@agent-native/core 0.231.0 → 0.232.0-nightly-20261118152333

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 (71) hide show
  1. package/dist/a2a/call-hooks.d.ts +135 -0
  2. package/dist/a2a/call-hooks.js +164 -0
  3. package/dist/a2a/client.d.ts +5 -0
  4. package/dist/a2a/client.js +22 -0
  5. package/dist/a2a/foreground-call-scope.d.ts +6 -0
  6. package/dist/a2a/foreground-call-scope.js +26 -0
  7. package/dist/a2a/handlers.js +119 -2
  8. package/dist/a2a/index.d.ts +3 -0
  9. package/dist/a2a/index.js +2 -0
  10. package/dist/a2a/invoke.js +17 -0
  11. package/dist/a2a/server.js +3 -0
  12. package/dist/action.js +3 -1
  13. package/dist/agent/durable-background.d.ts +6 -0
  14. package/dist/agent/durable-background.js +6 -0
  15. package/dist/agent/durable-turn-grant.d.ts +53 -0
  16. package/dist/agent/durable-turn-grant.js +83 -0
  17. package/dist/agent/production-agent.js +54 -2
  18. package/dist/app-config/agent.d.ts +1 -0
  19. package/dist/app-config/agent.js +7 -0
  20. package/dist/app-config/schema.d.ts +1 -0
  21. package/dist/cli/doctor.d.ts +1 -0
  22. package/dist/cli/doctor.js +10 -4
  23. package/dist/client/sharing/useShareButtonController.d.ts +5 -0
  24. package/dist/client/sharing/useShareButtonController.js +2 -1
  25. package/dist/client/use-chat-threads.js +3 -0
  26. package/dist/client/use-db-sync.js +22 -0
  27. package/dist/collab/routes.d.ts +1 -1
  28. package/dist/deploy/build.d.ts +4 -1
  29. package/dist/deploy/build.js +25 -15
  30. package/dist/file-upload/actions/upload-image.d.ts +2 -2
  31. package/dist/framework-package-versions.json +7 -7
  32. package/dist/guards/index.d.ts +1 -1
  33. package/dist/guards/index.js +1 -1
  34. package/dist/guards/no-env-credentials.d.ts +15 -1
  35. package/dist/guards/no-env-credentials.js +27 -0
  36. package/dist/integrations/internal-token.d.ts +15 -0
  37. package/dist/integrations/internal-token.js +19 -0
  38. package/dist/mcp/build-server.js +18 -2
  39. package/dist/mcp/index.d.ts +1 -0
  40. package/dist/mcp/index.js +1 -0
  41. package/dist/mcp/turn-grant-admitters.d.ts +61 -0
  42. package/dist/mcp/turn-grant-admitters.js +83 -0
  43. package/dist/mcp/turn-grant-store.d.ts +5 -0
  44. package/dist/mcp/turn-grant-store.js +19 -0
  45. package/dist/org/index.d.ts +2 -2
  46. package/dist/org/workspace-app-access.js +30 -11
  47. package/dist/provider-api/actions/custom-provider-registration.d.ts +16 -16
  48. package/dist/provider-api/actions/provider-api.d.ts +8 -8
  49. package/dist/provider-api/call-gates.d.ts +71 -2
  50. package/dist/provider-api/call-gates.js +157 -3
  51. package/dist/provider-api/corpus-jobs.d.ts +2 -2
  52. package/dist/provider-api/index.d.ts +1 -1
  53. package/dist/provider-api/index.js +1 -1
  54. package/dist/provider-api/interactive-scope.d.ts +2 -1
  55. package/dist/provider-api/interactive-scope.js +17 -4
  56. package/dist/server/agent-chat-plugin.js +9 -2
  57. package/dist/server/agent-run-context.d.ts +1 -1
  58. package/dist/server/agent-run-context.js +34 -3
  59. package/dist/server/entry-server.js +3 -1
  60. package/dist/server/transcribe-voice.d.ts +1 -1
  61. package/dist/shared/build-id.d.ts +14 -0
  62. package/dist/shared/build-id.js +21 -0
  63. package/dist/vite/client.d.ts +16 -0
  64. package/dist/vite/client.js +6 -3
  65. package/dist/vitest-config.js +1 -0
  66. package/dist/workspace-connections/workspace-credential-actions.d.ts +1 -0
  67. package/dist/workspace-connections/workspace-credential-actions.js +1 -0
  68. package/dist/workspace-connections/workspace-credentials.d.ts +4 -0
  69. package/dist/workspace-connections/workspace-credentials.js +40 -4
  70. package/docs/workspace-credential-drafts.md +28 -0
  71. package/package.json +5 -4
