@agent-native/core 0.16.1 → 0.16.3

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 (123) hide show
  1. package/README.md +21 -5
  2. package/dist/cli/code-agent-executor.js +1 -1
  3. package/dist/cli/code-agent-executor.js.map +1 -1
  4. package/dist/cli/code.d.ts.map +1 -1
  5. package/dist/cli/code.js +29 -4
  6. package/dist/cli/code.js.map +1 -1
  7. package/dist/client/AgentPanel.d.ts.map +1 -1
  8. package/dist/client/AgentPanel.js +9 -1
  9. package/dist/client/AgentPanel.js.map +1 -1
  10. package/dist/client/AssistantChat.js +2 -2
  11. package/dist/client/AssistantChat.js.map +1 -1
  12. package/dist/client/ConnectBuilderCard.js +1 -1
  13. package/dist/client/ConnectBuilderCard.js.map +1 -1
  14. package/dist/client/components/CodeRequiredDialog.d.ts.map +1 -1
  15. package/dist/client/components/CodeRequiredDialog.js +3 -1
  16. package/dist/client/components/CodeRequiredDialog.js.map +1 -1
  17. package/dist/client/composer/AgentComposerFrame.d.ts +3 -1
  18. package/dist/client/composer/AgentComposerFrame.d.ts.map +1 -1
  19. package/dist/client/composer/AgentComposerFrame.js +3 -3
  20. package/dist/client/composer/AgentComposerFrame.js.map +1 -1
  21. package/dist/client/composer/ComposerPlusMenu.d.ts.map +1 -1
  22. package/dist/client/composer/ComposerPlusMenu.js +2 -7
  23. package/dist/client/composer/ComposerPlusMenu.js.map +1 -1
  24. package/dist/client/composer/PromptComposer.d.ts +4 -1
  25. package/dist/client/composer/PromptComposer.d.ts.map +1 -1
  26. package/dist/client/composer/PromptComposer.js +3 -3
  27. package/dist/client/composer/PromptComposer.js.map +1 -1
  28. package/dist/client/composer/TiptapComposer.d.ts.map +1 -1
  29. package/dist/client/composer/TiptapComposer.js +13 -3
  30. package/dist/client/composer/TiptapComposer.js.map +1 -1
  31. package/dist/client/composer/useVoiceDictation.d.ts.map +1 -1
  32. package/dist/client/composer/useVoiceDictation.js +16 -10
  33. package/dist/client/composer/useVoiceDictation.js.map +1 -1
  34. package/dist/client/onboarding/OnboardingPanel.js +1 -1
  35. package/dist/client/onboarding/OnboardingPanel.js.map +1 -1
  36. package/dist/client/settings/BackgroundAgentSection.d.ts.map +1 -1
  37. package/dist/client/settings/BackgroundAgentSection.js +9 -2
  38. package/dist/client/settings/BackgroundAgentSection.js.map +1 -1
  39. package/dist/client/settings/BrowserSection.d.ts.map +1 -1
  40. package/dist/client/settings/BrowserSection.js +17 -3
  41. package/dist/client/settings/BrowserSection.js.map +1 -1
  42. package/dist/client/settings/SettingsPanel.d.ts.map +1 -1
  43. package/dist/client/settings/SettingsPanel.js +5 -5
  44. package/dist/client/settings/SettingsPanel.js.map +1 -1
  45. package/dist/client/settings/useBuilderStatus.d.ts +15 -2
  46. package/dist/client/settings/useBuilderStatus.d.ts.map +1 -1
  47. package/dist/client/settings/useBuilderStatus.js +99 -11
  48. package/dist/client/settings/useBuilderStatus.js.map +1 -1
  49. package/dist/client/settings/useBuilderStatus.spec.js +12 -6
  50. package/dist/client/settings/useBuilderStatus.spec.js.map +1 -1
  51. package/dist/code-agents/background-controller.d.ts +39 -0
  52. package/dist/code-agents/background-controller.d.ts.map +1 -0
  53. package/dist/code-agents/background-controller.js +249 -0
  54. package/dist/code-agents/background-controller.js.map +1 -0
  55. package/dist/code-agents/background-run.d.ts +58 -0
  56. package/dist/code-agents/background-run.d.ts.map +1 -0
  57. package/dist/code-agents/background-run.js +58 -0
  58. package/dist/code-agents/background-run.js.map +1 -0
  59. package/dist/code-agents/index.d.ts +2 -0
  60. package/dist/code-agents/index.d.ts.map +1 -1
  61. package/dist/code-agents/index.js +2 -0
  62. package/dist/code-agents/index.js.map +1 -1
  63. package/dist/connections/index.d.ts +1 -0
  64. package/dist/connections/index.d.ts.map +1 -1
  65. package/dist/connections/index.js +1 -0
  66. package/dist/connections/index.js.map +1 -1
  67. package/dist/connections/reader.d.ts +248 -0
  68. package/dist/connections/reader.d.ts.map +1 -0
  69. package/dist/connections/reader.js +461 -0
  70. package/dist/connections/reader.js.map +1 -0
  71. package/dist/credentials/index.d.ts +11 -0
  72. package/dist/credentials/index.d.ts.map +1 -1
  73. package/dist/credentials/index.js +40 -15
  74. package/dist/credentials/index.js.map +1 -1
  75. package/dist/index.d.ts +2 -2
  76. package/dist/index.d.ts.map +1 -1
  77. package/dist/index.js +2 -2
  78. package/dist/index.js.map +1 -1
  79. package/dist/server/agent-chat-plugin.d.ts +18 -0
  80. package/dist/server/agent-chat-plugin.d.ts.map +1 -1
  81. package/dist/server/agent-chat-plugin.js +57 -9
  82. package/dist/server/agent-chat-plugin.js.map +1 -1
  83. package/dist/server/agent-teams.d.ts +66 -1
  84. package/dist/server/agent-teams.d.ts.map +1 -1
  85. package/dist/server/agent-teams.js +433 -16
  86. package/dist/server/agent-teams.js.map +1 -1
  87. package/dist/server/builder-browser.d.ts +11 -0
  88. package/dist/server/builder-browser.d.ts.map +1 -1
  89. package/dist/server/builder-browser.js +45 -0
  90. package/dist/server/builder-browser.js.map +1 -1
  91. package/dist/server/core-routes-plugin.d.ts.map +1 -1
  92. package/dist/server/core-routes-plugin.js +25 -2
  93. package/dist/server/core-routes-plugin.js.map +1 -1
  94. package/dist/templates/workspace-root/AGENTS.md +5 -5
  95. package/dist/templates/workspace-root/README.md +1 -1
  96. package/dist/workspace-connections/credentials.d.ts +64 -0
  97. package/dist/workspace-connections/credentials.d.ts.map +1 -0
  98. package/dist/workspace-connections/credentials.js +378 -0
  99. package/dist/workspace-connections/credentials.js.map +1 -0
  100. package/dist/workspace-connections/index.d.ts +2 -1
  101. package/dist/workspace-connections/index.d.ts.map +1 -1
  102. package/dist/workspace-connections/index.js +2 -1
  103. package/dist/workspace-connections/index.js.map +1 -1
  104. package/dist/workspace-connections/store.d.ts +16 -0
  105. package/dist/workspace-connections/store.d.ts.map +1 -1
  106. package/dist/workspace-connections/store.js +57 -1
  107. package/dist/workspace-connections/store.js.map +1 -1
  108. package/docs/content/agent-teams.md +22 -5
  109. package/docs/content/cloneable-saas.md +2 -2
  110. package/docs/content/code-agents-ui.md +103 -3
  111. package/docs/content/creating-templates.md +16 -0
  112. package/docs/content/getting-started.md +40 -14
  113. package/docs/content/migration-workbench.md +25 -2
  114. package/docs/content/multi-app-workspace.md +1 -1
  115. package/docs/content/template-analytics.md +17 -1
  116. package/docs/content/template-brain.md +57 -28
  117. package/docs/content/template-dispatch.md +9 -2
  118. package/docs/content/workspace-connections.md +63 -14
  119. package/docs/content/workspace-management.md +9 -2
  120. package/docs/content/workspace.md +12 -5
  121. package/package.json +1 -1
  122. package/src/templates/workspace-root/AGENTS.md +5 -5
  123. package/src/templates/workspace-root/README.md +1 -1
@@ -1,5 +1,34 @@
1
1
  import { getSetting, putSetting, deleteSetting } from "../settings/store.js";
2
2
  const SETTING_PREFIX = "credential:";
