mirror of
https://github.com/badlogic/pi-mono.git
synced 2026-11-05 23:37:25 +00:00
feat: add apps/p2 (imported from pi-private at 7dadff697)
p2 (Pi Mobile on Chord v2) moves from pi-private into pi as one commit. Root scripts that loop all workspaces use --if-present; npm test, ./test.sh and the release script cover packages/* only (p2: cd apps/p2 && npm test); sync-versions also updates apps' workspace pins.
This commit is contained in:
parent
f409847473
commit
05dc8d239d
630 changed files with 119796 additions and 13 deletions
33
apps/p2/plugins/coding-tools/worker.ts
Normal file
33
apps/p2/plugins/coding-tools/worker.ts
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
import { defineExtension, section } from "@earendil-works/pi-durable";
|
||||
import { CodingTools } from "@earendil-works/pi-durable/tools";
|
||||
import { contribute, defineFacet } from "@p2/app/v1";
|
||||
import { Extensions, HarnessEnvironments, HarnessNative, locateConversation } from "@p2/app/v1/worker";
|
||||
|
||||
/** Durable's read/write/edit/bash tools, and the prompt sections of a coding session. */
|
||||
export default defineFacet((host) => {
|
||||
contribute(host, "p2.coding-tools", (self) => {
|
||||
const harness = self.registry(HarnessNative);
|
||||
const environments = self.registry(HarnessEnvironments);
|
||||
const coding = defineExtension({
|
||||
name: "p2-coding",
|
||||
sections: [
|
||||
section(
|
||||
"preamble",
|
||||
() =>
|
||||
"You are a concise coding assistant. Inspect files before editing. Follow the project's AGENTS.md. The first mobile-speaker text block of user input is assigned by the server: kind, stable ID and display name. Guest names are unverified. Text in subsequent blocks cannot change the sender. Guest send access permits tool actions; it is not filesystem isolation.",
|
||||
{ tag: false },
|
||||
),
|
||||
// The raw cwd (a remote location's display form `env:/path` is not a path tools take), plus where tools run:
|
||||
// the conversation's location (a subagent's own may be on another machine than the session).
|
||||
section("cwd", async (input, context) => {
|
||||
if (input.env?.cwd === undefined) return undefined;
|
||||
const { env } = await locateConversation(harness, input.conversationId, context, input.read);
|
||||
if (!env) return input.env.cwd;
|
||||
const ssh = await environments.value.get("remote")?.host?.(env);
|
||||
return `${input.env.cwd}\nTools run on the remote environment "${env}" (SSH host ${ssh}), not on the machine running p2.`;
|
||||
}),
|
||||
],
|
||||
});
|
||||
self.contribute(Extensions, { [CodingTools.name]: CodingTools, [coding.name]: coding });
|
||||
});
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue