@junghanacs/entwurf 0.30.1 → 0.32.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +4 -2
- package/CHANGELOG.md +194 -0
- package/DELIVERY.md +1 -0
- package/README.md +64 -14
- package/VERIFY.md +36 -1
- package/demo/README.md +1 -1
- package/docs/acp-backend-rail.md +1 -1
- package/docs/setup-clean-host.md +121 -4
- package/mcp/entwurf-bridge/dist/mcp/entwurf-bridge/src/index.js +7 -7
- package/mcp/entwurf-bridge/dist/pi-extensions/entwurf-capabilities.json +1 -0
- package/mcp/entwurf-bridge/dist/pi-extensions/lib/entwurf-deliverability.js +7 -1
- package/mcp/entwurf-bridge/dist/pi-extensions/lib/fresh-call-composition.js +34 -3
- package/mcp/entwurf-bridge/dist/pi-extensions/lib/meta-sender-identity.js +7 -1
- package/mcp/entwurf-bridge/dist/pi-extensions/lib/meta-session.js +28 -2
- package/mcp/entwurf-bridge/dist/pi-extensions/lib/mux-fresh-call.js +28 -2
- package/mcp/entwurf-bridge/dist/pi-extensions/lib/pi-durable-fresh-preflight.js +92 -0
- package/mcp/entwurf-bridge/dist/pi-extensions/lib/pi-durable-runtime.js +236 -0
- package/mcp/entwurf-bridge/dist/pi-extensions/meta-bridge-pi-durable.js +746 -0
- package/mcp/entwurf-bridge/src/index.ts +7 -7
- package/mcp/entwurf-bridge/tsconfig.build.json +8 -1
- package/package.json +19 -19
- package/pi/entwurf-capabilities.json +1 -0
- package/pi/pi-durable/bootstrap.mjs +404 -0
- package/pi/pi-durable/carrier/LICENSE +21 -0
- package/pi/pi-durable/carrier/harness-setup.js +123 -0
- package/pi/pi-durable/carrier/prompt.js +74 -0
- package/pi/pi-durable/carrier/runtime.js +402 -0
- package/pi/pi-durable/carrier/sessions.js +56 -0
- package/pi/pi-durable/carrier/subagent.js +55 -0
- package/pi/pi-durable/carrier/tui.js +655 -0
- package/pi/pi-durable/carrier-relocation.mjs +160 -0
- package/pi/pi-durable/carrier-resolver.mjs +38 -0
- package/pi/pi-durable/overlay/runtime-contacts.patch +91 -0
- package/pi/pi-durable/overlay/upstream-pin.json +108 -0
- package/pi-extensions/lib/entwurf-deliverability.ts +7 -1
- package/pi-extensions/lib/fresh-call-composition.ts +42 -7
- package/pi-extensions/lib/meta-sender-identity.ts +7 -1
- package/pi-extensions/lib/meta-session.ts +28 -2
- package/pi-extensions/lib/mux-fresh-call.ts +32 -2
- package/pi-extensions/lib/pi-durable-fresh-preflight.ts +113 -0
- package/pi-extensions/lib/pi-durable-runtime.ts +318 -0
- package/pi-extensions/meta-bridge-pi-durable.ts +1024 -0
- package/run.sh +624 -184
- package/scripts/check-entwurf-bridge-pi-free.ts +7 -5
- package/scripts/check-fresh-call-dispatch.ts +18 -0
- package/scripts/check-gate-qualification.ts +87 -34
- package/scripts/check-herdr-activation.ts +5 -4
- package/scripts/check-pi-durable-contact.ts +767 -0
- package/scripts/check-pi-durable-receive.ts +1079 -0
- package/scripts/check-pi-durable-send.ts +1821 -0
- package/scripts/emit-pi-durable-carrier.ts +355 -0
- package/scripts/lib/mutation-qualify.ts +21 -45
- package/scripts/lib/pi-durable-fresh-live-receipts.ts +139 -0
- package/scripts/lib/pi-durable-operator-guard.ts +89 -0
- package/scripts/lib/pi-durable-r1.ts +100 -0
- package/scripts/lib/pi-durable-reap.ts +27 -0
- package/scripts/lib/pi-durable-receive.ts +137 -0
- package/scripts/lib/qualification-receipt.ts +7 -11
- package/scripts/mutants/control-send-receipt.json +1 -1
- package/scripts/mutants/copilot-birth.json +2 -2
- package/scripts/mutants/gate-qualification.json +13 -0
- package/scripts/mutants/meta-hook-session-switch.json +4 -2
- package/scripts/mutants/mux-fresh-call.json +69 -3
- package/scripts/mutants/omp-birth.json +2 -2
- package/scripts/mutants/omp-fresh.json +6 -4
- package/scripts/mutants/pack-install.json +3 -3
- package/scripts/mutants/pi-durable.json +723 -0
- package/scripts/mutants/pi-floor.json +24 -2
- package/scripts/pi-durable-contact-host.mjs +105 -0
- package/scripts/pi-durable-receive-host.mjs +127 -0
- package/scripts/pi-durable-send-host.mjs +284 -0
- package/scripts/smoke-herdr-raw-install-live.sh +1 -1
- package/scripts/smoke-pi-durable-fresh-live.ts +624 -0
- package/scripts/smoke-setup-verdict.sh +22 -3
- package/scripts/smoke-user-scope-citizen.sh +1 -1
- package/scripts/tsconfig.json +1 -0
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
|
|
2
|
+
import { Type } from "@earendil-works/pi-ai";
|
|
3
|
+
import {
|
|
4
|
+
AssistantEntry,
|
|
5
|
+
configure,
|
|
6
|
+
defineExtension,
|
|
7
|
+
defineTool,
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
} from "@earendil-works/pi-durable";
|
|
12
|
+
|
|
13
|
+
async function answerText(api , answer , context ) {
|
|
14
|
+
const entry = await api.commit((tx) => tx.entry(AssistantEntry, answer), context);
|
|
15
|
+
const message = entry?.model?.[0] ;
|
|
16
|
+
return message?.content.flatMap((content) => (content.type === "text" ? [content.text] : [])).join("") ?? "";
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* A foreground subagent: each call creates a child conversation owned by the call's task, runs the task there, and
|
|
21
|
+
* returns the child's answer. Aborting the call aborts the child. The child outlives the call, so the user can switch
|
|
22
|
+
* to it and keep talking.
|
|
23
|
+
*/
|
|
24
|
+
export const Subagent = defineExtension({
|
|
25
|
+
name: "subagent",
|
|
26
|
+
tools: [
|
|
27
|
+
defineTool({
|
|
28
|
+
name: "subagent",
|
|
29
|
+
description:
|
|
30
|
+
"Delegate a self-contained task to a subagent with the same tools and get its answer back. Give it everything it needs to know; it does not see this conversation.",
|
|
31
|
+
parameters: Type.Object({ task: Type.String({ description: "What the subagent should do" }) }),
|
|
32
|
+
// A rerun after a crash finds the child it created and the submission it made.
|
|
33
|
+
replay: "safe",
|
|
34
|
+
execute: async (args, api, context) => {
|
|
35
|
+
const child = await api.commit(async (tx) => {
|
|
36
|
+
const existing = (await tx.scanConversations({ ownerTaskId: api.taskId }, 1)).items[0];
|
|
37
|
+
if (existing !== undefined) return existing.id;
|
|
38
|
+
// Starts as a copy of this conversation's agent; without this extension it cannot delegate further.
|
|
39
|
+
const created = await tx.createConversation({ ownership: { kind: "task", taskId: api.taskId } });
|
|
40
|
+
await configure(tx, created.id, { extensions: { remove: [Subagent] } });
|
|
41
|
+
return created.id;
|
|
42
|
+
}, context);
|
|
43
|
+
await api.details({ conversationId: child }, context);
|
|
44
|
+
const handle = (await api.conversation(child, context)) ;
|
|
45
|
+
const request = { type: "input", content: args.task, requestId: `subagent:${api.taskId}` } ;
|
|
46
|
+
const settled = await (await handle.submit(request, context)).wait(context);
|
|
47
|
+
if (settled.status !== "done" || settled.type !== "input") {
|
|
48
|
+
throw new Error(`Subagent ${child} failed: ${settled.status}`);
|
|
49
|
+
}
|
|
50
|
+
const text = await answerText(api, settled.answer, context);
|
|
51
|
+
return { content: [{ type: "text", text }], details: { conversationId: child } };
|
|
52
|
+
},
|
|
53
|
+
}),
|
|
54
|
+
],
|
|
55
|
+
});
|