@intentic/extension-manifest 1.408.1 → 1.409.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@intentic/extension-manifest",
3
- "version": "1.408.1",
3
+ "version": "1.409.0",
4
4
  "description": "What an intentic extension DECLARES, the intentic-extension.json schema and the sandbox-route allowlist rule",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -43,7 +43,7 @@
43
43
  }
44
44
  },
45
45
  "dependencies": {
46
- "@intentic/base": "1.408.1",
46
+ "@intentic/base": "1.409.0",
47
47
  "zod": "4.6.7"
48
48
  },
49
49
  "devDependencies": {
@@ -3,6 +3,7 @@ import { z } from "zod";
3
3
  import type { ContributionPoint } from "../contribution-point.js";
4
4
  import { TOOL_PATH } from "./tools.js";
5
5
  import { MARK_FIELDS } from "../mark.js";
6
+ import { ConnectionRefSchema, ConnectProbeSchema, KeyRequestSchema } from "./capability-field-shapes.js";
6
7
  import { type EffectMeaning, fieldMeanings, unwrapMeaning } from "../meaning.js";
7
8
 
8
9
  // A field the install dialog's config form renders (key, label, secret/optional flags, a select, a `when` gate);
@@ -73,6 +74,25 @@ export const CapabilityFieldSchema = z.object({
73
74
  .describe(
74
75
  "This field holds a TOTP seed, the base32 key or otpauth:// URI a service shows when enrolling an authenticator app. Declare it with `secret: true`. Unlike an ordinary secret it never enters the agent's environment: the daemon mints the six-digit codes on demand and only those cross.",
75
76
  ),
77
+ // (2026-11-11) Fields whose answer is not a typed string (capability-field-shapes.ts).
78
+ connection: ConnectionRefSchema.optional(),
79
+ keyValue: z
80
+ .boolean()
81
+ .optional()
82
+ .describe(
83
+ "Render it as rows of a name and a value with add and remove, for a block of `KEY=VALUE` lines (an agent's environment). What is stored is those lines, the same text a `multiline` box holds. With `secret: true` the values are masked.",
84
+ ),
85
+ keyRequest: KeyRequestSchema.optional(),
86
+ // Filled by a sign-in button rather than typed. `google`: the platform's own OAuth client runs the consent and hands
87
+ // the refresh token to the form, and later trades it for access tokens (the client secret never leaves the
88
+ // platform). `microsoft`: the sandbox runs the card's `refreshToken.deviceCode` sign-in. Only on the field the
89
+ // card's `refreshToken` names.
90
+ signIn: z
91
+ .enum(["google", "microsoft"])
92
+ .optional()
93
+ .describe(
94
+ "Fill this field with a sign-in button instead of a text box, and the refresh token lands here for Save to store, with nobody pasting a token. `google`: the platform's own OAuth client runs the consent screen, and the card's CLI trades the token for access tokens through the daemon's `POST /capabilities/{id}/oauth-access`, since the client secret stays on the platform. `microsoft`: the sandbox runs the device-code sign-in the card's `refreshToken.deviceCode` declares, against the card's own app. Only on the secret field the card's `refreshToken` names.",
95
+ ),
76
96
  });
77
97
  export type CapabilityField = z.infer<typeof CapabilityFieldSchema>;
78
98
 
@@ -81,11 +101,18 @@ export type CapabilityField = z.infer<typeof CapabilityFieldSchema>;
81
101
  export const fieldApplies = (field: CapabilityField, values: Readonly<Record<string, unknown>>): boolean =>
82
102
  field.when === undefined || evaluateWhen(parseWhen(field.when), values);
83
103
 
104
+ // A condition over the answers already given, in the field `when`'s grammar.
105
+ const WhenConditionSchema = z.string().refine(isWhenExpression, { message: "not a valid `when` condition" });
106
+
107
+ // The grants a test may trade for its bearer: a delegated sign-in's refresh token, or an app's own secret.
108
+ export const PROBE_GRANTS = ["refresh_token", "client_credentials"] as const;
109
+
84
110
  // One authenticated request the daemon makes on the form's behalf, declared as data since the check is per-service.
85
111
  // Worth declaring on any card whose failure is otherwise silent.
86
112
  const ProbeSchema = z.object({
87
- // A delegated sign-in's card keeps only a refresh token, so its test first trades that for an access token. The
88
- // trade is held in memory for this one request; neither token is stored or shown.
113
+ // A card that keeps a refresh token (a delegated sign-in) or an app's client secret (app-only access) has no bearer
114
+ // of its own, so its test first trades one for an access token. The trade is held in memory for this one request;
115
+ // no token is stored or shown.
89
116
  oauth: z
90
117
  .object({
91
118
  tokenUrl: z
@@ -94,11 +121,16 @@ const ProbeSchema = z.object({
94
121
  .describe("The token endpoint, templated like `url`. Only Microsoft identity platform hosts are served today."),
95
122
  form: z
96
123
  .record(z.string(), z.string())
97
- .describe("The refresh-token grant's form fields, templated like `url`; a field that comes out empty is left out."),
124
+ .refine((form) => PROBE_GRANTS.some((grant) => grant === form["grant_type"]), {
125
+ message: `grant_type must be one of ${PROBE_GRANTS.join(", ")}`,
126
+ })
127
+ .describe(
128
+ "The grant's form fields, templated like `url`; a field that comes out empty is left out. `grant_type` is `refresh_token` (a delegated sign-in: nothing to test until someone has signed in) or `client_credentials` (an app's own secret, with `scope` naming the resource's `.default`).",
129
+ ),
98
130
  })
99
131
  .optional()
100
132
  .describe(
101
- "Trade the card's refresh token for an access token before the request, sent as `Authorization: Bearer`. For Microsoft's identity platform the request goes to the Graph cloud paired with the token endpoint's host, whatever host `url` names.",
133
+ "Trade the card's refresh token, or its app's client secret, for an access token before the request, sent as `Authorization: Bearer`. For Microsoft's identity platform the request goes to the Graph cloud paired with the token endpoint's host, whatever host `url` names.",
102
134
  ),
103
135
  url: z
104
136
  .string()
@@ -114,12 +146,49 @@ const ProbeSchema = z.object({
114
146
  .string()
115
147
  .optional()
116
148
  .describe('A dotted path into the JSON answer naming who the caller is ("login", "user.name"), so success can say which account answered.'),
149
+ // A service that answers every call 200 and says in the body whether it worked (Slack) needs one more read, or a
150
+ // wrong token passes the test.
151
+ ok: z
152
+ .string()
153
+ .optional()
154
+ .describe(
155
+ 'A dotted path into the JSON answer that must hold `true` for the answer to count ("ok"), for a service that answers 200 either way and says in the body whether the call worked. Anything else fails the test, naming the answer\'s `error` code.',
156
+ ),
117
157
  insecure: z
118
158
  .boolean()
119
159
  .optional()
120
160
  .describe("Accept a self-signed certificate, for a service whose local install ships one (Obsidian's Local REST API)."),
121
161
  });
122
162
 
163
+ // What a sign-in asks for when it depends on the answers: the first entry whose `when` holds (or that has none).
164
+ const ScopeChoiceSchema = z.object({
165
+ when: WhenConditionSchema.optional(),
166
+ scope: z.string().min(1),
167
+ });
168
+
169
+ // A sign-in the form runs through the sandbox (RFC 8628): the provider's endpoints answer no browser, so the daemon
170
+ // asks for the code, polls, and hands the form a marker for the token it holds. Declared as data, so another card of a
171
+ // provider the sandbox already serves is a manifest edit. Every value is a template over the fields, like `probe`'s.
172
+ const DeviceCodeSchema = z.object({
173
+ when: WhenConditionSchema.optional().describe(
174
+ "Only while this condition over the answers holds does the button stand in for the field (`!clientSecret`: an app with a secret of its own brings its own token). Otherwise the field stays a box to paste into.",
175
+ ),
176
+ authorizeUrl: z
177
+ .string()
178
+ .min(1)
179
+ .describe("The device authorization endpoint, templated like `probe.url`: `https://${authority}/${tenantId:uri}/oauth2/v2.0/devicecode`."),
180
+ tokenUrl: z
181
+ .string()
182
+ .min(1)
183
+ .describe("The token endpoint the sandbox polls until the person finishes, templated the same way. Only Microsoft identity platform hosts are served today."),
184
+ clientId: z.string().min(1).describe("The public client the sign-in runs as, templated: `${clientId}`."),
185
+ scope: z
186
+ .union([z.string().min(1), z.array(ScopeChoiceSchema).min(1)])
187
+ .describe(
188
+ "What the sign-in asks for, templated: one string, or a list whose first entry with no `when`, or a `when` that holds, is asked (read permissions alone for a read-only card). On Microsoft's identity platform a scope naming `https://graph.microsoft.com/` is asked of the Graph paired with the token endpoint's cloud.",
189
+ ),
190
+ });
191
+
123
192
  // How a cli card's credential reaches the services it is for without ever reaching the agent: the sandbox's credential
124
193
  // gateway, a loopback-only listener the agent's shell calls instead of the service. The gateway picks the upstream from
125
194
  // this declaration (never from the request), attaches the credential the way the service takes it, checks the card's
@@ -232,6 +301,24 @@ const CatalogSchema = z.object({
232
301
  })
233
302
  .optional()
234
303
  .describe("The walkthrough the install dialog renders for getting the credential this card asks for."),
304
+ // What a connected card still needs done on the service's side (invite the bot to a server). Built in the browser
305
+ // from what the summary carries, which is why a template may not name a secret field: the browser never holds one.
306
+ links: z
307
+ .array(
308
+ z.object({
309
+ label: z.string().min(1).describe('What the link says on the connected card: "Add to your server".'),
310
+ url: z
311
+ .string()
312
+ .min(1)
313
+ .describe(
314
+ "The address, templated over the card's non-secret fields like `env`: `${field}` substitutes, `${field:uri}` percent-encodes. Offered only once every field it names holds a value.",
315
+ ),
316
+ }),
317
+ )
318
+ .optional()
319
+ .describe(
320
+ "Links each connected card of this kind offers on its row, for a step taken on the service's own site after connecting (inviting a bot to a server). A template naming a secret field is refused: the editor is never shown one.",
321
+ ),
235
322
  });
236
323
 
237
324
  // Every arm carries these: the slug (the card's /capabilities/<id> route and the discriminator value the daemon
@@ -277,9 +364,12 @@ export const CapabilityContributionSchema = z
277
364
  "A sandbox feature pack name (whisper, llamacpp, browser, …) supplying this tool. Preferred over `fragment`: an image that already bakes the pack needs no rebuild, and there is no copy to drift.",
278
365
  )
279
366
  .meta({ effect: "image" }),
280
- probe: ProbeSchema.optional().describe(
281
- "One authenticated request that tests this card's settings before they are saved, so a wrong token or an unreachable host is answered on the form rather than by a card that says 'not connected' afterwards.",
282
- ),
367
+ probe: z
368
+ .union([ProbeSchema, ConnectProbeSchema])
369
+ .optional()
370
+ .describe(
371
+ "One authenticated request that tests this card's settings before they are saved, so a wrong token or an unreachable host is answered on the form rather than by a card that says 'not connected' afterwards. For a service not spoken to over HTTP, `connect` names the protocol the daemon dials it with instead of `url`.",
372
+ ),
283
373
  // Lets a sign-in on the agent's side store what it got without printing it: the daemon's oauth-token route
284
374
  // writes `field` and nothing else, for a caller holding the card's current token, while every `boundTo`
285
375
  // field still holds what the sign-in was made against.
@@ -291,6 +381,9 @@ export const CapabilityContributionSchema = z
291
381
  .describe(
292
382
  "Fields a token is only good for as filled in at sign-in (tenant, client, cloud, access level); a token arriving after one of them changed is refused.",
293
383
  ),
384
+ deviceCode: DeviceCodeSchema.optional().describe(
385
+ "How the form signs in on its own (RFC 8628 device authorization), for the field declaring `signIn: \"microsoft\"`: the sandbox asks for a code, shows it with the provider's page, waits for the person there, and fills the field. The CLI's own sign-in stays for the agent.",
386
+ ),
294
387
  })
