@agent-native/core 0.210.0 → 0.210.1-nightly-20261020010058

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 (82) hide show
  1. package/dist/action.js +16 -1
  2. package/dist/agent/production-agent.d.ts +1 -0
  3. package/dist/agent/production-agent.js +2 -0
  4. package/dist/agent/reaped-run-thread.d.ts +1 -1
  5. package/dist/agent/reaped-run-thread.js +21 -6
  6. package/dist/agent/run-store.fencing.worker.js +58 -0
  7. package/dist/agent/run-store.js +7 -5
  8. package/dist/agent/run-thread-projector.d.ts +27 -0
  9. package/dist/agent/run-thread-projector.js +79 -0
  10. package/dist/agent/thread-data-builder.js +38 -13
  11. package/dist/automation/index.d.ts +1 -1
  12. package/dist/cli/create.d.ts +1 -1
  13. package/dist/cli/create.js +30 -27
  14. package/dist/cli/package-lifecycle.js +3 -2
  15. package/dist/cli/setup-agents.d.ts +5 -0
  16. package/dist/cli/setup-agents.js +91 -34
  17. package/dist/cli/skills.js +8 -14
  18. package/dist/cli/tar-command.d.ts +1 -0
  19. package/dist/cli/tar-command.js +9 -0
  20. package/dist/cli/template-baseline.js +6 -3
  21. package/dist/cli/template-sync.d.ts +2 -1
  22. package/dist/cli/template-sync.js +2 -1
  23. package/dist/client/agent-chat.d.ts +1 -0
  24. package/dist/client/agent-chat.js +1 -1
  25. package/dist/client/api-path.d.ts +1 -0
  26. package/dist/client/api-path.js +6 -0
  27. package/dist/client/chat/agentkit-agent-native.js +6 -2
  28. package/dist/client/chat/runtime.js +3 -0
  29. package/dist/client/use-agent-chat-context.js +6 -3
  30. package/dist/client/use-db-sync.js +3 -0
  31. package/dist/collab/awareness.d.ts +2 -2
  32. package/dist/collab/routes.d.ts +2 -2
  33. package/dist/deploy/immutable-assets.d.ts +1 -1
  34. package/dist/deploy/immutable-assets.js +1 -1
  35. package/dist/deploy/workspace-deploy.js +12 -5
  36. package/dist/file-upload/actions/upload-image.d.ts +3 -3
  37. package/dist/jobs/actions/manage-recurring-job.d.ts +1 -1
  38. package/dist/jobs/background-automation-runner.js +16 -7
  39. package/dist/mcp/build-server.js +5 -1
  40. package/dist/mcp/embed-app.js +84 -17
  41. package/dist/notifications/routes.d.ts +3 -3
  42. package/dist/observability/routes.d.ts +7 -7
  43. package/dist/org/actions/invite-organization-member.js +1 -0
  44. package/dist/org/actions/list-organization-members.js +1 -0
  45. package/dist/org/index.d.ts +1 -1
  46. package/dist/progress/routes.d.ts +1 -1
  47. package/dist/provider-api/actions/custom-provider-registration.d.ts +6 -6
  48. package/dist/provider-api/actions/provider-api.d.ts +8 -8
  49. package/dist/scripts/db/exec.js +18 -6
  50. package/dist/scripts/db/patch.js +20 -8
  51. package/dist/scripts/db/postgres-client.d.ts +2 -0
  52. package/dist/scripts/db/postgres-client.js +17 -1
  53. package/dist/scripts/db/query.js +7 -6
  54. package/dist/scripts/db/safety.js +2 -1
  55. package/dist/secrets/routes.d.ts +10 -10
  56. package/dist/server/agent-chat-plugin.js +17 -8
  57. package/dist/server/agent-engine-api-key-route.d.ts +1 -1
  58. package/dist/server/agent-engine-default-model-route.d.ts +1 -1
  59. package/dist/server/agent-teams.js +9 -3
  60. package/dist/server/framework-request-handler.js +19 -0
  61. package/dist/server/fusion-app.d.ts +7 -0
  62. package/dist/server/fusion-app.js +11 -2
  63. package/dist/templates/builder-code-starter/.agents/skills/actions/SKILL.md.patch +1 -1
  64. package/dist/templates/builder-code-starter/app/hooks/use-navigation-state.ts.patch +26 -45
  65. package/dist/templates/builder-code-starter/server/plugins/agent-chat.ts.patch +2 -1
  66. package/dist/templates/chat/.agents/skills/context-awareness/SKILL.md +5 -0
  67. package/dist/templates/chat/app/components/chat/ChatHomeRedirect.tsx +2 -2
  68. package/dist/templates/chat/app/hooks/use-navigation-state.ts +51 -22
  69. package/dist/templates/chat/server/plugins/agent-chat.ts +1 -0
  70. package/dist/templates/default/.agents/skills/context-awareness/SKILL.md +5 -0
  71. package/dist/templates/workspace-core/.agents/skills/context-awareness/SKILL.md +5 -0
  72. package/dist/triggers/actions/manage-automation.d.ts +5 -5
  73. package/package.json +5 -5
  74. package/src/templates/builder-code-starter/.agents/skills/actions/SKILL.md.patch +1 -1
  75. package/src/templates/builder-code-starter/app/hooks/use-navigation-state.ts.patch +26 -45
  76. package/src/templates/builder-code-starter/server/plugins/agent-chat.ts.patch +2 -1
  77. package/src/templates/chat/.agents/skills/context-awareness/SKILL.md +5 -0
  78. package/src/templates/chat/app/components/chat/ChatHomeRedirect.tsx +2 -2
  79. package/src/templates/chat/app/hooks/use-navigation-state.ts +51 -22
  80. package/src/templates/chat/server/plugins/agent-chat.ts +1 -0
  81. package/src/templates/default/.agents/skills/context-awareness/SKILL.md +5 -0
  82. package/src/templates/workspace-core/.agents/skills/context-awareness/SKILL.md +5 -0
