@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.
Files changed (63) hide show
  1. package/README.md +130 -4
  2. package/dist/api.d.ts +1 -0
  3. package/dist/api.d.ts.map +1 -1
  4. package/dist/backend-reach.d.ts +23 -0
  5. package/dist/backend-reach.d.ts.map +1 -0
  6. package/dist/backend-reach.js +241 -0
  7. package/dist/backend-reach.js.map +1 -0
  8. package/dist/index.d.ts +1 -0
  9. package/dist/index.d.ts.map +1 -1
  10. package/dist/index.js +1 -0
  11. package/dist/index.js.map +1 -1
  12. package/dist/runtime.d.ts +12 -2
  13. package/dist/runtime.d.ts.map +1 -1
  14. package/dist/runtime.js +110 -132
  15. package/dist/runtime.js.map +1 -1
  16. package/dist/server-reach.d.ts +58 -0
  17. package/dist/server-reach.d.ts.map +1 -0
  18. package/dist/server-reach.js +2 -0
  19. package/dist/server-reach.js.map +1 -0
  20. package/dist/server.d.ts +186 -1
  21. package/dist/server.d.ts.map +1 -1
  22. package/dist/sleep-fake.d.ts +15 -0
  23. package/dist/sleep-fake.d.ts.map +1 -0
  24. package/dist/sleep-fake.js +99 -0
  25. package/dist/sleep-fake.js.map +1 -0
  26. package/dist/sleep-reach.d.ts +7 -0
  27. package/dist/sleep-reach.d.ts.map +1 -0
  28. package/dist/sleep-reach.js +104 -0
  29. package/dist/sleep-reach.js.map +1 -0
  30. package/dist/testing.d.ts +64 -9
  31. package/dist/testing.d.ts.map +1 -1
  32. package/dist/testing.js +322 -13
  33. package/dist/testing.js.map +1 -1
  34. package/dist/turn-reach.d.ts +7 -0
  35. package/dist/turn-reach.d.ts.map +1 -0
  36. package/dist/turn-reach.js +140 -0
  37. package/dist/turn-reach.js.map +1 -0
  38. package/dist/version.d.ts +1 -1
  39. package/dist/version.d.ts.map +1 -1
  40. package/dist/version.js +1 -1
  41. package/dist/version.js.map +1 -1
  42. package/dist/wire.d.ts +5 -0
  43. package/dist/wire.d.ts.map +1 -0
  44. package/dist/wire.js +45 -0
  45. package/dist/wire.js.map +1 -0
  46. package/package.json +15 -4
  47. package/src/api.ts +3 -0
  48. package/src/backend-reach.integration.test.ts +154 -0
  49. package/src/backend-reach.ts +335 -0
  50. package/src/caller.integration.test.ts +108 -0
  51. package/src/index.ts +1 -0
  52. package/src/runtime.ts +184 -157
  53. package/src/server-reach.ts +104 -0
  54. package/src/server.ts +364 -3
  55. package/src/sleep-fake.ts +140 -0
  56. package/src/sleep-reach.integration.test.ts +119 -0
  57. package/src/sleep-reach.ts +147 -0
  58. package/src/surface.json +18932 -1
  59. package/src/testing.ts +506 -23
  60. package/src/turn-reach.integration.test.ts +166 -0
  61. package/src/turn-reach.ts +198 -0
  62. package/src/version.ts +121 -1
  63. package/src/wire.ts +64 -0
