@cotal-ai/connector-core 0.133.13 → 0.134.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 +22 -2
- package/dist/agent.d.ts.map +1 -1
- package/dist/agent.js +38 -3
- 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/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 +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -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/orientation.d.ts +11 -3
- package/dist/orientation.d.ts.map +1 -1
- package/dist/orientation.js +25 -7
- package/dist/orientation.js.map +1 -1
- package/dist/tool-specs.d.ts +13 -0
- package/dist/tool-specs.d.ts.map +1 -1
- package/dist/tool-specs.js +79 -17
- package/dist/tool-specs.js.map +1 -1
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"orientation.d.ts","sourceRoot":"","sources":["../src/orientation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,
|
|
1
|
+
{"version":3,"file":"orientation.d.ts","sourceRoot":"","sources":["../src/orientation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;A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BAAgB,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";
|
|
@@ -33,12 +33,22 @@ export const WORKFLOW_STEER = "Coordination that must survive restarts (multi-st
|
|
|
33
33
|
"fan-out over agents) belongs in a durable workflow run: a cotal-lang program driven with " +
|
|
34
34
|
"`cotal run start`, resumable on any host from its step journal. Read the `workflows` page via " +
|
|
35
35
|
"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
|
-
|
|
36
|
+
/** Where to talk, folded in beside {@link ORIENTATION_BOOTSTRAP} for every connector. Leads with
|
|
37
|
+
* the model (information moves through channels), then the rule (channel for work, a mention to
|
|
38
|
+
* make one peer act, a DM for what one peer alone needs), then the mechanics. A fresh seat may
|
|
39
|
+
* start on no channel, so it is told how to find and join one, and how a helper it spawns gets
|
|
40
|
+
* one. Guidance only: it grants nothing and changes no subscription. */
|
|
41
|
+
export const CHANNEL_GUIDANCE = "Information moves through channels. Subscribe to the channel where what you need is published, " +
|
|
42
|
+
"and publish what others may need on the channel where they will look for it. The channel you work " +
|
|
43
|
+
"on is where your work happens: post plans, status, results and decisions there with cotal_send, so every peer on it, " +
|
|
44
|
+
"and anyone who joins later, reads them without being asked. A plain post wakes nobody; @mention a " +
|
|
45
|
+
"peer only when that peer must act now, since a mention wakes them, and a mention in an " +
|
|
46
|
+
"acknowledgement or sign-off starts a wake-up loop. Use cotal_dm only for something one peer alone " +
|
|
47
|
+
"needs, because a DM is invisible to everyone else, and cotal_anycast to ask whoever holds a role. " +
|
|
48
|
+
"A channel's purpose is its registry note (cotal_channel_info); cotal_channels lists them and " +
|
|
49
|
+
"cotal_join adds one within your read allowance. A helper you spawn starts on no channel unless you " +
|
|
50
|
+
"pass join, so pass the channel you are working on. Post on #announce only for a deliberate notice " +
|
|
51
|
+
"to the whole space.";
|
|
42
52
|
/** The everyday loop (the `core` group); every other tool falls into `more`. Keep in sync with the
|
|
43
53
|
* reply/loop tools an agent reaches for each turn. An unknown/new tool defaults to `more`. */
|
|
44
54
|
const CORE_TOOLS = new Set([
|
|
@@ -115,6 +125,12 @@ export function buildOrientation(agent, config, visibleTools, generatedAt, read)
|
|
|
115
125
|
read: config.subscribe,
|
|
116
126
|
readAcl: config.allowSubscribe,
|
|
117
127
|
post: config.allowPublish,
|
|
128
|
+
joinable: config.allowSubscribe
|
|
129
|
+
.filter((c) => isConcreteChannel(c) && !config.subscribe.includes(c))
|
|
130
|
+
.map((channel) => {
|
|
131
|
+
const note = agent.channelInfo(channel).description?.trim();
|
|
132
|
+
return note ? { channel, note } : { channel };
|
|
133
|
+
}),
|
|
118
134
|
},
|
|
119
135
|
capabilities: config.capabilities ?? [],
|
|
120
136
|
tools: { core, more },
|
|
@@ -155,6 +171,8 @@ export function renderOrientation(o) {
|
|
|
155
171
|
];
|
|
156
172
|
if (aclDiffers)
|
|
157
173
|
lines.push(` • may join (read ACL): ${fmt(o.access.readAcl)}`);
|
|
174
|
+
if (o.access.joinable.length)
|
|
175
|
+
lines.push(` • not on yet: ${o.access.joinable.map((j) => `#${j.channel}${j.note ? ` (${j.note})` : ""}`).join(", ")} · join one with cotal_join`);
|
|
158
176
|
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
177
|
`private: ${o.actions.replyPrivate} · ask a role: ${o.actions.askRole}`);
|
|
160
178
|
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,M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C,WAAW,EAAE,IAAI,EAClE,eAAe,YAAY,CAAC,CAAC,CAAC,MAAM,CAAC,iBAAiB,CAAC,CAAC,SAAS,EAAE,EACnE,sBAAsB,CAAC,CAAC,KAAK,CAAC,OAAO,MAAM,CAAC,CAAC,KAAK,CAAC,OAAO,EAAE,EAC5D,sBAAsB,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,QAAQ,CAAC,MAAM,EAAE,EAAE,EACpF,eAAe,CAAC,CAAC,MAAM,CAAC,KAAK,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,6 +134,19 @@ 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
152
|
export declare const PATTERN_SEND_HELP = "A pattern such as team.> is refused. To reach the agents connected and following team.> now, post once to one channel it matches, such as team.announce; to reach several channels, post to each by name (cotal_channels lists the existing ones).";
|
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;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AAa,CA4FhB;AA4RD,+FAA+F;AAC/F,wBAAgB,WAAW,CAAC,CAAC,EAAE,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAQhE;AAED;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,IAAI,CAAC,WAAW,EAAE,cAAc,GAAG,OAAO,GAAG,UAAU,CAAC,EAAE,OAAO,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,GAAG,SAAS,CAGnJ;AAED;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,IAAI,CAAC,WAAW,EAAE,gBAAgB,GAAG,cAAc,GAAG,OAAO,GAAG,UAAU,CAAC,EAAE,OAAO,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,CAa3J;AAED;;;oCAGoC;AACpC,wBAAsB,eAAe,CACnC,KAAK,EAAE,SAAS,EAChB,MAAM,EAAE,WAAW,EACnB,MAAM,CAAC,EAAE,MAAM,EACf,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,EACvB,OAAO,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,GAC5B,OAAO,CAAC,MAAM,CAAC,CAGjB;AAED;0EAC0E;AAC1E,eAAO,MAAM,iBAAiB,uPACwN,CAAC;AAqBvP;;;;;;qEAMqE;AACrE,wBAAgB,cAAc,CAC5B,MAAM,EAAE,WAAW,EACnB,MAAM,SAAc,EACpB,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,EACvB,OAAO,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,EAC7B,cAAc,CAAC,EAAE,MAAM,MAAM,GAAG,SAAS,GACxC,aAAa,EAAE,CAwwCjB"}
|
package/dist/tool-specs.js
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
*/
|
|
10
10
|
import { execFileSync } from "node:child_process";
|
|
11
11
|
import { z } from "zod";
|
|
12
|
-
import { isConcreteChannel, assertValidChannel, MAX_CHANNEL_LENGTH, channelInAllow, AmbiguousPeerError, peerLabel, assertLifecycleToken, isPermissionDenied, renderLifecycleBlocked, EpEnvelopeError, LANG_PROBLEM_DETAIL_KIND, formatAge, presenceAges, presenceText } from "@cotal-ai/core";
|
|
12
|
+
import { isConcreteChannel, assertValidChannel, MAX_CHANNEL_LENGTH, channelInAllow, AmbiguousPeerError, peerLabel, assertLifecycleToken, isPermissionDenied, renderLifecycleBlocked, EpEnvelopeError, EP_UNANSWERED, REGISTRY_PAGE_LIMIT, LANG_PROBLEM_DETAIL_KIND, formatAge, presenceAges, presenceText } from "@cotal-ai/core";
|
|
13
13
|
import { afterRecallMark } from "./agent.js";
|
|
14
14
|
// The neutralization and the per-item rendering live in `framing.ts`, one convention shared with
|
|
15
15
|
// the auto-injected block, and are used here rather than restated. See that file for the rule.
|
|
@@ -455,7 +455,7 @@ function droppedNote(channels) {
|
|
|
455
455
|
return "";
|
|
456
456
|
const named = channels.slice(0, NAMED_DROPPED).map((c) => `#${attributionSafe(c).slice(0, 40)}`).join(", ");
|
|
457
457
|
const rest = channels.length - Math.min(NAMED_DROPPED, channels.length);
|
|
458
|
-
return `⚠ Some earlier chatter could not be recalled completely on ${named}${rest ? `, and ${rest} more channel${rest === 1 ? "" : "s"}` : ""} (retention or local safety bounds were reached).`;
|
|
458
|
+
return `⚠ Some earlier chatter could not be recalled completely on ${named}${rest ? `, and ${rest} more channel${rest === 1 ? "" : "s"}` : ""} (retention or local safety bounds were reached, or recall could not read the channel).`;
|
|
459
459
|
}
|
|
460
460
|
/** How many channels the recall warning names before it starts counting them instead. */
|
|
461
461
|
const NAMED_DROPPED = 5;
|
|
@@ -552,7 +552,35 @@ export function defaultSendChannel(config, reading) {
|
|
|
552
552
|
const concrete = reading.filter(isConcreteChannel);
|
|
553
553
|
return isAuthed(config) ? concrete.find((c) => channelInAllow(config.allowPublish, c)) : concrete[0];
|
|
554
554
|
}
|
|
555
|
-
|
|
555
|
+
/**
|
|
556
|
+
* Why a send with no channel has nowhere to go, and the exact next call. Built from the channels
|
|
557
|
+
* the agent reads now and the channels its ACL lets it post to, so the refusal names a channel the
|
|
558
|
+
* agent can use rather than pointing at another tool. Two shapes: on no channel at all, or on
|
|
559
|
+
* channels it may post to none of. `postable` is empty where the ACL grants no concrete post
|
|
560
|
+
* channel the agent could name (an operator widens that; nothing here can).
|
|
561
|
+
*/
|
|
562
|
+
export function sendNoDefaultRemedy(config, reading) {
|
|
563
|
+
const concrete = reading.filter(isConcreteChannel);
|
|
564
|
+
const authed = isAuthed(config);
|
|
565
|
+
const named = [...new Set([...config.allowPublish, ...config.allowSubscribe, ...reading].filter(isConcreteChannel))];
|
|
566
|
+
const postable = authed ? named.filter((c) => channelInAllow(config.allowPublish, c)) : named;
|
|
567
|
+
const where = concrete.length
|
|
568
|
+
? `you may post to none of the channels you read (${concrete.map((c) => `#${c}`).join(", ")})`
|
|
569
|
+
: "you are on no channel";
|
|
570
|
+
if (!postable.length)
|
|
571
|
+
return `${where}, so there is no default and an omitted channel is refused; your post ACL names no channel you could use, so ask an operator to widen it, and reach peers with cotal_dm or cotal_anycast meanwhile`;
|
|
572
|
+
const first = postable[0];
|
|
573
|
+
const list = postable.map((c) => `#${c}`).join(", ");
|
|
574
|
+
return `${where}, so there is no default and an omitted channel is refused. You may post to ${list}: call cotal_send with channel: "${first}", or cotal_join ${first} first to make it your default`;
|
|
575
|
+
}
|
|
576
|
+
/** The orientation card as the model reads it, over the SAME gated tool list the connector exposes
|
|
577
|
+
* (cotalToolSpecs already filters spawn/persona by capability), so the card can't claim a tool the
|
|
578
|
+
* agent can't call. The `cotal_orientation` tool, a connect result and a session-start hook all
|
|
579
|
+
* hand over this one rendering. */
|
|
580
|
+
export async function orientationCard(agent, config, source, env, offered) {
|
|
581
|
+
const visible = cotalToolSpecs(config, source, env, offered).map((s) => ({ name: s.name, title: s.title }));
|
|
582
|
+
return renderOrientation(buildOrientation(agent, config, visible, Date.now(), await agent.readRoster()));
|
|
583
|
+
}
|
|
556
584
|
/** How to reach a channel family, since every publish names one concrete channel (SPEC §3). The
|
|
557
585
|
* advertised `channel` text of `cotal_send`, here and in the gateway. */
|
|
558
586
|
export const PATTERN_SEND_HELP = "A pattern such as team.> is refused. To reach the agents connected and following team.> now, post once to one channel it matches, such as team.announce; to reach several channels, post to each by name (cotal_channels lists the existing ones).";
|
|
@@ -609,13 +637,7 @@ export function cotalToolSpecs(config, source = "connector", env, offered, empty
|
|
|
609
637
|
"present, your status/attention, and how many messages are unread. Call this first to get your " +
|
|
610
638
|
"bearings; it's read-only and safe to re-check anytime.",
|
|
611
639
|
async run(agent) {
|
|
612
|
-
|
|
613
|
-
// spawn/persona by capability), so the card can't claim a tool the agent can't call.
|
|
614
|
-
const visible = cotalToolSpecs(config, source, env, offered).map((s) => ({
|
|
615
|
-
name: s.name,
|
|
616
|
-
title: s.title,
|
|
617
|
-
}));
|
|
618
|
-
const card = renderOrientation(buildOrientation(agent, config, visible, Date.now(), await agent.readRoster()));
|
|
640
|
+
const card = await orientationCard(agent, config, source, env, offered);
|
|
619
641
|
const issue = agent.connectionIssue;
|
|
620
642
|
return ok(agent.connected
|
|
621
643
|
? card
|
|
@@ -990,7 +1012,7 @@ export function cotalToolSpecs(config, source = "connector", env, offered, empty
|
|
|
990
1012
|
channel: z
|
|
991
1013
|
.string()
|
|
992
1014
|
.optional()
|
|
993
|
-
.describe(`Channel to send on (${defaultChannel ? `default: ${defaultChannel}` :
|
|
1015
|
+
.describe(`Channel to send on (${defaultChannel ? `default: ${defaultChannel}` : `REQUIRED: ${sendNoDefaultRemedy(config, config.subscribe)}`}). ${PATTERN_SEND_HELP} Reply on the channel you received a message on.`),
|
|
994
1016
|
mentions: z
|
|
995
1017
|
.array(z.string())
|
|
996
1018
|
.optional()
|
|
@@ -1003,9 +1025,9 @@ export function cotalToolSpecs(config, source = "connector", env, offered, empty
|
|
|
1003
1025
|
try {
|
|
1004
1026
|
const joined = agent.joinedChannels();
|
|
1005
1027
|
const target = channel ?? defaultSendChannel(config, joined);
|
|
1006
|
-
if (target === undefined
|
|
1007
|
-
return err(`Couldn't send: ${
|
|
1008
|
-
const receipt =
|
|
1028
|
+
if (target === undefined)
|
|
1029
|
+
return err(`Couldn't send: ${sendNoDefaultRemedy(config, joined)}.`);
|
|
1030
|
+
const receipt = await agent.describeSendChannel(target);
|
|
1009
1031
|
const m = await agent.send(msg, target, mentions);
|
|
1010
1032
|
const dest = `Sent to #${m.channel}${m.mentions?.length ? ` (mentioned @${m.mentions.join(", @")})` : ""}`;
|
|
1011
1033
|
return ok(receipt ? `${dest} (${receipt}).` : `${dest}.`);
|
|
@@ -1288,9 +1310,13 @@ export function cotalToolSpecs(config, source = "connector", env, offered, empty
|
|
|
1288
1310
|
{
|
|
1289
1311
|
name: "cotal_spawn",
|
|
1290
1312
|
title: "Cotal: spawn a new teammate",
|
|
1291
|
-
description: "Ask the manager to start a new peer endpoint in your space. It joins the mesh as a lateral peer and, under the cmux runtime, appears in its own tab. A Cotal peer is a real, addressable process the user can watch; you can reach it by DM, find it on the roster, and coordinate with it later. Use it for teammate work that should stay visible on the mesh. Pass `prompt` when it should begin immediately; the connector auto-submits that prompt as its first turn. When you first bring a team online, if the live web dashboard is down, suggest `cotal watch` for a live terminal view. The dashboard service is configured and started separately; do not install or launch it implicitly. A partial result means the seat started but its requested model pin could not be read back: it names the seat and the `cotal ps --on <manager>` command that shows the pin, and spawning again would start a second agent.",
|
|
1313
|
+
description: "Ask the manager to start a new peer endpoint in your space. It joins the mesh as a lateral peer and, under the cmux runtime, appears in its own tab. A Cotal peer is a real, addressable process the user can watch; you can reach it by DM, find it on the roster, and coordinate with it later. Use it for teammate work that should stay visible on the mesh. Pass `prompt` when it should begin immediately; the connector auto-submits that prompt as its first turn. When you first bring a team online, if the live web dashboard is down, suggest `cotal watch` for a live terminal view. The dashboard service is configured and started separately; do not install or launch it implicitly. A partial result means the seat started but its requested model pin could not be read back: it names the seat and the `cotal ps --on <manager>` command that shows the pin, and spawning again would start a second agent. Channels: the new peer may read and post what its persona file allows; a persona that names no channel at all is scoped to your own allowances. It starts on NO channel unless you pass `join`, so pass the channel you are working on when it should see that traffic and post there (e.g. `join: [\"general\"]`).",
|
|
1292
1314
|
schema: {
|
|
1293
1315
|
name: z.string().describe("Which persona to spawn: the persona FILENAME in .cotal/agents (e.g. `review-critic`), without the .md. The new peer joins under the persona's own `name:` (auto-numbered with an underscore, e.g. socrates_2, if that's taken). Fails if no such persona file exists; spawn an existing persona, don't invent a name."),
|
|
1316
|
+
join: z
|
|
1317
|
+
.array(z.string())
|
|
1318
|
+
.optional()
|
|
1319
|
+
.describe("Channels the new peer joins at start, on top of what its persona file lists (e.g. ['general']). Concrete names only, each within YOUR read ACL (a spawn hands on only what you may read yourself; anything else is refused before launch). Omitted, a persona that lists no channel starts on none and its cotal_send with no channel is refused."),
|
|
1294
1320
|
instance: z
|
|
1295
1321
|
.string()
|
|
1296
1322
|
.refine((value) => {
|
|
@@ -1350,9 +1376,9 @@ export function cotalToolSpecs(config, source = "connector", env, offered, empty
|
|
|
1350
1376
|
// boundary. Resume lives only on the operator CLI (`cotal spawn --resume`, foreground or
|
|
1351
1377
|
// --detach); a peer-facing, capability-gated resume is deferred (see #159).
|
|
1352
1378
|
},
|
|
1353
|
-
async run(agent, _config, { name, instance, role, agent: agentType, model, variant, launchOptions, cwd, prompt, events, runtime }) {
|
|
1379
|
+
async run(agent, _config, { name, instance, role, agent: agentType, model, variant, launchOptions, cwd, prompt, events, runtime, join }) {
|
|
1354
1380
|
try {
|
|
1355
|
-
const reply = await agent.spawn(name, role, { agent: agentType, model, variant, launchOptions, cwd, prompt, events, runtime, instance });
|
|
1381
|
+
const reply = await agent.spawn(name, role, { agent: agentType, model, variant, launchOptions, cwd, prompt, events, runtime, instance, join });
|
|
1356
1382
|
// An uncertain launch is still managed and may yet join. Reported as an error it reads as a
|
|
1357
1383
|
// failed launch, and the caller's retry starts a second agent on the same work.
|
|
1358
1384
|
const pending = reply.code === "uncertain";
|
|
@@ -1713,6 +1739,42 @@ export function cotalToolSpecs(config, source = "connector", env, offered, empty
|
|
|
1713
1739
|
}
|
|
1714
1740
|
},
|
|
1715
1741
|
},
|
|
1742
|
+
{
|
|
1743
|
+
name: "cotal_endpoints",
|
|
1744
|
+
title: "Cotal: list the endpoints you can call",
|
|
1745
|
+
description: "List the endpoints registered in this space that this session can call, and for each one the commands its grants cover and the request forms they allow. The space's registry answers from the grants recorded when this session's credential was issued, so the broker or the endpoint can still refuse a listed command. Endpoints where this session holds no command are left out, and so are endpoints whose command declarations cannot be read. A command whose grants are too many to list form by form is named under `unprojected`. On a user-auth mesh manager commands ride a separate manager-call credential; pass view=\"manager\" to list what that credential can call. Call cotal_describe for a command's input schema. A page holds up to 100 endpoints; pass the previous page's `next` as `after` for the next one.",
|
|
1746
|
+
schema: {
|
|
1747
|
+
after: z.string().min(1).max(128).optional().describe("The `next` value from the previous page."),
|
|
1748
|
+
limit: z.number().int().min(1).max(REGISTRY_PAGE_LIMIT).optional().describe(`Endpoints per page (default ${REGISTRY_PAGE_LIMIT}).`),
|
|
1749
|
+
view: z.enum(["session", "manager"]).optional().describe("`session` (default): this session's own credential. `manager`: its manager-call credential."),
|
|
1750
|
+
instance: z.string().min(1).max(64).optional().describe("Manager view only: the manager instance whose call credential to use."),
|
|
1751
|
+
},
|
|
1752
|
+
async run(agent, _config, { after, limit, view, instance }) {
|
|
1753
|
+
if (instance !== undefined && view !== "manager")
|
|
1754
|
+
return err("`instance` selects the manager for view=\"manager\" only.");
|
|
1755
|
+
const label = view === "manager" ? "the manager-call credential" : "this session";
|
|
1756
|
+
try {
|
|
1757
|
+
const input = { ...(after !== undefined ? { after } : {}), ...(limit !== undefined ? { limit } : {}) };
|
|
1758
|
+
const r = view === "manager" ? await agent.listManagerEndpoints(input, instance) : await agent.ep.listEndpoints(input);
|
|
1759
|
+
if ("none" in r)
|
|
1760
|
+
return err(`There is no manager view: ${r.none}.`);
|
|
1761
|
+
if (r.unbound)
|
|
1762
|
+
return err(`The credential of ${label} has no listing binding, so the registry cannot list what it may call. A credential issued before the listing existed, or one with no expiry, has none; a new credential does.`);
|
|
1763
|
+
if (r.reply.reply.ok !== true) {
|
|
1764
|
+
const e = r.reply.reply.error;
|
|
1765
|
+
return err(`The registry refused the listing: ${e?.code ?? "error"}: ${e?.message ?? "no message"}`);
|
|
1766
|
+
}
|
|
1767
|
+
const page = r.page;
|
|
1768
|
+
const more = page.next !== undefined ? ` More endpoints follow; pass after="${page.next}".` : "";
|
|
1769
|
+
return endpointData(`${page.rows.length} endpoints ${label} can call (source: ${page.source}).${more}`, page);
|
|
1770
|
+
}
|
|
1771
|
+
catch (e) {
|
|
1772
|
+
if (e instanceof EpEnvelopeError && e.details?.some((d) => d.kind === EP_UNANSWERED))
|
|
1773
|
+
return err("The registry did not answer, so nothing is listed. The space may run no registry, or it is down; other tools are unaffected.");
|
|
1774
|
+
return endpointFailure("Couldn't list endpoints", e);
|
|
1775
|
+
}
|
|
1776
|
+
},
|
|
1777
|
+
},
|
|
1716
1778
|
{
|
|
1717
1779
|
name: "cotal_describe",
|
|
1718
1780
|
title: "Cotal: describe an endpoint",
|