@@ -6,29 +6,100 @@ const FILE_SYMLINKS = [
6
6
  const DIR_SYMLINKS = [
7
7
  { link: ".claude/skills", target: "../.agents/skills" },
8
8
  ];
9
+ export function prepareAgentSymlink(linkPath, target, type) {
10
+ let stat;
11
+ try {
12
+ stat = fs.lstatSync(linkPath);
13
+ }
14
+ catch (error) {
15
+ if (error.code === "ENOENT")
16
+ return "create";
17
+ throw error;
18
+ }
19
+ if (!stat.isSymbolicLink())
20
+ return "occupied";
21
+ let existingTarget;
22
+ try {
23
+ existingTarget = fs.readlinkSync(linkPath);
24
+ }
25
+ catch (error) {
26
+ if (error.code === "ENOENT")
27
+ return "create";
28
+ throw error;
29
+ }
30
+ const resolvedExistingTarget = path.resolve(path.dirname(linkPath), existingTarget);
31
+ const resolvedTarget = path.resolve(path.dirname(linkPath), target);
32
+ const sameTarget = process.platform === "win32"
33
+ ? resolvedExistingTarget.toLowerCase() === resolvedTarget.toLowerCase()
34
+ : resolvedExistingTarget === resolvedTarget;
35
+ if (sameTarget) {
36
+ return "matches";
37
+ }
38
+ try {
39
+ if (process.platform === "win32" && type === "dir") {
40
+ fs.rmdirSync(linkPath);
41
+ }
42
+ else {
43
+ fs.unlinkSync(linkPath);
44
+ }
45
+ }
46
+ catch (error) {
47
+ const code = error.code;
48
+ if (code !== "ENOENT" &&
49
+ code !== "EPERM" &&
50
+ code !== "EACCES" &&
51
+ code !== "EBUSY") {
52
+ throw error;
53
+ }
54
+ try {
55
+ fs.lstatSync(linkPath);
56
+ }
57
+ catch (statError) {
58
+ if (statError.code === "ENOENT")
59
+ return "create";
60
+ }
61
+ throw error;
62
+ }
63
+ return "create";
64
+ }
65
+ export function createAgentSymlink(target, linkPath, type) {
66
+ if (process.platform !== "win32" || type === "file") {
67
+ fs.symlinkSync(target, linkPath, type);
68
+ return;
69
+ }
70
+ try {
71
+ fs.symlinkSync(target, linkPath, "dir");
72
+ }
73
+ catch (error) {
74
+ const code = error.code;
75
+ if (code !== "EPERM" && code !== "EACCES")
76
+ throw error;
77
+ fs.symlinkSync(path.resolve(path.dirname(linkPath), target), linkPath, "junction");
78
+ }
79
+ }
80
+ export function rebaseAgentSymlinkTarget(sourceRoot, destinationRoot, sourceLinkPath, destinationLinkPath, target) {
81
+ const resolvedSourceRoot = path.resolve(sourceRoot);
82
+ const resolvedTarget = path.resolve(path.dirname(sourceLinkPath), target);
83
+ const targetWithinRoot = path.relative(resolvedSourceRoot, resolvedTarget);
84
+ if (targetWithinRoot === ".." ||
85
+ targetWithinRoot.startsWith(`..${path.sep}`) ||
86
+ path.isAbsolute(targetWithinRoot)) {
87
+ return undefined;
88
+ }
89
+ const copiedTargetPath = path.resolve(destinationRoot, targetWithinRoot);
90
+ return (path.relative(path.dirname(destinationLinkPath), copiedTargetPath) || ".");
91
+ }
9
92
  export function setupAgentSymlinks(targetDir) {
10
93
  for (const { link, target } of FILE_SYMLINKS) {
11
94
  const linkPath = path.join(targetDir, link);
12
95
  const targetPath = path.join(targetDir, target);
13
96
  if (!fs.existsSync(targetPath))
14
97
  continue;
98
+ const state = prepareAgentSymlink(linkPath, target, "file");
99
+ if (state !== "create")
100
+ continue;
15
101
  try {
16
- const stat = fs.lstatSync(linkPath);
17
- if (stat.isSymbolicLink()) {
18
- const existing = fs.readlinkSync(linkPath);
19
- if (existing === target)
20
- continue;
21
- fs.unlinkSync(linkPath);
22
- }
23
- else {
24
- continue;
25
- }
26
- }
27
- catch {
28
- // lstatSync threw ENOENT — file doesn't exist, proceed to create
29
- }
30
- try {
31
- fs.symlinkSync(target, linkPath);
102
+ createAgentSymlink(target, linkPath, "file");
32
103
  }
33
104
  catch {
34
105
  try {
@@ -46,25 +117,11 @@ export function setupAgentSymlinks(targetDir) {
46
117
  if (!fs.existsSync(absTarget))
47
118
  continue;
48
119
  fs.mkdirSync(parentDir, { recursive: true });
49
- if (fs.existsSync(linkPath)) {
50
- try {
51
- const stat = fs.lstatSync(linkPath);
52
- if (stat.isSymbolicLink()) {
53
- const existing = fs.readlinkSync(linkPath);
54
- if (existing === target)
55
- continue;
56
- }
57
- else {
58
- continue;
59
- }
60
- }
61
- catch {
62
- // Proceed to create
63
- }
64
- }
65
- const type = process.platform === "win32" ? "junction" : "dir";
120
+ const state = prepareAgentSymlink(linkPath, target, "dir");
121
+ if (state !== "create")
122
+ continue;
66
123
  try {
67
- fs.symlinkSync(target, linkPath, type);
124
+ createAgentSymlink(target, linkPath, "dir");
68
125
  }
69
126
  catch {
70
127
  try {
@@ -12,7 +12,7 @@ import { resolveClients, runConnect, writeConnectClientPreferences, } from "./co
12
12
  import { CONTEXT_XRAY_SKILL_MD, installLocalContextXray, } from "./context-xray-local.js";
13
13
  import { CLIENTS, configPathFor } from "./mcp-config-writers.js";
14
14
  import { installScreenMemoryForClient, resolveScreenMemoryStoreDir, } from "./mcp.js";
15
- import { setupAgentSymlinks } from "./setup-agents.js";
15
+ import { createAgentSymlink, prepareAgentSymlink, setupAgentSymlinks, } from "./setup-agents.js";
16
16
  import { ASSETS_SKILL_MD, AN_COMMAND_MD, AN_SKILL_MD, CANVAS_REFERENCE_MD, CONNECTION_REFERENCE_MD, CONTENT_SKILL_MD, DESIGN_EXPLORATION_SKILL_MD, DESIGN_VISUAL_EDIT_SKILL_MD, DOCUMENT_QUALITY_REFERENCE_MD, EXEMPLAR_REFERENCE_MD, HELP, LOCAL_FILES_REFERENCE_MD, REWIND_SKILL_MD, TURN_INTO_APP_ATTACHMENTS_REFERENCE_MD, TURN_INTO_APP_FRESH_PROJECT_REFERENCE_MD, TURN_INTO_APP_LOCAL_RUN_AND_DEPLOY_REFERENCE_MD, TURN_INTO_APP_OPENAI_YAML, TURN_INTO_APP_REVIEW_LOOP_REFERENCE_MD, TURN_INTO_APP_SKILL_MD, TURN_INTO_APP_SOURCE_BRIEF_REFERENCE_MD, TURN_INTO_APP_SPREADSHEET_SOURCE_REFERENCE_MD, TURN_INTO_APP_UI_ARCHETYPES_REFERENCE_MD, TURN_INTO_APP_UI_DIRECTION_REFERENCE_MD, TURN_INTO_APP_UI_PALETTES_REFERENCE_MD, VISUAL_PLANS_SKILL_MD, VISUAL_RECAP_SKILL_MD, VISUALIZE_REPO_SKILL_MD, WIREFRAME_REFERENCE_MD, } from "./skills-content/index.js";
17
17
  import { createCliTelemetry } from "./telemetry.js";
18
18
  import { applyTemplateLayer, readTemplateLayer } from "./template-layer.js";
@@ -1574,21 +1574,15 @@ function ensureWorkspaceRootSkillsLink(workspaceRoot, sharedPackageDir) {
1574
1574
  const linkPath = path.join(agentsDir, "skills");
1575
1575
  const target = path.relative(agentsDir, sharedSkillsDir);
1576
1576
  fs.mkdirSync(agentsDir, { recursive: true });
1577
- try {
1578
- const stat = fs.lstatSync(linkPath);
1579
- if (stat.isSymbolicLink()) {
1580
- if (fs.readlinkSync(linkPath) === target)
1581
- return;
1582
- fs.unlinkSync(linkPath);
1583
- }
1584
- else {
1585
- copyScaffoldGuidanceSkills([sharedSkillsDir], linkPath, listImmediateSkillDirs(sharedSkillsDir), false);
1586
- return;
1587
- }
1577
+ const state = prepareAgentSymlink(linkPath, target, "dir");
1578
+ if (state === "matches")
1579
+ return;
1580
+ if (state === "occupied") {
1581
+ copyScaffoldGuidanceSkills([sharedSkillsDir], linkPath, listImmediateSkillDirs(sharedSkillsDir), false);
1582
+ return;
1588
1583
  }
1589
- catch { }
1590
1584
  try {
1591
- fs.symlinkSync(target, linkPath, process.platform === "win32" ? "junction" : "dir");
1585
+ createAgentSymlink(target, linkPath, "dir");
1592
1586
  }
1593
1587
  catch {
1594
1588
  try {
@@ -0,0 +1 @@
1
+ export declare function resolveTarExecutable(platform?: NodeJS.Platform, systemRoot?: string): string;
@@ -0,0 +1,9 @@
1
+ import path from "node:path";
2
+ export function resolveTarExecutable(platform = process.platform, systemRoot = process.env.SYSTEMROOT) {
3
+ if (platform !== "win32")
4
+ return "tar";
5
+ if (!systemRoot) {
6
+ throw new Error("SystemRoot is required to resolve the Windows tar executable.");
7
+ }
8
+ return path.win32.join(systemRoot, "System32", "tar.exe");
9
+ }
@@ -2,6 +2,7 @@ import { execFileSync } from "node:child_process";
2
2
  import fs from "node:fs";
3
3
  import os from "node:os";
4
4
  import path from "node:path";
5
+ import { resolveTarExecutable } from "./tar-command.js";
5
6
  const REF_NAMESPACE = "refs/agent-native";
6
7
  const GIT_IDENTITY = {
7
8
  GIT_AUTHOR_NAME: "agent-native",
@@ -51,7 +52,7 @@ export function writeBaseline(store, sourceDir, slot, meta) {
51
52
  if (!store.gitDir) {
52
53
  const file = baselineTarballPath(store, slot);
53
54
  fs.mkdirSync(path.dirname(file), { recursive: true });
54
- execFileSync("tar", ["-czf", file, "-C", sourceDir, "."], {
55
+ execFileSync(resolveTarExecutable(), ["-czf", file, "-C", sourceDir, "."], {
55
56
  stdio: "pipe",
56
57
  });
57
58
  return { kind: "tarball", location: file, configuredRefspecs: [] };
@@ -130,7 +131,9 @@ export function materializeBaseline(store, slot) {
130
131
  fs.rmSync(out, { recursive: true, force: true });
131
132
  return null;
132
133
  }
133
- execFileSync("tar", ["-xzf", file, "-C", out], { stdio: "pipe" });
134
+ execFileSync(resolveTarExecutable(), ["-xzf", file, "-C", out], {
135
+ stdio: "pipe",
136
+ });
134
137
  return out;
135
138
  }
136
139
  const ref = baselineRefName(store, slot);
@@ -144,7 +147,7 @@ export function materializeBaseline(store, slot) {
144
147
  args.push("--", store.prefix);
145
148
  git(store, args);
146
149
  const strip = store.prefix ? store.prefix.split("/").length : 0;
147
- execFileSync("tar", [
150
+ execFileSync(resolveTarExecutable(), [
148
151
  "-xf",
149
152
  tarPath,
150
153
  "-C",
@@ -56,4 +56,5 @@ export declare function mergeTemplateTrees(appDir: string, baseDir: string, thei
56
56
  export declare function readProvenance(appDir: string): TemplateProvenance;
57
57
  export declare function resolveTargets(cwd: string, appArg?: string): AppTarget[];
58
58
  export declare function runTemplate(args: string[], io?: TemplateIO): Promise<number>;
59
- export {};
59
+ declare function useLocalTemplate(target: AppTarget, ref: string | null): boolean;
60
+ export { useLocalTemplate as _useLocalTemplate };
@@ -615,8 +615,9 @@ function useLocalTemplate(target, ref) {
615
615
  const source = target.provenance.templateSource;
616
616
  if (source !== "bundled" && source !== "local-checkout")
617
617
  return false;
618
- return ref === target.provenance.templateRef;
618
+ return _getGitHubTemplateRefCandidates().includes(ref);
619
619
  }
620
+ export { useLocalTemplate as _useLocalTemplate };
620
621
  async function materializeForTarget(target, flags, ref) {
621
622
  return materializeTemplate({
622
623
  appName: target.appName,
@@ -115,6 +115,7 @@ export interface AgentChatContextMutationOptions {
115
115
  export interface AgentChatContextRemoveOptions extends AgentChatContextMutationOptions {
116
116
  key: string;
117
117
  }
118
+ export declare const AGENT_CHAT_CONTEXT_STATE_KEY = "agent-chat-context";
118
119
  export declare const AGENT_CHAT_CONTEXT_CHANGED_EVENT = "agentNative.chatContextChanged";
119
120
  export declare const AGENT_CHAT_SET_CONTEXT_MESSAGE_TYPE = "agentNative.setChatContext";
120
121
  export declare const AGENT_CHAT_REMOVE_CONTEXT_MESSAGE_TYPE = "agentNative.removeChatContext";
@@ -9,7 +9,7 @@ import { getFramePostMessageTargetOrigin, isTrustedFrameMessage, } from "./frame
9
9
  import { isOpenAiMcpAppHost, sendMcpAppHostMessage, } from "./mcp-app-host.js";
10
10
  export { appendAgentChatContextToMessage } from "../shared/agent-chat-context.js";
11
11
  const AGENT_CHAT_MESSAGE_TYPE = "agentNative.submitChat";
12
- const AGENT_CHAT_CONTEXT_STATE_KEY = "agent-chat-context";
12
+ export const AGENT_CHAT_CONTEXT_STATE_KEY = "agent-chat-context";
13
13
  const AGENT_CHAT_EXEC_MODE_KEY = "agent-native-exec-mode";
14
14
  export const AGENT_CHAT_CONTEXT_CHANGED_EVENT = "agentNative.chatContextChanged";
15
15
  export const AGENT_CHAT_SET_CONTEXT_MESSAGE_TYPE = "agentNative.setChatContext";
@@ -20,6 +20,7 @@ export declare function isWorkspaceAppPath(path: string): boolean;
20
20
  export declare function appMountPath(appLocalRoute: string): string;
21
21
  export declare function appMountedPath(path: string, appLocalRoute: string): string;
22
22
  export declare function appPath(path: string): string;
23
+ export declare function appPathFromLocalRoute(path: string): string;
23
24
  export declare function appApiPath(path: string): string;
24
25
  export declare function agentNativePath(path: string): string;
25
26
  export declare function agentChatStreamingUrl(): string | undefined;
@@ -339,6 +339,12 @@ export function appPath(path) {
339
339
  return path;
340
340
  return `${basePath}${path}`;
341
341
  }
342
+ export function appPathFromLocalRoute(path) {
343
+ if (!path.startsWith("/"))
344
+ return path;
345
+ const basePath = appBasePath();
346
+ return basePath ? `${basePath}${path}` : path;
347
+ }
342
348
  export function appApiPath(path) {
343
349
  const normalized = path === "/api" || path.startsWith("/api/")
344
350
  ? path
@@ -3658,7 +3658,8 @@ export function createAgentNativeAgentKitTransport(options = {}) {
3658
3658
  const submittedRunId = typeof record?.submittedRunId === "string"
3659
3659
  ? record.submittedRunId
3660
3660
  : undefined;
3661
- const localRun = serverActiveRunId
3661
+ const hasSubmittedReceipt = typeof submittedRunId === "string" && submittedRunId.length > 0;
3662
+ const localRun = serverActiveRunId && !hasSubmittedReceipt
3662
3663
  ? await protocolTransport.getRun?.({
3663
3664
  threadId: input.threadId,
3664
3665
  runId: serverActiveRunId,
@@ -3667,11 +3668,14 @@ export function createAgentNativeAgentKitTransport(options = {}) {
3667
3668
  const activeRunId = localRun?.id ?? serverActiveRunId;
3668
3669
  const explicitNonSlotCode = typeof record?.code === "string" &&
3669
3670
  record.code !== "run_slot_busy" &&
3671
+ record.code !== "queued_message_already_submitted" &&
3670
3672
  record.code !== "http_409";
3671
3673
  if (record?.status === 409 &&
3672
3674
  (error instanceof AgentKitRunSlotBusyError ||
3673
3675
  record.code === "run_slot_busy" ||
3674
- ((typeof activeRunId === "string" || submittedRunId !== undefined) &&
3676
+ (record.code === "queued_message_already_submitted" &&
3677
+ hasSubmittedReceipt) ||
3678
+ ((typeof activeRunId === "string" || hasSubmittedReceipt) &&
3675
3679
  !explicitNonSlotCode))) {
3676
3680
  const busy = new AgentKitRunSlotBusyError(typeof activeRunId === "string" ? activeRunId : undefined, submittedRunId);
3677
3681
  Object.assign(busy, { status: 409 });
@@ -356,6 +356,9 @@ async function readHttpRuntimeError(response) {
356
356
  const explicitCode = typeof code === "string" ? code : undefined;
357
357
  const runSlotBusy = status === 409 &&
358
358
  (explicitCode === "run_slot_busy" ||
359
+ (explicitCode === "queued_message_already_submitted" &&
360
+ typeof submittedRunId === "string" &&
361
+ submittedRunId.length > 0) ||
359
362
  (explicitCode === undefined &&
360
363
  (activeRunIdValue ||
361
364
  (typeof submittedRunId === "string" && submittedRunId.length > 0))));
@@ -1,8 +1,11 @@
1
1
  import { useCallback, useEffect, useMemo, useSyncExternalStore } from "react";
2
- import { clearAgentChatContext, filterAgentChatContextItems, getAgentChatContextState, refreshAgentChatContext, removeAgentChatContextItem, setAgentChatContextItem, subscribeAgentChatContext, } from "./agent-chat.js";
3
- import { useChangeVersion } from "./use-change-version.js";
2
+ import { AGENT_CHAT_CONTEXT_STATE_KEY, clearAgentChatContext, filterAgentChatContextItems, getAgentChatContextState, refreshAgentChatContext, removeAgentChatContextItem, setAgentChatContextItem, subscribeAgentChatContext, } from "./agent-chat.js";
3
+ import { useChangeVersions } from "./use-change-version.js";
4
4
  export function useAgentChatContext(enabled = true) {
5
- const appStateVersion = useChangeVersion("app-state");
5
+ const appStateVersion = useChangeVersions([
6
+ `app-state:${AGENT_CHAT_CONTEXT_STATE_KEY}`,
7
+ "app-state:*",
8
+ ]);
6
9
  const state = useSyncExternalStore(subscribeAgentChatContext, getAgentChatContextState, getAgentChatContextState);
7
10
  const items = useMemo(() => filterAgentChatContextItems(state.items), [state.items]);
8
11
  useEffect(() => {
@@ -1254,6 +1254,9 @@ export function useDbSync(options = {}) {
1254
1254
  if (typeof evt.key === "string" && evt.key) {
1255
1255
  bumpChangeVersion(`${src}:${evt.key}`, ver);
1256
1256
  }
1257
+ else if (src === "app-state") {
1258
+ bumpChangeVersion("app-state:*", ver);
1259
+ }
1257
1260
  }
1258
1261
  }
1259
1262
  const invalidating = relevant.filter((e) => e.source !== "awareness");
@@ -38,19 +38,19 @@ export declare const postAwareness: import("h3").EventHandlerWithFetch<import("h
38
38
  error: string;
39
39
  states?: undefined;
40
40
  } | {
41
- error?: undefined;
42
41
  states: {
43
42
  clientId: number;
44
43
  state: string;
45
44
  }[];
45
+ error?: undefined;
46
46
  }>>;
47
47
  export declare const getActiveUsers: import("h3").EventHandlerWithFetch<import("h3").EventHandlerRequest, Promise<{
48
48
  error: string;
49
49
  users?: undefined;
50
50
  } | {
51
- error?: undefined;
52
51
  users: {
53
52
  clientId: number;
54
53
  lastSeen: number;
55
54
  }[];
55
+ error?: undefined;
56
56
  }>>;
@@ -13,16 +13,16 @@ export declare const getCollabState: import("h3").EventHandlerWithFetch<import("
13
13
  };
14
14
  }>>;
15
15
  export declare const postCollabUpdate: import("h3").EventHandlerWithFetch<import("h3").EventHandlerRequest, Promise<{
16
- ok?: undefined;
17
16
  error: string;
17
+ ok?: undefined;
18
18
  } | {
19
19
  error?: undefined;
20
20
  ok: boolean;
21
21
  }>>;
22
22
  export declare const postCollabText: import("h3").EventHandlerWithFetch<import("h3").EventHandlerRequest, Promise<{
23
23
  ok?: undefined;
24
- text?: undefined;
25
24
  error: string;
25
+ text?: undefined;
26
26
  } | {
27
27
  error?: undefined;
28
28
  ok: boolean;
@@ -4,7 +4,7 @@ export declare const IMMUTABLE_ASSET_CACHE_HEADERS: {
4
4
  readonly "cdn-cache-control": "public, max-age=31536000, immutable";
5
5
  readonly "netlify-cdn-cache-control": "public, max-age=31536000, immutable";
6
6
  };
7
- export declare const IMMUTABLE_ASSET_PATH_PATTERN = "^/assets/[^/]+-[A-Za-z0-9_-]{8}\\.[a-z0-9]+$";
7
+ export declare const IMMUTABLE_ASSET_PATH_PATTERN = "^/assets/(?:[^/]+/)*[^/]+-[A-Za-z0-9_-]{8}\\.[a-z0-9]+$";
8
8
  export declare function isImmutableAssetPath(pathname: string): boolean;
9
9
  export declare function normalizeBasePath(basePath: string | undefined): string;
10
10
  export declare function prefixAssetPath(pathname: string, basePath: string | undefined): string;
@@ -6,7 +6,7 @@ export const IMMUTABLE_ASSET_CACHE_HEADERS = {
6
6
  "cdn-cache-control": IMMUTABLE_ASSET_CACHE_CONTROL,
7
7
  "netlify-cdn-cache-control": IMMUTABLE_ASSET_CACHE_CONTROL,
8
8
  };
9
- export const IMMUTABLE_ASSET_PATH_PATTERN = "^/assets/[^/]+-[A-Za-z0-9_-]{8}\\.[a-z0-9]+$";
9
+ export const IMMUTABLE_ASSET_PATH_PATTERN = "^/assets/(?:[^/]+/)*[^/]+-[A-Za-z0-9_-]{8}\\.[a-z0-9]+$";
10
10
  const IMMUTABLE_ASSET_PATH_RE = new RegExp(IMMUTABLE_ASSET_PATH_PATTERN);
11
11
  export function isImmutableAssetPath(pathname) {
12
12
  return IMMUTABLE_ASSET_PATH_RE.test(pathname);
@@ -568,11 +568,18 @@ function writeVercelBuildConfig(outputDir, apps, workspaceApps, rootPage, sweepC
568
568
  function vercelImmutableAssetHeaderRoutes(outputDir, apps) {
569
569
  return apps.flatMap((app) => {
570
570
  const staticDir = path.join(outputDir, "static", app);
571
- return collectImmutableAssetPaths(staticDir).map((assetPath) => ({
572
- src: vercelRouteSrc(`/${app}${assetPath}`),
573
- headers: IMMUTABLE_ASSET_CACHE_HEADERS,
574
- continue: true,
575
- }));
571
+ const assetPaths = collectImmutableAssetPaths(staticDir);
572
+ if (assetPaths.length === 0)
573
+ return [];
574
+ return [
575
+ {
576
+ src: `^(?:${assetPaths
577
+ .map((assetPath) => vercelRouteSrc(`/${app}${assetPath}`))
578
+ .join("|")})$`,
579
+ headers: IMMUTABLE_ASSET_CACHE_HEADERS,
580
+ continue: true,
581
+ },
582
+ ];
576
583
  });
577
584
  }
578
585
  function vercelRouteSrc(pathname) {
@@ -33,20 +33,20 @@ declare const _default: import("../../action.js").ActionDefinition<{
33
33
  idempotencyKey: string;
34
34
  deleted: boolean;
35
35
  } | {
36
+ id?: undefined;
36
37
  error: string;
37
38
  url?: undefined;
38
- id?: undefined;
39
39
  provider?: undefined;
40
40
  configured?: undefined;
41
41
  } | {
42
42
  url: string;
43
43
  id: string;
44
44
  provider: string;
45
- error?: undefined;
46
45
  configured?: undefined;
46
+ error?: undefined;
47
47
  } | {
48
- url?: undefined;
49
48
  id?: undefined;
49
+ url?: undefined;
50
50
  provider?: undefined;
51
51
  error: string;
52
52
  configured: boolean;
@@ -11,9 +11,9 @@ declare const _default: import("../../action.js").ActionDefinition<{
11
11
  enabled?: undefined;
12
12
  nextRun?: undefined;
13
13
  } | {
14
- deleted?: undefined;
15
14
  name: string;
16
15
  enabled: boolean;
17
16
  nextRun: string;
17
+ deleted?: undefined;
18
18
  }>;
19
19
  export default _default;
@@ -9,6 +9,7 @@ import { foldReapedRunIntoThread } from "../agent/reaped-run-thread.js";
9
9
  import { AgentLoopAbortedError, runAgentLoopDirectWithSoftTimeout, } from "../agent/run-loop-with-resume.js";
10
10
  import { abortRun, resolveBackgroundAutomationSoftTimeoutMs, resolveBackgroundRunHardTimeoutMs, startRun, } from "../agent/run-manager.js";
11
11
  import { claimBackgroundRun, beginAgentExecutionStep, completeAgentExecutionStep, markAgentExecutionStepDispatched, insertRun, tryClaimRunSlot, releaseBackgroundRunBeforeStart, } from "../agent/run-store.js";
12
+ import { buildAssistantMessageFromRunJournal } from "../agent/run-thread-projector.js";
12
13
  import { buildCurrentTimeUserContext, buildRuntimeContextPrompt, } from "../agent/runtime-context.js";
13
14
  import { buildAssistantMessage, buildUserMessage, extractThreadMeta, foldAssistantTurn, upsertUserMessage, threadDataToEngineMessages, threadMessageTextForEngine, } from "../agent/thread-data-builder.js";
14
15
  import { classifyToolCallJournal, buildResumeJournalNote, toolCallInputFingerprint, } from "../agent/tool-call-journal.js";
@@ -472,13 +473,20 @@ async function persistBackgroundAutomationTurn(input) {
472
473
  },
473
474
  });
474
475
  }
475
- const assistantMsg = buildAssistantMessage(events, input.run.runId, {
476
- suppressInternalContinuation: !input.persistFailure,
477
- turnId: input.run.turnId,
478
- runDurationMs: Number.isFinite(input.run.startedAt)
479
- ? Math.max(0, Date.now() - input.run.startedAt)
480
- : undefined,
481
- });
476
+ const assistantMsg = input.persistAssistant === false
477
+ ? null
478
+ : await buildAssistantMessageFromRunJournal({
479
+ threadId: input.threadId,
480
+ turnId: input.run.turnId,
481
+ runId: input.run.runId,
482
+ runEvents: events,
483
+ options: {
484
+ suppressInternalContinuation: !input.persistFailure,
485
+ runDurationMs: Number.isFinite(input.run.startedAt)
486
+ ? Math.max(0, Date.now() - input.run.startedAt)
487
+ : undefined,
488
+ },
489
+ });
482
490
  if (assistantMsg) {
483
491
  repo = foldAssistantTurn(repo, assistantMsg, {
484
492
  runId: input.run.runId,
@@ -844,6 +852,7 @@ async function executeBackgroundAutomation(options, deps, historyId, runIdRef) {
844
852
  threadTitle,
845
853
  prompt: executionPrompt,
846
854
  run: { runId, turnId, startedAt: Date.now(), events: [] },
855
+ persistAssistant: false,
847
856
  });
848
857
  const afterInsert = (tx) => withDbExec(tx, async () => {
849
858
  await recordRunThread(historyId, thread.id, runId, Boolean(options.historyId), options.resume?.previousRunId);
@@ -2004,6 +2004,7 @@ export async function createMCPServerForRequest(config, identity, requestMeta) {
2004
2004
  connectorNames.size > 0 ||
2005
2005
  automaticConnectorPolicyActive);
2006
2006
  const writesAreAskAppOnly = externalAgentWritesAreAskAppOnly(config);
2007
+ const preserveCompactActions = config.connectorCatalog === undefined && !automaticConnectorPolicyActive;
2007
2008
  const advertisedActionsBeforeToolSearchScope = appCatalog
2008
2009
  ? Object.fromEntries(Object.entries(visibleActions).filter(([name]) => !denyNames.has(name)))
2009
2010
  : directoryCatalog
@@ -2016,8 +2017,11 @@ export async function createMCPServerForRequest(config, identity, requestMeta) {
2016
2017
  return false;
2017
2018
  if (COMPACT_MCP_APP_CATALOG_BUILTINS.has(name))
2018
2019
  return true;
2019
- if (!connectorNames.has(name))
2020
+ if (!connectorNames.has(name) &&
2021
+ !(preserveCompactActions &&
2022
+ isActionAdvertisedInCompactMcpAppCatalog(name, entry, config))) {
2020
2023
  return false;
2024
+ }
2021
2025
  if (writesAreAskAppOnly && !isMcpReadOnlyTool(entry)) {
2022
2026
  return false;
2023
2027
  }