@agent-native/core 0.198.3-nightly-20260930154911 → 0.198.4

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 (106) hide show
  1. package/dist/a2a/types.d.ts +5 -0
  2. package/dist/agent/production-agent.js +26 -1
  3. package/dist/automation/index.d.ts +1 -1
  4. package/dist/catalog.json +1 -0
  5. package/dist/cli/create.js +14 -0
  6. package/dist/cli/migration-codemod.js +2 -1
  7. package/dist/cli/skills.js +15 -32
  8. package/dist/cli/upgrade.d.ts +3 -2
  9. package/dist/cli/upgrade.js +3 -0
  10. package/dist/cli/workspacify.js +1 -1
  11. package/dist/client/chat/agentkit-agent-native.js +15 -15
  12. package/dist/client/chat/runtime.js +5 -3
  13. package/dist/client/feature-flags/types.d.ts +2 -0
  14. package/dist/client/i18n.d.ts +2 -0
  15. package/dist/client/i18n.js +2 -0
  16. package/dist/client/integrations/index.d.ts +1 -0
  17. package/dist/client/integrations/index.js +1 -0
  18. package/dist/client/labs/index.d.ts +1 -1
  19. package/dist/client/labs/use-lab.d.ts +5 -0
  20. package/dist/client/labs/use-lab.js +7 -3
  21. package/dist/client/resources/mcp-connection-resume.d.ts +5 -3
  22. package/dist/client/resources/mcp-connection-resume.js +150 -13
  23. package/dist/client/sse-event-processor.d.ts +6 -0
  24. package/dist/client/uploads/index.d.ts +1 -0
  25. package/dist/client/uploads/index.js +1 -0
  26. package/dist/client/uploads/private-icon.d.ts +10 -0
  27. package/dist/client/uploads/private-icon.js +52 -0
  28. package/dist/collab/routes.d.ts +1 -1
  29. package/dist/collab/struct-routes.d.ts +1 -1
  30. package/dist/db/client.d.ts +3 -0
  31. package/dist/db/client.js +7 -4
  32. package/dist/db/create-get-db.js +478 -3
  33. package/dist/feature-flags/actions/get-feature-flags.js +20 -0
  34. package/dist/feature-flags/actions/list-feature-flags.d.ts +2 -0
  35. package/dist/feature-flags/actions/list-feature-flags.js +5 -0
  36. package/dist/feature-flags/actions/set-feature-flag.js +5 -0
  37. package/dist/file-upload/actions/upload-image.d.ts +2 -2
  38. package/dist/framework-tools.js +2 -0
  39. package/dist/icon-assets/index.d.ts +3 -0
  40. package/dist/icon-assets/index.js +3 -0
  41. package/dist/icon-assets/multipart.d.ts +9 -0
  42. package/dist/icon-assets/multipart.js +60 -0
  43. package/dist/icon-assets/schema.d.ts +194 -0
  44. package/dist/icon-assets/schema.js +16 -0
  45. package/dist/icon-assets/store.d.ts +38 -0
  46. package/dist/icon-assets/store.js +187 -0
  47. package/dist/icon-assets/svg.d.ts +2 -0
  48. package/dist/icon-assets/svg.js +146 -0
  49. package/dist/icon-assets/workspace-transport.d.ts +20 -0
  50. package/dist/icon-assets/workspace-transport.js +122 -0
  51. package/dist/identity/rekey.js +1 -0
  52. package/dist/labs/actions/get-lab-states.d.ts +2 -0
  53. package/dist/labs/actions/get-lab-states.js +14 -0
  54. package/dist/labs/actions/get-labs.js +2 -2
  55. package/dist/labs/actions/set-lab.js +4 -2
  56. package/dist/labs/index.d.ts +1 -1
  57. package/dist/labs/index.js +1 -1
  58. package/dist/labs/registry.d.ts +3 -0
  59. package/dist/labs/registry.js +14 -0
  60. package/dist/labs/server.d.ts +1 -1
  61. package/dist/labs/server.js +1 -1
  62. package/dist/labs/store.d.ts +13 -2
  63. package/dist/labs/store.js +124 -7
  64. package/dist/localization/default-messages.d.ts +2 -0
  65. package/dist/localization/default-messages.js +1 -1
  66. package/dist/localization/icon-picker-messages.d.ts +44 -0
  67. package/dist/localization/icon-picker-messages.js +22 -0
  68. package/dist/mcp-client/oauth-client.d.ts +1 -0
  69. package/dist/mcp-client/oauth-client.js +42 -4
  70. package/dist/mcp-client/oauth-routes.js +15 -2
  71. package/dist/observability/routes.d.ts +9 -9
  72. package/dist/org/actions/list-workspace-icons.d.ts +7 -0
  73. package/dist/org/actions/list-workspace-icons.js +41 -0
  74. package/dist/org/handlers.d.ts +1 -1
  75. package/dist/org/handlers.js +28 -1
  76. package/dist/org/index.d.ts +2 -2
  77. package/dist/org/index.js +1 -1
  78. package/dist/org/migrations.js +21 -0
  79. package/dist/org/plugin.js +42 -0
  80. package/dist/org/private-icon-handlers.d.ts +6 -0
  81. package/dist/org/private-icon-handlers.js +212 -0
  82. package/dist/progress/routes.d.ts +1 -1
  83. package/dist/provider-api/actions/custom-provider-registration.d.ts +10 -10
  84. package/dist/provider-api/actions/provider-api.d.ts +7 -7
  85. package/dist/provider-api/index.d.ts +1 -1
  86. package/dist/provider-api/index.js +26 -6
  87. package/dist/secrets/routes.d.ts +6 -6
  88. package/dist/server/action-discovery.js +5 -0
  89. package/dist/server/agent-chat-plugin.js +14 -0
  90. package/dist/server/agent-engine-api-key-route.d.ts +1 -1
  91. package/dist/server/agent-engine-default-model-route.d.ts +2 -2
  92. package/dist/server/agent-engine-ollama-models-route.d.ts +1 -1
  93. package/dist/server/core-routes-plugin.d.ts +1 -1
  94. package/dist/server/core-routes-plugin.js +18 -3
  95. package/dist/server/index.d.ts +1 -1
  96. package/dist/server/index.js +1 -1
  97. package/dist/server/realtime-token.d.ts +1 -1
  98. package/dist/server/workspace-provider-oauth.d.ts +1 -0
  99. package/dist/server/workspace-provider-oauth.js +4 -2
  100. package/dist/sharing/access.js +4 -3
  101. package/dist/templates/chat/app/components/chat/ChatRouteContent.tsx +9 -16
  102. package/dist/triggers/actions/manage-automation.d.ts +5 -5
  103. package/dist/vite/action-types-plugin.js +4 -0
  104. package/dist/vite/client.js +11 -3
  105. package/package.json +8 -10
  106. package/src/templates/chat/app/components/chat/ChatRouteContent.tsx +9 -16
