@cotal-ai/connector-core 0.165.3 → 0.166.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/dist/agent.d.ts +3 -1
- package/dist/agent.d.ts.map +1 -1
- package/dist/agent.js +5 -2
- package/dist/agent.js.map +1 -1
- package/dist/control.d.ts +2 -9
- package/dist/control.d.ts.map +1 -1
- package/dist/control.js +1 -5
- package/dist/control.js.map +1 -1
- package/dist/docs-bundle.bin +0 -0
- package/dist/docs-bundle.generated.d.ts +1 -1
- package/dist/docs-bundle.generated.js +7 -7
- package/dist/docs-bundle.generated.js.map +1 -1
- package/dist/docs-index.bin +0 -0
- package/dist/index.d.ts +0 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -1
- package/dist/index.js.map +1 -1
- package/dist/manager-call.d.ts +0 -2
- package/dist/manager-call.d.ts.map +1 -1
- package/dist/manager-call.js +0 -2
- package/dist/manager-call.js.map +1 -1
- package/dist/once.d.ts +3 -2
- package/dist/once.d.ts.map +1 -1
- package/dist/relay.d.ts +1 -7
- package/dist/relay.d.ts.map +1 -1
- package/dist/relay.js +2 -2
- package/dist/relay.js.map +1 -1
- package/dist/tool-result-journal.d.ts +5 -4
- package/dist/tool-result-journal.d.ts.map +1 -1
- package/dist/version.generated.d.ts +1 -1
- package/dist/version.generated.js +1 -1
- package/package.json +3 -3
- package/dist/permission-desk.d.ts +0 -68
- package/dist/permission-desk.d.ts.map +0 -1
- package/dist/permission-desk.js +0 -223
- package/dist/permission-desk.js.map +0 -1
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The permission desk: one seat's holder of its harness's permission prompts (SPEC §8.2).
|
|
3
|
-
*
|
|
4
|
-
* While a prompt is held its owner can answer it from another session, and the harness's own dialog
|
|
5
|
-
* still works; the first answer applies. The desk writes one record per prompt and is that record's
|
|
6
|
-
* only writer. Every event about one prompt runs on that prompt's own chain and moves the record
|
|
7
|
-
* only through `stepPermission`. An answer is written before its verdict reaches the hook, and is
|
|
8
|
-
* accepted only once the hook confirms the verdict reached the harness. A signal from the machine
|
|
9
|
-
* (its tool ran, its hook went away, its deadline passed) is applied first and written after,
|
|
10
|
-
* because the harness has already acted on it.
|
|
11
|
-
*/
|
|
12
|
-
import { type CotalEndpoint, type JsonValue, type PermissionRequestId } from "@cotal-ai/core";
|
|
13
|
-
/** One prompt, as the hook parsed it from the harness. */
|
|
14
|
-
export interface PermissionAsk {
|
|
15
|
-
readonly tool: string;
|
|
16
|
-
readonly input: JsonValue;
|
|
17
|
-
readonly cwd?: string;
|
|
18
|
-
/** The harness scope that asked, such as a subagent's id. Absent means the main thread. */
|
|
19
|
-
readonly scope?: string;
|
|
20
|
-
}
|
|
21
|
-
/** What the hook hands the harness. `release` hands it nothing, so the harness keeps, or has
|
|
22
|
-
* already taken, its own answer. */
|
|
23
|
-
export type PermissionVerdict = {
|
|
24
|
-
readonly kind: "allow";
|
|
25
|
-
} | {
|
|
26
|
-
readonly kind: "deny";
|
|
27
|
-
readonly message: string;
|
|
28
|
-
} | {
|
|
29
|
-
readonly kind: "release";
|
|
30
|
-
};
|
|
31
|
-
export interface PermissionHold {
|
|
32
|
-
readonly verdict: Promise<PermissionVerdict>;
|
|
33
|
-
/** Whether the hook confirmed that the verdict reached the harness. */
|
|
34
|
-
confirm(delivered: boolean): void;
|
|
35
|
-
}
|
|
36
|
-
export interface PermissionDesk {
|
|
37
|
-
/** Hold one prompt. `hookGone` aborts when the hook's connection closes before its verdict. */
|
|
38
|
-
hold(ask: PermissionAsk, hookGone: AbortSignal): PermissionHold;
|
|
39
|
-
/** The harness ran these tool calls in `scope`. Each run settles one prompt still held in that scope
|
|
40
|
-
* for the same tool and input, the oldest first, as allowed at the terminal. */
|
|
41
|
-
toolsRan(calls: readonly {
|
|
42
|
-
readonly tool: string;
|
|
43
|
-
readonly input: unknown;
|
|
44
|
-
}[], scope?: string): void;
|
|
45
|
-
/** `scope` ended its turn: every prompt still held in it was allowed at the terminal. Absent means
|
|
46
|
-
* the main thread. */
|
|
47
|
-
turnEnded(scope?: string): void;
|
|
48
|
-
/** The newest prompt still waiting for an answer. */
|
|
49
|
-
waiting(): PermissionRequestId | undefined;
|
|
50
|
-
/** Stop serving and give every held prompt back to the terminal, writing nothing: readers see
|
|
51
|
-
* the holder gone. */
|
|
52
|
-
close(): void;
|
|
53
|
-
}
|
|
54
|
-
export interface PermissionDeskOptions {
|
|
55
|
-
/** Each prompt expires this long after it was asked, and is then denied. Unset, it never expires. */
|
|
56
|
-
readonly deadlineMs?: number;
|
|
57
|
-
/** How long a withdrawn hook waits before the record says so, so that a session ending, which
|
|
58
|
-
* closes the desk, reads as the holder gone and not as an answer at the terminal. */
|
|
59
|
-
readonly withdrawSettleMs?: number;
|
|
60
|
-
/** Told why a prompt stays with the terminal only. */
|
|
61
|
-
readonly warn?: (message: string) => void;
|
|
62
|
-
}
|
|
63
|
-
export declare const denyMessage: (note: string | undefined) => string;
|
|
64
|
-
export declare const expiryMessage: (deadline: number) => string;
|
|
65
|
-
/** Open the desk for the seat `ep` serves. Throws where no prompt can be relayed: an open mesh, or
|
|
66
|
-
* an endpoint with no lifecycle UID. */
|
|
67
|
-
export declare function openPermissionDesk(ep: CotalEndpoint, opts?: PermissionDeskOptions): PermissionDesk;
|
|
68
|
-
//# sourceMappingURL=permission-desk.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"permission-desk.d.ts","sourceRoot":"","sources":["../src/permission-desk.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EAML,KAAK,aAAa,EAElB,KAAK,SAAS,EAKd,KAAK,mBAAmB,EAEzB,MAAM,gBAAgB,CAAC;AAExB,0DAA0D;AAC1D,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,EAAE,SAAS,CAAC;IAC1B,QAAQ,CAAC,GAAG,CAA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AE,MAAM,KAAK,IAAI,CAAC;CAC3C;AAOD,eAAO,MAAM,WAAW,GAAI,MAAM,MAAM,GAAG,SAAS,KAAG,MAAsE,CAAC;AAC9H,eAAO,MAAM,aAAa,GAAI,UAAU,MAAM,KAAG,MAAiE,CAAC;AA6CnH;yCACyC;AACzC,wBAAgB,kBAAkB,CAAC,EAAE,EAAE,aAAa,EAAE,IAAI,GAAE,qBAA0B,GAAG,cAAc,CAiKtG"}
|
package/dist/permission-desk.js
DELETED
|
@@ -1,223 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The permission desk: one seat's holder of its harness's permission prompts (SPEC §8.2).
|
|
3
|
-
*
|
|
4
|
-
* While a prompt is held its owner can answer it from another session, and the harness's own dialog
|
|
5
|
-
* still works; the first answer applies. The desk writes one record per prompt and is that record's
|
|
6
|
-
* only writer. Every event about one prompt runs on that prompt's own chain and moves the record
|
|
7
|
-
* only through `stepPermission`. An answer is written before its verdict reaches the hook, and is
|
|
8
|
-
* accepted only once the hook confirms the verdict reached the harness. A signal from the machine
|
|
9
|
-
* (its tool ran, its hook went away, its deadline passed) is applied first and written after,
|
|
10
|
-
* because the harness has already acted on it.
|
|
11
|
-
*/
|
|
12
|
-
import { PERMISSION_HANDOFF_BOUND_MS, canonicalJson, mintPermissionRequestId, permissionInput, stepPermission, } from "@cotal-ai/core";
|
|
13
|
-
const RETRY_MS = 1_000;
|
|
14
|
-
/** Settled prompts remembered, so a late answer reads `answered` rather than `gone`. */
|
|
15
|
-
const SETTLED_MEMORY = 256;
|
|
16
|
-
const RELEASE = { kind: "release" };
|
|
17
|
-
export const denyMessage = (note) => (note ? `Denied from Cotal: ${note}` : "Denied from Cotal.");
|
|
18
|
-
export const expiryMessage = (deadline) => `No answer before ${new Date(deadline).toISOString()}.`;
|
|
19
|
-
function verdictFor(state, deadline) {
|
|
20
|
-
switch (state.kind) {
|
|
21
|
-
case "approved":
|
|
22
|
-
return { kind: "allow" };
|
|
23
|
-
case "denied":
|
|
24
|
-
return { kind: "deny", message: denyMessage(state.note) };
|
|
25
|
-
case "expired":
|
|
26
|
-
return { kind: "deny", message: expiryMessage(deadline ?? state.at) };
|
|
27
|
-
default:
|
|
28
|
-
return RELEASE;
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
/** A tool call's identity across the harness's hooks: the prompt names no call id, the batch does
|
|
32
|
-
* not repeat the prompt, and both carry the tool and its input. */
|
|
33
|
-
function callKey(tool, input) {
|
|
34
|
-
try {
|
|
35
|
-
return canonicalJson([tool, input]);
|
|
36
|
-
}
|
|
37
|
-
catch {
|
|
38
|
-
return undefined;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
/** Open the desk for the seat `ep` serves. Throws where no prompt can be relayed: an open mesh, or
|
|
42
|
-
* an endpoint with no lifecycle UID. */
|
|
43
|
-
export function openPermissionDesk(ep, opts = {}) {
|
|
44
|
-
const settleMs = opts.withdrawSettleMs ?? 1_000;
|
|
45
|
-
const prompts = new Map();
|
|
46
|
-
const settled = [];
|
|
47
|
-
let closed = false;
|
|
48
|
-
const port = ep.openPermissionHolder((a) => answer(a));
|
|
49
|
-
const enqueue = (h, task) => {
|
|
50
|
-
const run = h.chain.then(task);
|
|
51
|
-
h.chain = run.catch(() => { });
|
|
52
|
-
return run;
|
|
53
|
-
};
|
|
54
|
-
const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms).unref?.());
|
|
55
|
-
const later = (h, ms, fn) => {
|
|
56
|
-
const t = setTimeout(fn, ms);
|
|
57
|
-
t.unref?.();
|
|
58
|
-
h.timers.push(t);
|
|
59
|
-
};
|
|
60
|
-
/** Write `record` as the prompt's next revision. An unknown outcome is retried until it lands; a
|
|
61
|
-
* conflict or a refusal taints the prompt and gives it back to the terminal. */
|
|
62
|
-
async function project(h, record) {
|
|
63
|
-
let expected = h.revision;
|
|
64
|
-
for (;;) {
|
|
65
|
-
if (closed || h.tainted)
|
|
66
|
-
return false;
|
|
67
|
-
const w = await port.write(record, h.step, expected);
|
|
68
|
-
if (w.kind === "written") {
|
|
69
|
-
h.revision = w.revision;
|
|
70
|
-
h.step++;
|
|
71
|
-
return true;
|
|
72
|
-
}
|
|
73
|
-
if (w.kind !== "unavailable") {
|
|
74
|
-
h.tainted = true;
|
|
75
|
-
h.give(RELEASE);
|
|
76
|
-
remember(h);
|
|
77
|
-
opts.warn?.(w.kind === "conflict"
|
|
78
|
-
? `permission prompt ${record.id} has another writer, so it stays with the terminal`
|
|
79
|
-
: `permission prompt ${record.id} stays with the terminal: the record store refused it (${w.reason})`);
|
|
80
|
-
return false;
|
|
81
|
-
}
|
|
82
|
-
expected = "retry";
|
|
83
|
-
await sleep(RETRY_MS);
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
const remember = (h) => {
|
|
87
|
-
settled.push(h.record.id);
|
|
88
|
-
if (settled.length > SETTLED_MEMORY)
|
|
89
|
-
prompts.delete(settled.shift());
|
|
90
|
-
};
|
|
91
|
-
/** A signal from the machine, already acted on by the harness: apply it, then write it. */
|
|
92
|
-
async function apply(h, event) {
|
|
93
|
-
if (h.tainted)
|
|
94
|
-
return;
|
|
95
|
-
const step = stepPermission(h.record.state, event);
|
|
96
|
-
if (step.kind !== "move")
|
|
97
|
-
return;
|
|
98
|
-
h.record = { ...h.record, state: step.next };
|
|
99
|
-
h.give(verdictFor(step.next, h.record.deadline));
|
|
100
|
-
if (await project(h, h.record))
|
|
101
|
-
remember(h);
|
|
102
|
-
}
|
|
103
|
-
const signal = (h, event) => void enqueue(h, () => apply(h, event));
|
|
104
|
-
/** The harness ran the prompt's tool. Marked now, so a second run of the same call settles another
|
|
105
|
-
* prompt rather than this one again. */
|
|
106
|
-
const ran = (h) => {
|
|
107
|
-
h.ran = true;
|
|
108
|
-
signal(h, { kind: "tool-ran", at: Date.now() });
|
|
109
|
-
};
|
|
110
|
-
/** An answer from the rail. A prompt this desk does not hold gets no reply: an answer is addressed
|
|
111
|
-
* to the process its record names, so silence here leaves the reply to that process. */
|
|
112
|
-
function answer(a) {
|
|
113
|
-
const h = prompts.get(a.id);
|
|
114
|
-
if (!h)
|
|
115
|
-
return Promise.resolve(undefined);
|
|
116
|
-
return enqueue(h, async () => {
|
|
117
|
-
if (h.tainted)
|
|
118
|
-
return { v: 1, ok: false, code: "conflict" };
|
|
119
|
-
if (a.answer.decision === "approve" && h.record.input.kind === "withheld")
|
|
120
|
-
return { v: 1, ok: false, code: "withheld" };
|
|
121
|
-
const step = stepPermission(h.record.state, { kind: "answer", by: a.by, at: Date.now(), ...a.answer });
|
|
122
|
-
if (step.kind === "refuse")
|
|
123
|
-
return { v: 1, ok: false, code: step.code, state: h.record.state };
|
|
124
|
-
if (step.kind !== "move")
|
|
125
|
-
return { v: 1, ok: true, state: h.record.state };
|
|
126
|
-
const next = { ...h.record, state: step.next };
|
|
127
|
-
if (!(await project(h, next)))
|
|
128
|
-
return { v: 1, ok: false, code: closed ? "unknown" : "conflict" };
|
|
129
|
-
h.record = next;
|
|
130
|
-
h.give(verdictFor(next.state, next.deadline));
|
|
131
|
-
// The control server confirms or refuses a handoff within 5 s; the bound only covers a hook that
|
|
132
|
-
// never reports at all. An answerer waits longer, so it reads the outcome below.
|
|
133
|
-
const delivered = await Promise.race([h.delivered, sleep(PERMISSION_HANDOFF_BOUND_MS).then(() => false)]);
|
|
134
|
-
if (delivered) {
|
|
135
|
-
remember(h);
|
|
136
|
-
return { v: 1, ok: true, state: h.record.state };
|
|
137
|
-
}
|
|
138
|
-
await apply(h, { kind: "undelivered", at: Date.now() });
|
|
139
|
-
return { v: 1, ok: false, code: "answered", state: h.record.state };
|
|
140
|
-
});
|
|
141
|
-
}
|
|
142
|
-
return {
|
|
143
|
-
hold(ask, hookGone) {
|
|
144
|
-
if (closed)
|
|
145
|
-
return { verdict: Promise.resolve(RELEASE), confirm: () => { } };
|
|
146
|
-
const askedAt = Date.now();
|
|
147
|
-
const base = {
|
|
148
|
-
v: 1, id: mintPermissionRequestId(), agent: port.agent, holder: port.holder, tool: ask.tool,
|
|
149
|
-
...(ask.cwd ? { cwd: ask.cwd } : {}), askedAt,
|
|
150
|
-
...(opts.deadlineMs !== undefined ? { deadline: askedAt + opts.deadlineMs } : {}),
|
|
151
|
-
state: { kind: "pending" },
|
|
152
|
-
};
|
|
153
|
-
const record = { ...base, input: permissionInput(base, ask.input) };
|
|
154
|
-
let settle;
|
|
155
|
-
const verdict = new Promise((resolve) => (settle = resolve));
|
|
156
|
-
let confirm;
|
|
157
|
-
const delivered = new Promise((resolve) => (confirm = resolve));
|
|
158
|
-
const h = {
|
|
159
|
-
record, revision: "absent", step: 0, chain: Promise.resolve(), hook: "waiting", ran: false, tainted: false,
|
|
160
|
-
call: callKey(ask.tool, ask.input), scope: ask.scope, delivered, timers: [],
|
|
161
|
-
give(v) {
|
|
162
|
-
if (h.hook === "answered")
|
|
163
|
-
return;
|
|
164
|
-
h.hook = "answered";
|
|
165
|
-
settle(v);
|
|
166
|
-
},
|
|
167
|
-
};
|
|
168
|
-
prompts.set(record.id, h);
|
|
169
|
-
void enqueue(h, () => project(h, record));
|
|
170
|
-
const withdraw = () => {
|
|
171
|
-
if (h.hook === "waiting")
|
|
172
|
-
h.hook = "gone";
|
|
173
|
-
later(h, settleMs, () => { if (!closed)
|
|
174
|
-
signal(h, { kind: "withdrawn", at: Date.now() }); });
|
|
175
|
-
};
|
|
176
|
-
if (hookGone.aborted)
|
|
177
|
-
withdraw();
|
|
178
|
-
else
|
|
179
|
-
hookGone.addEventListener("abort", withdraw, { once: true });
|
|
180
|
-
if (record.deadline !== undefined)
|
|
181
|
-
later(h, record.deadline - askedAt, () => signal(h, { kind: "deadline", at: Date.now() }));
|
|
182
|
-
return { verdict, confirm: (d) => confirm(d) };
|
|
183
|
-
},
|
|
184
|
-
toolsRan(calls, scope) {
|
|
185
|
-
// The prompt names no call id, so a run matches by scope, tool and input, one run to one prompt.
|
|
186
|
-
// `prompts` keeps hold order, so the oldest matching prompt settles first.
|
|
187
|
-
for (const c of calls) {
|
|
188
|
-
const call = callKey(c.tool, c.input);
|
|
189
|
-
if (call === undefined)
|
|
190
|
-
continue;
|
|
191
|
-
for (const h of prompts.values())
|
|
192
|
-
if (h.hook === "waiting" && !h.ran && h.scope === scope && h.call === call) {
|
|
193
|
-
ran(h);
|
|
194
|
-
break;
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
},
|
|
198
|
-
turnEnded(scope) {
|
|
199
|
-
for (const h of prompts.values())
|
|
200
|
-
if (h.hook === "waiting" && !h.ran && h.scope === scope)
|
|
201
|
-
ran(h);
|
|
202
|
-
},
|
|
203
|
-
waiting() {
|
|
204
|
-
let newest;
|
|
205
|
-
for (const h of prompts.values())
|
|
206
|
-
if (h.hook === "waiting" && !h.ran && h.record.state.kind === "pending" && (!newest || h.record.askedAt >= newest.record.askedAt))
|
|
207
|
-
newest = h;
|
|
208
|
-
return newest?.record.id;
|
|
209
|
-
},
|
|
210
|
-
close() {
|
|
211
|
-
if (closed)
|
|
212
|
-
return;
|
|
213
|
-
closed = true;
|
|
214
|
-
port.close();
|
|
215
|
-
for (const h of prompts.values()) {
|
|
216
|
-
for (const t of h.timers)
|
|
217
|
-
clearTimeout(t);
|
|
218
|
-
h.give(RELEASE);
|
|
219
|
-
}
|
|
220
|
-
},
|
|
221
|
-
};
|
|
222
|
-
}
|
|
223
|
-
//# sourceMappingURL=permission-desk.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"permission-desk.js","sourceRoot":"","sources":["../src/permission-desk.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EACL,2BAA2B,EAC3B,aAAa,EACb,uBAAuB,EACvB,eAAe,EACf,cAAc,GAUf,MAAM,gBAAgB,CAAC;AAkDxB,MAAM,QAAQ,GAAG,KAAK,CAAC;AACvB,wFAAwF;AACxF,MAAM,cAAc,GAAG,GAAG,CAAC;AAC3B,MAAM,OAAO,GAAsB,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;AAEvD,MAAM,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