@agent-native/core 0.153.9 → 0.154.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (149) hide show
  1. package/corpus/README.md +1 -1
  2. package/corpus/templates/analytics/AGENTS.md +20 -30
  3. package/corpus/templates/analytics/actions/search-dashboard-references.ts +58 -0
  4. package/corpus/templates/analytics/app/components/layout/Sidebar.tsx +1 -1
  5. package/corpus/templates/analytics/app/lib/utils.ts +1 -1
  6. package/corpus/templates/analytics/app/pages/DataSources.tsx +2 -1
  7. package/corpus/templates/analytics/app/pages/adhoc/sql-dashboard/ViewSqlPopover.tsx +1 -1
  8. package/corpus/templates/analytics/app/pages/monitoring/errors/IssueList.tsx +4 -2
  9. package/corpus/templates/analytics/app/pages/sessions/SessionsPage.tsx +4 -2
  10. package/corpus/templates/analytics/server/lib/agent-chat-plan-mode.ts +2 -0
  11. package/corpus/templates/analytics/server/lib/dashboards-store.ts +366 -3
  12. package/corpus/templates/analytics/server/lib/real-data-actions.ts +3 -1
  13. package/corpus/templates/analytics/server/plugins/agent-chat.ts +6 -2
  14. package/corpus/templates/calendar/app/components/calendar/EventDialog.tsx +1 -1
  15. package/corpus/templates/calendar/app/lib/utils.ts +1 -1
  16. package/corpus/templates/clips/app/components/recorder/recorder-engine.ts +32 -5
  17. package/corpus/templates/clips/app/components/sharing/share-ui.tsx +15 -15
  18. package/corpus/templates/clips/app/i18n/en-US.ts +3 -3
  19. package/corpus/templates/clips/app/lib/utils.ts +5 -6
  20. package/corpus/templates/clips/app/root.tsx +4 -1
  21. package/corpus/templates/clips/app/routes/share.$shareId.tsx +2 -2
  22. package/corpus/templates/clips/chrome-extension/src/offscreen.ts +43 -8
  23. package/corpus/templates/clips/desktop/src/app.tsx +27 -13
  24. package/corpus/templates/clips/desktop/src/lib/recorder.ts +23 -9
  25. package/corpus/templates/clips/desktop/src-tauri/src/native_screen/custom_capture.rs +261 -11
  26. package/corpus/templates/clips/desktop/src-tauri/src/native_screen.rs +21 -3
  27. package/corpus/templates/clips/shared/mic-audio-cleanup.ts +350 -0
  28. package/corpus/templates/content/app/i18n-data.ts +10 -10
  29. package/corpus/templates/content/scripts/check-native-deps.mjs +181 -15
  30. package/corpus/templates/design/.agents/skills/design-generation/SKILL.md +79 -7
  31. package/corpus/templates/design/.agents/skills/design-systems/SKILL.md +14 -2
  32. package/corpus/templates/design/.agents/skills/visual-edit/SKILL.md +2 -2
  33. package/corpus/templates/design/.generated/bridge/editor-chrome.generated.ts +35 -11
  34. package/corpus/templates/design/actions/get-design-system.ts +103 -3
  35. package/corpus/templates/design/actions/import-design-tokens.ts +37 -8
  36. package/corpus/templates/design/actions/import-github.ts +32 -138
  37. package/corpus/templates/design/actions/index-design-system-with-builder.ts +49 -16
  38. package/corpus/templates/design/actions/present-design-variants.ts +93 -4
  39. package/corpus/templates/design/actions/run-design-audit.ts +229 -0
  40. package/corpus/templates/design/actions/sync-design-system-with-builder.ts +64 -0
  41. package/corpus/templates/design/app/components/design/DesignImportPanel.tsx +2 -1
  42. package/corpus/templates/design/app/components/design/TweaksPanel.tsx +2 -1
  43. package/corpus/templates/design/app/components/design/code-workbench/commands.ts +2 -2
  44. package/corpus/templates/design/app/components/design/inspector/DesignColorPicker.tsx +17 -4
  45. package/corpus/templates/design/app/components/design/inspector/GradientEditor.tsx +5 -1
  46. package/corpus/templates/design/app/components/design/inspector/ImageFillControls.tsx +5 -1
  47. package/corpus/templates/design/app/hooks/use-question-flow.ts +81 -5
  48. package/corpus/templates/design/app/i18n/en-US.ts +1 -1
  49. package/corpus/templates/design/app/i18n-data.ts +32 -1
  50. package/corpus/templates/design/app/i18n-keyboard-shortcuts.ts +10 -10
  51. package/corpus/templates/design/app/pages/DesignSystemSetup.tsx +83 -11
  52. package/corpus/templates/design/app/pages/DesignSystems.tsx +14 -0
  53. package/corpus/templates/design/app/pages/design-editor/generation-prompt-directives.ts +22 -0
  54. package/corpus/templates/design/changelog/2026-08-13-a-screen-that-would-render-behind-an-invisible-alpine-overla.md +6 -0
  55. package/corpus/templates/design/changelog/2026-08-13-attach-a-ui-screenshot-and-the-design-is-reproduced-not-rein.md +6 -0
  56. package/corpus/templates/design/changelog/2026-08-13-linking-a-design-system-means-you-never-get-generic-directio.md +6 -0
  57. package/corpus/templates/design/changelog/2026-08-13-the-design-audit-now-reports-when-a-screen-ignores-its-linke.md +6 -0
  58. package/corpus/templates/design/changelog/2026-08-13-the-design-system-preview-now-shows-how-many-named-tokens-we.md +6 -0
  59. package/corpus/templates/design/changelog/2026-08-13-your-design-system-prompt-and-reference-screenshots-now-reac.md +6 -0
  60. package/corpus/templates/design/server/lib/builder-design-system-proxy.ts +18 -2
  61. package/corpus/templates/design/shared/design-review.ts +1 -0
  62. package/corpus/templates/design/shared/html-integrity.ts +171 -0
  63. package/corpus/templates/mail/app/lib/utils.ts +1 -1
  64. package/corpus/templates/plan/app/pages/PlansPage.tsx +5 -2
  65. package/corpus/templates/slides/.agents/skills/design-systems/SKILL.md +10 -6
  66. package/corpus/templates/slides/actions/index-design-system-with-builder.ts +41 -3
  67. package/corpus/templates/slides/actions/sync-design-system-with-builder.ts +64 -0
  68. package/corpus/templates/slides/app/components/deck/DeckCard.tsx +1 -1
  69. package/corpus/templates/slides/app/components/design-system/DesignSystemSetup.tsx +193 -20
  70. package/corpus/templates/slides/app/components/editor/EditorSidebar.tsx +58 -33
  71. package/corpus/templates/slides/app/components/editor/EditorToolbar.tsx +28 -41
  72. package/corpus/templates/slides/app/components/editor/ExportMenu.tsx +119 -91
  73. package/corpus/templates/slides/app/components/editor/ImageOverlay.tsx +16 -0
  74. package/corpus/templates/slides/app/components/editor/SlideEditor.tsx +158 -31
  75. package/corpus/templates/slides/app/components/editor/SlideOverflowWarning.tsx +30 -14
  76. package/corpus/templates/slides/app/components/editor/SpeakerNotesPanel.tsx +2 -2
  77. package/corpus/templates/slides/app/components/editor/canvas-interactions/slides-canvas-adapter.ts +4 -1
  78. package/corpus/templates/slides/app/components/editor/rich-text-selection.ts +14 -0
  79. package/corpus/templates/slides/app/components/editor/slide-text-targets.ts +24 -0
  80. package/corpus/templates/slides/app/global.css +24 -0
  81. package/corpus/templates/slides/app/hooks/use-navigation-state.ts +5 -1
  82. package/corpus/templates/slides/app/i18n/en-US.ts +19 -10
  83. package/corpus/templates/slides/app/lib/deck-filter.ts +47 -0
  84. package/corpus/templates/slides/app/lib/export-google-slides-client.ts +15 -4
  85. package/corpus/templates/slides/app/lib/export-pptx-client.ts +637 -1
  86. package/corpus/templates/slides/app/lib/image-download.ts +84 -0
  87. package/corpus/templates/slides/app/lib/utils.ts +1 -1
  88. package/corpus/templates/slides/app/pages/Index.tsx +25 -9
  89. package/corpus/templates/slides/netlify.toml +1 -0
  90. package/corpus/templates/slides/server/lib/builder-design-system-proxy.ts +14 -2
  91. package/dist/agent/production-agent.js +1 -1
  92. package/dist/brand-kit/types.d.ts +10 -2
  93. package/dist/cli/code.js +1 -1
  94. package/dist/cli/index.js +30 -1
  95. package/dist/cli/native-dependencies.d.ts +24 -0
  96. package/dist/cli/native-dependencies.js +264 -0
  97. package/dist/cli/plan-local.js +1 -1
  98. package/dist/cli/skills-content/design-visual-edit-skill.d.ts +1 -1
  99. package/dist/cli/skills-content/design-visual-edit-skill.js +2 -2
  100. package/dist/cli/skills-content/help.d.ts +1 -1
  101. package/dist/cli/skills-content/help.js +2 -1
  102. package/dist/cli/skills.js +2 -1
  103. package/dist/cli/visualize-repo.js +1 -1
  104. package/dist/client/FeedbackButton.js +12 -12
  105. package/dist/client/NewWorkspaceAppFlow.js +4 -1
  106. package/dist/client/agent-chat-adapter.js +3 -4
  107. package/dist/client/agent-page/AgentTabsPage.d.ts +2 -2
  108. package/dist/client/agent-page/AgentTabsPage.js +12 -9
  109. package/dist/client/assistant-ui-recovery.d.ts +1 -1
  110. package/dist/client/assistant-ui-recovery.js +4 -0
  111. package/dist/client/chat/message-components.d.ts +11 -3
  112. package/dist/client/chat/message-components.js +31 -5
  113. package/dist/client/chat/tool-call-display.d.ts +2 -1
  114. package/dist/client/chat/tool-call-display.js +33 -15
  115. package/dist/client/db-admin/SqlEditor.js +1 -1
  116. package/dist/client/dev-overlay/DevOverlay.js +2 -2
  117. package/dist/client/extensions/ExtensionsSidebarSection.js +2 -1
  118. package/dist/client/extensions/portable-extension.js +4 -0
  119. package/dist/client/guided-questions.d.ts +8 -0
  120. package/dist/client/guided-questions.js +12 -3
  121. package/dist/client/onboarding/FirstRunOnboarding.js +2 -1
  122. package/dist/client/org/TeamPage.js +14 -3
  123. package/dist/client/settings/SettingsPanel.js +26 -1
  124. package/dist/client/sharing/ShareButton.js +16 -24
  125. package/dist/client/sse-event-processor.js +35 -15
  126. package/dist/client/tool-display.d.ts +9 -0
  127. package/dist/client/tool-display.js +39 -0
  128. package/dist/client/vite-dev-recovery-script.js +1 -1
  129. package/dist/extensions/html-shell.js +5 -0
  130. package/dist/integrations/catalog.js +9 -8
  131. package/dist/observability/routes.d.ts +2 -2
  132. package/dist/secrets/routes.d.ts +6 -6
  133. package/dist/server/agent-chat/prompt-resources.js +17 -16
  134. package/dist/server/agent-chat-plugin.d.ts +9 -0
  135. package/dist/server/agent-chat-plugin.js +31 -9
  136. package/dist/server/builder-design-systems.d.ts +33 -1
  137. package/dist/server/builder-design-systems.js +293 -11
  138. package/dist/server/design-token-utils.d.ts +11 -0
  139. package/dist/server/design-token-utils.js +68 -16
  140. package/dist/server/index.d.ts +1 -1
  141. package/dist/server/index.js +1 -1
  142. package/dist/server/onboarding-html.js +2 -1
  143. package/dist/shared/docs-url.d.ts +24 -0
  144. package/dist/shared/docs-url.js +39 -0
  145. package/dist/shared/index.d.ts +1 -0
  146. package/dist/shared/index.js +1 -0
  147. package/dist/templates/default/app/routes/_index.tsx +2 -1
  148. package/package.json +2 -2
  149. package/src/templates/default/app/routes/_index.tsx +2 -1