@@ -0,0 +1,140 @@
1
+ import { errorMessage } from "@intentic/base/errors";
2
+ import { parseJsonWith } from "@intentic/base/json";
3
+ import { extensionBrowserUrl, ExtensionJobFrameSchema, extensionJobsUrl, extensionJobUrl, extensionOwnerBrowserUrl, ExtensionToolContentSchema, ExtensionTurnCallAnswerSchema, ExtensionTurnRefusalSchema, NO_TOOL_GRANTS, } from "@intentic/sandbox-contract/extension-protocol";
4
+ const NO_TICKET = "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)";
5
+ const refusalOf = async (answer) => {
6
+ const text = await answer.text();
7
+ return parseJsonWith(text, ExtensionTurnRefusalSchema)?.error ?? text.split("\n")[0]?.slice(0, 300) ?? `${answer.status}`;
8
+ };
9
+ const toolResultOf = (raw) => {
10
+ const content = raw.content.flatMap((block) => {
11
+ const read = ExtensionToolContentSchema.safeParse(block);
12
+ return read.success ? [read.data] : [];
13
+ });
14
+ return raw.isError === true ? { content, isError: true } : { content };
15
+ };
16
+ export const createTurnReach = (id, request, declared, log) => {
17
+ const ticketFor = (power, standing) => {
18
+ if (!declared.includes(power)) {
19
+ throw new Error(`extension "${id}" did not declare "${power}" in permissions.turn: add it to its manifest`);
20
+ }
21
+ if (standing.ticket === undefined || standing.ticket === "") {
22
+ throw new Error(NO_TICKET);
23
+ }
24
+ return standing.ticket;
25
+ };
26
+ const post = (path, body, signal) => {
27
+ const init = { method: "POST", headers: { "content-type": "application/json" }, body: JSON.stringify(body) };
28
+ if (signal !== undefined) {
29
+ init.signal = signal;
30
+ }
31
+ return request(path, init);
32
+ };
33
+ const callTurn = async (path, body, signal) => {
34
+ const answer = await post(path, body, signal);
35
+ if (!answer.ok) {
36
+ throw new Error(`the sandbox refused (${answer.status}): ${await refusalOf(answer)}`);
37
+ }
38
+ return toolResultOf(ExtensionTurnCallAnswerSchema.parse(await answer.json()).result);
39
+ };
40
+ return {
41
+ browser: {
42
+ call: async (standing, call) => await callTurn(extensionBrowserUrl(), { turn: ticketFor("browser", standing), account: call.account, tool: call.tool, arguments: call.args ?? {} }, standing.signal),
43
+ },
44
+ ownerBrowser: {
45
+ call: async (standing, call) => await callTurn(extensionOwnerBrowserUrl(), { turn: ticketFor("owner-browser", standing), browser: call.browser, tool: call.tool, arguments: call.args ?? {} }, standing.signal),
46
+ },
47
+ jobs: {
48
+ start: async (standing, spec) => await startJob({ id, post, log }, ticketFor("jobs", standing), standing, spec),
49
+ },
50
+ };
51
+ };
52
+ async function* framesOf(body) {
53
+ const reader = body.getReader();
54
+ const decoder = new TextDecoder();
55
+ let buffer = "";
56
+ for (let chunk = await reader.read(); !chunk.done; chunk = await reader.read()) {
57
+ const parts = (buffer + decoder.decode(chunk.value, { stream: true })).split("\n");
58
+ buffer = parts.pop() ?? "";
59
+ for (const line of parts) {
60
+ const frame = line.trim() === "" ? undefined : parseJsonWith(line, ExtensionJobFrameSchema);
61
+ if (frame !== undefined) {
62
+ yield frame;
63
+ }
64
+ }
65
+ }
66
+ }
67
+ const runWork = async (deps, filed, job, spec) => {
68
+ let end;
69
+ try {
70
+ end = await spec.run(job);
71
+ }
72
+ catch (error) {
73
+ end = { ok: false, output: `The job failed in extension "${deps.id}": ${errorMessage(error)}` };
74
+ }
75
+ await report(deps, filed, { end });
76
+ };
77
+ const report = async (deps, filed, body) => {
78
+ try {
79
+ const answer = await deps.post(extensionJobUrl(filed.id), { job: filed.job, ...body }, undefined);
80
+ if (!answer.ok) {
81
+ deps.log(`job ${filed.id}: the sandbox did not take its ${body.end === undefined ? "line" : "end"} (${answer.status}): ${await refusalOf(answer)}`);
82
+ }
83
+ }
84
+ catch (error) {
85
+ deps.log(`job ${filed.id}: its ${body.end === undefined ? "line" : "end"} did not reach the sandbox: ${errorMessage(error)}`);
86
+ }
87
+ };
88
+ const startJob = async (deps, ticket, standing, spec) => {
89
+ const asked = { turn: ticket, command: spec.command, description: spec.description, started: spec.started };
90
+ if (spec.lane !== undefined) {
91
+ asked.lane = { name: spec.lane.name };
92
+ if (spec.lane.key !== undefined) {
93
+ asked.lane.key = spec.lane.key;
94
+ }
95
+ if (spec.lane.most !== undefined) {
96
+ asked.lane.most = spec.lane.most;
97
+ }
98
+ }
99
+ const answer = await deps.post(extensionJobsUrl(), asked, undefined);
100
+ if (!answer.ok || answer.body === null) {
101
+ throw new Error(`the sandbox refused (${answer.status}): ${await refusalOf(answer)}`);
102
+ }
103
+ const frames = framesOf(answer.body);
104
+ const first = await frames.next();
105
+ if (first.done === true || first.value.kind !== "filed") {
106
+ throw new Error("the sandbox did not say the job was filed");
107
+ }
108
+ const filed = first.value;
109
+ const stopped = new AbortController();
110
+ let says = Promise.resolve();
111
+ const job = {
112
+ id: filed.id,
113
+ grants: standing.grants ?? NO_TOOL_GRANTS,
114
+ ticket: filed.job,
115
+ signal: stopped.signal,
116
+ say: (line) => void (says = says.then(() => report(deps, filed, { say: line }))),
117
+ };
118
+ void (async () => {
119
+ let work;
120
+ try {
121
+ for await (const frame of frames) {
122
+ if (frame.kind === "begin") {
123
+ work = says.then(() => runWork(deps, filed, job, spec));
124
+ }
125
+ if (frame.kind === "stopped") {
126
+ stopped.abort();
127
+ }
128
+ }
129
+ }
130
+ catch (error) {
131
+ deps.log(`job ${filed.id}: its stream from the sandbox broke: ${errorMessage(error)}`);
132
+ }
133
+ finally {
134
+ stopped.abort();
135
+ await work;
136
+ }
137
+ })();
138
+ return { id: filed.id, ahead: filed.ahead };
139
+ };
140
+ //# sourceMappingURL=turn-reach.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"turn-reach.js","sourceRoot":"","sources":["../src/turn-reach.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD,OAAO,EAEH,mBAAmB,EAEnB,uBAAuB,EAGvB,gBAAgB,EAChB,eAAe,EAEf,wBAAwB,EACxB,0BAA0B,EAC1B,6BAA6B,EAC7B,0BAA0B,EAC1B,cAAc,GACjB,MAAM,+CAA+C,CAAC;AAWvD,MAAM,SAAS,GACX,wJAAwJ,CAAC;AAM7J,MAAM,SAAS,GAAG,KAAK,EAAE,MAAgB,EAAmB,EAAE;IAC1D,MAAM,IAAI,GAAG,MAAM,MAAM,CAAC,IAAI,EAAE,CAAC;IACjC,OAAO,aAAa,CAAC,IAAI,EAAE,0BAA0B,CAAC,EAAE,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,IAAI,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC;AAC9H,CAAC,CAAC;AAGF,MAAM,YAAY,GAAG,CAAC,GAAqF,EAAc,EAAE;IACvH,MAAM,OAAO,GAAkB,GAAG,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE;QACzD,MAAM,IAAI,GAAG,0BAA0B,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;QACzD,OAAO,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CA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AAC,EAAE,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,CAAC;AAChD,CAAC,CAAC"}
package/dist/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const extensionApiVersion = "2.43.0";
1
+ export declare const extensionApiVersion = "2.58.0";
2
2
  //# sourceMappingURL=version.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAgCA,eAAO,MAAM,mBAAmB,WAAW,CAAC"}
