@agent-native/core 0.206.0 → 0.206.1-nightly-20261009213000

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 (93) hide show
  1. package/dist/action.d.ts +2 -0
  2. package/dist/agent/default-agent-engine.js +25 -0
  3. package/dist/agent/durable-background.d.ts +2 -0
  4. package/dist/agent/durable-background.js +2 -0
  5. package/dist/agent/engine/error-detail.d.ts +1 -0
  6. package/dist/agent/engine/error-detail.js +6 -1
  7. package/dist/agent/engine/tool-call-journal-seed.d.ts +1 -1
  8. package/dist/agent/engine/tool-call-journal-seed.js +47 -11
  9. package/dist/agent/engine/translate-anthropic.d.ts +9 -0
  10. package/dist/agent/engine/translate-anthropic.js +18 -3
  11. package/dist/agent/production-agent.d.ts +6 -4
  12. package/dist/agent/production-agent.js +126 -85
  13. package/dist/agent/run-store.js +15 -3
  14. package/dist/agent/thread-data-builder.js +1 -2
  15. package/dist/agent/types.d.ts +1 -0
  16. package/dist/automation/index.d.ts +1 -1
  17. package/dist/chat-threads/store.js +6 -2
  18. package/dist/cli/design-connect.d.ts +1 -0
  19. package/dist/cli/design-connect.js +72 -19
  20. package/dist/client/analytics.js +48 -58
  21. package/dist/client/chat/agentkit-agent-native.js +11 -10
  22. package/dist/client/chat/agentkit-protocol.js +5 -1
  23. package/dist/client/chat/runtime.d.ts +4 -1
  24. package/dist/client/chat/runtime.js +135 -43
  25. package/dist/client/session-replay-endpoint.d.ts +1 -0
  26. package/dist/client/session-replay-endpoint.js +35 -0
  27. package/dist/client/session-replay.js +2 -24
  28. package/dist/client/sharing/share-controller-helpers.d.ts +1 -1
  29. package/dist/client/sharing/share-controller-helpers.js +2 -1
  30. package/dist/client/sharing/useShareButtonController.js +2 -9
  31. package/dist/client/use-action.d.ts +1 -0
  32. package/dist/client/use-action.js +2 -1
  33. package/dist/deploy/build.js +1 -1
  34. package/dist/deploy/workspace-deploy.js +65 -6
  35. package/dist/file-upload/actions/upload-image.d.ts +2 -2
  36. package/dist/file-upload/registry.d.ts +7 -1
  37. package/dist/file-upload/registry.js +25 -7
  38. package/dist/mcp/build-server.d.ts +6 -0
  39. package/dist/mcp/build-server.js +97 -28
  40. package/dist/mcp/embed-app.js +9 -8
  41. package/dist/mcp/screen-memory-stdio.d.ts +7 -7
  42. package/dist/notifications/routes.d.ts +3 -3
  43. package/dist/observability/metrics.d.ts +5 -0
  44. package/dist/observability/metrics.js +62 -7
  45. package/dist/observability/routes.d.ts +4 -4
  46. package/dist/org/handlers.d.ts +1 -1
  47. package/dist/org/index.d.ts +1 -1
  48. package/dist/provider-api/actions/custom-provider-registration.d.ts +13 -13
  49. package/dist/provider-api/actions/provider-api.d.ts +5 -5
  50. package/dist/scripts/docs/search.d.ts +1 -0
  51. package/dist/scripts/docs/search.js +17 -4
  52. package/dist/secrets/index.d.ts +1 -1
  53. package/dist/secrets/index.js +1 -1
  54. package/dist/secrets/storage.d.ts +1 -0
  55. package/dist/secrets/storage.js +8 -0
  56. package/dist/server/action-routes.js +62 -29
  57. package/dist/server/agent-chat/mcp-options.d.ts +2 -0
  58. package/dist/server/agent-chat/prompt-resources.js +2 -2
  59. package/dist/server/agent-engine-api-key-route.d.ts +2 -1
  60. package/dist/server/agent-engine-api-key-route.js +66 -2
  61. package/dist/server/agent-engine-default-model-route.d.ts +1 -1
  62. package/dist/server/agent-engine-ollama-models-route.d.ts +2 -2
  63. package/dist/server/agent-run-context.js +21 -1
  64. package/dist/server/agent-teams-run-queue.js +2 -1
  65. package/dist/server/agents-bundle.js +1 -1
  66. package/dist/server/auth.js +1 -0
  67. package/dist/server/core-routes-plugin.js +12 -0
  68. package/dist/server/embed-session.js +15 -1
  69. package/dist/server/http-response-telemetry.js +37 -8
  70. package/dist/server/realtime-token.d.ts +1 -1
  71. package/dist/shared/embed-auth.d.ts +4 -0
  72. package/dist/shared/embed-auth.js +156 -23
  73. package/dist/shared/inline-bytes.d.ts +29 -0
  74. package/dist/shared/inline-bytes.js +170 -0
  75. package/dist/shared/mcp-embed-headers.d.ts +1 -1
  76. package/dist/shared/mcp-embed-headers.js +1 -1
  77. package/dist/sharing/actions/list-resource-shares.d.ts +1 -1
  78. package/dist/sharing/actions/list-resource-shares.js +10 -4
  79. package/dist/sharing/actions/set-resource-visibility.js +3 -1
  80. package/dist/sharing/actions/share-resource.js +4 -2
  81. package/dist/sharing/actions/unshare-resource.js +3 -1
  82. package/dist/sharing/widget-grant.d.ts +19 -0
  83. package/dist/sharing/widget-grant.js +55 -0
  84. package/dist/templates/factory/.agents/skills/review-latest-feedback/SKILL.md +20 -21
  85. package/dist/testing.d.ts +1 -0
  86. package/dist/testing.js +1 -0
  87. package/dist/tracking/registry.d.ts +3 -2
  88. package/dist/tracking/registry.js +12 -3
  89. package/dist/vite/client.js +6 -1
  90. package/docs/content/observability.mdx +15 -10
  91. package/docs/content/tracking.mdx +1 -1
  92. package/package.json +4 -4
  93. package/src/templates/factory/.agents/skills/review-latest-feedback/SKILL.md +20 -21
