@tangle-network/agent-runtime 0.314.1 → 0.316.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 (82) hide show
  1. package/README.md +6 -0
  2. package/dist/{activation-BpMnOlw5.d.ts → activation-BFDmjaKP.d.ts} +2 -2
  3. package/dist/{activation-Ci20OAsG.js → activation-CvdE2HIU.js} +3 -3
  4. package/dist/{activation-Ci20OAsG.js.map → activation-CvdE2HIU.js.map} +1 -1
  5. package/dist/agent.d.ts +2 -1
  6. package/dist/agent.js +2 -2
  7. package/dist/{bundle-BK3XBY6q.js → bundle-RgHpAFDY.js} +2 -2
  8. package/dist/{bundle-BK3XBY6q.js.map → bundle-RgHpAFDY.js.map} +1 -1
  9. package/dist/candidate-execution/index.js +5 -5
  10. package/dist/{coordination-driver-CyJF37L8.js → coordination-driver-DGhN8GO9.js} +3 -3
  11. package/dist/{coordination-driver-CyJF37L8.js.map → coordination-driver-DGhN8GO9.js.map} +1 -1
  12. package/dist/{delegate-CTezpiM2.js → delegate-B5pmSbQa.js} +2 -2
  13. package/dist/{delegate-CTezpiM2.js.map → delegate-B5pmSbQa.js.map} +1 -1
  14. package/dist/durable.d.ts +1 -1
  15. package/dist/durable.js +4 -4
  16. package/dist/{graph-DGDrO_ZW.js → graph-G0j1ysqe.js} +4 -4
  17. package/dist/{graph-DGDrO_ZW.js.map → graph-G0j1ysqe.js.map} +1 -1
  18. package/dist/{improvement-cycle-DReg-Qi4.js → improvement-cycle-D7yR6GC2.js} +6 -6
  19. package/dist/{improvement-cycle-DReg-Qi4.js.map → improvement-cycle-D7yR6GC2.js.map} +1 -1
  20. package/dist/{index-B89bMKhD.d.ts → index-CUh40yUJ.d.ts} +13 -90
  21. package/dist/index.d.ts +4 -4
  22. package/dist/index.js +9 -9
  23. package/dist/integrations-DopfCC2a.d.ts +190 -0
  24. package/dist/integrations-dFi-ALk7.js +132 -0
  25. package/dist/integrations-dFi-ALk7.js.map +1 -0
  26. package/dist/intelligence.d.ts +2 -2
  27. package/dist/intelligence.js +7 -7
  28. package/dist/kernel.d.ts +2 -2
  29. package/dist/kernel.js +9 -9
  30. package/dist/{loop-runner-bin-eoycPwY3.js → loop-runner-bin-CFVX4oi0.js} +3 -3
  31. package/dist/{loop-runner-bin-eoycPwY3.js.map → loop-runner-bin-CFVX4oi0.js.map} +1 -1
  32. package/dist/{loop-runner-bin-BM1in-RT.d.ts → loop-runner-bin-DQKLUt0l.d.ts} +2 -2
  33. package/dist/loop-runner-bin.d.ts +1 -1
  34. package/dist/loop-runner-bin.js +1 -1
  35. package/dist/mcp/bin.js +3 -3
  36. package/dist/mcp/index.d.ts +74 -33
  37. package/dist/mcp/index.js +129 -6
  38. package/dist/mcp/index.js.map +1 -1
  39. package/dist/{openai-tools-xPO6dzf4.d.ts → openai-tools-u3gWBi3x.d.ts} +2 -2
  40. package/dist/placement.d.ts +132 -0
  41. package/dist/placement.js +319 -0
  42. package/dist/placement.js.map +1 -0
  43. package/dist/platform.d.ts +1 -188
  44. package/dist/platform.js +1 -129
  45. package/dist/platform.js.map +1 -1
  46. package/dist/{prepare-8A1CAWG8.js → prepare-CD9kR0gS.js} +3 -3
  47. package/dist/{prepare-8A1CAWG8.js.map → prepare-CD9kR0gS.js.map} +1 -1
  48. package/dist/{profile-BhQShsM1.js → profile-CHXYmpGd.js} +2 -2
  49. package/dist/{profile-BhQShsM1.js.map → profile-CHXYmpGd.js.map} +1 -1
  50. package/dist/profile-materialization-Cca615eu.d.ts +90 -0
  51. package/dist/profiles.d.ts +1 -1
  52. package/dist/{protected-model-port-ug52OmvB.js → protected-model-port-B0pHd65J.js} +4 -4
  53. package/dist/{protected-model-port-ug52OmvB.js.map → protected-model-port-B0pHd65J.js.map} +1 -1
  54. package/dist/{provision-supervisor-B6D3XRbL.js → provision-supervisor-BQLLrUtn.js} +4 -4
  55. package/dist/{provision-supervisor-B6D3XRbL.js.map → provision-supervisor-BQLLrUtn.js.map} +1 -1
  56. package/dist/{runtime-NlIVxRXu.js → runtime-B9BOFyEp.js} +10 -9
  57. package/dist/runtime-B9BOFyEp.js.map +1 -0
  58. package/dist/{search-executor-DFs-79tK.js → search-executor-B5ZVFsDV.js} +3 -3
  59. package/dist/{search-executor-DFs-79tK.js.map → search-executor-B5ZVFsDV.js.map} +1 -1
  60. package/dist/{server-B8ubWXpW.js → server-TwpH9aik.js} +4 -4
  61. package/dist/{server-B8ubWXpW.js.map → server-TwpH9aik.js.map} +1 -1
  62. package/dist/{supervise-BE9ta8bl.js → supervise-CU6AuxWY.js} +119 -29
  63. package/dist/supervise-CU6AuxWY.js.map +1 -0
  64. package/dist/{supervisor-DmSuKksw.js → supervisor-CbFyf48U.js} +3 -3
  65. package/dist/{supervisor-DmSuKksw.js.map → supervisor-CbFyf48U.js.map} +1 -1
  66. package/dist/testing.d.ts +1 -1
  67. package/dist/testing.js +14 -14
  68. package/dist/tool-loop.d.ts +35 -5
  69. package/dist/tool-loop.js +48 -21
  70. package/dist/tool-loop.js.map +1 -1
  71. package/dist/tui/index.d.ts +1 -1
  72. package/dist/tui/index.js +1 -1
  73. package/dist/workspace-store/index.d.ts +206 -0
  74. package/dist/workspace-store/index.js +855 -0
  75. package/dist/workspace-store/index.js.map +1 -0
  76. package/dist/{workspace-streams-BEvSX97P.js → workspace-streams-DkijayqX.js} +16 -3
  77. package/dist/workspace-streams-DkijayqX.js.map +1 -0
  78. package/package.json +14 -4
  79. package/skills/profile-authoring/SKILL.md +114 -171
  80. package/dist/runtime-NlIVxRXu.js.map +0 -1
  81. package/dist/supervise-BE9ta8bl.js.map +0 -1
  82. package/dist/workspace-streams-BEvSX97P.js.map +0 -1
