@junghanacs/entwurf 0.12.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 +240 -0
- package/BASELINE.md +227 -0
- package/CHANGELOG.md +1210 -0
- package/CONTRIBUTING.md +63 -0
- package/DELIVERY.md +209 -0
- package/LICENSE +21 -0
- package/README.md +504 -0
- package/VERIFY.md +260 -0
- package/demo/README.md +188 -0
- package/demo/demo-baseline.sh +156 -0
- package/demo/demo.sh +183 -0
- package/docs/assets/entwurf-demo.gif +0 -0
- package/docs/assets/entwurf-doomemacs.gif +0 -0
- package/docs/assets/entwurf-entwurf.gif +0 -0
- package/docs/assets/entwurf-hero.jpg +0 -0
- package/docs/setup-clean-host.md +305 -0
- package/mcp/entwurf-bridge/src/index.ts +513 -0
- package/mcp/entwurf-bridge/start.sh +25 -0
- package/mcp/entwurf-bridge/test.sh +54 -0
- package/mcp/tsconfig.json +29 -0
- package/package.json +130 -0
- package/pi/entwurf-capabilities.json +9 -0
- package/pi/entwurf-targets.json +20 -0
- package/pi/meta-bridge/.claude-plugin/marketplace.json +12 -0
- package/pi/meta-bridge/entwurf-meta-receive/.claude-plugin/plugin.json +5 -0
- package/pi/meta-bridge/entwurf-meta-receive/hooks/hooks.json +50 -0
- package/pi/meta-bridge/entwurf-meta-receive/scripts/doorbell.sh +54 -0
- package/pi/settings.reference.json +43 -0
- package/pi/skill-plugin-example/.claude-plugin/plugin.json +4 -0
- package/pi/skill-plugin-example/skills/hello/SKILL.md +18 -0
- package/pi-extensions/acp-provider.ts +63 -0
- package/pi-extensions/entwurf-control.ts +1692 -0
- package/pi-extensions/lib/acp/acp-client.ts +90 -0
- package/pi-extensions/lib/acp/augment.ts +238 -0
- package/pi-extensions/lib/acp/backend-adapter.ts +319 -0
- package/pi-extensions/lib/acp/backend.ts +873 -0
- package/pi-extensions/lib/acp/config.ts +552 -0
- package/pi-extensions/lib/acp/context.ts +177 -0
- package/pi-extensions/lib/acp/engraving.ts +123 -0
- package/pi-extensions/lib/acp/event-mapper.ts +339 -0
- package/pi-extensions/lib/acp/models.ts +102 -0
- package/pi-extensions/lib/acp/overlay.ts +220 -0
- package/pi-extensions/lib/acp/prompts/engraving.md +1 -0
- package/pi-extensions/lib/acp/session-store.ts +418 -0
- package/pi-extensions/lib/acp/tool-surface.ts +184 -0
- package/pi-extensions/lib/entwurf-control-rpc.ts +208 -0
- package/pi-extensions/lib/entwurf-core.ts +2033 -0
- package/pi-extensions/lib/entwurf-deliverability.ts +123 -0
- package/pi-extensions/lib/entwurf-fact-provider.ts +158 -0
- package/pi-extensions/lib/entwurf-facts.ts +251 -0
- package/pi-extensions/lib/entwurf-mailbox-guard.ts +100 -0
- package/pi-extensions/lib/entwurf-peers-render.ts +154 -0
- package/pi-extensions/lib/entwurf-preflight.ts +247 -0
- package/pi-extensions/lib/entwurf-resume-args.ts +88 -0
- package/pi-extensions/lib/entwurf-self-address.ts +117 -0
- package/pi-extensions/lib/entwurf-v2-contract.ts +427 -0
- package/pi-extensions/lib/entwurf-v2-decider.ts +441 -0
- package/pi-extensions/lib/entwurf-v2-lock.ts +412 -0
- package/pi-extensions/lib/entwurf-v2-mailbox.ts +87 -0
- package/pi-extensions/lib/entwurf-v2-production.ts +326 -0
- package/pi-extensions/lib/entwurf-v2-release.ts +149 -0
- package/pi-extensions/lib/entwurf-v2-resume-marker.ts +34 -0
- package/pi-extensions/lib/entwurf-v2-runner.ts +196 -0
- package/pi-extensions/lib/entwurf-v2-send-fallback.ts +166 -0
- package/pi-extensions/lib/entwurf-v2-send.ts +271 -0
- package/pi-extensions/lib/entwurf-v2-spawn-production.ts +337 -0
- package/pi-extensions/lib/entwurf-v2-spawn.ts +323 -0
- package/pi-extensions/lib/entwurf-v2-surface.ts +205 -0
- package/pi-extensions/lib/meta-mailbox-body.ts +80 -0
- package/pi-extensions/lib/meta-session.ts +1951 -0
- package/pi-extensions/lib/project-trust-handler.ts +154 -0
- package/pi-extensions/lib/session-id.js +57 -0
- package/pi-extensions/lib/socket-discovery.ts +346 -0
- package/pi-extensions/lib/socket-probe.ts +92 -0
- package/pi-extensions/meta-bridge-hook.ts +250 -0
- package/pi-extensions/model-lock.ts +235 -0
- package/prompts/engraving.md +27 -0
- package/protocol.js +31 -0
- package/run.sh +2832 -0
- package/scripts/check-acp-backend-preflight.ts +130 -0
- package/scripts/check-acp-carrier-augment.ts +297 -0
- package/scripts/check-acp-config.ts +322 -0
- package/scripts/check-acp-event-mapper.ts +253 -0
- package/scripts/check-acp-overlay.ts +154 -0
- package/scripts/check-acp-prompt-builder.ts +191 -0
- package/scripts/check-acp-provider-surface.ts +159 -0
- package/scripts/check-acp-sdk-surface.ts +211 -0
- package/scripts/check-acp-session-reuse.ts +756 -0
- package/scripts/check-acp-session-store.ts +387 -0
- package/scripts/check-acp-tool-surface.ts +159 -0
- package/scripts/check-entwurf-bridge-boot.ts +199 -0
- package/scripts/check-entwurf-capabilities.ts +123 -0
- package/scripts/check-entwurf-control-rpc.ts +187 -0
- package/scripts/check-entwurf-deliverability.ts +158 -0
- package/scripts/check-entwurf-fact-provider.ts +316 -0
- package/scripts/check-entwurf-facts.ts +358 -0
- package/scripts/check-entwurf-mailbox-guard.ts +264 -0
- package/scripts/check-entwurf-peers-surface.ts +235 -0
- package/scripts/check-entwurf-resume-args.ts +149 -0
- package/scripts/check-entwurf-self-address.ts +209 -0
- package/scripts/check-entwurf-session-identity.ts +703 -0
- package/scripts/check-entwurf-v2-contract.ts +536 -0
- package/scripts/check-entwurf-v2-decider.ts +795 -0
- package/scripts/check-entwurf-v2-lock.ts +368 -0
- package/scripts/check-entwurf-v2-mailbox.ts +228 -0
- package/scripts/check-entwurf-v2-matrix.ts +437 -0
- package/scripts/check-entwurf-v2-production.ts +406 -0
- package/scripts/check-entwurf-v2-release.ts +245 -0
- package/scripts/check-entwurf-v2-runner.ts +452 -0
- package/scripts/check-entwurf-v2-send-fallback.ts +371 -0
- package/scripts/check-entwurf-v2-send.ts +454 -0
- package/scripts/check-entwurf-v2-spawn-production.ts +452 -0
- package/scripts/check-entwurf-v2-spawn.ts +398 -0
- package/scripts/check-entwurf-v2-surface.ts +352 -0
- package/scripts/check-keyset-overlap.py +120 -0
- package/scripts/check-mailbox-receipt-state.ts +170 -0
- package/scripts/check-meta-capability-source.ts +112 -0
- package/scripts/check-meta-dual-consumers.ts +154 -0
- package/scripts/check-meta-dual-read.ts +158 -0
- package/scripts/check-meta-listing.ts +138 -0
- package/scripts/check-meta-mailbox-state-write.ts +135 -0
- package/scripts/check-meta-migration.ts +212 -0
- package/scripts/check-meta-receiver-marker.ts +185 -0
- package/scripts/check-meta-record-v2.ts +191 -0
- package/scripts/check-meta-session.ts +673 -0
- package/scripts/check-model-lock.ts +408 -0
- package/scripts/check-package-source-routing.ts +253 -0
- package/scripts/check-pi-preflight.ts +304 -0
- package/scripts/check-project-trust-handler.ts +265 -0
- package/scripts/check-shell-quote.ts +121 -0
- package/scripts/check-socket-discovery.ts +428 -0
- package/scripts/check-socket-probe.ts +106 -0
- package/scripts/fixtures/probe-mcp-server.ts +33 -0
- package/scripts/gnew-rpc-drive.ts +211 -0
- package/scripts/lib/acp-child-cleanup.ts +116 -0
- package/scripts/meta-bridge-doctor.sh +315 -0
- package/scripts/meta-bridge-hook-log.sh +26 -0
- package/scripts/meta-bridge-install.sh +135 -0
- package/scripts/meta-bridge-prune.ts +199 -0
- package/scripts/meta-bridge-state.py +549 -0
- package/scripts/meta-bridge-statusline.sh +192 -0
- package/scripts/meta-bridge-store-doctor.ts +64 -0
- package/scripts/meta-bridge-uninstall.sh +39 -0
- package/scripts/new-session-id.ts +25 -0
- package/scripts/postinstall-chmod.cjs +58 -0
- package/scripts/raw-async-delivery/README.md +258 -0
- package/scripts/raw-async-delivery/cc-enqueue-addressed.sh +35 -0
- package/scripts/raw-async-delivery/cc-mailbox-rewake.sh +38 -0
- package/scripts/raw-async-delivery/cc-watch-filechanged.sh +19 -0
- package/scripts/raw-async-delivery/cc-watch-sessionstart.sh +15 -0
- package/scripts/raw-async-delivery/codex-local-appserver.sh +39 -0
- package/scripts/raw-async-delivery/plugin-entwurf-receive/.claude-plugin/plugin.json +5 -0
- package/scripts/raw-async-delivery/plugin-entwurf-receive/hooks/hooks.json +28 -0
- package/scripts/raw-async-delivery/plugin-entwurf-receive/scripts/watch-filechanged.sh +28 -0
- package/scripts/raw-async-delivery/plugin-entwurf-receive/scripts/watch-sessionstart.sh +27 -0
- package/scripts/raw-async-delivery/raw-agy-send.sh +29 -0
- package/scripts/raw-async-delivery/raw-claude-enqueue.sh +30 -0
- package/scripts/raw-async-delivery/raw-codex-ws-turn-start.py +164 -0
- package/scripts/raw-async-delivery/repro-addressed-routing.sh +96 -0
- package/scripts/raw-async-delivery/repro-plugin-idle-wake.sh +104 -0
- package/scripts/resolve-acp-bridge.ts +25 -0
- package/scripts/smoke-acp-bundled-mcp-live.ts +292 -0
- package/scripts/smoke-acp-carrier-augment-live.ts +192 -0
- package/scripts/smoke-acp-mcp-live.ts +129 -0
- package/scripts/smoke-acp-memory-containment-live.ts +389 -0
- package/scripts/smoke-acp-overlay-live.ts +314 -0
- package/scripts/smoke-acp-provider-live.ts +162 -0
- package/scripts/smoke-acp-raw-turn-live.ts +261 -0
- package/scripts/smoke-acp-session-reuse-live.ts +172 -0
- package/scripts/smoke-acp-skill-live.ts +144 -0
- package/scripts/smoke-acp-socket-citizen-live.ts +168 -0
- package/scripts/smoke-claude-native-resume-live.sh +198 -0
- package/scripts/smoke-entwurf-v2-matrix-live.ts +398 -0
- package/scripts/smoke-entwurf-v2-spawn-live.ts +175 -0
- package/scripts/smoke-entwurf-v2-spawn-resume-live.ts +428 -0
- package/scripts/smoke-meta-async-drift.sh +171 -0
- package/scripts/smoke-meta-honesty.sh +147 -0
- package/scripts/smoke-meta-install-state.sh +403 -0
- package/scripts/smoke-meta-keyset-guard.sh +111 -0
- package/scripts/smoke-meta-prune.sh +174 -0
- package/scripts/smoke-resident-garden-guard.sh +433 -0
- package/scripts/smoke-session-id-name.ts +187 -0
- package/scripts/tsconfig.json +34 -0
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* check-entwurf-self-address — deterministic gate for the self-addressability
|
|
3
|
+
* honesty predicate (SE-1/SE-2 slice 1). Guards the bug where the MCP bridge and
|
|
4
|
+
* pi-native claim `replyable: true` purely from env presence: a pi session with no
|
|
5
|
+
* --entwurf-control socket, or a meta citizen whose owner exited / whose idle-watch
|
|
6
|
+
* was never armed, all advertised replyable while delivery silently failed (SE-1).
|
|
7
|
+
*
|
|
8
|
+
* Proves:
|
|
9
|
+
* - PURE truth table (computeSelfAddressability, facts injected): pi replyable ⟺
|
|
10
|
+
* socketAlive; meta replyable ⟺ recordBacked ∧ ownerAlive ∧ watchArmed; external
|
|
11
|
+
* never replyable. socketState alive/expected/none is its own assertable field.
|
|
12
|
+
* - The two REGRESSION-PROOF rows the lock requires (record-present, not all-absent):
|
|
13
|
+
* (b) meta record present + owner-dead (start-key mismatch) → false
|
|
14
|
+
* (c) meta record present + watch-unarmed → false
|
|
15
|
+
* These stay meaningful after slice 3 mints pi/meta records, where an
|
|
16
|
+
* "everything absent → false" row would silently go green.
|
|
17
|
+
* - SOURCE GUARD (the regression this gate exists for): buildStrictPiSenderEnvelope
|
|
18
|
+
* no longer hardcodes `replyable: true` in its pi-session envelope — it derives
|
|
19
|
+
* replyable from computeSelfAddressability over a real existsSync socket probe;
|
|
20
|
+
* entwurf_self renders the socket as alive vs expected (no synthesized path lie).
|
|
21
|
+
*
|
|
22
|
+
* v1/v2 contract (pin so it is not later misread): the slice-1 goal is "neither
|
|
23
|
+
* surface CLAIMS a false replyable", NOT "both surfaces reject". The now-removed v1
|
|
24
|
+
* entwurf_send rejected wants_reply=true from a non-replyable sender (no reply
|
|
25
|
+
* address); v2 entwurf_v2 passes wants_reply through as an etiquette payload and
|
|
26
|
+
* surfaces the envelope's honest replyable:false. Both stopped lying about
|
|
27
|
+
* replyability; only v1 also hard-rejected. They shared ONE builder, so the honesty
|
|
28
|
+
* fix landed in both at once.
|
|
29
|
+
*
|
|
30
|
+
* Slice boundary: meta-self's watchArmed FACT is wired from the slice-2 meta-receiver
|
|
31
|
+
* presence marker; the predicate already demands it here (fail-closed). Slices 1 and
|
|
32
|
+
* 2 closed in the same release block. The pi-NATIVE surface (entwurf-control.ts
|
|
33
|
+
* senderProvider/fallback) no longer hardcodes replyable:true — it derives replyable
|
|
34
|
+
* from computeSelfAddressability + a canonical-socket existsSync probe, pinned by
|
|
35
|
+
* check-entwurf-v2-surface and this gate's own pi-native source check.
|
|
36
|
+
*/
|
|
37
|
+
|
|
38
|
+
import assert from "node:assert/strict";
|
|
39
|
+
import { readFileSync } from "node:fs";
|
|
40
|
+
import * as path from "node:path";
|
|
41
|
+
import { fileURLToPath } from "node:url";
|
|
42
|
+
import {
|
|
43
|
+
computeSelfAddressability,
|
|
44
|
+
type SelfAddressabilityFacts,
|
|
45
|
+
type SocketState,
|
|
46
|
+
} from "../pi-extensions/lib/entwurf-self-address.ts";
|
|
47
|
+
|
|
48
|
+
let passed = 0;
|
|
49
|
+
function ok(label: string, cond: boolean): void {
|
|
50
|
+
assert.ok(cond, label);
|
|
51
|
+
console.log(` ok ${label}`);
|
|
52
|
+
passed++;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
const REPO_DIR = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..");
|
|
56
|
+
|
|
57
|
+
// ── PURE truth table ────────────────────────────────────────────────────────
|
|
58
|
+
function row(facts: SelfAddressabilityFacts): { replyable: boolean; socketState: SocketState } {
|
|
59
|
+
const r = computeSelfAddressability(facts);
|
|
60
|
+
return { replyable: r.replyable, socketState: r.socketState };
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
// pi-session axis: replyable ⟺ a live control socket.
|
|
64
|
+
{
|
|
65
|
+
const alive = row({ origin: "pi-session", socketAlive: true, socketPathComputable: true });
|
|
66
|
+
ok("pi + socket alive → replyable", alive.replyable === true);
|
|
67
|
+
ok("pi + socket alive → socketState alive", alive.socketState === "alive");
|
|
68
|
+
|
|
69
|
+
// SE-1 CORE: a pi session with PI_SESSION_ID but NO --entwurf-control socket.
|
|
70
|
+
const expected = row({ origin: "pi-session", socketAlive: false, socketPathComputable: true });
|
|
71
|
+
ok("pi + socket absent (path computable) → NOT replyable", expected.replyable === false);
|
|
72
|
+
ok("pi + socket absent → socketState expected (not a synthesized 'alive' lie)", expected.socketState === "expected");
|
|
73
|
+
|
|
74
|
+
// No session id at all → cannot even compute a path. Distinct from 'expected'.
|
|
75
|
+
const none = row({ origin: "pi-session", socketAlive: false, socketPathComputable: false });
|
|
76
|
+
ok("pi + no session id → NOT replyable", none.replyable === false);
|
|
77
|
+
ok("pi + no session id → socketState none", none.socketState === "none");
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
// meta-session axis: 3-conjunct deliverability (recordBacked ∧ ownerAlive ∧ watchArmed).
|
|
81
|
+
{
|
|
82
|
+
const full = row({ origin: "meta-session", recordBacked: true, ownerAlive: true, watchArmed: true });
|
|
83
|
+
ok("meta + record + owner-alive + watch-armed → replyable", full.replyable === true);
|
|
84
|
+
|
|
85
|
+
// (b) REGRESSION-PROOF row: record PRESENT but owner dead.
|
|
86
|
+
const ownerDead = row({ origin: "meta-session", recordBacked: true, ownerAlive: false, watchArmed: true });
|
|
87
|
+
ok("meta + record present + owner-dead (start-key mismatch) → NOT replyable", ownerDead.replyable === false);
|
|
88
|
+
|
|
89
|
+
// (c) REGRESSION-PROOF row: record + owner present but watch never armed.
|
|
90
|
+
const watchUnarmed = row({ origin: "meta-session", recordBacked: true, ownerAlive: true, watchArmed: false });
|
|
91
|
+
ok("meta + record present + owner-alive + watch-unarmed → NOT replyable", watchUnarmed.replyable === false);
|
|
92
|
+
|
|
93
|
+
// not backed by a record at all → false (the all-absent baseline; weakest row).
|
|
94
|
+
const unbacked = row({ origin: "meta-session", recordBacked: false, ownerAlive: false, watchArmed: false });
|
|
95
|
+
ok("meta + no backing record → NOT replyable", unbacked.replyable === false);
|
|
96
|
+
|
|
97
|
+
// fail-closed on missing axes (undefined treated as false, never optimistic).
|
|
98
|
+
const partial = row({ origin: "meta-session", recordBacked: true });
|
|
99
|
+
ok("meta + record but undefined owner/watch → fail-closed NOT replyable", partial.replyable === false);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
// external-mcp: never replyable.
|
|
103
|
+
{
|
|
104
|
+
const ext = row({ origin: "external-mcp" });
|
|
105
|
+
ok("external-mcp → NOT replyable", ext.replyable === false);
|
|
106
|
+
ok("external-mcp → socketState none", ext.socketState === "none");
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
// ── SOURCE GUARD: the MCP builders consume the predicate, no hardcoded lie ────
|
|
110
|
+
const indexPath = path.join(REPO_DIR, "mcp", "entwurf-bridge", "src", "index.ts");
|
|
111
|
+
const src = readFileSync(indexPath, "utf8");
|
|
112
|
+
|
|
113
|
+
/** Extract a top-level `function NAME(...) { ... }` body by brace-counting. */
|
|
114
|
+
function functionBody(name: string): string {
|
|
115
|
+
const sig = `function ${name}(`;
|
|
116
|
+
const at = src.indexOf(sig);
|
|
117
|
+
assert.ok(at >= 0, `${name} present in MCP source`);
|
|
118
|
+
const open = src.indexOf("{", at);
|
|
119
|
+
assert.ok(open >= 0, `${name} has a body`);
|
|
120
|
+
let depth = 0;
|
|
121
|
+
for (let i = open; i < src.length; i++) {
|
|
122
|
+
const c = src[i];
|
|
123
|
+
if (c === "{") depth++;
|
|
124
|
+
else if (c === "}") {
|
|
125
|
+
depth--;
|
|
126
|
+
if (depth === 0) return src.slice(open, i + 1);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
throw new Error(`${name} body never closed`);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/** Extract a `server.tool("NAME", ...)` call region by brace-counting from its open paren. */
|
|
133
|
+
function toolRegion(name: string): string {
|
|
134
|
+
const sig = `server.tool(\n\t"${name}"`;
|
|
135
|
+
const at = src.indexOf(sig);
|
|
136
|
+
assert.ok(at >= 0, `server.tool("${name}") present`);
|
|
137
|
+
const open = src.indexOf("(", at);
|
|
138
|
+
let depth = 0;
|
|
139
|
+
for (let i = open; i < src.length; i++) {
|
|
140
|
+
const c = src[i];
|
|
141
|
+
if (c === "(") depth++;
|
|
142
|
+
else if (c === ")") {
|
|
143
|
+
depth--;
|
|
144
|
+
if (depth === 0) return src.slice(open, i + 1);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
throw new Error(`server.tool("${name}") region never closed`);
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
ok(
|
|
151
|
+
"MCP imports computeSelfAddressability from the shared lib",
|
|
152
|
+
/computeSelfAddressability/.test(src) && /entwurf-self-address\.ts/.test(src),
|
|
153
|
+
);
|
|
154
|
+
|
|
155
|
+
const piBody = functionBody("buildStrictPiSenderEnvelope");
|
|
156
|
+
ok("buildStrictPiSenderEnvelope calls computeSelfAddressability", /computeSelfAddressability\s*\(/.test(piBody));
|
|
157
|
+
// Scoped to THIS function body (not a broad grep): the pi-session envelope must NOT
|
|
158
|
+
// hardcode `replyable: true`; it must derive from the predicate result.
|
|
159
|
+
ok("buildStrictPiSenderEnvelope no longer hardcodes `replyable: true`", !/replyable:\s*true/.test(piBody));
|
|
160
|
+
// existsSync alone is too loose — pin that it probes the CANONICAL socket path
|
|
161
|
+
// (ENTWURF_DIR + sessionId + SOCKET_SUFFIX), not some other file, so the honesty
|
|
162
|
+
// signal cannot drift to a path that does not represent this session's socket.
|
|
163
|
+
ok(
|
|
164
|
+
"buildStrictPiSenderEnvelope existsSync-probes the canonical socket (ENTWURF_DIR + sessionId + SOCKET_SUFFIX)",
|
|
165
|
+
/existsSync\s*\(/.test(piBody) && /ENTWURF_DIR/.test(piBody) && /SOCKET_SUFFIX/.test(piBody),
|
|
166
|
+
);
|
|
167
|
+
|
|
168
|
+
const selfRegion = toolRegion("entwurf_self");
|
|
169
|
+
ok(
|
|
170
|
+
"entwurf_self existsSync-probes the pi socket (alive vs expected, no synthesized path lie)",
|
|
171
|
+
/existsSync\s*\(/.test(selfRegion),
|
|
172
|
+
);
|
|
173
|
+
|
|
174
|
+
// ── SE-2 2e-b: meta-session sender replyability from the receiver presence marker ──
|
|
175
|
+
// Identity stays trusted (record-backed), but `replyable` is now derived from whether
|
|
176
|
+
// THIS session's own receiver inbox can actually wake (slice-2 presence marker), not a
|
|
177
|
+
// hardcoded true. An inactive receiver must still return the meta identity (replyable:false)
|
|
178
|
+
// — degrading to null would erase who-sent and fall through to external-mcp.
|
|
179
|
+
const metaBody = functionBody("buildTrustedMetaSenderEnvelope");
|
|
180
|
+
ok("buildTrustedMetaSenderEnvelope calls computeSelfAddressability", /computeSelfAddressability\s*\(/.test(metaBody));
|
|
181
|
+
ok("buildTrustedMetaSenderEnvelope no longer hardcodes `replyable: true`", !/replyable:\s*true/.test(metaBody));
|
|
182
|
+
ok(
|
|
183
|
+
"buildTrustedMetaSenderEnvelope derives active-receiver from the receiver marker (identity-matched)",
|
|
184
|
+
/readMetaReceiverMarker\s*\(/.test(metaBody) && /receiverMarkerMatchesIdentity\s*\(/.test(metaBody),
|
|
185
|
+
);
|
|
186
|
+
ok(
|
|
187
|
+
"buildTrustedMetaSenderEnvelope keeps meta identity + derived replyable (inactive → not null)",
|
|
188
|
+
/origin:\s*"meta-session"/.test(metaBody) && /replyable:\s*self\.replyable/.test(metaBody),
|
|
189
|
+
);
|
|
190
|
+
|
|
191
|
+
// ── SE-1 2e-a: pi-native surface derives pi-session replyability the SAME way ──
|
|
192
|
+
// entwurf-control.ts is a root-tsc emit surface, so it reaches the self-address fence via a
|
|
193
|
+
// non-literal dynamic import (never a static `.ts` import — TS5097), then decorates the
|
|
194
|
+
// sender with computeSelfAddressability + canonical socket existsSync (no hardcoded true).
|
|
195
|
+
const nativeSrc = readFileSync(path.join(REPO_DIR, "pi-extensions", "entwurf-control.ts"), "utf8");
|
|
196
|
+
ok(
|
|
197
|
+
"pi-native: decoratePiSenderAddressability derives replyable from computeSelfAddressability + canonical existsSync",
|
|
198
|
+
/function\s+decoratePiSenderAddressability/.test(nativeSrc) &&
|
|
199
|
+
/computeSelfAddressability/.test(nativeSrc) &&
|
|
200
|
+
/existsSync\s*\(\s*getSocketPath/.test(nativeSrc),
|
|
201
|
+
);
|
|
202
|
+
ok(
|
|
203
|
+
"pi-native: reaches the self-address fence via non-literal dynamic import (no static import; TS5097)",
|
|
204
|
+
/const ENTWURF_SELF_ADDRESS_MODULE\s*=/.test(nativeSrc) &&
|
|
205
|
+
/await import\(ENTWURF_SELF_ADDRESS_MODULE\)/.test(nativeSrc) &&
|
|
206
|
+
!/import[^;]*from\s*"\.\/lib\/entwurf-self-address\.(js|ts)"/.test(nativeSrc),
|
|
207
|
+
);
|
|
208
|
+
|
|
209
|
+
console.log(`\ncheck-entwurf-self-address: ${passed} checks passed`);
|