@sema-agent/client-core 0.92.0 → 0.93.1

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 (125) hide show
  1. package/CHANGELOG.md +227 -0
  2. package/README.md +25 -16
  3. package/dist/adapt/arms.js +2 -0
  4. package/dist/adapt/toolCards.js +6 -4
  5. package/dist/adapt.d.ts +1 -1
  6. package/dist/adapt.js +1 -1
  7. package/dist/adapter/runStream.js +3 -1
  8. package/dist/agentsWireCaps.js +1 -1
  9. package/dist/approvalDecidedByCapability.d.ts +16 -0
  10. package/dist/approvalDecidedByCapability.js +47 -0
  11. package/dist/approvalsStreamLiveCapability.js +3 -3
  12. package/dist/askSurvivesStandingAnswer.d.ts +1 -1
  13. package/dist/centerWiringCapability.js +1 -1
  14. package/dist/cloudConfigWireCaps.js +5 -5
  15. package/dist/compensations.js +2 -2
  16. package/dist/decideReceipt.d.ts +2 -0
  17. package/dist/decideReceipt.js +34 -9
  18. package/dist/detachWire.d.ts +2 -14
  19. package/dist/detachWire.js +1 -47
  20. package/dist/deviceExecutorManagementCapability.d.ts +6 -2
  21. package/dist/deviceExecutorManagementCapability.js +61 -15
  22. package/dist/engineConfigDrift.d.ts +20 -0
  23. package/dist/engineConfigDrift.js +54 -0
  24. package/dist/engineErrorCodes.d.ts +3 -0
  25. package/dist/engineErrorCodes.js +12 -4
  26. package/dist/engineInlineTaskStats.d.ts +1 -0
  27. package/dist/engineNoticeCodes.d.ts +2 -2
  28. package/dist/engineWireFor.d.ts +22 -0
  29. package/dist/engineWireFor.js +154 -9
  30. package/dist/engineWireSdk.d.ts +0 -1
  31. package/dist/engineWireSdk.js +0 -3
  32. package/dist/executionLaneCapability.js +2 -2
  33. package/dist/fileHistoryCaptureCapability.d.ts +1 -1
  34. package/dist/fileHistoryCaptureCapability.js +1 -6
  35. package/dist/fileHistoryLegNotice.d.ts +1 -1
  36. package/dist/fileHistoryLegNotice.js +1 -6
  37. package/dist/gateVocabulary.d.ts +1 -5
  38. package/dist/gateVocabulary.js +4 -22
  39. package/dist/generated/engineFactTables.d.ts +4 -3
  40. package/dist/generated/engineFactTables.js +10 -0
  41. package/dist/generated/engineNoticeTables.d.ts +1 -1
  42. package/dist/generated/engineNoticeTables.js +1 -1
  43. package/dist/goalStopHook.d.ts +1 -8
  44. package/dist/goalStopHook.js +2 -58
  45. package/dist/headlessPermissionModeWire.d.ts +3 -2
  46. package/dist/headlessPermissionModeWire.js +46 -5
  47. package/dist/hitl/approvalResolution.d.ts +3 -2
  48. package/dist/hitl/approvalResolution.js +13 -0
  49. package/dist/hitl/askParkRowRouting.js +2 -2
  50. package/dist/hitl/frameRouter.js +7 -2
  51. package/dist/hitl/gateLedger.d.ts +1 -0
  52. package/dist/hitl/gateLedger.js +3 -0
  53. package/dist/hitl/hitlBridge.d.ts +1 -0
  54. package/dist/hitl/hitlBridge.js +6 -1
  55. package/dist/hitl/hitlHostSurface.d.ts +6 -2
  56. package/dist/hitl/hitlHostSurface.js +29 -3
  57. package/dist/hitl/parkResolver.js +22 -4
  58. package/dist/hitl/persistedRulesWire.js +29 -17
  59. package/dist/hitl/planReviewWire.d.ts +0 -2
  60. package/dist/hitl/planReviewWire.js +1 -18
  61. package/dist/hitl/sessionPolicyDeliverable.js +3 -3
  62. package/dist/hitl/sessionPolicyWire.d.ts +2 -0
  63. package/dist/hitl/sessionPolicyWire.js +7 -4
  64. package/dist/hitl/toolApprovalWire.d.ts +32 -7
  65. package/dist/hitl/toolApprovalWire.js +282 -59
  66. package/dist/hooksWireCaps.d.ts +1 -1
  67. package/dist/hooksWireCaps.js +1 -1
  68. package/dist/index.d.ts +7 -2
  69. package/dist/index.js +6 -2
  70. package/dist/inheritEnvWire.d.ts +1 -4
  71. package/dist/inheritEnvWire.js +0 -18
  72. package/dist/limitsWire.d.ts +0 -6
  73. package/dist/limitsWire.js +0 -38
  74. package/dist/mcpProbeCapability.js +1 -1
  75. package/dist/mcpProbeWire.js +10 -12
  76. package/dist/mcpReconnect.d.ts +5 -0
  77. package/dist/mcpReconnect.js +28 -0
  78. package/dist/memoryComplianceCapability.js +2 -2
  79. package/dist/memoryOriginCapability.js +2 -2
  80. package/dist/memoryVerbsWire.js +14 -13
  81. package/dist/ownKey.d.ts +2 -0
  82. package/dist/ownKey.js +15 -0
  83. package/dist/peerLaneCapability.js +2 -2
  84. package/dist/permissionModesCapability.d.ts +16 -0
  85. package/dist/permissionModesCapability.js +71 -0
  86. package/dist/permissionRuleIssue.js +1 -1
  87. package/dist/permissionRulesWriteCapability.js +2 -2
  88. package/dist/permissionWireCaps.d.ts +2 -0
  89. package/dist/permissionWireCaps.js +8 -1
  90. package/dist/permissionsAllowGrantCapability.js +7 -2
  91. package/dist/postureKnob.js +1 -1
  92. package/dist/protocolSegment.d.ts +2 -0
  93. package/dist/protocolSegment.js +3 -0
  94. package/dist/readFacePosture.js +1 -1
  95. package/dist/resumeRefusalCopy.d.ts +1 -0
  96. package/dist/resumeRefusalCopy.js +26 -3
  97. package/dist/retryStatus.js +2 -1
  98. package/dist/rewindArchiveCapability.js +2 -2
  99. package/dist/runTerminal.d.ts +16 -0
  100. package/dist/runTerminal.js +32 -3
  101. package/dist/seam.d.ts +1 -0
  102. package/dist/sessionPolicyCapability.js +1 -1
  103. package/dist/sessionSyncFileHistoryCapability.js +2 -2
  104. package/dist/skillToolListsCapability.js +1 -1
  105. package/dist/sqlEngineCapability.js +1 -1
  106. package/dist/steerPriorityCapability.js +1 -1
  107. package/dist/storePostureCapability.js +2 -2
  108. package/dist/supportFloor.d.ts +1 -0
  109. package/dist/supportFloor.js +13 -3
  110. package/dist/taskRequestWords.d.ts +4 -2
  111. package/dist/taskRequestWords.js +1 -1
  112. package/dist/toolHistoryBadTurn.js +1 -2
  113. package/dist/toolResult.d.ts +2 -1
  114. package/dist/toolResult.js +33 -3
  115. package/dist/userInvokedSkillsCapability.js +1 -1
  116. package/dist/webSearchBackendCapability.js +2 -2
  117. package/dist/webSearchWireCaps.d.ts +1 -1
  118. package/dist/webSearchWireCaps.js +40 -2
  119. package/dist/wireFailureShape.js +2 -2
  120. package/dist/wireRefusalCopy.d.ts +9 -3
  121. package/dist/wireRefusalCopy.js +41 -4
  122. package/dist/workflowsJournalCapability.js +1 -1
  123. package/dist/writeProtectionCapability.js +1 -1
  124. package/docs/INTEGRATION-CLIENTS.md +999 -15
  125. package/package.json +2 -2
