@sema-agent/client-core 0.105.0 → 0.106.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 (132) hide show
  1. package/CHANGELOG.md +220 -0
  2. package/README.md +26 -11
  3. package/dist/adapt/arms.js +10 -1
  4. package/dist/adapter/activeRunSelfHeal.d.ts +13 -2
  5. package/dist/adapter/activeRunSelfHeal.js +80 -7
  6. package/dist/adapter/downstream/eventToSdkMessage.d.ts +0 -5
  7. package/dist/adapter/downstream/eventToSdkMessage.js +20 -19
  8. package/dist/adapter/downstream/terminalToSdkResult.js +2 -3
  9. package/dist/adapter/downstream/wiringManifestView.d.ts +1 -3
  10. package/dist/adapter/downstream/wiringManifestView.js +0 -1
  11. package/dist/adapter/runStream.js +3 -4
  12. package/dist/approvalReachWire.d.ts +1 -0
  13. package/dist/approvalReachWire.js +4 -1
  14. package/dist/approvalSeat.d.ts +21 -0
  15. package/dist/approvalSeat.js +73 -0
  16. package/dist/assistantInbox.d.ts +2 -0
  17. package/dist/assistantInbox.js +3 -0
  18. package/dist/checkpointRowVerdict.d.ts +23 -0
  19. package/dist/checkpointRowVerdict.js +89 -0
  20. package/dist/coreValuePorts.d.ts +12 -1
  21. package/dist/coreValuePorts.js +10 -0
  22. package/dist/decideFailureNote.js +3 -1
  23. package/dist/decideReceipt.d.ts +9 -0
  24. package/dist/decideReceipt.js +29 -1
  25. package/dist/declared/supportFloorDeclared.js +2 -2
  26. package/dist/deviceRebind.d.ts +7 -0
  27. package/dist/deviceRebind.js +39 -5
  28. package/dist/engineAddress.d.ts +3 -0
  29. package/dist/engineAddress.js +25 -0
  30. package/dist/engineDirectory.js +9 -17
  31. package/dist/engineErrorCodes.d.ts +8 -0
  32. package/dist/engineErrorCodes.js +8 -0
  33. package/dist/engineNoticeCodes.d.ts +26 -3
  34. package/dist/engineNoticeCodes.js +52 -7
  35. package/dist/engineRowRef.js +1 -1
  36. package/dist/errorSupplementRoles.js +2 -0
  37. package/dist/eventLeg.d.ts +2 -2
  38. package/dist/eventLeg.js +2 -1
  39. package/dist/fleet/fleetProjection.js +26 -5
  40. package/dist/generated/engineFactTables.d.ts +2 -1
  41. package/dist/generated/engineFactTables.js +3 -1
  42. package/dist/generated/engineNoticeTables.js +19 -4
  43. package/dist/generated/sdkFactTables.d.ts +3 -0
  44. package/dist/generated/sdkFactTables.js +15 -0
  45. package/dist/generated/settingsSchemaFns.d.ts +11 -0
  46. package/dist/generated/settingsSchemaFns.js +2 -1
  47. package/dist/generated/settingsSchemaSafetyMergeSpec.js +1 -1
  48. package/dist/generated/settingsSchemaSettingsSources.d.ts +1 -1
  49. package/dist/generated/settingsSchemaSettingsSources.js +22 -2
  50. package/dist/hitl/approvalLiveFace.d.ts +17 -0
  51. package/dist/hitl/approvalLiveFace.js +35 -0
  52. package/dist/hitl/approvalQueueRow.d.ts +21 -0
  53. package/dist/hitl/approvalQueueRow.js +69 -0
  54. package/dist/hitl/approvalsFeed.d.ts +5 -4
  55. package/dist/hitl/approvalsFeed.js +38 -6
  56. package/dist/hitl/askParkRowRouting.d.ts +4 -3
  57. package/dist/hitl/askParkRowRouting.js +15 -3
  58. package/dist/hitl/automaticAnswerVerdict.js +13 -10
  59. package/dist/hitl/crashConverged.d.ts +5 -1
  60. package/dist/hitl/decisionConflict.js +2 -1
  61. package/dist/hitl/decisionRefusal.js +1 -1
  62. package/dist/hitl/decisionSend.d.ts +1 -0
  63. package/dist/hitl/decisionSend.js +14 -2
  64. package/dist/hitl/frameRouter.js +4 -5
  65. package/dist/hitl/hitlBridge.d.ts +1 -1
  66. package/dist/hitl/hitlBridge.js +26 -5
  67. package/dist/hitl/livePendingAsk.d.ts +5 -0
  68. package/dist/hitl/livePendingAsk.js +6 -1
  69. package/dist/hitl/planReviewCard.d.ts +2 -0
  70. package/dist/hitl/planReviewCard.js +21 -0
  71. package/dist/hitl/planReviewWire.d.ts +2 -2
  72. package/dist/hitl/planReviewWire.js +101 -36
  73. package/dist/hitl/sessionAllowRoute.d.ts +2 -0
  74. package/dist/hitl/sessionAllowRoute.js +7 -0
  75. package/dist/hitl/sessionPolicyWire.d.ts +1 -7
  76. package/dist/hitl/sessionPolicyWire.js +3 -43
  77. package/dist/hitl/subagentSource.d.ts +1 -0
  78. package/dist/hitl/subagentSource.js +13 -0
  79. package/dist/hitl/toolApprovalWire.d.ts +3 -2
  80. package/dist/hitl/toolApprovalWire.js +79 -37
  81. package/dist/hostSettingsSource.d.ts +4 -1
  82. package/dist/hostSettingsSource.js +11 -6
  83. package/dist/hostTurnSettings.d.ts +4 -5
  84. package/dist/hostTurnSettings.js +80 -19
  85. package/dist/i18n/messages.en.d.ts +35 -12
  86. package/dist/i18n/messages.en.js +36 -13
  87. package/dist/i18n/messages.zh.js +38 -13
  88. package/dist/index.d.ts +21 -2
  89. package/dist/index.js +11 -2
  90. package/dist/liveInitToolFace.js +0 -1
  91. package/dist/liveModelCatalog.d.ts +15 -0
  92. package/dist/liveModelCatalog.js +40 -0
  93. package/dist/mcpWireCaps.js +1 -1
  94. package/dist/modelCapabilityProbe.js +66 -33
  95. package/dist/ownKey.d.ts +0 -1
  96. package/dist/ownKey.js +0 -2
  97. package/dist/permissionsDeclaration.d.ts +2 -2
  98. package/dist/permissionsDeclaration.js +12 -14
  99. package/dist/projectSeed.d.ts +39 -0
  100. package/dist/projectSeed.js +80 -0
  101. package/dist/promptDelivery.js +1 -1
  102. package/dist/replayBody.d.ts +7 -6
  103. package/dist/replayBody.js +62 -7
  104. package/dist/request/taskRequest.js +3 -4
  105. package/dist/ruleCompileVerdict.d.ts +0 -2
  106. package/dist/ruleCompileVerdict.js +0 -31
  107. package/dist/ruleRefusalSentence.js +0 -3
  108. package/dist/runReattachPolicy.d.ts +3 -0
  109. package/dist/runReattachPolicy.js +15 -2
  110. package/dist/runTerminal.js +30 -8
  111. package/dist/sandboxWire.d.ts +0 -3
  112. package/dist/sandboxWire.js +0 -9
  113. package/dist/seam.d.ts +14 -7
  114. package/dist/seam.js +12 -0
  115. package/dist/seatContract.d.ts +57 -7
  116. package/dist/seatContract.js +132 -3
  117. package/dist/serverSupportRange.d.ts +18 -0
  118. package/dist/serverSupportRange.js +25 -0
  119. package/dist/sessionEngine.d.ts +156 -0
  120. package/dist/sessionEngine.js +464 -0
  121. package/dist/sessionMap.d.ts +11 -1
  122. package/dist/sessionMap.js +35 -9
  123. package/dist/sessionMemorySync.d.ts +31 -0
  124. package/dist/sessionMemorySync.js +95 -0
  125. package/dist/sessionRowTag.d.ts +4 -0
  126. package/dist/sessionRowTag.js +18 -0
  127. package/dist/settingsLayerAdmission.d.ts +1 -0
  128. package/dist/settingsLayerAdmission.js +4 -1
  129. package/dist/toolResult.js +1 -1
  130. package/dist/wireRefusalCopy.js +2 -6
  131. package/docs/INTEGRATION-CLIENTS.md +1022 -16
  132. package/package.json +5 -5