@@ -49,6 +49,11 @@ export interface A2AConnectionRequestMetadata {
49
49
  reason: "connect" | "grant" | "reauthorize" | "admin_required";
50
50
  appId?: string;
51
51
  detail?: string;
52
+ source?: {
53
+ id: string;
54
+ kind: "workspace_connection";
55
+ label?: string;
56
+ };
52
57
  }
53
58
  export interface AgentSkill {
54
59
  id: string;
@@ -1656,7 +1656,11 @@ export async function callConnectedAgentReference(input) {
1656
1656
  ...(connectionRequest.appId
1657
1657
  ? { appId: connectionRequest.appId }
1658
1658
  : {}),
1659
- source: { id: input.agent, kind: "agent", label: input.agent },
1659
+ source: connectionRequest.source ?? {
1660
+ id: input.agent,
1661
+ kind: "agent",
1662
+ label: input.agent,
1663
+ },
1660
1664
  });
1661
1665
  }
1662
1666
  relay.finish("error");
@@ -1684,12 +1688,28 @@ function parseA2AConnectionRequest(error) {
1684
1688
  }
1685
1689
  const appId = typeof request.appId === "string" ? request.appId.trim() : "";
1686
1690
  const detail = typeof request.detail === "string" ? request.detail.trim() : "";
1691
+ const sourceValue = request.source && typeof request.source === "object"
1692
+ ? request.source
1693
+ : null;
1694
+ const sourceId = typeof sourceValue?.id === "string" ? sourceValue.id.trim() : "";
1695
+ const sourceLabel = typeof sourceValue?.label === "string" ? sourceValue.label.trim() : "";
1687
1696
  return {
1688
1697
  version: 1,
1689
1698
  provider,
1690
1699
  reason,
1691
1700
  ...(appId && appId.length <= 120 ? { appId } : {}),
1692
1701
  ...(detail && detail.length <= 1_000 ? { detail } : {}),
1702
+ ...(sourceValue?.kind === "workspace_connection" &&
1703
+ sourceId === provider &&
1704
+ sourceId.length <= 120
1705
+ ? {
1706
+ source: {
1707
+ id: sourceId,
1708
+ kind: "workspace_connection",
1709
+ ...(sourceLabel ? { label: sourceLabel.slice(0, 120) } : {}),
1710
+ },
1711
+ }
1712
+ : {}),
1693
1713
  };