1
+ {"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAwJA,eAAO,MAAM,mBAAmB,WAAW,CAAC"}
package/dist/version.js CHANGED
@@ -1,2 +1,2 @@
1
- export const extensionApiVersion = "2.43.0";
1
+ export const extensionApiVersion = "2.58.0";
2
2
  //# sourceMappingURL=version.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAgCA,MAAM,CAAC,MAAM,mBAAmB,GAAG,QAAQ,CAAC"}
1
+ {"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAwJA,MAAM,CAAC,MAAM,mBAAmB,GAAG,QAAQ,CAAC"}
package/dist/wire.d.ts ADDED
@@ -0,0 +1,5 @@
1
+ export declare const EXTENSION_WIRE: readonly ["@intentic/sandbox-contract", "@intentic/sandbox-contract/app-routes", "@intentic/sandbox-contract/batch-runs", "@intentic/sandbox-contract/capability-env", "@intentic/sandbox-contract/chores", "@intentic/sandbox-contract/ids/conversation-ids", "@intentic/sandbox-contract/message-limits", "@intentic/sandbox-contract/models/agent-catalog", "@intentic/sandbox-contract/oauth/google-workspace", "@intentic/sandbox-contract/policy/capability-env", "@intentic/sandbox-contract/policy/command-run", "@intentic/sandbox-contract/policy/keyring-origins", "@intentic/sandbox-contract/policy/role-capability", "@intentic/sandbox-contract/protocol/doors/listener-protocol", "@intentic/sandbox-contract/schemas/access-profiles", "@intentic/sandbox-contract/schemas/activity", "@intentic/sandbox-contract/schemas/agent", "@intentic/sandbox-contract/schemas/agents", "@intentic/sandbox-contract/schemas/approvals", "@intentic/sandbox-contract/schemas/automations", "@intentic/sandbox-contract/schemas/ci", "@intentic/sandbox-contract/schemas/git/git", "@intentic/sandbox-contract/schemas/git/git-history", "@intentic/sandbox-contract/schemas/history", "@intentic/sandbox-contract/schemas/keyring", "@intentic/sandbox-contract/schemas/ports", "@intentic/sandbox-contract/schemas/public", "@intentic/sandbox-contract/schemas/roles", "@intentic/sandbox-contract/schemas/services", "@intentic/sandbox-contract/schemas/share", "@intentic/sandbox-contract/schemas/shared", "@intentic/sandbox-contract/schemas/terminal", "@intentic/sandbox-contract/schemas/workspace/workspace-graph", "@intentic/sandbox-contract/schemas/workspace/workspace-repos", "@intentic/sandbox-contract/session-names", "@intentic/sandbox-contract/state/fix-attempt-plan", "@intentic/sandbox-contract/state/fix-stance", "@intentic/sandbox-contract/time", "@intentic/sandbox-contract/workspace-state"];
2
+ export type ExtensionWireSpecifier = (typeof EXTENSION_WIRE)[number];
3
+ export declare const namesWireContract: (specifier: string) => boolean;
4
+ export declare const isExtensionWire: (specifier: string) => boolean;
5
+ //# sourceMappingURL=wire.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wire.d.ts","sourceRoot":"","sources":["../src/wire.ts"],"names":[],"mappings":"AAYA,eAAO,MAAM,cAAc,YACvB,4BAA4B,EAC5B,uCAAuC,EACvC,uCAAuC,EACvC,2CAA2C,EAC3C,mCAAmC,EACnC,iDAAiD,EACjD,2CAA2C,EAC3C,iDAAiD,EACjD,mDAAmD,EACnD,kDAAkD,EAClD,+CAA+C,EAC/C,mDAAmD,EACnD,mDAAmD,EACnD,6DAA6D,EAC7D,oDAAoD,EACpD,6CAA6C,EAC7C,0CAA0C,EAC1C,2CAA2C,EAC3C,8CAA8C,EAC9C,gDAAgD,EAChD,uCAAuC,EACvC,4CAA4C,EAC5C,oDAAoD,EACpD,4CAA4C,EAC5C,4CAA4C,EAC5C,0CAA0C,EAC1C,2CAA2C,EAC3C,0CAA0C,EAC1C,6CAA6C,EAC7C,0CAA0C,EAC1C,2CAA2C,EAC3C,6CAA6C,EAC7C,8DAA8D,EAC9D,8DAA8D,EAC9D,0CAA0C,EAC1C,mDAAmD,EACnD,6CAA6C,EAC7C,iCAAiC,EACjC,4CAA4C,CACtC,CAAC;AAEX,MAAM,MAAM,sBAAsB,GAAG,CAAC,OAAO,cAAc,CAAC,CAAC,MAAM,CAAC,CAAC;AAGrE,eAAO,MAAM,iBAAiB,cAAe,MAAM,KAAG,OAC+C,CAAC;AAKtG,eAAO,MAAM,eAAe,cAAe,MAAM,KAAG,OAAiC,CAAC"}
package/dist/wire.js ADDED
@@ -0,0 +1,45 @@
1
+ export const EXTENSION_WIRE = [
2
+ "@intentic/sandbox-contract",
3
+ "@intentic/sandbox-contract/app-routes",
4
+ "@intentic/sandbox-contract/batch-runs",
5
+ "@intentic/sandbox-contract/capability-env",
6
+ "@intentic/sandbox-contract/chores",
7
+ "@intentic/sandbox-contract/ids/conversation-ids",
8
+ "@intentic/sandbox-contract/message-limits",
9
+ "@intentic/sandbox-contract/models/agent-catalog",
10
+ "@intentic/sandbox-contract/oauth/google-workspace",
11
+ "@intentic/sandbox-contract/policy/capability-env",
12
+ "@intentic/sandbox-contract/policy/command-run",
13
+ "@intentic/sandbox-contract/policy/keyring-origins",
14
+ "@intentic/sandbox-contract/policy/role-capability",
15
+ "@intentic/sandbox-contract/protocol/doors/listener-protocol",
16
+ "@intentic/sandbox-contract/schemas/access-profiles",
17
+ "@intentic/sandbox-contract/schemas/activity",
18
+ "@intentic/sandbox-contract/schemas/agent",
19
+ "@intentic/sandbox-contract/schemas/agents",
20
+ "@intentic/sandbox-contract/schemas/approvals",
21
+ "@intentic/sandbox-contract/schemas/automations",
22
+ "@intentic/sandbox-contract/schemas/ci",
23
+ "@intentic/sandbox-contract/schemas/git/git",
24
+ "@intentic/sandbox-contract/schemas/git/git-history",
25
+ "@intentic/sandbox-contract/schemas/history",
26
+ "@intentic/sandbox-contract/schemas/keyring",
27
+ "@intentic/sandbox-contract/schemas/ports",
28
+ "@intentic/sandbox-contract/schemas/public",
29
+ "@intentic/sandbox-contract/schemas/roles",
30
+ "@intentic/sandbox-contract/schemas/services",
31
+ "@intentic/sandbox-contract/schemas/share",
32
+ "@intentic/sandbox-contract/schemas/shared",
33
+ "@intentic/sandbox-contract/schemas/terminal",
34
+ "@intentic/sandbox-contract/schemas/workspace/workspace-graph",
35
+ "@intentic/sandbox-contract/schemas/workspace/workspace-repos",
36
+ "@intentic/sandbox-contract/session-names",
37
+ "@intentic/sandbox-contract/state/fix-attempt-plan",
38
+ "@intentic/sandbox-contract/state/fix-stance",
39
+ "@intentic/sandbox-contract/time",
40
+ "@intentic/sandbox-contract/workspace-state",
41
+ ];
42
+ export const namesWireContract = (specifier) => specifier === `@intentic/sandbox-contract` || specifier.startsWith(`@intentic/sandbox-contract/`);
43
+ const allowed = new Set(EXTENSION_WIRE);
44
+ export const isExtensionWire = (specifier) => allowed.has(specifier);
45
+ //# sourceMappingURL=wire.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wire.js","sourceRoot":"","sources":["../src/wire.ts"],"names":[],"mappings":"AAYA,MAAM,CAAC,MAAM,cAAc,GAAG;IAC1B,4BAA4B;IAC5B,uCAAuC;IACvC,uCAAuC;IACvC,2CAA2C;IAC3C,mCAAmC;IACnC,iDAAiD;IACjD,2CAA2C;IAC3C,iDAAiD;IACjD,mDAAmD;IACnD,kDAAkD;IAClD,+CAA+C;IAC/C,mDAAmD;IACnD,mDAAmD;IACnD,6DAA6D;IAC7D,oDAAoD;IACpD,6CAA6C;IAC7C,0CAA0C;IAC1C,2CAA2C;IAC3C,8CAA8C;IAC9C,gDAAgD;IAChD,uCAAuC;IACvC,4CAA4C;IAC5C,oDAAoD;IACpD,4CAA4C;IAC5C,4CAA4C;IAC5C,0CAA0C;IAC1C,2CAA2C;IAC3C,0CAA0C;IAC1C,6CAA6C;IAC7C,0CAA0C;IAC1C,2CAA2C;IAC3C,6CAA6C;IAC7C,8DAA8D;IAC9D,8DAA8D;IAC9D,0CAA0C;IAC1C,mDAAmD;IACnD,6CAA6C;IAC7C,iCAAiC;IACjC,4CAA4C;CACtC,CAAC;AAKX,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,SAAiB,EAAW,EAAE,CAC5D,SAAS,KAAK,4BAA4B,IAAI,SAAS,CAAC,UAAU,CAAC,6BAA6B,CAAC,CAAC;AAEtG,MAAM,OAAO,GAAwB,IAAI,GAAG,CAAC,cAAc,CAAC,CAAC;AAG7D,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,SAAiB,EAAW,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@intentic/extension-api",
3
- "version": "1.430.0",
3
+ "version": "1.432.0",
4
4
  "description": "The versioned public API intentic extensions compile against, manifest schema, detection facts and the host API",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -62,12 +62,23 @@
