@sema-agent/client-core 0.84.0 → 0.85.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 (101) hide show
  1. package/CHANGELOG.md +247 -0
  2. package/README.md +27 -13
  3. package/dist/abortableSleep.d.ts +10 -0
  4. package/dist/abortableSleep.js +37 -0
  5. package/dist/adapt/arms.js +1 -1
  6. package/dist/adapt.d.ts +1 -1
  7. package/dist/adapt.js +1 -1
  8. package/dist/adapter/downstream/terminalToSdkResult.d.ts +1 -0
  9. package/dist/adapter/downstream/terminalToSdkResult.js +19 -10
  10. package/dist/adapter/runStream.js +6 -2
  11. package/dist/agentSession/engineSessionBackgroundStop.d.ts +50 -0
  12. package/dist/agentSession/engineSessionBackgroundStop.js +291 -0
  13. package/dist/agentsWireCaps.d.ts +2 -1
  14. package/dist/agentsWireCaps.js +8 -0
  15. package/dist/cloudConfigWireCaps.js +2 -1
  16. package/dist/corruptSession.d.ts +3 -0
  17. package/dist/corruptSession.js +29 -0
  18. package/dist/corruptSessionCopy.d.ts +1 -0
  19. package/dist/corruptSessionCopy.js +4 -0
  20. package/dist/decideFailureNote.d.ts +2 -1
  21. package/dist/decideFailureNote.js +8 -3
  22. package/dist/decideReceipt.d.ts +6 -0
  23. package/dist/decideReceipt.js +30 -1
  24. package/dist/detachWire.d.ts +1 -0
  25. package/dist/detachWire.js +13 -5
  26. package/dist/displayUntrusted.js +114 -18
  27. package/dist/effortWire.d.ts +2 -1
  28. package/dist/effortWire.js +2 -4
  29. package/dist/engineErrorCodes.d.ts +11 -0
  30. package/dist/engineErrorCodes.js +32 -0
  31. package/dist/engineNoticeCodes.d.ts +39 -4
  32. package/dist/engineNoticeCodes.js +117 -161
  33. package/dist/engineWireFor.d.ts +43 -0
  34. package/dist/engineWireFor.js +399 -0
  35. package/dist/engineWireSdk.d.ts +6 -0
  36. package/dist/fileHistoryCaptureCapability.d.ts +4 -1
  37. package/dist/fileHistoryCaptureCapability.js +43 -9
  38. package/dist/gateVocabulary.d.ts +1 -2
  39. package/dist/gateVocabulary.js +1 -22
  40. package/dist/generated/engineNoticeTables.d.ts +3 -0
  41. package/dist/generated/engineNoticeTables.js +156 -0
  42. package/dist/generated/toolNameTables.d.ts +2 -0
  43. package/dist/generated/toolNameTables.js +43 -0
  44. package/dist/headlessPermissionModeWire.js +2 -4
  45. package/dist/hitl/askGateWire.d.ts +1 -1
  46. package/dist/hitl/askGateWire.js +1 -1
  47. package/dist/hitl/frameRouter.js +4 -2
  48. package/dist/hitl/hitlHostSurface.js +1 -1
  49. package/dist/hitl/parkResolver.d.ts +1 -0
  50. package/dist/hitl/parkResolver.js +11 -3
  51. package/dist/hitl/planReviewWire.d.ts +41 -3
  52. package/dist/hitl/planReviewWire.js +264 -49
  53. package/dist/hitl/rosterMountedNames.d.ts +2 -0
  54. package/dist/hitl/rosterMountedNames.js +38 -0
  55. package/dist/hitl/sessionPolicyDeliverable.d.ts +8 -2
  56. package/dist/hitl/sessionPolicyDeliverable.js +39 -48
  57. package/dist/hitl/sessionPolicyWire.d.ts +40 -0
  58. package/dist/hitl/sessionPolicyWire.js +173 -0
  59. package/dist/hitl/toolApprovalWire.d.ts +4 -2
  60. package/dist/hitl/toolApprovalWire.js +6 -4
  61. package/dist/index.d.ts +10 -3
  62. package/dist/index.js +7 -2
  63. package/dist/liveInitToolFace.js +28 -10
  64. package/dist/permissionWireCaps.d.ts +2 -1
  65. package/dist/permissionWireCaps.js +2 -7
  66. package/dist/request/taskRequest.d.ts +2 -0
  67. package/dist/request/taskRequest.js +18 -1
  68. package/dist/resumeRefusalCopy.d.ts +11 -0
  69. package/dist/resumeRefusalCopy.js +42 -2
  70. package/dist/runTerminal.js +4 -0
  71. package/dist/sandboxWire.js +1 -1
  72. package/dist/sealedKeyCapability.d.ts +17 -0
  73. package/dist/sealedKeyCapability.js +42 -0
  74. package/dist/seatContract.d.ts +2 -1
  75. package/dist/seatContract.js +5 -21
  76. package/dist/subagent/engineCompactWire.d.ts +13 -2
  77. package/dist/subagent/engineCompactWire.js +48 -37
  78. package/dist/subagent/engineDelegatedPrompt.d.ts +9 -1
  79. package/dist/subagent/engineDelegatedPrompt.js +16 -16
  80. package/dist/subagent/engineRowStopGate.d.ts +2 -2
  81. package/dist/subagent/engineRowStopGate.js +4 -4
  82. package/dist/subagent/engineSubagentOutput.d.ts +8 -0
  83. package/dist/subagent/engineSubagentOutput.js +37 -18
  84. package/dist/subagent/engineSubagentResume.d.ts +11 -2
  85. package/dist/subagent/engineSubagentResume.js +28 -14
  86. package/dist/subagent/engineSubagentSteer.d.ts +10 -1
  87. package/dist/subagent/engineSubagentSteer.js +16 -11
  88. package/dist/subagent/engineSubagentTail.d.ts +10 -1
  89. package/dist/subagent/engineSubagentTail.js +35 -17
  90. package/dist/subagent/engineTaskHandleWire.d.ts +13 -0
  91. package/dist/subagent/engineTaskHandleWire.js +41 -20
  92. package/dist/systemReminderTag.d.ts +5 -0
  93. package/dist/systemReminderTag.js +20 -9
  94. package/dist/taskRequestWords.d.ts +5 -0
  95. package/dist/taskRequestWords.js +4 -0
  96. package/dist/wireErrorTriage.d.ts +1 -0
  97. package/dist/wireErrorTriage.js +3 -1
  98. package/dist/wireRefusalCopy.d.ts +10 -0
  99. package/dist/wireRefusalCopy.js +62 -2
  100. package/docs/INTEGRATION-CLIENTS.md +1128 -22
  101. package/package.json +1 -1
