@tangle-network/agent-runtime 0.318.0 → 0.319.5

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 (81) hide show
  1. package/dist/{activation-CRG-tjnR.js → activation-DPpb2I8z.js} +3 -3
  2. package/dist/{activation-CRG-tjnR.js.map → activation-DPpb2I8z.js.map} +1 -1
  3. package/dist/{activation-RExX9RDm.d.ts → activation-OColGsfd.d.ts} +2 -2
  4. package/dist/agent.d.ts +3 -3
  5. package/dist/agent.js +3 -3
  6. package/dist/{bundle-RgHpAFDY.js → bundle-Cw-QdGmH.js} +2 -2
  7. package/dist/{bundle-RgHpAFDY.js.map → bundle-Cw-QdGmH.js.map} +1 -1
  8. package/dist/candidate-execution/index.d.ts +40 -3
  9. package/dist/candidate-execution/index.js +86 -7
  10. package/dist/candidate-execution/index.js.map +1 -1
  11. package/dist/{coordination-driver-DK3pI_HB.js → coordination-driver-woTI2Vpr.js} +3 -3
  12. package/dist/{coordination-driver-DK3pI_HB.js.map → coordination-driver-woTI2Vpr.js.map} +1 -1
  13. package/dist/{delegate-Co9vJIgE.js → delegate-DrFainK0.js} +2 -2
  14. package/dist/{delegate-Co9vJIgE.js.map → delegate-DrFainK0.js.map} +1 -1
  15. package/dist/durable.d.ts +1 -1
  16. package/dist/durable.js +4 -4
  17. package/dist/{graph-DYBCYZjg.js → graph-joXNwtkE.js} +5 -5
  18. package/dist/{graph-DYBCYZjg.js.map → graph-joXNwtkE.js.map} +1 -1
  19. package/dist/graph-registry-BuJbzTzF.js +211 -0
  20. package/dist/graph-registry-BuJbzTzF.js.map +1 -0
  21. package/dist/{improvement-cycle-jp80l_ZQ.js → improvement-cycle-Dkrb5nVc.js} +7 -7
  22. package/dist/{improvement-cycle-jp80l_ZQ.js.map → improvement-cycle-Dkrb5nVc.js.map} +1 -1
  23. package/dist/{index-CHlWvoo5.d.ts → index-Da7w2H86.d.ts} +268 -82
  24. package/dist/index.d.ts +5 -5
  25. package/dist/index.js +10 -10
  26. package/dist/intelligence.d.ts +4 -4
  27. package/dist/intelligence.js +7 -7
  28. package/dist/kernel.d.ts +3 -2
  29. package/dist/kernel.js +12 -11
  30. package/dist/{loop-runner-bin-C-QaaVE2.d.ts → loop-runner-bin-CbBoLC9D.d.ts} +2 -2
  31. package/dist/{loop-runner-bin-C8jLr2gR.js → loop-runner-bin-OYVzvqiL.js} +3 -3
  32. package/dist/{loop-runner-bin-C8jLr2gR.js.map → loop-runner-bin-OYVzvqiL.js.map} +1 -1
  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 +2 -2
  37. package/dist/mcp/index.js +6 -6
  38. package/dist/{model-policy-B-rOb8Nj.js → model-policy-CNe257pB.js} +4 -4
  39. package/dist/{model-policy-B-rOb8Nj.js.map → model-policy-CNe257pB.js.map} +1 -1
  40. package/dist/{openai-tools-BuJB3JQH.d.ts → openai-tools-Cu9E1Bda.d.ts} +2 -2
  41. package/dist/placement.d.ts +1 -1
  42. package/dist/{prepare-CD9kR0gS.js → prepare-DjCLEN-q.js} +3 -3
  43. package/dist/prepare-DjCLEN-q.js.map +1 -0
  44. package/dist/{profile-CHXYmpGd.js → profile-DmVM4Gxb.js} +9 -2
  45. package/dist/profile-DmVM4Gxb.js.map +1 -0
  46. package/dist/{profile-materialization-Cca615eu.d.ts → profile-materialization-C5-t3HJ7.d.ts} +14 -3
  47. package/dist/profiles.d.ts +1 -1
  48. package/dist/profiles.js +1 -1
  49. package/dist/{protected-model-port-C9QtEf3y.d.ts → protected-model-port-CQg2gstJ.d.ts} +3 -3
  50. package/dist/{protected-model-port-B0pHd65J.js → protected-model-port-D1fcnYdj.js} +4 -4
  51. package/dist/{protected-model-port-B0pHd65J.js.map → protected-model-port-D1fcnYdj.js.map} +1 -1
  52. package/dist/{provision-supervisor-CunKnayY.js → provision-supervisor-CN16EdkE.js} +5 -5
  53. package/dist/{provision-supervisor-CunKnayY.js.map → provision-supervisor-CN16EdkE.js.map} +1 -1
  54. package/dist/{runtime-UG5tV_yf.js → runtime-BE4GW_q1.js} +307 -13
  55. package/dist/runtime-BE4GW_q1.js.map +1 -0
  56. package/dist/{search-executor-DMX6tCY4.js → search-executor-DuHd_fws.js} +4 -4
  57. package/dist/{search-executor-DMX6tCY4.js.map → search-executor-DuHd_fws.js.map} +1 -1
  58. package/dist/{server-fSBvPPLH.js → server-CYdjyARj.js} +4 -4
  59. package/dist/{server-fSBvPPLH.js.map → server-CYdjyARj.js.map} +1 -1
  60. package/dist/{supervise-C41ywfFd.js → supervise-CvKx8rlw.js} +5 -5
  61. package/dist/{supervise-C41ywfFd.js.map → supervise-CvKx8rlw.js.map} +1 -1
  62. package/dist/{supervisor-BXEL_Fxe.js → supervisor--nmU6w86.js} +259 -36
  63. package/dist/supervisor--nmU6w86.js.map +1 -0
  64. package/dist/testing.d.ts +1 -1
  65. package/dist/testing.js +14 -14
  66. package/dist/tui/index.d.ts +1 -1
  67. package/dist/tui/index.js +1 -1
  68. package/dist/workspace-store/index.d.ts +171 -3
  69. package/dist/workspace-store/index.js +529 -8
  70. package/dist/workspace-store/index.js.map +1 -1
  71. package/dist/{workspace-streams-DkijayqX.js → workspace-streams-DFAhW7hF.js} +300 -42
  72. package/dist/workspace-streams-DFAhW7hF.js.map +1 -0
  73. package/dist/{workspace-streams-CpSmt3zx.d.ts → workspace-streams-U6_UfOXu.d.ts} +10 -2
  74. package/package.json +13 -10
  75. package/skills/codemode/references/runtime-execution.md +10 -3
  76. package/skills/graph-designer/SKILL.md +57 -0
  77. package/dist/prepare-CD9kR0gS.js.map +0 -1
  78. package/dist/profile-CHXYmpGd.js.map +0 -1
  79. package/dist/runtime-UG5tV_yf.js.map +0 -1
  80. package/dist/supervisor-BXEL_Fxe.js.map +0 -1
  81. package/dist/workspace-streams-DkijayqX.js.map +0 -1
