@sema-agent/client-core 0.104.0 → 0.105.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 (92) hide show
  1. package/CHANGELOG.md +99 -0
  2. package/README.md +13 -5
  3. package/dist/adapt/arms.js +14 -6
  4. package/dist/adapter/activeRunSelfHeal.d.ts +1 -0
  5. package/dist/adapter/activeRunSelfHeal.js +10 -5
  6. package/dist/adapter/downstream/eventToSdkMessage.js +4 -4
  7. package/dist/adapter/downstream/wiringManifestView.d.ts +6 -0
  8. package/dist/adapter/downstream/wiringManifestView.js +25 -0
  9. package/dist/adapter/runStream.js +5 -1
  10. package/dist/cloudConfigWireCaps.js +3 -0
  11. package/dist/compensations.js +6 -6
  12. package/dist/coreValuePorts.d.ts +3 -1
  13. package/dist/coreValuePorts.js +4 -0
  14. package/dist/displayUntrusted.d.ts +4 -2
  15. package/dist/displayUntrusted.js +45 -22
  16. package/dist/engineGenerationPort.d.ts +11 -2
  17. package/dist/engineGenerationPort.js +63 -9
  18. package/dist/engineHealthFacts.d.ts +5 -0
  19. package/dist/engineHealthFacts.js +11 -0
  20. package/dist/eventLeg.d.ts +1 -1
  21. package/dist/eventLeg.js +23 -3
  22. package/dist/generated/engineFactTables.d.ts +1 -0
  23. package/dist/generated/engineFactTables.js +1 -0
  24. package/dist/generated/sdkFactTables.d.ts +2 -0
  25. package/dist/generated/sdkFactTables.js +9 -0
  26. package/dist/headlessReconnectWire.js +31 -4
  27. package/dist/hitl/askGateWire.js +26 -2
  28. package/dist/hitl/frameRouter.d.ts +4 -0
  29. package/dist/hitl/frameRouter.js +14 -0
  30. package/dist/hitl/gateIdentity.d.ts +1 -0
  31. package/dist/hitl/gateIdentity.js +3 -0
  32. package/dist/hitl/livePendingAsk.d.ts +2 -1
  33. package/dist/hitl/livePendingAsk.js +7 -1
  34. package/dist/hitl/planReviewCard.d.ts +21 -0
  35. package/dist/hitl/planReviewCard.js +229 -0
  36. package/dist/hitl/planReviewWire.d.ts +38 -13
  37. package/dist/hitl/planReviewWire.js +355 -133
  38. package/dist/hitl/toolApprovalWire.d.ts +2 -2
  39. package/dist/hitl/toolApprovalWire.js +53 -32
  40. package/dist/hostSettingsSource.d.ts +1 -1
  41. package/dist/hostSettingsSource.js +8 -4
  42. package/dist/hostTurnSettings.d.ts +1 -1
  43. package/dist/hostTurnSettings.js +29 -10
  44. package/dist/i18n/messages.en.d.ts +50 -0
  45. package/dist/i18n/messages.en.js +50 -0
  46. package/dist/i18n/messages.zh.js +51 -0
  47. package/dist/index.d.ts +15 -3
  48. package/dist/index.js +9 -1
  49. package/dist/mcpTransportKindsCapability.d.ts +18 -0
  50. package/dist/mcpTransportKindsCapability.js +75 -0
  51. package/dist/mcpWireCaps.d.ts +4 -1
  52. package/dist/mcpWireCaps.js +24 -13
  53. package/dist/notifications.d.ts +9 -0
  54. package/dist/notifications.js +11 -2
  55. package/dist/ownKey.d.ts +4 -0
  56. package/dist/ownKey.js +8 -0
  57. package/dist/permissionModeWriteCapability.d.ts +13 -0
  58. package/dist/permissionModeWriteCapability.js +35 -0
  59. package/dist/permissionsAllowGrantCapability.d.ts +3 -0
  60. package/dist/permissionsAllowGrantCapability.js +26 -3
  61. package/dist/permissionsDeclaration.d.ts +23 -1
  62. package/dist/permissionsDeclaration.js +60 -30
  63. package/dist/planReviewCardFacts.d.ts +116 -0
  64. package/dist/planReviewCardFacts.js +469 -0
  65. package/dist/reattachWindow.d.ts +8 -1
  66. package/dist/reattachWindow.js +44 -12
  67. package/dist/runFollow.d.ts +30 -0
  68. package/dist/runFollow.js +117 -0
  69. package/dist/runLedgerSnapshot.d.ts +20 -0
  70. package/dist/runLedgerSnapshot.js +272 -0
  71. package/dist/runPermissionModeSwitch.d.ts +57 -0
  72. package/dist/runPermissionModeSwitch.js +135 -0
  73. package/dist/runReattachPolicy.d.ts +13 -5
  74. package/dist/runReattachPolicy.js +58 -23
  75. package/dist/seam.d.ts +3 -0
  76. package/dist/seam.js +1 -1
  77. package/dist/seatContract.js +1 -0
  78. package/dist/sessionMemoryErase.d.ts +1 -1
  79. package/dist/sessionMemoryErase.js +5 -0
  80. package/dist/sessionMemoryStatus.d.ts +27 -1
  81. package/dist/sessionMemoryStatus.js +117 -0
  82. package/dist/sseIdleTriage.d.ts +3 -1
  83. package/dist/sseIdleTriage.js +19 -4
  84. package/dist/steering.d.ts +1 -0
  85. package/dist/steering.js +34 -26
  86. package/dist/subagent/engineSubagentTail.js +2 -0
  87. package/dist/subagentContentStore.d.ts +3 -0
  88. package/dist/subagentContentStore.js +10 -1
  89. package/dist/turnFailurePresentation.d.ts +5 -2
  90. package/dist/turnFailurePresentation.js +12 -4
  91. package/docs/INTEGRATION-CLIENTS.md +587 -10
  92. package/package.json +2 -2
