@junghanacs/entwurf 0.41.2 → 0.50.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.
Files changed (122) hide show
  1. package/AGENTS.md +4 -2
  2. package/BASELINE.md +110 -1
  3. package/CHANGELOG.md +328 -0
  4. package/CONTRIBUTING.md +1 -1
  5. package/ENTWURF-CLI.json +1229 -0
  6. package/ENTWURF.json +284 -0
  7. package/FAQ.md +4 -4
  8. package/README.md +125 -184
  9. package/VERIFY.md +2 -2
  10. package/docs/external-mcp-host.md +3 -3
  11. package/docs/setup-clean-host.md +37 -12
  12. package/mcp/entwurf-bridge/dist/ENTWURF.json +284 -0
  13. package/mcp/entwurf-bridge/dist/mcp/entwurf-bridge/src/index.js +46 -196
  14. package/mcp/entwurf-bridge/dist/pi-extensions/lib/agent-guidance.js +299 -0
  15. package/mcp/entwurf-bridge/dist/pi-extensions/lib/entwurf-v2-surface.js +21 -25
  16. package/mcp/entwurf-bridge/dist/pi-extensions/lib/entwurf-v2-visible-resume.js +498 -29
  17. package/mcp/entwurf-bridge/dist/pi-extensions/lib/fresh-call-dispatch.js +47 -10
  18. package/mcp/entwurf-bridge/dist/pi-extensions/lib/herdr-fresh-call.js +613 -33
  19. package/mcp/entwurf-bridge/dist/pi-extensions/lib/herdr-resume-call.js +497 -0
  20. package/mcp/entwurf-bridge/dist/pi-extensions/lib/meta-session.js +3 -1
  21. package/mcp/entwurf-bridge/dist/pi-extensions/lib/mux-fresh-call.js +23 -20
  22. package/mcp/entwurf-bridge/dist/pi-extensions/lib/mux-resume-call.js +68 -21
  23. package/mcp/entwurf-bridge/dist/pi-extensions/lib/pi-durable-fresh-preflight.js +7 -1
  24. package/mcp/entwurf-bridge/dist/pi-extensions/lib/pi-durable-location.js +347 -0
  25. package/mcp/entwurf-bridge/dist/pi-extensions/lib/pi-durable-owner-fence.js +1132 -0
  26. package/mcp/entwurf-bridge/dist/pi-extensions/lib/pi-durable-runtime.js +1 -0
  27. package/mcp/entwurf-bridge/dist/pi-extensions/lib/remote-pair-send.js +7 -4
  28. package/mcp/entwurf-bridge/dist/pi-extensions/lib/resume-launch-identity.js +18 -11
  29. package/mcp/entwurf-bridge/dist/pi-extensions/meta-bridge-pi-durable.js +53 -60
  30. package/mcp/entwurf-bridge/dist/scripts/herdr-rails.mjs +40 -7
  31. package/mcp/entwurf-bridge/dist/scripts/meta-bridge-fresh-cut.js +1 -27
  32. package/mcp/entwurf-bridge/dist/scripts/meta-bridge-prune.js +1 -1
  33. package/mcp/entwurf-bridge/dist/scripts/meta-facts.js +1 -1
  34. package/mcp/entwurf-bridge/dist/scripts/peer-facts.js +1 -1
  35. package/mcp/entwurf-bridge/src/index.ts +149 -327
  36. package/mcp/entwurf-bridge/tsconfig.build.json +7 -1
  37. package/native/win32-x64/manifest.json +1 -1
  38. package/package.json +8 -4
  39. package/pi/pi-durable/bootstrap.mjs +179 -6
  40. package/pi/pi-durable/carrier/runtime.js +108 -9
  41. package/pi/pi-durable/carrier/session-name.js +11 -0
  42. package/pi/pi-durable/carrier/sessions.js +96 -20
  43. package/pi/pi-durable/overlay/upstream-pin.json +11 -5
  44. package/pi-extensions/lib/agent-guidance.ts +341 -0
  45. package/pi-extensions/lib/entwurf-v2-surface.ts +25 -31
  46. package/pi-extensions/lib/entwurf-v2-visible-resume.ts +725 -54
  47. package/pi-extensions/lib/fresh-call-dispatch.ts +64 -12
  48. package/pi-extensions/lib/herdr-fresh-call.ts +919 -40
  49. package/pi-extensions/lib/herdr-resume-call.ts +810 -0
  50. package/pi-extensions/lib/meta-session.ts +13 -8
  51. package/pi-extensions/lib/mux-fresh-call.ts +23 -26
  52. package/pi-extensions/lib/mux-resume-call.ts +95 -23
  53. package/pi-extensions/lib/pi-durable-fresh-preflight.ts +9 -2
  54. package/pi-extensions/lib/pi-durable-location.ts +446 -0
  55. package/pi-extensions/lib/pi-durable-owner-fence.ts +1461 -0
  56. package/pi-extensions/lib/pi-durable-runtime.ts +4 -0
  57. package/pi-extensions/lib/remote-pair-send.ts +7 -4
  58. package/pi-extensions/lib/resume-launch-identity.ts +31 -12
  59. package/pi-extensions/meta-bridge-pi-durable.ts +52 -79
  60. package/run.sh +417 -654
  61. package/scripts/build-bridge.sh +10 -0
  62. package/scripts/check-capability-bundle-reach.ts +86 -0
  63. package/scripts/check-claude-launch.ts +341 -0
  64. package/scripts/check-entwurf-self-address.ts +3 -3
  65. package/scripts/check-entwurf-v2-surface.ts +94 -98
  66. package/scripts/check-fresh-call-dispatch.ts +70 -9
  67. package/scripts/check-fresh-cut-gate.sh +23 -9
  68. package/scripts/check-gate-qualification.ts +24 -17
  69. package/scripts/check-herdr-activation.ts +301 -23
  70. package/scripts/check-herdr-fresh-call.ts +161 -25
  71. package/scripts/check-herdr-plugin-build.ts +173 -1
  72. package/scripts/check-herdr-plugin.ts +28 -2
  73. package/scripts/check-herdr-runtime-bootstrap.ts +136 -0
  74. package/scripts/check-install-surface.ts +1236 -6
  75. package/scripts/check-meta-doctor-oracle.sh +1 -1
  76. package/scripts/check-meta-facts.ts +20 -1
  77. package/scripts/check-mux-resume-call.ts +48 -3
  78. package/scripts/check-peer-facts.ts +39 -2
  79. package/scripts/cli-help.mjs +222 -0
  80. package/scripts/dev-bin.sh +39 -2
  81. package/scripts/herdr-activation.mjs +28 -6
  82. package/scripts/herdr-operator-link.mjs +389 -0
  83. package/scripts/herdr-plugin-activate.mjs +5 -0
  84. package/scripts/herdr-plugin-deactivate.mjs +18 -5
  85. package/scripts/herdr-rails.mjs +43 -7
  86. package/scripts/herdr-runtime.mjs +27 -0
  87. package/scripts/meta-bridge-fresh-cut.ts +1 -27
  88. package/scripts/meta-bridge-prune.ts +1 -1
  89. package/scripts/meta-facts.ts +1 -1
  90. package/scripts/mutants/agent-guidance.json +160 -0
  91. package/scripts/mutants/bridge-boot-resume.json +6 -8
  92. package/scripts/mutants/capability-bundle-reach.json +124 -0
  93. package/scripts/mutants/claude-launch.json +142 -0
  94. package/scripts/mutants/cli-help-source.json +420 -0
  95. package/scripts/mutants/control-send-receipt.json +21 -4
  96. package/scripts/mutants/dev-gate-dispatch.json +109 -0
  97. package/scripts/mutants/fresh-call-dispatch.json +38 -2
  98. package/scripts/mutants/fresh-cut.json +15 -0
  99. package/scripts/mutants/herdr-activation.json +128 -0
  100. package/scripts/mutants/herdr-fresh-call.json +278 -5
  101. package/scripts/mutants/herdr-operator-link.json +318 -0
  102. package/scripts/mutants/herdr-plugin-build.json +55 -0
  103. package/scripts/mutants/herdr-plugin.json +17 -0
  104. package/scripts/mutants/herdr-resume-call.json +288 -0
  105. package/scripts/mutants/herdr-runtime-bootstrap.json +48 -0
  106. package/scripts/mutants/meta-facts.json +15 -0
  107. package/scripts/mutants/mux-fresh-call.json +14 -3
  108. package/scripts/mutants/mux-resume-call.json +89 -3
  109. package/scripts/mutants/peer-facts.json +15 -0
  110. package/scripts/mutants/pi-durable.json +996 -6
  111. package/scripts/mutants/remote-pair-send.json +21 -2
  112. package/scripts/mutants/self-address.json +10 -10
  113. package/scripts/mutants/source-install.json +35 -0
  114. package/scripts/mutants/v2-surface.json +50 -64
  115. package/scripts/mutants/v2-visible-resume.json +266 -6
  116. package/scripts/peer-facts.ts +1 -1
  117. package/scripts/smoke-agy-install-state.sh +66 -0
  118. package/scripts/smoke-meta-prune.sh +23 -0
  119. package/scripts/smoke-omp-fresh-live.ts +12 -3
  120. package/scripts/smoke-omp-receive-live.ts +7 -1
  121. package/scripts/smoke-pi-durable-fresh-live.ts +12 -2
  122. package/team.json.example +39 -0