@@ -1,6 +1,6 @@
1
1
  import { readErrorNumber, readErrorRecord, readErrorStrictStringList, readErrorString, readErrorStringList } from './wireFailureShape.js';
2
2
  import { readOwnNonEmptyString } from './ownKey.js';
3
- import { ACTIVE_RUN_BUSY_ERROR_CODE, FLEET_LEASE_UNAVAILABLE, REQUEST_FIELD_CONFLICT, RESUME_POLICY_FOLD_CODE, USAGE_WINDOW_EXHAUSTED } from './engineErrorCodes.js';
3
+ import { ACTIVE_RUN_BUSY_ERROR_CODE, FLEET_LEASE_UNAVAILABLE, REQUEST_FIELD_CONFLICT, RESUME_POLICY_FOLD_CODE, SCENARIO_ASSIGNMENT_UNKNOWN_ERROR_CODE, USAGE_WINDOW_EXHAUSTED } from './engineErrorCodes.js';
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';
@@ -145,7 +145,38 @@ export function fleetLeaseUnavailableContent(detail) {
145
145
  : ' · The engine did not say how long to wait — send it again a little later';
146
146
  return `${head}${cause}${wait}`;
147
147
  }
148
+ export function scenarioAssignmentUnknownFromError(err) {
149
+ try {
150
+ if (err === null || typeof err !== 'object')
151
+ return null;
152
+ if (effectiveWireErrorCode(err) !== SCENARIO_ASSIGNMENT_UNKNOWN_ERROR_CODE)
153
+ return null;
154
+ const detail = readErrorRecord(err, 'detail');
155
+ const bit = (key) => {
156
+ if (detail === undefined)
157
+ return undefined;
158
+ try {
159
+ return Object.hasOwn(detail, key) ? detail[key] : undefined;
160
+ }
161
+ catch {
162
+ return undefined;
163
+ }
164
+ };
165
+ const scenario = bit('scenario');
166
+ const source = bit('source');
167
+ return {
168
+ code: SCENARIO_ASSIGNMENT_UNKNOWN_ERROR_CODE,
169
+ ...(typeof scenario === 'string' && scenario.length > 0 ? { scenario } : {}),
170
+ ...(source === 'ruling' || source === 'deployment' ? { source } : {}),
171
+ };
172
+ }
173
+ catch {
174
+ return null;
175
+ }
176
+ }
148
177
  const SETTLED_BY_NOT_IN_PROOF = 'settled_by_not_in_proof';
