@jini-ai/agent-plugins 0.6.19 → 0.6.22

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/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.6.22
4
+
5
+ - Lifecycle exports `classifyBundledPluginFile` (byte-identical bundled files skip the scan; plugin dev files stay out of exports), `agentVisiblePluginCandidate`, `createVersionedPluginActivationReader` and `planAgentPluginToolGrant`: off plugins show agents one catalog line, and one approval turns on the plugin with its declared tools.
6
+ - Cloudflare forms receiver validates submissions and handles personal data more strictly. The Vercel target reports a failed deployment as failed.
7
+
3
8
  ## 0.6.19
4
9
 
5
10
  - A plugin's state lock left by a killed boot no longer keeps that plugin off on every later boot after the machine's hostname spelling changed (macOS `.lan`/`.local`): the node process port records the kernel boot (`bootIdentity`), so the platform lock can prove the holder was this machine's and reclaim it once its pid is dead.
@@ -61,9 +61,28 @@ function checkSuccessPath({ form, successPath, kit }, _options = {}) {
61
61
 
62
62
  function normalizeField({ field, kit, slug }, _options = {}) {
63
63
  if (!FIELD_NAME.test(field?.name ?? '')) throw formsRefusal({ kit, message: `Form ${slug} has a field name that cannot be served here. Rename the field in the site admin, then publish again.` });
64
+ field = { ...field, ...(field.options ? { options: field.options.filter(value => value !== '') } : {}) };
65
+ assertReceiverField({ field, kit, slug });
64
66
  const max = field.maxLength;
65
67
  checkMaxLength({ max, kit, slug, name: field.name });
66
- return { name: field.name, required: field.required === true, ...(Number.isInteger(max) ? { maxLength: max } : {}), ...(field.multiple === true ? { multiple: true } : {}) };
68
+ return { name: field.name, required: field.required === true, ...receiverConstraints({ field }), ...(Number.isInteger(max) ? { maxLength: max } : {}), ...(field.multiple === true ? { multiple: true } : {}) };
69
+ }
70
+
71
+ function receiverConstraints({ field }, _options = {}) {
72
+ return {
73
+ ...(field.type ? { type: field.type } : {}),
74
+ ...(field.options ? { options: field.options } : {}),
75
+ ...(field.minLength !== undefined ? { minLength: field.minLength } : {}),
76
+ ...(field.checkboxValue !== undefined ? { checkboxValue: field.checkboxValue } : {}),
77
+ };
78
+ }
79
+
80
+ /** Refuse richer validation before provisioning a receiver that could report false success. */
81
+ function assertReceiverField({ field, kit, slug }, _options = {}) {
82
+ const supported = ['text', 'textarea', 'hidden', 'email', 'tel', 'phone', 'url', 'number', 'range', 'date', 'time', 'datetime', 'datetime-local', 'color', 'password', 'checkbox', 'toggle', 'select', 'radio', 'multi-select', 'checkbox-group'];
83
+ if (field.type === 'file') throw formsRefusal({ kit, message: `Form ${slug} field ${field.name} accepts files, but this receiver cannot store files. Remove the file field or choose a live server before publishing.` });
84
+ const unrepresentableChoice = field.options?.some(value => typeof value !== 'string' || value.trim() === '');
85
+ if (field.validationUnsupported || unrepresentableChoice || (field.type && !supported.includes(field.type))) throw formsRefusal({ kit, message: `Form ${slug} field ${field.name} needs validation this receiver cannot enforce. Publish to a live server or simplify this field, then publish again.` });
67
86
  }
68
87
 
69
88
  function checkMaxLength({ max, kit, slug, name }, _options = {}) {
@@ -122,6 +141,11 @@ export async function provisionForms({ api, kit, resourceName }, _options = {})
122
141
  const database = await findDatabase({ api, kit, name }) ?? await createDatabase({ api, kit, name });
123
142
  if (typeof database?.uuid !== 'string' || !database.uuid) throw formsRefusal({ kit, code: 'CLOUDFLARE_D1_INVALID', status: 502, message: `D1 database ${name} returned no id. Check it in the Cloudflare dashboard, then publish again.` });
124
143
  const applied = await migrate({ api, kit, databaseId: database.uuid });
144
+ // Older receivers retained raw IPs and acknowledged answers indefinitely. This cold publish
145
+ // upgrade performs three writes with no payload reads, before the new receiver can be uploaded.
146
+ await query({ api, databaseId: database.uuid, sql: 'DELETE FROM submissions WHERE pulled_at IS NOT NULL' });
147
+ await query({ api, databaseId: database.uuid, sql: 'UPDATE submissions SET ip = NULL WHERE ip IS NOT NULL' });
148
+ await query({ api, databaseId: database.uuid, sql: "DELETE FROM rate_windows WHERE key LIKE '%:%'" });
125
149
  return { databaseId: database.uuid, databaseName: name, applied };
126
150
  }
127
151
 
@@ -1,7 +1,8 @@
1
1
  /**
2
2
  * Form submissions receiver, uploaded as `receiver.mjs` beside the site's static assets.
3
3
  * Runs inside the Cloudflare Workers runtime: no imports, no Node APIs, Web platform only.
4
- * Forms, their fields and full validation belong to the host; this module only receives and stores.
4
+ * Forms and full validation belong to the host; this receiver enforces its published supported
5
+ * subset and rejects unsupported fields at publish time.
5
6
  * Never log answers, IPs or the management secret: only fixed reason codes.
6
7
  */
7
8
  export const LIMITS = Object.freeze({ maxBodyBytes: 64 * 1024, maxFields: 100, maxValueLength: 5000, ratePerWindow: 5, windowSeconds: 60, maxPage: 100 });
@@ -18,7 +19,7 @@ export async function handleRequest({ request, env, manifest }, options = {}) {
18
19
  const url = new URL(request.url);
19
20
  const submit = SUBMIT_PATH.exec(url.pathname);
20
21
  if (submit) return request.method === 'POST' ? handleSubmit({ request, env, manifest, slug: submit[1] }, options) : errorPage({ status: 405, message: 'This address only accepts form submissions.' });
21
- if (url.pathname === '/_tovu/forms/pending') return request.method === 'GET' ? guarded({ request, env, work: () => listPending({ env, url }) }) : json({ status: 405, body: { error: 'METHOD_NOT_ALLOWED' } });
22
+ if (url.pathname === '/_tovu/forms/pending') return request.method === 'GET' ? guarded({ request, env, work: () => listPending({ env, url }, options) }) : json({ status: 405, body: { error: 'METHOD_NOT_ALLOWED' } });
22
23
  if (url.pathname === '/_tovu/forms/ack') return request.method === 'POST' ? guarded({ request, env, work: () => acknowledge({ request, env }, options) }) : json({ status: 405, body: { error: 'METHOD_NOT_ALLOWED' } });
23
24
  const slug = sentFormSlug({ request, url, manifest });
24
25
  return slug ? withSentNotice({ request, env, slug }, options) : env.ASSETS.fetch(request);
@@ -72,16 +73,16 @@ export async function handleSubmit({ request, env, manifest, slug }, { now = ()
72
73
  if ((parsed.fields.get(HONEYPOT) ?? []).some(value => value.trim() !== '')) return successRedirect({ request, form });
73
74
  const checked = checkFields({ form, fields: parsed.fields });
74
75
  if (checked.error) return errorPage({ status: 400, message: checked.error, back });
75
- const refused = await storeSubmission({ db: env.TOVU_FORMS, slug, answers: checked.answers, ip: request.headers.get('CF-Connecting-IP'), back }, { now, randomId });
76
+ const refused = await storeSubmission({ db: env.TOVU_FORMS, slug, answers: checked.answers, ip: request.headers.get('CF-Connecting-IP'), secret: env.TOVU_FORMS_SECRET, back }, { now, randomId });
76
77
  return refused ?? successRedirect({ request, form });
77
78
  }
78
79
 
79
80
  /** Rate window, then insert. Returns the error page to send, or null once the row is stored. */
80
- async function storeSubmission({ db, slug, answers, ip, back }, { now, randomId }) {
81
+ async function storeSubmission({ db, slug, answers, ip, secret, back }, { now, randomId }) {
81
82
  try {
82
- if (!await withinRate({ db, key: `${slug}:${ip ?? 'unknown'}`, nowMs: now() })) return errorPage({ status: 429, message: 'Too many submissions. Wait a minute, then try again.', back });
83
+ if (!await withinRate({ db, key: await rateKey({ slug, ip, secret }), nowMs: now() })) return errorPage({ status: 429, message: 'Too many submissions. Wait a minute, then try again.', back });
83
84
  await db.prepare('INSERT INTO submissions (id, form_slug, answers_json, submitted_at, ip) VALUES (?, ?, ?, ?, ?)')
84
- .bind(randomId(), slug, JSON.stringify(answers), new Date(now()).toISOString(), ip).run();
85
+ .bind(randomId(), slug, JSON.stringify(answers), new Date(now()).toISOString(), null).run();
85
86
  return null;
86
87
  } catch {
87
88
  console.error('FORMS_STORE_FAILED');
@@ -149,11 +150,46 @@ export function checkFields({ form, fields }, _options = {}) {
149
150
  return { answers };
150
151
  }
151
152
 
153
+ /** Only the published supported subset is accepted. Deployment refuses richer validation rather
154
+ * than showing success for answers the live form would reject. O(values + option count). */
152
155
  function fieldProblem({ field, values }, _options = {}) {
153
- if (field.required && !values.some(value => value.trim() !== '')) return `"${field.name}" is required.`;
156
+ if (field.validationUnsupported || field.type === 'file') return `"${field.name}" cannot be received here. Contact the site owner.`;
154
157
  if (!field.multiple && values.length > 1) return `"${field.name}" was sent more than once.`;
158
+ if (values.length === 0) return field.required ? `"${field.name}" is required.` : null;
159
+ if (field.type === 'checkbox' || field.type === 'toggle') return checkboxProblem({ field, values });
160
+ return textFieldProblem({ field, values });
161
+ }
162
+
163
+ /** Text and choice checks run only after presence/multiplicity and checkbox admission. */
164
+ function textFieldProblem({ field, values }, _options = {}) {
165
+ if (field.required && !values.some(value => value.trim() !== '')) return `"${field.name}" is required.`;
155
166
  const max = field.maxLength ?? LIMITS.maxValueLength;
156
- return values.some(value => value.length > max) ? `"${field.name}" is longer than ${max} characters.` : null;
167
+ if (values.some(value => [...value].length > max)) return `"${field.name}" is longer than ${max} characters.`;
168
+ if (values.some(value => value !== '' && value.length < (field.minLength ?? 0))) return `"${field.name}" is too short.`;
169
+ return typedFieldProblem({ field, values });
170
+ }
171
+
172
+ function checkboxProblem({ field, values }, _options = {}) {
173
+ const expected = field.checkboxValue ?? 'on';
174
+ return values[0] === expected ? null : `"${field.name}" must be checked with its declared value.`;
175
+ }
176
+
177
+ // Native email syntax, equivalent to the live CMS field adapter. Full-match checks refuse a final newline.
178
+ const EMAIL_PATTERN = /^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/;
179
+ function typedFieldProblem({ field, values }, _options = {}) {
180
+ if (field.type === 'email' && values.some(value => value !== '' && EMAIL_PATTERN.exec(value)?.[0] !== value)) return `"${field.name}" must be an email address.`;
181
+ if (!field.options) return null;
182
+ if (!field.multiple && !field.required && values[0] === '') return null;
183
+ const allowed = new Set(field.options);
184
+ if (new Set(values).size !== values.length || values.some(value => !allowed.has(value))) return `"${field.name}" contains an unavailable choice.`;
185
+ return null;
186
+ }
187
+
188
+ /** Secret-salted short-lived pseudonyms prevent offline IPv4 enumeration; no raw IP persists. */
189
+ async function rateKey({ slug, ip, secret }, _options = {}) {
190
+ if (typeof secret !== 'string' || secret.length < 32) throw new Error('FORMS_RECEIVER_SECRET_MISSING');
191
+ const digest = await crypto.subtle.digest('SHA-256', new TextEncoder().encode(JSON.stringify([secret, slug, ip ?? 'unknown'])));
192
+ return [...new Uint8Array(digest)].map(byte => byte.toString(16).padStart(2, '0')).join('');
157
193
  }
158
194
 
159
195
  /** Fixed-window counter in D1 (shared by every isolate). Counts only valid submissions.
@@ -228,8 +264,8 @@ async function guarded({ request, env, work }, _options = {}) {
228
264
  export async function listPending({ env, url }, _options = {}) {
229
265
  const after = Math.max(0, Number.parseInt(url.searchParams.get('after') ?? '0', 10) || 0);
230
266
  const limit = Math.min(LIMITS.maxPage, Math.max(1, Number.parseInt(url.searchParams.get('limit') ?? '50', 10) || 50));
231
- const { results = [] } = await env.TOVU_FORMS.prepare('SELECT seq, id, form_slug, answers_json, submitted_at, ip FROM submissions WHERE pulled_at IS NULL AND seq > ? ORDER BY seq LIMIT ?').bind(after, limit).all();
232
- const items = results.map(row => ({ seq: row.seq, id: row.id, formSlug: row.form_slug, answers: JSON.parse(row.answers_json), submittedAt: row.submitted_at, ip: row.ip ?? null }));
267
+ const { results = [] } = await env.TOVU_FORMS.prepare('SELECT seq, id, form_slug, answers_json, submitted_at FROM submissions WHERE pulled_at IS NULL AND seq > ? ORDER BY seq LIMIT ?').bind(after, limit).all();
268
+ const items = results.map(row => ({ seq: row.seq, id: row.id, formSlug: row.form_slug, answers: JSON.parse(row.answers_json), submittedAt: row.submitted_at, ip: null }));
233
269
  return json({ body: { items, nextAfter: items.length ? items[items.length - 1].seq : after, hasMore: items.length === limit } });
234
270
  }
235
271
 
@@ -237,13 +273,13 @@ function validIds({ ids }, _options = {}) {
237
273
  return Array.isArray(ids) && ids.length > 0 && ids.length <= LIMITS.maxPage && ids.every(id => typeof id === 'string' && id.length > 0 && id.length <= 64);
238
274
  }
239
275
 
240
- /** Marks committed rows as pulled. Unknown or already-pulled ids are ignored. */
276
+ /** Delete committed remote copies. The durable local receipt makes repeat acknowledgements safe. */
241
277
  export async function acknowledge({ request, env }, { now = () => Date.now() } = {}) {
242
278
  let body;
243
279
  try { body = await request.json(); } catch { body = null; }
244
280
  const ids = body?.ids;
245
281
  if (!validIds({ ids })) return json({ status: 400, body: { error: 'INVALID_IDS' } });
246
- const result = await env.TOVU_FORMS.prepare(`UPDATE submissions SET pulled_at = ? WHERE pulled_at IS NULL AND id IN (${ids.map(() => '?').join(', ')})`)
247
- .bind(new Date(now()).toISOString(), ...ids).run();
282
+ const result = await env.TOVU_FORMS.prepare(`DELETE FROM submissions WHERE id IN (${ids.map(() => '?').join(', ')})`)
283
+ .bind(...ids).run();
248
284
  return json({ body: { acknowledged: Number(result.meta?.changes ?? 0) } });
249
285
  }
@@ -0,0 +1,24 @@
1
+ /** Revision-checked, per-plugin activation queries: no repeated whole-file read on tool calls. */
2
+ export interface PluginActivationReaderPorts {
3
+ /** An atomic-file identity/version, not a TTL or wall clock. Errors must reject. */
4
+ revision(required: Record<string, never>, optional?: Record<string, never>): Promise<string>;
5
+ /** The existing strict activation owner; hosts pass only installed provisioning plugin ids. */
6
+ resolve(required: {
7
+ pluginId: string;
8
+ }, optional?: Record<string, never>): Promise<boolean>;
9
+ }
10
+ /** Cache one activation bit per plugin only while the host's durable revision remains unchanged.
11
+ * @returns A point-query reader and explicit reset; no global state or timers.
12
+ * @throws The injected revision/resolution error so a security caller can fail closed.
13
+ * @complexity O(1) lookup, one revision check per call; one resolution plus a second revision
14
+ * check on cache miss. O(p) memory for queried installed plugins, cleared on a version change.
15
+ */
16
+ export declare function createVersionedPluginActivationReader({ ports }: {
17
+ ports: PluginActivationReaderPorts;
18
+ }, _options?: {}): {
19
+ isEnabled: ({ pluginId }: {
20
+ pluginId: string;
21
+ }, _options?: {}) => Promise<boolean>;
22
+ clear: (_required: Record<string, never>, _options?: {}) => void;
23
+ };
24
+ //# sourceMappingURL=activation-reader.d.ts.map
@@ -0,0 +1,27 @@
1
+ /** Cache one activation bit per plugin only while the host's durable revision remains unchanged.
2
+ * @returns A point-query reader and explicit reset; no global state or timers.
3
+ * @throws The injected revision/resolution error so a security caller can fail closed.
4
+ * @complexity O(1) lookup, one revision check per call; one resolution plus a second revision
5
+ * check on cache miss. O(p) memory for queried installed plugins, cleared on a version change.
6
+ */
7
+ export function createVersionedPluginActivationReader({ ports }, _options = {}) {
8
+ let version;
9
+ const enabledById = new Map();
10
+ async function isEnabled({ pluginId }, _options = {}) {
11
+ const current = await ports.revision({}, {});
12
+ if (current !== version) {
13
+ enabledById.clear();
14
+ version = current;
15
+ }
16
+ if (enabledById.has(pluginId))
17
+ return enabledById.get(pluginId);
18
+ const enabled = await ports.resolve({ pluginId }, {});
19
+ // A concurrent write must not cache a decision read from the revision it just replaced.
20
+ if (current !== await ports.revision({}, {}))
21
+ return false;
22
+ enabledById.set(pluginId, enabled);
23
+ return enabled;
24
+ }
25
+ return { isEnabled, clear: (_required, _options = {}) => { version = undefined; enabledById.clear(); } };
26
+ }
27
+ //# sourceMappingURL=activation-reader.js.map
@@ -1,3 +1,4 @@
1
+ import { agentVisiblePluginCandidate } from './search-projection.js';
1
2
  export const DEFAULT_CHAT_AGENT_PLUGINS = 'auto';
2
3
  const MAX_AUTOMATIC_GUIDANCE_BYTES = 8 * 1024;
3
4
  /** Use the same one-line metadata reason in consent and progressive disclosure. */
@@ -167,7 +168,8 @@ export function createAutomaticAgentPluginUse({ mode, state: initialState, ports
167
168
  return '';
168
169
  for (const id of input.loaded ?? [])
169
170
  alreadyLoaded.add(id);
170
- const candidates = (await ports.list({}, {})).filter(plugin => plugin.enabled && !state.excluded.includes(plugin.pluginId));
171
+ const catalog = (await ports.list({}, {})).filter(plugin => !state.excluded.includes(plugin.pluginId));
172
+ const candidates = catalog.filter(plugin => plugin.enabled);
171
173
  const ranked = rankCandidates({ candidates, input, ports });
172
174
  // Owner decision 2026-10-18: no per-chat plugin count; the relevance threshold and vendor gate decide.
173
175
  const relevant = ranked.filter(plugin => !delivered.has(plugin.pluginId) && !alreadyLoaded.has(plugin.pluginId));
@@ -177,7 +179,17 @@ export function createAutomaticAgentPluginUse({ mode, state: initialState, ports
177
179
  const result = shouldLoad ? (await resolveGuidance({ matches }, { signal: input.signal })).join('\n\n') : relevantPluginNote({ matches, formatPluginToolPointer: ports.formatPluginToolPointer });
178
180
  rememberAutoSelection();
179
181
  await publishUsage();
180
- return result;
182
+ // Off packages never enter guidance consent or resolution. A relevant catalog line is the
183
+ // only disclosure, so the model can offer the existing owner-approved enable flow.
184
+ const off = offPluginNote({ catalog, input });
185
+ return [result, off].filter(Boolean).join('\n\n');
186
+ }
187
+ /** Rank only catalog-safe fields for off plugins; no capability-triggered disclosure. O(p*t). */
188
+ function offPluginNote({ catalog, input }) {
189
+ if (!input.query)
190
+ return '';
191
+ const candidates = catalog.filter(plugin => !plugin.enabled).map(candidate => agentVisiblePluginCandidate({ candidate }));
192
+ return ports.rank({ query: input.query, candidates, limit: 10 }, {}).map(plugin => plugin.description ?? '').join('\n');
181
193
  }
182
194
  /** Admit one explicit id using the same catalog, consent, resolver and delivery state as prepare.
183
195
  * No activation writes; unavailable guidance is retryable. O(p) local catalog lookup.
@@ -0,0 +1,22 @@
1
+ /** Exact installed-file comparison for exports; names and package digests alone prove nothing. */
2
+ export type BundledPluginFileDisposition = 'scan' | 'skip';
3
+ /** Host-owned read from the installed bundled package, never from the user's plugin tree. */
4
+ export type ReadBundledPluginFile = (required: {
5
+ pluginId: string;
6
+ relativePath: string;
7
+ }) => Promise<Uint8Array | null>;
8
+ /**
9
+ * Compare export bytes to one installed bundled file. Identical bytes skip scanning; all files
10
+ * stay in the archive. Missing/unreadable/changed/custom files receive full scanning.
11
+ * @param required Candidate bytes and a reader restricted to the host's bundled package selection.
12
+ * @returns A per-file export decision; grants no execution trust and never changes content.
13
+ * @complexity O(path length + file bytes) time and one installed-file read; O(file bytes) memory.
14
+ * @example classifyBundledPluginFile({ pluginId, relativePath, bytes, readFile });
15
+ */
16
+ export declare function classifyBundledPluginFile(required: {
17
+ pluginId: string;
18
+ relativePath: string;
19
+ bytes: Uint8Array;
20
+ readFile: ReadBundledPluginFile;
21
+ }, _optional?: Record<string, never>): Promise<BundledPluginFileDisposition>;
22
+ //# sourceMappingURL=bundled-file-policy.d.ts.map
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Compare export bytes to one installed bundled file. Identical bytes skip scanning; all files
3
+ * stay in the archive. Missing/unreadable/changed/custom files receive full scanning.
4
+ * @param required Candidate bytes and a reader restricted to the host's bundled package selection.
5
+ * @returns A per-file export decision; grants no execution trust and never changes content.
6
+ * @complexity O(path length + file bytes) time and one installed-file read; O(file bytes) memory.
7
+ * @example classifyBundledPluginFile({ pluginId, relativePath, bytes, readFile });
8
+ */
9
+ export async function classifyBundledPluginFile(required, _optional = {}) {
10
+ const parts = required.relativePath.split('/');
11
+ if (/[:\\\x00]/.test(required.relativePath) || parts.some(part => part === '' || part === '.' || part === '..'))
12
+ return 'scan';
13
+ const installed = await required.readFile({ pluginId: required.pluginId, relativePath: required.relativePath }).catch(() => null);
14
+ const candidate = Buffer.from(required.bytes.buffer, required.bytes.byteOffset, required.bytes.byteLength);
15
+ if (installed === null || !candidate.equals(installed))
16
+ return 'scan';
17
+ return 'skip';
18
+ }
19
+ //# sourceMappingURL=bundled-file-policy.js.map
@@ -0,0 +1,26 @@
1
+ /** A plugin's declared tools are the ceiling for additions, never a remote server's tool listing. */
2
+ export interface AgentPluginDeclaredTools {
3
+ readonly allow?: readonly string[] | undefined;
4
+ readonly write: readonly string[];
5
+ }
6
+ export interface AgentPluginToolGrant {
7
+ readonly enabled: boolean;
8
+ readonly allow: readonly string[];
9
+ readonly write: readonly string[];
10
+ }
11
+ /** Plan the existing sign-in grant or an explicit owner-approved enable without changing inputs.
12
+ * Sign-in preserves every edited list. Owner enable retains existing grants and adds only declared
13
+ * tools; the host must bind this plan to its approval card before applying it.
14
+ * @param required Current row grants and the installed declaration.
15
+ * @param options Grant occasion; sign-in is the conservative default.
16
+ * @returns The exact resulting grants, or null when no grant is declared or needed.
17
+ * @throws RangeError when a declaration grants writes outside its allowlist.
18
+ * @complexity O(a + w) time and space in current and declared tool names; no I/O.
19
+ */
20
+ export declare function planAgentPluginToolGrant({ current, declared }: {
21
+ current: AgentPluginToolGrant;
22
+ declared: AgentPluginDeclaredTools;
23
+ }, { reason }?: {
24
+ reason?: 'sign-in' | 'owner-enable';
25
+ }): AgentPluginToolGrant | null;
26
+ //# sourceMappingURL=enable-grants.d.ts.map
@@ -0,0 +1,28 @@
1
+ /** Existing nonempty lists belong to the owner; sign-in must not widen either list. O(1). */
2
+ function hasExistingGrants({ current }, _options = {}) {
3
+ return current.allow.length > 0 || current.write.length > 0;
4
+ }
5
+ /** Plan the existing sign-in grant or an explicit owner-approved enable without changing inputs.
6
+ * Sign-in preserves every edited list. Owner enable retains existing grants and adds only declared
7
+ * tools; the host must bind this plan to its approval card before applying it.
8
+ * @param required Current row grants and the installed declaration.
9
+ * @param options Grant occasion; sign-in is the conservative default.
10
+ * @returns The exact resulting grants, or null when no grant is declared or needed.
11
+ * @throws RangeError when a declaration grants writes outside its allowlist.
12
+ * @complexity O(a + w) time and space in current and declared tool names; no I/O.
13
+ */
14
+ export function planAgentPluginToolGrant({ current, declared }, { reason = 'sign-in' } = {}) {
15
+ if (!declared.allow)
16
+ return null;
17
+ const declaredAllow = new Set(declared.allow);
18
+ if (declared.write.some(name => !declaredAllow.has(name)))
19
+ throw new RangeError('Plugin write grants must be in its declared allow list');
20
+ if (reason === 'sign-in' && hasExistingGrants({ current }))
21
+ return null;
22
+ const allow = [...new Set([...current.allow, ...declared.allow])];
23
+ const write = [...new Set([...current.write, ...declared.write])];
24
+ if (current.enabled && JSON.stringify(current.allow) === JSON.stringify(allow) && JSON.stringify(current.write) === JSON.stringify(write))
25
+ return null;
26
+ return { enabled: true, allow, write };
27
+ }
28
+ //# sourceMappingURL=enable-grants.js.map
@@ -3,6 +3,7 @@ export { AgentPluginUpdateError } from './update-store.js';
3
3
  export type { UpdateAgentPluginRequired, UpdateAgentPluginResult } from './update.js';
4
4
  export * from './compatibility.js';
5
5
  export * from './automatic-use.js';
6
+ export * from './bundled-file-policy.js';
6
7
  import { maxAgentPluginArchiveBytes } from './fetch-archive.js';
7
8
  import type { FetchAgentPluginArchiveOptional } from './fetch-archive.js';
8
9
  import type { PackAgentPluginDirectoryOptional } from './bundled-source-archive.js';
@@ -227,4 +228,7 @@ export declare function createAgentPluginLifecycle(required: AgentPluginLifecycl
227
228
  }, _optional?: Record<string, never>) => Promise<void>;
228
229
  };
229
230
  export { projectAgentPluginSearchPage, type AgentPluginDiscoveryMatch, type AgentPluginDiscoveryPage } from './search-projection.js';
231
+ export { agentVisiblePluginCandidate } from './search-projection.js';
232
+ export { createVersionedPluginActivationReader, type PluginActivationReaderPorts } from './activation-reader.js';
233
+ export { planAgentPluginToolGrant, type AgentPluginToolGrant, type AgentPluginDeclaredTools } from './enable-grants.js';
230
234
  //# sourceMappingURL=index.d.ts.map
@@ -3,6 +3,7 @@ export { AgentPluginUpdateError } from './update-store.js';
3
3
  import { createUpdateModule } from './update.js';
4
4
  export * from './compatibility.js';
5
5
  export * from './automatic-use.js';
6
+ export * from './bundled-file-policy.js';
6
7
  import { createPersistentStateModule } from "./persistent-state.js";
7
8
  import { fetchAgentPluginArchive, maxAgentPluginArchiveBytes } from './fetch-archive.js';
8
9
  import { createSeedBundledModule } from './seed-bundled.js';
@@ -120,4 +121,7 @@ export function createAgentPluginLifecycle(required, optional = {}) {
120
121
  };
121
122
  }
122
123
  export { projectAgentPluginSearchPage } from './search-projection.js';
124
+ export { agentVisiblePluginCandidate } from './search-projection.js';
125
+ export { createVersionedPluginActivationReader } from './activation-reader.js';
126
+ export { planAgentPluginToolGrant } from './enable-grants.js';
123
127
  //# sourceMappingURL=index.js.map
@@ -13,6 +13,14 @@ export interface AgentPluginDiscoveryPage {
13
13
  readonly totalMatches: number;
14
14
  readonly nextOffset: number | null;
15
15
  }
16
+ /** Keep an off plugin discoverable by identity and purpose without disclosing its instructions,
17
+ * connection method, skills, tool names or capabilities. Admin metadata keeps its original owner.
18
+ * @returns The original active candidate, or a catalog-only candidate for an off plugin.
19
+ * @complexity O(1) bounded text work; no I/O or mutation.
20
+ */
21
+ export declare function agentVisiblePluginCandidate({ candidate }: {
22
+ candidate: AgentPluginSearchCandidate;
23
+ }, _options?: {}): AgentPluginSearchCandidate;
16
24
  /** Page an already ordered catalog, bounding the complete serialized result, including JSON escaping.
17
25
  * @param required Ranked/listed candidates, a validated count window and the installed catalog size.
18
26
  * @param options Optional byte budget (at least 1024); defaults to 8 KiB.
@@ -1,15 +1,33 @@
1
1
  /** Retain a short, valid UTF-8 description; encoding work is bounded even for huge source prose. */
2
- function shortDescription({ text }, _options = {}) {
3
- const bytes = Buffer.from(text.slice(0, 240));
4
- if (bytes.length <= 240)
5
- return text.slice(0, 240);
6
- let end = 240;
2
+ function shortDescription({ text }, { maxBytes = 240 } = {}) {
3
+ const bytes = Buffer.from(text.slice(0, maxBytes));
4
+ if (bytes.length <= maxBytes)
5
+ return text.slice(0, maxBytes);
6
+ let end = maxBytes;
7
7
  while ((bytes[end] & 0xc0) === 0x80)
8
8
  end--;
9
9
  return bytes.subarray(0, end).toString('utf8');
10
10
  }
11
+ /** Keep an off plugin discoverable by identity and purpose without disclosing its instructions,
12
+ * connection method, skills, tool names or capabilities. Admin metadata keeps its original owner.
13
+ * @returns The original active candidate, or a catalog-only candidate for an off plugin.
14
+ * @complexity O(1) bounded text work; no I/O or mutation.
15
+ */
16
+ export function agentVisiblePluginCandidate({ candidate }, _options = {}) {
17
+ if (candidate.enabled)
18
+ return candidate;
19
+ const purpose = shortDescription({ text: (candidate.summary ?? candidate.description ?? '').slice(0, 1024).replace(/\s+/g, ' ').trim() }, { maxBytes: 100 });
20
+ const label = shortDescription({ text: (candidate.displayName ?? candidate.pluginId).slice(0, 1024).replace(/\s+/g, ' ').trim() }, { maxBytes: 80 });
21
+ return { pluginId: candidate.pluginId, id: candidate.id ?? candidate.pluginId, enabled: false,
22
+ description: `installed, off: ${label}: ${purpose} — ask to turn on`,
23
+ skills: [], keywords: [], provides: [], mcpServerIds: [] };
24
+ }
11
25
  /** Project one candidate without copying skills, keywords, credentials or host metadata. O(1). */
12
26
  function discoveryMatch({ candidate }, _options = {}) {
27
+ if (!candidate.enabled) {
28
+ const visible = agentVisiblePluginCandidate({ candidate });
29
+ return { id: visible.id ?? visible.pluginId, pluginId: visible.pluginId, enabled: false, description: visible.description ?? '' };
30
+ }
13
31
  return { id: candidate.id ?? candidate.pluginId, pluginId: candidate.pluginId, enabled: candidate.enabled,
14
32
  ...(candidate.maturity ? { maturity: candidate.maturity } : {}),
15
33
  description: shortDescription({ text: candidate.description ?? candidate.summary ?? '' }) };
@@ -1,4 +1,5 @@
1
1
  /** Extracted from the host plugin lifecycle. Effects are supplied per host context. */
2
+ import { agentVisiblePluginCandidate } from './search-projection.js';
2
3
  /** These describe the conversation or target, not a plugin's topic. Prose-only hits remain
3
4
  * available to explicit search without silently loading unrelated guidance. */
4
5
  const INCIDENTAL_TERMS = new Set('a an and are as at be build can could create do for from get help i in is it make me my new of on or please the this to use want we with you your site sites page pages website websites plugin plugins tell which load just don t anything'.split(' '));
@@ -22,8 +23,11 @@ function passesDeploymentGate({ candidate, capabilities, terms }, _options = {})
22
23
  * Mixed-purpose plugins can still match their other capabilities (for example source control).
23
24
  */
24
25
  function automaticScore({ candidate, terms }, _options = {}) {
25
- if (!candidate.enabled)
26
- return 0;
26
+ if (!candidate.enabled) {
27
+ const visible = agentVisiblePluginCandidate({ candidate });
28
+ const catalogTerms = automaticTerms(`${visible.pluginId} ${visible.description ?? ''}`);
29
+ return terms.reduce((score, term) => score + (catalogTerms.includes(term) ? 5 : 0), 0);
30
+ }
27
31
  const capabilities = candidate.provides ?? [];
28
32
  if (!passesDeploymentGate({ candidate, capabilities, terms }))
29
33
  return 0;
@@ -52,6 +56,7 @@ function buildModule(ports) {
52
56
  * each weight is what it is. Split out of {@link scoreCandidate} so the field/weight pairing is a
53
57
  * plain, independently-readable list rather than interleaved with the scoring loop itself. */
54
58
  function fieldHaystacks(candidate) {
59
+ candidate = agentVisiblePluginCandidate({ candidate });
55
60
  return [
56
61
  { text: `${candidate.pluginId} ${candidate.id ?? ""} ${candidate.displayName ?? ""}`.toLowerCase(), weight: ID_FIELD_WEIGHT },
57
62
  { text: [...candidate.keywords, ...(candidate.provides ?? [])].join(" ").toLowerCase(), weight: KEYWORD_FIELD_WEIGHT },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jini-ai/agent-plugins",
3
- "version": "0.6.19",
3
+ "version": "0.6.22",
4
4
  "description": "Support for Agent Plugins: vendor-neutral manifest types and validators, installation, activation, digests and trusted contribution loading. Every Jini agent plugin ships here as its own subpath (@jini-ai/agent-plugins/<id>); resolving one never loads another plugin's files.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -283,8 +283,8 @@
283
283
  "semver": "^7.6.2",
284
284
  "fast-check": "4.3.0",
285
285
  "jsdom": "^25.0.1",
286
- "@jini-ai/oauth": "^0.6.19",
287
- "@jini-ai/plugins": "^0.6.19"
286
+ "@jini-ai/plugins": "^0.6.22",
287
+ "@jini-ai/oauth": "^0.6.19"
288
288
  },
289
289
  "peerDependencies": {
290
290
  "yauzl": "^3.4.0",
@@ -144,14 +144,14 @@ export function bindVercel(kit) {
144
144
  return this.resolvedPublicUrl;
145
145
  }
146
146
  /**
147
- * Publishes `input.files` as a new Vercel deployment and waits for the
148
- * resulting URL to be reachable.
147
+ * Publishes `input.files`, asking Vercel for missing hashes before uploading. The optional
148
+ * synchronous `input.onProgress` receives credential-free counts and deployment facts.
149
149
  *
150
- * @param input - File set plus a caller-chosen project name label.
151
- * @returns The published deployment's URL/status once Vercel has a
152
- * terminal `readyState` (or the poll budget is exhausted).
153
- * @throws {DeployError} If `config.token` is missing, or Vercel's API
154
- * rejects the deployment request or reports `readyState: 'ERROR'`.
150
+ * @param input - File set, project name, optional security headers and progress observer.
151
+ * @returns The verified URL/status, or a partial result retaining the accepted deployment's
152
+ * ID/URL and next steps when readiness cannot be confirmed.
153
+ * @throws {DeployError} For a failed build or before a deployment is known to exist; includes confirmed
154
+ * upload counts, whether creation is false/unknown, and how to safely continue.
155
155
  * @complexity O(files) to hash and upload them, plus a bounded poll loop
156
156
  * (`pollVercelDeployment`) and the reachability wait's own bound.
157
157
  * @overallScore 100/100
@@ -161,22 +161,22 @@ export function bindVercel(kit) {
161
161
  throw new DeployError('Vercel token is required.', 400);
162
162
  }
163
163
  const { refs, blobs } = vercelFileManifest(withVercelConfigFile(input.files, input.responseHeaders));
164
- await uploadVercelFiles(this.config, blobs, [...blobs.keys()]);
165
164
  const name = this.resolvedProjectName ?? safeVercelProjectName(input.projectName);
166
- const created = await createUploadedVercelDeployment({ config: this.config, name, refs, blobs });
167
- const fallbackId = typeof created.uid === 'string' ? created.uid : undefined;
168
- const deploymentId = typeof created.id === 'string' ? created.id : fallbackId;
169
- const initialUrl = deploymentUrl(created);
170
- const ready = await readyVercelDeployment({ config: this.config, deploymentId, created });
171
- const link = await publicVercelLink({ name, ready, created, initialUrl, publicUrl: this.resolvedPublicUrl });
172
- return {
173
- targetId: this.id,
174
- url: link.url || deploymentUrl(ready) || initialUrl,
175
- ...(deploymentId ? { deploymentId } : {}),
176
- status: link.status,
177
- statusMessage: link.statusMessage,
178
- ...(link.reachableAt !== undefined ? { reachableAt: link.reachableAt } : {}),
179
- };
165
+ const progress = { phase: 'creating', totalFiles: blobs.size, uploadedFiles: 0, reusedFiles: 0, deploymentCreated: false };
166
+ const report = patch => { Object.assign(progress, patch); input.onProgress?.({ ...progress }); };
167
+ try {
168
+ const created = await createUploadedVercelDeployment({ config: this.config, name, refs, blobs, report });
169
+ const deploymentId = typeof created.id === 'string' ? created.id : created.uid;
170
+ const initialUrl = deploymentUrl(created);
171
+ report({ phase: 'polling', deploymentCreated: true, deploymentId, url: initialUrl, providerStatus: created.readyState ?? 'unknown' });
172
+ const ready = await readyVercelDeployment({ config: this.config, deploymentId, created, report });
173
+ if (ready?.readyState !== 'READY') return unfinishedDeployment({ progress, name });
174
+ report({ phase: 'checking', providerStatus: 'READY' });
175
+ const link = await publicVercelLink({ name, ready, created, initialUrl, publicUrl: this.resolvedPublicUrl });
176
+ return publishedResult({ link, ready, initialUrl, deploymentId });
177
+ } catch (error) {
178
+ return publishFailure({ progress, name, error, token: this.config.token });
179
+ }
180
180
  }
181
181
  /** Probes `url`, recognizing Vercel's own Deployment Protection auth wall. */
182
182
  async checkReachability(url) {
@@ -186,6 +186,21 @@ export function bindVercel(kit) {
186
186
  });
187
187
  }
188
188
  }
189
+ /** Preserve accepted deployment facts on verification failures; known build errors still reject.
190
+ * @complexity O(message bytes), no I/O; reuses the confirmed progress snapshot.
191
+ */
192
+ function publishFailure({ progress, name, error, token }, _options = {}) {
193
+ // An existing deployment remains a real provider fact even if polling/reachability fails.
194
+ if (progress.deploymentCreated === true && progress.providerStatus !== 'ERROR') return unfinishedDeployment({ progress, name, error, token });
195
+ const detail = safeFailureMessage({ error, token });
196
+ throw new DeployError(`${detail} ${publishFacts({ progress })} ${retryGuidance({ progress, name })}`, error?.status ?? 502);
197
+ }
198
+ /** Map a verified public link without changing the provider's deployment identity. */
199
+ function publishedResult({ link, ready, initialUrl, deploymentId }, _options = {}) {
200
+ return { targetId: VERCEL_TARGET_ID, url: link.url || deploymentUrl(ready) || initialUrl,
201
+ ...(deploymentId ? { deploymentId } : {}), status: link.status, statusMessage: link.statusMessage,
202
+ ...(link.reachableAt !== undefined ? { reachableAt: link.reachableAt } : {}) };
203
+ }
189
204
  /** Read the provider's production-only, verified, nonredirecting domains. Refuse a partial
190
205
  * inventory rather than select a different canonical URL on different pages of the result.
191
206
  * @complexity One bounded request; response limited to 100 records by the provider.
@@ -233,29 +248,66 @@ export function bindVercel(kit) {
233
248
  if (!domain) throw new DeployError('Vercel did not report a verified public domain for this project.', 400);
234
249
  return `https://${domain.name}`;
235
250
  }
236
- async function createUploadedVercelDeployment({ config, name, refs, blobs }, _options = {}) {
251
+ /** Let the provider's content store select missing hashes before sending bytes. A retry on
252
+ * another target/process reuses provider acknowledgements, including a prior partial upload.
253
+ * @complexity At most two O(file references) create requests plus one upload per missing hash.
254
+ */
255
+ async function createUploadedVercelDeployment({ config, name, refs, blobs, report }, _options = {}) {
237
256
  // `target: "production"`: without it Vercel makes a preview deployment, and only a project's
238
257
  // FIRST deployment takes the production alias, so every later publish never reached the
239
258
  // public address (2026-10-11). A publish is meant to update the live site.
240
259
  const body = JSON.stringify({ name, files: refs, target: 'production', projectSettings: { framework: null } });
260
+ report({ phase: 'creating', deploymentCreated: 'unknown' });
241
261
  let createResp = await createVercelDeployment(config, body);
242
262
  let created = await readVercelJson(createResp);
243
263
  const missing = created?.error?.code === 'missing_files' ? created.error.missing : undefined;
244
264
  if (!createResp.ok && Array.isArray(missing)) {
265
+ const shas = [...new Set(missing.filter(sha => blobs.has(sha)))];
266
+ report({ phase: 'uploading', deploymentCreated: false, reusedFiles: blobs.size - shas.length });
245
267
  // Vercel did not keep (or never got) some uploads: send exactly what it names, then create
246
268
  // once more. A second `missing_files` is reported like any other create failure.
247
- await uploadVercelFiles(config, blobs, missing.filter((sha) => blobs.has(sha)));
269
+ let uploadedFiles = 0;
270
+ await uploadVercelFiles(config, blobs, shas, () => report({ uploadedFiles: ++uploadedFiles }));
271
+ report({ phase: 'creating', deploymentCreated: 'unknown' });
248
272
  createResp = await createVercelDeployment(config, body);
249
273
  created = await readVercelJson(createResp);
274
+ } else if (createResp.ok) {
275
+ report({ reusedFiles: blobs.size });
250
276
  }
251
- if (!createResp.ok)
277
+ if (!createResp.ok) {
278
+ report({ deploymentCreated: false });
252
279
  throw vercelError(created, createResp.status);
280
+ }
253
281
  return created;
254
282
  }
255
- async function readyVercelDeployment({ config, deploymentId, created }, _options = {}) {
256
- const ready = deploymentId ? await pollVercelDeployment(config, deploymentId) : created;
283
+ /** Only confirmed, value-free facts cross the failure boundary; no raw upstream body.
284
+ * @complexity O(1) formatting, independent of export bytes.
285
+ */
286
+ function publishFacts({ progress }, _options = {}) {
287
+ const created = progress.deploymentCreated === true ? 'created' : progress.deploymentCreated === false ? 'not created' : 'unknown';
288
+ return `Deployment: ${created}. ${progress.uploadedFiles} of ${progress.totalFiles} distinct files uploaded this attempt; ${progress.reusedFiles} already stored. Deployment ID: ${progress.deploymentId ?? 'unknown'}; URL: ${progress.url || 'unknown'}; provider status: ${progress.providerStatus ?? 'unknown'}.`;
289
+ }
290
+ function retryGuidance({ progress, name }, _options = {}) {
291
+ if (progress.deploymentCreated !== false) return `Check deployment ${progress.deploymentId ?? ''} in the Vercel dashboard for project '${name}' before publishing again. A public site's 200 can belong to the previous deployment.`;
292
+ return 'Retry the publish to upload only missing hashes; acknowledged files are reused.';
293
+ }
294
+ function safeFailureMessage({ error, token }, _options = {}) {
295
+ return String(error?.message ?? 'Vercel did not finish the request.').split(token).join('[redacted]');
296
+ }
297
+ /** Accepted deployment with incomplete verification: retain its own URL, never prove it with
298
+ * an old production alias. Known provider errors remain failed rather than becoming a timeout.
299
+ */
300
+ function unfinishedDeployment({ progress, name, error, token }, _options = {}) {
301
+ const fallback = progress.providerStatus === 'ERROR' ? 'Vercel deployment failed.' : 'Vercel has not confirmed this deployment is ready yet.';
302
+ const detail = error ? safeFailureMessage({ error, token }) : fallback;
303
+ return { targetId: VERCEL_TARGET_ID, url: progress.url || '', deploymentId: progress.deploymentId,
304
+ status: progress.providerStatus === 'ERROR' ? 'failed' : 'link-delayed',
305
+ statusMessage: `${detail} ${publishFacts({ progress })} ${retryGuidance({ progress, name })}` };
306
+ }
307
+ async function readyVercelDeployment({ config, deploymentId, created, report }, _options = {}) {
308
+ const ready = deploymentId ? await pollVercelDeployment(config, deploymentId, report) : created;
257
309
  if (ready?.readyState === 'ERROR') {
258
- const readyError = ready?.error;
310
+ const readyError = ready.error;
259
311
  // `ready ?? undefined` — the `undefined` side is unreachable: this line
260
312
  // only runs when `ready?.readyState === 'ERROR'` just matched, which
261
313
  // requires `ready` itself to already be a real object (optional
@@ -316,25 +368,30 @@ export function bindVercel(kit) {
316
368
  }
317
369
  /**
318
370
  * Uploads `shas` (keys of `blobs`) to `POST /v2/files`, {@link VERCEL_UPLOAD_CONCURRENCY} at a
319
- * time. The first failure stops the remaining queue and rejects.
371
+ * time. The first failure stops the remaining queue; active sends drain before rejection.
320
372
  *
321
373
  * @complexity O(n) requests, plus at most `VERCEL_UPLOAD_ATTEMPTS - 1` retries each.
322
374
  */
323
- async function uploadVercelFiles(config, blobs, shas) {
324
- const queue = [...shas];
375
+ async function uploadVercelFiles(config, blobs, shas, onUploaded) {
376
+ let cursor = 0;
377
+ let stopped = false;
325
378
  const worker = async () => {
326
- while (queue.length) {
327
- const sha = queue.shift();
379
+ while (!stopped && cursor < shas.length) {
380
+ const sha = shas[cursor++];
328
381
  try {
329
382
  await uploadVercelFile(config, sha, blobs.get(sha));
330
- }
331
- catch (err) {
332
- queue.length = 0;
383
+ onUploaded();
384
+ } catch (err) {
385
+ stopped = true;
333
386
  throw err;
334
387
  }
335
388
  }
336
389
  };
337
- await Promise.all(Array.from({ length: Math.min(VERCEL_UPLOAD_CONCURRENCY, queue.length) }, worker));
390
+ // Drain already-started sends before reporting a failure, so acknowledged counts are final
391
+ // and no upload from this attempt can race a retry and charge the same bytes twice.
392
+ const results = await Promise.allSettled(Array.from({ length: Math.min(VERCEL_UPLOAD_CONCURRENCY, shas.length) }, worker));
393
+ const failure = results.find(result => result.status === 'rejected');
394
+ if (failure) throw failure.reason;
338
395
  }
339
396
  function vercelUploadTransportError({ err }, _options = {}) {
340
397
  // Node's fetch reports every transport failure as a bare "fetch failed"; the cause (a
@@ -405,7 +462,7 @@ export function bindVercel(kit) {
405
462
  * `publish` has no caller-facing timeout knob yet either; flagged as a
406
463
  * minor extensibility gap rather than a correctness issue.
407
464
  */
408
- async function pollVercelDeployment(config, id) {
465
+ async function pollVercelDeployment(config, id, report) {
409
466
  let last = null;
410
467
  for (let i = 0; i < 30; i += 1) {
411
468
  await sleep(i < 5 ? 1000 : 2000);
@@ -423,6 +480,7 @@ export function bindVercel(kit) {
423
480
  if (!resp.ok)
424
481
  throw vercelError(json, resp.status);
425
482
  last = json;
483
+ report({ providerStatus: json.readyState ?? 'unknown' });
426
484
  if (json.readyState === 'READY' || json.readyState === 'ERROR')
427
485
  return json;
428
486
  }