@agent-native/core 0.211.0 → 0.212.0-nightly-20261021010049

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 (91) hide show
  1. package/README.md +1 -1
  2. package/dist/app-config/analytics.d.ts +1 -0
  3. package/dist/app-config/analytics.js +7 -0
  4. package/dist/app-config/schema.d.ts +1 -0
  5. package/dist/chat-threads/store.d.ts +28 -2
  6. package/dist/chat-threads/store.js +75 -13
  7. package/dist/cli/template-baseline.js +18 -5
  8. package/dist/cli/template-sync.js +100 -19
  9. package/dist/client/agent-chat/index.d.ts +2 -1
  10. package/dist/client/agent-chat/index.js +2 -1
  11. package/dist/client/chat/agentkit-protocol.js +21 -1
  12. package/dist/client/chat/run-outcome.d.ts +1 -0
  13. package/dist/client/chat/runtime.js +6 -0
  14. package/dist/client/sharing/index.d.ts +2 -1
  15. package/dist/client/sharing/index.js +2 -1
  16. package/dist/client/sharing/share-controller-helpers.d.ts +14 -1
  17. package/dist/client/sharing/share-controller-helpers.js +46 -1
  18. package/dist/client/sharing/useShareButtonController.d.ts +12 -0
  19. package/dist/client/sharing/useShareButtonController.js +76 -57
  20. package/dist/client/sharing/useShareDialogController.d.ts +3 -0
  21. package/dist/client/sharing/useShareDialogController.js +77 -49
  22. package/dist/client/sharing/useShareVisibilityTransition.d.ts +68 -0
  23. package/dist/client/sharing/useShareVisibilityTransition.js +224 -0
  24. package/dist/client/use-chat-thread-list.d.ts +40 -0
  25. package/dist/client/use-chat-thread-list.js +210 -0
  26. package/dist/client/use-chat-threads.d.ts +67 -0
  27. package/dist/client/use-chat-threads.js +141 -23
  28. package/dist/client/use-db-sync.d.ts +1 -0
  29. package/dist/client/use-db-sync.js +13 -1
  30. package/dist/collab/__fixtures__/live-copy-tasks.d.ts +1 -0
  31. package/dist/collab/__fixtures__/live-copy-tasks.js +92 -0
  32. package/dist/collab/awareness.d.ts +2 -2
  33. package/dist/collab/bounded-task-bundle.d.ts +17 -0
  34. package/dist/collab/bounded-task-bundle.js +39 -0
  35. package/dist/collab/bounded-task-source.d.ts +14 -0
  36. package/dist/collab/bounded-task-source.js +8 -0
  37. package/dist/collab/bounded-tasks.d.ts +67 -0
  38. package/dist/collab/bounded-tasks.js +439 -0
  39. package/dist/collab/client.js +2 -1
  40. package/dist/collab/index.d.ts +5 -2
  41. package/dist/collab/index.js +5 -2
  42. package/dist/collab/live-copy-tasks.d.ts +80 -0
  43. package/dist/collab/live-copy-tasks.js +330 -0
  44. package/dist/collab/live-copy.d.ts +188 -0
  45. package/dist/collab/live-copy.js +415 -0
  46. package/dist/collab/routes.d.ts +5 -0
  47. package/dist/collab/routes.js +24 -8
  48. package/dist/collab/storage.d.ts +53 -1
  49. package/dist/collab/storage.js +93 -5
  50. package/dist/collab/struct-routes.d.ts +1 -1
  51. package/dist/collab/ydoc-manager.d.ts +92 -3
  52. package/dist/collab/ydoc-manager.js +447 -38
  53. package/dist/db/client.d.ts +6 -0
  54. package/dist/db/client.js +25 -5
  55. package/dist/deploy/build.js +2 -0
  56. package/dist/extensions/actions.js +1 -0
  57. package/dist/jobs/actions/manage-recurring-job.d.ts +1 -1
  58. package/dist/mcp/agent-connected.js +5 -1
  59. package/dist/mcp/build-server.js +39 -10
  60. package/dist/notifications/routes.d.ts +1 -1
  61. package/dist/observability/routes.d.ts +1 -1
  62. package/dist/org/index.d.ts +2 -2
  63. package/dist/progress/routes.d.ts +1 -1
  64. package/dist/provider-api/actions/custom-provider-registration.d.ts +16 -16
  65. package/dist/provider-api/actions/provider-api.d.ts +10 -10
  66. package/dist/server/agent-chat-plugin.js +80 -17
  67. package/dist/server/agent-engine-api-key-route.d.ts +1 -1
  68. package/dist/server/agent-engine-default-model-route.d.ts +1 -1
  69. package/dist/server/analytics.d.ts +1 -0
  70. package/dist/server/analytics.js +18 -1
  71. package/dist/server/collab-plugin.d.ts +10 -1
  72. package/dist/server/collab-plugin.js +89 -20
  73. package/dist/server/index.d.ts +1 -1
  74. package/dist/server/realtime-token.d.ts +1 -1
  75. package/dist/shared/optional-node-builtins.d.ts +1 -0
  76. package/dist/shared/optional-node-builtins.js +3 -0
  77. package/dist/sharing/access.d.ts +1 -0
  78. package/dist/sharing/access.js +113 -95
  79. package/dist/tracking/providers.d.ts +1 -0
  80. package/dist/tracking/providers.js +2 -1
  81. package/dist/triggers/actions/manage-automation.d.ts +2 -2
  82. package/dist/vite/bounded-task-plugin.d.ts +22 -0
  83. package/dist/vite/bounded-task-plugin.js +44 -0
  84. package/dist/vite/client.js +2 -0
  85. package/dist/vitest-config.js +3 -0
  86. package/dist/workspace-connections/actions/list-workspace-user-groups.d.ts +1 -1
  87. package/docs/content/deployment-environment-variables.mdx +1 -0
  88. package/docs/content/environment-variables.mdx +1 -0
  89. package/docs/content/sharing.mdx +36 -0
  90. package/docs/content/toolkit-sharing.mdx +98 -12
  91. package/package.json +5 -3
