@agent-native/core 0.232.0 → 0.233.0-nightly-20261124004026
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/a2a/handlers.js +60 -1
- package/dist/a2a/server.js +9 -0
- package/dist/action-call-classification.d.ts +9 -0
- package/dist/action-call-classification.js +18 -0
- package/dist/action-conformance.d.ts +81 -0
- package/dist/action-conformance.js +392 -0
- package/dist/action.d.ts +18 -0
- package/dist/action.js +68 -5
- package/dist/agent/execution-fence.d.ts +3 -1
- package/dist/agent/execution-fence.js +13 -2
- package/dist/agent/production-agent.d.ts +3 -0
- package/dist/agent/production-agent.js +301 -145
- package/dist/agent/run-store.js +11 -0
- package/dist/agent/thread-data-builder.d.ts +2 -0
- package/dist/agent/thread-data-builder.js +5 -1
- package/dist/app-config/schema.d.ts +24 -1
- package/dist/application-state/handlers.d.ts +1 -1
- package/dist/application-state/navigate-write-guard.d.ts +4 -1
- package/dist/application-state/navigate-write-guard.js +15 -1
- package/dist/cli/design-connect.js +5 -1
- package/dist/cli/matched-check.d.ts +1 -0
- package/dist/cli/matched-check.js +76 -0
- package/dist/client/agent-chat/index.d.ts +1 -1
- package/dist/client/agent-chat/index.js +1 -1
- package/dist/client/analytics/index.d.ts +1 -1
- package/dist/client/analytics.d.ts +13 -1
- package/dist/client/analytics.js +5 -2
- package/dist/client/application-state.d.ts +11 -0
- package/dist/client/application-state.js +219 -23
- package/dist/client/chat/agentkit-agent-native.js +52 -11
- package/dist/client/chat/agentkit-protocol.js +23 -2
- package/dist/client/chat-first-state.d.ts +6 -0
- package/dist/client/chat-first-state.js +36 -1
- package/dist/client/feature-flags/use-feature-flag.js +14 -6
- package/dist/client/navigation/index.d.ts +2 -0
- package/dist/client/navigation/index.js +2 -0
- package/dist/client/route-state.js +60 -18
- package/dist/client/screen-settled.d.ts +71 -1
- package/dist/client/screen-settled.js +221 -3
- package/dist/client/sse-event-processor.d.ts +1 -0
- package/dist/client/sse-event-processor.js +89 -10
- package/dist/client/theme.d.ts +6 -0
- package/dist/client/theme.js +7 -1
- package/dist/client/use-action.js +32 -10
- package/dist/client/use-session.js +36 -18
- package/dist/collab/struct-routes.d.ts +1 -1
- package/dist/db/client.js +2 -2
- package/dist/db/errors.d.ts +2 -0
- package/dist/db/errors.js +38 -6
- package/dist/feature-flags/actions/get-feature-flags.js +9 -2
- package/dist/file-upload/actions/upload-image.d.ts +2 -2
- package/dist/framework-package-versions.json +8 -8
- package/dist/ingestion/index.d.ts +1 -0
- package/dist/ingestion/index.js +1 -0
- package/dist/ingestion/matched-capture.d.ts +173 -0
- package/dist/ingestion/matched-capture.js +574 -0
- package/dist/ingestion/pptx.d.ts +1 -0
- package/dist/ingestion/pptx.js +4 -2
- package/dist/labs/store.d.ts +3 -1
- package/dist/labs/store.js +8 -4
- package/dist/manifest/index.d.ts +142 -3
- package/dist/manifest/index.js +249 -19
- package/dist/mcp/build-server.d.ts +2 -0
- package/dist/mcp/build-server.js +8 -1
- package/dist/mcp/server.js +3 -1
- package/dist/notifications/routes.d.ts +3 -3
- package/dist/observability/metrics.d.ts +2 -0
- package/dist/observability/metrics.js +7 -0
- package/dist/org/index.d.ts +1 -1
- package/dist/provider-api/actions/custom-provider-registration.d.ts +10 -10
- package/dist/provider-api/actions/provider-api.d.ts +14 -14
- package/dist/server/action-routes.js +9 -0
- package/dist/server/agent-chat/prompt-resources.js +107 -83
- package/dist/server/agent-run-context.d.ts +3 -0
- package/dist/server/agent-run-context.js +7 -0
- package/dist/server/builder-oauth.d.ts +1 -0
- package/dist/server/builder-oauth.js +40 -2
- package/dist/server/filesystem-action-entry.js +5 -0
- package/dist/server/first-touch-route.d.ts +2 -2
- package/dist/server/index.d.ts +2 -2
- package/dist/server/index.js +2 -2
- package/dist/server/open-route.js +10 -4
- package/dist/server/poll.d.ts +3 -0
- package/dist/server/poll.js +74 -14
- package/dist/server/request-context.d.ts +16 -6
- package/dist/server/request-context.js +4 -0
- package/dist/server/transcribe-voice.d.ts +1 -1
- package/dist/shared/analytics-events.d.ts +7 -0
- package/dist/shared/viewport-mode.d.ts +2 -0
- package/dist/shared/viewport-mode.js +9 -0
- package/dist/templates/chat/.agents/skills/actions/SKILL.md +1 -0
- package/dist/templates/chat/.agents/skills/build-an-app/SKILL.md +38 -17
- package/dist/templates/chat/.agents/skills/shadcn-ui/SKILL.md +3 -2
- package/dist/templates/default/.agents/skills/actions/SKILL.md +1 -0
- package/dist/templates/default/.agents/skills/build-an-app/SKILL.md +38 -17
- package/dist/templates/default/.agents/skills/shadcn-ui/SKILL.md +3 -2
- package/dist/templates/factory/.agents/skills/review-latest-feedback/SKILL.md +3 -2
- package/dist/templates/headless/.agents/skills/actions/SKILL.md +1 -0
- package/dist/templates/workspace-core/.agents/skills/actions/SKILL.md +1 -0
- package/dist/templates/workspace-core/.agents/skills/build-an-app/SKILL.md +38 -17
- package/dist/templates/workspace-core/.agents/skills/shadcn-ui/SKILL.md +3 -2
- package/dist/testing.d.ts +1 -0
- package/dist/testing.js +1 -0
- package/dist/tracking/action-lifecycle.d.ts +2 -0
- package/dist/tracking/action-lifecycle.js +16 -5
- package/docs/content/actions-defining.mdx +7 -0
- package/docs/content/custom-design-system.mdx +4 -2
- package/package.json +3 -3
- package/src/templates/chat/.agents/skills/actions/SKILL.md +1 -0
- package/src/templates/chat/.agents/skills/build-an-app/SKILL.md +38 -17
- package/src/templates/chat/.agents/skills/shadcn-ui/SKILL.md +3 -2
- package/src/templates/default/.agents/skills/actions/SKILL.md +1 -0
- package/src/templates/default/.agents/skills/build-an-app/SKILL.md +38 -17
- package/src/templates/default/.agents/skills/shadcn-ui/SKILL.md +3 -2
- package/src/templates/factory/.agents/skills/review-latest-feedback/SKILL.md +3 -2
- package/src/templates/headless/.agents/skills/actions/SKILL.md +1 -0
- package/src/templates/workspace-core/.agents/skills/actions/SKILL.md +1 -0
- package/src/templates/workspace-core/.agents/skills/build-an-app/SKILL.md +38 -17
- package/src/templates/workspace-core/.agents/skills/shadcn-ui/SKILL.md +3 -2
package/dist/agent/run-store.js
CHANGED
|
@@ -2567,6 +2567,17 @@ async function reapSingleStaleRun(runId, source, maxStaleMs) {
|
|
|
2567
2567
|
if (lease?.isLive && generationMatches) {
|
|
2568
2568
|
return { reaped: false, outcome: null };
|
|
2569
2569
|
}
|
|
2570
|
+
if (typeof maxStaleMs !== "number" &&
|
|
2571
|
+
lease &&
|
|
2572
|
+
generationMatches &&
|
|
2573
|
+
(await ownsLapsedTurnLease(tx, {
|
|
2574
|
+
threadId: runScope.thread_id,
|
|
2575
|
+
turnId: runScope.turn_id,
|
|
2576
|
+
runId,
|
|
2577
|
+
generation: lease.generation,
|
|
2578
|
+
}, { lapsedWithinMs: TURN_EXECUTION_LEASE_MS }))) {
|
|
2579
|
+
return { reaped: false, outcome: null };
|
|
2580
|
+
}
|
|
2570
2581
|
const repaired = await reconcileTerminalRunInRecoveryTransaction(tx, runId);
|
|
2571
2582
|
if (repaired) {
|
|
2572
2583
|
if (generationMatches && lease) {
|
|
@@ -92,11 +92,13 @@ export declare function buildSteeredUserMessage(message: AgentChatSteeredUserMes
|
|
|
92
92
|
export declare function normalizeThreadRepository(repo: any): any;
|
|
93
93
|
export interface ThreadDataToEngineMessagesOptions {
|
|
94
94
|
includeToolCalls?: boolean;
|
|
95
|
+
excludeSubmittedTurnId?: string;
|
|
95
96
|
}
|
|
96
97
|
export declare function threadDataToEngineMessages(threadData: unknown, options?: ThreadDataToEngineMessagesOptions): EngineMessage[];
|
|
97
98
|
export declare function recoverThreadHistoryForRequest(threadData: string | Record<string, unknown> | null | undefined, limits?: {
|
|
98
99
|
maxMessages?: number;
|
|
99
100
|
maxChars?: number;
|
|
101
|
+
excludeSubmittedTurnId?: string;
|
|
100
102
|
}): EngineMessage[];
|
|
101
103
|
/**
|
|
102
104
|
* History for resuming a stopped turn: earlier turns get the recovery window,
|
|
@@ -1164,6 +1164,10 @@ export function threadDataToEngineMessages(threadData, options = {}) {
|
|
|
1164
1164
|
const m = entry?.message ?? entry;
|
|
1165
1165
|
if (!m || (m.role !== "user" && m.role !== "assistant"))
|
|
1166
1166
|
continue;
|
|
1167
|
+
if (m.role === "user" &&
|
|
1168
|
+
options.excludeSubmittedTurnId &&
|
|
1169
|
+
m.metadata?.custom?.submittedTurnId === options.excludeSubmittedTurnId)
|
|
1170
|
+
continue;
|
|
1167
1171
|
if (m.omitFromPersistedHistory === true) {
|
|
1168
1172
|
messages.push({
|
|
1169
1173
|
role: m.role,
|
|
@@ -1227,7 +1231,7 @@ function boundedHistoryWindow(messages, limits) {
|
|
|
1227
1231
|
return window;
|
|
1228
1232
|
}
|
|
1229
1233
|
export function recoverThreadHistoryForRequest(threadData, limits) {
|
|
1230
|
-
return boundedHistoryWindow(threadDataToEngineMessages(threadData), limits);
|
|
1234
|
+
return boundedHistoryWindow(threadDataToEngineMessages(threadData, limits), limits);
|
|
1231
1235
|
}
|
|
1232
1236
|
/**
|
|
1233
1237
|
* History for resuming a stopped turn: earlier turns get the recovery window,
|
|
@@ -64,16 +64,39 @@ export declare const nativeManifestSchema: z.ZodObject<{
|
|
|
64
64
|
export type NativeManifest = z.infer<typeof nativeManifestSchema>;
|
|
65
65
|
export declare const appConfigSchema: z.ZodObject<{
|
|
66
66
|
manifest: z.ZodOptional<z.ZodPreprocess<z.ZodObject<{
|
|
67
|
-
version: z.ZodLiteral<1>;
|
|
67
|
+
version: z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<2>]>;
|
|
68
68
|
screens: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
69
69
|
route: z.ZodString;
|
|
70
70
|
action: z.ZodString;
|
|
71
|
+
params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
72
|
+
supportsViewOverlay: z.ZodOptional<z.ZodBoolean>;
|
|
71
73
|
}, z.core.$strip>>>;
|
|
72
74
|
suggestions: z.ZodOptional<z.ZodRecord<z.ZodEnum<{
|
|
73
75
|
"ai-split-filter": "ai-split-filter";
|
|
74
76
|
automation: "automation";
|
|
75
77
|
"saved-view": "saved-view";
|
|
76
78
|
}> & z.core.$partial, z.ZodString>>;
|
|
79
|
+
entities: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
80
|
+
screen: z.ZodOptional<z.ZodString>;
|
|
81
|
+
route: z.ZodOptional<z.ZodString>;
|
|
82
|
+
idParam: z.ZodOptional<z.ZodString>;
|
|
83
|
+
label: z.ZodOptional<z.ZodString>;
|
|
84
|
+
}, z.core.$strip>>>;
|
|
85
|
+
viewPolicy: z.ZodOptional<z.ZodObject<{
|
|
86
|
+
defaultMode: z.ZodOptional<z.ZodEnum<{
|
|
87
|
+
keep: "keep";
|
|
88
|
+
open: "open";
|
|
89
|
+
reveal: "reveal";
|
|
90
|
+
}>>;
|
|
91
|
+
allowBackgroundNavigation: z.ZodOptional<z.ZodBoolean>;
|
|
92
|
+
fallbackScreen: z.ZodOptional<z.ZodString>;
|
|
93
|
+
}, z.core.$strip>>;
|
|
94
|
+
suggestableCapabilities: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
95
|
+
type: z.ZodString;
|
|
96
|
+
action: z.ZodString;
|
|
97
|
+
description: z.ZodOptional<z.ZodString>;
|
|
98
|
+
}, z.core.$strip>>>;
|
|
99
|
+
supportsViewOverlay: z.ZodOptional<z.ZodBoolean>;
|
|
77
100
|
}, z.core.$strip>>>;
|
|
78
101
|
a2a: z.ZodPrefault<z.ZodObject<{
|
|
79
102
|
allowedOrigins: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
@@ -42,11 +42,11 @@ export declare const saveComposeDraft: import("h3").EventHandlerWithFetch<import
|
|
|
42
42
|
errorCode?: undefined;
|
|
43
43
|
details?: undefined;
|
|
44
44
|
} | {
|
|
45
|
+
error?: undefined;
|
|
45
46
|
value: {
|
|
46
47
|
id: string;
|
|
47
48
|
};
|
|
48
49
|
revision: string;
|
|
49
|
-
error?: undefined;
|
|
50
50
|
errorCode?: undefined;
|
|
51
51
|
details?: undefined;
|
|
52
52
|
} | {
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import type { ViewportMode } from "../shared/viewport-mode.js";
|
|
2
|
+
/** Registers a runtime probe that reports the current request's viewport mode without importing server modules into browser bundles. */
|
|
3
|
+
export declare function registerViewportModeProbe(probe: () => ViewportMode | undefined): void;
|
|
1
4
|
/**
|
|
2
5
|
* The one intent that lets an agent open a view: the user asked to see it.
|
|
3
6
|
* Agents (built-in chat, MCP, WebMCP, A2A) leave the user's view alone
|
|
@@ -5,7 +8,7 @@
|
|
|
5
8
|
*/
|
|
6
9
|
export declare const NAVIGATION_OPEN_INTENT: "open";
|
|
7
10
|
export type NavigationIntent = typeof NAVIGATION_OPEN_INTENT;
|
|
8
|
-
export type AgentNavigationKeptReason = "detail-requires-open-intent" | "write-keeps-view" | "navigation-mode-keep";
|
|
11
|
+
export type AgentNavigationKeptReason = "detail-requires-open-intent" | "write-keeps-view" | "navigation-mode-keep" | "background-viewport-locked";
|
|
9
12
|
export type AgentNavigationRefusalReason = "read-only-action" | AgentNavigationKeptReason;
|
|
10
13
|
export interface AgentNavigationKeptResult {
|
|
11
14
|
kept: true;
|
|
@@ -2,6 +2,11 @@ import { isAgentCaller } from "../action-caller.js";
|
|
|
2
2
|
import { currentActionAllowsAgentNavigation, currentActionNavigationIntent, currentActionOriginCaller, hasObservedWriteInActionChain, insideParentWriteAction, insideReadOnlyAction, insideWriteAction, isStandaloneNavigateAction, } from "../action-frame.js";
|
|
3
3
|
import { getAppConfig } from "../app-config/index.js";
|
|
4
4
|
import { getAsyncLocalStorageCtor } from "../shared/optional-node-builtins.js";
|
|
5
|
+
let viewportModeProbe;
|
|
6
|
+
/** Registers a runtime probe that reports the current request's viewport mode without importing server modules into browser bundles. */
|
|
7
|
+
export function registerViewportModeProbe(probe) {
|
|
8
|
+
viewportModeProbe = probe;
|
|
9
|
+
}
|
|
5
10
|
/**
|
|
6
11
|
* The one intent that lets an agent open a view: the user asked to see it.
|
|
7
12
|
* Agents (built-in chat, MCP, WebMCP, A2A) leave the user's view alone
|
|
@@ -53,7 +58,9 @@ export function buildAgentNavigationKeptResult(reason, currentView = null) {
|
|
|
53
58
|
: "Kept the user's current view";
|
|
54
59
|
const detailClause = reason === "write-keeps-view"
|
|
55
60
|
? "after agent writes"
|
|
56
|
-
:
|
|
61
|
+
: reason === "background-viewport-locked"
|
|
62
|
+
? "during a background viewport request"
|
|
63
|
+
: "instead of opening the item";
|
|
57
64
|
return {
|
|
58
65
|
kept: true,
|
|
59
66
|
navigated: false,
|
|
@@ -187,6 +194,10 @@ export function navigationKeyForCommandKey(key) {
|
|
|
187
194
|
}
|
|
188
195
|
return null;
|
|
189
196
|
}
|
|
197
|
+
const BACKGROUND_VIEWPORT_REFUSAL = {
|
|
198
|
+
reason: "background-viewport-locked",
|
|
199
|
+
message: "Refused: background viewport requests cannot navigate the foreground app view.",
|
|
200
|
+
};
|
|
190
201
|
const READ_ONLY_REFUSAL = {
|
|
191
202
|
reason: "read-only-action",
|
|
192
203
|
message: 'Refused: a read-only action cannot move the user\'s view. Read the data and answer; call navigate with intent: "open" only if the user asked to see it.',
|
|
@@ -211,6 +222,9 @@ const DETAIL_REQUIRES_OPEN_REFUSAL = {
|
|
|
211
222
|
* and after an observed write.
|
|
212
223
|
*/
|
|
213
224
|
export function evaluateAgentNavigationPolicy(navigation, options = {}) {
|
|
225
|
+
if (viewportModeProbe?.() === "background") {
|
|
226
|
+
return BACKGROUND_VIEWPORT_REFUSAL;
|
|
227
|
+
}
|
|
214
228
|
const originCaller = currentActionOriginCaller() ?? options.caller;
|
|
215
229
|
const mode = options.intent ??
|
|
216
230
|
navigation?.navigationMode ??
|
|
@@ -11,6 +11,7 @@ import { WebSocket, WebSocketServer } from "ws";
|
|
|
11
11
|
import { createLocalhostBridgeAudience, LOCALHOST_BRIDGE_OPERATION_CAPABILITY_FIELD, verifyLocalhostBridgeOperationCapability, } from "../server/visual-edit-bridge-capability.js";
|
|
12
12
|
import { injectDocumentMarkup } from "../shared/html-document.js";
|
|
13
13
|
import { fetchDesignReferenceCopy, fetchDesignReferenceResource, rewriteReferenceCss, ReferenceCopyError, } from "./design-reference-copy.js";
|
|
14
|
+
import { runMatchedCheckCommand } from "./matched-check.js";
|
|
14
15
|
const DEFAULT_BRIDGE_PORT = 7331;
|
|
15
16
|
const ROUTE_MANIFEST_FILE = path.join(".agent-native", "design-routes.json");
|
|
16
17
|
const BRIDGE_TOKEN_FILE = path.join(".agent-native", "design-bridge-token");
|
|
@@ -4400,6 +4401,9 @@ export async function runDesign(argv) {
|
|
|
4400
4401
|
console.log(JSON.stringify(body.pending ?? null, null, 2));
|
|
4401
4402
|
return 0;
|
|
4402
4403
|
}
|
|
4404
|
+
if (subcommand === "matched-check") {
|
|
4405
|
+
return runMatchedCheckCommand(argv.slice(1));
|
|
4406
|
+
}
|
|
4403
4407
|
if (subcommand !== "connect") {
|
|
4404
4408
|
if (subcommand === "help" ||
|
|
4405
4409
|
subcommand === "--help" ||
|
|
@@ -4407,7 +4411,7 @@ export async function runDesign(argv) {
|
|
|
4407
4411
|
printHelp();
|
|
4408
4412
|
return 0;
|
|
4409
4413
|
}
|
|
4410
|
-
console.error("Usage: agent-native design connect [options] | agent-native design pending [options]");
|
|
4414
|
+
console.error("Usage: agent-native design connect [options] | agent-native design pending [options] | agent-native design matched-check <spec.json> [--out dir]");
|
|
4411
4415
|
return 1;
|
|
4412
4416
|
}
|
|
4413
4417
|
const parsed = parseDesignConnectArgs(argv);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function runMatchedCheckCommand(argv: string[]): Promise<number>;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { randomUUID } from "node:crypto";
|
|
2
|
+
import fs from "node:fs/promises";
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
import { createPlaywrightCapturer, runMatchedCheck, } from "../ingestion/matched-capture.js";
|
|
5
|
+
export async function runMatchedCheckCommand(argv) {
|
|
6
|
+
let specPath;
|
|
7
|
+
let outArg;
|
|
8
|
+
for (let i = 0; i < argv.length; i++) {
|
|
9
|
+
const arg = argv.at(i);
|
|
10
|
+
if (arg === undefined)
|
|
11
|
+
continue;
|
|
12
|
+
if (arg === "--out") {
|
|
13
|
+
outArg = argv[++i];
|
|
14
|
+
if (!outArg || outArg.startsWith("--"))
|
|
15
|
+
throw new Error("--out requires a directory");
|
|
16
|
+
}
|
|
17
|
+
else if (arg.startsWith("--out=")) {
|
|
18
|
+
outArg = arg.slice(6);
|
|
19
|
+
if (!outArg)
|
|
20
|
+
throw new Error("--out requires a directory");
|
|
21
|
+
}
|
|
22
|
+
else if (arg.startsWith("--") || specPath) {
|
|
23
|
+
throw new Error(`Unexpected argument: ${arg}`);
|
|
24
|
+
}
|
|
25
|
+
else
|
|
26
|
+
specPath = arg;
|
|
27
|
+
}
|
|
28
|
+
let outDir = path.resolve(outArg ?? ".tmp/matched-check");
|
|
29
|
+
if (!specPath) {
|
|
30
|
+
console.error("Usage: agent-native design matched-check <spec.json> [--out dir]");
|
|
31
|
+
return 1;
|
|
32
|
+
}
|
|
33
|
+
const spec = JSON.parse(await fs.readFile(specPath, "utf8"));
|
|
34
|
+
await fs.mkdir(outDir, { recursive: true });
|
|
35
|
+
outDir = await fs.realpath(outDir);
|
|
36
|
+
const capturer = createPlaywrightCapturer({
|
|
37
|
+
launchArgs: spec.launchArgs,
|
|
38
|
+
executablePath: spec.executablePath,
|
|
39
|
+
});
|
|
40
|
+
try {
|
|
41
|
+
const report = await runMatchedCheck({
|
|
42
|
+
...spec,
|
|
43
|
+
capture: capturer.capture,
|
|
44
|
+
storeArtifact: async (name, bytes) => {
|
|
45
|
+
const file = path.resolve(outDir, name);
|
|
46
|
+
if (path.dirname(file) !== outDir) {
|
|
47
|
+
throw new Error(`Artifact name "${name}" escapes the output directory.`);
|
|
48
|
+
}
|
|
49
|
+
const temporary = path.join(outDir, `.matched-check-${randomUUID()}`);
|
|
50
|
+
let created = false;
|
|
51
|
+
try {
|
|
52
|
+
await fs.writeFile(temporary, bytes, { flag: "wx" });
|
|
53
|
+
created = true;
|
|
54
|
+
await fs.rename(temporary, file);
|
|
55
|
+
}
|
|
56
|
+
finally {
|
|
57
|
+
if (created)
|
|
58
|
+
await fs.unlink(temporary).catch((error) => {
|
|
59
|
+
if (error.code !== "ENOENT")
|
|
60
|
+
throw error;
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
return file;
|
|
64
|
+
},
|
|
65
|
+
});
|
|
66
|
+
console.log(JSON.stringify(report, null, 2));
|
|
67
|
+
const ok = report.totals.breakpoints > 0 &&
|
|
68
|
+
report.totals.fail === 0 &&
|
|
69
|
+
report.totals.couldNotRun === 0 &&
|
|
70
|
+
report.results.every((r) => r.validity === "valid");
|
|
71
|
+
return ok ? 0 : 2;
|
|
72
|
+
}
|
|
73
|
+
finally {
|
|
74
|
+
await capturer.close();
|
|
75
|
+
}
|
|
76
|
+
}
|
|
@@ -37,7 +37,7 @@ export * from "../chat/agentkit-protocol.js";
|
|
|
37
37
|
export { createAgentNativeAgentKitTransport, type CreateAgentNativeAgentKitTransportOptions, } from "../chat/agentkit-agent-native.js";
|
|
38
38
|
export { trackTurnSubmitted } from "../chat/turn-submitted-telemetry.js";
|
|
39
39
|
export { AGENT_CHAT_RUNNING_EVENT, dispatchAgentChatRunning, resolveAgentChatRunningThreadId, useAgentChatRunningThreads, type AgentChatPresentationPhase, type AgentChatRunningEventDetail, type AgentChatRunningThreadsState, type UseAgentChatRunningThreadsOptions, } from "../use-agent-chat-running-threads.js";
|
|
40
|
-
export { CHAT_FIRST_APP_LAYOUT_STORAGE_KEY, CHAT_FIRST_DEFAULT_APP_IDS, CHAT_FIRST_SURFACE_TABS_STORAGE_KEY, CHAT_FIRST_SURFACE_PANEL_STORAGE_KEY, CHAT_FIRST_SURFACE_WIDTH_DEFAULT, CHAT_FIRST_SURFACE_WIDTH_MIN, clampChatFirstSurfaceWidth, CHAT_FIRST_MODE_STORAGE_KEY, CHAT_FIRST_MODE_CHANGED_EVENT, CHAT_FIRST_OPEN_APP_EVENT, CHAT_FIRST_OPEN_BROWSER_EVENT, CHAT_FIRST_WATCH_SESSION_EVENT, CHAT_FIRST_SURFACE_CATALOG, chatFirstSurfaceTabId, closeChatFirstSessionWatch, emitChatFirstOpenApp, emitChatFirstOpenBrowser, emitChatFirstSessionWatch, getChatFirstSessionWatchStore, getChatFirstSurfaceTabsStore, getChatFirstSurfacePanelStore, orderChatFirstAppIds, readChatFirstAppLayout, resolveChatFirstAppTarget, resolveChatFirstBrowserTarget, resolveChatFirstSessionId, normalizeChatFirstSessionReference, readChatFirstMode, readChatFirstModeState, readChatFirstSurfaceWidth, subscribeChatFirstOpenApp, subscribeChatFirstOpenBrowser, subscribeChatFirstSessionWatch, useChatFirstSessionWatch, useChatFirstSurfaceResize, useChatFirstSurfacePanel, useChatFirstSurfaceTabs, writeChatFirstAppLayout, writeChatFirstMode, writeChatFirstSurfaceWidth, type ChatFirstAppLayoutPreference, type ChatFirstModeReadResult, type ChatFirstAppRegistration, type ChatFirstAppResolution, type ChatFirstAppTarget, type ChatFirstAppSurfacePlacement, type ChatFirstAgentActivity, type ChatFirstAgentActivityStatus, type ChatFirstOpenAppDelivery, type ChatFirstOpenAppDetail, type ChatFirstOpenBrowserDetail, type ChatFirstBrowserResolution, type ChatFirstSessionKind, type ChatFirstSessionReference, type ChatFirstSessionWatchDelivery, type ChatFirstSessionWatchState, type ChatFirstSessionWatchStore, type ChatFirstSurfaceKind, type ChatFirstSurfaceTab, type ChatFirstSurfacePanelState, type ChatFirstSurfacePanelStore, type ChatFirstSurfaceTabsState, type ChatFirstSurfaceTabsStore, } from "../chat-first-state.js";
|
|
40
|
+
export { CHAT_FIRST_APP_LAYOUT_STORAGE_KEY, CHAT_FIRST_DEFAULT_APP_IDS, CHAT_FIRST_SURFACE_TABS_STORAGE_KEY, CHAT_FIRST_SURFACE_PANEL_STORAGE_KEY, CHAT_FIRST_SURFACE_WIDTH_DEFAULT, CHAT_FIRST_SURFACE_WIDTH_MIN, clampChatFirstSurfaceWidth, CHAT_FIRST_MODE_STORAGE_KEY, CHAT_FIRST_MODE_CHANGED_EVENT, CHAT_FIRST_OPEN_APP_EVENT, CHAT_FIRST_OPEN_APP_START_EVENT, CHAT_FIRST_OPEN_BROWSER_EVENT, CHAT_FIRST_WATCH_SESSION_EVENT, CHAT_FIRST_SURFACE_CATALOG, chatFirstSurfaceTabId, closeChatFirstSessionWatch, emitChatFirstOpenApp, emitChatFirstOpenAppStart, emitChatFirstOpenBrowser, emitChatFirstSessionWatch, getChatFirstSessionWatchStore, getChatFirstSurfaceTabsStore, getChatFirstSurfacePanelStore, orderChatFirstAppIds, readChatFirstAppLayout, resolveChatFirstAppTarget, resolveChatFirstBrowserTarget, resolveChatFirstSessionId, normalizeChatFirstSessionReference, readChatFirstMode, readChatFirstModeState, readChatFirstSurfaceWidth, subscribeChatFirstOpenApp, subscribeChatFirstOpenAppStart, subscribeChatFirstOpenBrowser, subscribeChatFirstSessionWatch, useChatFirstSessionWatch, useChatFirstSurfaceResize, useChatFirstSurfacePanel, useChatFirstSurfaceTabs, writeChatFirstAppLayout, writeChatFirstMode, writeChatFirstSurfaceWidth, type ChatFirstAppLayoutPreference, type ChatFirstModeReadResult, type ChatFirstAppRegistration, type ChatFirstAppResolution, type ChatFirstAppTarget, type ChatFirstAppSurfacePlacement, type ChatFirstAgentActivity, type ChatFirstAgentActivityStatus, type ChatFirstOpenAppDelivery, type ChatFirstOpenAppDetail, type ChatFirstOpenBrowserDetail, type ChatFirstBrowserResolution, type ChatFirstSessionKind, type ChatFirstSessionReference, type ChatFirstSessionWatchDelivery, type ChatFirstSessionWatchState, type ChatFirstSessionWatchStore, type ChatFirstSurfaceKind, type ChatFirstSurfaceTab, type ChatFirstSurfacePanelState, type ChatFirstSurfacePanelStore, type ChatFirstSurfaceTabsState, type ChatFirstSurfaceTabsStore, } from "../chat-first-state.js";
|
|
41
41
|
export { useVoiceProviderStatus } from "../voice-provider-status.js";
|
|
42
42
|
export { formatChatErrorText, isProviderAuthenticationError, localizeKnownChatErrorText, NEW_CHAT_ACTION_HREF, } from "../error-format.js";
|
|
43
43
|
export { readAssistantChatComposerContextDraft, readAssistantChatComposerDraft, writeAssistantChatComposerContextDraft, writeAssistantChatComposerDraft, type AssistantChatComposerContextDraft, } from "../chat/composer-draft.js";
|
|
@@ -36,7 +36,7 @@ export * from "../chat/agentkit-protocol.js";
|
|
|
36
36
|
export { createAgentNativeAgentKitTransport, } from "../chat/agentkit-agent-native.js";
|
|
37
37
|
export { trackTurnSubmitted } from "../chat/turn-submitted-telemetry.js";
|
|
38
38
|
export { AGENT_CHAT_RUNNING_EVENT, dispatchAgentChatRunning, resolveAgentChatRunningThreadId, useAgentChatRunningThreads, } from "../use-agent-chat-running-threads.js";
|
|
39
|
-
export { CHAT_FIRST_APP_LAYOUT_STORAGE_KEY, CHAT_FIRST_DEFAULT_APP_IDS, CHAT_FIRST_SURFACE_TABS_STORAGE_KEY, CHAT_FIRST_SURFACE_PANEL_STORAGE_KEY, CHAT_FIRST_SURFACE_WIDTH_DEFAULT, CHAT_FIRST_SURFACE_WIDTH_MIN, clampChatFirstSurfaceWidth, CHAT_FIRST_MODE_STORAGE_KEY, CHAT_FIRST_MODE_CHANGED_EVENT, CHAT_FIRST_OPEN_APP_EVENT, CHAT_FIRST_OPEN_BROWSER_EVENT, CHAT_FIRST_WATCH_SESSION_EVENT, CHAT_FIRST_SURFACE_CATALOG, chatFirstSurfaceTabId, closeChatFirstSessionWatch, emitChatFirstOpenApp, emitChatFirstOpenBrowser, emitChatFirstSessionWatch, getChatFirstSessionWatchStore, getChatFirstSurfaceTabsStore, getChatFirstSurfacePanelStore, orderChatFirstAppIds, readChatFirstAppLayout, resolveChatFirstAppTarget, resolveChatFirstBrowserTarget, resolveChatFirstSessionId, normalizeChatFirstSessionReference, readChatFirstMode, readChatFirstModeState, readChatFirstSurfaceWidth, subscribeChatFirstOpenApp, subscribeChatFirstOpenBrowser, subscribeChatFirstSessionWatch, useChatFirstSessionWatch, useChatFirstSurfaceResize, useChatFirstSurfacePanel, useChatFirstSurfaceTabs, writeChatFirstAppLayout, writeChatFirstMode, writeChatFirstSurfaceWidth, } from "../chat-first-state.js";
|
|
39
|
+
export { CHAT_FIRST_APP_LAYOUT_STORAGE_KEY, CHAT_FIRST_DEFAULT_APP_IDS, CHAT_FIRST_SURFACE_TABS_STORAGE_KEY, CHAT_FIRST_SURFACE_PANEL_STORAGE_KEY, CHAT_FIRST_SURFACE_WIDTH_DEFAULT, CHAT_FIRST_SURFACE_WIDTH_MIN, clampChatFirstSurfaceWidth, CHAT_FIRST_MODE_STORAGE_KEY, CHAT_FIRST_MODE_CHANGED_EVENT, CHAT_FIRST_OPEN_APP_EVENT, CHAT_FIRST_OPEN_APP_START_EVENT, CHAT_FIRST_OPEN_BROWSER_EVENT, CHAT_FIRST_WATCH_SESSION_EVENT, CHAT_FIRST_SURFACE_CATALOG, chatFirstSurfaceTabId, closeChatFirstSessionWatch, emitChatFirstOpenApp, emitChatFirstOpenAppStart, emitChatFirstOpenBrowser, emitChatFirstSessionWatch, getChatFirstSessionWatchStore, getChatFirstSurfaceTabsStore, getChatFirstSurfacePanelStore, orderChatFirstAppIds, readChatFirstAppLayout, resolveChatFirstAppTarget, resolveChatFirstBrowserTarget, resolveChatFirstSessionId, normalizeChatFirstSessionReference, readChatFirstMode, readChatFirstModeState, readChatFirstSurfaceWidth, subscribeChatFirstOpenApp, subscribeChatFirstOpenAppStart, subscribeChatFirstOpenBrowser, subscribeChatFirstSessionWatch, useChatFirstSessionWatch, useChatFirstSurfaceResize, useChatFirstSurfacePanel, useChatFirstSurfaceTabs, writeChatFirstAppLayout, writeChatFirstMode, writeChatFirstSurfaceWidth, } from "../chat-first-state.js";
|
|
40
40
|
export { useVoiceProviderStatus } from "../voice-provider-status.js";
|
|
41
41
|
export { formatChatErrorText, isProviderAuthenticationError, localizeKnownChatErrorText, NEW_CHAT_ACTION_HREF, } from "../error-format.js";
|
|
42
42
|
export { readAssistantChatComposerContextDraft, readAssistantChatComposerDraft, writeAssistantChatComposerContextDraft, writeAssistantChatComposerDraft, } from "../chat/composer-draft.js";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { AGENT_NATIVE_EXCEPTION_EVENT_NAME, addErrorBreadcrumb, captureAttribution, captureClientException, captureError, captureException, captureMessage, clearAnalyticsSessionId, configureTracking, getAnalyticsAnonymousId, isAgentNativeAnalyticsConfigured, getAnalyticsSessionId, getFirstTouchAttribution, getLastTouchAttribution, getSessionReplayContext, getSessionReplayUrl, isErrorCaptureInstalled, maybeStartSessionReplay, scrubUrl, setAnalyticsSessionId, setSentryUser, setTrackingContentCaptureEnabled, setTrackingIdentity, startSessionReplay, stopSessionReplay, trackAgentChatLifecycle, trackAnonymousEvent, trackEvent, trackLifecycleEvent, trackSessionStatus, type AgentChatLifecycleEvent, type CaptureAttributionOptions, type CaptureExceptionContext, type CapturedExceptionEvent, type ClientCaptureContext, type ConfigureTrackingOptions, type ErrorCaptureConfigOptions, type ExceptionBreadcrumb, type ExceptionLevel, type FirstTouchAttribution, type LastTouchAttribution, type SessionReplayContext, type SessionReplayLinkOptions, type SessionReplayOptions, type SessionReplayStartResult, type SessionReplayUrlMatcher, type TrackingIdentityUser, } from "../analytics.js";
|
|
1
|
+
export { AGENT_NATIVE_EXCEPTION_EVENT_NAME, addErrorBreadcrumb, captureAttribution, captureClientException, captureError, captureException, captureMessage, clearAnalyticsSessionId, configureTracking, getAnalyticsAnonymousId, isAgentNativeAnalyticsConfigured, getAnalyticsSessionId, getFirstTouchAttribution, getLastTouchAttribution, getSessionReplayContext, getSessionReplayUrl, isErrorCaptureInstalled, maybeStartSessionReplay, scrubUrl, setAnalyticsSessionId, setSentryUser, setTrackingContentCaptureEnabled, setTrackingIdentity, startSessionReplay, stopSessionReplay, trackAgentChatLifecycle, trackAnonymousEvent, trackEvent, trackLifecycleEvent, trackSessionStatus, type AgentChatLifecycleEvent, type CaptureAttributionOptions, type CaptureExceptionContext, type CapturedExceptionEvent, type ClientCaptureContext, type ConfigureTrackingOptions, type ErrorCaptureConfigOptions, type ExceptionBreadcrumb, type ExceptionLevel, type FirstTouchAttribution, type LastTouchAttribution, type SessionReplayContext, type SessionReplayLinkOptions, type SessionReplayOptions, type SessionReplayStartResult, type SessionReplayUrlMatcher, type SessionStatusTrigger, type TrackingIdentityUser, } from "../analytics.js";
|
|
2
2
|
export { track } from "../track.js";
|
|
@@ -174,4 +174,16 @@ export declare function stopSessionReplay(reason?: string): Promise<void>;
|
|
|
174
174
|
export declare function trackEvent(name: string, params?: Record<string, unknown>): void;
|
|
175
175
|
export declare function trackAnonymousEvent(name: string, properties: Record<string, unknown>): void;
|
|
176
176
|
export declare function trackLifecycleEvent(name: AgentNativeLifecycleEventName, params?: Record<string, unknown>): void;
|
|
177
|
-
|
|
177
|
+
/**
|
|
178
|
+
* What made the tab read the session: its first read in the page (`"load"`,
|
|
179
|
+
* which the page's first answer always says, even when it comes on a retry, a
|
|
180
|
+
* later return to the tab, or a read a sign-in change or 401 started), a
|
|
181
|
+
* return to the tab, by focus or by becoming visible, once the answer was
|
|
182
|
+
* stale (`"focus"`), a component mounting after the answer expired
|
|
183
|
+
* (`"expired"`), a sign-in, sign-out, or account or organization switch in
|
|
184
|
+
* this tab or another (`"auth_change"`), a request answered 401
|
|
185
|
+
* (`"unauthorized"`), or requests moving to another transport, such as an
|
|
186
|
+
* embed's token arriving (`"transport_change"`). Only `"load"` is a page load.
|
|
187
|
+
*/
|
|
188
|
+
export type SessionStatusTrigger = "load" | "focus" | "expired" | "auth_change" | "unauthorized" | "transport_change";
|
|
189
|
+
export declare function trackSessionStatus(signedIn: boolean, trigger?: SessionStatusTrigger): void;
|
package/dist/client/analytics.js
CHANGED
|
@@ -2440,6 +2440,9 @@ export function trackAnonymousEvent(name, properties) {
|
|
|
2440
2440
|
export function trackLifecycleEvent(name, params) {
|
|
2441
2441
|
trackEvent(name, params);
|
|
2442
2442
|
}
|
|
2443
|
-
export function trackSessionStatus(signedIn) {
|
|
2444
|
-
trackEvent("session status", {
|
|
2443
|
+
export function trackSessionStatus(signedIn, trigger) {
|
|
2444
|
+
trackEvent("session status", {
|
|
2445
|
+
signed_in: signedIn,
|
|
2446
|
+
...(trigger !== undefined ? { trigger } : {}),
|
|
2447
|
+
});
|
|
2445
2448
|
}
|
|
@@ -12,6 +12,17 @@ export interface ClientAppStateWriteOptions {
|
|
|
12
12
|
*/
|
|
13
13
|
ownRequest?: boolean;
|
|
14
14
|
}
|
|
15
|
+
/** Keep app-owned context required while its editor or view is mounted. */
|
|
16
|
+
export declare function registerBeforeAgentTurnStateKeys(keys: readonly string[]): () => void;
|
|
17
|
+
/** Register deferred UI state or editor saves that must precede a new turn. */
|
|
18
|
+
export declare function registerBeforeAgentTurnFlush(flush: () => void | Promise<void>): () => void;
|
|
19
|
+
/**
|
|
20
|
+
* Await all in-flight writes. Retained failures gate core context and keys
|
|
21
|
+
* registered by a mounted owner. Custom keys opt in with
|
|
22
|
+
* registerBeforeAgentTurnStateKeys; owner flushers perform recovery.
|
|
23
|
+
* Failed writes are never replayed without their owner's intent and fencing.
|
|
24
|
+
*/
|
|
25
|
+
export declare function flushClientAppStateBeforeAgentTurn(signal?: AbortSignal): Promise<void>;
|
|
15
26
|
export declare function isClientAppStateMutationPending(key: string): boolean;
|
|
16
27
|
export interface ClientAppStateBatch {
|
|
17
28
|
values: Record<string, unknown>;
|