@@ -140,13 +140,13 @@ export declare function screenMemoryMcpToolDefinitions(): ({
140
140
  clientHint?: undefined;
141
141
  timestamp?: undefined;
142
142
  chapterId?: undefined;
143
+ count?: undefined;
143
144
  startAt?: undefined;
144
145
  endAt?: undefined;
145
146
  reason?: undefined;
146
147
  includeMicrophone?: undefined;
147
148
  includeSystemAudio?: undefined;
148
149
  requestId?: undefined;
149
- count?: undefined;
150
150
  };
151
151
  required?: undefined;
152
152
  };
@@ -171,13 +171,13 @@ export declare function screenMemoryMcpToolDefinitions(): ({
171
171
  clientHint?: undefined;
172
172
  timestamp?: undefined;
173
173
  chapterId?: undefined;
174
+ count?: undefined;
174
175
  startAt?: undefined;
175
176
  endAt?: undefined;
176
177
  reason?: undefined;
177
178
  includeMicrophone?: undefined;
178
179
  includeSystemAudio?: undefined;
179
180
  requestId?: undefined;
180
- count?: undefined;
181
181
  };
182
182
  required?: undefined;
183
183
  };
@@ -196,13 +196,13 @@ export declare function screenMemoryMcpToolDefinitions(): ({
196
196
  clientHint?: undefined;
197
197
  timestamp?: undefined;
198
198
  chapterId?: undefined;
199
+ count?: undefined;
199
200
  startAt?: undefined;
200
201
  endAt?: undefined;
201
202
  reason?: undefined;
202
203
  includeMicrophone?: undefined;
203
204
  includeSystemAudio?: undefined;
204
205
  requestId?: undefined;
205
- count?: undefined;
206
206
  };
207
207
  required?: undefined;
208
208
  };