1694
1714
  }
1695
1715
  const MAX_CONNECTED_AGENT_PROGRESS_DETAIL_CHARS = 200;
@@ -2648,6 +2668,11 @@ export function permanentPreconditionReason(toolName, message) {
2648
2668
  .trim()
2649
2669
  // The headline appends its own sentence punctuation.
2650
2670
  .replace(/[.。]+$/, "");
2671
+ const nestedPrecondition = reason
2672
+ .match(/\bI stopped because [\w-]+ can't run yet:\s*(.+?)\. That needs to be fixed outside this chat\b/i)?.[1]
2673
+ ?.trim();
2674
+ if (nestedPrecondition)
2675
+ return nestedPrecondition;
2651
2676
  if (!reason)
2652
2677
  return null;
2653
2678
  if (/\bI stopped because\b/i.test(reason) ||
@@ -139,8 +139,8 @@ export declare function createAutomationCallbackHandler(runtime: AutomationRunti
139
139
  duplicate?: undefined;
140
140
  eventId?: undefined;
141
141
  } | {
142
- error?: undefined;
143
142
  accepted: boolean;
144
143
  duplicate: boolean;
145
144
  eventId: string;
145
+ error?: undefined;
146
146
  }>;
package/dist/catalog.json CHANGED
@@ -51,6 +51,7 @@
51
51
  "playwright": "1.63.0",
52
52
  "react": "^19.2.7",
53
53
  "react-dom": "^19.2.7",
54
+ "react-router": "8.1.0",
54
55
  "recharts": "^3.9.2",
55
56
  "sonner": "^2.0.7",
56
57
  "tailwind-merge": "^3.5.0",
@@ -7,6 +7,7 @@ import { parse as parseYaml, stringify as stringifyYaml } from "yaml";
7
7
  import { DISPATCH_WORKSPACE_ROOT_REDIRECTS, getWorkspaceAppIdValidationError, } from "../shared/workspace-app-id.js";
8
8
  import { setupAgentSymlinks } from "./setup-agents.js";
9
9
  import { coreTemplates, getTemplate, allTemplateNames, } from "./templates-meta.js";
10
+ import { addConfiguredMigrationDependencies } from "./upgrade.js";
10
11
  import { ensureNodePtyBuildDependency, parseWorkspaceScope, workspacifyApp, } from "./workspacify.js";
11
12
  const __filename = fileURLToPath(import.meta.url);
12
13
  const __dirname = path.dirname(__filename);
@@ -553,6 +554,7 @@ async function createWorkspaceInteractive(name, opts, clack) {
553
554
  ...resolution,
554
555
  shape: "workspace",
555
556
  });
557
+ addConfiguredFeatureDependencies(appDir, targetDir);
556
558
  ensureGuardedScaffold(appDir);
557
559
  fixWebManifestName(appDir, appName, templateName, resolution.sourceIdentity);
558
560
  rewriteNetlifyToml(appDir, appName, "workspace");
@@ -795,6 +797,7 @@ async function scaffoldOneAppIntoWorkspace(workspace, appName, templateName, cla
795
797
  ...resolution,
796
798
  shape: "workspace",
797
799
  });
800
+ addConfiguredFeatureDependencies(appDir, workspace.workspaceRoot);
798
801
  ensureScaffoldEmailBrandingConfig(appDir, appName, templateName);
799
802
  ensureGuardedScaffold(appDir);
800
803
  fixWebManifestName(appDir, appName, templateName, resolution.sourceIdentity);
@@ -1630,6 +1633,7 @@ function postProcessStandalone(name, targetDir, templateName, resolution) {
1630
1633
  pkg.optionalDependencies,
1631
1634
  ].some((deps) => Boolean(deps?.["node-pty"]));
1632
1635
  fs.writeFileSync(pkgPath, JSON.stringify(pkg, null, 2) + "\n");
1636
+ addConfiguredFeatureDependencies(targetDir);
1633
1637
  }
