@agent-native/core 0.209.0-nightly-20261014153330 → 0.209.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/dist/agent/production-agent.d.ts +8 -0
- package/dist/agent/production-agent.js +68 -3
- package/dist/agent/strict-tool-input.d.ts +4 -0
- package/dist/agent/strict-tool-input.js +26 -0
- package/dist/agent/types.d.ts +7 -0
- package/dist/automation/index.d.ts +1 -1
- package/dist/cli/skills-content/turn-into-app-attachments.d.ts +1 -1
- package/dist/cli/skills-content/turn-into-app-attachments.js +1 -3
- package/dist/cli/skills-content/turn-into-app-skill.d.ts +2 -2
- package/dist/cli/skills-content/turn-into-app-skill.js +15 -10
- package/dist/client/chat/agentkit-protocol.js +2 -0
- package/dist/client/chat/runtime.d.ts +1 -0
- package/dist/client/chat/runtime.js +35 -3
- package/dist/collab/routes.d.ts +1 -1
- package/dist/jobs/actions/manage-recurring-job.d.ts +1 -1
- package/dist/observability/metrics.d.ts +2 -0
- package/dist/observability/metrics.js +15 -1
- package/dist/observability/routes.d.ts +7 -7
- package/dist/observability/traces.js +8 -1
- package/dist/provider-api/actions/custom-provider-registration.d.ts +11 -11
- package/dist/provider-api/actions/provider-api.d.ts +10 -10
- package/dist/resources/handlers.d.ts +1 -1
- package/dist/secrets/routes.d.ts +10 -10
- package/dist/server/agent-chat/additional-actions.d.ts +45 -0
- package/dist/server/agent-chat/additional-actions.js +707 -0
- package/dist/server/agent-chat/plugin-options.d.ts +21 -0
- package/dist/server/agent-chat-plugin.js +54 -13
- package/dist/server/better-auth-instance.js +108 -18
- package/dist/server/builder-browser.d.ts +4 -2
- package/dist/server/builder-browser.js +21 -16
- package/dist/server/index.d.ts +2 -1
- package/dist/server/index.js +1 -1
- package/dist/shared/data-url.d.ts +2 -0
- package/dist/shared/data-url.js +12 -0
- package/dist/templates/workspace-core/.agents/skills/turn-into-app/references/attachments.md +1 -3
- package/dist/templates/workspace-core/.agents/skills/turn-into-app/references/fresh-project.md +13 -8
- package/dist/templates/workspace-core/.agents/skills/turn-into-app/references/source-brief.md +2 -2
- package/dist/triggers/actions/manage-automation.d.ts +5 -5
- package/docs/content/agent-surfaces.mdx +61 -0
- package/docs/content/observability.mdx +2 -0
- package/package.json +5 -4
- package/src/templates/workspace-core/.agents/skills/turn-into-app/references/attachments.md +1 -3
- package/src/templates/workspace-core/.agents/skills/turn-into-app/references/fresh-project.md +13 -8
- package/src/templates/workspace-core/.agents/skills/turn-into-app/references/source-brief.md +2 -2
|
@@ -27,43 +27,43 @@ export declare function createObservabilityHandler(): import("h3").EventHandlerW
|
|
|
27
27
|
thumbsUpRate: number;
|
|
28
28
|
avgEvalScore: number;
|
|
29
29
|
} | {
|
|
30
|
-
ok?: undefined;
|
|
31
30
|
error: string;
|
|
32
31
|
message: string;
|
|
33
32
|
summary?: undefined;
|
|
34
33
|
spans?: undefined;
|
|
35
|
-
} | {
|
|
36
|
-
error?: undefined;
|
|
37
34
|
ok?: undefined;
|
|
35
|
+
} | {
|
|
38
36
|
message?: undefined;
|
|
39
37
|
summary: import("./types.js").TraceSummary;
|
|
40
38
|
spans: import("./types.js").TraceSpan[];
|
|
41
|
-
} | {
|
|
42
39
|
error?: undefined;
|
|
43
40
|
ok?: undefined;
|
|
41
|
+
} | {
|
|
44
42
|
message?: undefined;
|
|
45
43
|
summary?: undefined;
|
|
46
44
|
spans?: undefined;
|
|
47
45
|
traceMissing: true;
|
|
48
46
|
id: string;
|
|
49
|
-
} | {
|
|
50
47
|
error?: undefined;
|
|
51
48
|
ok?: undefined;
|
|
49
|
+
} | {
|
|
52
50
|
message?: undefined;
|
|
53
51
|
summary?: undefined;
|
|
54
52
|
spans?: undefined;
|
|
55
53
|
traceMissing?: undefined;
|
|
56
54
|
id: string;
|
|
57
|
-
|
|
55
|
+
error?: undefined;
|
|
58
56
|
ok?: undefined;
|
|
57
|
+
} | {
|
|
59
58
|
message?: undefined;
|
|
60
59
|
summary?: undefined;
|
|
61
60
|
spans?: undefined;
|
|
62
61
|
error: any;
|
|
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
|
}>>;
|
|
@@ -523,7 +523,7 @@ export async function instrumentAgentLoop(opts) {
|
|
|
523
523
|
finishOtelModelSpan(tripIndex, {
|
|
524
524
|
status: modelCallFailed ? "error" : "success",
|
|
525
525
|
errorMessage: modelErrorMessage,
|
|
526
|
-
errorCode: finalErrorCode,
|
|
526
|
+
errorCode: trip?.errorCode ?? finalErrorCode,
|
|
527
527
|
attributes: modelSpanAttributes(tripIndex),
|
|
528
528
|
endTime: modelRoundTrips[tripIndex]?.end,
|
|
529
529
|
});
|
|
@@ -646,6 +646,8 @@ export async function instrumentAgentLoop(opts) {
|
|
|
646
646
|
trip.end = end;
|
|
647
647
|
if (event.reason)
|
|
648
648
|
trip.stopReason = event.reason;
|
|
649
|
+
if (event.errorCode)
|
|
650
|
+
trip.errorCode = event.errorCode;
|
|
649
651
|
}
|
|
650
652
|
if (event.reason === undefined || event.reason === "error") {
|
|
651
653
|
modelSpansAwaitingFinalError.add(tripIndex);
|
|
@@ -1362,6 +1364,11 @@ export async function instrumentAgentLoop(opts) {
|
|
|
1362
1364
|
failed: tripIndex === interruptedModelRoundTrip ||
|
|
1363
1365
|
!trip.stopReason ||
|
|
1364
1366
|
trip.stopReason === "error",
|
|
1367
|
+
// Only the last call's failure can be the one that ended the run.
|
|
1368
|
+
errorCode: trip.errorCode ??
|
|
1369
|
+
(tripIndex === modelRoundTrips.length - 1
|
|
1370
|
+
? runTerminalCode
|
|
1371
|
+
: undefined),
|
|
1365
1372
|
inputTokens: trip.usage?.inputTokens,
|
|
1366
1373
|
outputTokens: trip.usage?.outputTokens,
|
|
1367
1374
|
});
|
|
@@ -75,10 +75,10 @@ export declare function createCustomProviderRegistrationAction<TSchema extends Z
|
|
|
75
75
|
user: "user";
|
|
76
76
|
}>>;
|
|
77
77
|
}, z.core.$strip>>, {
|
|
78
|
+
id?: undefined;
|
|
78
79
|
provider?: undefined;
|
|
79
80
|
deleted?: undefined;
|
|
80
|
-
|
|
81
|
-
found?: undefined;
|
|
81
|
+
message?: undefined;
|
|
82
82
|
providers: {
|
|
83
83
|
id: string;
|
|
84
84
|
label: string;
|
|
@@ -89,45 +89,45 @@ export declare function createCustomProviderRegistrationAction<TSchema extends Z
|
|
|
89
89
|
updatedAt: number;
|
|
90
90
|
}[];
|
|
91
91
|
count: number;
|
|
92
|
+
found?: undefined;
|
|
92
93
|
registered?: undefined;
|
|
93
94
|
label?: undefined;
|
|
94
|
-
message?: undefined;
|
|
95
95
|
} | {
|
|
96
|
-
deleted?: undefined;
|
|
97
96
|
id?: undefined;
|
|
98
97
|
count?: undefined;
|
|
98
|
+
deleted?: undefined;
|
|
99
|
+
message?: undefined;
|
|
99
100
|
providers?: undefined;
|
|
100
101
|
found: boolean;
|
|
101
102
|
provider: import("../custom-registry.js").CustomProviderConfig;
|
|
102
103
|
registered?: undefined;
|
|
103
104
|
label?: undefined;
|
|
104
|
-
message?: undefined;
|
|
105
105
|
} | {
|
|
106
106
|
provider?: undefined;
|
|
107
|
-
deleted?: undefined;
|
|
108
107
|
count?: undefined;
|
|
108
|
+
deleted?: undefined;
|
|
109
|
+
message?: undefined;
|
|
109
110
|
providers?: undefined;
|
|
110
111
|
found: boolean;
|
|
111
112
|
id: string;
|
|
112
113
|
registered?: undefined;
|
|
113
114
|
label?: undefined;
|
|
114
|
-
message?: undefined;
|
|
115
115
|
} | {
|
|
116
116
|
provider?: undefined;
|
|
117
117
|
count?: undefined;
|
|
118
|
-
|
|
118
|
+
message?: undefined;
|
|
119
119
|
providers?: undefined;
|
|
120
|
+
found?: undefined;
|
|
120
121
|
deleted: boolean;
|
|
121
122
|
id: string;
|
|
122
123
|
registered?: undefined;
|
|
123
124
|
label?: undefined;
|
|
124
|
-
message?: undefined;
|
|
125
125
|
} | {
|
|
126
126
|
provider?: undefined;
|
|
127
|
-
deleted?: undefined;
|
|
128
127
|
count?: undefined;
|
|
129
|
-
|
|
128
|
+
deleted?: undefined;
|
|
130
129
|
providers?: undefined;
|
|
130
|
+
found?: undefined;
|
|
131
131
|
registered: boolean;
|
|
132
132
|
id: string;
|
|
133
133
|
label: string;
|
|
@@ -311,10 +311,9 @@ export declare function createProviderApiActions(runtime: Pick<ProviderApiRuntim
|
|
|
311
311
|
notes?: string | undefined;
|
|
312
312
|
scope?: "org" | "user" | undefined;
|
|
313
313
|
}, {
|
|
314
|
+
message?: undefined;
|
|
314
315
|
id?: undefined;
|
|
315
316
|
deleted?: undefined;
|
|
316
|
-
message?: undefined;
|
|
317
|
-
found?: undefined;
|
|
318
317
|
providers: {
|
|
319
318
|
id: string;
|
|
320
319
|
label: string;
|
|
@@ -326,44 +325,45 @@ export declare function createProviderApiActions(runtime: Pick<ProviderApiRuntim
|
|
|
326
325
|
}[];
|
|
327
326
|
count: number;
|
|
328
327
|
provider?: undefined;
|
|
328
|
+
found?: undefined;
|
|
329
329
|
registered?: undefined;
|
|
330
330
|
label?: undefined;
|
|
331
331
|
} | {
|
|
332
|
+
message?: undefined;
|
|
332
333
|
id?: undefined;
|
|
333
334
|
deleted?: undefined;
|
|
334
|
-
count?: undefined;
|
|
335
|
-
message?: undefined;
|
|
336
335
|
providers?: undefined;
|
|
336
|
+
count?: undefined;
|
|
337
337
|
found: boolean;
|
|
338
338
|
provider: import("../custom-registry.js").CustomProviderConfig;
|
|
339
339
|
registered?: undefined;
|
|
340
340
|
label?: undefined;
|
|
341
341
|
} | {
|
|
342
|
-
deleted?: undefined;
|
|
343
|
-
count?: undefined;
|
|
344
342
|
message?: undefined;
|
|
343
|
+
deleted?: undefined;
|
|
345
344
|
providers?: undefined;
|
|
345
|
+
count?: undefined;
|
|
346
346
|
provider?: undefined;
|
|
347
347
|
found: boolean;
|
|
348
348
|
id: string;
|
|
349
349
|
registered?: undefined;
|
|
350
350
|
label?: undefined;
|
|
351
351
|
} | {
|
|
352
|
-
count?: undefined;
|
|
353
352
|
message?: undefined;
|
|
354
|
-
found?: undefined;
|
|
355
353
|
providers?: undefined;
|
|
354
|
+
count?: undefined;
|
|
356
355
|
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
|
-
count?: undefined;
|
|
364
|
-
found?: undefined;
|
|
365
363
|
providers?: undefined;
|
|
364
|
+
count?: undefined;
|
|
366
365
|
provider?: undefined;
|
|
366
|
+
found?: undefined;
|
|
367
367
|
registered: boolean;
|
|
368
368
|
id: string;
|
|
369
369
|
label: string;
|
|
@@ -39,8 +39,8 @@ export declare function handleUpdateResource(event: any): Promise<import("./stor
|
|
|
39
39
|
error: string;
|
|
40
40
|
}>;
|
|
41
41
|
export declare function handleDeleteResource(event: any): Promise<{
|
|
42
|
-
ok?: undefined;
|
|
43
42
|
error: string;
|
|
43
|
+
ok?: undefined;
|
|
44
44
|
} | {
|
|
45
45
|
error?: undefined;
|
|
46
46
|
ok: boolean;
|
package/dist/secrets/routes.d.ts
CHANGED
|
@@ -57,39 +57,39 @@ export declare function createWriteSecretHandler(): import("h3").EventHandlerWit
|
|
|
57
57
|
} | {
|
|
58
58
|
error: string;
|
|
59
59
|
errorCode?: undefined;
|
|
60
|
-
ok?: undefined;
|
|
61
60
|
status?: undefined;
|
|
61
|
+
ok?: undefined;
|
|
62
62
|
} | {
|
|
63
63
|
error: string;
|
|
64
64
|
errorCode: string;
|
|
65
|
-
ok?: undefined;
|
|
66
65
|
status?: undefined;
|
|
66
|
+
ok?: undefined;
|
|
67
67
|
} | {
|
|
68
|
-
error?: undefined;
|
|
69
68
|
errorCode?: undefined;
|
|
70
69
|
ok: boolean;
|
|
71
70
|
status: string;
|
|
71
|
+
error?: undefined;
|
|
72
72
|
} | {
|
|
73
|
-
ok?: undefined;
|
|
74
73
|
error: string;
|
|
75
74
|
removed?: undefined;
|
|
75
|
+
ok?: undefined;
|
|
76
76
|
} | {
|
|
77
|
-
error?: undefined;
|
|
78
77
|
ok: boolean;
|
|
79
78
|
removed: boolean;
|
|
79
|
+
error?: undefined;
|
|
80
80
|
}>>;
|
|
81
81
|
export declare function createTestSecretHandler(): import("h3").EventHandlerWithFetch<import("h3").EventHandlerRequest, Promise<{
|
|
82
|
-
ok?: undefined;
|
|
83
82
|
error: string;
|
|
84
83
|
note?: undefined;
|
|
84
|
+
ok?: undefined;
|
|
85
85
|
} | {
|
|
86
|
-
error?: undefined;
|
|
87
86
|
ok: boolean;
|
|
88
87
|
note?: undefined;
|
|
89
|
-
} | {
|
|
90
88
|
error?: undefined;
|
|
89
|
+
} | {
|
|
91
90
|
ok: boolean;
|
|
92
91
|
note: string;
|
|
92
|
+
error?: undefined;
|
|
93
93
|
} | {
|
|
94
94
|
note?: undefined;
|
|
95
95
|
ok: boolean;
|
|
@@ -117,11 +117,11 @@ export declare function createAdHocSecretHandler(): import("h3").EventHandlerWit
|
|
|
117
117
|
} | {
|
|
118
118
|
error: string;
|
|
119
119
|
} | {
|
|
120
|
-
error?: undefined;
|
|
121
120
|
ok: boolean;
|
|
122
121
|
key: string;
|
|
123
|
-
} | {
|
|
124
122
|
error?: undefined;
|
|
123
|
+
} | {
|
|
125
124
|
ok: boolean;
|
|
126
125
|
removed: boolean;
|
|
126
|
+
error?: undefined;
|
|
127
127
|
}>>;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { ActionEntry } from "../../agent/production-agent.js";
|
|
2
|
+
/**
|
|
3
|
+
* The agent loop a request runs on: interactive chat (production or dev), an
|
|
4
|
+
* A2A task, or an MCP `ask_app` call.
|
|
5
|
+
*/
|
|
6
|
+
export type AgentChatAdditionalActionsSurface = "chat" | "a2a" | "mcp";
|
|
7
|
+
/** Surfaces an app must opt into before its additional actions reach them. */
|
|
8
|
+
export type AgentChatAdditionalActionsExternalSurface = Exclude<AgentChatAdditionalActionsSurface, "chat">;
|
|
9
|
+
export interface AgentChatAdditionalActionsDetails {
|
|
10
|
+
surface: AgentChatAdditionalActionsSurface;
|
|
11
|
+
/** The H3 event. Absent for `mcp`, which runs outside a chat handler. */
|
|
12
|
+
event?: any;
|
|
13
|
+
ownerEmail: string;
|
|
14
|
+
orgId: string | null;
|
|
15
|
+
}
|
|
16
|
+
export type ResolveAgentChatAdditionalActions = (details: AgentChatAdditionalActionsDetails) => Record<string, ActionEntry> | Promise<Record<string, ActionEntry>>;
|
|
17
|
+
export interface AppAdditionalActionsConfig {
|
|
18
|
+
resolver: ResolveAgentChatAdditionalActions | undefined;
|
|
19
|
+
/** Surfaces besides chat the app opted into. */
|
|
20
|
+
externalSurfaces: readonly AgentChatAdditionalActionsExternalSurface[];
|
|
21
|
+
/**
|
|
22
|
+
* True for every name any surface can dispatch to a framework, template, or
|
|
23
|
+
* dev implementation, including names the current surface leaves out.
|
|
24
|
+
*/
|
|
25
|
+
isReservedName: (name: string) => boolean;
|
|
26
|
+
}
|
|
27
|
+
export declare function normalizeAdditionalActionSurfaces(surfaces: readonly string[] | undefined): AgentChatAdditionalActionsExternalSurface[];
|
|
28
|
+
/**
|
|
29
|
+
* Runs the app's `resolveAdditionalActions` once for one request and returns
|
|
30
|
+
* the entries that may join that request's registry.
|
|
31
|
+
*
|
|
32
|
+
* Everything the app returns is untrusted: it may carry names, descriptions,
|
|
33
|
+
* and schemas a user registered. An entry is dropped (and reported once) when
|
|
34
|
+
* its name is malformed or reserved, when it is an `mcp__` name this caller
|
|
35
|
+
* cannot see, or when its tool definition is unusable. Each kept entry is bound
|
|
36
|
+
* to the caller it was resolved for and its `run` is wrapped so every call,
|
|
37
|
+
* from any dispatcher, rechecks that caller, enforces the entry's `access`
|
|
38
|
+
* policy, and validates the arguments against its schema without coercion.
|
|
39
|
+
*/
|
|
40
|
+
export declare function resolveAppAdditionalActions(config: AppAdditionalActionsConfig, details: {
|
|
41
|
+
surface: AgentChatAdditionalActionsSurface;
|
|
42
|
+
event?: any;
|
|
43
|
+
ownerEmail: string | null | undefined;
|
|
44
|
+
orgId: string | null | undefined;
|
|
45
|
+
}, registered: Record<string, ActionEntry>): Promise<Record<string, ActionEntry>>;
|