@intentic/extension-api 1.430.0 → 1.432.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/README.md +130 -4
- package/dist/api.d.ts +1 -0
- package/dist/api.d.ts.map +1 -1
- package/dist/backend-reach.d.ts +23 -0
- package/dist/backend-reach.d.ts.map +1 -0
- package/dist/backend-reach.js +241 -0
- package/dist/backend-reach.js.map +1 -0
- 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/runtime.d.ts +12 -2
- package/dist/runtime.d.ts.map +1 -1
- package/dist/runtime.js +110 -132
- package/dist/runtime.js.map +1 -1
- package/dist/server-reach.d.ts +58 -0
- package/dist/server-reach.d.ts.map +1 -0
- package/dist/server-reach.js +2 -0
- package/dist/server-reach.js.map +1 -0
- package/dist/server.d.ts +186 -1
- package/dist/server.d.ts.map +1 -1
- package/dist/sleep-fake.d.ts +15 -0
- package/dist/sleep-fake.d.ts.map +1 -0
- package/dist/sleep-fake.js +99 -0
- package/dist/sleep-fake.js.map +1 -0
- package/dist/sleep-reach.d.ts +7 -0
- package/dist/sleep-reach.d.ts.map +1 -0
- package/dist/sleep-reach.js +104 -0
- package/dist/sleep-reach.js.map +1 -0
- package/dist/testing.d.ts +64 -9
- package/dist/testing.d.ts.map +1 -1
- package/dist/testing.js +322 -13
- package/dist/testing.js.map +1 -1
- package/dist/turn-reach.d.ts +7 -0
- package/dist/turn-reach.d.ts.map +1 -0
- package/dist/turn-reach.js +140 -0
- package/dist/turn-reach.js.map +1 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.d.ts.map +1 -1
- package/dist/version.js +1 -1
- package/dist/version.js.map +1 -1
- package/dist/wire.d.ts +5 -0
- package/dist/wire.d.ts.map +1 -0
- package/dist/wire.js +45 -0
- package/dist/wire.js.map +1 -0
- package/package.json +15 -4
- package/src/api.ts +3 -0
- package/src/backend-reach.integration.test.ts +154 -0
- package/src/backend-reach.ts +335 -0
- package/src/caller.integration.test.ts +108 -0
- package/src/index.ts +1 -0
- package/src/runtime.ts +184 -157
- package/src/server-reach.ts +104 -0
- package/src/server.ts +364 -3
- package/src/sleep-fake.ts +140 -0
- package/src/sleep-reach.integration.test.ts +119 -0
- package/src/sleep-reach.ts +147 -0
- package/src/surface.json +18932 -1
- package/src/testing.ts +506 -23
- package/src/turn-reach.integration.test.ts +166 -0
- package/src/turn-reach.ts +198 -0
- package/src/version.ts +121 -1
- package/src/wire.ts +64 -0
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
import { waitFor } from "@intentic/testing/bun";
|
|
2
|
+
import type { ExtensionServerApi, JobSpec, RunningJob, ToolCallContext, ToolCallGrants, ToolDefinition } from "./server.js";
|
|
3
|
+
import { type FakeExtension, fakeExtensionApi } from "./testing.js";
|
|
4
|
+
|
|
5
|
+
// (2026-11-26) What an extension's tools do with the turn calling them (turn-reach.ts), through the SDK's fake daemon
|
|
6
|
+
// (testing.ts), which judges each call as the daemon's turn doors do: the declared power, a live ticket, and the grants
|
|
7
|
+
// the ticket stands for.
|
|
8
|
+
|
|
9
|
+
const opened: FakeExtension[] = [];
|
|
10
|
+
const fake = async (options: Parameters<typeof fakeExtensionApi>[0]): Promise<FakeExtension> => {
|
|
11
|
+
const made = await fakeExtensionApi(options);
|
|
12
|
+
opened.push(made);
|
|
13
|
+
return made;
|
|
14
|
+
};
|
|
15
|
+
afterEach(async () => {
|
|
16
|
+
await Promise.all(opened.splice(0).map((each) => each.dispose()));
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
const GRANTS: ToolCallGrants = {
|
|
20
|
+
accounts: [{ id: "chatgpt", kind: "browser", sites: ["chatgpt.com", "openai.com"] }],
|
|
21
|
+
browsers: ["brave"],
|
|
22
|
+
cards: [],
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
const ALL_POWERS = { publisher: "acme", name: "kit", permissions: { turn: ["browser", "owner-browser", "jobs"] as const } };
|
|
26
|
+
|
|
27
|
+
// A backend whose one tool hands its arguments and context to `run`, and answers what `run` answers.
|
|
28
|
+
const serving = (run: (api: ExtensionServerApi, args: Parameters<ToolDefinition["call"]>[0], context: ToolCallContext) => ReturnType<ToolDefinition["call"]>) => ({
|
|
29
|
+
activateServer: (api: ExtensionServerApi) => {
|
|
30
|
+
const tool: ToolDefinition = { name: "act", description: "acts", inputSchema: { type: "object" }, call: async (args, context) => await run(api, args, context) };
|
|
31
|
+
api.tools.serve(() => [tool]);
|
|
32
|
+
},
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
test("a call is handed what its turn holds and a ticket good only while it runs", async () => {
|
|
36
|
+
const seen: ToolCallContext[] = [];
|
|
37
|
+
const extension = await fake({ manifest: ALL_POWERS, grants: GRANTS });
|
|
38
|
+
await extension.activate(
|
|
39
|
+
serving(async (_api, _args, context) => {
|
|
40
|
+
seen.push(context);
|
|
41
|
+
return "ok";
|
|
42
|
+
}),
|
|
43
|
+
);
|
|
44
|
+
await extension.callTool("act", {}, undefined, { conversationId: "c-1" });
|
|
45
|
+
expect(seen).toEqual([{ signal: expect.any(AbortSignal), grants: GRANTS, conversationId: "c-1", ticket: expect.any(String) }]);
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
test("a tool drives an account the turn holds, on its sites, and the daemon is told the account and the tool", async () => {
|
|
49
|
+
const extension = await fake({
|
|
50
|
+
manifest: ALL_POWERS,
|
|
51
|
+
grants: GRANTS,
|
|
52
|
+
browser: (call) => ({ content: [{ type: "text", text: `${call.tool} as ${call.account}` }] }),
|
|
53
|
+
});
|
|
54
|
+
await extension.activate(serving(async (api, _args, context) => await api.browser.call(context, { account: "chatgpt", tool: "browser_navigate", args: { url: "https://chatgpt.com/" } })));
|
|
55
|
+
expect(await extension.callTool("act", {}, undefined, { conversationId: "c-1" })).toEqual({ content: [{ type: "text", text: "browser_navigate as chatgpt" }] });
|
|
56
|
+
expect(extension.browserCalls).toEqual([{ account: "chatgpt", tool: "browser_navigate", args: { url: "https://chatgpt.com/" }, conversationId: "c-1" }]);
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
test.each([
|
|
60
|
+
["an account the turn does not hold", { account: "x", tool: "browser_snapshot" }, /holds no account "x"/],
|
|
61
|
+
["a tool outside the page's own", { account: "chatgpt", tool: "browser_run_code_unsafe", args: { code: "async (page) => page.context().cookies()" } }, /not a browser tool an extension may call/],
|
|
62
|
+
["a navigation off the account's sites", { account: "chatgpt", tool: "browser_navigate", args: { url: "https://mail.google.com/" } }, /signs in on chatgpt\.com or openai\.com/],
|
|
63
|
+
])("the daemon refuses %s, and the browser is never asked", async (_name, call, refusal) => {
|
|
64
|
+
const extension = await fake({ manifest: ALL_POWERS, grants: GRANTS });
|
|
65
|
+
await extension.activate(serving(async (api, _args, context) => await api.browser.call(context, call)));
|
|
66
|
+
await expect(Promise.resolve(extension.callTool("act", {}, undefined, { conversationId: "c-1" }))).rejects.toThrow(refusal);
|
|
67
|
+
expect(extension.browserCalls).toEqual([]);
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
test("an undeclared power is refused before anything is sent", async () => {
|
|
71
|
+
const extension = await fake({ manifest: { publisher: "acme", name: "kit", permissions: { turn: ["jobs"] as const } }, grants: GRANTS });
|
|
72
|
+
await extension.activate(serving(async (api, _args, context) => await api.browser.call(context, { account: "chatgpt", tool: "browser_snapshot" })));
|
|
73
|
+
await expect(Promise.resolve(extension.callTool("act", {}, undefined, { conversationId: "c-1" }))).rejects.toThrow('did not declare "browser" in permissions.turn');
|
|
74
|
+
expect(extension.calls).toEqual([]);
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
test("a ticket kept past its call reaches nothing", async () => {
|
|
78
|
+
let kept: ToolCallContext | undefined;
|
|
79
|
+
const extension = await fake({ manifest: ALL_POWERS, grants: GRANTS });
|
|
80
|
+
await extension.activate(
|
|
81
|
+
serving(async (_api, _args, context) => {
|
|
82
|
+
kept = context;
|
|
83
|
+
return "ok";
|
|
84
|
+
}),
|
|
85
|
+
);
|
|
86
|
+
await extension.callTool("act", {}, undefined, { conversationId: "c-1" });
|
|
87
|
+
if (kept === undefined) {
|
|
88
|
+
throw new Error("the tool was not called");
|
|
89
|
+
}
|
|
90
|
+
await expect(extension.api.browser.call(kept, { account: "chatgpt", tool: "browser_snapshot" })).rejects.toThrow(/is running under that ticket/);
|
|
91
|
+
await expect(extension.api.browser.call({ grants: GRANTS }, { account: "chatgpt", tool: "browser_snapshot" })).rejects.toThrow(/carries no ticket onto its turn/);
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
test("the owner's browser is reached only when the turn holds it", async () => {
|
|
95
|
+
const extension = await fake({ manifest: ALL_POWERS, grants: GRANTS, ownerBrowser: (call) => ({ content: [{ type: "text", text: `${call.tool} in ${call.browser}` }] }) });
|
|
96
|
+
await extension.activate(serving(async (api, args, context) => await api.ownerBrowser.call(context, { browser: String(args["browser"]), tool: "read", args: { url: "https://chatgpt.com/" } })));
|
|
97
|
+
expect(await extension.callTool("act", { browser: "brave" }, undefined, { conversationId: "c-1" })).toEqual({ content: [{ type: "text", text: "read in brave" }] });
|
|
98
|
+
await expect(Promise.resolve(extension.callTool("act", { browser: "chrome" }, undefined, { conversationId: "c-1" }))).rejects.toThrow(/holds no browser of the owner's called "chrome"/);
|
|
99
|
+
expect(extension.ownerBrowserCalls.map((call) => call.browser)).toEqual(["brave"]);
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
test("a job is filed in the calling conversation, its work runs with the call's grants, and its end is what the agent collects", async () => {
|
|
103
|
+
const extension = await fake({ manifest: ALL_POWERS, grants: GRANTS, ownerBrowser: () => ({ content: [{ type: "text", text: "saved /artifacts/cat.png" }] }) });
|
|
104
|
+
const spec = (run: JobSpec["run"]): JobSpec => ({ command: "chatgpt_image cat", description: "a cat", started: "Making a cat.", lane: { name: "brave", key: "chat-1", most: 2 }, run });
|
|
105
|
+
await extension.activate(
|
|
106
|
+
serving(async (api, _args, context) =>
|
|
107
|
+
await api.jobs.start(
|
|
108
|
+
context,
|
|
109
|
+
spec(async (job) => {
|
|
110
|
+
job.say("sent");
|
|
111
|
+
const saved = await api.ownerBrowser.call(job, { browser: "brave", tool: "chatgpt_image", args: { prompt: "a cat" } });
|
|
112
|
+
return { ok: true, output: saved.content.map((block) => (block.type === "text" ? block.text : "")).join("") };
|
|
113
|
+
}),
|
|
114
|
+
),
|
|
115
|
+
),
|
|
116
|
+
);
|
|
117
|
+
expect(await extension.callTool("act", {}, undefined, { conversationId: "c-1" })).toEqual({ id: "job-1", ahead: 0 });
|
|
118
|
+
expect(await extension.jobEnd("job-1")).toEqual({ ok: true, output: "saved /artifacts/cat.png" });
|
|
119
|
+
expect(extension.jobs).toEqual([
|
|
120
|
+
{
|
|
121
|
+
id: "job-1",
|
|
122
|
+
conversationId: "c-1",
|
|
123
|
+
command: "chatgpt_image cat",
|
|
124
|
+
description: "a cat",
|
|
125
|
+
lane: { name: "brave", key: "chat-1", most: 2 },
|
|
126
|
+
lines: ["sent"],
|
|
127
|
+
end: { ok: true, output: "saved /artifacts/cat.png" },
|
|
128
|
+
stopped: false,
|
|
129
|
+
},
|
|
130
|
+
]);
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
test("a job stopped by the agent aborts its work, and one whose work throws ends failed with the message", async () => {
|
|
134
|
+
const extension = await fake({ manifest: ALL_POWERS, grants: GRANTS });
|
|
135
|
+
const running: RunningJob[] = [];
|
|
136
|
+
await extension.activate(
|
|
137
|
+
serving(async (api, args, context) =>
|
|
138
|
+
await api.jobs.start(context, {
|
|
139
|
+
command: "work",
|
|
140
|
+
description: "work",
|
|
141
|
+
started: "Working.",
|
|
142
|
+
run: async (job) => {
|
|
143
|
+
running.push(job);
|
|
144
|
+
if (args["fail"] === true) {
|
|
145
|
+
throw new Error("the page changed");
|
|
146
|
+
}
|
|
147
|
+
await new Promise<void>((resolve) => job.signal.addEventListener("abort", () => resolve()));
|
|
148
|
+
return { ok: false, output: "stopped" };
|
|
149
|
+
},
|
|
150
|
+
}),
|
|
151
|
+
),
|
|
152
|
+
);
|
|
153
|
+
await extension.callTool("act", {}, undefined, { conversationId: "c-1" });
|
|
154
|
+
await waitFor(() => running.length === 1);
|
|
155
|
+
extension.stopJob("job-1");
|
|
156
|
+
await waitFor(() => running[0]?.signal.aborted === true);
|
|
157
|
+
await extension.callTool("act", { fail: true }, undefined, { conversationId: "c-1" });
|
|
158
|
+
expect(await extension.jobEnd("job-2")).toEqual({ ok: false, output: 'The job failed in extension "acme.kit": the page changed' });
|
|
159
|
+
});
|
|
160
|
+
|
|
161
|
+
test("a call with no conversation files no job", async () => {
|
|
162
|
+
const extension = await fake({ manifest: ALL_POWERS, grants: GRANTS });
|
|
163
|
+
await extension.activate(serving(async (api, _args, context) => await api.jobs.start(context, { command: "work", description: "work", started: "Working.", run: async () => ({ ok: true, output: "" }) })));
|
|
164
|
+
await expect(Promise.resolve(extension.callTool("act"))).rejects.toThrow(/no conversation to file a job in/);
|
|
165
|
+
expect(extension.jobs).toEqual([]);
|
|
166
|
+
});
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
import { errorMessage } from "@intentic/base/errors";
|
|
2
|
+
import { parseJsonWith } from "@intentic/base/json";
|
|
3
|
+
import type { ExtensionTurnPower } from "@intentic/extension-manifest/permissions";
|
|
4
|
+
import {
|
|
5
|
+
type ExtensionBrowserCall,
|
|
6
|
+
extensionBrowserUrl,
|
|
7
|
+
type ExtensionJobFrame,
|
|
8
|
+
ExtensionJobFrameSchema,
|
|
9
|
+
type ExtensionJobReport,
|
|
10
|
+
type ExtensionJobStart,
|
|
11
|
+
extensionJobsUrl,
|
|
12
|
+
extensionJobUrl,
|
|
13
|
+
type ExtensionOwnerBrowserCall,
|
|
14
|
+
extensionOwnerBrowserUrl,
|
|
15
|
+
ExtensionToolContentSchema,
|
|
16
|
+
ExtensionTurnCallAnswerSchema,
|
|
17
|
+
ExtensionTurnRefusalSchema,
|
|
18
|
+
NO_TOOL_GRANTS,
|
|
19
|
+
} from "@intentic/sandbox-contract/extension-protocol";
|
|
20
|
+
import type { ExtensionServerApi, JobEnd, JobSpec, RunningJob, StartedJob, ToolContent, ToolResult, TurnStanding } from "./server.js";
|
|
21
|
+
|
|
22
|
+
// (2026-11-26) What an extension's agent tools do with the grants of the turn calling them (`api.browser`,
|
|
23
|
+
// `api.ownerBrowser`, `api.jobs`), over the daemon's turn doors: each refused here before anything is sent when the
|
|
24
|
+
// manifest does not declare it in `permissions.turn`, or when the call carries no ticket, and refused by the daemon for
|
|
25
|
+
// anything the turn does not hold. The backend host only: a process serves no tool through it, so it holds no ticket.
|
|
26
|
+
|
|
27
|
+
type DaemonRequest = ExtensionServerApi["daemon"]["request"];
|
|
28
|
+
type TurnReach = Pick<ExtensionServerApi, "browser" | "ownerBrowser" | "jobs">;
|
|
29
|
+
|
|
30
|
+
const NO_TICKET =
|
|
31
|
+
"this call carries no ticket onto its turn: it did not come through the daemon's MCP door (a test calling the tool directly, or a daemon before 2.55.0)";
|
|
32
|
+
|
|
33
|
+
// What one of the doors is sent.
|
|
34
|
+
type TurnBody = ExtensionBrowserCall | ExtensionOwnerBrowserCall | ExtensionJobStart | ExtensionJobReport;
|
|
35
|
+
|
|
36
|
+
// The daemon's own words for a refusal: its `{ error }`, else the body's first line.
|
|
37
|
+
const refusalOf = async (answer: Response): Promise<string> => {
|
|
38
|
+
const text = await answer.text();
|
|
39
|
+
return parseJsonWith(text, ExtensionTurnRefusalSchema)?.error ?? text.split("\n")[0]?.slice(0, 300) ?? `${answer.status}`;
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
// A result as a tool reads it: its text and image blocks; a block of any other kind is left out.
|
|
43
|
+
const toolResultOf = (raw: { readonly content: readonly unknown[]; readonly isError?: boolean | undefined }): ToolResult => {
|
|
44
|
+
const content: ToolContent[] = raw.content.flatMap((block) => {
|
|
45
|
+
const read = ExtensionToolContentSchema.safeParse(block);
|
|
46
|
+
return read.success ? [read.data] : [];
|
|
47
|
+
});
|
|
48
|
+
return raw.isError === true ? { content, isError: true } : { content };
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
export const createTurnReach = (id: string, request: DaemonRequest, declared: readonly ExtensionTurnPower[], log: (message: string) => void): TurnReach => {
|
|
52
|
+
// The ticket the standing carries, once its power is declared; throws naming what is missing.
|
|
53
|
+
const ticketFor = (power: ExtensionTurnPower, standing: TurnStanding): string => {
|
|
54
|
+
if (!declared.includes(power)) {
|
|
55
|
+
throw new Error(`extension "${id}" did not declare "${power}" in permissions.turn: add it to its manifest`);
|
|
56
|
+
}
|
|
57
|
+
if (standing.ticket === undefined || standing.ticket === "") {
|
|
58
|
+
throw new Error(NO_TICKET);
|
|
59
|
+
}
|
|
60
|
+
return standing.ticket;
|
|
61
|
+
};
|
|
62
|
+
const post = (path: string, body: TurnBody, signal: AbortSignal | undefined): Promise<Response> => {
|
|
63
|
+
const init: RequestInit = { method: "POST", headers: { "content-type": "application/json" }, body: JSON.stringify(body) };
|
|
64
|
+
if (signal !== undefined) {
|
|
65
|
+
init.signal = signal;
|
|
66
|
+
}
|
|
67
|
+
return request(path, init);
|
|
68
|
+
};
|
|
69
|
+
// One turn call to its answer: the tool's result, or a rejection with the daemon's words.
|
|
70
|
+
const callTurn = async (path: string, body: TurnBody, signal: AbortSignal | undefined): Promise<ToolResult> => {
|
|
71
|
+
const answer = await post(path, body, signal);
|
|
72
|
+
if (!answer.ok) {
|
|
73
|
+
throw new Error(`the sandbox refused (${answer.status}): ${await refusalOf(answer)}`);
|
|
74
|
+
}
|
|
75
|
+
return toolResultOf(ExtensionTurnCallAnswerSchema.parse(await answer.json()).result);
|
|
76
|
+
};
|
|
77
|
+
return {
|
|
78
|
+
browser: {
|
|
79
|
+
call: async (standing, call) =>
|
|
80
|
+
await callTurn(extensionBrowserUrl(), { turn: ticketFor("browser", standing), account: call.account, tool: call.tool, arguments: call.args ?? {} }, standing.signal),
|
|
81
|
+
},
|
|
82
|
+
ownerBrowser: {
|
|
83
|
+
call: async (standing, call) =>
|
|
84
|
+
await callTurn(
|
|
85
|
+
extensionOwnerBrowserUrl(),
|
|
86
|
+
{ turn: ticketFor("owner-browser", standing), browser: call.browser, tool: call.tool, arguments: call.args ?? {} },
|
|
87
|
+
standing.signal,
|
|
88
|
+
),
|
|
89
|
+
},
|
|
90
|
+
jobs: {
|
|
91
|
+
start: async (standing, spec) => await startJob({ id, post, log }, ticketFor("jobs", standing), standing, spec),
|
|
92
|
+
},
|
|
93
|
+
};
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
// ---- jobs -----------------------------------------------------------------------------------------------------------
|
|
97
|
+
|
|
98
|
+
interface JobDeps {
|
|
99
|
+
readonly id: string;
|
|
100
|
+
readonly post: (path: string, body: TurnBody, signal: AbortSignal | undefined) => Promise<Response>;
|
|
101
|
+
readonly log: (message: string) => void;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
type FiledFrame = Extract<ExtensionJobFrame, { readonly kind: "filed" }>;
|
|
105
|
+
|
|
106
|
+
// Every frame of the job's stream, in order, to its end.
|
|
107
|
+
async function* framesOf(body: ReadableStream<Uint8Array>): AsyncGenerator<ExtensionJobFrame> {
|
|
108
|
+
const reader = body.getReader();
|
|
109
|
+
const decoder = new TextDecoder();
|
|
110
|
+
let buffer = "";
|
|
111
|
+
for (let chunk = await reader.read(); !chunk.done; chunk = await reader.read()) {
|
|
112
|
+
const parts = (buffer + decoder.decode(chunk.value, { stream: true })).split("\n");
|
|
113
|
+
buffer = parts.pop() ?? "";
|
|
114
|
+
for (const line of parts) {
|
|
115
|
+
const frame = line.trim() === "" ? undefined : parseJsonWith(line, ExtensionJobFrameSchema);
|
|
116
|
+
if (frame !== undefined) {
|
|
117
|
+
yield frame;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
// The job's work, run once its turn came, its end told to the daemon; a throw ends it as failed with the message.
|
|
124
|
+
const runWork = async (deps: JobDeps, filed: FiledFrame, job: RunningJob, spec: JobSpec): Promise<void> => {
|
|
125
|
+
let end: JobEnd;
|
|
126
|
+
try {
|
|
127
|
+
end = await spec.run(job);
|
|
128
|
+
} catch (error) {
|
|
129
|
+
end = { ok: false, output: `The job failed in extension "${deps.id}": ${errorMessage(error)}` };
|
|
130
|
+
}
|
|
131
|
+
await report(deps, filed, { end });
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
const report = async (deps: JobDeps, filed: FiledFrame, body: Omit<ExtensionJobReport, "job">): Promise<void> => {
|
|
135
|
+
try {
|
|
136
|
+
const answer = await deps.post(extensionJobUrl(filed.id), { job: filed.job, ...body }, undefined);
|
|
137
|
+
if (!answer.ok) {
|
|
138
|
+
deps.log(`job ${filed.id}: the sandbox did not take its ${body.end === undefined ? "line" : "end"} (${answer.status}): ${await refusalOf(answer)}`);
|
|
139
|
+
}
|
|
140
|
+
} catch (error) {
|
|
141
|
+
deps.log(`job ${filed.id}: its ${body.end === undefined ? "line" : "end"} did not reach the sandbox: ${errorMessage(error)}`);
|
|
142
|
+
}
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
// Files the job and answers once it is filed; the rest of its stream (its turn coming, a stop) is read on, and its
|
|
146
|
+
// work runs here, its lines and its end told to the daemon.
|
|
147
|
+
const startJob = async (deps: JobDeps, ticket: string, standing: TurnStanding, spec: JobSpec): Promise<StartedJob> => {
|
|
148
|
+
const asked: ExtensionJobStart = { turn: ticket, command: spec.command, description: spec.description, started: spec.started };
|
|
149
|
+
if (spec.lane !== undefined) {
|
|
150
|
+
asked.lane = { name: spec.lane.name };
|
|
151
|
+
if (spec.lane.key !== undefined) {
|
|
152
|
+
asked.lane.key = spec.lane.key;
|
|
153
|
+
}
|
|
154
|
+
if (spec.lane.most !== undefined) {
|
|
155
|
+
asked.lane.most = spec.lane.most;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
const answer = await deps.post(extensionJobsUrl(), asked, undefined);
|
|
159
|
+
if (!answer.ok || answer.body === null) {
|
|
160
|
+
throw new Error(`the sandbox refused (${answer.status}): ${await refusalOf(answer)}`);
|
|
161
|
+
}
|
|
162
|
+
const frames = framesOf(answer.body);
|
|
163
|
+
const first = await frames.next();
|
|
164
|
+
if (first.done === true || first.value.kind !== "filed") {
|
|
165
|
+
throw new Error("the sandbox did not say the job was filed");
|
|
166
|
+
}
|
|
167
|
+
const filed = first.value;
|
|
168
|
+
const stopped = new AbortController();
|
|
169
|
+
let says: Promise<void> = Promise.resolve();
|
|
170
|
+
const job: RunningJob = {
|
|
171
|
+
id: filed.id,
|
|
172
|
+
grants: standing.grants ?? NO_TOOL_GRANTS,
|
|
173
|
+
ticket: filed.job,
|
|
174
|
+
signal: stopped.signal,
|
|
175
|
+
// In order, one at a time.
|
|
176
|
+
say: (line) => void (says = says.then(() => report(deps, filed, { say: line }))),
|
|
177
|
+
};
|
|
178
|
+
void (async () => {
|
|
179
|
+
let work: Promise<void> | undefined;
|
|
180
|
+
try {
|
|
181
|
+
for await (const frame of frames) {
|
|
182
|
+
if (frame.kind === "begin") {
|
|
183
|
+
work = says.then(() => runWork(deps, filed, job, spec));
|
|
184
|
+
}
|
|
185
|
+
if (frame.kind === "stopped") {
|
|
186
|
+
stopped.abort();
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
} catch (error) {
|
|
190
|
+
deps.log(`job ${filed.id}: its stream from the sandbox broke: ${errorMessage(error)}`);
|
|
191
|
+
} finally {
|
|
192
|
+
// The stream ends once the job did, however it ended: whatever the work still does is read by nobody.
|
|
193
|
+
stopped.abort();
|
|
194
|
+
await work;
|
|
195
|
+
}
|
|
196
|
+
})();
|
|
197
|
+
return { id: filed.id, ahead: filed.ahead };
|
|
198
|
+
};
|
package/src/version.ts
CHANGED
|
@@ -30,4 +30,124 @@
|
|
|
30
30
|
// names where a 200 answer says it worked. Additive. The recorded surface grows the manifest schema.
|
|
31
31
|
// 2.43.0 names the signed-in user's trust tier `api.sandbox.tier()`. `role()` answers the same and is deprecated until
|
|
32
32
|
// 3.0.0: personas were renamed roles. Additive. The recorded surface grows `sandboxApi`.
|
|
33
|
-
|
|
33
|
+
// 2.44.0 versions the slice of @intentic/sandbox-contract an extension may read: `EXTENSION_WIRE`
|
|
34
|
+
// (@intentic/extension-api/wire) names the bare package and the subpaths an extension may import, and the lint and
|
|
35
|
+
// `intentic-kit-check` refuse any other. Additive. The recorded surface grows `wireExports`: each allowed subpath's export
|
|
36
|
+
// names and a digest of its zod schemas, so a schema an extension parses cannot change without a new entry.
|
|
37
|
+
// 2.45.0 records app-routes' `returnPath`, which validates a sign-in destination as a path on the editor's origin.
|
|
38
|
+
// 2.46.0 records the routed conversation prefix and account routing fields in the agent and subagent schemas.
|
|
39
|
+
// 2.47.0 records the listener protocol's reliable delivery: `id` on a /deliver body (a gateway posts one reply id once),
|
|
40
|
+
// `features` on a gateway's status (`DELIVER_ID_FEATURE`), and the dispatch key header (`LISTENER_DISPATCH_KEY_HEADER`)
|
|
41
|
+
// a gateway names a retried message by. Additive: each is optional, and an older side ignores it.
|
|
42
|
+
// 2.48.0 records the automations wire's webhook signature schemes (`WEBHOOK_SIGNATURE_SCHEMES`, `WebhookSignatureSchema`,
|
|
43
|
+
// `WebhookSignatureSchemeSchema`) and its `carried` run outcome, and the keyring wire's `isVaultKey`. Additive.
|
|
44
|
+
// 2.49.0 lets a cli card declare the outward actions it performs (2026-11-25): `broker.actions` names what a request
|
|
45
|
+
// through the credential gateway does (method, path, and where it names its channel and content), and `commandActions`
|
|
46
|
+
// what a command of the extension's own does (`whatsapp send`). The sandbox classifies, records and holds them to the
|
|
47
|
+
// owner's action rules (`<card id>.<action>`) from these, and Guardrails offers the enabled extensions' actions; it
|
|
48
|
+
// matches no provider's address or command itself any more. Additive. The recorded surface grows the manifest schema.
|
|
49
|
+
// 2.50.0 gives an extension's own code four primitives the daemon's engines had to itself (2026-11-26), each a power its
|
|
50
|
+
// manifest declares under `permissions` and the daemon refuses undeclared: `api.events` hears a run end in a conversation
|
|
51
|
+
// it started through POST /agent with its own token (`run`) and whether any agent turn runs (`activity`); `api.work.hold`
|
|
52
|
+
// keeps the sandbox awake and an update or restart waiting while work is in flight (`work`); `api.exec` runs a command
|
|
53
|
+
// under a workload class (`exec`: `command`, or `toolchain`, queued with the sandbox's builds); and an automation whose
|
|
54
|
+
// target is `{ kind: "extension" }` fires a handler the backend registers with `api.automations.onFire` (`fires`),
|
|
55
|
+
// under the scheduler's admission, holds and journal, handed over late when the backend was down. A declared process gets
|
|
56
|
+
// the first three. Additive: a manifest without them is unchanged, and `fakeExtensionApi` models each. The recorded
|
|
57
|
+
// surface grows `serverApi` and the manifest schema, and the wire's automations schemas (the new target).
|
|
58
|
+
// 2.51.0 (2026-11-26) lets an extension declare a watch kind and answer its check: `contributes.watchKinds` names each
|
|
59
|
+
// kind (its id, label, the sentence a source of it reads as, and its parameters as fields the composer, the
|
|
60
|
+
// `automations` command and the approval card draw and saving checks), and `api.checks.serve(kind, handler)` answers one
|
|
61
|
+
// check (`WatchCheck`: the parameters, what the last pass saw, and the credential-gateway addresses of the extension's own
|
|
62
|
+
// cards the kind names) with a pass and what it saw, or what it is still waiting for, reached from the daemon's
|
|
63
|
+
// automations engine alone through the backend host's door. `contributes.automationTemplates` takes every field the
|
|
64
|
+
// daemon's own templates carry (a `once` or webhook trigger's fields, `tz`, `afterSessions`, a watch's `source`, `fireOn`,
|
|
65
|
+
// `until` and `target`), so any template can be an extension's. The npm and GitHub release kinds left the daemon for the
|
|
66
|
+
// connectors extension, under the same ids. Additive: a manifest without them is unchanged, and `fakeExtensionApi`
|
|
67
|
+
// models `check`. The recorded surface grows `serverApi`, the manifest schema, and the wire's automations schemas (an
|
|
68
|
+
// open watch source, the catalogue's `watchKinds`).
|
|
69
|
+
// 2.52.0 (2026-11-26) lets an extension declare the jobs it starts agent runs for, `contributes.modelRoles` (an id, a label,
|
|
70
|
+
// an explanation, an icon and the setup it is suggested), which the owner puts on a model setup in Sandbox ▸ Agent ▸
|
|
71
|
+
// Models beside the sandbox's own; the daemon serves both (`GET /settings/model-roles`), and `job` on POST /agent and
|
|
72
|
+
// `api.models.agentRun(role)` take any job's id, the sandbox's own or one an extension declares (`runRole` keeps its
|
|
73
|
+
// closed list beside it, which every sandbox reads). The pipelines,
|
|
74
|
+
// deployments, maintenance, documentation and acceptance extensions declare the jobs the core's table held for them, under
|
|
75
|
+
// the same ids. And a card's `commandActions` entry says who decides its rule, `gatedBy: "sandbox"` (the command guard,
|
|
76
|
+
// the default) or `"backend"` (the card's backend, which asks the outward-action door), and what it comes to while no
|
|
77
|
+
// rule names it, `unruled: "allow"` (the default) or `"hold"`; `selfGated: true` is deprecated and read as the two
|
|
78
|
+
// together. Additive: a manifest without them is unchanged. The recorded surface grows the manifest schema and
|
|
79
|
+
// `contributes`, and the wire's agent schemas (`job`, an open id).
|
|
80
|
+
// 2.53.0 (2026-11-26) gives an extension three doors the core kept to its own features. `contributes.publicRoutes` declares
|
|
81
|
+
// routes anyone on the internet may call at /door/<id>/<path>, each a power the owner approves, and the daemon hands a
|
|
82
|
+
// call to `api.publicRoutes.serve` only once its own protections passed it (the body's size, a per-minute window and a
|
|
83
|
+
// daily ceiling, an automation's allowed origins or its door key, a proof-of-work challenge, a provider's signature over
|
|
84
|
+
// the body with a sandbox secret the extension never sees, a redelivery answered without it), with what it checked
|
|
85
|
+
// (`PublicRouteVerification`). `api.caller(request)` says who a request through `/x/<id>` comes from, as the daemon
|
|
86
|
+
// verified them (a person with their tier, areas and the folders those come to, a panel, a program, another extension,
|
|
87
|
+
// or nobody on a sandbox without sign-in), read off an assertion the daemon mints for that extension and signs with a
|
|
88
|
+
// key only it holds, good for two minutes; `api.daemon.asCaller(caller)` hands it back, and POST /agent then starts the
|
|
89
|
+
// turn as that person, held to their access as it stands. And `contributes.listener.strangers` says anyone on the
|
|
90
|
+
// internet reaches a source, which holds its wakes to the owner's floor for a visitor or a bug report instead of a team
|
|
91
|
+
// chat's. Additive: a manifest without them is unchanged, and `fakeExtensionApi` models `route(path, init, { caller })`
|
|
92
|
+
// and `publicRoute`. The recorded surface grows `serverApi`, `daemonApi`, `contributes`, the listener's fields and the
|
|
93
|
+
// manifest schema, and the wire's automations schemas (a trigger source's `strangers`).
|
|
94
|
+
// 2.54.0 (2026-11-26) lets a card declare what the core read from its own tables keyed by provider name. `channel` on a
|
|
95
|
+
// capability contribution says the platform's one-message limit (`messageLimit`, which the approvals inbox counts a post
|
|
96
|
+
// against and a gateway reads with connector-runtime's `declaredMessageLimit`), the targets its extension's backend
|
|
97
|
+
// publishes an approved post to itself (`publish.target`, a pattern; `api.approvals.publish` receives the post once the
|
|
98
|
+
// daemon matched and spent the person's yes, the way `perform` receives an action), and what a publishing turn should
|
|
99
|
+
// know about posting there (`posting`). `processors` says where a card sends people's data for the Data protection page
|
|
100
|
+
// (its flow, operator, region, third country, hosts and a field naming its server), and `status: { from: "listener" }`
|
|
101
|
+
// takes a card's status from its listener's report, with where a pairing code is typed. A public route may require a
|
|
102
|
+
// Cloudflare Turnstile token (`turnstile.secret`, a sandbox secret the daemon verifies with, sent as
|
|
103
|
+
// `x-intentic-turnstile`), told to the backend as `turnstile: true`. The four the bug intake lost moving onto a public
|
|
104
|
+
// door, for any extension: a route's `keyFromBrowsers` (an automation that opts in on its listener trigger,
|
|
105
|
+
// `keyFromBrowsers`, lets its key admit a browser whose Origin is not listed), `dailyMax: "none"` on a GET-only route, a
|
|
106
|
+
// listener message naming the one automation that hears it (`automationId`), and a held wake named on the dispatch
|
|
107
|
+
// stream with the conversation it will run in (`heldWake`). Additive: a manifest, a trigger or a message without them is
|
|
108
|
+
// unchanged, and `fakeExtensionApi` models `publish`. The recorded surface grows the manifest schema and the wire's
|
|
109
|
+
// listener protocol and automations schemas. The contract's `message-limits` subpath is frozen: nothing reads it but the
|
|
110
|
+
// approvals inbox facing an older daemon, and it leaves at 3.0.0.
|
|
111
|
+
// 2.55.0 (2026-11-26) tells an extension's agent tools what the turn calling them holds, and lets them act within it, each
|
|
112
|
+
// a power the manifest declares under `permissions.turn` and the daemon refuses undeclared. A call's `ToolCallContext`
|
|
113
|
+
// carries the turn's `grants` (the sandbox browser accounts it holds, each with the sites it signs in on; the owner's own
|
|
114
|
+
// browsers it holds; the cards of the extension's own kinds it holds) and a `ticket` the daemon minted for that call.
|
|
115
|
+
// `api.browser.call(context, { account, tool, args })` drives the turn's own signed-in browser for an account it holds,
|
|
116
|
+
// through the router and guards the agent's `browser` tools use, held to the page's own tools and the account's own
|
|
117
|
+
// sites (`browser`); `api.ownerBrowser.call(context, { browser, tool, args })` calls the owner's browser the turn holds
|
|
118
|
+
// through its peer door (`owner-browser`); and `api.jobs.start(context, spec)` files a background job in the calling
|
|
119
|
+
// conversation, in a lane of the extension's own, whose work runs in the backend while the agent collects it with `wait`
|
|
120
|
+
// and a turn that ended on it is woken by its end (`jobs`). Credentials never reach the extension, and anything the turn
|
|
121
|
+
// does not hold is refused. Additive: a manifest without `permissions.turn` and a tool that reads neither field are
|
|
122
|
+
// unchanged, and `fakeExtensionApi` models the grants, the ticket, the three calls (`browser`, `ownerBrowser`) and the jobs
|
|
123
|
+
// (`jobs`). The recorded surface grows `serverApi` and the manifest schema.
|
|
124
|
+
// 2.56.0 (2026-11-26) lets a backend hear CI and write the activity feed, what main's fix agent needed to leave the daemon
|
|
125
|
+
// for the pipelines extension. `permissions.events` takes `ci`, and `api.events.onCi(listener)` hears each frame of the
|
|
126
|
+
// CI feed as the core's ingestion hears it from a forge (a run that finished, a job that ended, a failed job's frame
|
|
127
|
+
// carrying what the forge said of it, `failed`), one frame a batch and an empty batch after a gap in the stream, as the
|
|
128
|
+
// workspace's kinds are told. `api.activity.append(row)` writes a row in the sandbox's activity feed as the extension's
|
|
129
|
+
// own, through a door every extension token reaches undeclared (`POST /extension/activity`). Additive: a manifest that
|
|
130
|
+
// declares neither is unchanged, and `fakeExtensionApi` emits `ci` frames and keeps the rows (`activities`). The recorded
|
|
131
|
+
// surface grows `serverApi`, the manifest schema and the wire's CI schemas (the feed's `failed` detail, the forge reads
|
|
132
|
+
// a backend asks of the core, main's repair state as it is handed over), and drops the contract routes main's fix agent
|
|
133
|
+
// answered from the daemon (`GET /ci/main`, `POST /ci/failures/forget`, `POST /ci/fix`), which its backend answers now.
|
|
134
|
+
// 2.57.0 (2026-11-27) lets an extension hear what arrives while a sandbox the platform hosts sleeps. A public route may
|
|
135
|
+
// declare `wakes: true` (its only `*` an automation's), a power the owner approves of its own: a call to it at the URL
|
|
136
|
+
// `api.sleep.wakeUrl(route, { automationId })` hands out (its wake secret in `?wake=`, the same URL across restarts, to
|
|
137
|
+
// paste into a provider's webhook setting) wakes the sleeping machine while an automation on the extension's listener
|
|
138
|
+
// provider is on, its sender answered 503 with `Retry-After` until it boots. `api.sleep.beforeSleep(handler)` runs right
|
|
139
|
+
// before a hosted sleep under one shared deadline of about ten seconds, and `api.sleep.boot()` says whether the last stop
|
|
140
|
+
// was such a sleep and whether a request at a wake door started this boot. The backend and every declared process get
|
|
141
|
+
// `api.sleep`, through four doors every extension token reaches undeclared (`/extension/sleep/...`). Additive: a manifest
|
|
142
|
+
// or a backend that uses none of it is unchanged, and `fakeExtensionApi` models it (`sleep`). The recorded surface grows
|
|
143
|
+
// `serverApi`, the manifest schema and the wire's extension protocol.
|
|
144
|
+
// 2.58.0 (2026-11-27) lets a card name the one credential Intentic's servers may hold while a hosted sandbox sleeps, for a
|
|
145
|
+
// service that delivers only over a live connection (Discord's gateway). A cli card declares `sleepWatch` (the service,
|
|
146
|
+
// its secret field, and a consent switch), and a field may declare `hosted: true`, drawn only on a sandbox Intentic hosts;
|
|
147
|
+
// a consent must be such a switch, off by default. Right before a hosted sleep the daemon hands the platform the
|
|
148
|
+
// credential of each connection whose owner turned the switch on while an automation listens on the card's provider;
|
|
149
|
+
// the platform notes where each message for the bot is and wakes the sandbox, and deletes the credential when it wakes.
|
|
150
|
+
// `api.sleep.heard()` answers those notes for the extension's own connections, once. A processor path may sit under a
|
|
151
|
+
// `when` over the card's answers. Additive: a manifest that declares none of it is unchanged, and `fakeExtensionApi`
|
|
152
|
+
// models `heard` (`sleep.heard`). The recorded surface grows the manifest schema.
|
|
153
|
+
export const extensionApiVersion = "2.58.0";
|
package/src/wire.ts
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
// THE SLICE OF THE WIRE CONTRACT AN EXTENSION MAY READ. @intentic/sandbox-contract is versioned with the product release
|
|
2
|
+
// (1.3xx), so an extension that takes `^1.x` of it would meet a reshaped schema with nothing saying so. An extension may
|
|
3
|
+
// import the bare package and these subpaths only, and the extension API versions exactly them: surface.json records,
|
|
4
|
+
// per extensionApiVersion, each one's runtime export names and a digest of every zod schema it exports (`wireExports`),
|
|
5
|
+
// and surface-guard.test.ts fails when they move without a new entry.
|
|
6
|
+
//
|
|
7
|
+
// Held to it: the `_extensions/**` lint override in .oxlintrc.json (_tools/checks/lib/extension-deps.mjs keeps the two
|
|
8
|
+
// in step) and the kit's published `intentic-kit-check`, which reads the list off the newest surface record's
|
|
9
|
+
// `wireExports` so it runs in a standalone extension's typecheck with no build and no network.
|
|
10
|
+
//
|
|
11
|
+
// Taken on 2026-11-23 from what the in-repo `_extensions/*` and the standalone checkouts beside this repository import.
|
|
12
|
+
// A subpath joins with a minor of the extension API; one leaves only in a major.
|
|
13
|
+
export const EXTENSION_WIRE = [
|
|
14
|
+
"@intentic/sandbox-contract",
|
|
15
|
+
"@intentic/sandbox-contract/app-routes",
|
|
16
|
+
"@intentic/sandbox-contract/batch-runs",
|
|
17
|
+
"@intentic/sandbox-contract/capability-env",
|
|
18
|
+
"@intentic/sandbox-contract/chores",
|
|
19
|
+
"@intentic/sandbox-contract/ids/conversation-ids",
|
|
20
|
+
"@intentic/sandbox-contract/message-limits",
|
|
21
|
+
"@intentic/sandbox-contract/models/agent-catalog",
|
|
22
|
+
"@intentic/sandbox-contract/oauth/google-workspace",
|
|
23
|
+
"@intentic/sandbox-contract/policy/capability-env",
|
|
24
|
+
"@intentic/sandbox-contract/policy/command-run",
|
|
25
|
+
"@intentic/sandbox-contract/policy/keyring-origins",
|
|
26
|
+
"@intentic/sandbox-contract/policy/role-capability",
|
|
27
|
+
"@intentic/sandbox-contract/protocol/doors/listener-protocol",
|
|
28
|
+
"@intentic/sandbox-contract/schemas/access-profiles",
|
|
29
|
+
"@intentic/sandbox-contract/schemas/activity",
|
|
30
|
+
"@intentic/sandbox-contract/schemas/agent",
|
|
31
|
+
"@intentic/sandbox-contract/schemas/agents",
|
|
32
|
+
"@intentic/sandbox-contract/schemas/approvals",
|
|
33
|
+
"@intentic/sandbox-contract/schemas/automations",
|
|
34
|
+
"@intentic/sandbox-contract/schemas/ci",
|
|
35
|
+
"@intentic/sandbox-contract/schemas/git/git",
|
|
36
|
+
"@intentic/sandbox-contract/schemas/git/git-history",
|
|
37
|
+
"@intentic/sandbox-contract/schemas/history",
|
|
38
|
+
"@intentic/sandbox-contract/schemas/keyring",
|
|
39
|
+
"@intentic/sandbox-contract/schemas/ports",
|
|
40
|
+
"@intentic/sandbox-contract/schemas/public",
|
|
41
|
+
"@intentic/sandbox-contract/schemas/roles",
|
|
42
|
+
"@intentic/sandbox-contract/schemas/services",
|
|
43
|
+
"@intentic/sandbox-contract/schemas/share",
|
|
44
|
+
"@intentic/sandbox-contract/schemas/shared",
|
|
45
|
+
"@intentic/sandbox-contract/schemas/terminal",
|
|
46
|
+
"@intentic/sandbox-contract/schemas/workspace/workspace-graph",
|
|
47
|
+
"@intentic/sandbox-contract/schemas/workspace/workspace-repos",
|
|
48
|
+
"@intentic/sandbox-contract/session-names",
|
|
49
|
+
"@intentic/sandbox-contract/state/fix-attempt-plan",
|
|
50
|
+
"@intentic/sandbox-contract/state/fix-stance",
|
|
51
|
+
"@intentic/sandbox-contract/time",
|
|
52
|
+
"@intentic/sandbox-contract/workspace-state",
|
|
53
|
+
] as const;
|
|
54
|
+
|
|
55
|
+
export type ExtensionWireSpecifier = (typeof EXTENSION_WIRE)[number];
|
|
56
|
+
|
|
57
|
+
/** Whether an import specifier names the wire contract at all, allowed or not. */
|
|
58
|
+
export const namesWireContract = (specifier: string): boolean =>
|
|
59
|
+
specifier === `@intentic/sandbox-contract` || specifier.startsWith(`@intentic/sandbox-contract/`);
|
|
60
|
+
|
|
61
|
+
const allowed: ReadonlySet<string> = new Set(EXTENSION_WIRE);
|
|
62
|
+
|
|
63
|
+
/** Whether an extension may import `specifier` from the wire contract. */
|
|
64
|
+
export const isExtensionWire = (specifier: string): boolean => allowed.has(specifier);
|