1634
1638
  catch (error) {
1635
1639
  const detail = error instanceof Error ? error.message : String(error);
@@ -1686,6 +1690,16 @@ function postProcessStandalone(name, targetDir, templateName, resolution) {
1686
1690
  fixStandaloneTsconfig(targetDir, templateName);
1687
1691
  setupAgentSymlinks(targetDir);
1688
1692
  }
1693
+ function addConfiguredFeatureDependencies(appDir, workspaceRoot = appDir) {
1694
+ const packageFile = path.join(appDir, "package.json");
1695
+ if (!fs.existsSync(packageFile))
1696
+ return;
1697
+ addConfiguredMigrationDependencies({
1698
+ root: workspaceRoot,
1699
+ kind: workspaceRoot === appDir ? "standalone" : "workspace",
1700
+ packageFiles: [packageFile],
1701
+ });
1702
+ }
1689
1703
  function ensureReactRouterBuildDependencies(pkg) {
1690
1704
  const allDeps = {
1691
1705
  ...pkg.dependencies,
@@ -2,7 +2,7 @@ import { spawnSync } from "node:child_process";
2
2
  import fs from "node:fs";
3
3
  import { createRequire } from "node:module";
4
4
  import path from "node:path";
5
- import { Node, Project, QuoteKind, SyntaxKind, } from "ts-morph";
5
+ import { Node, Project, QuoteKind, StructureKind, SyntaxKind, } from "ts-morph";
6
6
  import { bundledCorePackageVersion, isMigrationManifestActive, loadMigrationManifestsForProject, migrationMoveStatus, resolveMigrationSymbolMove, } from "../package-lifecycle/migration-manifest.js";
7
7
  const SOURCE_EXTENSIONS = new Set([".ts", ".tsx"]);
8
8
  const CSS_EXTENSIONS = new Set([".css"]);
@@ -180,6 +180,7 @@ function recordIntroducedDependency(pending, sourceFile, root, from, to) {
180
180
  }
181
181
  function importedNameStructure(importedName, localName, nextName, typeOnly) {
182
182
  return {
183
+ kind: StructureKind.ImportSpecifier,
183
184
  name: nextName,
184
185
  alias: localName !== nextName
185
186
  ? localName
@@ -546,6 +546,9 @@ const SKILL_INSTRUCTION_CLIENT_LABELS = {
546
546
  "claude-code-cli": "Claude Code",
547
547
  codex: "Shared .agents skills",
548
548
  cowork: "MCP only",
549
+ cursor: "Cursor",
550
+ opencode: "OpenCode",
551
+ "github-copilot": "GitHub Copilot",
549
552
  pi: "Pi",
550
553
  };
551
554
  const SKILL_INSTRUCTION_CLIENT_HINTS = {
@@ -553,12 +556,16 @@ const SKILL_INSTRUCTION_CLIENT_HINTS = {
553
556
  "claude-code-cli": "Also write Claude Code's native .claude/skills and commands files.",
554
557
  codex: "Project scope writes .agents skills/commands for Codex, Pi, Cursor, OpenCode, Copilot, and similar agents; user scope writes Codex's ~/.codex skills/commands.",
555
558
  cowork: "MCP only",
559
+ cursor: "Uses shared project .agents skills and commands.",
560
+ opencode: "Uses shared project .agents skills and commands.",
561
+ "github-copilot": "Uses shared project .agents skills and commands.",
556
562
  pi: "Project scope writes .agents/skills plus .pi/prompts; user scope writes ~/.agents/skills plus ~/.pi/agent/prompts.",
557
563
  };
558
564
  function normalizeKnownSkillTarget(value) {
559
565
  const key = value?.trim().toLowerCase();
560
- if (!key)
566
+ if (!key || !Object.hasOwn(BUILT_IN_APP_SKILL_ALIASES, key)) {
561
567
  return undefined;
568
+ }
562
569
  return BUILT_IN_APP_SKILL_ALIASES[key];
563
570
  }
564
571
  function isKnownSkill(value) {
@@ -894,10 +901,10 @@ function mergeContentLocalFilesManifest(existing, baseDir) {
894
901
  const apps = isJsonRecord(manifest.apps) ? { ...manifest.apps } : {};
895
902
  const contentApp = isJsonRecord(apps.content) ? { ...apps.content } : {};
896
903
  const defaults = defaultContentLocalFilesAppConfig();
897
- if (!Array.isArray(contentApp.roots) || contentApp.roots.length === 0) {
898
- contentApp.roots = defaults.roots;
899
- }
900
- contentApp.roots = contentApp.roots.map((root) => {
904
+ const roots = Array.isArray(contentApp.roots) && contentApp.roots.length > 0
905
+ ? contentApp.roots
906
+ : defaults.roots;
907
+ contentApp.roots = roots.map((root) => {
901
908
  if (!isJsonRecord(root) || typeof root.path !== "string")
902
909
  return root;
903
910
  const source = isJsonRecord(root.source) ? root.source : {};
@@ -1094,7 +1101,7 @@ function removeEmptyParents(start, boundary) {
1094
1101
  }
1095
1102
  }
1096
1103
  function restoreInstallPaths(snapshots, boundary) {
1097
- for (const snapshot of snapshots.toReversed()) {
1104
+ for (const snapshot of snapshots.slice().reverse()) {
1098
1105
  fs.rmSync(snapshot.target, { recursive: true, force: true });
1099
1106
  if (snapshot.existed) {
1100
1107
  fs.mkdirSync(path.dirname(snapshot.target), { recursive: true });
@@ -1609,25 +1616,6 @@ function updateSkillInstallStates(states, dryRun) {
1609
1616
  }
1610
1617
  return updated;
1611
1618
  }
1612
- function normalizeClientIds(values) {
1613
- if (!Array.isArray(values))
1614
- return [];
1615
- const seen = new Set();
1616
- const out = [];
1617
- for (const value of values) {
1618
- if (typeof value !== "string")
1619
- continue;
1620
- const id = value.toLowerCase();
1621
- if (!CLIENTS.includes(id))
1622
- continue;
1623
- const client = id;
1624
- if (seen.has(client))
1625
- continue;
1626
- seen.add(client);
1627
- out.push(client);
1628
- }
1629
- return out;
1630
- }
1631
1619
  function isMcpClientId(value) {
1632
1620
  return CLIENTS.includes(value);
1633
1621
  }
@@ -1949,7 +1937,7 @@ async function promptForPlanMcpUrl() {
1949
1937
  placeholder: "https://my-plan-app.example.com",
1950
1938
  validate(value) {
1951
1939
  try {
1952
- resolveMcpUrlOverride(value);
1940
+ resolveMcpUrlOverride(value ?? "");
1953
1941
  return undefined;
1954
1942
  }
1955
1943
  catch (err) {
@@ -2678,7 +2666,7 @@ async function connectAfterEnsure(installTarget, clients, parsed, options) {
2678
2666
  const clearSpinner = () => {
2679
2667
  if (!spinnerActive)
2680
2668
  return;
2681
- spinner.clear();
2669
+ spinner?.clear();
2682
2670
  spinnerActive = false;
2683
2671
  };
2684
2672
  const writeAuthMessage = () => {
@@ -3627,11 +3615,6 @@ export async function runSkills(argv, options = {}) {
3627
3615
  .map((result) => result.connectCommand)
3628
3616
  .filter((command) => Boolean(command))),
3629
3617
  ];
3630
- const authLine = authConnected
3631
- ? "Authentication: completed."
3632
- : pendingConnectCommands.length
3633
- ? `Authentication: pending — run ${pendingConnectCommands.join(" && ")}`
3634
- : "";
3635
3618
  const githubActions = [
3636
3619
  ...new Set(results
3637
3620
  .map((result) => result.githubActionPath)
@@ -1,5 +1,5 @@
1
1
  import { type SpawnSyncReturns } from "node:child_process";
2
- import { type MigrationManifest, type MigrationDependency } from "../package-lifecycle/migration-manifest.js";
2
+ import { type MigrationDependency } from "../package-lifecycle/migration-manifest.js";
3
3
  declare const PINNABLE_SECTIONS: readonly ["dependencies", "devDependencies", "optionalDependencies"];
4
4
  export type UpgradeCommand = "run" | "check" | "help";
5
5
  export interface UpgradeCliOptions {
@@ -114,8 +114,9 @@ export declare function isPinnedOrLocalVersion(version: string): boolean;
114
114
  export declare function shouldBumpAgentNativeVersion(version: string): boolean;
115
115
  export declare function selectMigrationDependencies(dependencies: MigrationDependency[], environment: NodeJS.ProcessEnv): MigrationDependency[];
116
116
  export declare function readUpgradeEnvironment(projectRoot: string, packageDir: string, shellEnvironment: NodeJS.ProcessEnv): NodeJS.ProcessEnv;
117
- export declare function loadActiveMigrationDependencies(projectRoot: string, packageVersion: string | null, manifests?: MigrationManifest[]): MigrationDependency[];
117
+ export declare function loadActiveMigrationDependencies(projectRoot: string, packageVersion: string | null, manifests?: import("../package-lifecycle/migration-manifest.js").MigrationManifest[]): MigrationDependency[];
118
118
  export declare function planMigrationDependencyAdditions(project: UpgradeProject, shellEnvironment?: NodeJS.ProcessEnv): UpgradeDependencyAddition[];
119
+ export declare function addConfiguredMigrationDependencies(project: UpgradeProject, shellEnvironment?: NodeJS.ProcessEnv): void;
119
120
  export declare function pinResolvedAgentNativeVersions(project: UpgradeProject): AgentNativePinResult;
120
121
  export declare function detectUpgradeProject(cwd: string): UpgradeProject | null;
121
122
  export declare function resolveInstalledPackageVersion(projectRoot: string, packageName: string): string | null;
@@ -384,6 +384,9 @@ function applyMigrationDependencyAdditions(additions) {
384
384
  writeJsonFile(file, read.value);
385
385
  }
386
386
  }
387
+ export function addConfiguredMigrationDependencies(project, shellEnvironment = process.env) {
388
+ applyMigrationDependencyAdditions(planMigrationDependencyAdditions(project, shellEnvironment));
389
+ }
387
390
  export function pinResolvedAgentNativeVersions(project) {
388
391
  const pins = [];
389
392
  const unresolved = [];
@@ -44,7 +44,7 @@ export function ensureNodePtyBuildDependency(workspaceRoot) {
44
44
  "dependencies",
45
45
  "node-gyp",
46
46
  ], NODE_PTY_BUILD_DEPENDENCY);
47
- const updated = document.toString();
47
+ const updated = document.toString({ lineWidth: 0 });
48
48
  if (updated !== current)
49
49
  fs.writeFileSync(workspacePath, updated);
50
50
  }
@@ -1,12 +1,13 @@
1
+ import { AgentKitRunSlotBusyError } from "@agent-native/agentkit/client";
1
2
  import { isAgentKitProtocolVersion, parseAgentThreadSnapshot, } from "@agent-native/agentkit/protocol";
2
3
  import { agentNativePath } from "../api-path.js";
3
4
  import { dispatchAgentChatRunning } from "../use-agent-chat-running-threads.js";
4
5
  import { appendChatThreadScopeParams, } from "../use-chat-threads.js";
5
6
  import { AGENT_NATIVE_PROTOCOL_METADATA_KEY, createAgentKitProtocolAdapter, } from "./agentkit-protocol.js";
6
7
  import { createAgentNativeChatRuntime, } from "./runtime.js";
7
- const RUN_SLOT_TIMEOUT_MS = 5_000;
8
8
  const RUN_SLOT_POLL_INTERVAL_MS = 150;
9
9
  const RUN_SLOT_STABLE_POLLS = 2;
10
+ const RUN_SLOT_MAX_POLLS = RUN_SLOT_STABLE_POLLS * 2;
10
11
  function asRecord(value) {
11
12
  return value && typeof value === "object" && !Array.isArray(value)
12
13
  ? value
@@ -954,9 +955,8 @@ export function createAgentNativeAgentKitTransport(options = {}) {
954
955
  };
955
956
  }
956
957
  async function waitForRunSlot(threadId) {
957
- const deadline = Date.now() + RUN_SLOT_TIMEOUT_MS;
958
958
  let consecutiveClearPolls = 0;
959
- while (Date.now() < deadline) {
959
+ for (let poll = 0; poll < RUN_SLOT_MAX_POLLS; poll += 1) {
960
960
  const response = await fetcher(`${apiUrl}/runs/active?threadId=${encodeURIComponent(threadId)}`, { headers: await headers({ sessionId: threadId }) });
961
961
  if (!response.ok)
962
962
  throw await responseError(response);
@@ -964,22 +964,22 @@ export function createAgentNativeAgentKitTransport(options = {}) {
964
964
  if (!status) {
965
965
  throw new TypeError("Agent chat active-run response must be an object.");
966
966
  }
967
- if (status.awaitingRedispatch === true) {
968
- throw new Error("The agent runtime owns a continuation for this thread; the queued message remains pending.");
969
- }
970
- const clear = status.active !== true ||
971
- status.status === "completed" ||
972
- status.status === "complete" ||
973
- status.status === "failed" ||
974
- status.status === "cancelled" ||
975
- status.status === "errored" ||
976
- status.status === "aborted";
967
+ const clear = status.awaitingRedispatch !== true &&
968
+ (status.active !== true ||
969
+ status.status === "completed" ||
970
+ status.status === "complete" ||
971
+ status.status === "failed" ||
972
+ status.status === "cancelled" ||
973
+ status.status === "errored" ||
974
+ status.status === "aborted");
977
975
  consecutiveClearPolls = clear ? consecutiveClearPolls + 1 : 0;
978
976
  if (consecutiveClearPolls >= RUN_SLOT_STABLE_POLLS)
979
977
  return;
980
- await new Promise((resolve) => setTimeout(resolve, RUN_SLOT_POLL_INTERVAL_MS));
978
+ if (poll + 1 < RUN_SLOT_MAX_POLLS) {
979
+ await new Promise((resolve) => setTimeout(resolve, RUN_SLOT_POLL_INTERVAL_MS));
980
+ }
981
981
  }
982
- throw new Error("The current agent run did not release the thread; the queued message remains pending.");
982
+ throw new AgentKitRunSlotBusyError();
983
983
  }
984
984
  async function readQueue(threadId) {
985
985
  const thread = await snapshot(threadId);
@@ -967,9 +967,11 @@ function mapAgentNativeEvent(raw, input) {
967
967
  reason: ev.connectionReason ?? "connect",
968
968
  appId: ev.appId,
969
969
  detail: ev.detail,
970
- source: ev.agent
971
- ? { id: ev.agent, kind: "agent", label: ev.agent }
972
- : undefined,
970
+ source: ev.source
971
+ ? { ...ev.source, kind: ev.source.kind ?? "connection" }
972
+ : ev.agent
973
+ ? { id: ev.agent, kind: "agent", label: ev.agent }
974
+ : undefined,
973
975
  },
974
976
  ];
975
977
  }
@@ -4,6 +4,8 @@ export interface FeatureFlagActor {
4
4
  }
5
5
  export interface FeatureFlagMetadata {
6
6
  key: string;
7
+ canManage?: boolean;
8
+ movedToLab?: string;
7
9
  displayName?: string | null;
8
10
  description?: string | null;
9
11
  defaultValue: boolean;
@@ -67,7 +67,9 @@ export declare function useIconPickerLabels(): {
67
67
  allCategories: string;
68
68
  loadError: string;
69
69
  saveError: string;
70
+ uploadFailed: string;
70
71
  uploadTooLarge: string;
72
+ uploadUnsupportedType: string;
71
73
  retry: string;
72
74
  uploadHint: string;
73
75
  colorNames: {
@@ -488,7 +488,9 @@ export function useIconPickerLabels() {
488
488
  allCategories: t("iconPicker.allCategories"),
489
489
  loadError: t("iconPicker.loadError"),
490
490
  saveError: t("iconPicker.saveError"),
491
+ uploadFailed: t("iconPicker.uploadFailed"),
491
492
  uploadTooLarge: t("iconPicker.uploadTooLarge"),
493
+ uploadUnsupportedType: t("iconPicker.uploadUnsupportedType"),
492
494
  retry: t("iconPicker.retry"),
493
495
  uploadHint: t("iconPicker.uploadHint"),
494
496
  colorNames: Object.fromEntries(Object.keys(defaultEnglishMessages.iconPicker.colorNames).map((color) => [
@@ -1,4 +1,5 @@
1
1
  export { startWorkspaceProviderOAuth, workspaceProviderOAuthUrl, type WorkspaceProviderOAuthOptions, type WorkspaceProviderOAuthScope, } from "./workspace-provider-oauth.js";
2
+ export { getWorkspaceConnectionProvider } from "../../connections/catalog.js";
2
3
  export { channelConnectionState, hasMissingRequiredCredentials, listChannelsForSettings, type ChannelConnectionState, type ChannelCredential, } from "./channel-setup.js";
3
4
  export { useIntegrationStatus } from "./useIntegrationStatus.js";
4
5
  export type { IntegrationStatus } from "./useIntegrationStatus.js";
@@ -1,4 +1,5 @@
1
1
  export { startWorkspaceProviderOAuth, workspaceProviderOAuthUrl, } from "./workspace-provider-oauth.js";
2
+ export { getWorkspaceConnectionProvider } from "../../connections/catalog.js";
2
3
  export { channelConnectionState, hasMissingRequiredCredentials, listChannelsForSettings, } from "./channel-setup.js";
3
4
  export { useIntegrationStatus } from "./useIntegrationStatus.js";
4
5
  export { listIntegrationEnvStatuses, listIntegrationStatuses, saveIntegrationEnvVars, setIntegrationEnabled, setupIntegration, disconnectManagedIntegrationInstallation, listManagedIntegrationInstallations, managedIntegrationOAuthUrl, managedSlackAgentManifestUrl, listManagedIntegrationScopes, saveManagedIntegrationScope, listManagedIntegrationBudgets, listManagedIntegrationMemory, forgetManagedIntegrationMemory, saveManagedIntegrationBudget, testManagedIntegrationInstallation, IntegrationClientError, } from "./api.js";
@@ -1 +1 @@
1
- export { useLab, useLabState, useLabs, type LabReference, type LabValues, } from "./use-lab.js";
1
+ export { useLab, useLabState, useLabs, type LabReference, type LabValues, type LabStates, } from "./use-lab.js";
@@ -1,5 +1,7 @@
1
1
  import type { LabDefinition } from "../../labs/registry.js";
2
+ import type { UserLabState } from "../../labs/store.js";
2
3
  export type LabValues = Record<string, boolean>;
4
+ export type LabStates = Record<string, UserLabState>;
3
5
  /**
4
6
  * A lab by key, or by its definition. Pass the definition so the lab reads as
5
7
  * its `defaultEnabled` until the server answers (and when it can't); a bare
@@ -8,6 +10,9 @@ export type LabValues = Record<string, boolean>;
8
10
  export type LabReference = string | Pick<LabDefinition, "key" | "defaultEnabled">;
9
11
  export declare function useLabState(lab: LabReference): {
10
12
  enabled: boolean;
13
+ source: UserLabState["source"] | null;
14
+ mixed: boolean;
15
+ legacyValues?: Record<string, boolean>;
11
16
  isLoading: boolean;
12
17
  isError: boolean;
13
18
  isSuccess: boolean;
@@ -6,13 +6,17 @@ function labKey(lab) {
6
6
  export function useLabState(lab) {
7
7
  const key = labKey(lab);
8
8
  const { status } = useSession();
9
- const query = useActionQuery("get-labs", undefined, {
9
+ const query = useActionQuery("get-lab-states", undefined, {
10
10
  enabled: status === "authenticated",
11
11
  });
12
+ const state = query.data?.[key];
12
13
  return {
13
- enabled: query.data
14
- ? query.data[key] === true
14
+ enabled: state
15
+ ? state.enabled
15
16
  : typeof lab !== "string" && lab.defaultEnabled === true,
17
+ source: state?.source ?? null,
18
+ mixed: state?.mixed ?? false,
19
+ legacyValues: state?.legacyValues,
16
20
  isLoading: query.isLoading || (status === "loading" && query.data === undefined),
17
21
  isError: query.isError,
18
22
  isSuccess: query.isSuccess,
@@ -2,14 +2,16 @@ export interface McpConnectionResumeRequest {
2
2
  message: string;
3
3
  returnUrl: string;
4
4
  createdAt: number;
5
+ completionId?: string;
5
6
  agentKit?: {
6
7
  threadId: string;
7
8
  runId: string;
8
9
  requestId: string;
9
10
  };
10
11
  }
11
- export declare function saveMcpConnectionResume(message: string, agentKit?: McpConnectionResumeRequest["agentKit"]): boolean;
12
- export declare function clearMcpConnectionResume(): void;
12
+ export declare function saveMcpConnectionResume(message: string, agentKit?: McpConnectionResumeRequest["agentKit"], completionId?: string): boolean;
13
+ export declare function getPendingMcpConnectionResume(returnUrl?: string): McpConnectionResumeRequest | null;
14
+ export declare function clearMcpConnectionResume(expected?: McpConnectionResumeRequest | string): void;
13
15
  export declare function consumeMcpConnectionResume(returnUrl?: string): McpConnectionResumeRequest | null;
14
- export declare function notifyMcpConnectionComplete(): void;
16
+ export declare function notifyMcpConnectionComplete(completionId?: string): void;
15
17
  export declare function addMcpConnectionCompleteListener(listener: () => void): () => void;