@@ -0,0 +1,206 @@
1
+ //#region src/workspace-store/store.d.ts
2
+ /**
3
+ * The workspace store port: path documents with compare-and-set revisions and
4
+ * erasure tombstones. One store per tenant holds memory and files for every
5
+ * executor; adapters own persistence, this module owns the contract.
6
+ *
7
+ * No `node:` imports: this module runs unchanged in Workers.
8
+ */
9
+ /** What an entry holds; memory kinds are written through `memory.remember`, files through `files.write`. */
10
+ type WorkspaceEntryKind = 'fact' | 'preference' | 'instruction' | 'file';
11
+ /** `member` entries live under `/memories/members/<memberId>/`; everything else is `workspace`. */
12
+ type WorkspaceEntryScope = 'workspace' | 'member';
13
+ /** Large content kept outside the index, e.g. an R2 object. The adapter owns `key`. */
14
+ interface WorkspaceBytesRef {
15
+ readonly key: string;
16
+ readonly size: number;
17
+ readonly contentType?: string;
18
+ readonly sha256?: string;
19
+ }
20
+ /** One live document. Exactly one of `content` and `bytes` is present. */
21
+ interface WorkspaceEntry {
22
+ readonly workspaceId: string;
23
+ /** Stable for the life of the path; kept across updates. */
24
+ readonly id: string;
25
+ readonly path: string;
26
+ readonly kind: WorkspaceEntryKind;
27
+ readonly scope: WorkspaceEntryScope;
28
+ readonly content?: string;
29
+ readonly bytes?: WorkspaceBytesRef;
30
+ /** Monotonic per path, including across delete and re-create. */
31
+ readonly revision: number;
32
+ readonly createdBy: string;
33
+ readonly createdAt: string;
34
+ readonly updatedBy: string;
35
+ readonly updatedAt: string;
36
+ }
37
+ /** Erasure record: the content and bytes are gone; only this audit row remains. */
38
+ interface WorkspaceTombstone {
39
+ readonly workspaceId: string;
40
+ readonly id: string;
41
+ readonly path: string;
42
+ /** The revision the delete produced (last live revision + 1). */
43
+ readonly revision: number;
44
+ readonly deletedBy: string;
45
+ readonly deletedAt: string;
46
+ }
47
+ interface WorkspacePutInput {
48
+ readonly workspaceId: string;
49
+ readonly path: string;
50
+ readonly kind: WorkspaceEntryKind;
51
+ /** Revision the caller read, or `null` when the path must not hold a live entry. */
52
+ readonly ifRevision: number | null;
53
+ readonly actor: string;
54
+ readonly content?: string;
55
+ readonly bytes?: WorkspaceBytesRef;
56
+ /** Id for a new entry; ignored on update. Defaults to a random UUID. */
57
+ readonly id?: string;
58
+ }
59
+ interface WorkspaceDeleteInput {
60
+ readonly workspaceId: string;
61
+ readonly path: string;
62
+ /** When present, the delete is refused unless the live revision matches. */
63
+ readonly ifRevision?: number;
64
+ readonly actor: string;
65
+ }
66
+ /**
67
+ * Versioned path store for one or many tenants. Every write is a compare-and-set
68
+ * on `revision`; a mismatch throws {@link WorkspaceConflictError}. Delete erases
69
+ * content and bytes and records a {@link WorkspaceTombstone}.
70
+ */
71
+ interface WorkspaceStore {
72
+ get(workspaceId: string, path: string): Promise<WorkspaceEntry | null>;
73
+ /** Live entries whose path starts with `prefix`, sorted by path. */
74
+ list(workspaceId: string, prefix: string): Promise<WorkspaceEntry[]>;
75
+ put(input: WorkspacePutInput): Promise<WorkspaceEntry>;
76
+ /** Returns the tombstone, or `null` when nothing was live and no `ifRevision` was given. */
77
+ delete(input: WorkspaceDeleteInput): Promise<WorkspaceTombstone | null>;
78
+ /** Erasure audit rows whose path starts with `prefix`, oldest first. */
79
+ tombstones(workspaceId: string, prefix?: string): Promise<WorkspaceTombstone[]>;
80
+ }
81
+ /** A write lost a compare-and-set race or targeted the wrong revision. Re-read and retry. */
82
+ declare class WorkspaceConflictError extends Error {
83
+ readonly path: string;
84
+ readonly expected: number | null;
85
+ readonly actual: number | null;
86
+ readonly code: "conflict";
87
+ constructor(path: string, expected: number | null, actual: number | null);
88
+ }
89
+ /** Refuse anything but an absolute, normalized path such as `/files/report.md`. */
90
+ declare function assertWorkspacePath(path: string): void;
91
+ /** The member a path belongs to, or `null` for workspace-scoped paths. */
92
+ declare function memberIdFromPath(path: string): string | null;
93
+ /** Validate a put before any adapter touches storage; adapters call this first. */
94
+ declare function checkWorkspacePut(input: WorkspacePutInput): void;
95
+ /** Process-local adapter for tests, previews, and single-instance hosts. */
96
+ declare function createInMemoryWorkspaceStore(options?: {
97
+ now?: () => Date;
98
+ newId?: () => string;
99
+ }): WorkspaceStore;
100
+ //#endregion
101
+ //#region src/workspace-store/contract.d.ts
102
+ interface WorkspaceStoreContractCase {
103
+ readonly name: string;
104
+ run(): Promise<void>;
105
+ }
106
+ interface WorkspaceStoreContractResult {
107
+ readonly name: string;
108
+ readonly passed: boolean;
109
+ readonly error?: string;
110
+ }
111
+ /** Make a fresh, empty store for one case. */
112
+ type MakeWorkspaceStore = () => WorkspaceStore | Promise<WorkspaceStore>;
113
+ /** The contract as named cases; each case builds its own store. */
114
+ declare function workspaceStoreContractCases(makeStore: MakeWorkspaceStore): WorkspaceStoreContractCase[];
115
+ /** Run every contract case against fresh stores; never throws for a failing case. */
116
+ declare function runWorkspaceStoreContract(makeStore: MakeWorkspaceStore): Promise<WorkspaceStoreContractResult[]>;
117
+ //#endregion
118
+ //#region src/workspace-store/tools.d.ts
119
+ /** `viewer` and `guest` are read-only under the default policy. */
120
+ type WorkspaceRole = 'owner' | 'manager' | 'member' | 'viewer' | 'guest';
121
+ /** The speaker of the running turn, resolved by the host from its trusted session. */
122
+ interface WorkspaceTurn {
123
+ readonly workspaceId: string;
124
+ readonly memberId: string;
125
+ readonly role: WorkspaceRole;
126
+ }
127
+ /**
128
+ * Structural tool shape, assignable to agent-app's `McpToolDefinition`
129
+ * (`name`, `description`, JSON Schema `inputSchema`, `run(args)`), so a host
130
+ * mounts it in-process or behind `createMcpToolHandler` without this package
131
+ * depending on agent-app. `run` throws to report a refusal or conflict.
132
+ */
133
+ interface WorkspaceToolDefinition {
134
+ name: string;
135
+ description: string;
136
+ inputSchema: Record<string, unknown>;
137
+ run(args: Record<string, unknown>): Promise<unknown>;
138
+ }
139
+ interface WorkspaceAccess {
140
+ readonly op: 'read' | 'write' | 'delete';
141
+ readonly path: string;
142
+ readonly kind?: WorkspaceEntryKind;
143
+ }
144
+ /** `null` allows; a string refuses and is shown to the model as the reason. */
145
+ type WorkspacePolicyDecision = string | null;
146
+ interface MemoryPolicy {
147
+ authorize(turn: WorkspaceTurn, access: WorkspaceAccess): WorkspacePolicyDecision;
148
+ /** Product content rule, e.g. refuse guest PII. Runs after `authorize` on every write. */
149
+ admit?(turn: WorkspaceTurn, candidate: {
150
+ path: string;
151
+ kind: WorkspaceEntryKind;
152
+ text: string;
153
+ }): WorkspacePolicyDecision | Promise<WorkspacePolicyDecision>;
154
+ }
155
+ /** A policy or path rule refused the call. */
156
+ declare class WorkspacePolicyError extends Error {
157
+ readonly code: "refused";
158
+ constructor(message: string);
159
+ }
160
+ /**
161
+ * Default authority. Reads: workspace memory, the speaker's own member memory,
162
+ * `/knowledge/**`, `/files/**`. Writes: viewers and guests none; any member may
163
+ * save workspace facts and own-scope facts or preferences, and write `/files/**`;
164
+ * owners and managers also save instructions, workspace preferences, and
165
+ * `/knowledge/**`. Nobody touches another member's scope. `admit` is the
166
+ * product's content hook.
167
+ */
168
+ declare function defaultMemoryPolicy(options?: {
169
+ admit?: MemoryPolicy['admit'];
170
+ }): MemoryPolicy;
171
+ interface WorkspaceToolContext {
172
+ store: WorkspaceStore;
173
+ /** Resolve the running turn from the trusted server session; never from tool arguments. */
174
+ activeTurn(): Promise<WorkspaceTurn>;
175
+ /** Defaults to {@link defaultMemoryPolicy}. */
176
+ policy?: MemoryPolicy;
177
+ /** Id for new entries. Defaults to a random UUID. */
178
+ newId?: () => string;
179
+ }
180
+ /** Workspace memories plus the speaker's own member memories, the set a turn may see. */
181
+ declare function readTurnMemories(store: WorkspaceStore, turn: WorkspaceTurn): Promise<WorkspaceEntry[]>;
182
+ /** `memory.remember`, `memory.recall`, `memory.forget`. */
183
+ declare function createMemoryTools(context: WorkspaceToolContext): WorkspaceToolDefinition[];
184
+ /** `files.list`, `files.read`, `files.write`, `files.delete`, `files.search` over `/files/**` and `/knowledge/**`. */
185
+ declare function createFileTools(context: WorkspaceToolContext): WorkspaceToolDefinition[];
186
+ /**
187
+ * BM25 over entry text (and path words), highest score first, ties by path.
188
+ * Entries without inline text match on path words only.
189
+ */
190
+ declare function rankEntries(entries: readonly WorkspaceEntry[], query: string, limit: number): {
191
+ entry: WorkspaceEntry;
192
+ score: number;
193
+ }[];
194
+ /**
195
+ * Render the memories a turn sees as one stable block for the per-turn preamble.
196
+ * Order: instructions, preferences, facts; workspace before member; then path.
197
+ * Input order never changes the output, so identical memories give identical
198
+ * bytes (cache- and digest-stable). Lines beyond `maxTokens` (≈4 chars per
199
+ * token) are counted, not shown. The block ends with where to recall more.
200
+ */
201
+ declare function renderPinnedMemory(entries: readonly WorkspaceEntry[], options?: {
202
+ maxTokens?: number;
203
+ }): string;
204
+ //#endregion
205
+ export { type MakeWorkspaceStore, type MemoryPolicy, type WorkspaceAccess, type WorkspaceBytesRef, WorkspaceConflictError, type WorkspaceDeleteInput, type WorkspaceEntry, type WorkspaceEntryKind, type WorkspaceEntryScope, type WorkspacePolicyDecision, WorkspacePolicyError, type WorkspacePutInput, type WorkspaceRole, type WorkspaceStore, type WorkspaceStoreContractCase, type WorkspaceStoreContractResult, type WorkspaceTombstone, type WorkspaceToolContext, type WorkspaceToolDefinition, type WorkspaceTurn, assertWorkspacePath, checkWorkspacePut, createFileTools, createInMemoryWorkspaceStore, createMemoryTools, defaultMemoryPolicy, memberIdFromPath, rankEntries, readTurnMemories, renderPinnedMemory, runWorkspaceStoreContract, workspaceStoreContractCases };
206
+ //# sourceMappingURL=index.d.ts.map