package/dist/testing.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { Bt as RunGraphTestOptions, Cc as superviseWithTestBrain, Dv as ToolLoopChat, Ev as ToolLoopCallContext, Wt as runGraphWithTestBrain, hl as supervisorAgentWithTestBrain, mn as driverAgent, ol as SupervisorAgentTestDeps, pn as DriverAgentOptions, xc as SuperviseTestOptions } from "./index-CHlWvoo5.js";
1
+ import { Hn as driverAgent, Pl as SupervisorAgentTestDeps, Tn as runGraphWithTestBrain, Ul as supervisorAgentWithTestBrain, Vn as DriverAgentOptions, Yc as SuperviseTestOptions, Zc as superviseWithTestBrain, ey as ToolLoopCallContext, ty as ToolLoopChat, xn as RunGraphTestOptions } from "./index-Da7w2H86.js";
2
2
  import { AgentImprovementProposal, AgentProfile, AgentProfileImprovementMeasuredComparison, SandboxSizePreset } from "@tangle-network/agent-interface";
3
3
  //#region src/testing/index.d.ts
4
4
  /** A proposal produced by Runtime's opaque profile-improvement path. */
package/dist/testing.js CHANGED
@@ -1,14 +1,14 @@
1
- import { I as immutableCandidateValue, M as canonicalCandidateDigest$1 } from "./workspace-streams-DkijayqX.js";
2
- import { f as verifyAgentImprovementProposal } from "./improvement-cycle-jp80l_ZQ.js";
3
- import { i as applyExactAgentProfileDiff, p as parseExactAgentProfile } from "./profile-CHXYmpGd.js";
4
- import { r as driverAgent } from "./coordination-driver-DK3pI_HB.js";
5
- import { a as superviseWithTestBrain, m as supervisorAgentWithTestBrain } from "./supervise-C41ywfFd.js";
6
- import { i as runGraphWithTestBrain } from "./graph-DYBCYZjg.js";
1
+ import { L as immutableCandidateValue, N as canonicalCandidateDigest$1 } from "./workspace-streams-DFAhW7hF.js";
2
+ import { f as verifyAgentImprovementProposal } from "./improvement-cycle-Dkrb5nVc.js";
3
+ import { i as applyExactAgentProfileDiff, p as parseExactAgentProfile } from "./profile-DmVM4Gxb.js";
4
+ import { r as driverAgent } from "./coordination-driver-woTI2Vpr.js";
5
+ import { a as superviseWithTestBrain, m as supervisorAgentWithTestBrain } from "./supervise-CvKx8rlw.js";
6
+ import { i as runGraphWithTestBrain } from "./graph-joXNwtkE.js";
7
7
  import { SANDBOX_SIZE_PRESET_NAMES, canonicalAgentProfileDigest } from "@tangle-network/agent-interface";