@@ -1,7 +1,7 @@
1
1
  import { LLM_MISSING_CREDENTIALS_ERROR_CODE, LLM_MISSING_CREDENTIALS_MESSAGE, } from "../agent/engine/credential-errors.js";
2
2
  import { emitChatFirstOpenApp } from "./chat-first.js";
3
3
  import { formatChatErrorText, normalizeChatError } from "./error-format.js";
4
- import { humanizeToolLabelText, humanizeToolName, runningToolLabel, } from "./tool-display.js";
4
+ import { humanizeToolLabelText, humanizeToolName, isToolCallActive, runningToolLabel, } from "./tool-display.js";
5
5
  /**
6
6
  * Kept verbatim in sync with `INTERRUPTED_TOOL_RESULT_MARKER`
7
7
  * (agent/production-agent.ts): the server matches this substring in replayed
@@ -13,16 +13,21 @@ const INTERRUPTED_ACTIVITY_RESULT = "Stopped before this action started.";
13
13
  /**
14
14
  * Maximum number of assistant-ui repository updates we deliver in one browser
15
15
  * event-loop turn. Durable-run replay can put hundreds of SSE frames into the
16
- * stream queue before the client attaches; draining all of them through
17
- * assistant-ui without a macrotask boundary synchronously nests React external
18
- * store notifications until React throws "Maximum update depth exceeded."
16
+ * stream queue before the client attaches; allowing even a small burst through
17
+ * assistant-ui can synchronously nest React external-store notifications until
18
+ * React throws "Maximum update depth exceeded."
19
19
  *
20
- * A timer scheduled on the first result resets the count when the stream is
20
+ * A task scheduled on the first result resets the count when the stream is
21
21
  * naturally idle between network chunks. We only await it when results are
22
22
  * arriving densely enough to hit this bound, so normal live token streaming
23
23
  * keeps its existing latency while replay bursts yield cooperatively.
24
24
  */
