pilotswarm-sdk 0.5.73 → 0.5.74
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/README.md +7 -0
- package/api/src/admin-diagnostics.js +1 -1
- package/dist/agent-discovery.d.ts.map +1 -1
- package/dist/agent-discovery.js +2 -4
- package/dist/agent-discovery.js.map +1 -1
- package/dist/agent-package-format.d.ts +2 -2
- package/dist/agent-package-format.js +3 -3
- package/dist/agent-package-format.js.map +1 -1
- package/dist/base-agent-policy.d.ts +13 -0
- package/dist/base-agent-policy.d.ts.map +1 -0
- package/dist/base-agent-policy.js +26 -0
- package/dist/base-agent-policy.js.map +1 -0
- package/dist/capability-catalog.d.ts +99 -0
- package/dist/capability-catalog.d.ts.map +1 -0
- package/dist/capability-catalog.js +198 -0
- package/dist/capability-catalog.js.map +1 -0
- package/dist/capability-runtime.d.ts +124 -0
- package/dist/capability-runtime.d.ts.map +1 -0
- package/dist/capability-runtime.js +163 -0
- package/dist/capability-runtime.js.map +1 -0
- package/dist/cms-migrations.d.ts.map +1 -1
- package/dist/cms-migrations.js +2 -8
- package/dist/cms-migrations.js.map +1 -1
- package/dist/cms.d.ts +5 -9
- package/dist/cms.d.ts.map +1 -1
- package/dist/cms.js +24 -0
- package/dist/cms.js.map +1 -1
- package/dist/feature-flag-cache.d.ts.map +1 -1
- package/dist/feature-flag-cache.js +5 -2
- package/dist/feature-flag-cache.js.map +1 -1
- package/dist/feature-flags.d.ts +10 -1
- package/dist/feature-flags.d.ts.map +1 -1
- package/dist/feature-flags.js +13 -0
- package/dist/feature-flags.js.map +1 -1
- package/dist/feature-store.d.ts +2 -1
- package/dist/feature-store.d.ts.map +1 -1
- package/dist/feature-store.js +4 -2
- package/dist/feature-store.js.map +1 -1
- package/dist/managed-session.d.ts.map +1 -1
- package/dist/managed-session.js +56 -33
- package/dist/managed-session.js.map +1 -1
- package/dist/migrations/base-agent-v2-0079.d.ts +3 -0
- package/dist/migrations/base-agent-v2-0079.d.ts.map +1 -0
- package/dist/migrations/base-agent-v2-0079.js +19 -0
- package/dist/migrations/base-agent-v2-0079.js.map +1 -0
- package/dist/native-subagents.d.ts +2 -1
- package/dist/native-subagents.d.ts.map +1 -1
- package/dist/native-subagents.js +22 -4
- package/dist/native-subagents.js.map +1 -1
- package/dist/reserved-tool-names.d.ts.map +1 -1
- package/dist/reserved-tool-names.js +1 -0
- package/dist/reserved-tool-names.js.map +1 -1
- package/dist/session-manager.d.ts +2 -0
- package/dist/session-manager.d.ts.map +1 -1
- package/dist/session-manager.js +102 -5
- package/dist/session-manager.js.map +1 -1
- package/dist/types.d.ts +4 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/dist/worker.d.ts +4 -0
- package/dist/worker.d.ts.map +1 -1
- package/dist/worker.js +66 -2
- package/dist/worker.js.map +1 -1
- package/package.json +3 -3
- package/plugins/system/prompts/base-v2.md +130 -0
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
2
|
+
export const EMPTY_CAPABILITY_STATE = { revision: 0, selections: [] };
|
|
3
|
+
export function normalizeCapabilityState(value) {
|
|
4
|
+
const state = value;
|
|
5
|
+
if (!state || !Number.isSafeInteger(state.revision) || state.revision < 0
|
|
6
|
+
|| !Array.isArray(state.selections) || state.selections.length > 32
|
|
7
|
+
|| state.requests !== undefined && (!Array.isArray(state.requests) || state.requests.length > 64)) {
|
|
8
|
+
throw new Error("Invalid durable capability state");
|
|
9
|
+
}
|
|
10
|
+
const sourceIds = new Set();
|
|
11
|
+
const selections = state.selections.map(selection => {
|
|
12
|
+
if (!selection || typeof selection.sourceId !== "string" || !selection.sourceId || selection.sourceId.length > 500
|
|
13
|
+
|| sourceIds.has(selection.sourceId)
|
|
14
|
+
|| selection.sourceRef !== undefined && (typeof selection.sourceRef !== "string" || selection.sourceRef.length > 4096)) {
|
|
15
|
+
throw new Error("Invalid durable capability selection");
|
|
16
|
+
}
|
|
17
|
+
sourceIds.add(selection.sourceId);
|
|
18
|
+
const clean = (names) => {
|
|
19
|
+
if (!Array.isArray(names) || names.length > 64
|
|
20
|
+
|| names.some(name => typeof name !== "string" || !name || name.length > 200)
|
|
21
|
+
|| new Set(names).size !== names.length)
|
|
22
|
+
throw new Error("Invalid durable capability names");
|
|
23
|
+
return [...names].sort();
|
|
24
|
+
};
|
|
25
|
+
return { sourceId: selection.sourceId, ...(selection.sourceRef ? { sourceRef: selection.sourceRef } : {}),
|
|
26
|
+
tools: clean(selection.tools), mcpServers: clean(selection.mcpServers) };
|
|
27
|
+
});
|
|
28
|
+
const requests = state.requests?.map(receipt => {
|
|
29
|
+
if (!receipt || typeof receipt.id !== "string" || !receipt.id || receipt.id.length > 128
|
|
30
|
+
|| typeof receipt.hash !== "string" || !/^[a-f0-9]{64}$/.test(receipt.hash)) {
|
|
31
|
+
throw new Error("Invalid durable capability request receipt");
|
|
32
|
+
}
|
|
33
|
+
return { id: receipt.id, hash: receipt.hash };
|
|
34
|
+
});
|
|
35
|
+
return { revision: state.revision, selections, ...(requests ? { requests } : {}) };
|
|
36
|
+
}
|
|
37
|
+
export function capabilityHash(value) {
|
|
38
|
+
return createHash("sha256").update(JSON.stringify(value)).digest("hex");
|
|
39
|
+
}
|
|
40
|
+
export function visibleCapabilitySource(source, owner) {
|
|
41
|
+
return source.scope === "shared" || Boolean(owner && source.owner?.provider === owner.provider && source.owner.subject === owner.subject);
|
|
42
|
+
}
|
|
43
|
+
export function capabilityRef(s, r, k, n = "") {
|
|
44
|
+
return "cap1." + Buffer.from(JSON.stringify({ s, r, k, n })).toString("base64url");
|
|
45
|
+
}
|
|
46
|
+
export function parseCapabilityRef(ref) {
|
|
47
|
+
if (typeof ref !== "string" || ref.length > 4096 || !/^cap1\.[A-Za-z0-9_-]+$/.test(ref))
|
|
48
|
+
throw new Error("Invalid capability reference");
|
|
49
|
+
let v;
|
|
50
|
+
try {
|
|
51
|
+
v = JSON.parse(Buffer.from(ref.slice(5), "base64url").toString());
|
|
52
|
+
}
|
|
53
|
+
catch {
|
|
54
|
+
throw new Error("Invalid capability reference");
|
|
55
|
+
}
|
|
56
|
+
if (!v || !["skill", "agent", "tool", "mcp", "source"].includes(v.k) || ![v.s, v.r, v.n].every(x => typeof x === "string"))
|
|
57
|
+
throw new Error("Invalid capability reference");
|
|
58
|
+
return v;
|
|
59
|
+
}
|
|
60
|
+
export function resolveCapabilitySource(sources, owner, ref) {
|
|
61
|
+
const parsed = parseCapabilityRef(ref);
|
|
62
|
+
const source = sources.find(s => s.id === parsed.s && visibleCapabilitySource(s, owner));
|
|
63
|
+
if (!source)
|
|
64
|
+
throw new Error("Capability source unavailable or inaccessible; search again");
|
|
65
|
+
if (source.revision !== parsed.r)
|
|
66
|
+
throw new Error("Capability source changed; search again for the current revision");
|
|
67
|
+
return { source, ref: parsed };
|
|
68
|
+
}
|
|
69
|
+
function tokens(text) { return text.toLowerCase().match(/[\p{L}\p{N}]+/gu) ?? []; }
|
|
70
|
+
function lexicalTokens(text) {
|
|
71
|
+
const parts = tokens(text);
|
|
72
|
+
const result = new Set(parts);
|
|
73
|
+
// Human requests commonly add spaces or hyphens to compact product names
|
|
74
|
+
// (for example, "deep wiki" for "deepwiki"). Index adjacent compounds in
|
|
75
|
+
// both the query and catalog text so either spelling finds the same entry.
|
|
76
|
+
for (let index = 0; index + 1 < parts.length; index++)
|
|
77
|
+
result.add(parts[index] + parts[index + 1]);
|
|
78
|
+
return [...result];
|
|
79
|
+
}
|
|
80
|
+
function lexicalScore(query, name, description) {
|
|
81
|
+
const qs = lexicalTokens(query);
|
|
82
|
+
if (!qs.length)
|
|
83
|
+
return 0;
|
|
84
|
+
const names = new Set(lexicalTokens(name));
|
|
85
|
+
const words = new Set(lexicalTokens(description));
|
|
86
|
+
const exact = tokens(name).join("") === tokens(query).join("");
|
|
87
|
+
return qs.reduce((sum, t) => sum + (names.has(t) ? 5 : words.has(t) ? 1 : 0), exact ? 20 : 0);
|
|
88
|
+
}
|
|
89
|
+
function artifactId(artifact, index) {
|
|
90
|
+
return artifact.id ?? `${artifact.kind}:${index}:${artifact.name}`;
|
|
91
|
+
}
|
|
92
|
+
function factValue(f) {
|
|
93
|
+
if (typeof f.value !== "string")
|
|
94
|
+
return f.value;
|
|
95
|
+
try {
|
|
96
|
+
return JSON.parse(f.value);
|
|
97
|
+
}
|
|
98
|
+
catch {
|
|
99
|
+
return { instructions: f.value };
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
function curatedSkill(f) { return f.shared === true && f.key.startsWith("skills/") && Boolean(f.scopeKey) && f.etag != null; }
|
|
103
|
+
export class CapabilityCatalog {
|
|
104
|
+
getSources;
|
|
105
|
+
factStore;
|
|
106
|
+
reservedPrefixes;
|
|
107
|
+
constructor(getSources, factStore, reservedPrefixes = []) {
|
|
108
|
+
this.getSources = getSources;
|
|
109
|
+
this.factStore = factStore;
|
|
110
|
+
this.reservedPrefixes = reservedPrefixes;
|
|
111
|
+
}
|
|
112
|
+
isCurated = (f) => curatedSkill(f) && !f.deletedAt && !this.reservedPrefixes.some(p => f.key.startsWith(p));
|
|
113
|
+
async search(owner, readerSessionId, args) {
|
|
114
|
+
if (typeof args.query !== "string" || !args.query.trim() || args.query.length > 2000)
|
|
115
|
+
throw new Error("query must contain 1–2000 characters");
|
|
116
|
+
if (args.limit !== undefined && (!Number.isSafeInteger(args.limit) || args.limit < 1))
|
|
117
|
+
throw new Error("limit must be a positive integer");
|
|
118
|
+
const limit = Math.max(1, Math.min(30, Math.trunc(args.limit ?? 8)));
|
|
119
|
+
const kinds = args.kinds ?? ["skill", "agent", "tool", "mcp"];
|
|
120
|
+
const origins = args.sources ?? ["static", "published", "curated"];
|
|
121
|
+
if (!kinds.every(k => ["skill", "agent", "tool", "mcp"].includes(k)) || !origins.every(k => ["static", "published", "curated"].includes(k)))
|
|
122
|
+
throw new Error("Unknown kind or source filter");
|
|
123
|
+
const coverage = {};
|
|
124
|
+
const hits = [];
|
|
125
|
+
for (const origin of ["static", "published"]) {
|
|
126
|
+
if (!origins.includes(origin))
|
|
127
|
+
continue;
|
|
128
|
+
coverage[origin] = "available";
|
|
129
|
+
const ranked = [];
|
|
130
|
+
for (const source of this.getSources().filter(s => s.source === origin && visibleCapabilitySource(s, owner))) {
|
|
131
|
+
for (const [index, a] of source.artifacts.entries()) {
|
|
132
|
+
if (!kinds.includes(a.kind))
|
|
133
|
+
continue;
|
|
134
|
+
const score = lexicalScore(args.query, a.name, `${source.name} ${a.description} ${(a.tools ?? []).join(" ")}`);
|
|
135
|
+
if (!score)
|
|
136
|
+
continue;
|
|
137
|
+
ranked.push({ kind: a.kind, name: a.name, description: a.description.slice(0, 600), source: origin,
|
|
138
|
+
ref: capabilityRef(source.id, source.revision, a.kind, artifactId(a, index)),
|
|
139
|
+
source_ref: capabilityRef(source.id, source.revision, "source"), revision: source.revision, scope: source.scope,
|
|
140
|
+
tools: a.tools, mcp_servers: a.mcpServers, score });
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
ranked.sort((a, b) => b.score - a.score || a.ref.localeCompare(b.ref));
|
|
144
|
+
ranked.slice(0, limit).forEach((h, i) => hits.push({ ...h, score: 1 / (60 + i + 1) }));
|
|
145
|
+
}
|
|
146
|
+
if (origins.includes("curated") && kinds.includes("skill")) {
|
|
147
|
+
const store = this.factStore;
|
|
148
|
+
if (!store?.capabilities?.search || typeof store.searchFacts !== "function")
|
|
149
|
+
coverage.curated = "unavailable";
|
|
150
|
+
else
|
|
151
|
+
try {
|
|
152
|
+
const result = await store.searchFacts(args.query, { mode: "hybrid", namespace: "skills", scope: "shared", limit }, { readerSessionId, unrestricted: false });
|
|
153
|
+
coverage.curated = "available";
|
|
154
|
+
result.facts.filter(this.isCurated).forEach((f, i) => {
|
|
155
|
+
const v = factValue(f);
|
|
156
|
+
hits.push({ kind: "skill", name: v?.name ?? f.key, description: String(v?.description ?? "").slice(0, 600),
|
|
157
|
+
source: "curated", scope: "shared", revision: String(f.etag),
|
|
158
|
+
ref: capabilityRef(`curated:${f.scopeKey}`, String(f.etag), "skill", f.key),
|
|
159
|
+
confidence: v?.confidence, expires_at: v?.expires_at, contradiction_count: v?.contradiction_count,
|
|
160
|
+
score: 1 / (60 + i + 1) });
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
catch {
|
|
164
|
+
coverage.curated = "unavailable";
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
hits.sort((a, b) => b.score - a.score || a.ref.localeCompare(b.ref));
|
|
168
|
+
return { capabilities: hits.slice(0, limit), coverage };
|
|
169
|
+
}
|
|
170
|
+
async load(owner, readerSessionId, ref, kind) {
|
|
171
|
+
const parsed = parseCapabilityRef(ref);
|
|
172
|
+
if (parsed.k !== kind)
|
|
173
|
+
throw new Error(`Expected a ${kind} reference`);
|
|
174
|
+
if (parsed.s.startsWith("curated:")) {
|
|
175
|
+
if (kind !== "skill" || !parsed.n.startsWith("skills/") || !this.factStore)
|
|
176
|
+
throw new Error("Invalid curated skill reference");
|
|
177
|
+
const rows = await this.factStore.readFacts({ scopeKeys: [parsed.s.slice(8)], scope: "shared", limit: 1 }, { readerSessionId, unrestricted: false });
|
|
178
|
+
const f = rows.facts.find(f => this.isCurated(f) && f.scopeKey === parsed.s.slice(8) && f.key === parsed.n);
|
|
179
|
+
if (!f)
|
|
180
|
+
throw new Error("Curated skill unavailable or inaccessible");
|
|
181
|
+
if (String(f.etag) !== parsed.r)
|
|
182
|
+
throw new Error("Curated skill changed; search again");
|
|
183
|
+
return { ref, source: "curated", revision: parsed.r, skill: factValue(f) };
|
|
184
|
+
}
|
|
185
|
+
const { source } = resolveCapabilitySource(this.getSources(), owner, ref);
|
|
186
|
+
let a = source.artifacts.find((artifact, index) => artifact.kind === kind && artifactId(artifact, index) === parsed.n);
|
|
187
|
+
if (!a) {
|
|
188
|
+
const named = source.artifacts.filter(artifact => artifact.kind === kind && artifact.name === parsed.n);
|
|
189
|
+
if (named.length === 1)
|
|
190
|
+
a = named[0];
|
|
191
|
+
}
|
|
192
|
+
if (!a)
|
|
193
|
+
throw new Error("Capability unavailable; search again");
|
|
194
|
+
return { ref, source: source.source, revision: source.revision, mode: "reference", ...a,
|
|
195
|
+
...(kind === "agent" ? { notice: `Before applying these instructions, tell the user you are using instructions from ${a.name}. State material adaptations. This does not launch the agent, grant its identity/tools, execute initialPrompt, or create schedules.` } : {}) };
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
//# sourceMappingURL=capability-catalog.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"capability-catalog.js","sourceRoot":"","sources":["../src/capability-catalog.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAuBzC,MAAM,CAAC,MAAM,sBAAsB,GAAoB,EAAE,QAAQ,EAAE,CAAC,EAAE,UAAU,EAAE,EAAE,EAAE,CAAC;AACvF,MAAM,UAAU,wBAAwB,CAAC,KAAc;IACnD,MAAM,KAAK,GAAG,KAAwB,CAAC;IACvC,IAAI,CAAC,KAAK,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,KAAK,CAAC,QAAQ,GAAG,CAAC;WAClE,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,UAAU,CAAC,IAAI,KAAK,CAAC,UAAU,CAAC,MAAM,GAAG,EAAE;WAChE,KAAK,CAAC,QAAQ,KAAK,SAAS,IAAI,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,KAAK,CAAC,QAAQ,CAAC,MAAM,GAAG,EAAE,CAAC,EAAE,CAAC;QACpG,MAAM,IAAI,KAAK,CAAC,kCAAkC,CAAC,CAAC;IACxD,CAAC;IACD,MAAM,SAAS,GAAG,IAAI,GAAG,EAAU,CAAC;IACpC,MAAM,UAAU,GAAG,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE;QAChD,IAAI,CAAC,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,CAAC;YACL,MAAM,KAAK,GAAG,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC,QAAQ,CAAC,IAAI,KAAK,IAAI,IAAI,QAAQ,CAAC,IAAI,KAAK,MAAM,CAAC,CAAC,CAAC,CAAC;YACxG,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC;gBAAE,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;QACzC,CAAC;QACD,IAAI,CAAC,CAAC;YAAE,MAAM,IAAI,KAAK,CAAC,sCAAsC,CAAC,CAAC;QAChE,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,EAAE,MAAM,CAAC,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,GAAG,CAAC;YACnF,GAAG,CAAC,IAAI,KAAK,OAAO,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,qFAAqF,CAAC,CAAC,IAAI,qIAAqI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC;IACpR,CAAC;CACJ"}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { type Tool } from "@github/copilot-sdk";
|
|
2
|
+
import { type CapabilitySource, type CapabilityState, type CapabilitySelection } from "./capability-catalog.js";
|
|
3
|
+
import type { FeatureOwner } from "./feature-flags.js";
|
|
4
|
+
import { type McpAllowlistAgent } from "./mcp-loader.js";
|
|
5
|
+
export interface PackageRequest {
|
|
6
|
+
source_ref: string;
|
|
7
|
+
tools?: string[];
|
|
8
|
+
mcp_servers?: string[];
|
|
9
|
+
action?: "add" | "remove";
|
|
10
|
+
expected_revision: number;
|
|
11
|
+
request_id: string;
|
|
12
|
+
}
|
|
13
|
+
export interface CapabilityServices {
|
|
14
|
+
search(args: any): Promise<unknown>;
|
|
15
|
+
load(ref: string, kind: "skill" | "agent"): Promise<unknown>;
|
|
16
|
+
list(): Promise<unknown>;
|
|
17
|
+
use(args: PackageRequest): Promise<{
|
|
18
|
+
changed: boolean;
|
|
19
|
+
revision: number;
|
|
20
|
+
}>;
|
|
21
|
+
}
|
|
22
|
+
export declare const CAPABILITY_TOOL_SPECS: {
|
|
23
|
+
readonly search_capabilities: {
|
|
24
|
+
readonly description: "Search visible static and published skills, authored agent workflows, tools and MCP servers; also curated shared skills. Returns metadata and exact references. Does not load instructions or grant tools. Static/package search is weighted keyword matching; curated search uses the configured hybrid index.";
|
|
25
|
+
readonly parameters: {
|
|
26
|
+
readonly type: "object";
|
|
27
|
+
readonly properties: {
|
|
28
|
+
readonly query: {
|
|
29
|
+
readonly type: "string";
|
|
30
|
+
};
|
|
31
|
+
readonly limit: {
|
|
32
|
+
readonly type: "integer";
|
|
33
|
+
readonly minimum: 1;
|
|
34
|
+
readonly maximum: 30;
|
|
35
|
+
};
|
|
36
|
+
readonly kinds: {
|
|
37
|
+
readonly type: "array";
|
|
38
|
+
readonly items: {
|
|
39
|
+
readonly type: "string";
|
|
40
|
+
readonly enum: readonly ["skill", "agent", "tool", "mcp"];
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
readonly sources: {
|
|
44
|
+
readonly type: "array";
|
|
45
|
+
readonly items: {
|
|
46
|
+
readonly type: "string";
|
|
47
|
+
readonly enum: readonly ["static", "published", "curated"];
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
readonly required: readonly ["query"];
|
|
52
|
+
};
|
|
53
|
+
};
|
|
54
|
+
readonly load_agent_guidelines: {
|
|
55
|
+
readonly description: "Read an authored agent's own workflow as reference material using its search reference. Before applying it, tell the user which agent supplied the instructions and describe material adaptations. Does not launch an agent, adopt its identity, grant tools, or execute its startup prompt.";
|
|
56
|
+
readonly parameters: {
|
|
57
|
+
readonly type: "object";
|
|
58
|
+
readonly properties: {
|
|
59
|
+
readonly ref: {
|
|
60
|
+
readonly type: "string";
|
|
61
|
+
};
|
|
62
|
+
};
|
|
63
|
+
readonly required: readonly ["ref"];
|
|
64
|
+
};
|
|
65
|
+
};
|
|
66
|
+
readonly list_session_capabilities: {
|
|
67
|
+
readonly description: "List this durable session's explicit capability-source tool/MCP selections, their availability, and the revision required by use_package. No secrets or server configuration are returned.";
|
|
68
|
+
readonly parameters: {
|
|
69
|
+
readonly type: "object";
|
|
70
|
+
readonly properties: {};
|
|
71
|
+
};
|
|
72
|
+
};
|
|
73
|
+
readonly use_package: {
|
|
74
|
+
readonly description: "Add or remove explicitly selected tools/MCP servers from an exact visible static or published source_ref returned by search_capabilities. Does not install packages, grant an agent identity, or load every export. Parent-session only. Selections persist for this durable session; changes refresh the same session at the next turn boundary and continue automatically. Finish native tasks first. Use list_session_capabilities for expected_revision; use a new request_id per logical change and reuse it on retry. Existing original/bound tools cannot be removed here.";
|
|
75
|
+
readonly parameters: {
|
|
76
|
+
readonly type: "object";
|
|
77
|
+
readonly properties: {
|
|
78
|
+
readonly source_ref: {
|
|
79
|
+
readonly type: "string";
|
|
80
|
+
};
|
|
81
|
+
readonly tools: {
|
|
82
|
+
readonly type: "array";
|
|
83
|
+
readonly items: {
|
|
84
|
+
readonly type: "string";
|
|
85
|
+
};
|
|
86
|
+
};
|
|
87
|
+
readonly mcp_servers: {
|
|
88
|
+
readonly type: "array";
|
|
89
|
+
readonly items: {
|
|
90
|
+
readonly type: "string";
|
|
91
|
+
};
|
|
92
|
+
};
|
|
93
|
+
readonly action: {
|
|
94
|
+
readonly type: "string";
|
|
95
|
+
readonly enum: readonly ["add", "remove"];
|
|
96
|
+
};
|
|
97
|
+
readonly expected_revision: {
|
|
98
|
+
readonly type: "integer";
|
|
99
|
+
readonly minimum: 0;
|
|
100
|
+
};
|
|
101
|
+
readonly request_id: {
|
|
102
|
+
readonly type: "string";
|
|
103
|
+
readonly minLength: 1;
|
|
104
|
+
readonly maxLength: 128;
|
|
105
|
+
};
|
|
106
|
+
};
|
|
107
|
+
readonly required: readonly ["source_ref", "expected_revision", "request_id"];
|
|
108
|
+
};
|
|
109
|
+
};
|
|
110
|
+
};
|
|
111
|
+
export declare function capabilityToolDeclarations(): Tool<any>[];
|
|
112
|
+
export declare function validatePackageRequest(args: PackageRequest): void;
|
|
113
|
+
export declare function nextCapabilityState(state: CapabilityState, sourceId: string, args: PackageRequest): {
|
|
114
|
+
state: CapabilityState;
|
|
115
|
+
changed: boolean;
|
|
116
|
+
};
|
|
117
|
+
/** Resolve exact exports. Never fall back to a same-named package or the legacy flat registry. */
|
|
118
|
+
export declare function bindCapabilities(sources: CapabilitySource[], owner: FeatureOwner | null, selections: CapabilitySelection[], originalTools: Tool<any>[], originalMcp: Record<string, any>, agent: McpAllowlistAgent | null, strict?: boolean): {
|
|
119
|
+
tools: Tool<any>[];
|
|
120
|
+
mcpServers: Record<string, any>;
|
|
121
|
+
unavailable: string[];
|
|
122
|
+
fingerprint: string;
|
|
123
|
+
};
|
|
124
|
+
//# sourceMappingURL=capability-runtime.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"capability-runtime.d.ts","sourceRoot":"","sources":["../src/capability-runtime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,KAAK,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,EACH,KAAK,gBAAgB,EAAE,KAAK,eAAe,EAAE,KAAK,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC3G,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,EAAsB,KAAK,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAG7E,MAAM,WAAW,cAAc;IAC3B,UAAU,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IAAC,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IAC7D,MAAM,CAAC,EAAE,KAAK,GAAG,QAAQ,CAAC;IAAC,iBAAiB,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAC;CAC5E;AACD,MAAM,WAAW,kBAAkB;IAC/B,MAAM,C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from "./capability-catalog.js";
|
|
3
|
+
import { mcpAllowlistAdmits } from "./mcp-loader.js";
|
|
4
|
+
import { findReservedPackageToolName } from "./reserved-tool-names.js";
|
|
5
|
+
export const CAPABILITY_TOOL_SPECS = {
|
|
6
|
+
search_capabilities: {
|
|
7
|
+
description: "Search visible static and published skills, authored agent workflows, tools and MCP servers; also curated shared skills. Returns metadata and exact references. Does not load instructions or grant tools. Static/package search is weighted keyword matching; curated search uses the configured hybrid index.",
|
|
8
|
+
parameters: { type: "object", properties: { query: { type: "string" }, limit: { type: "integer", minimum: 1, maximum: 30 },
|
|
9
|
+
kinds: { type: "array", items: { type: "string", enum: ["skill", "agent", "tool", "mcp"] } },
|
|
10
|
+
sources: { type: "array", items: { type: "string", enum: ["static", "published", "curated"] } } }, required: ["query"] },
|
|
11
|
+
},
|
|
12
|
+
load_agent_guidelines: {
|
|
13
|
+
description: "Read an authored agent's own workflow as reference material using its search reference. Before applying it, tell the user which agent supplied the instructions and describe material adaptations. Does not launch an agent, adopt its identity, grant tools, or execute its startup prompt.",
|
|
14
|
+
parameters: { type: "object", properties: { ref: { type: "string" } }, required: ["ref"] },
|
|
15
|
+
},
|
|
16
|
+
list_session_capabilities: {
|
|
17
|
+
description: "List this durable session's explicit capability-source tool/MCP selections, their availability, and the revision required by use_package. No secrets or server configuration are returned.",
|
|
18
|
+
parameters: { type: "object", properties: {} },
|
|
19
|
+
},
|
|
20
|
+
use_package: {
|
|
21
|
+
description: "Add or remove explicitly selected tools/MCP servers from an exact visible static or published source_ref returned by search_capabilities. Does not install packages, grant an agent identity, or load every export. Parent-session only. Selections persist for this durable session; changes refresh the same session at the next turn boundary and continue automatically. Finish native tasks first. Use list_session_capabilities for expected_revision; use a new request_id per logical change and reuse it on retry. Existing original/bound tools cannot be removed here.",
|
|
22
|
+
parameters: { type: "object", properties: { source_ref: { type: "string" }, tools: { type: "array", items: { type: "string" } },
|
|
23
|
+
mcp_servers: { type: "array", items: { type: "string" } }, action: { type: "string", enum: ["add", "remove"] },
|
|
24
|
+
expected_revision: { type: "integer", minimum: 0 }, request_id: { type: "string", minLength: 1, maxLength: 128 } },
|
|
25
|
+
required: ["source_ref", "expected_revision", "request_id"] },
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
export function capabilityToolDeclarations() {
|
|
29
|
+
return Object.entries(CAPABILITY_TOOL_SPECS).map(([name, spec]) => defineTool(name, { ...spec, handler: async () => "Capability service unavailable" }));
|
|
30
|
+
}
|
|
31
|
+
export function validatePackageRequest(args) {
|
|
32
|
+
if (!args || !Number.isSafeInteger(args.expected_revision) || args.expected_revision < 0
|
|
33
|
+
|| typeof args.request_id !== "string" || !args.request_id.trim() || args.request_id.length > 128
|
|
34
|
+
|| args.action !== undefined && !["add", "remove"].includes(args.action))
|
|
35
|
+
throw new Error("Invalid package request/revision");
|
|
36
|
+
for (const names of [args.tools ?? [], args.mcp_servers ?? []]) {
|
|
37
|
+
if (!Array.isArray(names) || names.length > 64 || names.some(n => typeof n !== "string" || !n || n.length > 200)
|
|
38
|
+
|| new Set(names).size !== names.length)
|
|
39
|
+
throw new Error("Invalid or duplicate tool/server names");
|
|
40
|
+
}
|
|
41
|
+
if (!(args.tools?.length || args.mcp_servers?.length))
|
|
42
|
+
throw new Error("Select at least one tool or MCP server");
|
|
43
|
+
}
|
|
44
|
+
export function nextCapabilityState(state, sourceId, args) {
|
|
45
|
+
validatePackageRequest(args);
|
|
46
|
+
const hash = capabilityHash({
|
|
47
|
+
sourceId,
|
|
48
|
+
sourceRef: args.source_ref,
|
|
49
|
+
action: args.action ?? "add",
|
|
50
|
+
tools: [...(args.tools ?? [])].sort(),
|
|
51
|
+
mcpServers: [...(args.mcp_servers ?? [])].sort(),
|
|
52
|
+
});
|
|
53
|
+
const receipt = state.requests?.find(r => r.id === args.request_id);
|
|
54
|
+
if (receipt) {
|
|
55
|
+
if (receipt.hash !== hash)
|
|
56
|
+
throw new Error("request_id was already used for a different package change");
|
|
57
|
+
return { state, changed: false };
|
|
58
|
+
}
|
|
59
|
+
if (state.revision !== args.expected_revision)
|
|
60
|
+
throw new Error("Capability revision conflict; list current selections and retry");
|
|
61
|
+
const old = state.selections.find(s => s.sourceId === sourceId) ?? { sourceId, tools: [], mcpServers: [] };
|
|
62
|
+
const merge = (current, selected) => args.action === "remove"
|
|
63
|
+
? current.filter(n => !selected.includes(n)) : [...new Set([...current, ...selected])].sort();
|
|
64
|
+
// Removing one export cannot silently upgrade all remaining exports to a
|
|
65
|
+
// newly published source revision. Preserve the original exact ref until
|
|
66
|
+
// the selection is fully removed or explicitly re-added from a fresh ref.
|
|
67
|
+
const selection = { sourceId,
|
|
68
|
+
sourceRef: args.action === "remove" ? old.sourceRef ?? args.source_ref : args.source_ref,
|
|
69
|
+
tools: merge(old.tools, args.tools ?? []), mcpServers: merge(old.mcpServers, args.mcp_servers ?? []) };
|
|
70
|
+
const selections = state.selections.filter(s => s.sourceId !== sourceId);
|
|
71
|
+
if (selection.tools.length || selection.mcpServers.length)
|
|
72
|
+
selections.push(selection);
|
|
73
|
+
if (selections.length > 32)
|
|
74
|
+
throw new Error("At most 32 capability sources may be attached");
|
|
75
|
+
selections.sort((a, b) => a.sourceId.localeCompare(b.sourceId));
|
|
76
|
+
const changed = capabilityHash(selections) !== capabilityHash(state.selections);
|
|
77
|
+
return { changed, state: { revision: state.revision + 1, selections,
|
|
78
|
+
requests: [...(state.requests ?? []), { id: args.request_id, hash }].slice(-64) } };
|
|
79
|
+
}
|
|
80
|
+
/** Resolve exact exports. Never fall back to a same-named package or the legacy flat registry. */
|
|
81
|
+
export function bindCapabilities(sources, owner, selections, originalTools, originalMcp, agent, strict = false) {
|
|
82
|
+
const tools = [];
|
|
83
|
+
const mcpServers = Object.create(null);
|
|
84
|
+
const unavailable = [];
|
|
85
|
+
const toolNames = new Set(originalTools.map(t => t.name));
|
|
86
|
+
const mcpNames = new Set(Object.keys(originalMcp));
|
|
87
|
+
const bound = [];
|
|
88
|
+
for (const selection of selections) {
|
|
89
|
+
const source = sources.find(s => s.id === selection.sourceId && visibleCapabilitySource(s, owner));
|
|
90
|
+
if (!source) {
|
|
91
|
+
if (strict)
|
|
92
|
+
throw new Error("Capability source unavailable or inaccessible");
|
|
93
|
+
unavailable.push(selection.sourceId);
|
|
94
|
+
continue;
|
|
95
|
+
}
|
|
96
|
+
if (selection.sourceRef) {
|
|
97
|
+
try {
|
|
98
|
+
const exact = resolveCapabilitySource(sources, owner, selection.sourceRef);
|
|
99
|
+
if (exact.ref.k !== "source" || exact.source !== source)
|
|
100
|
+
throw new Error("Capability selection source mismatch");
|
|
101
|
+
}
|
|
102
|
+
catch (error) {
|
|
103
|
+
if (strict)
|
|
104
|
+
throw error;
|
|
105
|
+
unavailable.push(selection.sourceId);
|
|
106
|
+
continue;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
const selectedTools = [];
|
|
110
|
+
const selectedMcp = {};
|
|
111
|
+
let problem = "";
|
|
112
|
+
for (const name of selection.tools) {
|
|
113
|
+
const tool = source.tools.get(name);
|
|
114
|
+
if (!tool || tool.name !== name) {
|
|
115
|
+
problem = "Selected tool unavailable";
|
|
116
|
+
break;
|
|
117
|
+
}
|
|
118
|
+
if (toolNames.has(name) || findReservedPackageToolName([name], [], [])) {
|
|
119
|
+
problem = `Tool name collision or reserved name: ${name}`;
|
|
120
|
+
break;
|
|
121
|
+
}
|
|
122
|
+
selectedTools.push(tool);
|
|
123
|
+
}
|
|
124
|
+
for (const name of selection.mcpServers) {
|
|
125
|
+
if (name === "__proto__" || name === "prototype" || name === "constructor"
|
|
126
|
+
|| !Object.hasOwn(source.mcpServers, name)) {
|
|
127
|
+
problem = "Selected MCP server unavailable";
|
|
128
|
+
break;
|
|
129
|
+
}
|
|
130
|
+
const cfg = source.mcpServers[name];
|
|
131
|
+
if (!cfg) {
|
|
132
|
+
problem = "Selected MCP server unavailable";
|
|
133
|
+
break;
|
|
134
|
+
}
|
|
135
|
+
if (mcpNames.has(name)) {
|
|
136
|
+
problem = `MCP server name collision: ${name}`;
|
|
137
|
+
break;
|
|
138
|
+
}
|
|
139
|
+
if (cfg.allowedAgents && !mcpAllowlistAdmits(cfg.allowedAgents, agent)) {
|
|
140
|
+
problem = "MCP server is restricted to an authorized bound agent";
|
|
141
|
+
break;
|
|
142
|
+
}
|
|
143
|
+
const { allowedAgents: _, ...server } = cfg;
|
|
144
|
+
selectedMcp[name] = server;
|
|
145
|
+
}
|
|
146
|
+
if (problem) {
|
|
147
|
+
if (strict)
|
|
148
|
+
throw new Error(problem);
|
|
149
|
+
unavailable.push(selection.sourceId);
|
|
150
|
+
continue;
|
|
151
|
+
}
|
|
152
|
+
for (const tool of selectedTools) {
|
|
153
|
+
tools.push(tool);
|
|
154
|
+
toolNames.add(tool.name);
|
|
155
|
+
}
|
|
156
|
+
Object.assign(mcpServers, selectedMcp);
|
|
157
|
+
Object.keys(selectedMcp).forEach(n => mcpNames.add(n));
|
|
158
|
+
bound.push({ sourceId: source.id, revision: source.revision,
|
|
159
|
+
tools: [...selection.tools].sort(), mcpServers: [...selection.mcpServers].sort() });
|
|
160
|
+
}
|
|
161
|
+
return { tools, mcpServers, unavailable, fingerprint: capabilityHash(bound) };
|
|
162
|
+
}
|
|
163
|
+
//# sourceMappingURL=capability-runtime.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"capability-runtime.js","sourceRoot":"","sources":["../src/capability-runtime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAa,MAAM,qBAAqB,CAAC;AAC5D,OAAO,EAAqB,cAAc,EAAE,uBAAuB,EAAE,uBAAuB,EACjB,MAAM,yBAAyB,CAAC;AAE3G,OAAO,EAAE,kBAAkB,EAA0B,MAAM,iBAAiB,CAAC;AAC7E,OAAO,EAAE,2BAA2B,EAAE,MAAM,0BAA0B,CAAC;AAYvE,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACjC,mBAAmB,EAAE;QACjB,WAAW,EAAE,iTAAiT;QAC9T,UAAU,EAAE,E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","sources":["../src/cms-migrations.ts"],"names":[],"mappings":"AACA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAIvD;;;GAGG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,cAAc,EAAE,CAkY/D"}
|
package/dist/cms-migrations.js
CHANGED
|
@@ -1,11 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
* CMS Migration definitions — ordered SQL migrations for the session catalog.
|
|
3
|
-
*
|
|
4
|
-
* Each migration is a function of schema name → SQL string so that the schema
|
|
5
|
-
* placeholder is resolved at runtime (supporting isolated test schemas).
|
|
6
|
-
*
|
|
7
|
-
* @module
|
|
8
|
-
*/
|
|
1
|
+
import { baseAgentV2Migration } from "./migrations/base-agent-v2-0079.js";
|
|
9
2
|
import { featureFlagsMigration } from "./migrations/feature-flags-0077.js";
|
|
10
3
|
import { nativeTasksDefaultPolicyMigration } from "./migrations/native-tasks-default-policy-0078.js";
|
|
11
4
|
/**
|
|
@@ -396,6 +389,7 @@ export function CMS_MIGRATIONS(schema) {
|
|
|
396
389
|
},
|
|
397
390
|
{ version: "0077", name: "feature_flags", sql: featureFlagsMigration(schema) },
|
|
398
391
|
{ version: "0078", name: "native_tasks_default_policy", sql: nativeTasksDefaultPolicyMigration(schema) },
|
|
392
|
+
{ version: "0079", name: "base_agent_v2", sql: baseAgentV2Migration(schema) },
|
|
399
393
|
];
|
|
400
394
|
}
|
|
401
395
|
/** Cluster admin accounting projections; all pre-existing procedures remain intact. */
|