@@ -450,7 +450,7 @@ const resolvedSnapshotForWire = (resolved) => {
450
450
  export function hostTurnSettings(input) {
451
451
  return buildHostTurnSettings(input, { materialize: (snapshot) => resolvedSnapshotForWire(snapshot), memoryOffDeclared });
452
452
  }
453
- const fileRestoreRequested = (restoreFiles, rewindFilesTo, rewindFiles) => restoreFiles === true || (typeof rewindFilesTo === 'string' && rewindFilesTo.length > 0) || rewindFiles === true;
453
+ const fileRestoreRequested = (restoreFiles, rewindFilesTo) => restoreFiles === true || (typeof rewindFilesTo === 'string' && rewindFilesTo.length > 0);
454
454
  function tightenedRequestOf(request, intake, lane) {
455
455
  const readData = (key) => {
456
456
  try {
@@ -489,10 +489,9 @@ function tightenedRequestOf(request, intake, lane) {
489
489
  if (sent.value !== FILE_HISTORY_DISABLED) {
490
490
  const restoreFiles = readData('restoreFiles');
491
491
  const rewindFilesTo = readData('rewindFilesTo');
492
- const rewindFiles = readData('rewindFiles');
493
- if (!restoreFiles.ok || !rewindFilesTo.ok || !rewindFiles.ok)
492
+ if (!restoreFiles.ok || !rewindFilesTo.ok)
494
493
  return unjudged;
495
- if (fileRestoreRequested(restoreFiles.value, rewindFilesTo.value, rewindFiles.value))
494
+ if (fileRestoreRequested(restoreFiles.value, rewindFilesTo.value))
496
495
  return { kind: 'refuse', notice: hostFileHistoryRestoreNotice() };
497
496
  add.fileHistory = FILE_HISTORY_DISABLED;
498
497
  appendOwnElement(tightened, 'fileHistory');
@@ -25,5 +25,3 @@ export type DenyEntryReading = {
25
25
  readonly kind: 'unknown';
26
26
  };
27
27
  export declare function denyEntryReading(rule: string): DenyEntryReading;
28
- export declare const DOMAIN_TIGHTEN_HONORED_FROM = "7.135.0";
29
- export declare function tightenEntryNeverMatches(rule: string, serverVersion: string | undefined): boolean;
@@ -1,6 +1,5 @@
1
1
  import { readRuleEntry, validatePermissionRules } from './coreValuePorts.js';
2
2
  import { guardedRead, readOwnDataValue } from './ownKey.js';
3
- import { engineVersionTier } from './supportFloor.js';
4
3
  const RULE_COMPILE_ROOT = '/';
5
4
  function issueText(issue, key) {
6
5
  try {
@@ -73,33 +72,3 @@ export function denyEntryReading(rule) {
73
72
  return { kind: 'unknown' };
74
73
  }
75
74
  }
76
- function readsAsDomainSpelling(rule) {
77
- try {
78
- const reading = readRuleEntry(rule, 'allow');
79
- if (typeof reading !== 'object' || reading === null)
80
- return false;
81
- if (readOwnDataValue(reading, 'kind') !== 'row')
82
- return false;
83
- const compiled = readOwnDataValue(reading, 'compiled');
84
- if (typeof compiled !== 'object' || compiled === null)
85
- return false;
86
- return readOwnDataValue(compiled, 'kind') === 'domain';
87
- }
88
- catch {
89
- return false;
90
- }
91
- }
92
- export const DOMAIN_TIGHTEN_HONORED_FROM = '7.135.0';
93
- function targetLeavesDomainTightenInert(serverVersion) {
94
- return engineVersionTier(serverVersion) === 'engine' && engineVersionTier(serverVersion, DOMAIN_TIGHTEN_HONORED_FROM) === 'legacy';
95
- }
96
- export function tightenEntryNeverMatches(rule, serverVersion) {
97
- if (!targetLeavesDomainTightenInert(serverVersion))
98
- return false;
99
- const r = denyEntryReading(rule);
100
- if (r.kind !== 'inert' || r.reason !== 'content_unsupported')
101
- return false;
102
- if (!readsAsDomainSpelling(rule))
103
- return false;
104
- return ruleCompileVerdict(rule, 'deny').kind === 'compiles';
105
- }
@@ -10,7 +10,6 @@ const CLASS_OF_REASON = Object.freeze({
10
10
  home_relative_path: 'homePath',
11
11
  compile_refused: 'compile',
12
12
  paren_in_tool_name: 'compile',
13
- content_form_never_matches: 'neverMatches',
14
13
  });
15
14
  function reasonOf(row, lang) {
16
15
  const cls = typeof row.reason === 'string' && Object.hasOwn(CLASS_OF_REASON, row.reason) ? CLASS_OF_REASON[row.reason] : undefined;
@@ -18,8 +17,6 @@ function reasonOf(row, lang) {
18
17
  return renderMessage(msg('rules.refusal.reason.toolName'), lang);
19
18
  if (cls === 'homePath')
20
19
  return renderMessage(msg('rules.refusal.reason.homePath'), lang);
21
- if (cls === 'neverMatches')
22
- return renderMessage(msg('rules.refusal.reason.neverMatches'), lang);
23
20
  if (cls === 'compile')
24
21
  return permissionRuleIssueDetail(row.code, row.message, row.rule, lang);
25
22
  return undefined;
@@ -1,5 +1,6 @@
1
1
  import { type RunNotFollowed } from './runFollow.js';
2
2
  export declare const REATTACH_MAX_TRIES = 5;
3
+ export declare const STREAM_CAP_CREDIBLE_AFTER_MS = 300000;
3
4
  export interface ReattachBudget {
4
5
  readonly tries: number;
5
6
  readonly drainingStreak: number;
@@ -14,6 +15,7 @@ export type ReattachEvent = {
14
15
  } | {
15
16
  readonly cause: 'stream_cap';
16
17
  readonly runId?: string;
18
+ readonly legElapsedMs?: number;
17
19
  } | {
18
20
  readonly cause: 'stream_draining';
19
21
  readonly runId?: string;
@@ -30,6 +32,7 @@ export type ReattachDrainingEvent = Extract<ReattachEvent, {
30
32
  export type ReattachDecision = {
31
33
  readonly action: 'reattach';
32
34
  readonly afterMs: number;
35
+ readonly premature?: true;
33
36
  readonly budget: ReattachBudget;
34
37
  } | {
35
38
  readonly action: 'give_up';
@@ -2,12 +2,14 @@ import { STREAM_DRAINING_RECONNECT_MAX, drainingRetryDelayMs, isPreStreamDrainin
2
2
  import { drainingLegStep } from './streamDrainingLegs.js';
3
3
  import { mintRunNotFollowed } from './runFollow.js';
4
4
  export const REATTACH_MAX_TRIES = 5;
5
+ export const STREAM_CAP_CREDIBLE_AFTER_MS = 300_000;
6
+ const connectionLostBackoffMs = (n) => 1000 * n;
5
7
  const DRAINING_TOTAL_MAX = REATTACH_MAX_TRIES * STREAM_DRAINING_RECONNECT_MAX;
6
8
  export const REATTACH_BUDGET_FRESH = Object.freeze({ tries: 0, drainingStreak: 0, drainingTotal: 0 });
7
9
  export const REATTACH_BUDGET_NONE = Object.freeze({ tries: REATTACH_MAX_TRIES, drainingStreak: 0, drainingTotal: DRAINING_TOTAL_MAX });
8
10
  const isCount = (v) => typeof v === 'number' && Number.isSafeInteger(v) && v >= 0;
9
11
  const giveUp = (notFollowed, budget) => Object.freeze({ action: 'give_up', budget, notFollowed });
10
- const reattach = (afterMs, tries, drainingStreak, drainingTotal) => Object.freeze({ action: 'reattach', afterMs, budget: Object.freeze({ tries, drainingStreak, drainingTotal }) });
12
+ const reattach = (afterMs, tries, drainingStreak, drainingTotal, premature) => Object.freeze({ action: 'reattach', afterMs, ...(premature === true ? { premature } : {}), budget: Object.freeze({ tries, drainingStreak, drainingTotal }) });
11
13
  export function runReattachPolicy(budget, event) {
12
14
  let handle;
13
15
  try {
@@ -44,6 +46,15 @@ export function runReattachPolicy(budget, event) {
44
46
  draining = { step: st };
45
47
  }
46
48
  }
49
+ let premature = false;
50
+ if (cause === 'stream_cap') {
51
+ const legElapsedMs = event.legElapsedMs;
52
+ if (legElapsedMs !== undefined) {
53
+ if (typeof legElapsedMs !== 'number' || !Number.isFinite(legElapsedMs) || legElapsedMs < 0)
54
+ return bad();
55
+ premature = legElapsedMs < STREAM_CAP_CREDIBLE_AFTER_MS;
56
+ }
57
+ }
47
58
  if (runId === undefined)
48
59
  return giveUp(mintRunNotFollowed('no_run_id'), keep);
49
60
  if (handle === undefined)
@@ -55,12 +66,14 @@ export function runReattachPolicy(budget, event) {
55
66
  return exhausted(cause);
56
67
  const error = event.error;
57
68
  const next = tries + 1;
58
- const afterMs = isPreStreamDrainingReject(error) ? drainingRetryDelayMs(error, next - 1) : 1000 * next;
69
+ const afterMs = isPreStreamDrainingReject(error) ? drainingRetryDelayMs(error, next - 1) : connectionLostBackoffMs(next);
59
70
  return reattach(afterMs, next, 0, drainingTotal);
60
71
  }
61
72
  if (cause === 'stream_cap') {
62
73
  if (tries >= REATTACH_MAX_TRIES)
63
74
  return exhausted(cause);
75
+ if (premature)
76
+ return reattach(connectionLostBackoffMs(tries + 1), tries + 1, 0, drainingTotal, true);
64
77
  return reattach(0, tries + 1, 0, drainingTotal);
65
78
  }
66
79
  if (draining === undefined || 'ladder' in draining) {
@@ -1,7 +1,7 @@
1
1
  import { CORE_PROMPT_BLOCK_CAUSES } from './generated/engineFactTables.js';
2
2
  import { isSdkRunParked } from './terminalStatuses.js';
3
+ import { runRowSentenceOf, terminalLayerOf } from './replayBody.js';
3
4
  import { readOwnDataNonEmptyString, readOwnDataValue } from './ownKey.js';
4
- import { doneResultView } from './replayBody.js';
5
5
  import { washCredentials } from './displayUntrusted.js';
6
6
  export const PROMPT_BLOCK_CAUSES = CORE_PROMPT_BLOCK_CAUSES;
7
7
  const _promptBlockTablePin = true;
@@ -300,18 +300,40 @@ function blockedDetailOf(cause) {
300
300
  }
301
301
  }
302
302
  export function readRunTerminal(result) {
303
- if (typeof result !== 'object' || result === null || Array.isArray(result))
304
- return null;
305
- const view = doneResultView(result);
306
- if (view.replay) {
307
- return readRunTerminalArm(view.engine) ?? readRunTerminalArm({ status: view.row?.status, errorCode: view.row?.errorCode, errorMessage: view.row?.error });
303
+ const layer = terminalLayerOf(result);
304
+ const read = readRunTerminalArm(layer);
305
+ if (read === null || read.kind !== 'failed' || read.plane !== 'flat' || read.message !== undefined || layer !== result)
306
+ return read;
307
+ const sentence = runRowSentenceOf(result);
308
+ return sentence === undefined ? read : { ...read, message: sentence };
309
+ }
310
+ function topLevelSnapshotOf(o) {
311
+ const snap = Object.create(null);
312
+ for (const k of ['terminal', 'status', 'errorCode', 'errorMessage', 'blockedReason', 'checkpointGate', 'checkpointId', 'workspaceRestoreMode']) {
313
+ let present;
314
+ try {
315
+ present = k in o;
316
+ }
317
+ catch {
318
+ return undefined;
319
+ }
320
+ if (!present)
321
+ continue;
322
+ try {
323
+ snap[k] = o[k];
324
+ }
325
+ catch {
326
+ snap[k] = undefined;
327
+ }
308
328
  }
309
- return readRunTerminalArm(result);
329
+ return snap;
310
330
  }
311
331
  function readRunTerminalArm(result) {
312
332
  if (typeof result !== 'object' || result === null || Array.isArray(result))
313
333
  return null;
314
- const r = result;
334
+ const r = topLevelSnapshotOf(result);
335
+ if (r === undefined)
336
+ return null;
315
337
  if ('terminal' in r) {
316
338
  const t = r.terminal;
317
339
  const c = typeof t === 'object' && t !== null && !Array.isArray(t) ? t : undefined;
@@ -20,9 +20,6 @@ export declare function sandboxRequestFields(sel: SandboxSelection | undefined):
20
20
  };
21
21
  export declare const AUTO_SANDBOX_ADVISORY: string;
22
22
  export declare function wrapObjectiveWithAutoSandboxAdvisory(objective: string): string;
23
- export declare const SANDBOX_K8S_ONLY_400_ANCHOR = "only supported on the k8s sandbox backend";
24
- export declare const SANDBOX_NO_IMAGE_INDEX_400_ANCHOR = "requires the image index";
25
- export declare const SANDBOX_NO_PUBLISHED_IMAGE_404_ANCHOR = "no published sandbox image for profile";
26
23
  export declare const SANDBOX_CASCADE_CONFLICT_400_ANCHOR = "not supported together with cascade/verify";
27
24
  export type SandboxHintHost = 'terminal' | 'web' | 'desktop';
28
25
  export declare const SANDBOX_HINT_HOSTS: readonly SandboxHintHost[];
@@ -41,9 +41,6 @@ export const AUTO_SANDBOX_ADVISORY = '<sandbox-auto-select>\n' +
41
41
  export function wrapObjectiveWithAutoSandboxAdvisory(objective) {
42
42
  return `${AUTO_SANDBOX_ADVISORY}\n\n${objective}`;
43
43
  }
44
- export const SANDBOX_K8S_ONLY_400_ANCHOR = 'only supported on the k8s sandbox backend';
45
- export const SANDBOX_NO_IMAGE_INDEX_400_ANCHOR = 'requires the image index';
46
- export const SANDBOX_NO_PUBLISHED_IMAGE_404_ANCHOR = 'no published sandbox image for profile';
47
44
  export const SANDBOX_CASCADE_CONFLICT_400_ANCHOR = 'not supported together with cascade/verify';
48
45
  export const SANDBOX_HINT_HOSTS = Object.freeze(['terminal', 'web', 'desktop']);
49
46
  const SANDBOX_HINT_ARMS = Object.freeze({
@@ -146,12 +143,6 @@ export function sandboxDegradeHint(err, host, sentRequest) {
146
143
  const msg = err.message;
147
144
  if (typeof msg !== 'string')
148
145
  return undefined;
149
- if (noCode && status === 400 && msg.includes(SANDBOX_K8S_ONLY_400_ANCHOR))
150
- return sandboxHintOf(SANDBOX_HINT_ARMS.k8sLaneOnly, host);
151
- if (noCode && status === 400 && msg.includes(SANDBOX_NO_IMAGE_INDEX_400_ANCHOR))
152
- return sandboxHintOf(SANDBOX_HINT_ARMS.imageIndexRequired, host);
153
- if (noCode && status === 404 && msg.includes(SANDBOX_NO_PUBLISHED_IMAGE_404_ANCHOR))
154
- return sandboxHintOf(SANDBOX_HINT_ARMS.noPublishedImage404, host);
155
146
  if (status === 400 && msg.includes(SANDBOX_CASCADE_CONFLICT_400_ANCHOR))
156
147
  return sandboxHintOf(SANDBOX_HINT_ARMS.cascadeConflict400, host);
157
148
  return undefined;
package/dist/seam.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import type { ModelUsage, SDKMessage } from '@sema-agent/agent-types';
2
2
  import type { EngineTurnUsage } from './adapter/downstream/turnUsageToModelUsage.js';
3
3
  import type { RunCostReconcile } from './adapter/downstream/terminalToSdkResult.js';
4
- import type { WiringManifestAutoMode, WiringManifestModelGate, WiringManifestMcpEntryView, WiringManifestHookEntryView, WiringManifestLspSeamView, WiringManifestWriteProtectionView, WiringManifestAutoConsolidationView, WiringManifestReadDenyView, WiringManifestModView, ContextUsageSectionView, PromptManifestSectionView, PromptManifestBlockView, PromptManifestToolView, PromptManifestIdentityView } from './adapter/downstream/eventToSdkMessage.js';
4
+ import type { WiringManifestAutoMode, WiringManifestModelGate, WiringManifestMcpEntryView, WiringManifestLspSeamView, WiringManifestWriteProtectionView, WiringManifestAutoConsolidationView, WiringManifestReadDenyView, WiringManifestModView, ContextUsageSectionView, PromptManifestSectionView, PromptManifestBlockView, PromptManifestToolView, PromptManifestIdentityView } from './adapter/downstream/eventToSdkMessage.js';
5
5
  import type { ToolRosterView, ToolRosterDeltaView, WiringManifestHandsView } from './toolRoster.js';
6
6
  import type { WiringManifestFleetView } from './adapter/downstream/wiringManifestView.js';
7
7
  import type { SuspendedReopenReading } from './hitl/suspendedReopen.js';
@@ -165,7 +165,7 @@ export type ChromeEvent = {
165
165
  } | ({
166
166
  kind: 'run_cost_reconciled';
167
167
  laneProof: LaneProof;
168
- } & RunCostReconcile) | HumanInputChromeEvent | MessageCommittedChromeEvent | EngineNoticeChromeEvent | TextSegmentEndChromeEvent | ThinkingSegmentEndChromeEvent | ToolDisclosureChromeEvent | ToolProgressChromeEvent | ToolRosterDeltaChromeEvent | ContextUsageChromeEvent | CompactionOutcomeChromeEvent | CompactionStartedChromeEvent | SubagentStartedChromeEvent | PromptAssembledChromeEvent | MemorySavedChromeEvent | WiringManifestChromeEvent | ResultTextDivergedChromeEvent | ResultReplayedChromeEvent | ToolParkedChromeEvent | ApprovalRequestChromeEvent | ApprovalRevokeChromeEvent | {
168
+ } & RunCostReconcile) | HumanInputChromeEvent | MessageCommittedChromeEvent | EngineNoticeChromeEvent | TextSegmentEndChromeEvent | ThinkingSegmentEndChromeEvent | ToolDisclosureChromeEvent | ToolProgressChromeEvent | ToolRosterDeltaChromeEvent | ContextUsageChromeEvent | CompactionOutcomeChromeEvent | CompactionStartedChromeEvent | SubagentStartedChromeEvent | PromptAssembledChromeEvent | MemorySavedChromeEvent | WiringManifestChromeEvent | ResultTextDivergedChromeEvent | ResultReplayedChromeEvent | ToolParkedChromeEvent | ApprovalRequestChromeEvent | ApprovalRevokeChromeEvent | ApprovalCompleteChromeEvent | SessionTitledChromeEvent | {
169
169
  kind: 'suspended_reopened';
170
170
  laneProof: LaneProof;
171
171
  reopen: Extract<SuspendedReopenReading, {
@@ -182,7 +182,6 @@ export interface WiringManifestChromeEvent {
182
182
  autoMode?: WiringManifestAutoMode;
183
183
  mcp?: readonly WiringManifestMcpEntryView[];
184
184
  tools?: ToolRosterView;
185
- hooks?: readonly WiringManifestHookEntryView[];
186
185
  lsp?: WiringManifestLspSeamView;
187
186
  writeProtection?: WiringManifestWriteProtectionView;
188
187
  autoConsolidation?: WiringManifestAutoConsolidationView;
@@ -311,17 +310,25 @@ export interface ThinkingSegmentEndChromeEvent {
311
310
  committedUuids?: readonly string[];
312
311
  eventId?: string;
313
312
  }
314
- export interface ApprovalRequestChromeEvent {
313
+ export interface ApprovalRequestChromeEvent extends ApprovalFrameChromeEnvelope {
315
314
  kind: 'approval_request';
315
+ }
316
+ export interface ApprovalFrameChromeEnvelope {
316
317
  laneProof: LaneProof;
317
318
  frame: unknown;
318
319
  schemaVersion: number;
319
320
  }
320
- export interface ApprovalRevokeChromeEvent {
321
+ export interface ApprovalCompleteChromeEvent extends ApprovalFrameChromeEnvelope {
322
+ kind: 'approval_complete';
323
+ }
324
+ export interface ApprovalRevokeChromeEvent extends ApprovalFrameChromeEnvelope {
321
325
  kind: 'approval_revoke';
326
+ }
327
+ export interface SessionTitledChromeEvent {
328
+ kind: 'session_titled';
322
329
  laneProof: LaneProof;
323
- frame: unknown;
324
- schemaVersion: number;
330
+ sessionId: string;
331
+ title: string;
325
332
  }
326
333
  export interface ResultTextDivergedChromeEvent {
327
334
  kind: 'result_text_diverged';
package/dist/seam.js CHANGED
@@ -168,6 +168,18 @@ const CHROME_ARM_TABLE = {
168
168
  '🔴 三纪律:①按 taskId 归属过滤(孤儿撤帧行非我即忽略)②账本重放的撤帧只用于时间线渲染,卡集基准恒为开流 preamble' +
169
169
  '(撤帧可能整帧丢失)③已 DECIDED 的兄弟不在 askIds 里;真撤到本地卡时给一行归因(reason 消毒后呈现),零命中不要多说那一行',
170
170
  },
171
+ approval_complete: {
172
+ required: true,
173
+ duty: '用 sdk isApprovalCompleteFrameV1 窄化 frame 取 askId/outcome/cause/parked;窄不下来按 askId(若有)清卡、别猜结局;按开卡帧的 askId 清本地卡' +
174
+ '(与撤卡帧不冲突,两帧都可能到;清卡是这张卡的一条出口,呈卡臂登记的持有句柄照放);🔴 永不据本帧推断 run 的归宿(读 run 行 / 停驻面),' +
175
+ 'expired 不是拒绝,带 parked 的是转进耐久队列、还在等人;账本重放的消卡帧只用于时间线渲染,卡集对账基准恒为开流 preamble(帧可能整帧丢失)',
176
+ },
177
+ session_titled: {
178
+ required: false,
179
+ duty: '可选:按 sessionId(服务端会话 id)把那一条会话行的标题刷新成 title(与行上同值,写进宿主自己那一份会话行);' +
180
+ '🔴 会话行 title 是唯一真源:本臂只活不存、可能不到(冷启动 / 多窗口 / 断线重连读行),没收到 ≠ 还没有标题;' +
181
+ 'title 是模型产文,只渲染、永不回喂模型;座位上由宿主刷新会话行后经 session_updated 推给渲染端',
182
+ },
171
183
  text_segment_end: {
172
184
  required: true,
173
185
  duty: '🔴 引擎明报的 assistant 散文段边界 + **该段权威全文**(server ≥7.75.3 起 content 经脱敏器、' +
@@ -14,7 +14,8 @@ import type { DeviceEnrollTokenOutcome, DeviceListOutcome, DeviceRebindOutcome,
14
14
  import type { McpPanelView } from "./mcpPanel.js";
15
15
  import type { McpToolToggleKey } from "./mcpToolToggles.js";
16
16
  import { type ThinkingLatchEvent, type ThinkingLatchRowWord } from "./thinkingLatchWords.js";
17
- import type { SessionRowPatchFields } from "./sessionRowTag.js";
17
+ import type { SessionRowPatchFields, SessionRowUnreadable } from "./sessionRowTag.js";
18
+ import { type SessionEngineView } from "./sessionEngine.js";
18
19
  export interface SeatValidationFailure {
19
20
  reason: string;
20
21
  field?: string;
@@ -50,7 +51,10 @@ export interface LocalSessionRecord {
50
51
  parked?: boolean;
51
52
  pinned?: boolean;
52
53
  rowTag?: string;
54
+ unreadable?: SessionRowUnreadable;
53
55
  thinkingLatch?: ThinkingLatchRowWord;
56
+ engine?: SessionEngineView;
57
+ executionLane?: string;
54
58
  }
55
59
  export declare const TOOL_PERMISSION_REQUEST_ID_DOMAINS: readonly ["live:", "durable:", "question:", "elicit:", "plan:"];
56
60
  export type ToolPermissionRequestIdDomain = (typeof TOOL_PERMISSION_REQUEST_ID_DOMAINS)[number];
@@ -105,6 +109,7 @@ declare const CHROME_ARM_SEAT_ROUTE: {
105
109
  readonly plan_review_park: "host";
106
110
  readonly approval_request: "host";
107
111
  readonly approval_revoke: "host";
112
+ readonly approval_complete: "host";
108
113
  readonly task_ledger_sync: "host";
109
114
  readonly inline_task_stats: "host";
110
115
  readonly stream_delta: "host";
@@ -124,6 +129,7 @@ declare const CHROME_ARM_SEAT_ROUTE: {
124
129
  readonly wiring_manifest: "host";
125
130
  readonly suspended_reopened: "host";
126
131
  readonly result_text_diverged: "host";
132
+ readonly session_titled: "host";
127
133
  };
128
134
  type SeatRoutedKind = {
129
135
  [K in keyof typeof CHROME_ARM_SEAT_ROUTE]: (typeof CHROME_ARM_SEAT_ROUTE)[K] extends "seat" ? K : never;
@@ -194,7 +200,7 @@ export type SeatStreamReading = {
194
200
  };
195
201
  export declare function seatStreamDeltaMessage(event: SeatStreamDeltaSource, ids: SeatStreamDeltaIds): SeatStreamEventMessage | undefined;
196
202
  export declare function readSeatStreamDelta(message: object): SeatStreamReading;
197
- export declare const SEAT_CAPABILITY_NAMES: readonly ["pickFolder", "rewind", "recents", "patchSession", "devices", "engineTarget", "onboard", "mcpToolToggles", "thinkingLatch"];
203
+ export declare const SEAT_CAPABILITY_NAMES: readonly ["pickFolder", "rewind", "recents", "patchSession", "devices", "engineTarget", "onboard", "mcpToolToggles", "thinkingLatch", "computerUseSwitch", "engineModeDefaultOnly"];
198
204
  export type SeatCapabilityName = (typeof SEAT_CAPABILITY_NAMES)[number];
199
205
  export interface SeatCapabilitiesState {
200
206
  pickFolder?: boolean;
@@ -206,6 +212,8 @@ export interface SeatCapabilitiesState {
206
212
  onboard?: boolean;
207
213
  mcpToolToggles?: boolean;
208
214
  thinkingLatch?: boolean;
215
+ computerUseSwitch?: boolean;
216
+ engineModeDefaultOnly?: boolean;
209
217
  }
210
218
  export type SeatCapabilityReading = {
211
219
  readonly kind: "reported";
@@ -589,6 +597,7 @@ export interface OnboardImportableProfile {
589
597
  api: ModelApiWord;
590
598
  hasKey: boolean;
591
599
  models: string[];
600
+ isCurrent?: boolean;
592
601
  }
593
602
  export interface OnboardProvidersResult {
594
603
  providers: OnboardProviderRow[];
@@ -600,6 +609,42 @@ export declare const checkMcpToolToggleKey: (v: unknown) => SeatValidation;
600
609
  export interface McpToolTogglesResult {
601
610
  off: McpToolToggleKey[];
602
611
  }
612
+ export declare const COMPUTER_USE_SOURCES: readonly ["env", "settings", "default"];
613
+ export type ComputerUseSource = (typeof COMPUTER_USE_SOURCES)[number];
614
+ export declare const COMPUTER_USE_REFUSAL_REASONS: readonly ["locked-by-env", "confirmation-required", "invalid-request", "write-failed"];
615
+ export type ComputerUseRefusalReason = (typeof COMPUTER_USE_REFUSAL_REASONS)[number];
616
+ export declare const COMPUTER_USE_APPLIES_ON: readonly ["next-engine-start"];
617
+ export type ComputerUseAppliesOn = (typeof COMPUTER_USE_APPLIES_ON)[number];
618
+ export interface ComputerUseState {
619
+ enabled: boolean;
620
+ source: ComputerUseSource;
621
+ lockedByEnv: boolean;
622
+ appliesOn: ComputerUseAppliesOn;
623
+ }
624
+ export type SetComputerUseRequest = {
625
+ readonly enabled: false;
626
+ } | {
627
+ readonly enabled: true;
628
+ readonly confirmed: true;
629
+ };
630
+ export type SetComputerUseResult = {
631
+ ok: true;
632
+ changed: boolean;
633
+ state: ComputerUseState;
634
+ } | {
635
+ ok: false;
636
+ reason: ComputerUseRefusalReason;
637
+ state: ComputerUseState;
638
+ };
639
+ export declare const checkSetComputerUseRequest: (v: unknown) => SeatValidation;
640
+ export type SetComputerUsePlan = {
641
+ readonly kind: "apply";
642
+ readonly enabled: boolean;
643
+ } | {
644
+ readonly kind: "refused";
645
+ readonly reason: Exclude<ComputerUseRefusalReason, "write-failed">;
646
+ };
647
+ export declare function planSetComputerUse(request: {} | null | undefined, lockedByEnv: boolean): SetComputerUsePlan;
603
648
  export interface LocalSessionsApi {
604
649
  start(opts?: StartSessionOptions): Promise<LocalSessionRecord>;
605
650
  sendMessage(req: SendMessageRequest): Promise<SendMessageAck>;
@@ -638,6 +683,8 @@ export interface LocalSessionsApi {
638
683
  listMcpToolToggles(): Promise<McpToolTogglesResult>;
639
684
  setMcpToolToggle(key: McpToolToggleKey, enabled: boolean): Promise<OkAck>;
640
685
  setThinkingLatch(req: SetThinkingLatchRequest): Promise<OkAck>;
686
+ getComputerUse(): Promise<ComputerUseState>;
687
+ setComputerUse(req: SetComputerUseRequest): Promise<SetComputerUseResult>;
641
688
  onEvent(cb: (ev: LocalSessionEvent) => void): () => void;
642
689
  onToolPermissionRequest(cb: (req: ToolPermissionRequest) => void): () => void;
643
690
  sessionsStateStore: EipcStoreClient<SessionsState>;
@@ -683,12 +730,12 @@ export declare const checkSetThinkingLatchRequest: (v: unknown) => SeatValidatio
683
730
  export declare function isSetThinkingLatchRequest(v: unknown): v is SetThinkingLatchRequest;
684
731
  export declare function isSendMessageAck(v: unknown): v is SendMessageAck;
685
732
  export declare const LOCAL_SESSIONS_SPEC: EipcServiceSpec;
686
- export declare const SEAT_METHOD_NAMES: readonly ["start", "sendMessage", "interrupt", "stop", "respondToToolPermission", "cancelQueuedMessage", "reorderQueuedMessage", "promoteQueuedMessage", "setFocusedSession", "setModel", "getTranscript", "searchSessions", "uploadAttachment", "listModels", "applyModelConfig", "pickFolder", "listRecentFolders", "noteRecentFolder", "patchSession", "listDevices", "readSessionBinding", "rebindSession", "issueEnrollToken", "revokeDevice", "setEngineMode", "startCloudLogin", "cancelCloudLogin", "connectCloudEngine", "configureCloudEngine", "clearCloudEngine", "listOnboardProviders", "probeOnboardEntry", "applyOnboardEntry", "readSessionMcpPanel", "listMcpToolToggles", "setMcpToolToggle", "setThinkingLatch", "onEvent", "onToolPermissionRequest"];
733
+ export declare const SEAT_METHOD_NAMES: readonly ["start", "sendMessage", "interrupt", "stop", "respondToToolPermission", "cancelQueuedMessage", "reorderQueuedMessage", "promoteQueuedMessage", "setFocusedSession", "setModel", "getTranscript", "searchSessions", "uploadAttachment", "listModels", "applyModelConfig", "pickFolder", "listRecentFolders", "noteRecentFolder", "patchSession", "listDevices", "readSessionBinding", "rebindSession", "issueEnrollToken", "revokeDevice", "setEngineMode", "startCloudLogin", "cancelCloudLogin", "connectCloudEngine", "configureCloudEngine", "clearCloudEngine", "listOnboardProviders", "probeOnboardEntry", "applyOnboardEntry", "readSessionMcpPanel", "listMcpToolToggles", "setMcpToolToggle", "setThinkingLatch", "getComputerUse", "setComputerUse", "onEvent", "onToolPermissionRequest"];
687
734
  export declare const SEAT_STORE_PROPS: readonly ["sessionsStateStore", "focusedSessionStateStore", "settingsStateStore", "seatCapabilitiesStateStore", "engineTargetStateStore"];
688
735
  export declare const SEAT_EVENT_METHOD_NAMES: readonly ["onEvent", "onToolPermissionRequest"];
689
736
  export declare const LOCAL_SESSION_EVENT_KEYS: readonly ["type", "sessionId", "message", "error", "errorCategory", "code", "session", "userMessageUuid", "requestId", "outcome", "parked", "chrome", "_sema_turnFailure", "subagentContent"];
690
737
  export declare const TOOL_PERMISSION_REQUEST_KEYS: readonly ["requestId", "sessionId", "toolName", "toolCallId", "input", "message", "toctouBinding", "createdAtMs", "governanceForced", "delegation", "mandated", "mandate", "origin", "ruleOffersAbsence", "askClass", "classes", "sessionRow"];
691
- export declare const LOCAL_SESSION_RECORD_KEYS: readonly ["sessionId", "engineSessionId", "model", "title", "cwd", "isRunning", "createdAt", "lastActivityAt", "queuedMessages", "parked", "pinned", "rowTag", "thinkingLatch"];
738
+ export declare const LOCAL_SESSION_RECORD_KEYS: readonly ["sessionId", "engineSessionId", "model", "title", "cwd", "isRunning", "createdAt", "lastActivityAt", "queuedMessages", "parked", "pinned", "rowTag", "unreadable", "thinkingLatch", "engine", "executionLane"];
692
739
  export declare const SEND_MESSAGE_REQUEST_KEYS: readonly ["sessionId", "text", "model", "userMessageUuid", "permissionMode", "attachmentIds", "reasoningEffort", "retainBackgroundProcesses", "forwardSubagentEvents", "retainSubagentSessions", "settings", "scenario", "rewind"];
693
740
  export declare const SEAT_SEND_MESSAGE_KEY_ORIGINS: {
694
741
  readonly sessionId: {
@@ -738,7 +785,7 @@ export declare const SEAT_VALIDATOR_KEY_COVERAGE: {
738
785
  readonly LocalSessionRecord: {
739
786
  readonly guard: "isLocalSessionRecord";
740
787
  readonly check: (v: unknown) => SeatValidation;
741
- readonly validated: readonly ["sessionId", "engineSessionId", "model", "title", "cwd", "isRunning", "createdAt", "lastActivityAt", "queuedMessages", "parked", "pinned", "rowTag", "thinkingLatch"];
788
+ readonly validated: readonly ["sessionId", "engineSessionId", "model", "title", "cwd", "isRunning", "createdAt", "lastActivityAt", "queuedMessages", "parked", "pinned", "rowTag", "unreadable", "thinkingLatch", "engine", "executionLane"];
742
789
  readonly unchecked: readonly [];
743
790
  };
744
791
  readonly ToolPermissionRequest: {
@@ -804,6 +851,9 @@ export declare const SEAT_VALIDATOR_KEY_COVERAGE: {
804
851
  }, {
805
852
  readonly key: "candidateRejected";
806
853
  readonly why: "诊断面(0.97.0 CC-715;当前配置是候选被整拒后回落的那一份),三态读法归 modelCandidateRejectedOf(含坏形 unreadable);出站门为它拒掉整份目录 = 选单为一行诊断整个消失。";
854
+ }, {
855
+ readonly key: "modelPlane";
856
+ readonly why: "诊断面(0.106.0 CC-1156;这台引擎服务的是哪张模型表 / 最近一份目录候选的结局),三态读法归 modelPlaneOf(含坏形 unreadable、表外词整位不给);出站门为它拒掉整份目录 = 选单为一行诊断整个消失。";
807
857
  }];
808
858
  };
809
859
  readonly SendMessageRequest: {
@@ -877,7 +927,7 @@ export declare const SEAT_VALIDATOR_KEY_COVERAGE: {
877
927
  };
878
928
  readonly SeatCapabilitiesState: {
879
929
  readonly check: (v: unknown) => SeatValidation;
880
- readonly validated: readonly ["pickFolder", "rewind", "recents", "patchSession", "devices", "engineTarget", "onboard", "mcpToolToggles", "thinkingLatch"];
930
+ readonly validated: readonly ["pickFolder", "rewind", "recents", "patchSession", "devices", "engineTarget", "onboard", "mcpToolToggles", "thinkingLatch", "computerUseSwitch", "engineModeDefaultOnly"];
881
931
  readonly unchecked: readonly [];
882
932
  };
883
933
  readonly RecentFoldersResult: {
@@ -917,7 +967,7 @@ export declare const SEAT_VALIDATOR_KEY_COVERAGE: {
917
967
  };
918
968
  };
919
969
  export declare const SEAT_VALIDATOR_COVERAGE_EXEMPT: readonly [...{
920
- label: "DeviceListOutcome" | "DeviceSessionBindingOutcome" | "DeviceRebindOutcome" | "DeviceEnrollTokenOutcome" | "DeviceRevokeOutcome" | "SeatDeviceRebindRequest" | "SeatDeviceRevokeRequest" | "EngineTargetState" | "EngineTargetResult" | "CloudLoginStart" | "CloudLoginCancelAck" | "CloudConnectResult" | "CloudLoginRequest" | "CloudEngineConnectRequest" | "CloudEngineConfigureRequest" | "OnboardProvidersResult" | "OnboardProbeResult" | "OnboardApplyResult" | "OnboardEntryRequest" | "OnboardApplyRequest" | "McpToolTogglesResult" | "McpToolToggleKey";
970
+ label: "DeviceListOutcome" | "DeviceSessionBindingOutcome" | "DeviceRebindOutcome" | "DeviceEnrollTokenOutcome" | "DeviceRevokeOutcome" | "SeatDeviceRebindRequest" | "SeatDeviceRevokeRequest" | "EngineTargetState" | "EngineTargetResult" | "CloudLoginStart" | "CloudLoginCancelAck" | "CloudConnectResult" | "CloudLoginRequest" | "CloudEngineConnectRequest" | "CloudEngineConfigureRequest" | "OnboardProvidersResult" | "OnboardProbeResult" | "OnboardApplyResult" | "OnboardEntryRequest" | "OnboardApplyRequest" | "McpToolTogglesResult" | "McpToolToggleKey" | "ComputerUseState" | "SetComputerUseResult" | "SetComputerUseRequest";
921
971
  check: (v: unknown) => SeatValidation;
922
972
  why: string;
923
973
  }[], {