@cotal-ai/connector-core 0.133.13 → 0.135.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 +71 -4
- package/dist/agent.d.ts.map +1 -1
- package/dist/agent.js +228 -33
- package/dist/agent.js.map +1 -1
- package/dist/briefing.d.ts +27 -0
- package/dist/briefing.d.ts.map +1 -0
- package/dist/briefing.js +58 -0
- package/dist/briefing.js.map +1 -0
- package/dist/config.d.ts +1 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js.map +1 -1
- package/dist/control.d.ts +3 -2
- package/dist/control.d.ts.map +1 -1
- package/dist/control.js +1 -1
- 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.d.ts.map +1 -1
- package/dist/docs-bundle.generated.js +13 -6
- package/dist/docs-bundle.generated.js.map +1 -1
- package/dist/docs-index.bin +0 -0
- package/dist/gateway.d.ts.map +1 -1
- package/dist/gateway.js +6 -2
- package/dist/gateway.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/manager-call.d.ts +7 -1
- package/dist/manager-call.d.ts.map +1 -1
- package/dist/manager-call.js +39 -1
- package/dist/manager-call.js.map +1 -1
- package/dist/once.d.ts +53 -0
- package/dist/once.d.ts.map +1 -0
- package/dist/once.js +126 -0
- package/dist/once.js.map +1 -0
- package/dist/orientation.d.ts +11 -3
- package/dist/orientation.d.ts.map +1 -1
- package/dist/orientation.js +29 -8
- package/dist/orientation.js.map +1 -1
- package/dist/tool-specs.d.ts +14 -1
- package/dist/tool-specs.d.ts.map +1 -1
- package/dist/tool-specs.js +197 -50
- package/dist/tool-specs.js.map +1 -1
- package/package.json +3 -3
package/dist/manager-call.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BASELINE_LIFECYCLE_ENDPOINT, EpEnvelopeError, dialerFor, goalFollowRefusal, invokeCommand, isPermissionDenied, issuedUserCaller, managerCallerBinding, replyRefusedBeforeEffect, resolveService, standaloneConnectOpts, } from "@cotal-ai/core";
|
|
1
|
+
import { BASELINE_LIFECYCLE_ENDPOINT, EpEnvelopeError, dialerFor, goalFollowRefusal, invokeCommand, isPermissionDenied, issuedUserCaller, managerCallerBinding, registryListingCaller, replyRefusedBeforeEffect, resolveService, standaloneConnectOpts, } from "@cotal-ai/core";
|
|
2
2
|
/** Credentials whose manager-call view the broker refused an accepted row for. Successful legacy
|
|
3
3
|
* calls skip that read until {@link LEGACY_RAIL_RECHECK_MS}; a permission-failed resolve rechecks
|
|
4
4
|
* its own connection, whose issued view may have changed with the direct parent's grant.
|
|
@@ -22,6 +22,44 @@ function rememberLegacyRail(key) {
|
|
|
22
22
|
}
|
|
23
23
|
/** Forget every remembered legacy-rail verdict. For tests that reuse a process across stacks. */
|
|
24
24
|
export function forgetLegacyRail() { legacyRail.clear(); }
|
|
25
|
+
/** Open a manager-call connection on `token` as a manager call opens it, find the caller a registry
|
|
26
|
+
* listing rides on it (SPEC 13.15), run `ask` over it, and close it. `exp` is the bearer's expiry,
|
|
27
|
+
* the listing's horizon at the callout. The issued read shares the manager calls' legacy-rail
|
|
28
|
+
* memory, so a legacy credential is refused that read once, not once per listing. */
|
|
29
|
+
export async function withUserManagerListing(config, token, exp, ask) {
|
|
30
|
+
const user = config.userAuth;
|
|
31
|
+
const binding = managerCallerBinding(token, {
|
|
32
|
+
space: config.space, owner: user.owner, actor: user.actor, lifecycleUid: config.lifecycleUid, instanceId: config.managerInstanceId,
|
|
33
|
+
});
|
|
34
|
+
const railKey = binding.credentialId ?? token;
|
|
35
|
+
const connectOpts = standaloneConnectOpts({ bearer: token, sentinelCreds: user.sentinelCreds, tls: config.tls });
|
|
36
|
+
const connId = String(connectOpts.name);
|
|
37
|
+
const nc = await dialerFor(config.servers)({ servers: config.servers, ...connectOpts, maxReconnectAttempts: 0, timeout: 10_000 });
|
|
38
|
+
// An issued view lists as itself; any other under the listing generation its credential carries.
|
|
39
|
+
const issued = async () => {
|
|
40
|
+
try {
|
|
41
|
+
const caller = await issuedUserCaller(nc, config.space, connId, binding.caller);
|
|
42
|
+
legacyRail.delete(railKey);
|
|
43
|
+
return caller;
|
|
44
|
+
}
|
|
45
|
+
catch (e) {
|
|
46
|
+
if (!isPermissionDenied(e))
|
|
47
|
+
throw e;
|
|
48
|
+
rememberLegacyRail(railKey);
|
|
49
|
+
return undefined;
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
try {
|
|
53
|
+
const skipped = onLegacyRail(railKey);
|
|
54
|
+
const caller = skipped ? undefined : await issued();
|
|
55
|
+
const listing = caller ?? await registryListingCaller(nc, config.space, binding.caller, { connId, ...(exp !== undefined ? { exp } : {}) });
|
|
56
|
+
// A remembered legacy verdict may be stale: with no listing binding, check the issued read once.
|
|
57
|
+
return await ask(nc, listing ?? (skipped ? await issued() : undefined));
|
|
58
|
+
}
|
|
59
|
+
finally {
|
|
60
|
+
await nc.drain().catch(() => nc.close());
|
|
61
|
+
}
|
|
62
|
+
}
|
|
25
63
|
/** A control connection never replaces the seat's presence, messages or standing bearer source. */
|
|
26
64
|
export async function invokeUserManager(config, bearer, command, args, opts = {}) {
|
|
27
65
|
opts.signal?.throwIfAborted();
|
package/dist/manager-call.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"manager-call.js","sourceRoot":"","sources":["../src/manager-call.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,2BAA2B,EAC3B,eAAe,EACf,SAAS,EACT,iBAAiB,EACjB,aAAa,EACb,kBAAkB,EAClB,gBAAgB,EAChB,oBAAoB,EACpB,wBAAwB,EACxB,cAAc,EACd,qBAAqB,
|
|
1
|
+
{"version":3,"file":"manager-call.js","sourceRoot":"","sources":["../src/manager-call.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,2BAA2B,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|
|
|
1
|
+
/**
|
|
2
|
+
* The seat side of a `once` task's handoff. A once task is handed to the harness at most once per
|
|
3
|
+
* seat process: a second run of it is one the spawner could not see, so an ambiguous handoff ends
|
|
4
|
+
* the task instead of offering it again.
|
|
5
|
+
*
|
|
6
|
+
* A task moves pending → claimed → confirmed, or claimed → sealed. Claimed is a permit an adapter
|
|
7
|
+
* takes at its dispatch site, right before the native send; confirmed is its native acceptance
|
|
8
|
+
* ({@link MeshAgent.commitSurfacedTurns}); sealed is a dispatch it gave up on, or a claim that
|
|
9
|
+
* outlived {@link ONCE_HANDOFF_MS}. The first of confirmed and sealed wins, and neither is undone.
|
|
10
|
+
* A dispatch whose send is its acceptance, such as a prompt hook that edits the prompt in place in
|
|
11
|
+
* the same synchronous step as its peek, confirms without a claim.
|
|
12
|
+
*
|
|
13
|
+
* The state lives in one registry per process, reached through a `Symbol.for` key, so every copy
|
|
14
|
+
* of this module loaded in the process and every `MeshAgent` built again for the same seat read
|
|
15
|
+
* the same entries. A once seat is never restarted, so no second process runs under its uid.
|
|
16
|
+
*/
|
|
17
|
+
/** The bound on one dispatch attempt, from the claim to the harness's acceptance. It is above every
|
|
18
|
+
* adapter's own dispatch timeout and never measures the model's response. */
|
|
19
|
+
export declare const ONCE_HANDOFF_MS = 60000;
|
|
20
|
+
/** How long a seat that must end itself waits for its own graceful shutdown before it exits. */
|
|
21
|
+
export declare const ONCE_EXIT_GRACE_MS = 10000;
|
|
22
|
+
export type OnceHandoffState = "pending" | "claimed" | "confirmed" | "sealed";
|
|
23
|
+
export declare function onceHandoffState(uid: string, goalId: string): OnceHandoffState;
|
|
24
|
+
/** Take the permit for every once task in `goalIds`, or for none: succeeds only when each is still
|
|
25
|
+
* pending, and starts each one's handoff timer. */
|
|
26
|
+
export declare function claimOnceHandoff(uid: string, goalIds: readonly string[]): boolean;
|
|
27
|
+
/** The harness accepted the task. False when the handoff was already sealed: that task is not
|
|
28
|
+
* marked surfaced, so no automatic yield follows for it. */
|
|
29
|
+
export declare function confirmOnceHandoff(uid: string, goalId: string): boolean;
|
|
30
|
+
/** Seal a claimed task as not confirmed. True only for the call that sealed it. */
|
|
31
|
+
export declare function sealOnceHandoff(uid: string, goalId: string): boolean;
|
|
32
|
+
/** End the handoff of a task its manager settled without this seat (its deadline, a stop), whether
|
|
33
|
+
* or not a dispatch had claimed it, so no later claim can send it. A confirmed task stays confirmed.
|
|
34
|
+
* Nothing is reported: the manager already holds the task's terminal. */
|
|
35
|
+
export declare function endOnceHandoff(uid: string, goalId: string): void;
|
|
36
|
+
/** The dispatch left the seat; the acceptance arrives with the model's response, which the
|
|
37
|
+
* handoff timer must not measure. */
|
|
38
|
+
export declare function stopOnceHandoffTimer(uid: string, goalId: string): void;
|
|
39
|
+
export declare function onOnceHandoffTimeout(fn: (uid: string, goalId: string) => void): void;
|
|
40
|
+
/** An adapter's graceful shutdown for a once seat that must end itself. It starts the shutdown and
|
|
41
|
+
* returns nothing, or answers whether the seat is ending: an adapter whose own process is not the
|
|
42
|
+
* seat (Claude's MCP server is a child of `claude`) answers false when it cannot end the seat. A
|
|
43
|
+
* promise must settle, since no forced exit is armed until it does. */
|
|
44
|
+
export type OnceExit = () => void | boolean | Promise<boolean>;
|
|
45
|
+
/** Register the adapter's graceful shutdown for a once seat that must end itself. */
|
|
46
|
+
export declare function registerOnceExit(fn: OnceExit): void;
|
|
47
|
+
/** End this seat: start the adapter's graceful shutdown, then exit this process after
|
|
48
|
+
* {@link ONCE_EXIT_GRACE_MS} whatever that shutdown is doing. Its manager proves the exit, and the
|
|
49
|
+
* exit settles the task. A shutdown that answers false declines: no forced exit is armed, this
|
|
50
|
+
* process keeps running, and the caller keeps reporting. Resolves whether the seat is ending; a
|
|
51
|
+
* call while an exit is in flight gets that exit's answer. */
|
|
52
|
+
export declare function exitOnceSeat(): Promise<boolean>;
|
|
53
|
+
//# sourceMappingURL=once.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"once.d.ts","sourceRoot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C,OAAO,CAAC,CAU/C"}
|
package/dist/once.js
ADDED
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The seat side of a `once` task's handoff. A once task is handed to the harness at most once per
|
|
3
|
+
* seat process: a second run of it is one the spawner could not see, so an ambiguous handoff ends
|
|
4
|
+
* the task instead of offering it again.
|
|
5
|
+
*
|
|
6
|
+
* A task moves pending → claimed → confirmed, or claimed → sealed. Claimed is a permit an adapter
|
|
7
|
+
* takes at its dispatch site, right before the native send; confirmed is its native acceptance
|
|
8
|
+
* ({@link MeshAgent.commitSurfacedTurns}); sealed is a dispatch it gave up on, or a claim that
|
|
9
|
+
* outlived {@link ONCE_HANDOFF_MS}. The first of confirmed and sealed wins, and neither is undone.
|
|
10
|
+
* A dispatch whose send is its acceptance, such as a prompt hook that edits the prompt in place in
|
|
11
|
+
* the same synchronous step as its peek, confirms without a claim.
|
|
12
|
+
*
|
|
13
|
+
* The state lives in one registry per process, reached through a `Symbol.for` key, so every copy
|
|
14
|
+
* of this module loaded in the process and every `MeshAgent` built again for the same seat read
|
|
15
|
+
* the same entries. A once seat is never restarted, so no second process runs under its uid.
|
|
16
|
+
*/
|
|
17
|
+
/** The bound on one dispatch attempt, from the claim to the harness's acceptance. It is above every
|
|
18
|
+
* adapter's own dispatch timeout and never measures the model's response. */
|
|
19
|
+
export const ONCE_HANDOFF_MS = 60_000;
|
|
20
|
+
/** How long a seat that must end itself waits for its own graceful shutdown before it exits. */
|
|
21
|
+
export const ONCE_EXIT_GRACE_MS = 10_000;
|
|
22
|
+
const KEY = Symbol.for("cotal.once-handoff");
|
|
23
|
+
function proc() {
|
|
24
|
+
const g = globalThis;
|
|
25
|
+
return (g[KEY] ??= { handoffs: new Map() });
|
|
26
|
+
}
|
|
27
|
+
const keyOf = (uid, goalId) => `${uid}:${goalId}`;
|
|
28
|
+
export function onceHandoffState(uid, goalId) {
|
|
29
|
+
return proc().handoffs.get(keyOf(uid, goalId))?.state ?? "pending";
|
|
30
|
+
}
|
|
31
|
+
/** Take the permit for every once task in `goalIds`, or for none: succeeds only when each is still
|
|
32
|
+
* pending, and starts each one's handoff timer. */
|
|
33
|
+
export function claimOnceHandoff(uid, goalIds) {
|
|
34
|
+
const p = proc();
|
|
35
|
+
if (goalIds.some((id) => onceHandoffState(uid, id) !== "pending"))
|
|
36
|
+
return false;
|
|
37
|
+
for (const id of goalIds) {
|
|
38
|
+
const timer = setTimeout(() => p.timedOut?.(uid, id), ONCE_HANDOFF_MS);
|
|
39
|
+
timer.unref?.();
|
|
40
|
+
p.handoffs.set(keyOf(uid, id), { state: "claimed", timer });
|
|
41
|
+
}
|
|
42
|
+
return true;
|
|
43
|
+
}
|
|
44
|
+
/** The harness accepted the task. False when the handoff was already sealed: that task is not
|
|
45
|
+
* marked surfaced, so no automatic yield follows for it. */
|
|
46
|
+
export function confirmOnceHandoff(uid, goalId) {
|
|
47
|
+
const h = proc().handoffs.get(keyOf(uid, goalId));
|
|
48
|
+
if (h?.state === "sealed")
|
|
49
|
+
return false;
|
|
50
|
+
if (h?.timer !== undefined)
|
|
51
|
+
clearTimeout(h.timer);
|
|
52
|
+
proc().handoffs.set(keyOf(uid, goalId), { state: "confirmed" });
|
|
53
|
+
return true;
|
|
54
|
+
}
|
|
55
|
+
/** Seal a claimed task as not confirmed. True only for the call that sealed it. */
|
|
56
|
+
export function sealOnceHandoff(uid, goalId) {
|
|
57
|
+
const h = proc().handoffs.get(keyOf(uid, goalId));
|
|
58
|
+
if (h?.state !== "claimed")
|
|
59
|
+
return false;
|
|
60
|
+
if (h.timer !== undefined)
|
|
61
|
+
clearTimeout(h.timer);
|
|
62
|
+
proc().handoffs.set(keyOf(uid, goalId), { state: "sealed" });
|
|
63
|
+
return true;
|
|
64
|
+
}
|
|
65
|
+
/** End the handoff of a task its manager settled without this seat (its deadline, a stop), whether
|
|
66
|
+
* or not a dispatch had claimed it, so no later claim can send it. A confirmed task stays confirmed.
|
|
67
|
+
* Nothing is reported: the manager already holds the task's terminal. */
|
|
68
|
+
export function endOnceHandoff(uid, goalId) {
|
|
69
|
+
const h = proc().handoffs.get(keyOf(uid, goalId));
|
|
70
|
+
if (h?.state === "confirmed" || h?.state === "sealed")
|
|
71
|
+
return;
|
|
72
|
+
if (h?.timer !== undefined)
|
|
73
|
+
clearTimeout(h.timer);
|
|
74
|
+
proc().handoffs.set(keyOf(uid, goalId), { state: "sealed" });
|
|
75
|
+
}
|
|
76
|
+
/** The dispatch left the seat; the acceptance arrives with the model's response, which the
|
|
77
|
+
* handoff timer must not measure. */
|
|
78
|
+
export function stopOnceHandoffTimer(uid, goalId) {
|
|
79
|
+
const h = proc().handoffs.get(keyOf(uid, goalId));
|
|
80
|
+
if (h?.state !== "claimed" || h.timer === undefined)
|
|
81
|
+
return;
|
|
82
|
+
clearTimeout(h.timer);
|
|
83
|
+
h.timer = undefined;
|
|
84
|
+
}
|
|
85
|
+
export function onOnceHandoffTimeout(fn) {
|
|
86
|
+
proc().timedOut = fn;
|
|
87
|
+
}
|
|
88
|
+
/** Register the adapter's graceful shutdown for a once seat that must end itself. */
|
|
89
|
+
export function registerOnceExit(fn) {
|
|
90
|
+
proc().exit = fn;
|
|
91
|
+
}
|
|
92
|
+
/** End this seat: start the adapter's graceful shutdown, then exit this process after
|
|
93
|
+
* {@link ONCE_EXIT_GRACE_MS} whatever that shutdown is doing. Its manager proves the exit, and the
|
|
94
|
+
* exit settles the task. A shutdown that answers false declines: no forced exit is armed, this
|
|
95
|
+
* process keeps running, and the caller keeps reporting. Resolves whether the seat is ending; a
|
|
96
|
+
* call while an exit is in flight gets that exit's answer. */
|
|
97
|
+
export function exitOnceSeat() {
|
|
98
|
+
const p = proc();
|
|
99
|
+
if (p.exiting)
|
|
100
|
+
return p.exiting;
|
|
101
|
+
const exiting = askOnceExit(p.exit).then((ending) => {
|
|
102
|
+
if (!ending) {
|
|
103
|
+
p.exiting = undefined;
|
|
104
|
+
return false;
|
|
105
|
+
}
|
|
106
|
+
setTimeout(() => process.exit(1), ONCE_EXIT_GRACE_MS);
|
|
107
|
+
return true;
|
|
108
|
+
});
|
|
109
|
+
p.exiting = exiting;
|
|
110
|
+
return exiting;
|
|
111
|
+
}
|
|
112
|
+
/** Whether the adapter's shutdown says the seat is ending: anything but false does, a throw included,
|
|
113
|
+
* and a promise does unless it answers false or rejects. */
|
|
114
|
+
async function askOnceExit(exit) {
|
|
115
|
+
let ending;
|
|
116
|
+
try {
|
|
117
|
+
ending = exit?.();
|
|
118
|
+
}
|
|
119
|
+
catch {
|
|
120
|
+
return true;
|
|
121
|
+
}
|
|
122
|
+
if (ending instanceof Promise)
|
|
123
|
+
ending = await ending.catch(() => false);
|
|
124
|
+
return ending !== false;
|
|
125
|
+
}
|
|
126
|
+
//# sourceMappingURL=once.js.map
|
package/dist/once.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"once.js","sourceRoot":"","sources":["../src/once.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH;8EAC8E;AAC9E,MAAM,CAAC,MAAM,eAAe,GAAG,MAAM,CAAC;AACtC,gGAAgG;AAChG,MAAM,CAAC,MAAM,kBAAkB,GAAG,MAAM,CAAC;AAczC,MAAM,GAAG,GAAG,MAAM,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAC;AAE7C,SAAS,IAAI;IACX,MAAM,CAAC,GAAG,UAAqC,CAAC;IAChD,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,EAAE,QAAQ,EAAE,IAAI,GAAG,EAAE,EAAE,CAAC,CAAC;AAC9C,CAAC;AAED,MAAM,KAAK,GAAG,CAAC,GAAW,EAAE,MAAc,EAAU,EAAE,CAAC,GAAG,GAAG,IAAI,MAAM,EAAE,CAAC;AAE1E,MAAM,UAAU,gBAAgB,CAAC,GAAW,EAAE,MAAc;IAC1D,OAAO,IAAI,EAAE,CAAC,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,EAAE,MAAM,CAAC,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,GAAG,EAAE,CAAC,KAAK,CAAC,CAAC;IACxE,OAAO,MAAM,KAAK,KAAK,CAAC;AAC1B,CAAC"}
|
package/dist/orientation.d.ts
CHANGED
|
@@ -25,9 +25,11 @@ export declare const MESH_FIRST_STEER: string;
|
|
|
25
25
|
* at durable cotal-lang runs for coordination that must outlive their own session, so the reflex is
|
|
26
26
|
* a journalled `cotal run` rather than an improvised loop held in one agent's context. */
|
|
27
27
|
export declare const WORKFLOW_STEER: string;
|
|
28
|
-
/** Where to talk, folded in beside {@link ORIENTATION_BOOTSTRAP} for every connector.
|
|
29
|
-
*
|
|
30
|
-
*
|
|
28
|
+
/** Where to talk, folded in beside {@link ORIENTATION_BOOTSTRAP} for every connector. Leads with
|
|
29
|
+
* the model (information moves through channels), then the rule (channel for work, a mention to
|
|
30
|
+
* make one peer act, a DM for what one peer alone needs), then the mechanics. A fresh seat may
|
|
31
|
+
* start on no channel, so it is told how to find and join one, and how a helper it spawns gets
|
|
32
|
+
* one. Guidance only: it grants nothing and changes no subscription. */
|
|
31
33
|
export declare const CHANNEL_GUIDANCE: string;
|
|
32
34
|
/** A tool the agent can actually call (already gated), as it appears in the card. */
|
|
33
35
|
export interface OrientationTool {
|
|
@@ -77,6 +79,12 @@ export interface Orientation {
|
|
|
77
79
|
readAcl: string[];
|
|
78
80
|
/** Post ACL — channels you may broadcast to. Empty ⇒ read-only (default-deny). */
|
|
79
81
|
post: string[];
|
|
82
|
+
/** Concrete channels in the read ACL you are NOT on yet, each with its registry note when the
|
|
83
|
+
* registry has one: where to look before the first send, without a second call. */
|
|
84
|
+
joinable: {
|
|
85
|
+
channel: string;
|
|
86
|
+
note?: string;
|
|
87
|
+
}[];
|
|
80
88
|
};
|
|
81
89
|
/** Control-plane capabilities (e.g. `spawn`). Empty ⇒ none beyond the defaults granted to all. */
|
|
82
90
|
capabilities: string[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"orientation.d.ts","sourceRoot":"","sources":["../src/orientation.ts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F;AAgBD;;;kBAGkB;AAClB,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,UAAU,GAAG,WAAW,CAAC,UAAU,CAAC,CAa5F;AAED;;;iDAGiD;AACjD,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,SAAS,EAChB,MAAM,EAAE,WAAW,EACnB,YAAY,EAAE,eAAe,EAAE,EAC/B,WAAW,EAAE,MAAM,EACnB,IAAI,EAAE,UAAU,GACf,WAAW,CAiEb;AAED,8EAA8E;AAC9E,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,WAAW,GAAG,MAAM,CA2CxD"}
|
package/dist/orientation.js
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* The typed {@link Orientation} object is the source of truth; {@link renderOrientation} is one view of
|
|
10
10
|
* it (the text the model reads). A future MCP resource can JSON-stringify the object directly.
|
|
11
11
|
*/
|
|
12
|
-
import { parsePrincipalKey, peerLabel } from "@cotal-ai/core";
|
|
12
|
+
import { isConcreteChannel, parsePrincipalKey, peerLabel } from "@cotal-ai/core";
|
|
13
13
|
import { presenceReadCondition } from "./agent.js";
|
|
14
14
|
import { isAuthed } from "./config.js";
|
|
15
15
|
import { DOCS_VERSION } from "./docs.js";
|
|
@@ -25,7 +25,8 @@ export const ORIENTATION_BOOTSTRAP = "Start with cotal_orientation — it shows
|
|
|
25
25
|
export const MESH_FIRST_STEER = "Keep multi-agent work on the mesh. Before reaching for your harness's own subagents, Task tool, or " +
|
|
26
26
|
"any built-in parallel-agent feature, do it through Cotal instead: spawn or delegate to a real peer " +
|
|
27
27
|
"(cotal_spawn if you have it, otherwise cotal_dm or cotal_anycast to reach one) so the work stays " +
|
|
28
|
-
"visible to the user and addressable by peers rather than hidden inside a private subagent."
|
|
28
|
+
"visible to the user and addressable by peers rather than hidden inside a private subagent. For a " +
|
|
29
|
+
"single task, cotal_spawn with once: true starts a helper that is stopped when the task ends.";
|
|
29
30
|
/** Workflow-run steer, folded in beside {@link MESH_FIRST_STEER} for every connector. Points agents
|
|
30
31
|
* at durable cotal-lang runs for coordination that must outlive their own session, so the reflex is
|
|
31
32
|
* a journalled `cotal run` rather than an improvised loop held in one agent's context. */
|
|
@@ -33,12 +34,24 @@ export const WORKFLOW_STEER = "Coordination that must survive restarts (multi-st
|
|
|
33
34
|
"fan-out over agents) belongs in a durable workflow run: a cotal-lang program driven with " +
|
|
34
35
|
"`cotal run start`, resumable on any host from its step journal. Read the `workflows` page via " +
|
|
35
36
|
"cotal_docs before improvising such a loop in your own context.";
|
|
36
|
-
/** Where to talk, folded in beside {@link ORIENTATION_BOOTSTRAP} for every connector.
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
37
|
+
/** Where to talk, folded in beside {@link ORIENTATION_BOOTSTRAP} for every connector. Leads with
|
|
38
|
+
* the model (information moves through channels), then the rule (channel for work, a mention to
|
|
39
|
+
* make one peer act, a DM for what one peer alone needs), then the mechanics. A fresh seat may
|
|
40
|
+
* start on no channel, so it is told how to find and join one, and how a helper it spawns gets
|
|
41
|
+
* one. Guidance only: it grants nothing and changes no subscription. */
|
|
42
|
+
export const CHANNEL_GUIDANCE = "Information moves through channels. Subscribe to the channel where what you need is published, " +
|
|
43
|
+
"and publish what others may need on the channel where they will look for it. The channel you work " +
|
|
44
|
+
"on is where your work happens: post plans, status, results and decisions there with cotal_send, so every peer on it, " +
|
|
45
|
+
"and anyone who joins later, reads them without being asked. A plain post wakes nobody; @mention a " +
|
|
46
|
+
"peer only when that peer must act now, since a mention wakes them, and a mention in an " +
|
|
47
|
+
"acknowledgement or sign-off starts a wake-up loop. Use cotal_dm only for something one peer alone " +
|
|
48
|
+
"needs, because a DM is invisible to everyone else, and cotal_anycast to ask whoever holds a role. " +
|
|
49
|
+
"A channel's purpose is its registry note (cotal_channel_info); cotal_channels lists them and " +
|
|
50
|
+
"cotal_join adds one within your read allowance. To follow every channel under a prefix, join a " +
|
|
51
|
+
"family such as team.>: posts on its durable channels are kept for you while you are away, from the " +
|
|
52
|
+
"join on. A helper you spawn starts on no channel unless you " +
|
|
53
|
+
"pass join, so pass the channel you are working on. Post on #announce only for a deliberate notice " +
|
|
54
|
+
"to the whole space.";
|
|
42
55
|
/** The everyday loop (the `core` group); every other tool falls into `more`. Keep in sync with the
|
|
43
56
|
* reply/loop tools an agent reaches for each turn. An unknown/new tool defaults to `more`. */
|
|
44
57
|
const CORE_TOOLS = new Set([
|
|
@@ -115,6 +128,12 @@ export function buildOrientation(agent, config, visibleTools, generatedAt, read)
|
|
|
115
128
|
read: config.subscribe,
|
|
116
129
|
readAcl: config.allowSubscribe,
|
|
117
130
|
post: config.allowPublish,
|
|
131
|
+
joinable: config.allowSubscribe
|
|
132
|
+
.filter((c) => isConcreteChannel(c) && !config.subscribe.includes(c))
|
|
133
|
+
.map((channel) => {
|
|
134
|
+
const note = agent.channelInfo(channel).description?.trim();
|
|
135
|
+
return note ? { channel, note } : { channel };
|
|
136
|
+
}),
|
|
118
137
|
},
|
|
119
138
|
capabilities: config.capabilities ?? [],
|
|
120
139
|
tools: { core, more },
|
|
@@ -155,6 +174,8 @@ export function renderOrientation(o) {
|
|
|
155
174
|
];
|
|
156
175
|
if (aclDiffers)
|
|
157
176
|
lines.push(` • may join (read ACL): ${fmt(o.access.readAcl)}`);
|
|
177
|
+
if (o.access.joinable.length)
|
|
178
|
+
lines.push(` • not on yet: ${o.access.joinable.map((j) => `#${j.channel}${j.note ? ` (${j.note})` : ""}`).join(", ")} · join one with cotal_join`);
|
|
158
179
|
lines.push(` • post: ${o.access.post.length ? fmt(o.access.post) : "— (read-only; no post channels)"}`, ` • capabilities: ${o.capabilities.length ? o.capabilities.join(", ") : "none beyond defaults"}`, "", `Tools — core loop: ${o.tools.core.map((t) => t.name).join(", ") || "—"}`, `Tools — more: ${o.tools.more.map((t) => t.name).join(", ") || "—"}`, "", `Right now (snapshot @ ${new Date(o.generatedAt).toISOString()}):`, ` • status: ${honestStatus(o.status)} · attention: ${o.attention}`, ` • peers present: ${o.peers.present} — ${o.peers.summary}`, ` • presence view: ${o.presence.live ? "live" : `NOT LIVE — ${o.presence.detail}`}`, ` • unread: ${o.unread.total}`, "", `Act → read: ${o.actions.read} · reply on a channel: ${o.actions.replyChannel} · ` +
|
|
159
180
|
`private: ${o.actions.replyPrivate} · ask a role: ${o.actions.askRole}`);
|
|
160
181
|
return lines.join("\n");
|
package/dist/orientation.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"orientation.js","sourceRoot":"","sources":["../src/orientation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EAAE,iBAAiB,EAAE,SAAS,EAA2C,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"orientation.js","sourceRoot":"","sources":["../src/orientation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,SAAS,EAA2C,MAAM,gBAAgB,CAAC;AAC1H,OAAO,EAAE,qBAAqB,EAAmC,MAAM,YAAY,CAAC;AACpF,OAAO,EAAE,QAAQ,EAAoB,MAAM,aAAa,CAAC;AACzD,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAEzC;;2DAE2D;AAC3D,MAAM,CAAC,MAAM,qBAAqB,GAChC,uIAAuI;IACvI,mEAAmE,CAAC;AAEtE;;;2GAG2G;AAC3G,MAAM,CAAC,MAAM,gBAAgB,GAC3B,qGAAqG;IACrG,qGAAqG;IACrG,mGAAmG;IACnG,mGAAmG;IACnG,8FAA8F,CAAC;AAEjG;;2FAE2F;AAC3F,MAAM,CAAC,MAAM,cAAc,GACzB,6FAA6F;IAC7F,2FAA2F;IAC3F,gGAAgG;IAChG,gEAAgE,CAAC;AAEnE;;;;yEAIyE;AACzE,MAAM,CAAC,MAAM,gBAAgB,GAC3B,iGAAiG;IACjG,oGAAoG;IACpG,uHAAuH;IACvH,oGA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,EAAE,EAC/B,EAAE,EACF,eAAe,CAAC,CAAC,OAAO,CAAC,IAAI,0BAA0B,CAAC,CAAC,OAAO,CAAC,YAAY,KAAK;QAChF,YAAY,CAAC,CAAC,OAAO,CAAC,YAAY,kBAAkB,CAAC,CAAC,OAAO,CAAC,OAAO,EAAE,CAC1E,CAAC;IACF,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC"}
|
package/dist/tool-specs.d.ts
CHANGED
|
@@ -134,9 +134,22 @@ export declare function channelMeta(i: InboxItem): Record<string, string>;
|
|
|
134
134
|
* no channel qualifies; a send without a channel is then refused.
|
|
135
135
|
*/
|
|
136
136
|
export declare function defaultSendChannel(config: Pick<AgentConfig, "allowPublish" | "creds" | "userAuth">, reading: readonly string[]): string | undefined;
|
|
137
|
+
/**
|
|
138
|
+
* Why a send with no channel has nowhere to go, and the exact next call. Built from the channels
|
|
139
|
+
* the agent reads now and the channels its ACL lets it post to, so the refusal names a channel the
|
|
140
|
+
* agent can use rather than pointing at another tool. Two shapes: on no channel at all, or on
|
|
141
|
+
* channels it may post to none of. `postable` is empty where the ACL grants no concrete post
|
|
142
|
+
* channel the agent could name (an operator widens that; nothing here can).
|
|
143
|
+
*/
|
|
144
|
+
export declare function sendNoDefaultRemedy(config: Pick<AgentConfig, "allowSubscribe" | "allowPublish" | "creds" | "userAuth">, reading: readonly string[]): string;
|
|
145
|
+
/** The orientation card as the model reads it, over the SAME gated tool list the connector exposes
|
|
146
|
+
* (cotalToolSpecs already filters spawn/persona by capability), so the card can't claim a tool the
|
|
147
|
+
* agent can't call. The `cotal_orientation` tool, a connect result and a session-start hook all
|
|
148
|
+
* hand over this one rendering. */
|
|
149
|
+
export declare function orientationCard(agent: MeshAgent, config: AgentConfig, source?: string, env?: NodeJS.ProcessEnv, offered?: ReadonlySet<string>): Promise<string>;
|
|
137
150
|
/** How to reach a channel family, since every publish names one concrete channel (SPEC §3). The
|
|
138
151
|
* advertised `channel` text of `cotal_send`, here and in the gateway. */
|
|
139
|
-
export declare const PATTERN_SEND_HELP = "A pattern such as team.> is refused. To reach the agents
|
|
152
|
+
export declare const PATTERN_SEND_HELP = "A pattern such as team.> is refused. To reach the agents following team.>, post once to one channel it matches, such as team.announce: those connected then get it, and one that is away gets a stored copy if that channel is durable. To reach several channels, post to each by name (cotal_channels lists the existing ones).";
|
|
140
153
|
/** The full Cotal tool set for a given config. Renderers iterate this; `source` names the
|
|
141
154
|
* hosting connector and is stamped onto outgoing feedback. An explicit env restricts feedback's
|
|
142
155
|
* Git lookup to its global config; omitted preserves process inheritance and repository lookup.
|
package/dist/tool-specs.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool-specs.d.ts","sourceRoot":"","sources":["../src/tool-specs.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAmB,KAAK,SAAS,EAAE,KAAK,SAAS,EAAE,MAAM,YAAY,CAAC;AAI7E,OAAO,EAAY,KAAK,WAAW,EAAE,MAAM,aAAa,CAAC;AAKzD;;gGAEgG;AAChG,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACtC;AAiFD;;;;;;;sGAOsG;AACtG,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC;AAExD,0DAA0D;AAC1D,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB;;;;8FAI0F;IAC1F,MAAM,EAAE,cAAc,CAAC;IACvB,GAAG,CAAC,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,WAAW,EAAE,IAAI,EAAE,GA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