@@ -1,6 +1,7 @@
1
1
  import * as Y from "yjs";
2
- import type { DbExec } from "../db/client.js";
2
+ import { type DbExec } from "../db/client.js";
3
3
  import { type PatchOp } from "./json-to-yjs.js";
4
+ import { type LiveCopyBinding, type LiveCopyOutcome } from "./live-copy.js";
4
5
  export declare class CollabBaseVersionConflictError extends Error {
5
6
  constructor(message: string);
6
7
  }
@@ -16,9 +17,95 @@ export interface PreparedYDocMutationLease {
16
17
  persist(transaction: DbExec, textSnapshot: string): Promise<void>;
17
18
  }
18
19
  export declare function withPreparedYDocMutation<T>(docId: string, requestSource: string | undefined, run: (lease: PreparedYDocMutationLease) => Promise<T>): Promise<T>;
19
- export declare function getDocForWrite(docId: string): Promise<Y.Doc>;
20
+ /** Refuses live copies with `read_refused`; read those with `readLiveCopy`. */
20
21
  export declare function getDoc(docId: string): Promise<Y.Doc>;
21
- export declare function applyUpdate(docId: string, update: Uint8Array, requestSource?: string): Promise<void>;
22
+ /**
23
+ * Commits a client update. Once any live copy is defined, the result says
24
+ * whether the app's rows were derived from it; with none defined it is
25
+ * undefined, as before live copies existed.
26
+ */
27
+ export declare function applyUpdate(docId: string, update: Uint8Array, requestSource?: string): Promise<LiveCopyOutcome | undefined>;
28
+ export type LiveCopyRead = {
29
+ kind: "absent";
30
+ } | {
31
+ kind: "unseeded";
32
+ version: number;
33
+ state: Uint8Array;
34
+ } | {
35
+ kind: "live";
36
+ version: number;
37
+ state: Uint8Array;
38
+ text: string;
39
+ };
40
+ /**
41
+ * The stored live copy and derive(state). Absent (no row), unseeded (a row
42
+ * with nothing in the field, including a zero-byte state) and malformed
43
+ * (throws `malformed_state`) are never conflated.
44
+ */
45
+ export declare function readLiveCopy(binding: LiveCopyBinding, docId: string): Promise<LiveCopyRead>;
46
+ export interface MutateLiveCopyOptions {
47
+ /**
48
+ * The name of an edit in the runner's module
49
+ * (`defineLiveCopyTasks({ edits })`). It runs in the runner and is re-run
50
+ * against fresh state after each version conflict.
51
+ */
52
+ edit: string;
53
+ /** Passed to the edit. */
54
+ input?: unknown;
55
+ requestSource?: string;
56
+ maxAttempts?: number;
57
+ /**
58
+ * Writes this call's own rows (say, claiming the suggestion the edit
59
+ * applies) in the transaction that commits the edit, after the binding's
60
+ * persist and before `_collab_docs`, so they commit or roll back together.
61
+ * When the edit changes nothing it runs in a transaction of its own. A
62
+ * throw reaches the caller and nothing is published. Re-run on each
63
+ * version-conflict attempt.
64
+ */
65
+ persist?(tx: DbExec, change: LiveCopyCallChange): Promise<void>;
66
+ }
67
+ export interface LiveCopyCallChange {
68
+ changed: boolean;
69
+ /** The version this call leaves stored. */
70
+ version: number;
71
+ /** derive(state) at that version. */
72
+ text: string;
73
+ }
74
+ export interface LiveCopyMutationResult extends LiveCopyOutcome {
75
+ changed: boolean;
76
+ /** The stored version after the call; an unchanged edit leaves it as is. */
77
+ version: number;
78
+ state: Uint8Array;
79
+ /** derive(state). */
80
+ text: string;
81
+ /** What this call added to the state it edited. Empty when unchanged. */
82
+ update: Uint8Array;
83
+ attempts: number;
84
+ }
85
+ /**
86
+ * Applies a named edit to a seeded live copy and commits it with its derived
87
+ * text, retrying on `_collab_docs.version` conflicts. Throws `not_seeded`
88
+ * for an absent or unseeded copy; seed it with `seedLiveCopy` first.
89
+ */
90
+ export declare function mutateLiveCopy(binding: LiveCopyBinding, docId: string, options: MutateLiveCopyOptions): Promise<LiveCopyMutationResult>;
91
+ export interface SeedLiveCopyOptions {
92
+ /** Passed to the seed handler in the runner's module. */
93
+ source: string;
94
+ requestSource?: string;
95
+ }
96
+ export interface LiveCopySeedResult extends LiveCopyOutcome {
97
+ seeded: boolean;
98
+ version: number;
99
+ state: Uint8Array;
100
+ /** derive(state). */
101
+ text: string;
102
+ }
103
+ /**
104
+ * Seeds an absent or unseeded live copy from `source`. A live copy that
105
+ * already has content comes back unchanged with `seeded: false`; malformed
106
+ * stored state throws `malformed_state` and is never overwritten.
107
+ */
108
+ export declare function seedLiveCopy(binding: LiveCopyBinding, docId: string, options: SeedLiveCopyOptions): Promise<LiveCopySeedResult>;
22
109
  export declare function seedXmlFragmentIfEmpty(docId: string, seedUpdate: Uint8Array, requestSource?: string): Promise<{
23
110
  seeded: boolean;
24
111
  state: Uint8Array;
@@ -39,4 +126,6 @@ export declare function applyJson(docId: string, newJson: any, fieldName?: strin
39
126
  export declare function applyPatchOps(docId: string, ops: PatchOp[], fieldName?: string, requestSource?: string): Promise<void>;
40
127
  export declare function getJson(docId: string, fieldName?: string): Promise<any>;
41
128
  export declare function seedFromJson(docId: string, json: any, fieldName?: string, type?: "map" | "array", client?: DbExec): Promise<void>;
129
+ /** Overwrites a document's stored state and text. Refuses live copies. */
130
+ export declare function saveYDocState(docId: string, state: Uint8Array, textSnapshot: string): Promise<void>;
42
131
  export declare function releaseDoc(docId: string): void;