8
8
  //#region src/testing/fixtures/agent-improvement-proposal.json
9
9
  var agent_improvement_proposal_default = {
10
10
  changedSurfaces: ["prompt"],
11
- digest: "sha256:6fa8d47783fd932aec5ede5b31e1b1eda4cdf2b40e9180c5da9c0c5d5298d174",
11
+ digest: "sha256:f8c3cb727d2492dc2905479b6004f6e6ccf5618869d3a92e7c2bd00abcb0b47b",
12
12
  evaluation: {
13
13
  "decision": {
14
14
  "contributingChecks": [
@@ -4579,7 +4579,7 @@ var agent_improvement_proposal_default = {
4579
4579
  ],
4580
4580
  "metadata": {
4581
4581
  "fixture": "agent-improvement-proposal",
4582
- "runtimeVersion": "0.318.0"
4582
+ "runtimeVersion": "0.319.5"
4583
4583
  },
4584
4584
  "objectives": [
4585
4585
  {
@@ -4690,8 +4690,8 @@ var agent_improvement_proposal_default = {
4690
4690
  "baselineContentHash": "sha256:5c21ee53e513fc604cb09754e21c392b24a424da0ef37dbf8f1ee4a8a0b08f09",
4691
4691
  "candidateContentHash": "sha256:60fcbb1c728194bd51d7d19cb732d1c3f1881dce7e0a6266b41c8b98cfd65693",
4692
4692
  "kind": "agent-eval-loop",
4693
- "recordDigest": "sha256:ac37057ac69db1739b5e62c052813c08efc956a8eaee649ce0146044ff40b7e5",
4694
- "runId": "agent-runtime-0.318.0-proposal-fixture",
4693
+ "recordDigest": "sha256:9c02079c1e46abdc3821c1f2feec5bb2ddb1d7dd5f9cd2b9db6c9ed101d5f560",
4694
+ "runId": "agent-runtime-0.319.5-proposal-fixture",
4695
4695
  "schema": "agent-candidate-experiment"
4696
4696
  }
4697
4697
  },
@@ -4714,13 +4714,13 @@ var agent_improvement_proposal_default = {
4714
4714
  }],
4715
4715
  kind: "agent-improvement-proposal",
4716
4716
  proposedAt: "2026-07-10T01:00:00.000Z",
4717
- runId: "agent-runtime-0.318.0-proposal-fixture"
4717
+ runId: "agent-runtime-0.319.5-proposal-fixture"
4718
4718
  };
4719
4719
  //#endregion
4720
4720
  //#region src/testing/fixtures/agent-profile-improvement-proposal.json
4721
4721
  var agent_profile_improvement_proposal_default = {
4722
4722
  changedSurfaces: ["prompt", "skills"],
4723
- digest: "sha256:3884e3f5c91e1007b37615c5ee1261c385c3548e0acd0d58453a8db73c3b513f",
4723
+ digest: "sha256:a3d4efbd0e7a95c16413801313cfea534676477dd50347a2d7b2dca5cbdd75a4",
4724
4724
  evaluation: {
4725
4725
  "decision": {
4726
4726
  "contributingChecks": [
@@ -6354,7 +6354,7 @@ var agent_profile_improvement_proposal_default = {
6354
6354
  ],
6355
6355
  "metadata": {
6356
6356
  "fixture": "agent-profile-improvement-proposal",
6357
- "runtimeVersion": "0.318.0"
6357
+ "runtimeVersion": "0.319.5"
6358
6358
  },
6359
6359
  "objectives": [
6360
6360
  {
@@ -6465,7 +6465,7 @@ var agent_profile_improvement_proposal_default = {
6465
6465
  "baselineContentHash": "sha256:21c495a37c418c10bde64fbaa188beddeed31f1f051ea60a6a6582a9ee0db704",
6466
6466
  "candidateContentHash": "sha256:103f77bc8481601eef1ad5fe6ba84a40dffabc3a44f421f8c8559121edab84e9",
6467
6467
  "kind": "agent-eval-loop",
6468
- "recordDigest": "sha256:f5da112352ed105eaf6a64b9979fc67f608bd359d677fade6ac080c31563d886",
6468
+ "recordDigest": "sha256:c70404980d0f4a369d2dc1de283ebeaf2c91bb554bda9af1372f4cf83db7c343",
6469
6469
  "runId": "profile-improvement-1",
6470
6470
  "schema": "agent-profile-improvement-experiment"
6471
6471
  }
@@ -1,4 +1,4 @@
1
- import { _t as SupervisorCleanupReceipt, gt as ProvisionedSupervisor, ht as ProvisionSupervisorRequest, mt as ProvisionSupervisorConnection, vt as provisionSupervisor } from "../index-CHlWvoo5.js";
1
+ import { _t as SupervisorCleanupReceipt, gt as ProvisionedSupervisor, ht as ProvisionSupervisorRequest, mt as ProvisionSupervisorConnection, vt as provisionSupervisor } from "../index-Da7w2H86.js";
2
2
  //#region src/tui/top-app.d.ts
3
3
  /**
4
4
  * The interactive side of the supervisor-run TUI: a keypress/mouse loop over the frames
package/dist/tui/index.js CHANGED
@@ -1,3 +1,3 @@
1
- import { t as provisionSupervisor } from "../provision-supervisor-CunKnayY.js";
1
+ import { t as provisionSupervisor } from "../provision-supervisor-CN16EdkE.js";
2
2
  import { a as renderTopFrameWithLayout, i as renderTopFrame, n as runTopApp, r as loadTopSnapshot, t as renderTopOnce } from "../top-app-DaiR4LXM.js";
3
3
  export { loadTopSnapshot, provisionSupervisor, renderTopFrame, renderTopFrameWithLayout, renderTopOnce, runTopApp };
@@ -55,6 +55,14 @@ interface WorkspacePutInput {
55
55
  readonly bytes?: WorkspaceBytesRef;
56
56
  /** Id for a new entry; ignored on update. Defaults to a random UUID. */
57
57
  readonly id?: string;
58
+ /**
59
+ * The caller's key for this write, for at-least-once callers such as a queue
60
+ * consumer or a sidecar capture hook. While the path's live entry is the one
61
+ * this operation wrote, with the same kind and content, repeating the call
62
+ * returns that entry instead of a conflict. Honoured only by a store that sets
63
+ * {@link WorkspaceStore.idempotentOperations}; others ignore it.
64
+ */
65
+ readonly operationId?: string;
58
66
  }
59
67
  interface WorkspaceDeleteInput {
60
68
  readonly workspaceId: string;
@@ -62,6 +70,13 @@ interface WorkspaceDeleteInput {
62
70
  /** When present, the delete is refused unless the live revision matches. */
63
71
  readonly ifRevision?: number;
64
72
  readonly actor: string;
73
+ /**
74
+ * The caller's key for this delete. While the path's latest tombstone is the
75
+ * one this operation made, repeating the call returns that tombstone instead
76
+ * of a conflict. Honoured only by a store that sets
77
+ * {@link WorkspaceStore.idempotentOperations}.
78
+ */
79
+ readonly operationId?: string;
65
80
  }
66
81
  /**
67
82
  * Versioned path store for one or many tenants. Every write is a compare-and-set
@@ -77,6 +92,8 @@ interface WorkspaceStore {
77
92
  delete(input: WorkspaceDeleteInput): Promise<WorkspaceTombstone | null>;
78
93
  /** Erasure audit rows whose path starts with `prefix`, oldest first. */
79
94
  tombstones(workspaceId: string, prefix?: string): Promise<WorkspaceTombstone[]>;
95
+ /** True when put and delete honour `operationId`; the contract then checks it. */
96
+ readonly idempotentOperations?: boolean;
80
97
  }
81
98
  /** A write lost a compare-and-set race or targeted the wrong revision. Re-read and retry. */
82
99
  declare class WorkspaceConflictError extends Error {
@@ -92,12 +109,81 @@ declare function assertWorkspacePath(path: string): void;
92
109
  declare function memberIdFromPath(path: string): string | null;
93
110
  /** Validate a put before any adapter touches storage; adapters call this first. */
94
111
  declare function checkWorkspacePut(input: WorkspacePutInput): void;
112
+ /** Refuse an `operationId` that is present but empty, not a string, or over 256 chars. */
113
+ declare function checkOperationId(path: string, operationId: unknown): void;
114
+ /** Whether `entry` is exactly what `input` would write: same kind, content and bytes. */
115
+ declare function isSameWorkspaceWrite(entry: WorkspaceEntry, input: WorkspacePutInput): boolean;
95
116
  /** Process-local adapter for tests, previews, and single-instance hosts. */
96
117
  declare function createInMemoryWorkspaceStore(options?: {
97
118
  now?: () => Date;
98
119
  newId?: () => string;
99
120
  }): WorkspaceStore;
100
121
  //#endregion
122
+ //#region src/workspace-store/codec.d.ts
123
+ /** Where a value lives; bound into the ciphertext. */
124
+ interface WorkspaceCodecContext {
125
+ readonly tenant: string;
126
+ readonly path: string;
127
+ /**
128
+ * The write's `operationId`, when it has one. A codec then seals the same
129
+ * plaintext to the same bytes, so a replayed put is the same write.
130
+ */
131
+ readonly operationId?: string;
132
+ }
133
+ interface WorkspaceContentCodec {
134
+ seal(plain: Uint8Array, context: WorkspaceCodecContext): Promise<Uint8Array>;
135
+ open(sealed: Uint8Array, context: WorkspaceCodecContext): Promise<Uint8Array>;
136
+ }
137
+ /** A value did not open: unknown key, wrong tenant or path, tampering, or plaintext where a seal was required. */
138
+ declare class WorkspaceCodecError extends Error {
139
+ readonly code: "codec";
140
+ constructor(message: string);
141
+ }
142
+ /**
143
+ * AES-256-GCM with a key id per value. `keys` maps key id to 32 raw bytes
144
+ * (base64 or base64url when a string). The encryption key and the key that
145
+ * derives replay-stable IVs are both derived from the raw key with HKDF, so the
146
+ * raw key is never used for two algorithms.
147
+ *
148
+ * Without an `operationId` every seal uses a random 96-bit IV. With one, the IV
149
+ * is an HMAC of the tenant, path, operation and plaintext, as in SIV: only an
150
+ * identical write repeats it, and that repeat reveals only that the write was
151
+ * repeated.
152
+ */
153
+ declare function createAesGcmContentCodec(options: {
154
+ keys: Readonly<Record<string, string | Uint8Array>>;
155
+ activeKeyId: string;
156
+ }): WorkspaceContentCodec;
157
+ /**
158
+ * The AES-256-GCM codec from an app's env, or `null` when neither variable is
159
+ * set. `WORKSPACE_STORE_KEYS` is `id:base64,id:base64`; `WORKSPACE_STORE_KEY_ID`
160
+ * names the key new writes use. Setting one without the other is refused.
161
+ */
162
+ declare function aesGcmContentCodecFromEnv(env: {
163
+ WORKSPACE_STORE_KEYS?: string;
164
+ WORKSPACE_STORE_KEY_ID?: string;
165
+ }): WorkspaceContentCodec | null;
166
+ /** Stored text of a sealed `content`: a prefix, then the sealed bytes in base64. */
167
+ declare const SEALED_CONTENT_PREFIX = "wsc1:";
168
+ /** Seal bytes a host is about to upload (an R2 object) under the entry's tenant and path. */
169
+ declare function sealWorkspaceBytes(codec: WorkspaceContentCodec, context: WorkspaceCodecContext, bytes: Uint8Array): Promise<Uint8Array>;
170
+ /** Open bytes a host downloaded for an entry's `bytes` reference. */
171
+ declare function openWorkspaceBytes(codec: WorkspaceContentCodec, context: WorkspaceCodecContext, sealed: Uint8Array): Promise<Uint8Array>;
172
+ interface ContentCodecOptions {
173
+ /**
174
+ * Return stored content that is not sealed as is, for a store being moved
175
+ * onto a codec. Off by default: a regulated store refuses plaintext.
176
+ */
177
+ readonly readPlaintext?: boolean;
178
+ }
179
+ /**
180
+ * `store` with every entry's `content` sealed at rest. Index fields, `bytes`
181
+ * references and tombstones pass through untouched; the host seals the bytes
182
+ * themselves. `idempotentOperations` is the inner store's: a replayed put with
183
+ * an `operationId` seals to the same bytes, so the inner replay check holds.
184
+ */
185
+ declare function withContentCodec(store: WorkspaceStore, codec: WorkspaceContentCodec, options?: ContentCodecOptions): WorkspaceStore;
186
+ //#endregion
101
187
  //#region src/workspace-store/contract.d.ts
102
188
  interface WorkspaceStoreContractCase {
103
189
  readonly name: string;
@@ -110,10 +196,14 @@ interface WorkspaceStoreContractResult {
110
196
  }
111
197
  /** Make a fresh, empty store for one case. */
112
198
  type MakeWorkspaceStore = () => WorkspaceStore | Promise<WorkspaceStore>;
199
+ interface WorkspaceStoreContractOptions {
200
+ /** Also check `operationId` replay; for a store that sets `idempotentOperations`. */
201
+ readonly idempotentOperations?: boolean;
202
+ }
113
203
  /** The contract as named cases; each case builds its own store. */
114
- declare function workspaceStoreContractCases(makeStore: MakeWorkspaceStore): WorkspaceStoreContractCase[];
204
+ declare function workspaceStoreContractCases(makeStore: MakeWorkspaceStore, options?: WorkspaceStoreContractOptions): WorkspaceStoreContractCase[];
115
205
  /** Run every contract case against fresh stores; never throws for a failing case. */
116
- declare function runWorkspaceStoreContract(makeStore: MakeWorkspaceStore): Promise<WorkspaceStoreContractResult[]>;
206
+ declare function runWorkspaceStoreContract(makeStore: MakeWorkspaceStore, options?: WorkspaceStoreContractOptions): Promise<WorkspaceStoreContractResult[]>;
117
207
  //#endregion
118
208
  //#region src/workspace-store/tools.d.ts
119
209
  /** `viewer` and `guest` are read-only under the default policy. */
@@ -202,5 +292,83 @@ declare function renderPinnedMemory(entries: readonly WorkspaceEntry[], options?
202
292
  maxTokens?: number;
203
293
  }): string;
204
294
  //#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 };
295
+ //#region src/workspace-store/harness.d.ts
296
+ /** Opening marker for the generated block in a harness's native memory file. */
297
+ declare const HARNESS_MEMORY_BEGIN = "<!-- workspace-store:memory begin. Generated from the workspace store; save memories with memory.remember. -->";
298
+ /** Closing marker for the generated block in a harness's native memory file. */
299
+ declare const HARNESS_MEMORY_END = "<!-- workspace-store:memory end -->";
300
+ /** The generated block a host writes into a harness's native memory location. */
301
+ declare function renderHarnessMemory(entries: readonly WorkspaceEntry[], options?: {
302
+ maxTokens?: number;
303
+ }): string;
304
+ /** Replace the generated block in `native`, or append one; text outside it is kept byte for byte. */
305
+ declare function projectHarnessMemory(native: string, block: string): string;
306
+ /** Native files keyed by path, as the host read them. A missing file is absent or `undefined`. */
307
+ type HarnessNativeFiles = Readonly<Record<string, string | undefined>>;
308
+ /** Lowercase, collapse spaces, drop a leading "Remember:" and trailing punctuation: the duplicate key. */
309
+ declare function normalizeMemoryText(text: string): string;
310
+ /**
311
+ * What the harness added during the turn, outside the generated block: new
312
+ * lines in files that existed, and the body of new files (a Claude Code memory
313
+ * directory entry). Lines removed or present before are ignored; a removal is
314
+ * not a forget, which only `memory.forget` performs.
315
+ */
316
+ declare function captureHarnessMemory(before: HarnessNativeFiles, after: HarnessNativeFiles): string[];
317
+ /** Where a captured memory came from. */
318
+ interface HarnessProvenance {
319
+ readonly harness: string;
320
+ readonly turnId: string;
321
+ readonly memberId: string;
322
+ }
323
+ /** The entry `actor` for a captured memory, so `createdBy` carries its provenance. */
324
+ declare function harnessActor({ harness, turnId, memberId }: HarnessProvenance): string;
325
+ /** Read the harness, turn, and member provenance encoded by {@link harnessActor}. */
326
+ declare function parseHarnessActor(actor: string): HarnessProvenance | null;
327
+ interface HarnessIngestResult {
328
+ readonly saved: WorkspaceEntry[];
329
+ /** Facts already in the store, by normalized text. */
330
+ readonly duplicates: string[];
331
+ /** Facts the policy refused, with the reason. */
332
+ readonly refused: {
333
+ text: string;
334
+ reason: string;
335
+ }[];
336
+ }
337
+ /**
338
+ * Save captured facts as workspace memories through the same policy as
339
+ * `memory.remember`, with the harness and turn as the actor. Duplicates of a
340
+ * memory the turn can see, or of an earlier fact in the batch, are skipped.
341
+ */
342
+ declare function ingestHarnessMemories(context: WorkspaceToolContext, input: {
343
+ harness: string;
344
+ turnId: string;
345
+ facts: readonly string[];
346
+ }): Promise<HarnessIngestResult>;
347
+ interface MemoryDivergence {
348
+ /** Sum of the counts below; 0 means every native copy agrees with the store. */
349
+ readonly total: number;
350
+ /** Store memories the turn sees that a native file's generated block omits. */
351
+ readonly missing: number;
352
+ /** Generated-block lines whose id is gone from the store or whose text differs. */
353
+ readonly stale: number;
354
+ /** Facts a harness wrote outside the generated block that the store does not hold. */
355
+ readonly uncaptured: number;
356
+ readonly files: Record<string, {
357
+ missing: string[];
358
+ stale: string[];
359
+ uncaptured: string[];
360
+ }>;
361
+ }
362
+ /**
363
+ * Compare each native file with the store as `turn` sees it, after ingest ran.
364
+ * `before` is the files as projected at session start, `after` as they are now:
365
+ * only what the harness added since then can be uncaptured, so the profile's own
366
+ * generated text in the same file never counts. Files that held a generated
367
+ * block at session start are projection targets: losing the block counts every
368
+ * visible memory as missing. Other files (a new memory-directory entry) can
369
+ * only hold uncaptured facts.
370
+ */
371
+ declare function memoryDivergence(store: WorkspaceStore, turn: WorkspaceTurn, before: HarnessNativeFiles, after: HarnessNativeFiles): Promise<MemoryDivergence>;
372
+ //#endregion
373
+ export { type ContentCodecOptions, HARNESS_MEMORY_BEGIN, HARNESS_MEMORY_END, type HarnessIngestResult, type HarnessNativeFiles, type HarnessProvenance, type MakeWorkspaceStore, type MemoryDivergence, type MemoryPolicy, SEALED_CONTENT_PREFIX, type WorkspaceAccess, type WorkspaceBytesRef, type WorkspaceCodecContext, WorkspaceCodecError, WorkspaceConflictError, type WorkspaceContentCodec, type WorkspaceDeleteInput, type WorkspaceEntry, type WorkspaceEntryKind, type WorkspaceEntryScope, type WorkspacePolicyDecision, WorkspacePolicyError, type WorkspacePutInput, type WorkspaceRole, type WorkspaceStore, type WorkspaceStoreContractCase, type WorkspaceStoreContractOptions, type WorkspaceStoreContractResult, type WorkspaceTombstone, type WorkspaceToolContext, type WorkspaceToolDefinition, type WorkspaceTurn, aesGcmContentCodecFromEnv, assertWorkspacePath, captureHarnessMemory, checkOperationId, checkWorkspacePut, createAesGcmContentCodec, createFileTools, createInMemoryWorkspaceStore, createMemoryTools, defaultMemoryPolicy, harnessActor, ingestHarnessMemories, isSameWorkspaceWrite, memberIdFromPath, memoryDivergence, normalizeMemoryText, openWorkspaceBytes, parseHarnessActor, projectHarnessMemory, rankEntries, readTurnMemories, renderHarnessMemory, renderPinnedMemory, runWorkspaceStoreContract, sealWorkspaceBytes, withContentCodec, workspaceStoreContractCases };
206
374
  //# sourceMappingURL=index.d.ts.map