@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
@@ -20,5 +20,9 @@ export type SessionRowPatchRefusal = {
20
20
  } | {
21
21
  readonly kind: 'tag-unsupported';
22
22
  };
23
+ export interface SessionRowUnreadable {
24
+ readonly errorCode?: string;
25
+ }
26
+ export declare function sessionRowUnreadableOf(row: object | null | undefined): SessionRowUnreadable | undefined;
23
27
  export declare function sessionRowTagOf(row: object | null | undefined): string | undefined;
24
28
  export declare function sessionRowPatchRefusalOf(error: {} | null | undefined, sent: Readonly<SessionRowPatchFields> | null | undefined): SessionRowPatchRefusal | null;
@@ -8,6 +8,24 @@ function ownData(v, key) {
8
8
  return undefined;
9
9
  return guardedRead(() => readOwnDataValue(v, key));
10
10
  }
11
+ export function sessionRowUnreadableOf(row) {
12
+ try {
13
+ const marker = ownData(row, 'unreadable');
14
+ if (!isPlainMarker(marker))
15
+ return undefined;
16
+ const code = ownData(marker, 'errorCode');
17
+ return Object.freeze(typeof code === 'string' && code.length > 0 ? { errorCode: code } : {});
18
+ }
19
+ catch {
20
+ return undefined;
21
+ }
22
+ }
23
+ function isPlainMarker(v) {
24
+ if (typeof v !== 'object' || v === null || Array.isArray(v))
25
+ return false;
26
+ const proto = Object.getPrototypeOf(v);
27
+ return proto === null || (typeof proto === 'object' && Object.getPrototypeOf(proto) === null);
28
+ }
11
29
  export function sessionRowTagOf(row) {
12
30
  const v = ownData(row, 'rowTag');
13
31
  return typeof v === 'string' && v.length > 0 ? v : undefined;
@@ -1,4 +1,5 @@
1
1
  import type { HostSettingsLayer, WorkspaceTrustState } from './hostSettingsSource.js';
2
+ export declare function layerAdmissionReading(trust: WorkspaceTrustState | 'unreadable'): WorkspaceTrustState;
2
3
  export declare function layerAdmissionWord(layer: HostSettingsLayer, trust: WorkspaceTrustState | 'unreadable', category: string, member?: string): string;
3
4
  export declare function layerAdmitted(layer: HostSettingsLayer, trust: WorkspaceTrustState | 'unreadable', category: string, member?: string): boolean;
4
5
  export declare function admittedLayers<L extends HostSettingsLayer>(layers: readonly L[], trust: WorkspaceTrustState | 'unreadable', category: string, member?: string): readonly L[];
@@ -1,8 +1,11 @@
1
1
  import { SETTINGS_LAYER_ADMISSION } from './generated/settingsSchemaFns.js';
2
2
  const TRUST_UNREADABLE_READING = 'declined';
3
3
  const ADMITTED = 'admitted';
4
+ export function layerAdmissionReading(trust) {
5
+ return trust === 'unreadable' ? TRUST_UNREADABLE_READING : trust;
6
+ }
4
7
  function layerAdmissionOf(layer, trust, category, member) {
5
- const reading = trust === 'unreadable' ? TRUST_UNREADABLE_READING : trust;
8
+ const reading = layerAdmissionReading(trust);
6
9
  return member === undefined ? SETTINGS_LAYER_ADMISSION(layer, reading, category) : SETTINGS_LAYER_ADMISSION(layer, reading, category, member);
7
10
  }
8
11
  export function layerAdmissionWord(layer, trust, category, member) {
@@ -28,7 +28,7 @@ export const PROTOCOL_MARKERS = {
28
28
  delegationTrailer: 'Verify this result before concluding. If it leaves more to do, continue or delegate again.',
29
29
  delegationTrailerFork: 'Verify this result before concluding. If it leaves more to do, continue the work yourself or fork again.',
30
30
  delegationFieldLine: /^(status|error|error_kind|observer|stats|worktree):(?: ([^\r\u2028\u2029\u0085]*))?/,
31
- taskOutputLabel: /^TaskOutput\s+(\S+)$/,
31
+ taskOutputLabel: /^(?:TaskOutput|task)\s+(\S+)$/,
32
32
  taskOutputStatus: /^status:\s*(.+)$/m,
33
33
  taskOutputHeadSlots: /^(\r?\n)(?:(state: ([^\r\n\u2028\u2029\u0085]*)(?:\r?\n|$)))?(?:(error: ([^\r\n\u2028\u2029\u0085]*)(?:\r?\n|$)))?/,
34
34
  taskOutputResultNote: /^--- result \(([^)\n]*)\) ---/,
@@ -4,6 +4,7 @@ import { ACTIVE_RUN_BUSY_ERROR_CODE, FLEET_LEASE_UNAVAILABLE, REQUEST_AUTONOMY_L
4
4
  import { capForDisplay } from './fleetTaskDesc.js';
5
5
  import { effectiveWireErrorCode } from './wireErrorTriage.js';
6
6
  import { CORE_TOOL_DECLARATION_CODES } from './generated/engineFactTables.js';
7
+ import { SETTINGS_ECHO_CALLER_TEXT } from './generated/settingsSchemaFns.js';
7
8
  import { PERMISSION_RULE_ISSUE_CODES, permissionRuleIssueDetail } from './permissionRuleIssue.js';
8
9
  import { ruleRefusalListText } from './ruleRefusalSentence.js';
9
10
  import { msg, renderMessage } from './i18n/translate.js';
@@ -579,11 +580,6 @@ export function bodyShapeRefusalFromError(err) {
579
580
  }
580
581
  }
581
582
  const SETTINGS_PERMISSIONS_PREFIX = 'permissions.';
582
- const ECHO_MAX_CHARS = 64;
583
- function echoedKeyName(key) {
584
- const clean = key.replace(/[\u0000-\u001f\u007f\u061c\u200e\u200f\u202a-\u202e\u2066-\u2069]/g, '');
585
- return clean.length > ECHO_MAX_CHARS ? `${clean.slice(0, ECHO_MAX_CHARS)}…` : clean;
586
- }
587
583
  function hasCustomJson(v) {
588
584
  return typeof v === 'object' && v !== null && typeof v.toJSON === 'function';
589
585
  }
@@ -615,7 +611,7 @@ function echoMatch(bag, prefix, echo) {
615
611
  }
616
612
  let state = 'absent';
617
613
  for (const name of names) {
618
- if (prefix + echoedKeyName(name) !== echo)
614
+ if (prefix + SETTINGS_ECHO_CALLER_TEXT(name) !== echo)
619
615
  continue;
620
616
  const s = sentValue(bag, name).state;
621
617
  if (s === 'sent')