62
62
  "default": "./dist/testing.js"
63
63
  }
64
64
  },
65
+ "./wire": {
66
+ "types": "./dist/wire.d.ts",
67
+ "import": {
68
+ "@intentic/src": "./src/wire.ts",
69
+ "default": "./dist/wire.js"
70
+ },
71
+ "require": {
72
+ "@intentic/src": "./src/wire.ts",
73
+ "default": "./dist/wire.js"
74
+ }
75
+ },
65
76
  "./surface.json": "./src/surface.json"
66
77
  },
67
78
  "dependencies": {
68
- "@intentic/base": "1.430.0",
69
- "@intentic/extension-manifest": "1.430.0",
70
- "@intentic/sandbox-contract": "1.430.0",
79
+ "@intentic/base": "1.432.0",
80
+ "@intentic/extension-manifest": "1.432.0",
81
+ "@intentic/sandbox-contract": "1.432.0",
71
82
  "@orpc/client": "1.16.1",
72
83
  "@orpc/contract": "1.16.1",
73
84
  "@orpc/openapi-client": "1.16.1"
package/src/api.ts CHANGED
@@ -333,6 +333,9 @@ export interface IntenticApi {
333
333
  // This extension's own backend (`server`), by a path relative to its namespace: the host adds the routing prefix,
334
334
  // which is the extension's install id and not always `publisher.name`, so no extension spells `/x/<id>` itself.
335
335
  readonly backend: {
336
+ /** Whether the daemon's installed manifest declares a server, as the host heard it last: read again at each access, so it
337
+ * follows a daemon rebuilt under an open view. Unknown on older hosts or without an inventory. */
338
+ readonly available?: boolean | undefined;
336
339
  request(path: string, init?: RequestInit): Promise<Response>;
337
340
  json<T>(path: string, init?: RequestInit): Promise<T>;
338
341
  };
@@ -0,0 +1,154 @@
1
+ import { mkdtemp, rm } from "node:fs/promises";
2
+ import { tmpdir } from "node:os";
3
+ import { join } from "node:path";
4
+ import { waitFor } from "@intentic/testing/bun";
5
+ import { connectExtensionProcess } from "./runtime.js";
6
+ import type { AutomationFire } from "./server.js";
7
+ import type { RunSettled, SandboxActivity } from "./server-reach.js";
8
+ import { type FakeExtension, type FakeManifest, fakeExtensionApi } from "./testing.js";
9
+
10
+ // What a backend hears, holds, runs and is woken by beyond its routes (backend-reach.ts, runtime.ts), each declared under
11
+ // its manifest's `permissions`: driven through the SDK's own fake daemon, which refuses what the manifest does not
12
+ // declare as the daemon does (extensions/runtime/own.routes.ts, own-doors.ts in the sandbox).
13
+
14
+ const opened: FakeExtension[] = [];
15
+ const fake = async (options: Parameters<typeof fakeExtensionApi>[0]): Promise<FakeExtension> => {
16
+ const made = await fakeExtensionApi(options);
17
+ opened.push(made);
18
+ return made;
19
+ };
20
+ afterEach(async () => {
21
+ await Promise.all(opened.splice(0).map((each) => each.dispose()));
22
+ });
23
+
24
+ const declaring = (permissions: NonNullable<FakeManifest["permissions"]>): FakeManifest => ({ publisher: "acme", name: "maintenance", permissions });
25
+ const bare = declaring({});
26
+
27
+ describe("api.events", () => {
28
+ test("its own conversations' runs and the sandbox's activity arrive as the daemon frames them", async () => {
29
+ const extension = await fake({ manifest: declaring({ events: ["run", "activity"] }) });
30
+ const runs: RunSettled[] = [];
31
+ const activity: SandboxActivity[] = [];
32
+ extension.api.events.onRunSettled((run) => runs.push(run));
33
+ extension.api.events.onActivity((now) => activity.push(now));
34
+ extension.emit({ kind: "activity", live: true });
35
+ extension.emit({ kind: "run", conversationId: "fix-main-1", run: "r1", outcome: "failed", error: "spent", closing: "I could not finish." });
36
+ extension.emit({ kind: "activity", live: false });
37
+ await waitFor(() => expect(activity).toHaveLength(2));
38
+ expect(activity).toEqual([{ live: true }, { live: false }]);
39
+ expect(runs).toEqual([{ conversationId: "fix-main-1", run: "r1", outcome: "failed", error: "spent", closing: "I could not finish." }]);
40
+ // The stream asked for the kinds the manifest declares, and the daemon admitted it.
41
+ expect(extension.calls).toEqual([{ line: "GET /extension/events", admitted: true }]);
42
+ });
43
+
44
+ test("a listener of a kind the manifest does not declare is refused before anything is sent", async () => {
45
+ const extension = await fake({ manifest: declaring({ events: ["run"] }) });
46
+ expect(() => extension.api.events.onActivity(() => undefined)).toThrow(
47
+ `extension "acme.maintenance" listened for the sandbox's activity (\`activity\`) without declaring it: declare it in permissions.events in its manifest`,
48
+ );
49
+ expect(extension.calls).toEqual([]);
50
+ });
51
+
52
+ test("the daemon refuses a stream asking for a kind the manifest does not declare", async () => {
53
+ const extension = await fake({ manifest: declaring({ events: ["run"] }) });
54
+ expect((await extension.api.daemon.request("/extension/events?kinds=activity")).status).toBe(403);
55
+ const asked = await extension.api.daemon.request("/extension/events?kinds=run");
56
+ expect(asked.status).toBe(200);
57
+ await asked.body?.cancel();
58
+ });
59
+ });
60
+
61
+ describe("api.work.hold", () => {
62
+ test("a hold stands while it is held and goes when it is let go", async () => {
63
+ const extension = await fake({ manifest: declaring({ work: true }) });
64
+ const held = extension.api.work.hold("code-health probes");
65
+ await waitFor(() => expect(extension.holds).toEqual(["code-health probes"]));
66
+ held.dispose();
67
+ await waitFor(() => expect(extension.holds).toEqual([]));
68
+ });
69
+
70
+ test("holding without declaring `work` throws, naming the field", async () => {
71
+ const extension = await fake({ manifest: bare });
72
+ expect(() => extension.api.work.hold("anything")).toThrow(/declare it in permissions\.work in its manifest/);
73
+ expect(extension.holds).toEqual([]);
74
+ });
75
+ });
76
+
77
+ describe("api.exec", () => {
78
+ test("a declared class runs, and the daemon's answer comes back as it was given", async () => {
79
+ const extension = await fake({
80
+ manifest: declaring({ exec: ["toolchain"] }),
81
+ exec: (command) => ({ waitedMs: 12, exitCode: 1, stdout: `ran ${command.argv.join(" ")}`, stderr: "1 finding", truncated: false }),
82
+ });
83
+ const result = await extension.api.exec(["knip", "--reporter", "json"], { class: "toolchain", cwd: "intentic", timeoutMs: 60_000, label: "knip" });
84
+ expect(result).toEqual({ waitedMs: 12, exitCode: 1, stdout: "ran knip --reporter json", stderr: "1 finding", truncated: false });
85
+ expect(extension.execs).toEqual([
86
+ { argv: ["knip", "--reporter", "json"], class: "toolchain", cwd: "intentic", timeoutMs: 60_000, outputBytes: 1024 * 1024, label: "knip" },
87
+ ]);
88
+ });
89
+
90
+ test("a class the manifest does not declare is refused before anything is sent", async () => {
91
+ const extension = await fake({ manifest: declaring({ exec: ["toolchain"] }) });
92
+ await expect(extension.api.exec(["ls"])).rejects.toThrow(`extension "acme.maintenance" ran a command in the command class without declaring it`);
93
+ expect(extension.execs).toEqual([]);
94
+ });
95
+
96
+ test("the daemon refuses a class the manifest does not declare, asked by hand", async () => {
97
+ const extension = await fake({ manifest: declaring({ exec: ["command"] }) });
98
+ const body = JSON.stringify({ argv: ["tsc"], class: "toolchain", timeoutMs: 1_000, outputBytes: 1_000 });
99
+ expect((await extension.api.daemon.request("/extension/exec", { method: "POST", body })).status).toBe(403);
100
+ });
101
+ });
102
+
103
+ describe("api.automations.onFire", () => {
104
+ test("a declared handler is handed its fire, and lets go of its name when disposed", async () => {
105
+ const extension = await fake({ manifest: declaring({ fires: ["sweep"] }) });
106
+ const fired: AutomationFire[] = [];
107
+ const registered = extension.api.automations.onFire("sweep", (fire) => {
108
+ fired.push(fire);
109
+ });
110
+ await extension.fire("sweep", { id: "f1", automationId: "maintenance-sweep", firedAt: 1_000, coalesced: 3, prompt: "Sweep the probes." });
111
+ expect(fired).toEqual([
112
+ { id: "f1", automationId: "maintenance-sweep", handler: "sweep", firedAt: 1_000, coalesced: 3, prompt: "Sweep the probes.", payload: undefined, observed: undefined },
113
+ ]);
114
+ registered.dispose();
115
+ await expect(extension.fire("sweep")).rejects.toThrow(`"acme.maintenance" has registered no "sweep" fire handler`);
116
+ });
117
+
118
+ test("registering a handler the manifest does not declare throws, naming the field", async () => {
119
+ const extension = await fake({ manifest: declaring({ fires: ["sweep"] }) });
120
+ expect(() => extension.api.automations.onFire("nightly", () => undefined)).toThrow(
121
+ `extension "acme.maintenance" registered the fire handler "nightly" without declaring it: declare it in permissions.fires in its manifest`,
122
+ );
123
+ });
124
+ });
125
+
126
+ test("a process reads its declared reach from the environment the daemon started it with", async () => {
127
+ const root = await mkdtemp(join(tmpdir(), "process-declared-"));
128
+ const env = {
129
+ INTENTIC_EXTENSION_ID: "acme.maintenance",
130
+ INTENTIC_DAEMON: "http://127.0.0.1:1",
131
+ INTENTIC_EXTENSION_TOKEN: "t",
132
+ INTENTIC_WORKSPACE: root,
133
+ INTENTIC_EXTENSION_STATE: root,
134
+ INTENTIC_EXTENSION_CACHE: root,
135
+ };
136
+ try {
137
+ const undeclared = connectExtensionProcess(env);
138
+ expect(() => undeclared.api.work.hold("probes")).toThrow(/permissions\.work/);
139
+ undeclared.close();
140
+ const declared = connectExtensionProcess({
141
+ ...env,
142
+ INTENTIC_EXTENSION_DECLARED: JSON.stringify({ events: ["activity"], work: true, exec: ["toolchain"], fires: [] }),
143
+ });
144
+ const held = declared.api.work.hold("probes");
145
+ held.dispose();
146
+ expect(() => declared.api.events.onActivity(() => undefined).dispose()).not.toThrow();
147
+ declared.close();
148
+ expect(() => connectExtensionProcess({ ...env, INTENTIC_EXTENSION_DECLARED: JSON.stringify({ events: ["ci"] }) })).toThrow(
149
+ "INTENTIC_EXTENSION_DECLARED is not the JSON of a declared reach",
150
+ );
151
+ } finally {
152
+ await rm(root, { recursive: true, force: true });
153
+ }
154
+ });