@@ -23,3 +23,13 @@ export interface DenyAttributionRefusalDetail {
23
23
  }
24
24
  export declare function denyAttributionRefusalFromError(err: unknown, sentSettledBy: boolean): DenyAttributionRefusalDetail | null;
25
25
  export declare function denyAttributionRefusalContent(detail: Pick<DenyAttributionRefusalDetail, 'kind' | 'field'>): string;
26
+ export declare const CONFLICT_SESSION_CHILDREN_ALIVE = "conflict.session_children_alive";
27
+ export type SessionDeleteConflictKind = 'children_alive' | 'active_run' | 'unrecognized';
28
+ export interface SessionDeleteConflictDetail {
29
+ kind: SessionDeleteConflictKind;
30
+ code?: string;
31
+ remaining?: readonly string[];
32
+ activeTaskId?: string;
33
+ }
34
+ export declare function sessionDeleteConflictFromError(err: unknown): SessionDeleteConflictDetail | null;
35
+ export declare function sessionDeleteConflictContent(detail: Pick<SessionDeleteConflictDetail, 'kind' | 'remaining' | 'activeTaskId'>): string;
@@ -1,5 +1,6 @@
1
- import { readErrorNumber } from './wireFailureShape.js';
2
- import { USAGE_WINDOW_EXHAUSTED } from './engineErrorCodes.js';
1
+ import { readErrorNumber, readErrorString, readErrorStringList } from './wireFailureShape.js';
2
+ import { ACTIVE_RUN_BUSY_ERROR_CODE, USAGE_WINDOW_EXHAUSTED } from './engineErrorCodes.js';
3
+ import { capForDisplay } from './fleetTaskDesc.js';
3
4
  export const CONFLICT_APPROVAL_SETTLED = 'conflict.approval_settled';