@@ -231,13 +231,13 @@ export declare function screenMemoryMcpToolDefinitions(): ({
231
231
  };
232
232
  timestamp?: undefined;
233
233
  chapterId?: undefined;
234
+ count?: undefined;
234
235
  startAt?: undefined;
235
236
  endAt?: undefined;
236
237
  reason?: undefined;
237
238
  includeMicrophone?: undefined;
238
239
  includeSystemAudio?: undefined;
239
240
  requestId?: undefined;
240
- count?: undefined;
241
241
  };
242
242
  };
243
243
  } | {
@@ -260,12 +260,12 @@ export declare function screenMemoryMcpToolDefinitions(): ({
260
260
  description: string;
261
261
  };
262
262
  chapterId?: undefined;
263
+ count?: undefined;
263
264
  startAt?: undefined;
264
265
  endAt?: undefined;
265
266
  includeMicrophone?: undefined;
266
267
  includeSystemAudio?: undefined;
267
268
  requestId?: undefined;
268
- count?: undefined;
269
269
  };
270
270
  };
271
271
  } | {
@@ -317,6 +317,7 @@ export declare function screenMemoryMcpToolDefinitions(): ({
317
317
  clientHint?: undefined;
318
318
  timestamp?: undefined;
319
319
  chapterId?: undefined;
320
+ count?: undefined;
320
321
  startAt: {
321
322
  type: string;
322
323
  description: string;
@@ -336,7 +337,6 @@ export declare function screenMemoryMcpToolDefinitions(): ({
336
337
  type: string;
337
338
  };
338
339
  requestId?: undefined;
339
- count?: undefined;
340
340
  };
341
341
  };
342
342
  } | {
@@ -352,6 +352,7 @@ export declare function screenMemoryMcpToolDefinitions(): ({
352
352
  clientHint?: undefined;
353
353
  timestamp?: undefined;
354
354
  chapterId?: undefined;
355
+ count?: undefined;
355
356
  startAt?: undefined;
356
357
  endAt?: undefined;
357
358
  reason?: undefined;
@@ -360,7 +361,6 @@ export declare function screenMemoryMcpToolDefinitions(): ({
360
361
  requestId: {
361
362
  type: string;
362
363
  };
363
- count?: undefined;
364
364
  };
365
365
  };
366
366
  })[];
@@ -1,13 +1,13 @@
1
1
  export declare function createNotificationsHandler(): import("h3").EventHandlerWithFetch<import("h3").EventHandlerRequest, Promise<"" | import("./types.js").Notification[] | {
2
2
  count: number;
3
3
  updated?: undefined;
4
- error?: undefined;
5
4
  ok?: undefined;
5
+ error?: undefined;
6
6
  } | {
7
7
  count?: undefined;
8
8
  updated: number;
9
- error?: undefined;
10
9
  ok?: undefined;
10
+ error?: undefined;
11
11
  } | {
12
12
  count?: undefined;
13
13
  updated?: undefined;
@@ -16,6 +16,6 @@ export declare function createNotificationsHandler(): import("h3").EventHandlerW
16
16
  } | {
17
17
  count?: undefined;
18
18
  updated?: undefined;
19
- error?: undefined;
20
19
  ok: boolean;
20
+ error?: undefined;
21
21
  }>>;
@@ -19,6 +19,7 @@ export interface HttpServerRequestMetric {
19
19
  route?: string;
20
20
  }
21
21
  export declare function recordHttpServerRequest(request: HttpServerRequestMetric): void;
22
+ export declare function recordHttpServerHandoff(request: HttpServerRequestMetric): void;
22
23
  export interface GenAiChatMetric {
23
24
  requestModel: string;
24
25
  /** The engine name; a closed, registered set. */
@@ -49,10 +50,14 @@ export declare function recordAgentToolCall(call: AgentToolCallMetric): void;
49
50
  export type TraceWriteStage = "spans" | "summary" | "thread_org" | "write";
50
51
  /** Counted once per failed stage of a run, never per span. */
51
52
  export declare function recordTraceWriteFailure(stage: TraceWriteStage, error: unknown): void;
53
+ export declare function __resetFlushFailureLogForTests(): void;
54
+ export declare const METRICS_FLUSH_MIN_INTERVAL_MS = 10000;
52
55
  /**
53
56
  * Export buffered telemetry before a serverless function can freeze. Never
54
57
  * delays a request by more than OBSERVABILITY_FLUSH_TIMEOUT_MS; each provider
55
58
  * that times out or fails drops its points and is counted separately on
56
59
  * `agent_native.telemetry.flush_failures`, which the next flush exports.
60
+ * Metrics export at most once per METRICS_FLUSH_MIN_INTERVAL_MS; spans export
61
+ * on every call.
57
62
  */
58
63
  export declare function flushObservability(): Promise<void>;
@@ -8,6 +8,7 @@
8
8
  */
9
9
  import { CORE_ACTION_GROUPS } from "../framework-tools.js";
10
10
  import { getRegisteredObservabilityProvider, } from "./otel-provider.js";
11
+ import { trackingIdentityProperties } from "./tracking-identity.js";
11
12
  const METER_NAME = "@agent-native/core";
12
13
  // The SDK default is dense below 100ms, which serverless requests don't need.
13
14
  const HTTP_SERVER_DURATION_BUCKETS_S = [0.05, 0.1, 0.25, 0.5, 1, 2.5, 5, 10];
@@ -51,6 +52,11 @@ function instruments() {
51
52
  unit: "s",
52
53
  advice: { explicitBucketBoundaries: HTTP_SERVER_DURATION_BUCKETS_S },
53
54
  }),
55
+ httpServerHandoffDuration: meter.createHistogram("agent_native.http.server.handoff.duration", {
56
+ description: "Time from the start of an HTTP server request until its response is handed back to the runtime, including post-handler work that holds it.",
57
+ unit: "s",
58
+ advice: { explicitBucketBoundaries: HTTP_SERVER_DURATION_BUCKETS_S },
59
+ }),
54
60
  genAiOperationDuration: meter.createHistogram("gen_ai.client.operation.duration", {
55
61
  description: "GenAI operation duration.",
56
62
  unit: "s",
@@ -82,18 +88,24 @@ function httpRequestMethod(method) {
82
88
  const upper = method.toUpperCase();
83
89
  return KNOWN_HTTP_METHODS.has(upper) ? upper : "_OTHER";
84
90
  }
85
- export function recordHttpServerRequest(request) {
86
- const recorded = instruments();
87
- if (!recorded)
88
- return;
89
- recorded.httpServerRequestDuration.record(Math.max(0, request.durationMs) / 1_000, {
91
+ function httpServerAttributes(request) {
92
+ return {
90
93
  "http.request.method": httpRequestMethod(request.method),
91
94
  "http.response.status_code": request.statusCode,
92
95
  ...(request.route ? { "http.route": request.route } : {}),
93
96
  ...(request.statusCode >= 500
94
97
  ? { "error.type": String(request.statusCode) }
95
98
  : {}),
96
- });
99
+ };
100
+ }
101
+ export function recordHttpServerRequest(request) {
102
+ instruments()?.httpServerRequestDuration.record(Math.max(0, request.durationMs) / 1_000, httpServerAttributes(request));
103
+ }
104
+ // http.server.request.duration ends when the response hook starts; this ends
105
+ // when the hook hands the response back, so work holding a finished response
106
+ // (an awaited telemetry export) shows up as the gap between the two.
107
+ export function recordHttpServerHandoff(request) {
108
+ instruments()?.httpServerHandoffDuration.record(Math.max(0, request.durationMs) / 1_000, httpServerAttributes(request));
97
109
  }
98
110
  /**
99
111
  * Engines that accept custom model ids pass any caller-supplied string
@@ -167,17 +179,56 @@ export function recordTraceWriteFailure(stage, error) {
167
179
  function flushErrorType(error) {
168
180
  return error instanceof Error && error.name ? error.name : "unknown";
169
181
  }
182
+ const FLUSH_FAILURE_LOG_EVENT = "agent-native.telemetry_flush_failed";
183
+ // Error names come from arbitrary exporters; cap distinct kinds so a provider
184
+ // minting varied names cannot grow this set or the log without bound.
185
+ const MAX_LOGGED_FLUSH_FAILURE_KINDS = 8;
186
+ const loggedFlushFailures = new Set();
170
187
  function recordFlushFailure(signal, errorType) {
171
188
  instruments()?.flushFailures.add(1, {
172
189
  "agent_native.telemetry.signal": signal,
173
190
  "error.type": errorType,
174
191
  });
192
+ // The counter rides the export that just failed, so a collector that keeps
193
+ // timing out never delivers it. The function log does not depend on OTLP.
194
+ const key = `${signal}:${errorType}`;
195
+ if (loggedFlushFailures.has(key) ||
196
+ loggedFlushFailures.size >= MAX_LOGGED_FLUSH_FAILURE_KINDS) {
197
+ return;
198
+ }
199
+ loggedFlushFailures.add(key);
200
+ console.warn(JSON.stringify({
201
+ event: FLUSH_FAILURE_LOG_EVENT,
202
+ ...trackingIdentityProperties(),
203
+ signal,
204
+ error_type: errorType,
205
+ timeout_ms: OBSERVABILITY_FLUSH_TIMEOUT_MS,
206
+ }));
207
+ }
208
+ export function __resetFlushFailureLogForTests() {
209
+ loggedFlushFailures.clear();
210
+ }
211
+ // A metric export re-sends every series the process holds, so exporting on
212
+ // each request multiplies upload volume by request rate. Cumulative (and
213
+ // delta) points carry everything skipped into the next export; only an
214
+ // instance that never serves another request loses its last window.
215
+ export const METRICS_FLUSH_MIN_INTERVAL_MS = 10_000;
216
+ const lastMetricsFlushAt = new WeakMap();
217
+ function shouldFlushMetrics(meterProvider, now) {
218
+ const last = lastMetricsFlushAt.get(meterProvider);
219
+ if (last !== undefined && now - last < METRICS_FLUSH_MIN_INTERVAL_MS) {
220
+ return false;
221
+ }
222
+ lastMetricsFlushAt.set(meterProvider, now);
223
+ return true;
175
224
  }
176
225
  /**
177
226
  * Export buffered telemetry before a serverless function can freeze. Never
178
227
  * delays a request by more than OBSERVABILITY_FLUSH_TIMEOUT_MS; each provider
179
228
  * that times out or fails drops its points and is counted separately on
180
229
  * `agent_native.telemetry.flush_failures`, which the next flush exports.
230
+ * Metrics export at most once per METRICS_FLUSH_MIN_INTERVAL_MS; spans export
231
+ * on every call.
181
232
  */
182
233
  export async function flushObservability() {
183
234
  const provider = getRegisteredObservabilityProvider();
@@ -196,8 +247,12 @@ export async function flushObservability() {
196
247
  try {
197
248
  // One provider failing must not end the wait for the other: the response
198
249
  // hook returning early lets the runtime freeze mid-export.
250
+ const meterProvider = provider.meterProvider?.forceFlush &&
251
+ shouldFlushMetrics(provider.meterProvider, startedAt)
252
+ ? provider.meterProvider
253
+ : undefined;
199
254
  const flushes = [
200
- ["metrics", provider.meterProvider],
255
+ ["metrics", meterProvider],
201
256
  ["traces", provider.tracerProvider],
202
257
  ];
203
258
  const failures = await Promise.all(flushes.map(([, signalProvider]) => Promise.race([
@@ -33,26 +33,26 @@ export declare function createObservabilityHandler(): import("h3").EventHandlerW
33
33
  spans?: undefined;
34
34
  ok?: undefined;
35
35
  } | {
36
- error?: undefined;
37
36
  message?: undefined;
38
37
  summary: import("./types.js").TraceSummary;
39
38
  spans: import("./types.js").TraceSpan[];
39
+ error?: undefined;
40
40
  ok?: undefined;
41
41
  } | {
42
- error?: undefined;
43
42
  message?: undefined;
44
43
  summary?: undefined;
45
44
  spans?: undefined;
46
45
  traceMissing: true;
47
46
  id: string;
47
+ error?: undefined;
48
48
  ok?: undefined;
49
49
  } | {
50
- error?: undefined;
51
50
  message?: undefined;
52
51
  summary?: undefined;
53
52
  spans?: undefined;
54
53
  traceMissing?: undefined;
55
54
  id: string;
55
+ error?: undefined;
56
56
  ok?: undefined;
57
57
  } | {
58
58
  message?: undefined;
@@ -61,9 +61,9 @@ export declare function createObservabilityHandler(): import("h3").EventHandlerW
61
61
  error: any;
62
62
  ok?: undefined;
63
63
  } | {
64
- error?: undefined;
65
64
  message?: undefined;
66
65
  summary?: undefined;
67
66
  spans?: undefined;
67
+ error?: undefined;
68
68
  ok: boolean;
69
69
  }>>;
@@ -72,9 +72,9 @@ export declare const setWorkspaceAppDefaultVisibilityHandler: import("h3").Event
72
72
  }>>;
73
73
  export declare const createOrgHandler: import("h3").EventHandlerWithFetch<import("h3").EventHandlerRequest, Promise<{
74
74
  success: boolean;
75
- id?: undefined;
76
75
  name?: undefined;
77
76
  role?: undefined;
77
+ id?: undefined;
78
78
  } | {
79
79
  success?: undefined;
80
80
  id: string;
@@ -177,10 +177,10 @@ export declare const getMyOrgHandler: import("h3").EventHandlerWithFetch<import(
177
177
  soloDeploymentAdmin: boolean | undefined;
178
178
  }>>;
179
179
  export declare const createOrgHandler: import("h3").EventHandlerWithFetch<import("h3").EventHandlerRequest, Promise<{
180
+ id?: undefined;
180
181
  name?: undefined;
181
182
  success: boolean;
182
183
  role?: undefined;
183
- id?: undefined;
184
184
  } | {
185
185
  success?: undefined;
186
186
  id: string;
@@ -75,10 +75,11 @@ export declare function createCustomProviderRegistrationAction<TSchema extends Z
75
75
  user: "user";
76
76
  }>>;
77
77
  }, z.core.$strip>>, {
78
- message?: undefined;
79
- deleted?: undefined;
80
78
  id?: undefined;
81
79
  provider?: undefined;
80
+ deleted?: undefined;
81
+ message?: undefined;
82
+ found?: undefined;
82
83
  providers: {
83
84
  id: string;
84
85
  label: string;
@@ -89,45 +90,44 @@ export declare function createCustomProviderRegistrationAction<TSchema extends Z
89
90
  updatedAt: number;
90
91
  }[];
91
92
  count: number;
92
- found?: undefined;
93
93
  registered?: undefined;
94
94
  label?: undefined;
95
95
  } | {
96
- message?: undefined;
97
- deleted?: undefined;
98
96
  id?: undefined;
99
- providers?: undefined;
100
97
  count?: undefined;
98
+ deleted?: undefined;
99
+ message?: undefined;
100
+ providers?: undefined;
101
101
  found: boolean;
102
102
  provider: import("../custom-registry.js").CustomProviderConfig;
103
103
  registered?: undefined;
104
104
  label?: undefined;
105
105
  } | {
106
- message?: undefined;
107
- deleted?: undefined;
108
106
  provider?: undefined;
109
- providers?: undefined;
110
107
  count?: undefined;
108
+ deleted?: undefined;
109
+ message?: undefined;
110
+ providers?: undefined;
111
111
  found: boolean;
112
112
  id: string;
113
113
  registered?: undefined;
114
114
  label?: undefined;
115
115
  } | {
116
- message?: undefined;
117
116
  provider?: undefined;
118
- providers?: undefined;
119
117
  count?: undefined;
118
+ message?: undefined;
120
119
  found?: undefined;
120
+ providers?: undefined;
121
121
  deleted: boolean;
122
122
  id: string;
123
123
  registered?: undefined;
124
124
  label?: undefined;
125
125
  } | {
126
- deleted?: undefined;
127
126
  provider?: undefined;
128
- providers?: undefined;
129
127
  count?: undefined;
128
+ deleted?: undefined;
130
129
  found?: undefined;
130
+ providers?: undefined;
131
131
  registered: boolean;
132
132
  id: string;
133
133
  label: string;
@@ -311,9 +311,9 @@ export declare function createProviderApiActions(runtime: Pick<ProviderApiRuntim
311
311
  notes?: string | undefined;
312
312
  scope?: "org" | "user" | undefined;
313
313
  }, {
314
- id?: undefined;
315
314
  deleted?: undefined;
316
315
  message?: undefined;
316
+ found?: undefined;
317
317
  providers: {
318
318
  id: string;
319
319
  label: string;
@@ -325,11 +325,10 @@ export declare function createProviderApiActions(runtime: Pick<ProviderApiRuntim
325
325
  }[];
326
326
  count: number;
327
327
  provider?: undefined;
328
- found?: undefined;
329
328
  registered?: undefined;
329
+ id?: undefined;
330
330
  label?: undefined;
331
331
  } | {
332
- id?: undefined;
333
332
  deleted?: undefined;
334
333
  message?: undefined;
335
334
  providers?: undefined;
@@ -337,6 +336,7 @@ export declare function createProviderApiActions(runtime: Pick<ProviderApiRuntim
337
336
  found: boolean;
338
337
  provider: import("../custom-registry.js").CustomProviderConfig;
339
338
  registered?: undefined;
339
+ id?: undefined;
340
340
  label?: undefined;
341
341
  } | {
342
342
  deleted?: undefined;
@@ -350,20 +350,20 @@ export declare function createProviderApiActions(runtime: Pick<ProviderApiRuntim
350
350
  label?: undefined;
351
351
  } | {
352
352
  message?: undefined;
353
+ found?: undefined;
353
354
  providers?: undefined;
354
355
  count?: undefined;
355
356
  provider?: undefined;
356
- found?: undefined;
357
357
  deleted: boolean;
358
358
  id: string;
359
359
  registered?: undefined;
360
360
  label?: undefined;
361
361
  } | {
362
362
  deleted?: undefined;
363
+ found?: undefined;
363
364
  providers?: undefined;
364
365
  count?: undefined;
365
366
  provider?: undefined;
366
- found?: undefined;
367
367
  registered: boolean;
368
368
  id: string;
369
369
  label: string;
@@ -6,6 +6,7 @@ interface DocMeta {
6
6
  export interface DocFull extends DocMeta {
7
7
  body: string;
8
8
  }
9
+ export declare function loadSkillDocPages(slugs: readonly string[], userEmail: string | null | undefined): Promise<Map<string, string>>;
9
10
  export declare function loadAllDocs(userEmail?: string): Promise<DocFull[]>;
10
11
  export default function docsSearchScript(args: string[]): Promise<void>;
11
12
  export {};
@@ -140,6 +140,22 @@ async function loadAgentBundleDocs(userEmail) {
140
140
  }
141
141
  return docs;
142
142
  }
143
+ function formatDocPage(doc) {
144
+ return `# ${doc.title}\n\n${doc.description ? `${doc.description}\n\n` : ""}${doc.body}`;
145
+ }
146
+ // Slugs come from the client, so only skills visible to this user resolve.
147
+ export async function loadSkillDocPages(slugs, userEmail) {
148
+ const pages = new Map();
149
+ if (slugs.length === 0)
150
+ return pages;
151
+ const docs = new Map((await loadAgentBundleDocs(userEmail)).map((doc) => [doc.slug, doc]));
152
+ for (const slug of slugs) {
153
+ const doc = slug.startsWith("skill-") ? docs.get(slug) : undefined;
154
+ if (doc)
155
+ pages.set(slug, formatDocPage(doc));
156
+ }
157
+ return pages;
158
+ }
143
159
  export async function loadAllDocs(userEmail = getRequestUserEmail()) {
144
160
  return [...loadFilesystemDocs(), ...(await loadAgentBundleDocs(userEmail))];
145
161
  }
@@ -201,10 +217,7 @@ Options:
201
217
  logMissingFrameworkDocsNote();
202
218
  return;
203
219
  }
204
- console.log(`# ${doc.title}\n`);
205
- if (doc.description)
206
- console.log(`${doc.description}\n`);
207
- console.log(doc.body);
220
+ console.log(formatDocPage(doc));
208
221
  return;
209
222
  }
210
223
  if (parsed.query) {
@@ -1,5 +1,5 @@
1
1
  export { registerRequiredSecret, listRequiredSecrets, getRequiredSecret, registerSecretUsage, getRegisteredSecretUsage, __resetSecretsRegistry, type RegisteredSecret, type SecretUsage, type SecretManagedBy, type SecretScope, type SecretKind, type SecretValidator, type ValidatorResult, } from "./register.js";
2
- export { writeAppSecret, readAppSecret, readAppSecretMeta, deleteAppSecret, getAppSecretMeta, listAppSecretsForScope, last4, VAULT_SYNC_DESCRIPTION_PREFIX, type SecretRef, type WriteSecretArgs, type ReadSecretResult, type SecretMeta, } from "./storage.js";
2
+ export { writeAppSecret, readAppSecret, hasAppSecret, readAppSecretMeta, deleteAppSecret, getAppSecretMeta, listAppSecretsForScope, last4, VAULT_SYNC_DESCRIPTION_PREFIX, type SecretRef, type WriteSecretArgs, type ReadSecretResult, type SecretMeta, } from "./storage.js";
3
3
  export { APP_SECRETS_CREATE_SQL, appSecrets } from "./schema.js";
4
4
  export { encryptSecretValue, decryptSecretValue, isEncryptedSecretValue, } from "./crypto.js";
5
5
  export { createListSecretsHandler, createWriteSecretHandler, createTestSecretHandler, createAdHocSecretHandler, type SecretStatusPayload, type AdHocSecretPayload, } from "./routes.js";
@@ -1,5 +1,5 @@
1
1
  export { registerRequiredSecret, listRequiredSecrets, getRequiredSecret, registerSecretUsage, getRegisteredSecretUsage, __resetSecretsRegistry, } from "./register.js";
2
- export { writeAppSecret, readAppSecret, readAppSecretMeta, deleteAppSecret, getAppSecretMeta, listAppSecretsForScope, last4, VAULT_SYNC_DESCRIPTION_PREFIX, } from "./storage.js";
2
+ export { writeAppSecret, readAppSecret, hasAppSecret, readAppSecretMeta, deleteAppSecret, getAppSecretMeta, listAppSecretsForScope, last4, VAULT_SYNC_DESCRIPTION_PREFIX, } from "./storage.js";
3
3
  export { APP_SECRETS_CREATE_SQL, appSecrets } from "./schema.js";
4
4
  export { encryptSecretValue, decryptSecretValue, isEncryptedSecretValue, } from "./crypto.js";
5
5
  export { createListSecretsHandler, createWriteSecretHandler, createTestSecretHandler, createAdHocSecretHandler, } from "./routes.js";
@@ -60,6 +60,7 @@ export interface SecretMeta {
60
60
  createdAt: number;
61
61
  updatedAt: number;
62
62
  }
63
+ export declare function hasAppSecret(ref: SecretRef): Promise<boolean>;
63
64
  export declare function readAppSecretMeta(ref: SecretRef): Promise<SecretMeta | null>;
64
65
  /**
65
66
  * List all secrets for a given scope. Returns metadata only — values are
@@ -345,6 +345,14 @@ export async function getAppSecretMeta(ref) {
345
345
  return null;
346
346
  return { last4: result.last4, updatedAt: result.updatedAt };
347
347
  }
348
+ export async function hasAppSecret(ref) {
349
+ await ensureTable();
350
+ const { rows } = await getDbExec().execute({
351
+ sql: `SELECT 1 FROM app_secrets WHERE scope = ? AND scope_id = ? AND key = ? LIMIT 1`,
352
+ args: [ref.scope, ref.scopeId, ref.key],
353
+ });
354
+ return rows.length > 0;
355
+ }
348
356
  export async function readAppSecretMeta(ref) {
349
357
  await ensureTable();
350
358
  const { key, scope, scopeId } = ref;