@@ -18,6 +18,11 @@
18
18
  */
19
19
 
20
20
  import { basename } from "node:path";
21
+ import {
22
+ ENTWURF_DELIVERY_RESULT_CLAUSES,
23
+ ENTWURF_REJECT_HINTS,
24
+ ENTWURF_SLOTTED_REJECT_HINTS,
25
+ } from "./agent-guidance.ts";
21
26
  import type { SenderEnvelope } from "./entwurf-control-rpc.ts";
22
27
  import type { DispatchInput, EntwurfV2Mode } from "./entwurf-v2-decider.ts";
23
28
  import { makeProductionEntwurfV2Deps, type ProductionEntwurfV2Opts } from "./entwurf-v2-production.ts";
@@ -65,7 +70,9 @@ export function toDispatchInput(params: SurfaceEntwurfV2Params): DispatchInput {
65
70
  * Detour B (B-a) — actionable rendering of an honest reject. The decider is UNCHANGED:
66
71
  * a reject stays a reject (Hard Rule 3). This only appends a one-line "what to do instead"
67
72
  * to the reject TEXT, so an honest reject stops reading as "delivery impossible". Returns
68
- * undefined for rejects with no useful next step.
73
+ * undefined for rejects with no useful next step. Hint English is authored in root ENTWURF.json
74
+ * (#154); the reason switch stays here, and so do the record-less-socket slot value and its
75
+ * concatenation (#154 E1b).
69
76
  */
70
77
  export function actionableRejectHint(reason: string): string | undefined {
71
78
  switch (reason) {
@@ -74,13 +81,7 @@ export function actionableRejectHint(reason: string): string | undefined {
74
81
  // state — the citizen exists and is not running — matters more than ever now that
75
82
  // there is no verb behind it: a caller that reads "reject" as "wrong id" goes
76
83
  // looking in the wrong place.
77
- return (
78
- "this citizen's record is intact but its session is not running, and delivery has no way to wake it. " +
79
- "The resume that used to answer here launched a hidden background child and was withdrawn under the " +
80
- "visible-first rule; the visible same-id resume is the separate lifecycle verb entwurf_resume_call. " +
81
- "Only on an explicit operator request, use entwurf_resume_call {target} for Pi or Claude Code; " +
82
- "it submits no prompt. This capability hint is not permission to resume automatically."
83
- );
84
+ return ENTWURF_REJECT_HINTS["dormant-fire-forget-unsupported"];
84
85
  case "indeterminate-no-spawn":
85
86
  // The socket probe did not settle, so liveness is UNKNOWN — an unestablished probe
86
87
  // is not a measured death, and dispatching into it could double-deliver. Say
@@ -91,35 +92,27 @@ export function actionableRejectHint(reason: string): string | undefined {
91
92
  // (never dispatch into an indeterminate target), not a capability that still
92
93
  // exists. So the hint's job is to say plainly what did NOT happen: nothing
93
94
  // delivered, nothing started.
94
- return (
95
- "the control-socket probe was inconclusive, so the target's liveness is UNKNOWN — this is not a " +
96
- "measured death. NOTHING was delivered and NO process was started (the reason id keeps its frozen " +
97
- "'-no-spawn' wire spelling from an era when one could be; entwurf_v2 starts nothing on any rail). " +
98
- "Re-run entwurf_peers to re-probe; if it stays indeterminate, check for a stale socket file left at " +
99
- "that garden id by a session that died without cleaning up."
100
- );
95
+ return ENTWURF_REJECT_HINTS["indeterminate-no-spawn"];
101
96
  case "native-push-target-dead":
102
97
  // The adapter probe found no live native host serving this conversation/thread. Stays
103
98
  // backend-neutral: agy speaks conversations over an LS port, Codex threads over an
104
99
  // app-server socket, and this hint is read by callers of both.
105
- return "the native-push conversation/thread is not live — no native host (harness process or app-server) answered the probe for it. Re-open that conversation/thread in its own harness, then retry; there is nothing to inject into.";
100
+ return ENTWURF_REJECT_HINTS["native-push-target-dead"];
106
101
  case "native-push-probe-indeterminate":
107
102
  // Native host up, but nothing served this conversation/thread — inconclusive, not a
108
103
  // hard dead. Backend-neutral for the same reason as the dead cell above.
109
- return "the native host (harness process or app-server) is up, but nothing served this conversation/thread, so the probe is INCONCLUSIVE — not a measured death. Retry once it is loaded, or verify the conversation/thread id.";
104
+ return ENTWURF_REJECT_HINTS["native-push-probe-indeterminate"];
110
105
  case "native-push-paused":
111
106
  // #152: a policy refusal, not a liveness verdict — this dispatch probed and sent nothing.
112
- return "native-push for this backend is paused (#152): its language server refused entwurf's measured external calls for a missing CSRF token, so this dispatch probed and sent nothing. The citizen and its record are kept; reach it from inside its own harness instead.";
113
- case "record-less-socket":
107
+ return ENTWURF_REJECT_HINTS["native-push-paused"];
108
+ case "record-less-socket": {
114
109
  // #50 C4: name the true cause AND the fix — a bare socket is a diagnostic
115
- // state, not an addressable citizen (the record is the address).
116
- return (
117
- "a control socket exists at this garden id but NO meta-record claims it — the record is the " +
118
- "sole address authority, so a bare socket is not an addressable citizen. If a pre-record-era " +
119
- "resident owns that socket, restart it under the current runtime (session_start births its " +
120
- `record); if the store predates the current generation, quiesce and archive it with ` +
121
- `${FRESH_CUT_PRESCRIPTION}. A stale/forged socket should be removed.`
122
- );
110
+ // state, not an addressable citizen (the record is the address). The text on either
111
+ // side of the fix command is authored in root ENTWURF.json; the command itself stays
112
+ // with its owner (meta-session.ts), so the root file never copies it.
113
+ const hint = ENTWURF_SLOTTED_REJECT_HINTS["record-less-socket"];
114
+ return `${hint.beforeFreshCutPrescription}${FRESH_CUT_PRESCRIPTION}${hint.afterFreshCutPrescription}`;
115
+ }
123
116
  default:
124
117
  return undefined;
125
118
  }
@@ -221,17 +214,18 @@ export function renderEntwurfV2Result(result: EntwurfV2RunResult): EntwurfV2Surf
221
214
  // the same acceptance vocabulary the ordinary receipt uses is named here too — a
222
215
  // dirty lock is a reason to be MORE precise about what happened, not less, because
223
216
  // the operator is about to decide by hand whether anything needs re-sending.
217
+ // The two static clauses are authored in root ENTWURF.json (#154 E1a); this receipt's
218
+ // syntax, branches and slots stay here.
224
219
  const what =
225
220
  result.finalizedOutcome === "rejected"
226
- ? `rejected${result.finalizedRejectReason ? ` (${result.finalizedRejectReason})` : ""} — the receiver refused it; nothing was accepted`
221
+ ? `rejected${result.finalizedRejectReason ? ` (${result.finalizedRejectReason})` : ""} — ${ENTWURF_DELIVERY_RESULT_CLAUSES["finalized-rejected"]}`
227
222
  : `${result.finalizedBoundary ?? "mailbox-enqueued"}${
228
223
  result.finalizedMessagePath ? ` (enqueued ${basename(result.finalizedMessagePath)})` : ""
229
224
  }`;
230
225
  return {
231
226
  text:
232
- `entwurf_v2 ${result.transport} finalized as ${what}, and the lock is DIRTY ` +
233
- `(release failed) — do NOT retry, a re-send would double-deliver. Clear the lock by hand.` +
234
- `\n error: ${result.error}`,
227
+ `entwurf_v2 ${result.transport} finalized as ${what}, and ` +
228
+ `${ENTWURF_DELIVERY_RESULT_CLAUSES["dirty-lock"]}\n error: ${result.error}`,
235
229
  isError: true,
236
230
  };
237
231
  }