4
5
  export const CONFLICT_RUN_NOT_RUNNING = 'conflict.run_not_running';
5
6
  function readStringField(o, key) {
@@ -151,3 +152,62 @@ export function denyAttributionRefusalContent(detail) {
151
152
  }
152
153
  }
153
154
  }
155
+ export const CONFLICT_SESSION_CHILDREN_ALIVE = 'conflict.session_children_alive';
156
+ export function sessionDeleteConflictFromError(err) {
157
+ try {
158
+ if (err === null || typeof err !== 'object')
159
+ return null;
160
+ const o = err;
161
+ const rawStatus = o.status ?? o.statusCode;
162
+ const is409 = rawStatus === 409 || (rawStatus === undefined && o.name === 'ConflictError');
163
+ if (!is409)
164
+ return null;
165
+ const code = readStringField(o, 'errorCode');
166
+ if (code === CONFLICT_SESSION_CHILDREN_ALIVE) {
167
+ const remaining = readErrorStringList(err, 'remaining')?.filter((id) => id.length > 0);
168
+ return { kind: 'children_alive', code, ...(remaining !== undefined && remaining.length > 0 ? { remaining: Object.freeze(remaining) } : {}) };
169
+ }
170
+ if (code === ACTIVE_RUN_BUSY_ERROR_CODE) {
171
+ const activeTaskId = readErrorString(err, 'activeTaskId');
172
+ return { kind: 'active_run', code, ...(activeTaskId !== undefined && activeTaskId.length > 0 ? { activeTaskId } : {}) };
173
+ }
174
+ return { kind: 'unrecognized', ...(code !== undefined ? { code } : {}) };
175
+ }
176
+ catch {
177
+ return null;
178
+ }
179
+ }
180
+ const DELETE_CONFLICT_IDS_SHOWN = 3;
181
+ const DELETE_CONFLICT_ID_MAX = 64;
182
+ function sessionDeleteConflictUnrecognizedContent() {
183
+ return ('The engine refused to delete this session with a conflict it did not explain · ' +
184
+ 'Check whether the session is still listed and whether anything of it is still running, then try the delete again');
185
+ }
186
+ export function sessionDeleteConflictContent(detail) {
187
+ try {
188
+ if (detail === null || typeof detail !== 'object')
189
+ return sessionDeleteConflictUnrecognizedContent();
190
+ switch (detail.kind) {
191
+ case 'children_alive': {
192
+ const raw = detail.remaining;
193
+ const ids = Array.isArray(raw) ? raw.filter((id) => typeof id === 'string' && id.length > 0) : [];
194
+ const shown = ids.slice(0, DELETE_CONFLICT_IDS_SHOWN).map((id) => capForDisplay(id, DELETE_CONFLICT_ID_MAX));
195
+ const more = ids.length > shown.length ? ` and ${ids.length - shown.length} more` : '';
196
+ const which = shown.length > 0 ? ` (${shown.join(', ')}${more})` : '';
197
+ return (`This session was not deleted: background agents it started are still running where this engine cannot stop them${which} · ` +
198
+ 'Nothing was deleted — delete it again once they finish, or stop them where they run first');
199
+ }
200
+ case 'active_run': {
201
+ const active = detail.activeTaskId;
202
+ const run = typeof active === 'string' && active.length > 0 ? ` (run ${capForDisplay(active, DELETE_CONFLICT_ID_MAX)})` : '';
203
+ return (`This session was not deleted: it still has a run in progress${run} · ` +
204
+ 'Nothing was deleted — cancel that run or let it finish, then delete the session again');
205
+ }
206
+ default:
207
+ return sessionDeleteConflictUnrecognizedContent();
208
+ }
209
+ }
210
+ catch {
211
+ return sessionDeleteConflictUnrecognizedContent();
212
+ }
213
+ }