178
+ const DECIDED_BY_NOT_IN_PROOF = 'decided_by_not_in_proof';
179
+ const RETIRED_DECISION_KEY = 'settledBy';
149
180
  const RESUME_OUTCOME_INVALID = 'resume_outcome_invalid';
150
181
  const APPROVAL_NON_BINDING_FIELDS = new Set(['hostDecision', 'approver']);
151
182
  function readRefusalField(o) {
@@ -163,7 +194,7 @@ function readRefusalField(o) {
163
194
  }
164
195
  return readStringField(o, 'field');
165
196
  }
166
- export function denyAttributionRefusalFromError(err, sentSettledBy) {
197
+ export function denyAttributionRefusalFromError(err, sentAttributionKey) {
167
198
  try {
168
199
  if (err === null || typeof err !== 'object')
169
200
  return null;
@@ -175,9 +206,12 @@ export function denyAttributionRefusalFromError(err, sentSettledBy) {
175
206
  const code = readStringField(o, 'errorCode');
176
207
  if (code === undefined)
177
208
  return null;
178
- if (status === 400 && code === SETTLED_BY_NOT_IN_PROOF)
209
+ if (status === 400 && (code === SETTLED_BY_NOT_IN_PROOF || code === DECIDED_BY_NOT_IN_PROOF))
179
210
  return { kind: 'not_in_proof', code, status };
180
- if (status === 400 && code === REQUEST_FIELD_CONFLICT && sentSettledBy) {
211
+ if (status === 400 && code === BODY_SHAPE && readRefusalField(o) === RETIRED_DECISION_KEY) {
212
+ return { kind: 'retired_key', code, status, field: RETIRED_DECISION_KEY };
213
+ }
214
+ if (status === 400 && code === REQUEST_FIELD_CONFLICT && sentAttributionKey) {
181
215
  return { kind: 'decision_conflict', code, status };
182
216
  }
183
217
  if (status === 409 && code === RESUME_OUTCOME_INVALID) {
@@ -202,6 +236,9 @@ export function denyAttributionRefusalContent(detail) {
202
236
  return ('The engine refused this decision before judging it: the body says a policy settled it and also asks to allow the call, ' +
203
237
  'and only a person can allow one · Nothing was decided and the approval is still waiting — ' +
204
238
  'send it again with the decision and the note in agreement');
239
+ case 'retired_key':
240
+ return ('The engine refused this decision before judging it: the note saying who settled it was sent under a name this engine no longer accepts · ' +
241
+ 'Nothing was decided and the approval is still waiting — send the decision again with who made it given under the name the engine now takes in its place');
205
242
  case 'attribution_rejected': {
206
243
  const named = typeof detail.field === 'string' && APPROVAL_NON_BINDING_FIELDS.has(detail.field)
207
244
  ? ` It named ${detail.field} as the part it would not take.`
@@ -33,7 +33,7 @@ export function workflowsJournalAvailable(reading) {
33
33
  export function workflowsJournalDoctorDetail(reading) {
34
34
  switch (reading.kind) {
35
35
  case 'unobserved':
36
- return 'workflow journal not observed — the engine reports it on /v1/capabilities (workflowsJournal); this process has no usable capabilities reading cached for it (none received, or the last one was unreadable)';
36
+ return 'workflow journal not observed — the engine reports it on /v1/capabilities (workflowsJournal); this process has no usable capabilities reading cached for it (none received, the last one was unreadable, or the last one was discarded when the engine connection was reset; this process cannot tell which)';
37
37
  case 'not_reported':
38
38
  return 'workflow journal not reported by this engine — the engine predates the separate flag, so the workflow listing flag still covers the journal';
39
39
  case 'absent':
@@ -75,7 +75,7 @@ export function writeProtectionDoctorDetail(reading) {
75
75
  switch (reading.kind) {
76
76
  case 'unobserved':
77
77
  return ('not observed — the engine reports it on /v1/capabilities; this process has no usable ' +
78
- 'capabilities reading cached for it (none received, or the last one was unreadable)');
78
+ 'capabilities reading cached for it (none received, the last one was unreadable, or the last one was discarded when the engine connection was reset; this process cannot tell which)');
79
79
  case 'not_reported':
80
80
  return ('not reported by this engine — the capability position needs a newer engine; this says ' +
81
81
  'nothing about whether a protected-name table is in effect (an absent seat is the engine ' +