@vibefield/puppeteer-imposter 0.0.0-stage → 0.2.1
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/LICENSE +21 -0
- package/bin/ai.mjs +17 -0
- package/dist/cli/argv.d.ts +40 -0
- package/dist/cli/argv.d.ts.map +1 -0
- package/dist/cli/argv.js +62 -0
- package/dist/cli/argv.js.map +1 -0
- package/dist/cli/http-persona.d.ts +15 -0
- package/dist/cli/http-persona.d.ts.map +1 -0
- package/dist/cli/http-persona.js +216 -0
- package/dist/cli/http-persona.js.map +1 -0
- package/dist/cli/main.d.ts +11 -0
- package/dist/cli/main.d.ts.map +1 -0
- package/dist/cli/main.js +671 -0
- package/dist/cli/main.js.map +1 -0
- package/dist/cli/prompt-line.d.ts +27 -0
- package/dist/cli/prompt-line.d.ts.map +1 -0
- package/dist/cli/prompt-line.js +93 -0
- package/dist/cli/prompt-line.js.map +1 -0
- package/dist/control/client.d.ts +51 -0
- package/dist/control/client.d.ts.map +1 -0
- package/dist/control/client.js +206 -0
- package/dist/control/client.js.map +1 -0
- package/dist/control/index.d.ts +10 -0
- package/dist/control/index.d.ts.map +1 -0
- package/dist/control/index.js +10 -0
- package/dist/control/index.js.map +1 -0
- package/dist/control/peer.d.ts +42 -0
- package/dist/control/peer.d.ts.map +1 -0
- package/dist/control/peer.js +174 -0
- package/dist/control/peer.js.map +1 -0
- package/dist/control/protocol.d.ts +207 -0
- package/dist/control/protocol.d.ts.map +1 -0
- package/dist/control/protocol.js +535 -0
- package/dist/control/protocol.js.map +1 -0
- package/dist/index.d.ts +36 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +36 -0
- package/dist/index.js.map +1 -0
- package/dist/persona/launch.d.ts +7 -0
- package/dist/persona/launch.d.ts.map +1 -0
- package/dist/persona/launch.js +26 -0
- package/dist/persona/launch.js.map +1 -0
- package/dist/persona/load.d.ts +28 -0
- package/dist/persona/load.d.ts.map +1 -0
- package/dist/persona/load.js +705 -0
- package/dist/persona/load.js.map +1 -0
- package/dist/persona/session-id.d.ts +4 -0
- package/dist/persona/session-id.d.ts.map +1 -0
- package/dist/persona/session-id.js +12 -0
- package/dist/persona/session-id.js.map +1 -0
- package/dist/persona/types.d.ts +265 -0
- package/dist/persona/types.d.ts.map +1 -0
- package/dist/persona/types.js +38 -0
- package/dist/persona/types.js.map +1 -0
- package/dist/session/channels/hook.d.ts +31 -0
- package/dist/session/channels/hook.d.ts.map +1 -0
- package/dist/session/channels/hook.js +114 -0
- package/dist/session/channels/hook.js.map +1 -0
- package/dist/session/channels/http-sse.d.ts +67 -0
- package/dist/session/channels/http-sse.d.ts.map +1 -0
- package/dist/session/channels/http-sse.js +212 -0
- package/dist/session/channels/http-sse.js.map +1 -0
- package/dist/session/channels/jsonrpc.d.ts +56 -0
- package/dist/session/channels/jsonrpc.d.ts.map +1 -0
- package/dist/session/channels/jsonrpc.js +196 -0
- package/dist/session/channels/jsonrpc.js.map +1 -0
- package/dist/session/channels/leader-ipc.d.ts +27 -0
- package/dist/session/channels/leader-ipc.d.ts.map +1 -0
- package/dist/session/channels/leader-ipc.js +314 -0
- package/dist/session/channels/leader-ipc.js.map +1 -0
- package/dist/session/channels/native-store.d.ts +31 -0
- package/dist/session/channels/native-store.d.ts.map +1 -0
- package/dist/session/channels/native-store.js +275 -0
- package/dist/session/channels/native-store.js.map +1 -0
- package/dist/session/channels/statusline.d.ts +20 -0
- package/dist/session/channels/statusline.d.ts.map +1 -0
- package/dist/session/channels/statusline.js +48 -0
- package/dist/session/channels/statusline.js.map +1 -0
- package/dist/session/channels/terminal.d.ts +27 -0
- package/dist/session/channels/terminal.d.ts.map +1 -0
- package/dist/session/channels/terminal.js +108 -0
- package/dist/session/channels/terminal.js.map +1 -0
- package/dist/session/channels/transcript.d.ts +16 -0
- package/dist/session/channels/transcript.d.ts.map +1 -0
- package/dist/session/channels/transcript.js +24 -0
- package/dist/session/channels/transcript.js.map +1 -0
- package/dist/session/channels/ws-unix.d.ts +57 -0
- package/dist/session/channels/ws-unix.d.ts.map +1 -0
- package/dist/session/channels/ws-unix.js +396 -0
- package/dist/session/channels/ws-unix.js.map +1 -0
- package/dist/session/http-session-server.d.ts +31 -0
- package/dist/session/http-session-server.d.ts.map +1 -0
- package/dist/session/http-session-server.js +508 -0
- package/dist/session/http-session-server.js.map +1 -0
- package/dist/session/scenario-driver.d.ts +105 -0
- package/dist/session/scenario-driver.d.ts.map +1 -0
- package/dist/session/scenario-driver.js +211 -0
- package/dist/session/scenario-driver.js.map +1 -0
- package/dist/session/scenario.d.ts +119 -0
- package/dist/session/scenario.d.ts.map +1 -0
- package/dist/session/scenario.js +299 -0
- package/dist/session/scenario.js.map +1 -0
- package/dist/session/serve.d.ts +124 -0
- package/dist/session/serve.d.ts.map +1 -0
- package/dist/session/serve.js +136 -0
- package/dist/session/serve.js.map +1 -0
- package/dist/session/session.d.ts +125 -0
- package/dist/session/session.d.ts.map +1 -0
- package/dist/session/session.js +781 -0
- package/dist/session/session.js.map +1 -0
- package/dist/session/template.d.ts +35 -0
- package/dist/session/template.d.ts.map +1 -0
- package/dist/session/template.js +133 -0
- package/dist/session/template.js.map +1 -0
- package/dist/session/timeline.d.ts +81 -0
- package/dist/session/timeline.d.ts.map +1 -0
- package/dist/session/timeline.js +155 -0
- package/dist/session/timeline.js.map +1 -0
- package/dist/tui/app.d.ts +30 -0
- package/dist/tui/app.d.ts.map +1 -0
- package/dist/tui/app.js +72 -0
- package/dist/tui/app.js.map +1 -0
- package/dist/tui/mount.d.ts +37 -0
- package/dist/tui/mount.d.ts.map +1 -0
- package/dist/tui/mount.js +88 -0
- package/dist/tui/mount.js.map +1 -0
- package/dist/tui/store.d.ts +38 -0
- package/dist/tui/store.d.ts.map +1 -0
- package/dist/tui/store.js +56 -0
- package/dist/tui/store.js.map +1 -0
- package/dist/tui/theme.d.ts +40 -0
- package/dist/tui/theme.d.ts.map +1 -0
- package/dist/tui/theme.js +54 -0
- package/dist/tui/theme.js.map +1 -0
- package/package.json +67 -3
- package/personas/antigravity/behavior/happy-turn.json +9 -0
- package/personas/antigravity/ops.json +14 -0
- package/personas/antigravity/persona.json +15 -0
- package/personas/antigravity/runflows.json +6 -0
- package/personas/antigravity/scenarios/happy-turn.json +25 -0
- package/personas/claude/behavior/happy-turn.json +19 -0
- package/personas/claude/ops.json +128 -0
- package/personas/claude/persona.json +29 -0
- package/personas/claude/runflows.json +45 -0
- package/personas/claude/scenarios/channel-disconnect.json +19 -0
- package/personas/claude/scenarios/crash-mid-turn.json +42 -0
- package/personas/claude/scenarios/cross-layer-implementation.json +488 -0
- package/personas/claude/scenarios/deep-research.json +494 -0
- package/personas/claude/scenarios/duplicate-out-of-order.json +57 -0
- package/personas/claude/scenarios/flood.json +11 -0
- package/personas/claude/scenarios/happy-turn.json +57 -0
- package/personas/claude/scenarios/incident-investigation.json +465 -0
- package/personas/claude/scenarios/late-after-exit.json +27 -0
- package/personas/claude/scenarios/permission-allow.json +55 -0
- package/personas/claude/scenarios/permission-deny.json +71 -0
- package/personas/claude/scenarios/token-usage-refresh.json +33 -0
- package/personas/claude/scenarios/unknown-event.json +14 -0
- package/personas/codex/behavior/approval-turn.json +15 -0
- package/personas/codex/behavior/happy-turn.json +10 -0
- package/personas/codex/ops.json +159 -0
- package/personas/codex/persona.json +36 -0
- package/personas/codex/runflows.json +45 -0
- package/personas/codex/scenarios/channel-disconnect.json +31 -0
- package/personas/codex/scenarios/crash-mid-turn.json +30 -0
- package/personas/codex/scenarios/cross-layer-implementation.json +725 -0
- package/personas/codex/scenarios/deep-research.json +684 -0
- package/personas/codex/scenarios/duplicate-out-of-order.json +87 -0
- package/personas/codex/scenarios/flood.json +22 -0
- package/personas/codex/scenarios/happy-turn.json +81 -0
- package/personas/codex/scenarios/incident-investigation.json +695 -0
- package/personas/codex/scenarios/late-after-exit.json +59 -0
- package/personas/codex/scenarios/permission-allow.json +110 -0
- package/personas/codex/scenarios/permission-deny.json +83 -0
- package/personas/codex/scenarios/token-usage-refresh.json +49 -0
- package/personas/codex/scenarios/unknown-event.json +17 -0
- package/personas/codex/serve.json +124 -0
- package/personas/copilot/behavior/happy-turn.json +9 -0
- package/personas/copilot/ops.json +28 -0
- package/personas/copilot/persona.json +17 -0
- package/personas/copilot/runflows.json +6 -0
- package/personas/copilot/scenarios/happy-turn.json +50 -0
- package/personas/grok/behavior/approval-turn.json +16 -0
- package/personas/grok/behavior/happy-turn.json +13 -0
- package/personas/grok/ops.json +330 -0
- package/personas/grok/persona.json +24 -0
- package/personas/grok/runflows.json +25 -0
- package/personas/grok/scenarios/agent-team-lifecycle.json +74 -0
- package/personas/grok/scenarios/compact-lifecycle.json +61 -0
- package/personas/grok/serve.json +57 -0
- package/personas/hermes/behavior/approval-turn.json +11 -0
- package/personas/hermes/behavior/happy-turn.json +9 -0
- package/personas/hermes/ops.json +227 -0
- package/personas/hermes/persona.json +15 -0
- package/personas/hermes/runflows.json +50 -0
- package/personas/hermes/scenarios/happy-turn.json +25 -0
- package/personas/hermes/scenarios/late-after-exit.json +21 -0
- package/personas/hermes/scenarios/permission-deny.json +54 -0
- package/personas/hermes/scenarios/unknown-event.json +14 -0
- package/personas/hermes/serve.json +54 -0
- package/personas/kimi/behavior/happy-turn.json +9 -0
- package/personas/kimi/ops.json +357 -0
- package/personas/kimi/persona.json +23 -0
- package/personas/kimi/runflows.json +84 -0
- package/personas/kimi/scenarios/compaction-lifecycle.json +20 -0
- package/personas/kimi/scenarios/duplicate-out-of-order.json +60 -0
- package/personas/kimi/scenarios/happy-turn.json +66 -0
- package/personas/kimi/scenarios/late-after-end.json +28 -0
- package/personas/kimi/scenarios/tool-failure.json +43 -0
- package/personas/kimi/scenarios/tool-success.json +57 -0
- package/personas/kimi/scenarios/unknown-record.json +15 -0
- package/personas/opencode/README.md +32 -0
- package/personas/opencode/behavior/happy-turn.json +9 -0
- package/personas/opencode/behavior/permission-turn.json +18 -0
- package/personas/opencode/http-serve.json +72 -0
- package/personas/opencode/ops.json +250 -0
- package/personas/opencode/persona.json +22 -0
- package/personas/opencode/runflows.json +45 -0
- package/personas/opencode/scenarios/duplicate-event.json +27 -0
- package/personas/opencode/scenarios/failure.json +30 -0
- package/personas/opencode/scenarios/happy-turn.json +86 -0
- package/personas/opencode/scenarios/late-event.json +29 -0
- package/personas/opencode/scenarios/out-of-order.json +42 -0
- package/personas/opencode/scenarios/permission-allow.json +31 -0
- package/personas/opencode/scenarios/permission-deny.json +31 -0
- package/personas/opencode/scenarios/question-reject.json +37 -0
- package/personas/opencode/scenarios/question-reply.json +38 -0
- package/personas/opencode/scenarios/reconnect.json +22 -0
- package/personas/opencode/scenarios/resume.json +30 -0
- package/personas/opencode/scenarios/unknown-event.json +15 -0
- package/personas/pi/behavior/happy-turn.json +9 -0
- package/personas/pi/ops.json +19 -0
- package/personas/pi/persona.json +16 -0
- package/personas/pi/runflows.json +6 -0
- package/personas/pi/scenarios/happy-turn.json +52 -0
- package/personas/synthetic/behavior/happy-turn.json +12 -0
- package/personas/synthetic/groundtruth.html +164 -0
- package/personas/synthetic/groundtruth.json +380 -0
- package/personas/synthetic/model/behavior.json +27 -0
- package/personas/synthetic/model/channels.json +16 -0
- package/personas/synthetic/model/detection.json +13 -0
- package/personas/synthetic/model/events/agent.action.json +16 -0
- package/personas/synthetic/model/events/agent.boot.json +16 -0
- package/personas/synthetic/model/events/agent.halt.json +16 -0
- package/personas/synthetic/model/events/agent.prompt.json +16 -0
- package/personas/synthetic/model/events/agent.reply.json +16 -0
- package/personas/synthetic/model/events/agent.settled.json +16 -0
- package/personas/synthetic/model/manifest.json +7 -0
- package/personas/synthetic/ops.json +18 -0
- package/personas/synthetic/persona.json +11 -0
- package/README.md +0 -3
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Newline-delimited JSON-RPC 2.0 over a duplex stream (docs/archive/IMPOSTER.md §5.1).
|
|
3
|
+
*
|
|
4
|
+
* One codec, both ends: the imposter's client and the control center's plane
|
|
5
|
+
* build their halves from this, so there is a single place where framing,
|
|
6
|
+
* correlation, and shutdown can be wrong — and a single place that is tested.
|
|
7
|
+
*
|
|
8
|
+
* Either side may originate. A message with an `id` is a request and gets a
|
|
9
|
+
* reply; without one it is a notification and never does. Ids are per-peer, so
|
|
10
|
+
* the two directions never collide.
|
|
11
|
+
*/
|
|
12
|
+
import { ControlError, INTERNAL_ERROR, INVALID_REQUEST, PARSE_ERROR } from "./protocol.js";
|
|
13
|
+
/**
|
|
14
|
+
* A single line is one whole message, so a peer that cannot find a newline
|
|
15
|
+
* inside this many bytes has lost sync and cannot recover by reading further.
|
|
16
|
+
*/
|
|
17
|
+
export const MAX_CONTROL_MESSAGE_BYTES = 16 * 1024 * 1024;
|
|
18
|
+
/** Beyond this much unflushed output, drop pushes rather than grow the heap. */
|
|
19
|
+
const SATURATION_BYTES = 4 * 1024 * 1024;
|
|
20
|
+
const DEFAULT_TIMEOUT_MS = 5_000;
|
|
21
|
+
export function createPeer(stream, options) {
|
|
22
|
+
const log = options.log ?? (() => { });
|
|
23
|
+
const defaultTimeout = options.timeoutMs ?? DEFAULT_TIMEOUT_MS;
|
|
24
|
+
const pending = new Map();
|
|
25
|
+
let nextId = 1;
|
|
26
|
+
let closed = false;
|
|
27
|
+
let buffer = '';
|
|
28
|
+
const write = (message) => {
|
|
29
|
+
if (closed || !stream.writable)
|
|
30
|
+
return false;
|
|
31
|
+
stream.write(`${JSON.stringify(message)}\n`);
|
|
32
|
+
return true;
|
|
33
|
+
};
|
|
34
|
+
const settle = (error) => {
|
|
35
|
+
if (closed)
|
|
36
|
+
return;
|
|
37
|
+
closed = true;
|
|
38
|
+
const failure = error ?? new ControlError(INTERNAL_ERROR, 'control connection closed');
|
|
39
|
+
for (const [, entry] of pending) {
|
|
40
|
+
clearTimeout(entry.timer);
|
|
41
|
+
entry.reject(failure);
|
|
42
|
+
}
|
|
43
|
+
pending.clear();
|
|
44
|
+
options.onClose?.(error);
|
|
45
|
+
};
|
|
46
|
+
const respond = async (id, method, params) => {
|
|
47
|
+
try {
|
|
48
|
+
const result = await options.handle(method, params);
|
|
49
|
+
write({ jsonrpc: '2.0', id, result: result ?? { ok: true } });
|
|
50
|
+
}
|
|
51
|
+
catch (error) {
|
|
52
|
+
const code = error instanceof ControlError ? error.code : INTERNAL_ERROR;
|
|
53
|
+
write({
|
|
54
|
+
jsonrpc: '2.0',
|
|
55
|
+
id,
|
|
56
|
+
error: { code, message: error instanceof Error ? error.message : String(error) },
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
const dispatch = (raw) => {
|
|
61
|
+
let message;
|
|
62
|
+
try {
|
|
63
|
+
message = JSON.parse(raw);
|
|
64
|
+
}
|
|
65
|
+
catch {
|
|
66
|
+
// No id is recoverable from an unparseable line, so answer with the
|
|
67
|
+
// null-id form the spec reserves for exactly this and keep reading.
|
|
68
|
+
write({ jsonrpc: '2.0', id: null, error: { code: PARSE_ERROR, message: 'message must be valid JSON' } });
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
if (message === null || typeof message !== 'object' || Array.isArray(message)) {
|
|
72
|
+
write({ jsonrpc: '2.0', id: null, error: { code: INVALID_REQUEST, message: 'message must be an object' } });
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
const record = message;
|
|
76
|
+
const id = record.id;
|
|
77
|
+
if (record.method === undefined) {
|
|
78
|
+
// A response: match it against what we sent, or drop it.
|
|
79
|
+
if (typeof id !== 'number')
|
|
80
|
+
return log('dropping a response with no usable id');
|
|
81
|
+
const entry = pending.get(id);
|
|
82
|
+
if (!entry)
|
|
83
|
+
return log(`dropping a response for unknown id ${id}`);
|
|
84
|
+
pending.delete(id);
|
|
85
|
+
clearTimeout(entry.timer);
|
|
86
|
+
if (record.error !== undefined) {
|
|
87
|
+
const failure = record.error;
|
|
88
|
+
entry.reject(new ControlError(failure.code ?? INTERNAL_ERROR, failure.message ?? 'control request failed'));
|
|
89
|
+
}
|
|
90
|
+
else {
|
|
91
|
+
entry.resolve(record.result);
|
|
92
|
+
}
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
if (typeof record.method !== 'string') {
|
|
96
|
+
if (id !== undefined)
|
|
97
|
+
write({ jsonrpc: '2.0', id, error: { code: INVALID_REQUEST, message: 'method must be a string' } });
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
const params = record.params === null || typeof record.params !== 'object' || Array.isArray(record.params)
|
|
101
|
+
? {}
|
|
102
|
+
: record.params;
|
|
103
|
+
if (id === undefined) {
|
|
104
|
+
// Notification: a handler failure is logged, never answered.
|
|
105
|
+
void (async () => {
|
|
106
|
+
try {
|
|
107
|
+
await options.handle(record.method, params);
|
|
108
|
+
}
|
|
109
|
+
catch (error) {
|
|
110
|
+
log(`notification ${String(record.method)} failed: ${error instanceof Error ? error.message : String(error)}`);
|
|
111
|
+
}
|
|
112
|
+
})();
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
void respond(id, record.method, params);
|
|
116
|
+
};
|
|
117
|
+
stream.setEncoding('utf8');
|
|
118
|
+
stream.on('data', (chunk) => {
|
|
119
|
+
buffer += chunk;
|
|
120
|
+
let index;
|
|
121
|
+
while ((index = buffer.indexOf('\n')) >= 0) {
|
|
122
|
+
const line = buffer.slice(0, index).trim();
|
|
123
|
+
buffer = buffer.slice(index + 1);
|
|
124
|
+
if (line.length > 0)
|
|
125
|
+
dispatch(line);
|
|
126
|
+
}
|
|
127
|
+
if (Buffer.byteLength(buffer) > MAX_CONTROL_MESSAGE_BYTES) {
|
|
128
|
+
buffer = '';
|
|
129
|
+
const error = new ControlError(INVALID_REQUEST, `control message exceeds ${MAX_CONTROL_MESSAGE_BYTES} bytes`);
|
|
130
|
+
stream.destroy(error);
|
|
131
|
+
}
|
|
132
|
+
});
|
|
133
|
+
stream.on('error', (error) => settle(error));
|
|
134
|
+
stream.on('close', () => settle());
|
|
135
|
+
stream.on('end', () => {
|
|
136
|
+
if (!closed)
|
|
137
|
+
stream.destroy();
|
|
138
|
+
});
|
|
139
|
+
return {
|
|
140
|
+
get saturated() {
|
|
141
|
+
return stream.writableLength > SATURATION_BYTES;
|
|
142
|
+
},
|
|
143
|
+
get closed() {
|
|
144
|
+
return closed;
|
|
145
|
+
},
|
|
146
|
+
request(method, params = {}, requestOptions = {}) {
|
|
147
|
+
if (closed || !stream.writable) {
|
|
148
|
+
return Promise.reject(new ControlError(INTERNAL_ERROR, 'control connection is closed'));
|
|
149
|
+
}
|
|
150
|
+
const id = nextId++;
|
|
151
|
+
return new Promise((resolve, reject) => {
|
|
152
|
+
const timer = setTimeout(() => {
|
|
153
|
+
pending.delete(id);
|
|
154
|
+
reject(new ControlError(INTERNAL_ERROR, `control request ${method} timed out`));
|
|
155
|
+
}, requestOptions.timeoutMs ?? defaultTimeout);
|
|
156
|
+
// An unref'd timer must not be the only thing keeping a CLI alive.
|
|
157
|
+
timer.unref?.();
|
|
158
|
+
pending.set(id, { resolve, reject, timer });
|
|
159
|
+
write({ jsonrpc: '2.0', id, method, params });
|
|
160
|
+
});
|
|
161
|
+
},
|
|
162
|
+
notify(method, params = {}) {
|
|
163
|
+
return write({ jsonrpc: '2.0', method, params });
|
|
164
|
+
},
|
|
165
|
+
close() {
|
|
166
|
+
if (closed)
|
|
167
|
+
return;
|
|
168
|
+
stream.end();
|
|
169
|
+
stream.destroy();
|
|
170
|
+
settle();
|
|
171
|
+
},
|
|
172
|
+
};
|
|
173
|
+
}
|
|
174
|
+
//# sourceMappingURL=peer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"peer.js","sourceRoot":"","sources":["../../src/control/peer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE3F;;;GAGG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,EAAE,GAAG,IAAI,GAAG,IAAI,CAAC;AAE1D,gFAAgF;AA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AK,GAAG,UAAU,CAAC,GAAG,EAAE;oBAC5B,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;oBACnB,MAAM,CAAC,IAAI,YAAY,CAAC,cAAc,EAAE,mBAAmB,MAAM,YAAY,CAAC,CAAC,CAAC;gBAClF,CAAC,EAAE,cAAc,CAAC,SAAS,IAAI,cAAc,CAAC,CAAC;gBAC/C,mEAAmE;gBACnE,KAAK,CAAC,KAAK,EAAE,EAAE,CAAC;gBAChB,OAAO,CAAC,GAAG,CAAC,EAAE,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC;gBAC5C,KAAK,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;YAChD,CAAC,CAAC,CAAC;QACL,CAAC;QACD,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,EAAE;YACxB,OAAO,KAAK,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;QACnD,CAAC;QACD,KAAK;YACH,IAAI,MAAM;gBAAE,OAAO;YACnB,MAAM,CAAC,GAAG,EAAE,CAAC;YACb,MAAM,CAAC,OAAO,EAAE,CAAC;YACjB,MAAM,EAAE,CAAC;QACX,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Control-channel message shapes (docs/archive/IMPOSTER.md §5.1), shared by the
|
|
3
|
+
* imposter's client and the control center's plane.
|
|
4
|
+
*
|
|
5
|
+
* Zero I/O — types, validation, and the two well-known paths. Framing lives in
|
|
6
|
+
* `peer.ts`, dialing in `client.ts`, and the server side is built from the same
|
|
7
|
+
* two by `apps/imposter-control/src/main/plane.ts`.
|
|
8
|
+
*
|
|
9
|
+
* Every parser here refuses rather than coerces. The plane is the boundary
|
|
10
|
+
* between a browser console and a process that impersonates a vendor, so a
|
|
11
|
+
* malformed field must fail loudly at the edge instead of arriving at a channel
|
|
12
|
+
* as `undefined` and teaching the adapter something untrue.
|
|
13
|
+
*/
|
|
14
|
+
import type { SurfaceBehavior, SurfaceConfidence, SurfaceModel } from '@vibefield/puppeteer-surface';
|
|
15
|
+
import type { Persona } from '../persona/types.ts';
|
|
16
|
+
import type { RunflowDescriptor } from '../persona/types.ts';
|
|
17
|
+
export type { RunflowDescriptor } from '../persona/types.ts';
|
|
18
|
+
export declare const PARSE_ERROR = -32700;
|
|
19
|
+
export declare const INVALID_REQUEST = -32600;
|
|
20
|
+
export declare const METHOD_NOT_FOUND = -32601;
|
|
21
|
+
export declare const INVALID_PARAMS = -32602;
|
|
22
|
+
export declare const INTERNAL_ERROR = -32603;
|
|
23
|
+
/** The imposter declined: off-model payload, unsupported fault, bad state. */
|
|
24
|
+
export declare const REFUSED = -32000;
|
|
25
|
+
/** Addressed something that does not exist (a scenario name, a session). */
|
|
26
|
+
export declare const NOT_FOUND = -32001;
|
|
27
|
+
export declare class ControlError extends Error {
|
|
28
|
+
readonly code: number;
|
|
29
|
+
constructor(code: number, message: string);
|
|
30
|
+
}
|
|
31
|
+
/** HTTP status for a JSON-RPC code, for the plane's browser-facing side. */
|
|
32
|
+
export declare function httpStatusForCode(code: number): number;
|
|
33
|
+
/**
|
|
34
|
+
* `sun_path` is ~103 bytes on macOS and ~107 on Linux, so the socket lives at a
|
|
35
|
+
* short fixed path and never a nested per-session one (§5.2). Windows gets a
|
|
36
|
+
* named pipe, which node's `net` reaches through the same API.
|
|
37
|
+
*/
|
|
38
|
+
export declare const MAX_SOCKET_PATH_BYTES = 100;
|
|
39
|
+
export declare function controlHome(): string;
|
|
40
|
+
export declare function defaultSocketPath(env?: Record<string, string | undefined>): string;
|
|
41
|
+
/**
|
|
42
|
+
* The shared secret, beside the socket rather than inside a discovery file.
|
|
43
|
+
*
|
|
44
|
+
* On POSIX the 0700 directory is the real capability and this is belt-and-
|
|
45
|
+
* braces; on Windows named pipes node exposes no ACL, so the token is the only
|
|
46
|
+
* thing standing between the plane and any local process that guesses the pipe
|
|
47
|
+
* name. It carries no URL, no pid, and no liveness — the socket is discovery,
|
|
48
|
+
* and socket close is liveness (§5).
|
|
49
|
+
*/
|
|
50
|
+
export declare function defaultTokenPath(env?: Record<string, string | undefined>): string;
|
|
51
|
+
export interface NativeEventDescriptor {
|
|
52
|
+
event: string;
|
|
53
|
+
/** PayloadSchema property names, for the console's trigger form. */
|
|
54
|
+
fields: string[];
|
|
55
|
+
channel: string;
|
|
56
|
+
/** All native rails on which this event may be observed. */
|
|
57
|
+
channels: string[];
|
|
58
|
+
confidence: SurfaceConfidence;
|
|
59
|
+
transport?: string;
|
|
60
|
+
trigger?: string;
|
|
61
|
+
notes?: string;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* One semantic op as this persona binds it. The console drives sessions by op
|
|
65
|
+
* first and by raw event second: an op is what a turn is made of, so firing one
|
|
66
|
+
* produces traffic a real vendor would produce, while a raw event is the
|
|
67
|
+
* adversarial escape hatch that deliberately does not.
|
|
68
|
+
*/
|
|
69
|
+
export interface OpDescriptor {
|
|
70
|
+
op: string;
|
|
71
|
+
/** Delivery kinds this op fans out to. */
|
|
72
|
+
channels: string[];
|
|
73
|
+
/** Wire names it produces — hook events, or JSON-RPC methods. */
|
|
74
|
+
events: string[];
|
|
75
|
+
/** `$op.<field>` references in the persona's templates, i.e. the op's arguments. */
|
|
76
|
+
fields: string[];
|
|
77
|
+
/** The op suspends until the client answers (an approval). */
|
|
78
|
+
awaits?: boolean;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Internal portable scenario intent. This is deliberately not named or
|
|
82
|
+
* presented as the vendor's lifecycle; native truth lives in SurfaceBehavior.
|
|
83
|
+
*/
|
|
84
|
+
export interface ScenarioDriverView {
|
|
85
|
+
state: string;
|
|
86
|
+
enabled: string[];
|
|
87
|
+
offModel: number;
|
|
88
|
+
applied: number;
|
|
89
|
+
heartbeats: number;
|
|
90
|
+
}
|
|
91
|
+
/** imposter -> plane, first message on the connection. */
|
|
92
|
+
export interface SessionHello {
|
|
93
|
+
token: string;
|
|
94
|
+
vendor: string;
|
|
95
|
+
version: string;
|
|
96
|
+
sessionId: string;
|
|
97
|
+
pid: number;
|
|
98
|
+
cwd: string;
|
|
99
|
+
channels: string[];
|
|
100
|
+
nativeBehavior: SurfaceBehavior;
|
|
101
|
+
nativeEvents: NativeEventDescriptor[];
|
|
102
|
+
ops: OpDescriptor[];
|
|
103
|
+
runflows: RunflowDescriptor[];
|
|
104
|
+
scenarioDriver: ScenarioDriverView;
|
|
105
|
+
}
|
|
106
|
+
/** What the plane shows the console. Never carries the token. */
|
|
107
|
+
export interface SessionView {
|
|
108
|
+
vendor: string;
|
|
109
|
+
version: string;
|
|
110
|
+
sessionId: string;
|
|
111
|
+
pid: number;
|
|
112
|
+
cwd: string;
|
|
113
|
+
channels: string[];
|
|
114
|
+
nativeBehavior: SurfaceBehavior;
|
|
115
|
+
nativeEvents: NativeEventDescriptor[];
|
|
116
|
+
ops: OpDescriptor[];
|
|
117
|
+
runflows: RunflowDescriptor[];
|
|
118
|
+
scenarioDriver: ScenarioDriverView;
|
|
119
|
+
/** Latest automation run, retained so a reconnecting console can recover. */
|
|
120
|
+
scenarioRun?: ScenarioRunProgressView;
|
|
121
|
+
joinedAt: string;
|
|
122
|
+
}
|
|
123
|
+
export interface EmittedEntry {
|
|
124
|
+
at: string;
|
|
125
|
+
sequence: number;
|
|
126
|
+
event: string;
|
|
127
|
+
channel?: string;
|
|
128
|
+
payload?: Record<string, unknown>;
|
|
129
|
+
truncated?: boolean;
|
|
130
|
+
}
|
|
131
|
+
export interface TriggerRequest {
|
|
132
|
+
event: string;
|
|
133
|
+
/** Select one declared native rail; absent means the event's primary rail. */
|
|
134
|
+
channel?: string;
|
|
135
|
+
with: Record<string, unknown>;
|
|
136
|
+
}
|
|
137
|
+
export interface OpRequest {
|
|
138
|
+
op: string;
|
|
139
|
+
with: Record<string, unknown>;
|
|
140
|
+
}
|
|
141
|
+
export interface ScenarioRunRequest {
|
|
142
|
+
name?: string;
|
|
143
|
+
script?: unknown;
|
|
144
|
+
/** Devkit catalog identity; never passed into a native payload. */
|
|
145
|
+
runflowId?: string;
|
|
146
|
+
mode: 'play' | 'pause' | 'step';
|
|
147
|
+
speed: number;
|
|
148
|
+
stimulus?: Record<string, unknown>;
|
|
149
|
+
}
|
|
150
|
+
export type ScenarioRunStatus = 'running' | 'paused' | 'completed' | 'failed';
|
|
151
|
+
/** Control-plane lifecycle for one scenario execution, separate from evidence. */
|
|
152
|
+
export interface ScenarioRunProgressView {
|
|
153
|
+
runId: string;
|
|
154
|
+
scenario?: string;
|
|
155
|
+
runflowId?: string;
|
|
156
|
+
mode: 'play' | 'pause' | 'step';
|
|
157
|
+
status: ScenarioRunStatus;
|
|
158
|
+
step: number;
|
|
159
|
+
steps: number;
|
|
160
|
+
/** Inclusive native sequence window. It may be empty when through < from. */
|
|
161
|
+
fromSequence: number;
|
|
162
|
+
throughSequence?: number;
|
|
163
|
+
error?: string;
|
|
164
|
+
}
|
|
165
|
+
export type ScenarioControlAction = 'pause' | 'step' | 'resume';
|
|
166
|
+
export interface ScenarioControlRequest {
|
|
167
|
+
action: ScenarioControlAction;
|
|
168
|
+
}
|
|
169
|
+
export type FaultKind = 'crash' | 'exit' | 'hang' | 'flood' | 'channel-drop';
|
|
170
|
+
export interface FaultRequest {
|
|
171
|
+
kind: FaultKind;
|
|
172
|
+
channel?: string;
|
|
173
|
+
count?: number;
|
|
174
|
+
event?: string;
|
|
175
|
+
with?: Record<string, unknown>;
|
|
176
|
+
exitCode?: number;
|
|
177
|
+
}
|
|
178
|
+
export declare const FAULT_KINDS: readonly FaultKind[];
|
|
179
|
+
export declare function asRecord(value: unknown, label?: string): Record<string, unknown>;
|
|
180
|
+
export declare function requiredString(value: unknown, field: string, maxLength?: number): string;
|
|
181
|
+
export declare function parseHello(params: unknown): SessionHello;
|
|
182
|
+
export declare function parseRunflows(value: unknown): RunflowDescriptor[];
|
|
183
|
+
export declare function parseScenarioRunProgress(value: unknown): ScenarioRunProgressView;
|
|
184
|
+
export declare function parseOps(value: unknown): OpDescriptor[];
|
|
185
|
+
export declare function parseScenarioDriver(value: unknown): ScenarioDriverView;
|
|
186
|
+
export declare function parseNativeEvents(value: unknown): NativeEventDescriptor[];
|
|
187
|
+
export declare function parseNativeBehavior(value: unknown): SurfaceBehavior;
|
|
188
|
+
export declare function parseTrigger(params: unknown): TriggerRequest;
|
|
189
|
+
export declare function parseOpRequest(params: unknown): OpRequest;
|
|
190
|
+
export declare function parseScenarioRun(params: unknown): ScenarioRunRequest;
|
|
191
|
+
export declare function parseScenarioControl(params: unknown): ScenarioControlRequest;
|
|
192
|
+
export declare function parseFault(params: unknown, channels?: readonly string[]): FaultRequest;
|
|
193
|
+
export declare function parseEmitted(params: unknown): EmittedEntry;
|
|
194
|
+
/**
|
|
195
|
+
* The console's trigger forms are generated from the ASM, never hand-listed —
|
|
196
|
+
* an event the model does not describe is an event the imposter would refuse
|
|
197
|
+
* to emit anyway (§7.3 item 3).
|
|
198
|
+
*/
|
|
199
|
+
export declare function nativeEventsFromModel(model: SurfaceModel): NativeEventDescriptor[];
|
|
200
|
+
/**
|
|
201
|
+
* The ops this persona binds, derived from ops.json rather than listed by hand
|
|
202
|
+
* — an op the persona does not bind is an op the console must not offer as if
|
|
203
|
+
* it produced traffic. The scenario driver's own description supplies the full
|
|
204
|
+
* vocabulary, so the console can still show the authoring gap.
|
|
205
|
+
*/
|
|
206
|
+
export declare function opsFromPersona(persona: Pick<Persona, 'ops' | 'channelFor'>): OpDescriptor[];
|
|
207
|
+
//# sourceMappingURL=protocol.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"protocol.d.ts","sourceRoot":"","sources":["../../src/control/protocol.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAIH,OAAO,KAAK,EACV,eAAe,EAEf,iBAAiB,EACjB,YAA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