@@ -39,6 +39,24 @@ export interface PermissionsDeclarationBuckets {
39
39
  export interface PermissionsDeclaration {
40
40
  permissions?: PermissionsDeclarationBuckets;
41
41
  }
42
+ export type SettingsRuleLayerOrigin = keyof typeof SETTINGS_SOURCE_TIERS;
43
+ export interface TightenRuleContribution {
44
+ readonly rule: string;
45
+ readonly origin: WireRuleOrigin;
46
+ }
47
+ export interface LayeredTightenEntry {
48
+ readonly rule: string;
49
+ readonly layer: SettingsRuleLayerOrigin;
50
+ }
51
+ export type TightenWireEntry = string | LayeredTightenEntry;
52
+ export interface HostPermissionsBuckets {
53
+ deny?: TightenWireEntry[];
54
+ ask?: TightenWireEntry[];
55
+ allow?: string[];
56
+ }
57
+ export interface HostPermissionsDeclaration {
58
+ permissions?: HostPermissionsBuckets;
59
+ }
42
60
  export declare const PERMISSIONS_KEPT_REASONS: readonly ["allow_capability_off", "settings_read_not_clean", "empty_rule", "paren_in_tool_name", "retired_tool_name", "unprefixed_namespaced_name", "incomplete_protocol_name", "unminted_protocol_segment", "home_relative_path", "compile_refused", "content_form_not_grantable", "content_form_never_matches", "judge_failed", "duplicate", "voids_allow_list"];
43
61
  export type PermissionsKeptReason = (typeof PERMISSIONS_KEPT_REASONS)[number];
44
62
  export interface PermissionsKeptRule {
@@ -86,8 +104,12 @@ export interface AssembledRuleRow {
86
104
  readonly origin?: WireRuleOrigin;
87
105
  readonly fate: AssembledRuleFate;
88
106
  }
107
+ export interface LayeredTightenSources {
108
+ readonly deny: readonly TightenRuleContribution[];
109
+ readonly ask: readonly TightenRuleContribution[];
110
+ }
89
111
  export declare function permissionsDeclaration(input: PermissionsDeclarationInput, caps: PermissionsAllowGrantReading): PermissionsDeclaration;
90
- export declare function projectPermissionsDeclaration(input: PermissionsDeclarationInput, caps: PermissionsAllowGrantReading, projection: RulePortsProjection): PermissionsDeclaration;
112
+ export declare function projectPermissionsDeclaration(input: PermissionsDeclarationInput, caps: PermissionsAllowGrantReading, projection: RulePortsProjection, layered?: LayeredTightenSources): HostPermissionsDeclaration;
91
113
  export declare function permissionsDeclarationReport(input: PermissionsDeclarationInput, caps: PermissionsAllowGrantReading): PermissionsDeclarationReport;
92
114
  export declare function assembledRuleRows(input: PermissionsDeclarationInput, caps: PermissionsAllowGrantReading): readonly AssembledRuleRow[];
93
115
  export interface PermissionsAllowKeptFacts {
@@ -244,45 +244,60 @@ function allowListVoiders(sent) {
244
244
  return 'unknown';
245
245
  }
246
246
  }
247
- function judgeBucket(raw, behavior, originOf, cli, settingsGate, allowForm = 'grant', dropWire, owned = [], serverVersion) {
247
+ function judgeBucket(raw, behavior, originOf, cli, settingsGate, allowForm = 'grant', dropWire, owned = [], serverVersion, layeredFrom) {
248
248
  const firstSlot = new Map();
249
249
  for (const s of raw)
250
250
  if (!firstSlot.has(s.rule))
251
251
  firstSlot.set(s.rule, s);
252
252
  const groups = WIRE_RULE_TRUST_ORDER.map(() => []);
253
253
  const rankOf = (origin) => WIRE_RULE_TRUST_ORDER.indexOf(origin);
254
- if (originOf !== undefined) {
255
- for (const [r, origin] of originOf) {
254
+ const pairs = layeredFrom !== undefined ? layeredFrom.map((c) => [c.rule, c.origin]) : originOf;
255
+ const known = new Set();
256
+ if (pairs !== undefined) {
257
+ for (const [r, origin] of pairs) {
256
258
  const rank = rankOf(origin);
257
- if (rank >= 0 && typeof r === 'string' && firstSlot.has(r))
259
+ if (rank >= 0 && typeof r === 'string' && firstSlot.has(r)) {
258
260
  appendOwnElement(groups[rank], r);
261
+ known.add(r);
262
+ }
259
263
  }
260
264
  }
261
- const unknownOrigin = [...firstSlot.keys()].filter((r) => originOf === undefined || rankOf(originOf.get(r)) < 0);
265
+ const unknownOrigin = [...firstSlot.keys()].filter((r) => !known.has(r));
262
266
  const fateOfRule = new Map();
263
267
  const sent = [];
268
+ const sentLayers = [];
269
+ const sentIds = [];
264
270
  const winnerOf = new Map();
265
271
  const cliFates = cli === undefined ? [] : [...cli.fates];
266
- const place = (slot, fate) => {
272
+ const layerOf = (origin) => layeredFrom !== undefined && origin !== undefined && Object.hasOwn(SETTINGS_SOURCE_TIERS, origin) ? origin : undefined;
273
+ const place = (slot, fate, origin) => {
267
274
  if (!fate.sent)
268
275
  return fate;
269
276
  const dropped = dropWire?.(fate.wire);
270
277
  if (dropped !== undefined)
271
278
  return kept(dropped);
272
- if (winnerOf.has(fate.wire))
279
+ const layer = layerOf(origin);
280
+ const id = layeredFrom === undefined ? fate.wire : JSON.stringify([layer ?? null, fate.wire]);
281
+ if (winnerOf.has(id))
273
282
  return kept('duplicate');
274
- winnerOf.set(fate.wire, slot);
283
+ winnerOf.set(id, slot);
275
284
  appendOwnElement(sent, fate.wire);
285
+ appendOwnElement(sentLayers, layer);
286
+ appendOwnElement(sentIds, id);
276
287
  return fate;
277
288
  };
278
289
  const appendGroup = (group, origin) => {
279
290
  const held = settingsGate !== undefined && !outsideSettingsFiles(origin);
280
291
  const fates = held ? group.map(() => kept(settingsGate)) : judgeList(group, behavior, allowForm, serverVersion);
281
- group.forEach((r, k) => fateOfRule.set(r, place(firstSlot.get(r), fates[k])));
292
+ group.forEach((r, k) => {
293
+ const f = place(firstSlot.get(r), fates[k], origin);
294
+ if (!fateOfRule.has(r))
295
+ fateOfRule.set(r, f);
296
+ });
282
297
  };
283
298
  WIRE_RULE_TRUST_ORDER.forEach((origin, rank) => {
284
299
  if (origin === 'cliArg' && cli !== undefined)
285
- cli.slots.forEach((s, k) => (cliFates[k] = place(s, cliFates[k])));
300
+ cli.slots.forEach((s, k) => (cliFates[k] = place(s, cliFates[k], 'cliArg')));
286
301
  appendGroup(groups[rank], origin);
287
302
  });
288
303
  const ownedFates = owned.map((fate, k) => place({ rule: fate.sent ? fate.wire : '', list: 'allow', at: -1 - k }, fate));
@@ -293,7 +308,7 @@ function judgeBucket(raw, behavior, originOf, cli, settingsGate, allowForm = 'gr
293
308
  return f;
294
309
  return f.sent || f.reason === 'duplicate' ? kept('duplicate') : f;
295
310
  });
296
- return { sent, fates: [...fates, ...cliFates], winnerOf, ownedFates };
311
+ return { sent, sentLayers, sentIds, fates: [...fates, ...cliFates], winnerOf, ownedFates };
297
312
  }
298
313
  function clientOwnedFate(server) {
299
314
  if (server.length === 0)
@@ -312,7 +327,7 @@ function ownField(obj, key, where) {
312
327
  throw malformed(`${WHO}: ${where}${key} 只在原型链上,不是自有字段 —— 拒绝读取(请交普通对象)。`);
313
328
  return undefined;
314
329
  }
315
- function ruleList(v, key) {
330
+ function ruleList(v, key, tighten = false) {
316
331
  if (v === undefined || v === null)
317
332
  return undefined;
318
333
  if (!Array.isArray(v))
@@ -326,6 +341,9 @@ function ruleList(v, key) {
326
341
  continue;
327
342
  }
328
343
  const r = v[i];
344
+ if (tighten && r !== null && typeof r === 'object') {
345
+ throw malformed(`${WHO}: ${key}[${i}] 是对象(带出处层的条目形)—— 本口只收规则串:收紧方向的条目不静默丢,拒绝装配(带层条目由宿主设置入口在能力位恰真时铸)。`);
346
+ }
329
347
  if (typeof r === 'string')
330
348
  appendOwnElement(out, r);
331
349
  }
@@ -348,17 +366,17 @@ function originMap(v, key) {
348
366
  return snap;
349
367
  }
350
368
  const slotsOf = (list, name) => (list ?? []).map((rule, at) => ({ rule, list: name, at }));
351
- function assemble(input, caps, projection) {
369
+ function assemble(input, caps, projection, layered) {
352
370
  const outer = activeRulePortsProjection;
353
371
  activeRulePortsProjection = projection;
354
372
  try {
355
- return assembleNow(input, caps);
373
+ return assembleNow(input, caps, layered);
356
374
  }
357
375
  finally {
358
376
  activeRulePortsProjection = outer;
359
377
  }
360
378
  }
361
- function assembleNow(input, caps) {
379
+ function assembleNow(input, caps, layered) {
362
380
  let read;
363
381
  try {
364
382
  read = readAssemblyInput(input, caps);
@@ -367,7 +385,7 @@ function assembleNow(input, caps) {
367
385
  throw asAssemblyRefusal(e, 'input_malformed', WHO);
368
386
  }
369
387
  try {
370
- return judgeAssembly(read, caps);
388
+ return judgeAssembly(read, caps, layered);
371
389
  }
372
390
  catch (e) {
373
391
  throw asAssemblyRefusal(e, 'judge_unanswerable', WHO);
@@ -377,10 +395,10 @@ function readAssemblyInput(input, caps) {
377
395
  if (input === null || typeof input !== 'object' || Array.isArray(input)) {
378
396
  throw malformed(`${WHO}: 入参必须是对象 —— 收到 ${input === null ? 'null' : Array.isArray(input) ? 'array' : `typeof=${typeof input}`}。`);
379
397
  }
380
- const deny = ruleList(ownField(input, 'deny', ''), 'deny');
381
- const ask = ruleList(ownField(input, 'ask', ''), 'ask');
398
+ const deny = ruleList(ownField(input, 'deny', ''), 'deny', true);
399
+ const ask = ruleList(ownField(input, 'ask', ''), 'ask', true);
382
400
  const allow = ruleList(ownField(input, 'allow', ''), 'allow');
383
- const cliDeny = ruleList(ownField(input, 'cliDeny', ''), 'cliDeny');
401
+ const cliDeny = ruleList(ownField(input, 'cliDeny', ''), 'cliDeny', true);
384
402
  const ownedServers = [...new Set(ruleList(ownField(input, 'clientOwnedServers', ''), 'clientOwnedServers') ?? [])];
385
403
  const originsRaw = ownField(input, 'origins', '');
386
404
  let origins = {};
@@ -398,19 +416,19 @@ function readAssemblyInput(input, caps) {
398
416
  const serverVersion = typeof versionRaw === 'string' ? versionRaw : undefined;
399
417
  return { deny, ask, allow, cliDeny, ownedServers, origins, gate, serverVersion };
400
418
  }
401
- function judgeAssembly(read, caps) {
419
+ function judgeAssembly(read, caps, layered) {
402
420
  const { deny, ask, allow, cliDeny, ownedServers, origins, gate, serverVersion } = read;
403
421
  const cliSlots = slotsOf(cliDeny, 'cliDeny');
404
422
  const cli = cliDeny === undefined ? undefined : { slots: cliSlots, fates: judgeList(cliDeny, 'deny', 'grant', serverVersion) };
405
423
  const denySlots = slotsOf(deny, 'deny');
406
424
  const askSlots = slotsOf(ask, 'ask');
407
425
  const allowSlots = slotsOf(allow, 'allow');
408
- const denyJ = judgeBucket(denySlots, 'deny', origins.deny, cli, undefined, 'grant', undefined, [], serverVersion);
409
- const askJ = judgeBucket(askSlots, 'ask', origins.ask, undefined, undefined, 'grant', undefined, [], serverVersion);
426
+ const denyJ = judgeBucket(denySlots, 'deny', origins.deny, cli, undefined, 'grant', undefined, [], serverVersion, layered?.deny);
427
+ const askJ = judgeBucket(askSlots, 'ask', origins.ask, undefined, undefined, 'grant', undefined, [], serverVersion, layered?.ask);
410
428
  const allowForm = allowWireForm(caps) === 'layer' ? 'layer' : 'grant';
411
429
  const settingsGate = gate === 'settings_read_not_clean' ? 'settings_read_not_clean' : undefined;
412
430
  let allowJ = gate === 'capability_off'
413
- ? { sent: [], fates: allowSlots.map(() => kept('allow_capability_off')), winnerOf: new Map(), ownedFates: ownedServers.map(() => kept('allow_capability_off')) }
431
+ ? { sent: [], sentLayers: [], sentIds: [], fates: allowSlots.map(() => kept('allow_capability_off')), winnerOf: new Map(), ownedFates: ownedServers.map(() => kept('allow_capability_off')) }
414
432
  : judgeBucket(allowSlots, 'allow', origins.allow, undefined, settingsGate, allowForm, undefined, ownedServers.map(clientOwnedFate));
415
433
  if (gate !== 'capability_off' && allowForm === 'layer' && allowJ.sent.length > 0) {
416
434
  const voiders = allowListVoiders(allowJ.sent);
@@ -426,6 +444,17 @@ function judgeAssembly(read, caps) {
426
444
  buckets.ask = [...askJ.sent];
427
445
  if (allowJ.sent.length > 0)
428
446
  buckets.allow = [...allowJ.sent];
447
+ const entriesOf = (j) => j.sent.map((wire, i) => {
448
+ const layer = j.sentLayers[i];
449
+ return layer === undefined ? wire : Object.freeze({ rule: wire, layer });
450
+ });
451
+ const wireBuckets = {};
452
+ if (denyJ.sent.length > 0)
453
+ wireBuckets.deny = entriesOf(denyJ);
454
+ if (askJ.sent.length > 0)
455
+ wireBuckets.ask = entriesOf(askJ);
456
+ if (allowJ.sent.length > 0)
457
+ wireBuckets.allow = [...allowJ.sent];
429
458
  const keptRows = [];
430
459
  const rewritten = [];
431
460
  const ruleRows = [];
@@ -458,21 +487,22 @@ function judgeAssembly(read, caps) {
458
487
  });
459
488
  }
460
489
  });
461
- for (const wire of j.sent) {
462
- const winner = j.winnerOf.get(wire);
490
+ j.sent.forEach((wire, i) => {
491
+ const winner = j.winnerOf.get(j.sentIds[i]);
463
492
  if (winner.at < 0)
464
- continue;
493
+ return;
465
494
  if (winner.rule !== wire)
466
495
  appendOwnElement(rewritten, { from: winner.rule, to: wire, bucket });
467
- }
496
+ });
468
497
  }
469
- return { buckets, report: { kept: keptRows, rewritten, ...(clientOwned.length > 0 ? { clientOwned } : {}) }, rows: ruleRows };
498
+ return { buckets, wireBuckets, report: { kept: keptRows, rewritten, ...(clientOwned.length > 0 ? { clientOwned } : {}) }, rows: ruleRows };
470
499
  }
471
500
  export function permissionsDeclaration(input, caps) {
472
501
  return declarationOf(assemble(input, caps));
473
502
  }
474
- export function projectPermissionsDeclaration(input, caps, projection) {
475
- return declarationOf(assemble(input, caps, projection));
503
+ export function projectPermissionsDeclaration(input, caps, projection, layered) {
504
+ const { wireBuckets } = assemble(input, caps, projection, layered);
505
+ return Object.keys(wireBuckets).length > 0 ? { permissions: wireBuckets } : {};
476
506
  }
477
507
  function declarationOf({ buckets }) {
478
508
  return Object.keys(buckets).length > 0 ? { permissions: buckets } : {};
@@ -0,0 +1,116 @@
1
+ export type PlanBodyUnknownCause = 'not_observed' | 'gate_unidentified' | 'gate_moved' | 'unreadable' | 'ambiguous_call' | 'malformed_frame' | 'conflicting_claims' | 'not_presented' | 'not_carried';
2
+ export type PlanReviewBody = {
3
+ readonly kind: 'shown';
4
+ readonly markdown: string;
5
+ } | {
6
+ readonly kind: 'marked';
7
+ readonly literal: string;
8
+ } | {
9
+ readonly kind: 'too_large';
10
+ readonly length: number;
11
+ } | {
12
+ readonly kind: 'unknown';
13
+ readonly cause: PlanBodyUnknownCause;
14
+ };
15
+ export interface PlanReviewCardFacts {
16
+ readonly taskId: string;
17
+ readonly checkpointId?: string;
18
+ readonly body: PlanReviewBody;
19
+ }
20
+ export declare function planReviewBodyOf(text: string): Exclude<PlanReviewBody, {
21
+ kind: 'unknown';
22
+ }>;
23
+ export declare function mintPlanReviewCardFacts(taskId: string, checkpointId: string | undefined, body: PlanReviewBody): PlanReviewCardFacts;
24
+ export declare function unknownBody(cause: PlanBodyUnknownCause): PlanReviewBody;
25
+ export declare function planReviewCardFactsFrom(v: {} | null | undefined): PlanReviewCardFacts | undefined;
26
+ export declare function samePlanReviewCardFacts(a: PlanReviewCardFacts, b: PlanReviewCardFacts): boolean;
27
+ export declare function isPlanReviewPark(result: unknown): result is {
28
+ taskId: string;
29
+ sessionId?: string;
30
+ };
31
+ export declare function pausedCheckpointIdOf(carrier: {} | null | undefined): string | undefined;
32
+ export type PlanClaim = {
33
+ readonly kind: 'text';
34
+ readonly text: string;
35
+ } | {
36
+ readonly kind: 'cause';
37
+ readonly cause: PlanBodyUnknownCause;
38
+ };
39
+ interface PresentedCall {
40
+ readonly plan?: string;
41
+ }
42
+ interface ClaimWindow {
43
+ presented: PresentedCall[];
44
+ malformed: boolean;
45
+ ambiguous: boolean;
46
+ unreadable: boolean;
47
+ }
48
+ interface PlanReviewGateEntry {
49
+ readonly checkpointId: string;
50
+ readonly facts: PlanReviewCardFacts;
51
+ readonly claim: PlanClaim;
52
+ readonly highWater?: string;
53
+ readonly generation: number;
54
+ }
55
+ interface PlanReviewRunRecord {
56
+ readonly open: Set<string>;
57
+ readonly settled: Set<string>;
58
+ window: ClaimWindow;
59
+ sawPlanFrame: boolean;
60
+ claimAtMarker?: PlanClaim | undefined;
61
+ claimGate?: string | undefined;
62
+ dirty: boolean;
63
+ gate?: PlanReviewGateEntry;
64
+ generation: number;
65
+ cardIssued: boolean;
66
+ }
67
+ export declare function _resetPlanReviewRunsForTest(): void;
68
+ export interface PlanReviewFactsTicket {
69
+ readonly sessionKey: string;
70
+ readonly taskId: string;
71
+ readonly generation: number;
72
+ }
73
+ export declare function beginPlanReviewFactsRead(sessionKey: string, taskId: string): PlanReviewFactsTicket;
74
+ export declare function commitPlanReviewFacts(ticket: PlanReviewFactsTicket, facts: PlanReviewCardFacts, claim: PlanClaim, highWater?: string): PlanReviewCardFacts | undefined;
75
+ export declare function samePlanClaim(a: PlanClaim, b: PlanClaim): boolean;
76
+ export declare function registeredPlanReviewCardFacts(sessionKey: string, taskId: string, checkpointId: string): PlanReviewCardFacts | undefined;
77
+ export interface PlanReviewCurrentGate {
78
+ readonly checkpointId: string;
79
+ readonly facts: PlanReviewCardFacts;
80
+ readonly generation: number;
81
+ }
82
+ export declare function currentPlanReviewGateOf(sessionKey: string, taskId: string): PlanReviewCurrentGate | undefined;
83
+ export declare function planReviewRunGeneration(sessionKey: string, taskId: string): number;
84
+ export declare function notePlanReviewCardIssued(sessionKey: string, taskId: string): boolean;
85
+ export declare function planReviewGateHighWaterOf(sessionKey: string, taskId: string, checkpointId: string): string | undefined;
86
+ export interface PlanBodyClaimLeg {
87
+ taskId?: string;
88
+ readonly buffer: Array<{
89
+ readonly frame: object;
90
+ readonly subFlow: boolean;
91
+ }>;
92
+ overflow: boolean;
93
+ unreadable: boolean;
94
+ }
95
+ export declare function openPlanBodyClaimLeg(): PlanBodyClaimLeg;
96
+ export declare function stepPlanBodyClaim(leg: PlanBodyClaimLeg, frame: object, subFlow: boolean): void;
97
+ export declare function planReviewParkFacts(leg: PlanBodyClaimLeg, result: {} | null | undefined): PlanReviewCardFacts | undefined;
98
+ export interface PlanReviewFactsTaken {
99
+ readonly sessionKey: string;
100
+ readonly taskId: string;
101
+ readonly facts: PlanReviewCardFacts;
102
+ readonly generation: number;
103
+ }
104
+ export declare function planReviewFactsCurrent(taken: PlanReviewFactsTaken): boolean;
105
+ export interface PlanGateRowRead {
106
+ readonly ok: boolean;
107
+ readonly atPlanGate: boolean;
108
+ readonly checkpointId?: string;
109
+ }
110
+ export declare function planGateRowReadOf(row: {} | null | undefined): PlanGateRowRead;
111
+ export type PlanReviewLedgerFold = PlanReviewRunRecord;
112
+ export declare function openPlanReviewLedgerFold(): PlanReviewLedgerFold;
113
+ export declare function stepPlanReviewLedgerFold(fold: PlanReviewLedgerFold, frame: object, subFlow: boolean): PlanReviewLedgerFold;
114
+ export declare function planReviewLedgerClaimOf(fold: PlanReviewLedgerFold): PlanClaim | undefined;
115
+ export declare function isPlanReviewClaimFrame(frame: object): boolean;
116
+ export {};