3
+ function userCredentialSettingKey(email, key) {
4
+ return `u:${email.toLowerCase()}:${SETTING_PREFIX}${key}`;
5
+ }
6
+ function orgCredentialSettingKey(orgId, key) {
7
+ return `o:${orgId}:${SETTING_PREFIX}${key}`;
8
+ }
9
+ async function readCredentialSetting(settingKey) {
10
+ const setting = await getSetting(settingKey);
11
+ return setting && typeof setting.value === "string"
12
+ ? setting.value
13
+ : undefined;
14
+ }
15
+ /**
16
+ * Resolve a credential from one explicit legacy SQL credential scope.
17
+ *
18
+ * Prefer `resolveCredential()` for normal app-local credential lookup. This
19
+ * helper exists for workspace connection refs, where a ref can explicitly say
20
+ * "use the org-scoped key" and must not accidentally read a user override.
21
+ */
22
+ export async function resolveCredentialForScope(key, ctx) {
23
+ if (!ctx?.userEmail)
24
+ return undefined;
25
+ if (ctx.scope === "org") {
26
+ if (!ctx.orgId)
27
+ return undefined;
28
+ return readCredentialSetting(orgCredentialSettingKey(ctx.orgId, key));
29
+ }
30
+ return readCredentialSetting(userCredentialSettingKey(ctx.userEmail, key));
31
+ }
3
32
  /**
4
33
  * Resolve a credential, scoped to the caller's user (and falling back to
5
34
  * the active org's shared credential, if any).
@@ -15,18 +44,14 @@ const SETTING_PREFIX = "credential:";
15
44
  export async function resolveCredential(key, ctx) {
16
45
  if (!ctx?.userEmail)
17
46
  return undefined;
18
- const email = ctx.userEmail.toLowerCase();
19
- const userKey = `u:${email}:${SETTING_PREFIX}${key}`;
20
- const userSetting = await getSetting(userKey);
21
- if (userSetting && typeof userSetting.value === "string") {
22
- return userSetting.value;
23
- }
47
+ const userSetting = await resolveCredentialForScope(key, {
48
+ ...ctx,
49
+ scope: "user",
50
+ });
51
+ if (userSetting)
52
+ return userSetting;
24
53
  if (ctx.orgId) {
25
- const orgKey = `o:${ctx.orgId}:${SETTING_PREFIX}${key}`;
26
- const orgSetting = await getSetting(orgKey);
27
- if (orgSetting && typeof orgSetting.value === "string") {
28
- return orgSetting.value;
29
- }
54
+ return resolveCredentialForScope(key, { ...ctx, scope: "org" });
30
55
  }
31
56
  return undefined;
32
57
  }
@@ -48,10 +73,10 @@ export async function saveCredential(key, value, ctx) {
48
73
  if (!ctx.orgId) {
49
74
  throw new Error("saveCredential scope='org' requires orgId");
50
75
  }
51
- await putSetting(`o:${ctx.orgId}:${SETTING_PREFIX}${key}`, { value });
76
+ await putSetting(orgCredentialSettingKey(ctx.orgId, key), { value });
52
77
  return;
53
78
  }
54
- await putSetting(`u:${ctx.userEmail.toLowerCase()}:${SETTING_PREFIX}${key}`, {
79
+ await putSetting(userCredentialSettingKey(ctx.userEmail, key), {
55
80
  value,
56
81
  });
57
82
  }
@@ -66,9 +91,9 @@ export async function deleteCredential(key, ctx) {
66
91
  if (!ctx.orgId) {
67
92
  throw new Error("deleteCredential scope='org' requires orgId");
68
93
  }
69
- await deleteSetting(`o:${ctx.orgId}:${SETTING_PREFIX}${key}`);
94
+ await deleteSetting(orgCredentialSettingKey(ctx.orgId, key));
70
95
  return;
71
96
  }
72
- await deleteSetting(`u:${ctx.userEmail.toLowerCase()}:${SETTING_PREFIX}${key}`);
97
+ await deleteSetting(userCredentialSettingKey(ctx.userEmail, key));
73
98
  }
74
99
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\"../settings/store.js\";\n\nconst SETTING_PREFIX = \"credential:\";\n\nexport interface CredentialContext {\n userEmail: string;\n orgId?: string | null;\n}\n\n/**\n * Resolve a credential, scoped to the caller's user (and falling back to\n * the active org's shared credential, if any).\n *\n * SECURITY: NEVER reads from process.env. Env vars are global to the\n * deployment and would leak across users in a multi-tenant app. The only\n * sources are per-user / per-org rows in the SQL `settings` table.\n *\n * Storage keys (priority order):\n * 1. u:<email>:credential:<KEY> — per-user override\n * 2. o:<orgId>:credential:<KEY> — per-org shared credential (if orgId given)\n */\nexport async function resolveCredential(\n key: string,\n ctx: CredentialContext,\n): Promise<string | undefined> {\n if (!ctx?.userEmail) return undefined;\n const email = ctx.userEmail.toLowerCase();\n\n const userKey = `u:${email}:${SETTING_PREFIX}${key}`;\n const userSetting = await getSetting(userKey);\n if (userSetting && typeof userSetting.value === \"string\") {\n return userSetting.value;\n }\n\n if (ctx.orgId) {\n const orgKey = `o:${ctx.orgId}:${SETTING_PREFIX}${key}`;\n const orgSetting = await getSetting(orgKey);\n if (orgSetting && typeof orgSetting.value === \"string\") {\n return orgSetting.value;\n }\n }\n\n return undefined;\n}\n\n/**\n * Check if a credential is available for the given context.\n */\nexport async function hasCredential(\n key: string,\n ctx: CredentialContext,\n): Promise<boolean> {\n return (await resolveCredential(key, ctx)) !== undefined;\n}\n\n/**\n * Save a credential. By default writes to the per-user store; pass\n * `scope: \"org\"` to write to the active org's shared credentials.\n */\nexport async function saveCredential(\n key: string,\n value: string,\n ctx: CredentialContext & { scope?: \"user\" | \"org\" },\n): Promise<void> {\n if (!ctx?.userEmail) {\n throw new Error(\"saveCredential requires CredentialContext with userEmail\");\n }\n if (ctx.scope === \"org\") {\n if (!ctx.orgId) {\n throw new Error(\"saveCredential scope='org' requires orgId\");\n }\n await putSetting(`o:${ctx.orgId}:${SETTING_PREFIX}${key}`, { value });\n return;\n }\n await putSetting(`u:${ctx.userEmail.toLowerCase()}:${SETTING_PREFIX}${key}`, {\n value,\n });\n}\n\n/**\n * Delete a credential from the per-user (default) or per-org store.\n */\nexport async function deleteCredential(\n key: string,\n ctx: CredentialContext & { scope?: \"user\" | \"org\" },\n): Promise<void> {\n if (!ctx?.userEmail) {\n throw new Error(\n \"deleteCredential requires CredentialContext with userEmail\",\n );\n }\n if (ctx.scope === \"org\") {\n if (!ctx.orgId) {\n throw new Error(\"deleteCredential scope='org' requires orgId\");\n }\n await deleteSetting(`o:${ctx.orgId}:${SETTING_PREFIX}${key}`);\n return;\n }\n await deleteSetting(\n `u:${ctx.userEmail.toLowerCase()}:${SETTING_PREFIX}${key}`,\n );\n}\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/credentials/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAE7E,MAAM,cAAc,GAAG,aAAa,CAAC;AASrC,SAAS,wBAAwB,CAAC,KAAa,EAAE,GAAW;IAC1D,OAAO,KAAK,KAAK,CAAC,WAAW,EAAE,IAAI,cAAc,GAAG,GAAG,EAAE,CAAC;AAC5D,CAAC;AAED,SAAS,uBAAuB,CAAC,KAAa,EAAE,GAAW;IACzD,OAAO,KAAK,KAAK,IAAI,cAAc,GAAG,GAAG,EAAE,CAAC;AAC9C,CAAC;AAED,KAAK,UAAU,qBAAqB,CAClC,UAAkB;IAElB,MAAM,OAAO,GAAG,MAAM,UAAU,CAAC,UAAU,CAAC,CAAC;IAC7C,OAAO,OAAO,IAAI,OAAO,OAAO,CAAC,KAAK,KAAK,QAAQ;QACjD,CAAC,CAAC,OAAO,CAAC,KAAK;QACf,CAAC,CAAC,SAAS,CAAC;AAChB,CAAC;AAED;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,yBAAyB,CAC7C,GAAW,EACX,GAA0D;IAE1D,IAAI,CAAC,GAAG,EAAE,SAAS;QAAE,OAAO,SAAS,CAAC;IACtC,IAAI,GAAG,CAAC,KAAK,KAAK,KAAK,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;YACf,MAAM,IAAI,KAAK,CAAC,2CAA2C,CAAC,CAAC;QAC/D,CAAC;QACD,MAAM,UAAU,CAAC,uBAAuB,CAAC,GAAG,CAAC,KAAK,EAAE,GAAG,CAAC,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;QACrE,OAAO;IACT,CAAC;IACD,MAAM,UAAU,CAAC,wBAAwB,CAAC,GAAG,CAAC,SAAS,EAAE,GAAG,CAAC,EAAE;QAC7D,KAAK;KACN,CAAC,CAAC;AACL,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,gBAAgB,CACpC,GAAW,EACX,GAAmD;IAEnD,IAAI,CAAC,GAAG,EAAE,SAAS,EAAE,CAAC;QACpB,MAAM,IAAI,KAAK,CACb,4DAA4D,CAC7D,CAAC;IACJ,CAAC;IACD,IAAI,GAAG,CAAC,KAAK,KAAK,KAAK,EAAE,CAAC;QACxB,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC;YACf,MAAM,IAAI,KAAK,CAAC,6CAA6C,CAAC,CAAC;QACjE,CAAC;QACD,MAAM,aAAa,CAAC,uBAAuB,CAAC,GAAG,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,CAAC;QAC7D,OAAO;IACT,CAAC;IACD,MAAM,aAAa,CAAC,wBAAwB,CAAC,GAAG,CAAC,SAAS,EAAE,GAAG,CAAC,CAAC,CAAC;AACpE,CAAC","sourcesContent":["import { getSetting, putSetting, deleteSetting } from \"../settings/store.js\";\n\nconst SETTING_PREFIX = \"credential:\";\n\nexport interface CredentialContext {\n userEmail: string;\n orgId?: string | null;\n}\n\nexport type CredentialStorageScope = \"user\" | \"org\";\n\nfunction userCredentialSettingKey(email: string, key: string): string {\n return `u:${email.toLowerCase()}:${SETTING_PREFIX}${key}`;\n}\n\nfunction orgCredentialSettingKey(orgId: string, key: string): string {\n return `o:${orgId}:${SETTING_PREFIX}${key}`;\n}\n\nasync function readCredentialSetting(\n settingKey: string,\n): Promise<string | undefined> {\n const setting = await getSetting(settingKey);\n return setting && typeof setting.value === \"string\"\n ? setting.value\n : undefined;\n}\n\n/**\n * Resolve a credential from one explicit legacy SQL credential scope.\n *\n * Prefer `resolveCredential()` for normal app-local credential lookup. This\n * helper exists for workspace connection refs, where a ref can explicitly say\n * \"use the org-scoped key\" and must not accidentally read a user override.\n */\nexport async function resolveCredentialForScope(\n key: string,\n ctx: CredentialContext & { scope: CredentialStorageScope },\n): Promise<string | undefined> {\n if (!ctx?.userEmail) return undefined;\n if (ctx.scope === \"org\") {\n if (!ctx.orgId) return undefined;\n return readCredentialSetting(orgCredentialSettingKey(ctx.orgId, key));\n }\n return readCredentialSetting(userCredentialSettingKey(ctx.userEmail, key));\n}\n\n/**\n * Resolve a credential, scoped to the caller's user (and falling back to\n * the active org's shared credential, if any).\n *\n * SECURITY: NEVER reads from process.env. Env vars are global to the\n * deployment and would leak across users in a multi-tenant app. The only\n * sources are per-user / per-org rows in the SQL `settings` table.\n *\n * Storage keys (priority order):\n * 1. u:<email>:credential:<KEY> — per-user override\n * 2. o:<orgId>:credential:<KEY> — per-org shared credential (if orgId given)\n */\nexport async function resolveCredential(\n key: string,\n ctx: CredentialContext,\n): Promise<string | undefined> {\n if (!ctx?.userEmail) return undefined;\n\n const userSetting = await resolveCredentialForScope(key, {\n ...ctx,\n scope: \"user\",\n });\n if (userSetting) return userSetting;\n\n if (ctx.orgId) {\n return resolveCredentialForScope(key, { ...ctx, scope: \"org\" });\n }\n\n return undefined;\n}\n\n/**\n * Check if a credential is available for the given context.\n */\nexport async function hasCredential(\n key: string,\n ctx: CredentialContext,\n): Promise<boolean> {\n return (await resolveCredential(key, ctx)) !== undefined;\n}\n\n/**\n * Save a credential. By default writes to the per-user store; pass\n * `scope: \"org\"` to write to the active org's shared credentials.\n */\nexport async function saveCredential(\n key: string,\n value: string,\n ctx: CredentialContext & { scope?: \"user\" | \"org\" },\n): Promise<void> {\n if (!ctx?.userEmail) {\n throw new Error(\"saveCredential requires CredentialContext with userEmail\");\n }\n if (ctx.scope === \"org\") {\n if (!ctx.orgId) {\n throw new Error(\"saveCredential scope='org' requires orgId\");\n }\n await putSetting(orgCredentialSettingKey(ctx.orgId, key), { value });\n return;\n }\n await putSetting(userCredentialSettingKey(ctx.userEmail, key), {\n value,\n });\n}\n\n/**\n * Delete a credential from the per-user (default) or per-org store.\n */\nexport async function deleteCredential(\n key: string,\n ctx: CredentialContext & { scope?: \"user\" | \"org\" },\n): Promise<void> {\n if (!ctx?.userEmail) {\n throw new Error(\n \"deleteCredential requires CredentialContext with userEmail\",\n );\n }\n if (ctx.scope === \"org\") {\n if (!ctx.orgId) {\n throw new Error(\"deleteCredential scope='org' requires orgId\");\n }\n await deleteSetting(orgCredentialSettingKey(ctx.orgId, key));\n return;\n }\n await deleteSetting(userCredentialSettingKey(ctx.userEmail, key));\n}\n"]}
package/dist/index.d.ts CHANGED
@@ -8,8 +8,8 @@ export { sendToAgentChat, useAgentChatGenerating, useDevMode, useSendToAgentChat
8
8
  export { agentChat, type AgentChatCallOptions, type AgentChatResponse, } from "./shared/index.js";
9
9
  export { AGENT_WEB_CRAWLER_CATEGORIES, AGENT_WEB_CRAWLER_USER_AGENTS, DEFAULT_AGENT_WEB_CRAWLER_POLICY, absoluteUrl, agentWebConfigFromPackageJson, buildAgentWebStaticFiles, buildBaseJsonLd, buildLlmsFullTxt, buildLlmsTxt, buildMarkdownResponseHeaders, buildPageJsonLd, buildRobotsTxt, buildSitemapXml, deriveAgentWebPublicRoutes, estimateMarkdownTokens, markdownFilePathForPage, markdownUrlForPage, normalizeAgentWebConfig, pathPatternMatches, resolveAgentWebCrawlerPolicy, type AgentWebConfig, type AgentWebCrawlerCategory, type AgentWebCrawlerDecision, type AgentWebCrawlerOverrides, type AgentWebCrawlerPolicy, type AgentWebInputConfig, type AgentWebPage, type AgentWebStaticFile, type BuildAgentWebStaticFilesOptions, type DeriveAgentWebPublicRoutesOptions, type MarkdownResponseHeadersOptions, } from "./agent-web/index.js";
10
10
  export { recordUsage, getUsageSummary, getUserUsageCents, calculateCost, usageBillingForEngine, builderCreditsFromCostCents, BUILDER_AGENT_CREDIT_MARGIN_MULTIPLIER, BUILDER_AGENT_CREDITS_PER_USD, BUILDER_CREDIT_USAGE_BILLING, USD_USAGE_BILLING, type UsageRecord, type UsageSummary, type UsageBillingMode, type UsageBillingUnit, type UsageBucket, type DailyBucket, type UsageRecentEntry, } from "./usage/store.js";
11
- export { deleteWorkspaceConnection, getWorkspaceConnectionAppAccess, getWorkspaceConnection, getWorkspaceConnectionGrant, listWorkspaceConnectionProviderCatalogForApp, listWorkspaceConnectionGrants, listWorkspaceConnections, revokeWorkspaceConnectionGrant, serializeWorkspaceConnectionGrant, serializeWorkspaceConnection, summarizeWorkspaceConnectionProviderForApp, summarizeWorkspaceConnectionProviderReadiness, upsertWorkspaceConnectionGrant, upsertWorkspaceConnection, type ListWorkspaceConnectionProviderCatalogForAppOptions, type ListWorkspaceConnectionGrantsOptions, type ListWorkspaceConnectionsOptions, type SerializedWorkspaceConnectionGrant, type SerializedWorkspaceConnection, type SummarizeWorkspaceConnectionProviderForAppOptions, type SummarizeWorkspaceConnectionProviderReadinessOptions, type UpsertWorkspaceConnectionGrantInput, type UpsertWorkspaceConnectionInput, type WorkspaceConnectionAppAccess, type WorkspaceConnectionAppAccessMode, type WorkspaceConnection, type WorkspaceConnectionCredentialRef, type WorkspaceConnectionExplicitGrantSummary, type WorkspaceConnectionForAppSummary, type WorkspaceConnectionGrant, type WorkspaceConnectionGrantAvailability, type WorkspaceConnectionGrantState, type WorkspaceConnectionProviderAppSummary, type WorkspaceConnectionProviderLike, type WorkspaceConnectionProviderCatalogForApp, type WorkspaceConnectionProviderCatalogForAppItem, type WorkspaceConnectionProviderReadiness, type WorkspaceConnectionProviderReadinessStatus, type WorkspaceConnectionPublicCredentialRef, type WorkspaceConnectionStatus, workspaceConnectionIsAvailableToApp, } from "./workspace-connections/index.js";
12
- export { WORKSPACE_CONNECTION_PROVIDERS, defineWorkspaceConnectionProvider, getWorkspaceConnectionProvider, isWorkspaceConnectionProviderId, listWorkspaceConnectionProviders, listWorkspaceConnectionProvidersForCapability, listWorkspaceConnectionProvidersForTemplate, workspaceConnectionProviderSupports, type ListWorkspaceConnectionProvidersOptions, type WorkspaceConnectionCapability, type WorkspaceConnectionCredentialKey, type WorkspaceConnectionProvider, type WorkspaceConnectionProviderId, type WorkspaceConnectionTemplateUse, } from "./connections/index.js";
11
+ export { deleteWorkspaceConnection, getWorkspaceConnectionAppAccess, getWorkspaceConnection, getWorkspaceConnectionGrant, listWorkspaceConnectionProviderCatalogForApp, listWorkspaceConnectionGrants, listWorkspaceConnections, resolveWorkspaceConnectionCredentialForApp, resolveWorkspaceConnectionCredentialsForApp, revokeWorkspaceConnectionGrant, serializeWorkspaceConnectionGrant, serializeWorkspaceConnection, summarizeWorkspaceConnectionProviderForApp, summarizeWorkspaceConnectionProviderReadiness, upsertWorkspaceConnectionGrant, upsertWorkspaceConnection, type ListWorkspaceConnectionProviderCatalogForAppOptions, type ListWorkspaceConnectionGrantsOptions, type ListWorkspaceConnectionsOptions, type ResolveWorkspaceConnectionCredentialForAppOptions, type ResolveWorkspaceConnectionCredentialsForAppOptions, type SerializedWorkspaceConnectionGrant, type SerializedWorkspaceConnection, type SummarizeWorkspaceConnectionProviderForAppOptions, type SummarizeWorkspaceConnectionProviderReadinessOptions, type UpsertWorkspaceConnectionGrantInput, type UpsertWorkspaceConnectionInput, type WorkspaceConnectionAppAccess, type WorkspaceConnectionAppAccessMode, type WorkspaceConnection, type WorkspaceConnectionCredentialBackend, type WorkspaceConnectionCredentialProvenance, type WorkspaceConnectionCredentialRef, type WorkspaceConnectionCredentialResolution, type WorkspaceConnectionCredentialResolutionCheck, type WorkspaceConnectionCredentialResolutionStatus, type WorkspaceConnectionCredentialsResolution, type WorkspaceConnectionExplicitGrantSummary, type WorkspaceConnectionForAppSummary, type WorkspaceConnectionGrant, type WorkspaceConnectionGrantAvailability, type WorkspaceConnectionGrantState, type WorkspaceConnectionProviderAppSummary, type WorkspaceConnectionProviderLike, type WorkspaceConnectionProviderCatalogForApp, type WorkspaceConnectionProviderCatalogForAppItem, type WorkspaceConnectionProviderReadiness, type WorkspaceConnectionProviderReadinessStatus, type WorkspaceConnectionPublicCredentialRef, type WorkspaceConnectionStatus, workspaceConnectionIsAvailableToApp, } from "./workspace-connections/index.js";
12
+ export { PROVIDER_READERS, ProviderReaderRuntimeError, WORKSPACE_CONNECTION_PROVIDERS, createProviderReaderRuntime, defineProviderReader, defineProviderReaderImplementation, defineWorkspaceConnectionProvider, getProviderReader, getWorkspaceConnectionProvider, isWorkspaceConnectionProviderId, listProviderReaders, listWorkspaceConnectionProviders, listWorkspaceConnectionProvidersForCapability, listWorkspaceConnectionProvidersForTemplate, providerReaderSupports, workspaceConnectionProviderSupports, type ListWorkspaceConnectionProvidersOptions, type ListProviderReadersOptions, type ProviderReaderCapability, type ProviderReaderCredentialRequirement, type ProviderReaderDefinition, type ProviderReaderImplementationStatus, type ProviderReaderOperation, type ProviderReaderOperationDescriptor, type ProviderReaderOperationParameter, type ProviderReaderRequest, type ProviderReaderRuntime, type ProviderReaderRuntimeConnection, type ProviderReaderRuntimeConnectionResolverOptions, type ProviderReaderRuntimeContext, type ProviderReaderRuntimeCredentialsResolverOptions, type ProviderReaderRuntimeErrorCode, type ProviderReaderRuntimeHandler, type ProviderReaderRuntimeImplementation, type ProviderReaderRuntimeItem, type ProviderReaderRuntimeOptions, type ProviderReaderRuntimeResponse, type WorkspaceConnectionCapability, type WorkspaceConnectionCredentialKey, type WorkspaceConnectionProvider, type WorkspaceConnectionProviderId, type WorkspaceConnectionTemplateUse, } from "./connections/index.js";
13
13
  export { runScript, loadEnv, parseArgs, camelCaseArgs, isValidPath, isValidProjectPath, ensureDir, fail, } from "./scripts/index.js";
14
14
  export { registerRequiredSecret, listRequiredSecrets, getRequiredSecret, readAppSecret, writeAppSecret, deleteAppSecret, type RegisteredSecret, type SecretScope, type SecretKind, type SecretValidator, type SecretRef, } from "./secrets/index.js";
15
15
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,4BAA4B,EAC5B,KAAK,WAAW,EAChB,KAAK,WAAW,EAChB,KAAK,sBAAsB,EAC3B,KAAK,UAAU,EACf,KAAK,UAAU,EACf,KAAK,YAAY,EACjB,KAAK,gBAAgB,EACrB,KAAK,cAAc,EACnB,KAAK,mBAAmB,EACxB,aAAa,GACd,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,YAAY,EACZ,oBAAoB,EACpB,sBAAsB,EACtB,KAAK,gBAAgB,EACrB,KAAK,sBAAsB,EAC3B,KAAK,uBAAuB,GAC7B,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AACjE,OAAO,EACL,qBAAqB,EACrB,sBAAsB,EACtB,KAAK,sBAAsB,GAC5B,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACL,+BAA+B,EAC/B,wBAAwB,EACxB,KAAK,gCAAgC,GACtC,MAAM,sBAAsB,CAAC;AAG9B,OAAO,EACL,YAAY,EACZ,gBAAgB,EAChB,iBAAiB,EACjB,aAAa,EACb,UAAU,EACV,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,EACtB,KAAK,WAAW,EAChB,KAAK,WAAW,GACjB,MAAM,mBAAmB,CAAC;AAG3B,OAAO,EACL,eAAe,EACf,sBAAsB,EACtB,UAAU,EACV,kBAAkB,EAClB,kBAAkB,EAClB,oCAAoC,EACpC,SAAS,EACT,cAAc,EACd,EAAE,EACF,cAAc,EACd,UAAU,EACV,mBAAmB,EACnB,kBAAkB,EAClB,oBAAoB,EACpB,KAAK,gBAAgB,EACrB,KAAK,wBAAwB,EAC7B,KAAK,2CAA2C,EAChD,KAAK,uBAAuB,EAC5B,KAAK,sBAAsB,EAC3B,KAAK,wBAAwB,EAC7B,KA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AAK,+CAA+C,EACpD,KAAK,8BAA8B,EACnC,KAAK,4BAA4B,EACjC,KAAK,mCAAmC,EACxC,KAAK,yBAAyB,EAC9B,KAAK,4BAA4B,EACjC,KAAK,6BAA6B,EAClC,KAAK,6BAA6B,EAClC,KAAK,gCAAgC,EACrC,KAAK,2BAA2B,EAChC,KAAK,6BAA6B,EAClC,KAAK,8BAA8B,GACpC,MAAM,wBAAwB,CAAC;AAGhC,OAAO,EACL,SAAS,EACT,OAAO,EACP,SAAS,EACT,aAAa,EACb,WAAW,EACX,kBAAkB,EAClB,SAAS,EACT,IAAI,GACL,MAAM,oBAAoB,CAAC;AAK5B,OAAO,EACL,sBAAsB,EACtB,mBAAmB,EACnB,iBAAiB,EACjB,aAAa,EACb,cAAc,EACd,eAAe,EACf,KAAK,gBAAgB,EACrB,KAAK,WAAW,EAChB,KAAK,UAAU,EACf,KAAK,eAAe,EACpB,KAAK,SAAS,GACf,MAAM,oBAAoB,CAAC"}
package/dist/index.js CHANGED
@@ -17,9 +17,9 @@ export { AGENT_WEB_CRAWLER_CATEGORIES, AGENT_WEB_CRAWLER_USER_AGENTS, DEFAULT_AG
17
17
  // Token usage tracking
18
18
  export { recordUsage, getUsageSummary, getUserUsageCents, calculateCost, usageBillingForEngine, builderCreditsFromCostCents, BUILDER_AGENT_CREDIT_MARGIN_MULTIPLIER, BUILDER_AGENT_CREDITS_PER_USD, BUILDER_CREDIT_USAGE_BILLING, USD_USAGE_BILLING, } from "./usage/store.js";
19
19
  // Workspace-scoped third-party connection metadata
20
- export { deleteWorkspaceConnection, getWorkspaceConnectionAppAccess, getWorkspaceConnection, getWorkspaceConnectionGrant, listWorkspaceConnectionProviderCatalogForApp, listWorkspaceConnectionGrants, listWorkspaceConnections, revokeWorkspaceConnectionGrant, serializeWorkspaceConnectionGrant, serializeWorkspaceConnection, summarizeWorkspaceConnectionProviderForApp, summarizeWorkspaceConnectionProviderReadiness, upsertWorkspaceConnectionGrant, upsertWorkspaceConnection, workspaceConnectionIsAvailableToApp, } from "./workspace-connections/index.js";
20
+ export { deleteWorkspaceConnection, getWorkspaceConnectionAppAccess, getWorkspaceConnection, getWorkspaceConnectionGrant, listWorkspaceConnectionProviderCatalogForApp, listWorkspaceConnectionGrants, listWorkspaceConnections, resolveWorkspaceConnectionCredentialForApp, resolveWorkspaceConnectionCredentialsForApp, revokeWorkspaceConnectionGrant, serializeWorkspaceConnectionGrant, serializeWorkspaceConnection, summarizeWorkspaceConnectionProviderForApp, summarizeWorkspaceConnectionProviderReadiness, upsertWorkspaceConnectionGrant, upsertWorkspaceConnection, workspaceConnectionIsAvailableToApp, } from "./workspace-connections/index.js";
21
21
  // Reusable workspace connection provider catalog
22
- export { WORKSPACE_CONNECTION_PROVIDERS, defineWorkspaceConnectionProvider, getWorkspaceConnectionProvider, isWorkspaceConnectionProviderId, listWorkspaceConnectionProviders, listWorkspaceConnectionProvidersForCapability, listWorkspaceConnectionProvidersForTemplate, workspaceConnectionProviderSupports, } from "./connections/index.js";
22
+ export { PROVIDER_READERS, ProviderReaderRuntimeError, WORKSPACE_CONNECTION_PROVIDERS, createProviderReaderRuntime, defineProviderReader, defineProviderReaderImplementation, defineWorkspaceConnectionProvider, getProviderReader, getWorkspaceConnectionProvider, isWorkspaceConnectionProviderId, listProviderReaders, listWorkspaceConnectionProviders, listWorkspaceConnectionProvidersForCapability, listWorkspaceConnectionProvidersForTemplate, providerReaderSupports, workspaceConnectionProviderSupports, } from "./connections/index.js";
23
23
  // Scripts
24
24
  export { runScript, loadEnv, parseArgs, camelCaseArgs, isValidPath, isValidProjectPath, ensureDir, fail, } from "./scripts/index.js";
25
25
  // Secrets registry — import from "@agent-native/core/secrets" when possible
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,mCAAmC;AACnC,+CAA+C;AAE/C,0BAA0B;AAC1B,OAAO,EACL,4BAA4B,EAU5B,aAAa,GACd,MAAM,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AAE1B,mDAAmD;AACnD,OAAO,EACL,yBAAyB,EACzB,+BAA+B,EAC/B,sBAAsB,EACtB,2BAA2B,EAC3B,4CAA4C,EAC5C,6BAA6B,EAC7B,wBAAwB,EACxB,8BAA8B,EAC9B,iCAAiC,EACjC,4BAA4B,EAC5B,0CAA0C,EAC1C,6CAA6C,EAC7C,8BAA8B,EAC9B,yBAAyB,EA2BzB,mCAAmC,GACpC,MAAM,kCAAkC,CAAC;AAE1C,iDAAiD;AACjD,OAAO,EACL,8BAA8B,EAC9B,iCAAiC,EACjC,8BAA8B,EAC9B,+BAA+B,EAC/B,gCAAgC,EAChC,6CAA6C,EAC7C,2CAA2C,EAC3C,mCAAmC,GAOpC,MAAM,wBAAwB,CAAC;AAEhC,UAAU;AACV,OAAO,EACL,SAAS,EACT,OAAO,EACP,SAAS,EACT,aAAa,EACb,WAAW,EACX,kBAAkB,EAClB,SAAS,EACT,IAAI,GACL,MAAM,oBAAoB,CAAC;AAE5B,4EAA4E;AAC5E,wEAAwE;AACxE,mCAAmC;AACnC,OAAO,EACL,sBAAsB,EACtB,mBAAmB,EACnB,iBAAiB,EACjB,aAAa,EACb,cAAc,EACd,eAAe,GAMhB,MAAM,oBAAoB,CAAC","sourcesContent":["// Framework for agent-native apps.\n// Import everything from \"@agent-native/core\".\n\n// Agent (production mode)\nexport {\n createProductionAgentHandler,\n type ActionEntry,\n type ScriptEntry,\n type ProductionAgentOptions,\n type ActionTool,\n type ScriptTool,\n type AgentMessage,\n type AgentChatRequest,\n type AgentChatEvent,\n type AgentChatAttachment,\n DEFAULT_MODEL,\n} from \"./agent/index.js\";\nexport {\n defineAction,\n AgentActionStopError,\n isAgentActionStopError,\n type ActionHttpConfig,\n type AgentActionStopOptions,\n type PublicAgentActionConfig,\n} from \"./action.js\";\nexport { createDevScriptRegistry } from \"./scripts/dev/index.js\";\nexport {\n createAgentChatPlugin,\n defaultAgentChatPlugin,\n type AgentChatPluginOptions,\n} from \"./server/agent-chat-plugin.js\";\nexport {\n createAgentNativeEmbeddedPlugin,\n mountAgentNativeEmbedded,\n type AgentNativeEmbeddedPluginOptions,\n} from \"./server/embedded.js\";\n\n// Server\nexport {\n createServer,\n createSSEHandler,\n defineNitroPlugin,\n autoMountAuth,\n getSession,\n type CreateServerOptions,\n type SSEHandlerOptions,\n type AuthSession,\n type AuthOptions,\n} from \"./server/index.js\";\n\n// Client\nexport {\n sendToAgentChat,\n useAgentChatGenerating,\n useDevMode,\n useSendToAgentChat,\n CodeRequiredDialog,\n useAgentNativeEmbeddedBrowserSession,\n useDbSync,\n useFileWatcher,\n cn,\n ApiKeySettings,\n useSession,\n AgentNativeEmbedded,\n useProductionAgent,\n ProductionAgentPanel,\n type AgentChatMessage,\n type AgentNativeEmbeddedProps,\n type UseAgentNativeEmbeddedBrowserSessionOptions,\n type CodeRequiredDialogProps,\n type ProductionAgentMessage,\n type UseProductionAgentResult,\n type ProductionAgentPanelProps,\n useActionQuery,\n useActionMutation,\n} from \"./client/index.js\";\n\n// Shared (isomorphic)\nexport {\n agentChat,\n type AgentChatCallOptions,\n type AgentChatResponse,\n} from \"./shared/index.js\";\n\n// Agent Web surfaces\nexport {\n AGENT_WEB_CRAWLER_CATEGORIES,\n AGENT_WEB_CRAWLER_USER_AGENTS,\n DEFAULT_AGENT_WEB_CRAWLER_POLICY,\n absoluteUrl,\n agentWebConfigFromPackageJson,\n buildAgentWebStaticFiles,\n buildBaseJsonLd,\n buildLlmsFullTxt,\n buildLlmsTxt,\n buildMarkdownResponseHeaders,\n buildPageJsonLd,\n buildRobotsTxt,\n buildSitemapXml,\n deriveAgentWebPublicRoutes,\n estimateMarkdownTokens,\n markdownFilePathForPage,\n markdownUrlForPage,\n normalizeAgentWebConfig,\n pathPatternMatches,\n resolveAgentWebCrawlerPolicy,\n type AgentWebConfig,\n type AgentWebCrawlerCategory,\n type AgentWebCrawlerDecision,\n type AgentWebCrawlerOverrides,\n type AgentWebCrawlerPolicy,\n type AgentWebInputConfig,\n type AgentWebPage,\n type AgentWebStaticFile,\n type BuildAgentWebStaticFilesOptions,\n type DeriveAgentWebPublicRoutesOptions,\n type MarkdownResponseHeadersOptions,\n} from \"./agent-web/index.js\";\n\n// Token usage tracking\nexport {\n recordUsage,\n getUsageSummary,\n getUserUsageCents,\n calculateCost,\n usageBillingForEngine,\n builderCreditsFromCostCents,\n BUILDER_AGENT_CREDIT_MARGIN_MULTIPLIER,\n BUILDER_AGENT_CREDITS_PER_USD,\n BUILDER_CREDIT_USAGE_BILLING,\n USD_USAGE_BILLING,\n type UsageRecord,\n type UsageSummary,\n type UsageBillingMode,\n type UsageBillingUnit,\n type UsageBucket,\n type DailyBucket,\n type UsageRecentEntry,\n} from \"./usage/store.js\";\n\n// Workspace-scoped third-party connection metadata\nexport {\n deleteWorkspaceConnection,\n getWorkspaceConnectionAppAccess,\n getWorkspaceConnection,\n getWorkspaceConnectionGrant,\n listWorkspaceConnectionProviderCatalogForApp,\n listWorkspaceConnectionGrants,\n listWorkspaceConnections,\n revokeWorkspaceConnectionGrant,\n serializeWorkspaceConnectionGrant,\n serializeWorkspaceConnection,\n summarizeWorkspaceConnectionProviderForApp,\n summarizeWorkspaceConnectionProviderReadiness,\n upsertWorkspaceConnectionGrant,\n upsertWorkspaceConnection,\n type ListWorkspaceConnectionProviderCatalogForAppOptions,\n type ListWorkspaceConnectionGrantsOptions,\n type ListWorkspaceConnectionsOptions,\n type SerializedWorkspaceConnectionGrant,\n type SerializedWorkspaceConnection,\n type SummarizeWorkspaceConnectionProviderForAppOptions,\n type SummarizeWorkspaceConnectionProviderReadinessOptions,\n type UpsertWorkspaceConnectionGrantInput,\n type UpsertWorkspaceConnectionInput,\n type WorkspaceConnectionAppAccess,\n type WorkspaceConnectionAppAccessMode,\n type WorkspaceConnection,\n type WorkspaceConnectionCredentialRef,\n type WorkspaceConnectionExplicitGrantSummary,\n type WorkspaceConnectionForAppSummary,\n type WorkspaceConnectionGrant,\n type WorkspaceConnectionGrantAvailability,\n type WorkspaceConnectionGrantState,\n type WorkspaceConnectionProviderAppSummary,\n type WorkspaceConnectionProviderLike,\n type WorkspaceConnectionProviderCatalogForApp,\n type WorkspaceConnectionProviderCatalogForAppItem,\n type WorkspaceConnectionProviderReadiness,\n type WorkspaceConnectionProviderReadinessStatus,\n type WorkspaceConnectionPublicCredentialRef,\n type WorkspaceConnectionStatus,\n workspaceConnectionIsAvailableToApp,\n} from \"./workspace-connections/index.js\";\n\n// Reusable workspace connection provider catalog\nexport {\n WORKSPACE_CONNECTION_PROVIDERS,\n defineWorkspaceConnectionProvider,\n getWorkspaceConnectionProvider,\n isWorkspaceConnectionProviderId,\n listWorkspaceConnectionProviders,\n listWorkspaceConnectionProvidersForCapability,\n listWorkspaceConnectionProvidersForTemplate,\n workspaceConnectionProviderSupports,\n type ListWorkspaceConnectionProvidersOptions,\n type WorkspaceConnectionCapability,\n type WorkspaceConnectionCredentialKey,\n type WorkspaceConnectionProvider,\n type WorkspaceConnectionProviderId,\n type WorkspaceConnectionTemplateUse,\n} from \"./connections/index.js\";\n\n// Scripts\nexport {\n runScript,\n loadEnv,\n parseArgs,\n camelCaseArgs,\n isValidPath,\n isValidProjectPath,\n ensureDir,\n fail,\n} from \"./scripts/index.js\";\n\n// Secrets registry — import from \"@agent-native/core/secrets\" when possible\n// (the subpath keeps the top-level entry point lean), but re-export the\n// public API here for convenience.\nexport {\n registerRequiredSecret,\n listRequiredSecrets,\n getRequiredSecret,\n readAppSecret,\n writeAppSecret,\n deleteAppSecret,\n type RegisteredSecret,\n type SecretScope,\n type SecretKind,\n type SecretValidator,\n type SecretRef,\n} from \"./secrets/index.js\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,mCAAmC;AACnC,+CAA+C;AAE/C,0BAA0B;AAC1B,OAAO,EACL,4BAA4B,EAU5B,aAAa,GACd,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,YAAY,EACZ,oBAAoB,EACpB,sBAAsB,GAIv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ACtB,2BAA2B,EAC3B,4CAA4C,EAC5C,6BAA6B,EAC7B,wBAAwB,EACxB,0CAA0C,EAC1C,2CAA2C,EAC3C,8BAA8B,EAC9B,iCAAiC,EACjC,4BAA4B,EAC5B,0CAA0C,EAC1C,6CAA6C,EAC7C,8BAA8B,EAC9B,yBAAyB,EAmCzB,mCAAmC,GACpC,MAAM,kCAAkC,CAAC;AAE1C,iDAAiD;AACjD,OAAO,EACL,gBAAgB,EAChB,0BAA0B,EAC1B,8BAA8B,EAC9B,2BAA2B,EAC3B,oBAAoB,EACpB,kCAAkC,EAClC,iCAAiC,EACjC,iBAAiB,EACjB,8BAA8B,EAC9B,+BAA+B,EAC/B,mBAAmB,EACnB,gCAAgC,EAChC,6CAA6C,EAC7C,2CAA2C,EAC3C,sBAAsB,EACtB,mCAAmC,GA2BpC,MAAM,wBAAwB,CAAC;AAEhC,UAAU;AACV,OAAO,EACL,SAAS,EACT,OAAO,EACP,SAAS,EACT,aAAa,EACb,WAAW,EACX,kBAAkB,EAClB,SAAS,EACT,IAAI,GACL,MAAM,oBAAoB,CAAC;AAE5B,4EAA4E;AAC5E,wEAAwE;AACxE,mCAAmC;AACnC,OAAO,EACL,sBAAsB,EACtB,mBAAmB,EACnB,iBAAiB,EACjB,aAAa,EACb,cAAc,EACd,eAAe,GAMhB,MAAM,oBAAoB,CAAC","sourcesContent":["// Framework for agent-native apps.\n// Import everything from \"@agent-native/core\".\n\n// Agent (production mode)\nexport {\n createProductionAgentHandler,\n type ActionEntry,\n type ScriptEntry,\n type ProductionAgentOptions,\n type ActionTool,\n type ScriptTool,\n type AgentMessage,\n type AgentChatRequest,\n type AgentChatEvent,\n type AgentChatAttachment,\n DEFAULT_MODEL,\n} from \"./agent/index.js\";\nexport {\n defineAction,\n AgentActionStopError,\n isAgentActionStopError,\n type ActionHttpConfig,\n type AgentActionStopOptions,\n type PublicAgentActionConfig,\n} from \"./action.js\";\nexport { createDevScriptRegistry } from \"./scripts/dev/index.js\";\nexport {\n createAgentChatPlugin,\n defaultAgentChatPlugin,\n type AgentChatPluginOptions,\n} from \"./server/agent-chat-plugin.js\";\nexport {\n createAgentNativeEmbeddedPlugin,\n mountAgentNativeEmbedded,\n type AgentNativeEmbeddedPluginOptions,\n} from \"./server/embedded.js\";\n\n// Server\nexport {\n createServer,\n createSSEHandler,\n defineNitroPlugin,\n autoMountAuth,\n getSession,\n type CreateServerOptions,\n type SSEHandlerOptions,\n type AuthSession,\n type AuthOptions,\n} from \"./server/index.js\";\n\n// Client\nexport {\n sendToAgentChat,\n useAgentChatGenerating,\n useDevMode,\n useSendToAgentChat,\n CodeRequiredDialog,\n useAgentNativeEmbeddedBrowserSession,\n useDbSync,\n useFileWatcher,\n cn,\n ApiKeySettings,\n useSession,\n AgentNativeEmbedded,\n useProductionAgent,\n ProductionAgentPanel,\n type AgentChatMessage,\n type AgentNativeEmbeddedProps,\n type UseAgentNativeEmbeddedBrowserSessionOptions,\n type CodeRequiredDialogProps,\n type ProductionAgentMessage,\n type UseProductionAgentResult,\n type ProductionAgentPanelProps,\n useActionQuery,\n useActionMutation,\n} from \"./client/index.js\";\n\n// Shared (isomorphic)\nexport {\n agentChat,\n type AgentChatCallOptions,\n type AgentChatResponse,\n} from \"./shared/index.js\";\n\n// Agent Web surfaces\nexport {\n AGENT_WEB_CRAWLER_CATEGORIES,\n AGENT_WEB_CRAWLER_USER_AGENTS,\n DEFAULT_AGENT_WEB_CRAWLER_POLICY,\n absoluteUrl,\n agentWebConfigFromPackageJson,\n buildAgentWebStaticFiles,\n buildBaseJsonLd,\n buildLlmsFullTxt,\n buildLlmsTxt,\n buildMarkdownResponseHeaders,\n buildPageJsonLd,\n buildRobotsTxt,\n buildSitemapXml,\n deriveAgentWebPublicRoutes,\n estimateMarkdownTokens,\n markdownFilePathForPage,\n markdownUrlForPage,\n normalizeAgentWebConfig,\n pathPatternMatches,\n resolveAgentWebCrawlerPolicy,\n type AgentWebConfig,\n type AgentWebCrawlerCategory,\n type AgentWebCrawlerDecision,\n type AgentWebCrawlerOverrides,\n type AgentWebCrawlerPolicy,\n type AgentWebInputConfig,\n type AgentWebPage,\n type AgentWebStaticFile,\n type BuildAgentWebStaticFilesOptions,\n type DeriveAgentWebPublicRoutesOptions,\n type MarkdownResponseHeadersOptions,\n} from \"./agent-web/index.js\";\n\n// Token usage tracking\nexport {\n recordUsage,\n getUsageSummary,\n getUserUsageCents,\n calculateCost,\n usageBillingForEngine,\n builderCreditsFromCostCents,\n BUILDER_AGENT_CREDIT_MARGIN_MULTIPLIER,\n BUILDER_AGENT_CREDITS_PER_USD,\n BUILDER_CREDIT_USAGE_BILLING,\n USD_USAGE_BILLING,\n type UsageRecord,\n type UsageSummary,\n type UsageBillingMode,\n type UsageBillingUnit,\n type UsageBucket,\n type DailyBucket,\n type UsageRecentEntry,\n} from \"./usage/store.js\";\n\n// Workspace-scoped third-party connection metadata\nexport {\n deleteWorkspaceConnection,\n getWorkspaceConnectionAppAccess,\n getWorkspaceConnection,\n getWorkspaceConnectionGrant,\n listWorkspaceConnectionProviderCatalogForApp,\n listWorkspaceConnectionGrants,\n listWorkspaceConnections,\n resolveWorkspaceConnectionCredentialForApp,\n resolveWorkspaceConnectionCredentialsForApp,\n revokeWorkspaceConnectionGrant,\n serializeWorkspaceConnectionGrant,\n serializeWorkspaceConnection,\n summarizeWorkspaceConnectionProviderForApp,\n summarizeWorkspaceConnectionProviderReadiness,\n upsertWorkspaceConnectionGrant,\n upsertWorkspaceConnection,\n type ListWorkspaceConnectionProviderCatalogForAppOptions,\n type ListWorkspaceConnectionGrantsOptions,\n type ListWorkspaceConnectionsOptions,\n type ResolveWorkspaceConnectionCredentialForAppOptions,\n type ResolveWorkspaceConnectionCredentialsForAppOptions,\n type SerializedWorkspaceConnectionGrant,\n type SerializedWorkspaceConnection,\n type SummarizeWorkspaceConnectionProviderForAppOptions,\n type SummarizeWorkspaceConnectionProviderReadinessOptions,\n type UpsertWorkspaceConnectionGrantInput,\n type UpsertWorkspaceConnectionInput,\n type WorkspaceConnectionAppAccess,\n type WorkspaceConnectionAppAccessMode,\n type WorkspaceConnection,\n type WorkspaceConnectionCredentialBackend,\n type WorkspaceConnectionCredentialProvenance,\n type WorkspaceConnectionCredentialRef,\n type WorkspaceConnectionCredentialResolution,\n type WorkspaceConnectionCredentialResolutionCheck,\n type WorkspaceConnectionCredentialResolutionStatus,\n type WorkspaceConnectionCredentialsResolution,\n type WorkspaceConnectionExplicitGrantSummary,\n type WorkspaceConnectionForAppSummary,\n type WorkspaceConnectionGrant,\n type WorkspaceConnectionGrantAvailability,\n type WorkspaceConnectionGrantState,\n type WorkspaceConnectionProviderAppSummary,\n type WorkspaceConnectionProviderLike,\n type WorkspaceConnectionProviderCatalogForApp,\n type WorkspaceConnectionProviderCatalogForAppItem,\n type WorkspaceConnectionProviderReadiness,\n type WorkspaceConnectionProviderReadinessStatus,\n type WorkspaceConnectionPublicCredentialRef,\n type WorkspaceConnectionStatus,\n workspaceConnectionIsAvailableToApp,\n} from \"./workspace-connections/index.js\";\n\n// Reusable workspace connection provider catalog\nexport {\n PROVIDER_READERS,\n ProviderReaderRuntimeError,\n WORKSPACE_CONNECTION_PROVIDERS,\n createProviderReaderRuntime,\n defineProviderReader,\n defineProviderReaderImplementation,\n defineWorkspaceConnectionProvider,\n getProviderReader,\n getWorkspaceConnectionProvider,\n isWorkspaceConnectionProviderId,\n listProviderReaders,\n listWorkspaceConnectionProviders,\n listWorkspaceConnectionProvidersForCapability,\n listWorkspaceConnectionProvidersForTemplate,\n providerReaderSupports,\n workspaceConnectionProviderSupports,\n type ListWorkspaceConnectionProvidersOptions,\n type ListProviderReadersOptions,\n type ProviderReaderCapability,\n type ProviderReaderCredentialRequirement,\n type ProviderReaderDefinition,\n type ProviderReaderImplementationStatus,\n type ProviderReaderOperation,\n type ProviderReaderOperationDescriptor,\n type ProviderReaderOperationParameter,\n type ProviderReaderRequest,\n type ProviderReaderRuntime,\n type ProviderReaderRuntimeConnection,\n type ProviderReaderRuntimeConnectionResolverOptions,\n type ProviderReaderRuntimeContext,\n type ProviderReaderRuntimeCredentialsResolverOptions,\n type ProviderReaderRuntimeErrorCode,\n type ProviderReaderRuntimeHandler,\n type ProviderReaderRuntimeImplementation,\n type ProviderReaderRuntimeItem,\n type ProviderReaderRuntimeOptions,\n type ProviderReaderRuntimeResponse,\n type WorkspaceConnectionCapability,\n type WorkspaceConnectionCredentialKey,\n type WorkspaceConnectionProvider,\n type WorkspaceConnectionProviderId,\n type WorkspaceConnectionTemplateUse,\n} from \"./connections/index.js\";\n\n// Scripts\nexport {\n runScript,\n loadEnv,\n parseArgs,\n camelCaseArgs,\n isValidPath,\n isValidProjectPath,\n ensureDir,\n fail,\n} from \"./scripts/index.js\";\n\n// Secrets registry — import from \"@agent-native/core/secrets\" when possible\n// (the subpath keeps the top-level entry point lean), but re-export the\n// public API here for convenience.\nexport {\n registerRequiredSecret,\n listRequiredSecrets,\n getRequiredSecret,\n readAppSecret,\n writeAppSecret,\n deleteAppSecret,\n type RegisteredSecret,\n type SecretScope,\n type SecretKind,\n type SecretValidator,\n type SecretRef,\n} from \"./secrets/index.js\";\n"]}
@@ -2,6 +2,12 @@ import { type ActionEntry } from "../agent/production-agent.js";
2
2
  import type { AgentChatAttachment, AgentChatEvent, AgentChatReference, MentionProvider } from "../agent/types.js";
3
3
  import { McpClientManager } from "../mcp-client/index.js";
4
4
  import { type A2AArtifactResponseOptions, type A2AToolResultSummary } from "../a2a/artifact-response.js";
5
+ export declare function buildPublicAgentA2ASkills(actions: Record<string, ActionEntry>): Array<{
6
+ id: string;
7
+ name: string;
8
+ description: string;
9
+ publicAgent: ActionEntry["publicAgent"];
10
+ }>;
5
11
  export declare function assembleA2AFinalResponse(events: readonly AgentChatEvent[], toolResults: readonly A2AToolResultSummary[], options?: A2AArtifactResponseOptions & {
6
12
  event?: any;
7
13
  }): {
@@ -164,6 +170,18 @@ export interface AgentChatPluginOptions {
164
170
  * Defaults to `false`.
165
171
  */
166
172
  nativeActionsInDev?: boolean;
173
+ /**
174
+ * Optional A2A-only deterministic response path. Runs after inbound A2A text
175
+ * and user context are resolved, but before an agent engine/model is loaded.
176
+ * Return a message to complete the A2A task without invoking the LLM, or
177
+ * null/undefined to continue through the normal agent loop.
178
+ */
179
+ a2aMessageFallback?: (details: {
180
+ message: import("../a2a/types.js").Message;
181
+ text: string;
182
+ context: import("../a2a/types.js").A2AHandlerContext;
183
+ userEmail: string | undefined;
184
+ }) => import("../a2a/types.js").Message | string | null | undefined | Promise<import("../a2a/types.js").Message | string | null | undefined>;
167
185
  }
168
186
  /**
169
187
  * Pre-load the agent's context: AGENTS.md (workspace/template/runtime
@@ -1 +1 @@
1
- {"version":3,"file":"agent-chat-plugin.d.ts","sourceRoot":"","sources":["../../src/server/agent-chat-plugin.ts"],"names":[],"mappings":"AAaA,OAAO,EASL,KAAK,WAAW,EACjB,MAAM,8BAA8B,CAAC;AAoBtC,OAAO,KAAK,EACV,mBAAmB,EACnB,cAAc,EACd,kBAAkB,EAElB,eAAe,EAEhB,MAAM,mBAAmB,CAAC;AAG3B,OAAO,EACL,gBAAgB,EAYjB,MAAM,wBAAwB,CAAC;AA4DhC,OAAO,EAGL,KAAK,0BAA0B,EAC/B,KAAK,oBAAoB,EAC1B,MAAM,6BAA6B,CAAC;AAgUrC,wBAAgB,wBAAwB,CACtC,MAAM,EAAE,SAAS,cAAc,EAAE,EACjC,WAAW,EAAE,SAAS,oBAAoB,EAAE,EAC5C,OAAO,GAAE,0BAA0B,GAAG;IAAE,KAAK,CAAC,EAAE,GAAG,CAAA;CAAO,GACzD;IAAE,YAAY,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,CAO7C;AAizCD,KAAK,cAAc,GAAG,CAAC,QAAQ,EAAE,GAAG,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;AAE9D,MAAM,WAAW,sBAAsB;IACrC,+DAA+D;IAC/D,OAAO,CAAC,EACJ,MAAM,CAAC,MAAM,EAAE,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function filterPublicAgentActions(actions) {
270
270
  config.isConsequential !== true);
271
271
  }));
272
272
  }
273
+ export function buildPublicAgentA2ASkills(actions) {
274
+ return Object.entries(filterPublicAgentActions(actions)).map(([name, entry]) => ({
275
+ id: name,
276
+ name,
277
+ description: entry.tool.description,
278
+ publicAgent: entry.publicAgent,
279
+ }));
280
+ }
273
281
  function resolveArtifactBaseUrl(event) {
274
282
  const fromEnv = process.env.APP_URL ||
275
283
  process.env.URL ||
@@ -2674,12 +2682,7 @@ export function createAgentChatPlugin(options) {
2674
2682
  ? options.appId.charAt(0).toUpperCase() + options.appId.slice(1)
2675
2683
  : "Agent",
2676
2684
  description: `Agent-native ${options?.appId ?? "app"} agent`,
2677
- skills: Object.entries(allScripts).map(([name, entry]) => ({
2678
- id: name,
2679
- name,
2680
- description: entry.tool.description,
2681
- publicAgent: entry.publicAgent,
2682
- })),
2685
+ skills: buildPublicAgentA2ASkills(allScripts),
2683
2686
  publicSkillsOnly: true,
2684
2687
  streaming: true,
2685
2688
  handler: async function* (message, context) {
@@ -2799,6 +2802,23 @@ export function createAgentChatPlugin(options) {
2799
2802
  };
2800
2803
  return;
2801
2804
  }
2805
+ if (!userEmail)
2806
+ throw new Error("no authenticated user");
2807
+ const fallbackResponse = await options?.a2aMessageFallback?.({
2808
+ message,
2809
+ text,
2810
+ context,
2811
+ userEmail,
2812
+ });
2813
+ if (fallbackResponse) {
2814
+ yield typeof fallbackResponse === "string"
2815
+ ? {
2816
+ role: "agent",
2817
+ parts: [{ type: "text", text: fallbackResponse }],
2818
+ }
2819
+ : fallbackResponse;
2820
+ return;
2821
+ }
2802
2822
  // Use the SAME agent setup as the interactive chat — identical tools,
2803
2823
  // prompt, and capabilities. The A2A agent IS the app's agent.
2804
2824
  const a2aEngine = await resolveEngine({
@@ -2810,8 +2830,6 @@ export function createAgentChatPlugin(options) {
2810
2830
  const devActive = isDevMode();
2811
2831
  const handler = devActive && devHandler ? devHandler : prodHandler;
2812
2832
  // Build the same system prompt the interactive agent uses
2813
- if (!userEmail)
2814
- throw new Error("no authenticated user");
2815
2833
  const owner = userEmail;
2816
2834
  const resources = await loadResourcesForPrompt(owner, lazyContext, options?.appId);
2817
2835
  const schemaBlock = lazyContext
@@ -4372,9 +4390,24 @@ Non-code requests are still fine on this surface — read data, navigate the UI,
4372
4390
  // GET /runs/active?threadId=X — check if there's an active run for a thread
4373
4391
  getH3App(nitroApp).use(`${routePath}/runs`, defineEventHandler(async (event) => {
4374
4392
  // Auth check — ensure the user is authenticated
4375
- await getOwnerFromEvent(event);
4393
+ const owner = await getOwnerFromEvent(event);
4376
4394
  const method = getMethod(event);
4377
4395
  const url = event.node?.req?.url || event.path || "";
4396
+ // Route: GET /runs/list?goalId=agent-team
4397
+ // Returns hosted Agent Teams in the Code hub-compatible run shape.
4398
+ const listMatch = url.match(/\/runs\/list(?:[/?]|$)/) ||
4399
+ url.match(/^\/list(?:[/?]|$)/);
4400
+ if (listMatch && method === "GET") {
4401
+ const query = getQuery(event);
4402
+ const goalId = query.goalId ? String(query.goalId) : undefined;
4403
+ const runs = await runWithRequestContext({ userEmail: owner }, async () => {
4404
+ if (goalId && goalId !== "agent-team")
4405
+ return [];
4406
+ const { listAgentTeamBackgroundRuns } = await import("./agent-teams.js");
4407
+ return listAgentTeamBackgroundRuns();
4408
+ });
4409
+ return { status: "ok", goalId, runs };
4410
+ }
4378
4411
  // Route: POST /runs/:id/abort
4379
4412
  // Match both full URL (/runs/{id}/abort) and h3 prefix-stripped (/{id}/abort)
4380
4413
  const abortMatch = url.match(/\/runs\/([^/?]+)\/abort/) ||
@@ -4394,6 +4427,21 @@ Non-code requests are still fine on this surface — read data, navigate the UI,
4394
4427
  abortRun(runId, reason); // Aborts in-memory + marks aborted in SQL
4395
4428
  return { ok: true };
4396
4429
  }
4430
+ // Route: GET /runs/:id/background-events
4431
+ // Returns Agent Teams transcript events in the shared background-run shape.
4432
+ const backgroundEventsMatch = url.match(/\/runs\/([^/?]+)\/background-events/) ||
4433
+ url.match(/^\/([^/?]+)\/background-events/);
4434
+ if (backgroundEventsMatch && method === "GET") {
4435
+ const runId = decodeURIComponent(backgroundEventsMatch[1]);
4436
+ const { getAgentTeamBackgroundRun, listAgentTeamBackgroundTranscriptEvents, } = await import("./agent-teams.js");
4437
+ const run = await runWithRequestContext({ userEmail: owner }, () => getAgentTeamBackgroundRun(runId));
4438
+ if (!run) {
4439
+ setResponseStatus(event, 404);
4440
+ return { status: "unavailable", runId, events: [] };
4441
+ }
4442
+ const events = await runWithRequestContext({ userEmail: owner }, () => listAgentTeamBackgroundTranscriptEvents(runId));
4443
+ return { status: "ok", runId, events };
4444
+ }
4397
4445
  // Route: GET /runs/:id/events?after=N
4398
4446
  // Match both full URL (/runs/{id}/events) and h3 prefix-stripped (/{id}/events)
4399
4447
  const eventsMatch = url.match(/\/runs\/([^/?]+)\/events/) ||