295
388
  .optional()
296
389
  .describe(
@@ -383,6 +476,14 @@ export const CapabilityContributionSchema = z
383
476
  z.object({ ...contributionBase, kind: z.literal("agent") }),
384
477
  ])
385
478
  .superRefine((spec, ctx) => {
479
+ const secrets = new Set(spec.fields.filter((field) => field.secret === true).map((field) => field.key));
480
+ for (const link of spec.catalog.links ?? []) {
481
+ for (const [, key] of link.url.matchAll(/\$\{([a-zA-Z][a-zA-Z0-9]*)(?::uri)?\}/g)) {
482
+ if (key !== undefined && secrets.has(key)) {
483
+ ctx.addIssue({ code: "custom", message: `catalog.links "${link.label}" names the secret field "${key}", which the editor never holds` });
484
+ }
485
+ }
486
+ }
386
487
  // A totp field's env must never be referenced: that would hand the agent the seed itself instead of the
387
488
  // daemon's one-time codes.
388
489
  if (spec.kind !== "cli") {
@@ -397,6 +498,13 @@ export const CapabilityContributionSchema = z
397
498
  ctx.addIssue({ code: "custom", message: `refreshToken.boundTo names "${key}", which is not another field of this card` });
398
499
  }
399
500
  }
501
+ for (const field of spec.fields.filter((candidate) => candidate.signIn !== undefined && candidate.key !== spec.refreshToken?.field)) {
502
+ ctx.addIssue({ code: "custom", message: `signIn on "${field.key}" needs refreshToken.field to name it` });
503
+ }
504
+ // The sandbox runs a Microsoft sign-in from the card's own declaration; without one the button has nothing to do.
505
+ if (spec.fields.some((field) => field.signIn === "microsoft") && spec.refreshToken?.deviceCode === undefined) {
506
+ ctx.addIssue({ code: "custom", message: `signIn "microsoft" needs refreshToken.deviceCode to say how the sandbox signs in` });
507
+ }
400
508
  for (const field of spec.fields.filter((candidate) => candidate.totp === true)) {
401
509
  if (Object.values(spec.env).some((template) => template.includes(`\${${field.key}}`) || template.includes(`\${${field.key}:uri}`))) {
402
510
  ctx.addIssue({
@@ -0,0 +1,56 @@
1
+ import { CapabilityContributionSchema, CapabilityFieldSchema } from "./capabilities.js";
2
+
3
+ // The card shapes whose answer is not a typed string: a reference to another connection, a KEY=VALUE block as rows, a
4
+ // key the sandbox makes with its certificate request, and a test that dials a service other than over HTTP.
5
+
6
+ const cliCard = (extra: Record<string, unknown>) => ({
7
+ id: "db",
8
+ kind: "cli",
9
+ catalog: { name: `DB`, description: `A database.`, category: `data` },
10
+ fields: [
11
+ { key: "host", label: "Host" },
12
+ { key: "port", label: "Port", default: "5432" },
13
+ ],
14
+ env: { DB_HOST: "${host}" },
15
+ skill: "skills/db/SKILL.md",
16
+ ...extra,
17
+ });
18
+
19
+ test(`a field names the kind of connection it picks, and for a shared kind its card`, () => {
20
+ const field = CapabilityFieldSchema.parse({ key: "mailbox", label: "Code mailbox", connection: { kind: "cli", provider: "imap" } });
21
+
22
+ expect(field.connection).toEqual({ kind: "cli", provider: "imap" });
23
+ expect(CapabilityFieldSchema.safeParse({ key: "via", label: "Via", connection: { kind: "Device" } }).success).toBe(false);
24
+ });
25
+
26
+ test(`a key request takes a subject over the standard attributes only, and the field it keeps its request in`, () => {
27
+ const field = CapabilityFieldSchema.parse({
28
+ key: "privateKey",
29
+ label: "Key",
30
+ secret: true,
31
+ keyRequest: { subject: { O: "${organization}", CN: "${commonName}" }, request: "certificateRequest" },
32
+ });
33
+
34
+ expect(field.keyRequest).toEqual({ subject: { O: "${organization}", CN: "${commonName}" }, request: "certificateRequest" });
35
+ expect(CapabilityFieldSchema.safeParse({ key: "k", label: "K", keyRequest: { subject: { SERIAL: "x" } } }).success).toBe(false);
36
+ expect(CapabilityFieldSchema.parse({ key: "env", label: "Environment", keyValue: true }).keyValue).toBe(true);
37
+ });
38
+
39
+ test(`a probe either calls a URL or dials a protocol it names`, () => {
40
+ const dialled = CapabilityContributionSchema.parse(
41
+ cliCard({ probe: { connect: "postgres", host: "${host}", port: "${port}", user: "${user}", password: "${password}", database: "${database}" } }),
42
+ );
43
+ const called = CapabilityContributionSchema.parse(cliCard({ probe: { url: "https://${host}/health" } }));
44
+
45
+ expect(dialled.kind === "cli" ? dialled.probe : undefined).toEqual({
46
+ connect: "postgres",
47
+ host: "${host}",
48
+ port: "${port}",
49
+ user: "${user}",
50
+ password: "${password}",
51
+ database: "${database}",
52
+ });
53
+ expect(called.kind === "cli" ? called.probe : undefined).toEqual({ url: "https://${host}/health" });
54
+ expect(CapabilityContributionSchema.safeParse(cliCard({ probe: { connect: "redis", host: "${host}", port: "6379" } })).success).toBe(false);
55
+ expect(CapabilityContributionSchema.safeParse(cliCard({ probe: { connect: "tcp", host: "${host}" } })).success).toBe(false);
56
+ });
@@ -0,0 +1,64 @@
1
+ import { z } from "zod";
2
+
3
+ // The parts of a capability card whose answer is not a typed string: a reference to another connection, a key the
4
+ // sandbox makes, and the test of a service that is not spoken to over HTTP. Their own module, so the card schema in
5
+ // capabilities.ts stays readable.
6
+
7
+ // (2026-11-11) A reference to another of the owner's connections, picked rather than typed: a typed name only ever minted
8
+ // references to nothing. The value stored is the connection's name, exactly what a typed one was.
9
+ export const ConnectionRefSchema = z
10
+ .object({
11
+ kind: z.string().regex(/^[a-z][a-z0-9-]*$/).describe("The kind of connection it names: `device`, `exit`, `identity`, `cli`."),
12
+ provider: z
13
+ .string()
14
+ .min(1)
15
+ .optional()
16
+ .describe("For a kind several cards share, the card it was added from: a cli card's `provider` (`imap`), a site's `platform`."),
17
+ })
18
+ .describe(
19
+ "Answer this field by picking one of the owner's existing connections of this kind, by name, instead of typing the name. The empty choice is what leaving the field empty means, labelled with `placeholder`; with none of that kind connected, the field says so. The value stored is the connection's name, and the sandbox refuses a name that is not one.",
20
+ );
21
+ export type ConnectionRef = z.infer<typeof ConnectionRefSchema>;
22
+
23
+ // The subject attributes a certificate request may carry, in the order a request writes them.
24
+ export const KEY_REQUEST_ATTRIBUTES = ["C", "ST", "L", "O", "OU", "CN", "emailAddress"] as const;
25
+ export type KeyRequestAttribute = (typeof KEY_REQUEST_ATTRIBUTES)[number];
26
+
27
+ // (2026-11-11) A key the sandbox makes and keeps, with only its certificate request shown, as an ssh card's generated key
28
+ // shows only its public half.
29
+ export const KeyRequestSchema = z
30
+ .object({
31
+ subject: z
32
+ .partialRecord(z.enum(KEY_REQUEST_ATTRIBUTES), z.string())
33
+ .describe(
34
+ "The request's subject, attribute by attribute, as templates over the other fields (`${organization}`). An attribute that comes out empty is left out; letters with diacritics are written without them.",
35
+ ),
36
+ request: z
37
+ .string()
38
+ .optional()
39
+ .describe(
40
+ "A non-secret `multiline` field the request itself is kept in, so the card shows it again later; the form draws it inside this one rather than as a box of its own.",
41
+ ),
42
+ })
43
+ .describe(
44
+ "This secret field holds a private key the sandbox generates and keeps (RSA 2048): the form shows a PKCS#10 certificate signing request for it to copy or download, and the key itself never reaches the browser. For a service that issues a certificate from a request, which the card then takes in another field.",
45
+ );
46
+ export type KeyRequest = z.infer<typeof KeyRequestSchema>;
47
+
48
+ // (2026-11-11) The test of a service not spoken to over HTTP (a database, a mailbox), whose usual failure is the network
49
+ // between it and the sandbox: the daemon dials it as its client would and signs in where it can. Every value is a
50
+ // template over the fields, like an HTTP probe's `url`.
51
+ export const CONNECT_PROTOCOLS = ["tcp", "postgres", "mysql", "imap"] as const;
52
+ export const ConnectProbeSchema = z.object({
53
+ connect: z
54
+ .enum(CONNECT_PROTOCOLS)
55
+ .describe(
56
+ "What to dial. `tcp`: only that something accepts a connection there. `postgres` and `mysql`: sign in to the database (TLS when the server offers it, as their command-line clients do) and name the server's version. `imap`: sign in with LOGIN, over implicit TLS on 993 and STARTTLS where offered elsewhere; with no password it only checks the greeting.",
57
+ ),
58
+ host: z.string().min(1).describe("The host to dial, templated: `${host}`."),
59
+ port: z.string().min(1).describe("The port, templated: `${port}`."),
60
+ user: z.string().optional().describe("Who to sign in as, templated."),
61
+ password: z.string().optional().describe("The password, templated."),
62
+ database: z.string().optional().describe("The database to open, for `postgres` and `mysql`; the one a success names."),
63
+ });
64
+ export type ConnectProbe = z.infer<typeof ConnectProbeSchema>;
@@ -20,6 +20,7 @@ export * from "./agent.js";
20
20
  export * from "./automation-templates.js";
21
21
  export * from "./bin.js";
22
22
  export * from "./capabilities.js";
23
+ export * from "./capability-field-shapes.js";
23
24
  export * from "./commands.js";
24
25
  export * from "./documents.js";
25
26
  export * from "./environment.js";