25
- const SSE_RENDER_UPDATES_PER_EVENT_LOOP_TURN = 20;
25
+ const SSE_RENDER_UPDATES_PER_EVENT_LOOP_TURN = 1;
26
+ function waitForNextEventLoopTurn() {
27
+ return new Promise((resolve) => {
28
+ setTimeout(resolve, 0);
29
+ });
30
+ }
26
31
  export function settleInterruptedToolCalls(content, result = INTERRUPTED_TOOL_RESULT, options) {
27
32
  let changed = false;
28
33
  for (const part of content) {
@@ -825,6 +830,8 @@ function hasCompletedCustomUi(content) {
825
830
  return hasCompletedTool && lastCompletedToolIsCustomUi;
826
831
  }
827
832
  export function appendMissingFinalResponseWarning(content, completedToolNames) {
833
+ if (content.some((part) => isToolCallActive(part)))
834
+ return null;
828
835
  const lastTextIndex = lastAssistantTextIndex(content);
829
836
  const successfulToolNames = [
830
837
  ...new Set(completedToolNames ?? completedToolNamesAfterLastAssistantText(content)),
@@ -1245,6 +1252,7 @@ export function processEvent(ev, content, toolCallCounter, tabId, state) {
1245
1252
  : "Done";
1246
1253
  part.structuredMeta = {
1247
1254
  ...part.structuredMeta,
1255
+ ...(ev.status === "pending" ? { agentPending: true } : {}),
1248
1256
  ...(ev.durationMs != null
1249
1257
  ? { agentDurationMs: ev.durationMs }
1250
1258
  : {}),
@@ -1618,15 +1626,19 @@ export async function* readSSEStream(body, content, toolCallCounter, tabId, onSe
1618
1626
  const currentNoProgressTimeoutMs = () => inFlightWork > 0
1619
1627
  ? Math.max(noProgressTimeoutMs, SSE_IN_FLIGHT_WORK_TIMEOUT_MS)
1620
1628
  : noProgressTimeoutMs;
1621
- const paceRenderUpdate = async () => {
1629
+ const paceRenderUpdate = async (hasBufferedEvent) => {
1630
+ // A single event in a network chunk already has a natural read boundary.
1631
+ // Avoid inserting a task into quiet streams so watchdogs and fake-clock
1632
+ // consumers can continue to observe their own timers normally.
1633
+ if (!hasBufferedEvent) {
1634
+ renderUpdatesThisTurn = 0;
1635
+ return;
1636
+ }
1622
1637
  renderUpdatesThisTurn += 1;
1623
1638
  if (!nextEventLoopTurn) {
1624
- nextEventLoopTurn = new Promise((resolve) => {
1625
- setTimeout(() => {
1626
- renderUpdatesThisTurn = 0;
1627
- nextEventLoopTurn = null;
1628
- resolve();
1629
- }, 0);
1639
+ nextEventLoopTurn = waitForNextEventLoopTurn().then(() => {
1640
+ renderUpdatesThisTurn = 0;
1641
+ nextEventLoopTurn = null;
1630
1642
  });
1631
1643
  }
1632
1644
  if (renderUpdatesThisTurn >= SSE_RENDER_UPDATES_PER_EVENT_LOOP_TURN) {
@@ -1686,12 +1698,19 @@ export async function* readSSEStream(body, content, toolCallCounter, tabId, onSe
1686
1698
  const lines = buf.split("\n");
1687
1699
  buf = lines.pop() ?? "";
1688
1700
  let sawProgressEvent = false;
1689
- for (const line of lines) {
1701
+ let bufferedDataEvents = lines.reduce((count, pendingLine) => count +
1702
+ (pendingLine.startsWith("data: ") &&
1703
+ pendingLine.slice(6).trim().length > 0
1704
+ ? 1
1705
+ : 0), 0);
1706
+ for (let lineIndex = 0; lineIndex < lines.length; lineIndex += 1) {
1707
+ const line = lines[lineIndex];
1690
1708
  if (!line.startsWith("data: "))
1691
1709
  continue;
1692
1710
  const raw = line.slice(6).trim();
1693
1711
  if (!raw)
1694
1712
  continue;
1713
+ bufferedDataEvents -= 1;
1695
1714
  let ev;
1696
1715
  try {
1697
1716
  ev = JSON.parse(raw);
@@ -1751,7 +1770,8 @@ export async function* readSSEStream(body, content, toolCallCounter, tabId, onSe
1751
1770
  }
1752
1771
  : result;
1753
1772
  if (terminalResult) {
1754
- await paceRenderUpdate();
1773
+ const hasBufferedEvent = bufferedDataEvents > 0;
1774
+ await paceRenderUpdate(hasBufferedEvent);
1755
1775
  yield withStreamMetadata(terminalResult);
1756
1776
  }
1757
1777
  if (hasStalledPreparingAction(preparingActionState, Date.now(), preparationStallTimeoutMs)) {
@@ -7,7 +7,16 @@ type ToolDisplayPart = {
7
7
  toolName?: string;
8
8
  argsText?: string;
9
9
  args?: Record<string, unknown>;
10
+ result?: unknown;
11
+ outcome?: "unknown";
12
+ activity?: boolean;
13
+ structuredMeta?: Record<string, unknown>;
10
14
  };
15
+ export declare function isDelegatedAgentToolCall(part: ToolDisplayPart): boolean;
16
+ /** True when a tool has not reported a result and the stream did not mark it unknown. */
17
+ export declare function isToolCallInFlight(part: ToolDisplayPart): boolean;
18
+ /** True when the UI must not present this tool as finished. */
19
+ export declare function isToolCallActive(part: ToolDisplayPart): boolean;
11
20
  /**
12
21
  * `call-agent` emits both its ordinary tool row and a richer `agent:<name>`
13
22
  * progress row. Keep the ordinary part in message state for tool completion
@@ -33,6 +33,45 @@ export function humanizeToolLabelText(label, toolName) {
33
33
  return text;
34
34
  return text.split(tool).join(humanizeToolName(tool));
35
35
  }
36
+ const ACTIVE_AGENT_ACTIVITY_PHASES = new Set([
37
+ "reasoning",
38
+ "tool",
39
+ "responding",
40
+ ]);
41
+ export function isDelegatedAgentToolCall(part) {
42
+ return (part.type === "tool-call" && part.toolName?.startsWith("agent:") === true);
43
+ }
44
+ function hasActiveDelegatedAgentActivity(part) {
45
+ const snapshot = part.structuredMeta?.agentActivity;
46
+ if (!snapshot || typeof snapshot !== "object")
47
+ return false;
48
+ const record = snapshot;
49
+ if (typeof record.activePhase === "string" &&
50
+ ACTIVE_AGENT_ACTIVITY_PHASES.has(record.activePhase)) {
51
+ return true;
52
+ }
53
+ return (Array.isArray(record.toolCalls) &&
54
+ record.toolCalls.some((tool) => tool != null &&
55
+ typeof tool === "object" &&
56
+ tool.status === "running"));
57
+ }
58
+ /** True when a tool has not reported a result and the stream did not mark it unknown. */
59
+ export function isToolCallInFlight(part) {
60
+ if (part.type !== "tool-call")
61
+ return false;
62
+ if (part.result !== undefined || part.outcome === "unknown")
63
+ return false;
64
+ return part.activity !== true || isDelegatedAgentToolCall(part);
65
+ }
66
+ /** True when the UI must not present this tool as finished. */
67
+ export function isToolCallActive(part) {
68
+ if (isToolCallInFlight(part))
69
+ return true;
70
+ return (isDelegatedAgentToolCall(part) &&
71
+ part.outcome !== "unknown" &&
72
+ (part.structuredMeta?.agentPending === true ||
73
+ hasActiveDelegatedAgentActivity(part)));
74
+ }
36
75
  function normalizedAgentName(value) {
37
76
  if (typeof value !== "string")
38
77
  return null;
@@ -87,7 +87,7 @@ export function getViteDevRecoveryScript() {
87
87
  console.warn("[agent-native] Dev server keeps re-bundling. Manual refresh needed.", reason);
88
88
  showOverlay(
89
89
  "Dev server out of sync",
90
- "Auto-reload gave up after " + MAX_RELOADS + " tries. Refresh the page (\\u2318R / Ctrl+R)."
90
+ "Auto-reload gave up after " + MAX_RELOADS + " tries. Refresh the page (\\u2318R / Ctrl R)."
91
91
  );
92
92
  return;
93
93
  }
@@ -147,6 +147,11 @@ export function buildExtensionHtml(content, themeVars, isDark, extensionId, bind
147
147
  </style>
148
148
  <style>
149
149
  *, *::before, *::after { border-color: hsl(var(--border)); }
150
+ /* Alpine only honours x-cloak when a stylesheet hides it, and extension
151
+ content is a body snippet that cannot supply one. Without this, an
152
+ x-cloak overlay paints over the whole extension until Alpine boots —
153
+ and forever if it never does. */
154
+ [x-cloak] { display: none !important; }
150
155
  html, body {
151
156
  /* Transparent so the iframe inherits the host surface (dashboard panel,
152
157
  sidebar, chat) instead of painting the browser's default white canvas.
@@ -5,6 +5,7 @@
5
5
  * Runtime behavior stays in adapters and plugins; consumers must use
6
6
  * availability and support maturity before offering a connection flow.
7
7
  */
8
+ import { docsUrl } from "../shared/docs-url.js";
8
9
  export const INTEGRATION_CATEGORIES = [
9
10
  "channel",
10
11
  "provider",
@@ -26,7 +27,7 @@ const BUILT_IN_CHANNEL_CATALOG = [
26
27
  "Managed installations select encrypted credentials by workspace; legacy manual installs should use SLACK_ALLOWED_TEAM_IDS.",
27
28
  ],
28
29
  documentation: {
29
- href: "/docs/messaging#slack",
30
+ href: docsUrl("messaging", { hash: "slack" }),
30
31
  externalHref: "https://api.slack.com/apps",
31
32
  externalLabel: "Open Slack apps",
32
33
  },
@@ -88,7 +89,7 @@ const BUILT_IN_CHANNEL_CATALOG = [
88
89
  "Production deployments must allowlist Microsoft Entra tenant IDs; proactive messaging without an inbound conversation reference is not implemented.",
89
90
  ],
90
91
  documentation: {
91
- href: "/docs/messaging#microsoft-teams",
92
+ href: docsUrl("messaging", { hash: "microsoft-teams" }),
92
93
  externalHref: "https://dev.botframework.com/",
93
94
  externalLabel: "Open Bot Framework",
94
95
  },
@@ -148,7 +149,7 @@ const BUILT_IN_CHANNEL_CATALOG = [
148
149
  "Interaction tokens are retained only while the queued task is active and normally expire after 15 minutes.",
149
150
  ],
150
151
  documentation: {
151
- href: "/docs/messaging#discord",
152
+ href: docsUrl("messaging", { hash: "discord" }),
152
153
  externalHref: "https://discord.com/developers/applications",
153
154
  externalLabel: "Open Discord applications",
154
155
  },
@@ -197,7 +198,7 @@ const BUILT_IN_CHANNEL_CATALOG = [
197
198
  "Webhook verification requires TELEGRAM_WEBHOOK_SECRET for production-safe setup.",
198
199
  ],
199
200
  documentation: {
200
- href: "/docs/messaging#telegram",
201
+ href: docsUrl("messaging", { hash: "telegram" }),
201
202
  externalHref: "https://t.me/BotFather",
202
203
  externalLabel: "Open BotFather",
203
204
  },
@@ -246,7 +247,7 @@ const BUILT_IN_CHANNEL_CATALOG = [
246
247
  "Meta pricing and the customer-service conversation window can limit replies; template-message flows are not implemented by this adapter.",
247
248
  ],
248
249
  documentation: {
249
- href: "/docs/messaging#whatsapp",
250
+ href: docsUrl("messaging", { hash: "whatsapp" }),
250
251
  externalHref: "https://developers.facebook.com/apps",
251
252
  externalLabel: "Open Meta developer console",
252
253
  },
@@ -303,7 +304,7 @@ const BUILT_IN_CHANNEL_CATALOG = [
303
304
  "Email replies preserve RFC email threads and reply-all when the agent was CC'd.",
304
305
  ],
305
306
  documentation: {
306
- href: "/docs/messaging#email",
307
+ href: docsUrl("messaging", { hash: "email" }),
307
308
  externalHref: "https://resend.com/webhooks",
308
309
  externalLabel: "Open Resend webhooks",
309
310
  },
@@ -363,7 +364,7 @@ const AUTOMATION_CATALOG = [
363
364
  "Use a configured webhook URL or n8n credential; never put an n8n URL or credential in an agent prompt.",
364
365
  ],
365
366
  documentation: {
366
- href: "/docs/automation-connectors#n8n",
367
+ href: docsUrl("automation-connectors", { hash: "n8n" }),
367
368
  externalHref: "https://docs.n8n.io/integrations/builtin/core-nodes/n8n-nodes-base.webhook/",
368
369
  externalLabel: "Open n8n Webhook docs",
369
370
  },
@@ -405,7 +406,7 @@ const AUTOMATION_CATALOG = [
405
406
  "Zapier MCP is a separately configured remote MCP connection with its own account and authorization flow.",
406
407
  ],
407
408
  documentation: {
408
- href: "/docs/automation-connectors#zapier",
409
+ href: docsUrl("automation-connectors", { hash: "zapier" }),
409
410
  externalHref: "https://docs.zapier.com/mcp/home",
410
411
  externalLabel: "Open Zapier MCP docs",
411
412
  },
@@ -41,14 +41,14 @@ export declare function createObservabilityHandler(): import("h3").EventHandlerW
41
41
  thumbsUpRate: number;
42
42
  avgEvalScore: number;
43
43
  } | {
44
- error?: undefined;
45
44
  ok?: undefined;
45
+ error?: undefined;
46
46
  summary: import("./types.js").TraceSummary;
47
47
  spans: import("./types.js").TraceSpan[];
48
48
  id?: undefined;
49
49
  } | {
50
- error?: undefined;
51
50
  ok?: undefined;
51
+ error?: undefined;
52
52
  summary?: undefined;
53
53
  spans?: undefined;
54
54
  id: string;
@@ -37,17 +37,17 @@ export declare function createWriteSecretHandler(): import("h3").EventHandlerWit
37
37
  ok?: undefined;
38
38
  status?: undefined;
39
39
  } | {
40
- error?: undefined;
41
40
  ok: boolean;
42
41
  status: string;
42
+ error?: undefined;
43
43
  } | {
44
44
  ok?: undefined;
45
45
  error: string;
46
46
  removed?: undefined;
47
47
  } | {
48
- error?: undefined;
49
48
  ok: boolean;
50
49
  removed: boolean;
50
+ error?: undefined;
51
51
  }>>;
52
52
  /**
53
53
  * POST /_agent-native/secrets/:key/test — validate an optional candidate value
@@ -58,13 +58,13 @@ export declare function createTestSecretHandler(): import("h3").EventHandlerWith
58
58
  error: string;
59
59
  note?: undefined;
60
60
  } | {
61
- error?: undefined;
62
61
  ok: boolean;
63
62
  note?: undefined;
64
- } | {
65
63
  error?: undefined;
64
+ } | {
66
65
  ok: boolean;
67
66
  note: string;
67
+ error?: undefined;
68
68
  } | {
69
69
  note?: undefined;
70
70
  ok: boolean;
@@ -95,11 +95,11 @@ export interface AdHocSecretPayload {
95
95
  export declare function createAdHocSecretHandler(): import("h3").EventHandlerWithFetch<import("h3").EventHandlerRequest, Promise<AdHocSecretPayload[] | {
96
96
  error: string;
97
97
  } | {
98
- error?: undefined;
99
98
  ok: boolean;
100
99
  key: string;
101
- } | {
102
100
  error?: undefined;
101
+ } | {
103
102
  ok: boolean;
104
103
  removed: boolean;
104
+ error?: undefined;
105
105
  }>>;
@@ -416,21 +416,22 @@ export function resourceScopeForOwner(owner, currentOwner) {
416
416
  return "resource";
417
417
  }
418
418
  async function loadAgentsResourceForPrompt(owner, scope, maxChars = SHARED_PROMPT_RESOURCE_MAX_CHARS) {
419
+ let agents;
419
420
  try {
420
- const agents = await resourceGetByPath(owner, "AGENTS.md");
421
- if (!agents?.content?.trim())
422
- return null;
423
- return promptResourceBlock({
424
- name: "AGENTS.md",
425
- scope,
426
- path: "AGENTS.md",
427
- content: agents.content,
428
- maxChars,
429
- });
421
+ agents = await resourceGetByPath(owner, "AGENTS.md");
430
422
  }
431
- catch {
432
- return null;
423
+ catch (error) {
424
+ throw new Error(`Unable to read durable AGENTS.md instructions for ${scope} (${owner}). The run cannot safely continue without them.`, { cause: error });
433
425
  }
426
+ if (!agents?.content?.trim())
427
+ return null;
428
+ return promptResourceBlock({
429
+ name: "AGENTS.md",
430
+ scope,
431
+ path: "AGENTS.md",
432
+ content: agents.content,
433
+ maxChars,
434
+ });
434
435
  }
435
436
  async function loadInstructionResourcesForPrompt(owner, scope, maxChars = SHARED_PROMPT_RESOURCE_MAX_CHARS, summaryOnly = false) {
436
437
  try {
@@ -671,14 +672,14 @@ export async function loadResourcesForPrompt(owner, compact = false, selfAppId,
671
672
  // every app in the workspace, not copied into app scopes. They may come from
672
673
  // SQL, Dispatch, or local file mode.
673
674
  const workspaceAgents = await loadAgentsResourceForPrompt(WORKSPACE_OWNER, "workspace", promptResourceMaxChars);
674
- addSection(workspaceAgents);
675
+ addSection(workspaceAgents, "required");
675
676
  addSections(await loadInstructionResourcesForPrompt(WORKSPACE_OWNER, "workspace-instruction", promptResourceMaxChars, compact));
676
677
  const organizationOwner = sharedResourceOwner(orgId);
677
678
  // 4. Legacy app-wide defaults. Existing deployments keep their seeded
678
679
  // shared guidance as an inherited fallback; organization writes never
679
680
  // mutate this owner.
680
681
  const appDefaultAgents = await loadAgentsResourceForPrompt(SHARED_OWNER, organizationOwner === SHARED_OWNER ? "shared" : "app-default", promptResourceMaxChars);
681
- addSection(appDefaultAgents);
682
+ addSection(appDefaultAgents, "required");
682
683
  addSections(await loadInstructionResourcesForPrompt(SHARED_OWNER, organizationOwner === SHARED_OWNER
683
684
  ? "shared-instruction"
684
685
  : "app-default-instruction", promptResourceMaxChars, compact));
@@ -686,14 +687,14 @@ export async function loadResourcesForPrompt(owner, compact = false, selfAppId,
686
687
  // learnings that Slack/integration runs share with interactive app chat.
687
688
  if (organizationOwner !== SHARED_OWNER) {
688
689
  const organizationAgents = await loadAgentsResourceForPrompt(organizationOwner, "organization", promptResourceMaxChars);
689
- addSection(organizationAgents);
690
+ addSection(organizationAgents, "required");
690
691
  addSections(await loadInstructionResourcesForPrompt(organizationOwner, "organization-instruction", promptResourceMaxChars, compact));
691
692
  }
692
693
  // 6. Personal SQL resources. These come last in the instruction stack so a
693
694
  // user can narrow or override organization/app and workspace defaults.
694
695
  if (owner !== SHARED_OWNER && owner !== WORKSPACE_OWNER) {
695
696
  const personalAgents = await loadAgentsResourceForPrompt(owner, "personal", promptResourceMaxChars);
696
- addSection(personalAgents, "user");
697
+ addSection(personalAgents, "required");
697
698
  addSections(await loadInstructionResourcesForPrompt(owner, "personal-instruction", promptResourceMaxChars, compact), "user");
698
699
  }
699
700
  const resourceSkillsBlock = await loadResourceSkillsPromptBlock(owner, orgId);
@@ -16,6 +16,15 @@ export { loadResourcesForPrompt };
16
16
  export { _agentChatPromptSectionsForTests };
17
17
  export { buildPublicAgentA2ASkills };
18
18
  export { assembleA2AFinalResponse };
19
+ export declare function buildLeanSystemPrompt(input: {
20
+ basePrompt: string;
21
+ resources: string;
22
+ additionalFramework?: string;
23
+ cacheSplit?: string;
24
+ extra?: string;
25
+ modelOverlay?: string;
26
+ runtimeContext?: string;
27
+ }): string;
19
28
  export type { AgentChatPluginOptions };
20
29
  export { runA2AAgentLoop };
21
30
  export { runMCPAgentLoop };
@@ -34,6 +34,7 @@ import { getSkillNameFromPath } from "../resources/metadata.js";
34
34
  import { resourceList, resourceListAccessible, resourceGet, ensurePersonalDefaults, SHARED_OWNER, WORKSPACE_OWNER, } from "../resources/store.js";
35
35
  import { normalizeDatabaseToolsMode } from "../scripts/db/tool-mode.js";
36
36
  import { getSetting, putSetting } from "../settings/store.js";
37
+ import { docsUrl } from "../shared/docs-url.js";
37
38
  import { handleSharedThreadRequest, } from "./agent-chat/shared-thread.js";
38
39
  import { discoverAgents } from "./agent-discovery.js";
39
40
  import { resolveAgentRunOwnerContext, runWithAgentRunContext, seedBackgroundAgentRunOwnerContext, } from "./agent-run-context.js";
@@ -124,6 +125,15 @@ export { loadResourcesForPrompt };
124
125
  export { _agentChatPromptSectionsForTests };
125
126
  export { buildPublicAgentA2ASkills };
126
127
  export { assembleA2AFinalResponse };
128
+ export function buildLeanSystemPrompt(input) {
129
+ return (input.basePrompt +
130
+ (input.additionalFramework ?? "") +
131
+ (input.cacheSplit ?? "") +
132
+ input.resources +
133
+ (input.extra ?? "") +
134
+ (input.modelOverlay ?? "") +
135
+ (input.runtimeContext ?? ""));
136
+ }
127
137
  export { runA2AAgentLoop };
128
138
  export { runMCPAgentLoop };
129
139
  export { createA2AEngineToolSurface };
@@ -2600,20 +2610,25 @@ Non-code requests are still fine on this surface: read data, navigate the UI, su
2600
2610
  // so everything after it can change without a cache write.
2601
2611
  if (leanPrompt) {
2602
2612
  const leanRunPolicyPrompt = buildLeanRunPolicyPrompt(codeEditingSurfaceRestriction, prodCodeExecPromptNote);
2613
+ const resources = await loadResourcesForPrompt(owner, true, options?.appId, undefined, { disabledFrameworkGroups });
2603
2614
  await emitContextXraySystemSections(event, {
2604
2615
  frameworkPrompt: leanBasePrompt.slice(0, Math.max(0, leanBasePrompt.length - leanActionsPrompt.length)),
2605
2616
  actionsPrompt: leanActionsPrompt,
2606
2617
  additionalFramework: leanRunPolicyPrompt,
2618
+ resources,
2607
2619
  extra,
2608
2620
  modelOverlay,
2609
2621
  runtimeContext,
2610
2622
  });
2611
- return setSystemPromptOnContext(leanBasePrompt +
2612
- leanRunPolicyPrompt +
2613
- SYSTEM_PROMPT_CACHE_SPLIT +
2614
- extra +
2615
- modelOverlay +
2616
- runtimeContext);
2623
+ return setSystemPromptOnContext(buildLeanSystemPrompt({
2624
+ basePrompt: leanBasePrompt,
2625
+ additionalFramework: leanRunPolicyPrompt,
2626
+ cacheSplit: SYSTEM_PROMPT_CACHE_SPLIT,
2627
+ resources,
2628
+ extra,
2629
+ modelOverlay,
2630
+ runtimeContext,
2631
+ }));
2617
2632
  }
2618
2633
  const resources = await loadResourcesForPrompt(owner, lazyContext, options?.appId, undefined, { disabledFrameworkGroups });
2619
2634
  // In lazy context mode, skip embedding the full schema. When database
@@ -2839,14 +2854,22 @@ Non-code requests are still fine on this surface: read data, navigate the UI, su
2839
2854
  // cached prompt prefix as possible. See the prod handler above
2840
2855
  // for the same pattern.
2841
2856
  if (leanPrompt) {
2857
+ const resources = await loadResourcesForPrompt(owner, true, options?.appId, undefined, { disabledFrameworkGroups });
2842
2858
  await emitContextXraySystemSections(event, {
2843
2859
  frameworkPrompt: leanBasePrompt.slice(0, Math.max(0, leanBasePrompt.length - leanActionsPrompt.length)),
2844
2860
  actionsPrompt: leanActionsPrompt,
2861
+ resources,
2845
2862
  extra,
2846
2863
  modelOverlay,
2847
2864
  runtimeContext,
2848
2865
  });
2849
- return setSystemPromptOnContext(leanBasePrompt + extra + modelOverlay + runtimeContext);
2866
+ return setSystemPromptOnContext(buildLeanSystemPrompt({
2867
+ basePrompt: leanBasePrompt,
2868
+ resources,
2869
+ extra,
2870
+ modelOverlay,
2871
+ runtimeContext,
2872
+ }));
2850
2873
  }
2851
2874
  const resources = await loadResourcesForPrompt(owner, lazyContext, options?.appId, undefined, { disabledFrameworkGroups });
2852
2875
  const schemaBlock = lazyContext || !databaseToolsEnabled
@@ -3510,8 +3533,7 @@ Non-code requests are still fine on this surface: read data, navigate the UI, su
3510
3533
  }
3511
3534
  const result = { skills };
3512
3535
  if (skills.length === 0) {
3513
- result.hint =
3514
- "No skills found. Add skill files under skills/ in Resources. Learn more: https://agent-native.com/docs/resources#skills";
3536
+ result.hint = `No skills found. Add skill files under skills/ in Resources. Learn more: ${docsUrl("agent-resources", { hash: "skills" })}`;
3515
3537
  }
3516
3538
  return result;
3517
3539
  }));
@@ -39,6 +39,8 @@ export interface BuilderDesignSystemProxyFieldsOptions {
39
39
  description?: string;
40
40
  surface: "design" | "slides";
41
41
  sourceKind?: BuilderDesignSystemSourceKind;
42
+ githubSources?: BuilderDesignSystemGitHubSource[];
43
+ syncedAt?: string;
42
44
  }
43
45
  export type BuilderDesignSystemSourceKind = "figma" | "code" | "github" | "mixed";
44
46
  export interface BuilderDesignSystemProxyFields {
@@ -55,6 +57,8 @@ export interface BuilderDesignSystemProxyReference {
55
57
  builderProjectId?: string;
56
58
  builderUrl?: string;
57
59
  builderStatus?: string;
60
+ githubSources?: BuilderDesignSystemGitHubSource[];
61
+ syncedAt?: string;
58
62
  }
59
63
  export interface BuilderDesignSystemDocsOptions {
60
64
  page?: number;
@@ -82,11 +86,20 @@ export interface BuilderDesignSystemIndexOptions {
82
86
  projectName?: string;
83
87
  description?: string;
84
88
  githubRepoUrl?: string;
89
+ githubRepos?: BuilderDesignSystemGitHubSource[];
85
90
  connectedProjectId?: string;
86
91
  files?: BuilderDesignSystemIndexFile[];
87
92
  selection?: Record<string, string[]>;
88
93
  devToolsVersion?: string;
89
94
  }
95
+ /** A durable, replayable GitHub source configuration for a Builder DSI kit. */
96
+ export interface BuilderDesignSystemGitHubSource {
97
+ repoUrl: string;
98
+ ref?: string;
99
+ include?: string[];
100
+ exclude?: string[];
101
+ instructions?: string;
102
+ }
90
103
  export interface BuilderDesignSystemIndexResult {
91
104
  ok: true;
92
105
  source: "builder";
@@ -124,6 +137,25 @@ export interface BuilderDesignSystemDecodeJobStatus {
124
137
  createdAt: number;
125
138
  updatedAt: number;
126
139
  }
140
+ export interface BuilderDesignSystemGitHubFile {
141
+ path: string;
142
+ content: string;
143
+ }
144
+ export interface BuilderDesignSystemGitHubFileCollection {
145
+ source: BuilderDesignSystemGitHubSource;
146
+ owner: string;
147
+ repo: string;
148
+ ref?: string;
149
+ files: BuilderDesignSystemGitHubFile[];
150
+ totalBytes: number;
151
+ truncated: boolean;
152
+ }
153
+ /**
154
+ * Resolve an explicitly scoped/ref'd GitHub source into bounded file uploads.
155
+ * Native Builder public-repo sources are preferred for unscoped public repos;
156
+ * this path exists so branch, folder, and private-repo imports are replayable.
157
+ */
158
+ export declare function collectBuilderDesignSystemGitHubFiles(input: BuilderDesignSystemGitHubSource): Promise<BuilderDesignSystemGitHubFileCollection>;
127
159
  export declare function fetchBuilderDesignSystemDecodeJobStatus(jobId: string): Promise<BuilderDesignSystemDecodeJobStatus>;
128
160
  export declare function getBuilderDesignSystemsBaseUrl(): string;
129
161
  export declare function mimeTypeForBuilderDesignSystemFilename(filename: string, explicit?: string): string;
@@ -131,7 +163,7 @@ export declare function buildBuilderDesignSystemIndexFiles({ codeFiles, designMd
131
163
  export declare function builderDesignSystemUrl(designSystemId?: string | null): string;
132
164
  export declare function builderProjectBranchUrl(projectId?: string | null, branchName?: string | null): string | undefined;
133
165
  export declare function localBuilderDesignSystemId(builderDesignSystemId: string): string;
134
- export declare function createBuilderDesignSystemProxyFields({ result, projectName, description, surface, sourceKind, }: BuilderDesignSystemProxyFieldsOptions): BuilderDesignSystemProxyFields;
166
+ export declare function createBuilderDesignSystemProxyFields({ result, projectName, description, surface, sourceKind, githubSources, syncedAt, }: BuilderDesignSystemProxyFieldsOptions): BuilderDesignSystemProxyFields;
135
167
  export declare function parseBuilderDesignSystemProxyReference(data: unknown): BuilderDesignSystemProxyReference | null;
136
168
  export declare function fetchBuilderDesignSystemDocs(designSystemId: string, options?: BuilderDesignSystemDocsOptions): Promise<BuilderDesignSystemDocument[]>;
137
169
  export declare function hydrateBuilderDesignSystemReference(reference: BuilderDesignSystemProxyReference, options?: BuilderDesignSystemDocsOptions): Promise<BuilderDesignSystemHydratedReference>;