@@ -100,6 +100,7 @@ function refs(p) {
100
100
  function storedConfig(p) {
101
101
  return {
102
102
  ...p.config,
103
+ ...(p.draft ? { workspaceCredentialDraft: true } : {}),
103
104
  workspaceConnectionScope: "workspace",
104
105
  workspaceCredentialProfile: PROFILE,
105
106
  };
@@ -111,6 +112,9 @@ function profileMatches(c, g, appId, orgId, allowArchived = false) {
111
112
  (c.status === "connected" || (allowArchived && c.status === "disabled")) &&
112
113
  c.config.workspaceConnectionScope === "workspace" &&
113
114
  c.config.workspaceCredentialProfile === PROFILE &&
115
+ (c.config.workspaceCredentialDraft === undefined ||
116
+ (c.config.workspaceCredentialDraft === true &&
117
+ c.status === "disabled")) &&
114
118
  c.allowedApps.length === 1 &&
115
119
  c.allowedApps[0] === appId &&
116
120
  c.allowedUsers.length === 0 &&
@@ -203,10 +207,15 @@ export function createWorkspaceCredentialService(rawOptions) {
203
207
  "validateCredentials",
204
208
  "validationTimeoutMs",
205
209
  "beforeUpdateCommit",
210
+ "allowDraftEdits",
206
211
  ]);
207
212
  if (options.beforeUpdateCommit !== undefined &&
208
213
  typeof options.beforeUpdateCommit !== "function")
209
214
  fail("invalid_input");
215
+ if (options.allowDraftEdits !== undefined &&
216
+ typeof options.allowDraftEdits !== "boolean")
217
+ fail("invalid_input");
218
+ const allowDraftEdits = options.allowDraftEdits === true;
210
219
  const beforeUpdateCommit = options.beforeUpdateCommit;
211
220
  const appId = text(options.appId);
212
221
  if (typeof options.validateCredentials !== "function")
@@ -354,7 +363,22 @@ export function createWorkspaceCredentialService(rawOptions) {
354
363
  c.provider !== provider.id ||
355
364
  !profileMatches(c, g, appId, a.orgId, true))
356
365
  fail("conflict");
357
- if (c.status !== "disabled") {
366
+ if (c.config.workspaceCredentialDraft === true) {
367
+ const config = { ...c.config };
368
+ delete config.workspaceCredentialDraft;
369
+ const now = Math.max(Date.now(), Date.parse(c.updatedAt) + 1, Date.parse(g.updatedAt) + 1);
370
+ const row = await tx.execute({
371
+ sql: "UPDATE public.workspace_connections SET config_json = ?, updated_at = ? WHERE id = ? AND org_id = ? AND status = 'disabled'",
372
+ args: [JSON.stringify(config), now, connectionId, a.orgId],
373
+ });
374
+ const grant = await tx.execute({
375
+ sql: "UPDATE public.workspace_connection_grants SET config_json = ?, updated_at = ? WHERE id = ? AND org_id = ?",
376
+ args: [JSON.stringify(config), now, g.id, a.orgId],
377
+ });
378
+ if (row.rowsAffected !== 1 || grant.rowsAffected !== 1)
379
+ fail("storage_failed");
380
+ }
381
+ else if (c.status !== "disabled") {
358
382
  const updated = await tx.execute({
359
383
  sql: "UPDATE public.workspace_connections SET status = 'disabled', updated_at = ? WHERE id = ? AND owner_email = ? AND org_id = ? AND status = 'connected'",
360
384
  args: [Date.now(), connectionId, c.ownerEmail, a.orgId],
@@ -402,12 +426,17 @@ export function createWorkspaceCredentialService(rawOptions) {
402
426
  const input = record(raw, [
403
427
  "connectionId",
404
428
  "revision",
429
+ "draft",
405
430
  "name",
406
431
  "config",
407
432
  "secretValues",
408
433
  ]), a = actor();
409
434
  await authorize(a, true);
410
435
  const connectionId = text(input.connectionId), revision = text(input.revision);
436
+ if (input.draft !== undefined &&
437
+ (typeof input.draft !== "boolean" || !allowDraftEdits))
438
+ fail("invalid_input");
439
+ const requestedDraft = typeof input.draft === "boolean" ? input.draft : undefined;
411
440
  async function snapshot() {
412
441
  await authorize(a, true);
413
442
  const c = await getWorkspaceConnection(connectionId);
@@ -419,13 +448,14 @@ export function createWorkspaceCredentialService(rawOptions) {
419
448
  if (!g ||
420
449
  grants.length !== 1 ||
421
450
  c.provider !== provider.id ||
422
- !profileMatches(c, g, appId, a.orgId))
451
+ !profileMatches(c, g, appId, a.orgId, allowDraftEdits && c.config.workspaceCredentialDraft === true))
423
452
  fail("conflict");
424
453
  if (credentialRevision(c, g) !== revision)
425
454
  fail("conflict");
426
455
  const allowedConfig = new Set([
427
456
  "workspaceConnectionScope",
428
457
  "workspaceCredentialProfile",
458
+ ...(allowDraftEdits ? ["workspaceCredentialDraft"] : []),
429
459
  ...(provider.configurationFields ?? []).map((field) => field.key),
430
460
  ]);
431
461
  if (Object.keys(c.config).some((key) => !allowedConfig.has(key)))
@@ -453,6 +483,9 @@ export function createWorkspaceCredentialService(rawOptions) {
453
483
  }
454
484
  try {
455
485
  const before = await snapshot();
486
+ // An edit that does not say otherwise keeps a draft a draft, so only an
487
+ // explicit `draft: false` can validate and reconnect it.
488
+ const draft = requestedDraft ?? before.c.config.workspaceCredentialDraft === true;
456
489
  const values = new Map(before.secrets.map((secret) => [secret.key, secret.secret]));
457
490
  const seen = new Set();
458
491
  for (const rawSecret of array(input.secretValues ?? [])) {
@@ -474,7 +507,9 @@ export function createWorkspaceCredentialService(rawOptions) {
474
507
  secretValues: [...values].map(([key, secret]) => ({ key, secret })),
475
508
  }, a);
476
509
  p.id = connectionId;
477
- await validatePrepared(p);
510
+ p.draft = draft;
511
+ if (!draft)
512
+ await validatePrepared(p);
478
513
  await authorize(a, true);
479
514
  const db = getDbExec();
480
515
  if (typeof db.transaction !== "function")
@@ -514,9 +549,10 @@ export function createWorkspaceCredentialService(rawOptions) {
514
549
  // the system clock repeats or moves backwards.
515
550
  const now = Math.max(Date.now(), Date.parse(current.c.updatedAt) + 1, Date.parse(current.g.updatedAt) + 1), configJson = JSON.stringify(storedConfig(p)), refsJson = JSON.stringify(refs(p));
516
551
  const row = await tx.execute({
517
- sql: "UPDATE public.workspace_connections SET label = ?, config_json = ?, credential_refs_json = ?, updated_at = ? WHERE id = ? AND org_id = ? AND owner_email = ?",
552
+ sql: "UPDATE public.workspace_connections SET label = ?, status = ?, config_json = ?, credential_refs_json = ?, updated_at = ? WHERE id = ? AND org_id = ? AND owner_email = ?",
518
553
  args: [
519
554
  p.name,
555
+ draft ? "disabled" : "connected",
520
556
  configJson,
521
557
  refsJson,
522
558
  now,
@@ -0,0 +1,28 @@
1
+ # Workspace credential draft edits
2
+
3
+ `createWorkspaceCredentialActions` and `createWorkspaceCredentialService` accept the trusted server option `allowDraftEdits: true`. It is off by default. Enable it only when the app can reopen and activate its own disabled drafts.
4
+
5
+ With the option enabled, pass `draft: true` to `update` with the opened connection revision. The update stores the submitted configuration and credentials without provider validation, atomically marks the profile disabled, and keeps its grant and encrypted credentials. Disabled profiles cannot resolve credentials for app requests. The returned profile has `active: false`; its `workspaceCredentialDraft` config marker identifies it as an editable draft. Archive removes that marker, so an archived connection cannot be activated as a draft.
6
+
7
+ To activate, reopen the draft and pass its current revision with `draft: false`. The service validates the complete credential set before publishing the active status. A validation failure leaves the draft and its revision unchanged. An update that omits `draft` keeps the profile a draft and skips validation; only an explicit `draft: false` activates it. Omitted secret values retain their saved values. Unknown write outcomes require a fresh read rather than an automatic retry.
8
+
9
+ ```ts
10
+ const actions = createWorkspaceCredentialActions({
11
+ appId: "analytics-2",
12
+ provider,
13
+ validateCredentials,
14
+ allowDraftEdits: true,
15
+ });
16
+
17
+ await actions.update.run(
18
+ { connectionId, revision, draft: true, name },
19
+ context,
20
+ );
21
+ // Reopen the profile to get its latest revision before activation.
22
+ await actions.update.run(
23
+ { connectionId, revision: reopenedRevision, draft: false },
24
+ context,
25
+ );
26
+ ```
27
+
28
+ The app must apply its usual manager authorization and provide a form that distinguishes a disabled draft from an archived connection. Do not treat the draft marker as permission to query the provider.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agent-native/core",
3
- "version": "0.231.0",
3
+ "version": "0.232.0-nightly-20261118152333",
4
4
  "description": "The agentic application framework for building autonomous agents with intuitive UIs",
5
5
  "homepage": "https://github.com/BuilderIO/agent-native#readme",
6
6
  "bugs": {
@@ -483,6 +483,7 @@
483
483
  "./connections/runtime": "./dist/connections/runtime.js",
484
484
  "./provider-api": "./dist/provider-api/index.js",
485
485
  "./provider-api/runtime": "./dist/provider-api/runtime.js",
486
+ "./provider-api/call-gates": "./dist/provider-api/call-gates.js",
486
487
  "./provider-api/gong": "./dist/provider-api/gong.js",
487
488
  "./provider-api/corpus-jobs": "./dist/provider-api/corpus-jobs.js",
488
489
  "./provider-api/corpus-jobs-store": "./dist/provider-api/corpus-jobs-store.js",
@@ -807,8 +808,8 @@
807
808
  "yaml": "^2.9.0",
808
809
  "yjs": "^13.6.33",
809
810
  "zod": "^4.3.6",
810
- "@agent-native/recap-cli": "^0.5.106",
811
- "@agent-native/agentkit": "^0.231.0"
811
+ "@agent-native/agentkit": "^0.232.0-nightly-20261118152333",
812
+ "@agent-native/recap-cli": "^0.5.106"
812
813
  },
813
814
  "devDependencies": {
814
815
  "@ai-sdk/anthropic": "^3.0.71",
@@ -881,7 +882,7 @@
881
882
  "xlsx": "^0.18.5"
882
883
  },
883
884
  "peerDependencies": {
884
- "@agent-native/core-corpus": ">=0.196.0",
885
+ "@agent-native/core-corpus": "0.232.0-nightly-20261118152333",
885
886
  "@ai-sdk/anthropic": ">=3",
886
887
  "@ai-sdk/cohere": ">=3",
887
888
  "@ai-sdk/google": ">=3",