@sema-agent/client-core 0.85.2 → 0.87.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 (79) hide show
  1. package/CHANGELOG.md +263 -0
  2. package/README.md +25 -16
  3. package/dist/adapt/arms.js +14 -1
  4. package/dist/adapter/downstream/terminalToSdkResult.d.ts +3 -3
  5. package/dist/adapter/downstream/terminalToSdkResult.js +4 -1
  6. package/dist/adapter/runStream.js +75 -2
  7. package/dist/adapter/types.d.ts +3 -0
  8. package/dist/agentSession/backgroundView.js +7 -1
  9. package/dist/agentSession/contract.d.ts +1 -1
  10. package/dist/centerWiringCapability.d.ts +38 -0
  11. package/dist/centerWiringCapability.js +202 -0
  12. package/dist/decideFailureNote.js +3 -0
  13. package/dist/decideReceipt.d.ts +1 -1
  14. package/dist/decideReceipt.js +1 -1
  15. package/dist/detachWire.d.ts +6 -1
  16. package/dist/detachWire.js +22 -1
  17. package/dist/engineCapReader.d.ts +8 -0
  18. package/dist/engineCapReader.js +15 -0
  19. package/dist/engineErrorCodes.d.ts +3 -0
  20. package/dist/engineErrorCodes.js +8 -0
  21. package/dist/engineNoticeCodes.d.ts +62 -0
  22. package/dist/engineNoticeCodes.js +247 -29
  23. package/dist/executionLaneCapability.d.ts +6 -0
  24. package/dist/executionLaneCapability.js +55 -2
  25. package/dist/fleet/fleetProjection.js +6 -8
  26. package/dist/fleet/workflowSizeWarning.js +2 -5
  27. package/dist/gateOutcome.d.ts +13 -0
  28. package/dist/gateOutcome.js +48 -1
  29. package/dist/gateVocabulary.d.ts +6 -3
  30. package/dist/gateVocabulary.js +7 -15
  31. package/dist/generated/engineFactTables.d.ts +10 -0
  32. package/dist/generated/engineFactTables.js +113 -0
  33. package/dist/generated/engineNoticeTables.js +14 -0
  34. package/dist/hitl/crashConverged.d.ts +1 -0
  35. package/dist/hitl/crashConverged.js +17 -2
  36. package/dist/hitl/hitlBridge.d.ts +4 -0
  37. package/dist/hitl/hitlBridge.js +6 -0
  38. package/dist/hitl/parkResolver.js +17 -12
  39. package/dist/hitl/refusedToolNameProse.d.ts +4 -0
  40. package/dist/hitl/refusedToolNameProse.js +7 -0
  41. package/dist/hitl/sessionPolicyDeliverable.js +9 -5
  42. package/dist/hitl/sessionPolicyWire.d.ts +16 -0
  43. package/dist/hitl/sessionPolicyWire.js +49 -1
  44. package/dist/hitl/suspendedReopen.d.ts +7 -0
  45. package/dist/hitl/suspendedReopen.js +38 -7
  46. package/dist/hitl/toolApprovalWire.js +4 -5
  47. package/dist/index.d.ts +6 -1
  48. package/dist/index.js +6 -1
  49. package/dist/inheritEnvWire.d.ts +22 -0
  50. package/dist/inheritEnvWire.js +84 -0
  51. package/dist/peerFrames.js +2 -10
  52. package/dist/printInitToolFace.d.ts +6 -0
  53. package/dist/printInitToolFace.js +115 -2
  54. package/dist/readCredentialRefusal.d.ts +2 -0
  55. package/dist/readCredentialRefusal.js +7 -0
  56. package/dist/request/taskRequest.d.ts +4 -5
  57. package/dist/request/taskRequest.js +33 -23
  58. package/dist/resumeRefusalCopy.d.ts +2 -7
  59. package/dist/resumeRefusalCopy.js +2 -24
  60. package/dist/rewindArchiveCapability.js +5 -0
  61. package/dist/runTerminal.js +2 -6
  62. package/dist/seam.d.ts +11 -1
  63. package/dist/seam.js +7 -0
  64. package/dist/sqlEngineCapability.js +15 -2
  65. package/dist/storePostureCapability.d.ts +25 -0
  66. package/dist/storePostureCapability.js +132 -0
  67. package/dist/toolHistoryMismatch.d.ts +63 -0
  68. package/dist/toolHistoryMismatch.js +425 -0
  69. package/dist/toolResult.js +2 -47
  70. package/dist/wireErrorTriage.d.ts +1 -0
  71. package/dist/wireErrorTriage.js +3 -0
  72. package/dist/wireFailureShape.d.ts +3 -0
  73. package/dist/wireFailureShape.js +44 -0
  74. package/dist/wireRefusalCopy.d.ts +39 -1
  75. package/dist/wireRefusalCopy.js +350 -2
  76. package/dist/workflowClient.d.ts +7 -2
  77. package/dist/workflowClient.js +15 -7
  78. package/docs/INTEGRATION-CLIENTS.md +942 -16
  79. package/package.json +2 -2
@@ -1,6 +1,8 @@
1
1
  import { wireFailureShapeOf } from '../wireFailureShape.js';
2
2
  import { hostLog } from '../host.js';
3
3
  import { isEngineRefusedToolName } from './sessionPolicyDeliverable.js';
4
+ import { RULES_LEGACY_TOOL_NAME_WRITE_NOTE } from './refusedToolNameProse.js';
5
+ import { RULES_LEGACY_TOOL_NAME, isRulesRefusalCode } from '../engineErrorCodes.js';
4
6
  import { rosterMountedNames } from './rosterMountedNames.js';
5
7
  const RULE_FIELD_PRESENCE = {
6
8
  toolAllow: true,
@@ -12,9 +14,19 @@ const RULE_FIELD_PRESENCE = {
12
14
  export const SESSION_POLICY_RULE_FIELDS = Object.freeze(Object.keys(RULE_FIELD_PRESENCE));
13
15
  const MAX_RULE_ENTRIES = 10_000;
14
16
  export function classifySessionPolicyFailure(e) {
15
- const { status, errorCode, message } = wireFailureShapeOf(e);
17
+ const { status, errorCode, message, bodyField, bodyName } = wireFailureShapeOf(e);
16
18
  if (errorCode === undefined || errorCode === '')
17
19
  return { kind: 'no-verdict', message };
20
+ if (errorCode === RULES_LEGACY_TOOL_NAME) {
21
+ return {
22
+ kind: 'legacy-tool-name',
23
+ message,
24
+ ...(bodyField === 'toolDeny' || bodyField === 'toolAllow' ? { field: bodyField } : {}),
25
+ ...(bodyName !== undefined && bodyName !== '' ? { name: bodyName } : {}),
26
+ };
27
+ }
28
+ if (isRulesRefusalCode(errorCode) && status !== undefined && status >= 400 && status < 500)
29
+ return { kind: 'error', message };
18
30
  if (status === 501 || errorCode === 'capability.session_store_required') {
19
31
  return { kind: 'face-unavailable', message };
20
32
  }
@@ -209,10 +221,30 @@ function unknownFrom(failure, leg) {
209
221
  return { kind: 'unknown', why: leg === 'read' ? 'read_failed' : 'write_indeterminate', message };
210
222
  case 'loosen-forbidden':
211
223
  case 'cas-conflict':
224
+ case 'legacy-tool-name':
212
225
  case 'error':
213
226
  return { kind: 'unknown', why: leg === 'read' ? 'read_failed' : 'write_refused', message };
214
227
  }
215
228
  }
229
+ function legacyToolNameOutcome(failure, prior, add) {
230
+ const { field, name } = failure;
231
+ let alreadyInRecord;
232
+ if (field !== undefined && name !== undefined) {
233
+ const inPrior = Object.hasOwn(prior, field) ? prior[field] : undefined;
234
+ const inAdd = Object.hasOwn(add, field) ? add[field] : undefined;
235
+ if (inPrior !== undefined && inPrior.includes(name))
236
+ alreadyInRecord = true;
237
+ else if (inAdd !== undefined && inAdd.includes(name))
238
+ alreadyInRecord = false;
239
+ }
240
+ return {
241
+ kind: 'legacy_tool_name',
242
+ message: failure.message,
243
+ ...(field !== undefined ? { field } : {}),
244
+ ...(name !== undefined ? { name } : {}),
245
+ ...(alreadyInRecord !== undefined ? { alreadyInRecord } : {}),
246
+ };
247
+ }
216
248
  async function attemptTighten(facade, req, opts) {
217
249
  const read = await readSessionPolicy(facade, req.sessionId, opts);
218
250
  if (read.kind === 'failed')
@@ -231,6 +263,8 @@ async function attemptTighten(facade, req, opts) {
231
263
  return { done: { kind: 'loosen_forbidden', message: failure.message } };
232
264
  if (failure.kind === 'cas-conflict')
233
265
  return { retryAtRev: read.rev };
266
+ if (failure.kind === 'legacy-tool-name')
267
+ return { done: legacyToolNameOutcome(failure, read.rules, req.add) };
234
268
  return { done: unknownFrom(failure, 'write') };
235
269
  }
236
270
  let narrowed;
@@ -279,6 +313,8 @@ export function sessionPolicyTightenNotice(outcome) {
279
313
  return outcome.why === 'absent'
280
314
  ? 'This deployment does not keep per-session tool rules, so there is nothing to tighten here.'
281
315
  : 'This engine does not say whether it keeps per-session tool rules — it predates that answer — so the tightening entry stays hidden rather than being written blind.';
316
+ case 'legacy_tool_name':
317
+ return RULES_LEGACY_TOOL_NAME_WRITE_NOTE;
282
318
  case 'unknown':
283
319
  switch (outcome.why) {
284
320
  case 'face_unavailable':
@@ -382,6 +418,16 @@ async function attemptRemoval(facade, sessionId, mounted, opts) {
382
418
  return { done: { kind: 'loosen_forbidden', message: failure.message, refused: removed } };
383
419
  if (failure.kind === 'cas-conflict')
384
420
  return { retryAtRev: read.rev };
421
+ if (failure.kind === 'legacy-tool-name') {
422
+ return {
423
+ done: {
424
+ kind: 'legacy_tool_name',
425
+ message: failure.message,
426
+ ...(failure.field !== undefined ? { field: failure.field } : {}),
427
+ ...(failure.name !== undefined ? { name: failure.name } : {}),
428
+ },
429
+ };
430
+ }
385
431
  return { done: removalFailed(failure, 'write') };
386
432
  }
387
433
  let narrowed;
@@ -475,6 +521,8 @@ export function sessionPolicyRemovalNotice(outcome) {
475
521
  }
476
522
  case 'write_unconfirmed':
477
523
  return 'The removal was sent but no clear answer came back from the engine — it may already be in effect. Run the removal again: it re-reads the record, and reports nothing left to remove if it did take effect.';
524
+ case 'legacy_tool_name':
525
+ return 'Nothing was changed: the engine refused to write this session’s rule record back, because an entry this removal keeps is a name the engine no longer accepts in that record (the engine\'s own error text names the entry). The removal keeps it on purpose — the supplied roster mounts a tool by exactly that name, or this version does not yet recognise the name as one the engine refuses. While the record holds that entry it cannot be written, so the entries this removal meant to take out stay in it as well.';
478
526
  default:
479
527
  return generic;
480
528
  }
@@ -7,3 +7,10 @@ export type SuspendedReopenReading = {
7
7
  readonly kind: 'unstated';
8
8
  };
9
9
  export declare function suspendedReopenOf(ev: unknown): SuspendedReopenReading;
10
+ export interface ResumeReopenDetail {
11
+ code: string;
12
+ reason: 'env_failed' | 'tool_unavailable' | 'tool_contract_mismatch';
13
+ retriable: true;
14
+ }
15
+ export declare function resumeReopenFromError(err: unknown): ResumeReopenDetail | null;
16
+ export declare function resumeReopenContent(detail: ResumeReopenDetail): string;
@@ -1,13 +1,44 @@
1
+ import { RESUME_REOPEN_CODES, RESUME_ENV_FAILED, RESUME_TOOL_UNAVAILABLE } from '../engineErrorCodes.js';
1
2
  const UNSTATED = Object.freeze({ kind: 'unstated' });
2
3
  const NOT_REOPENED = Object.freeze({ kind: 'not_reopened' });
3
4
  export function suspendedReopenOf(ev) {
4
- if (ev === null || typeof ev !== 'object' || Array.isArray(ev))
5
+ if (ev === null || typeof ev !== 'object')
5
6
  return UNSTATED;
6
- const o = ev;
7
- if (!Object.hasOwn(o, 'reopened'))
7
+ try {
8
+ if (Array.isArray(ev))
9
+ return UNSTATED;
10
+ const o = ev;
11
+ if (!Object.hasOwn(o, 'reopened'))
12
+ return UNSTATED;
13
+ const v = o.reopened;
14
+ if (v === null)
15
+ return NOT_REOPENED;
16
+ return typeof v === 'string' && v.length > 0 ? { kind: 'reopened', code: v } : UNSTATED;
17
+ }
18
+ catch {
8
19
  return UNSTATED;
9
- const v = o.reopened;
10
- if (v === null)
11
- return NOT_REOPENED;
12
- return typeof v === 'string' && v.length > 0 ? { kind: 'reopened', code: v } : UNSTATED;
20
+ }
21
+ }
22
+ export function resumeReopenFromError(err) {
23
+ if (typeof err !== 'object' || err === null)
24
+ return null;
25
+ const code = err.errorCode;
26
+ if (typeof code !== 'string' || !RESUME_REOPEN_CODES.includes(code))
27
+ return null;
28
+ if (err.retriable !== true)
29
+ return null;
30
+ const reason = code.slice('resume.'.length);
31
+ return { code, reason, retriable: true };
32
+ }
33
+ export function resumeReopenContent(detail) {
34
+ const first = detail.code === RESUME_ENV_FAILED
35
+ ? 'The execution environment for this parked work could not be brought back'
36
+ : detail.code === RESUME_TOOL_UNAVAILABLE
37
+ ? 'The tool this approval was granted for is not available on this engine'
38
+ : 'The tool this approval was granted for has changed since the approval was recorded';
39
+ return [
40
+ first,
41
+ 'The engine re-parked the work before consuming anything — the approval is still pending and your decision was not consumed',
42
+ 'Re-fetch the pending approvals and decide again on an engine where the same tool is available',
43
+ ].join(' · ');
13
44
  }
@@ -1,4 +1,4 @@
1
- import { DEFAULT_DENY_REASON, DecideTransportRetryExhaustedError, HitlBridge, HitlSafetyError, denyReasonForWire, findPendingForTask, readDecideCurrentPending, readWireErrorCode, } from './hitlBridge.js';
1
+ import { APPROVAL_CARD_PORT_KEY_MISMATCH_REASON, DEFAULT_DENY_REASON, DecideTransportRetryExhaustedError, HitlBridge, NO_APPROVAL_CARD_PORT_REASON, HitlSafetyError, denyReasonForWire, findPendingForTask, readDecideCurrentPending, readWireErrorCode, } from './hitlBridge.js';
2
2
  import { askParkRowArm } from './askParkRowRouting.js';
3
3
  import { hostLog } from '../host.js';
4
4
  import { readOwnNonEmptyString } from '../ownKey.js';
@@ -120,10 +120,9 @@ function cardPortMissReason() {
120
120
  const otherKeysInstalled = cardPortByKey
121
121
  .keys()
122
122
  .some((k) => k !== DEFAULT_SESSION_KEY && cardPortByKey.get(k) != null);
123
- if (otherKeysInstalled) {
124
- return 'no approval card port installed for the default session key, but a non-default sessionKey has one — likely a keyed-install/default-read mismatch (installApprovalCardPortFor vs the zero-arg default-key read), not a missing install';
125
- }
126
- return 'no approval card port installed (print/non-REPL mode, or host forgot installApprovalCardPort)';
123
+ if (otherKeysInstalled)
124
+ return APPROVAL_CARD_PORT_KEY_MISMATCH_REASON;
125
+ return NO_APPROVAL_CARD_PORT_REASON;
127
126
  }
128
127
  function rememberRefusedByServer(e) {
129
128
  switch (readWireErrorCode(e)) {
package/dist/index.d.ts CHANGED
@@ -72,7 +72,7 @@ export * from './engineWireSdk.js';
72
72
  export * from './classifierVerdictWire.js';
73
73
  export { stripSystemReminderBlocks, unwrapSystemReminder } from './systemReminderTag.js';
74
74
  export { findSystemReminderOpenTag, type SystemReminderOpenTagSpan } from './systemReminderTag.js';
75
- export { ACTIVE_RUN_BUSY_ERROR_CODE, asModelFallbackReason, CAPABILITY_SELF_ORCHESTRATION_REQUIRED, CONFIG_DELEGATION_ENTRY_CAPS, CONFIG_LEGACY_TOOL_NAME, CONFIG_LIMIT_INVALID, CONFIG_LIMIT_UNKNOWN_KEY, CONFIG_MEMORY_PROJECT_KEY_SPELLING, CONFIG_MEMORY_WRITE_SCOPE_MISMATCH, CONFIG_REFUSAL_CODES, CONFIG_STRATEGY_FIND_LIMIT_INVALID, CONFIG_STRATEGY_MAX_SIZE_INVALID, CORRUPT_SESSION_ERROR_CODE, DECIDE_CLAIM_LOST, DECIDE_GATE_MOVED, DECIDE_NOT_PARKED, DECIDE_PARK_MOVED_CODES, DECIDE_WORKFLOW_HOST_UNKNOWN, DECIDE_WORKFLOW_LANE_CODES, DECIDE_WORKFLOW_REMEMBER_UNSUPPORTED, DELEGATION_CAP_CODES, DELEGATION_CONCURRENCY_CAP, DELEGATION_SESSION_CAP, delegationCapDispositionOf, DRAINING_ERROR_CODE, ENGINE_STOP_REASONS, engineStopReasonToCc, ENV_LIFETIME_EXPIRED, GATE_PARKED_ERROR_CODE, isConfigRefusalCode, isCorruptSessionCode, isDecideParkMovedCode, isDelegationCapCode, isInterruptedToolEndCode, isLimitsExceededCode, isRewindFamilyCode, isStatusDerivedCoarseCode, isWorkflowParkRefusalCode, LIMITS_MAX_COST_EXCEEDED, LIMITS_MAX_TOKENS_EXCEEDED, LIMITS_MAX_TURNS_EXCEEDED, LIMITS_MAX_WALLTIME_EXCEEDED, MCP_SERVER_REVOKED, MODEL_FALLBACK_INHERIT_NO_TIER_BINDING, OUTPUT_INVALID, PARKED_RESUME_STARTUP_FAILED, RESUME_AT_ERROR_CODE_PREFIX, RESUME_CONTEXT_UNAVAILABLE, RESUME_ENV_FAILED, RESUME_PLACEMENT_MISMATCH, RESUME_POLICY_FOLD_CODE, RESUME_PREFLIGHT_REJECTED, RESUME_REOPEN_CODES, RESUME_RETRY_LATER_CODES, RESUME_TOOL_CONTRACT_MISMATCH, RESUME_TOOL_UNAVAILABLE, RESUME_USAGE_WINDOW_EXHAUSTED, REWIND_ERROR_CODE_PREFIXES, SCENARIO_NOT_ALLOWED_ERROR_CODE, STATUS_DERIVED_COARSE_CODES, STOP_CONFLICT_CODES, STREAM_MAX_DURATION, TOOL_END_INTERRUPTED_NEVER_STARTED, TOOL_END_INTERRUPTED_OUTCOME_UNKNOWN, USAGE_WINDOW_EXHAUSTED, WORKFLOW_PARK_REFUSAL_CODES, } from './engineErrorCodes.js';
75
+ export { ACTIVE_RUN_BUSY_ERROR_CODE, asModelFallbackReason, CAPABILITY_SELF_ORCHESTRATION_REQUIRED, CONFIG_DELEGATION_ENTRY_CAPS, CONFIG_LEGACY_TOOL_NAME, CONFIG_LIMIT_INVALID, CONFIG_LIMIT_UNKNOWN_KEY, CONFIG_MEMORY_PROJECT_KEY_SPELLING, CONFIG_MEMORY_WRITE_SCOPE_MISMATCH, CONFIG_REFUSAL_CODES, CONFIG_STRATEGY_FIND_LIMIT_INVALID, CONFIG_STRATEGY_MAX_SIZE_INVALID, CORRUPT_SESSION_ERROR_CODE, DECIDE_CLAIM_LOST, DECIDE_GATE_MOVED, DECIDE_NOT_PARKED, DECIDE_PARK_MOVED_CODES, DECIDE_WORKFLOW_HOST_UNKNOWN, DECIDE_WORKFLOW_LANE_CODES, DECIDE_WORKFLOW_REMEMBER_UNSUPPORTED, DELEGATION_CAP_CODES, DELEGATION_CONCURRENCY_CAP, DELEGATION_SESSION_CAP, delegationCapDispositionOf, DRAINING_ERROR_CODE, ENGINE_STOP_REASONS, engineStopReasonToCc, ENV_LIFETIME_EXPIRED, FLEET_LEASE_UNAVAILABLE, GATE_PARKED_ERROR_CODE, isConfigRefusalCode, isCorruptSessionCode, isDecideParkMovedCode, isDelegationCapCode, isInterruptedToolEndCode, isLimitsExceededCode, isRewindFamilyCode, isRulesRefusalCode, isStatusDerivedCoarseCode, isWorkflowParkRefusalCode, LIMITS_MAX_COST_EXCEEDED, LIMITS_MAX_TOKENS_EXCEEDED, LIMITS_MAX_TURNS_EXCEEDED, LIMITS_MAX_WALLTIME_EXCEEDED, MCP_SERVER_REVOKED, MODEL_FALLBACK_INHERIT_NO_TIER_BINDING, OUTPUT_INVALID, PARKED_RESUME_STARTUP_FAILED, RESUME_AT_ERROR_CODE_PREFIX, RESUME_CONTEXT_UNAVAILABLE, RESUME_ENV_FAILED, RESUME_PLACEMENT_MISMATCH, RESUME_POLICY_FOLD_CODE, RESUME_PREFLIGHT_REJECTED, RESUME_REOPEN_CODES, RESUME_RETRY_LATER_CODES, RESUME_TOOL_CONTRACT_MISMATCH, RESUME_TOOL_UNAVAILABLE, RESUME_USAGE_WINDOW_EXHAUSTED, REWIND_ERROR_CODE_PREFIXES, RULES_LEGACY_TOOL_NAME, SCENARIO_NOT_ALLOWED_ERROR_CODE, STATUS_DERIVED_COARSE_CODES, STOP_CONFLICT_CODES, STREAM_MAX_DURATION, TOOL_END_INTERRUPTED_NEVER_STARTED, TOOL_END_INTERRUPTED_OUTCOME_UNKNOWN, USAGE_WINDOW_EXHAUSTED, WORKFLOW_PARK_REFUSAL_CODES, } from './engineErrorCodes.js';
76
76
  export type { DelegationCapDisposition, ModelFallbackReason, } from './engineErrorCodes.js';
77
77
  export * from './agentsWireCaps.js';
78
78
  export * from './attachmentsWireCaps.js';
@@ -90,6 +90,8 @@ export * from './rewindWireCaps.js';
90
90
  export * from './rewindArchiveCapability.js';
91
91
  export * from './fileHistoryCaptureCapability.js';
92
92
  export * from './sealedKeyCapability.js';
93
+ export * from './storePostureCapability.js';
94
+ export * from './centerWiringCapability.js';
93
95
  export * from './registryQuotaUsage.js';
94
96
  export * from './selfOrchestrationWireCaps.js';
95
97
  export * from './skillsWireCaps.js';
@@ -143,8 +145,10 @@ export * from './principalWire.js';
143
145
  export * from './wireErrorTriage.js';
144
146
  export * from './corruptSession.js';
145
147
  export * from './corruptSessionCopy.js';
148
+ export { classifyToolHistoryMismatch, resolveToolHistoryRewindTarget } from './toolHistoryMismatch.js';
146
149
  export * from './resumeRefusalCopy.js';
147
150
  export * from './wireRefusalCopy.js';
151
+ export * from './inheritEnvWire.js';
148
152
  export * from './decideReceipt.js';
149
153
  export * from './sessionMap.js';
150
154
  export * from './detachWire.js';
@@ -189,6 +193,7 @@ export * from './request/printNotification.js';
189
193
  export * from './seatContract.js';
190
194
  export * from './agentSession/contract.js';
191
195
  export * from './agentSession/backgroundView.js';
196
+ export { READ_CREDENTIAL_NOT_ACCEPTED_NOTICE } from './readCredentialRefusal.js';
192
197
  export { readEngineAgentRegistry, isEngineAgentRegistryListingSuperseded } from './agentSession/engineAgentRegistryRead.js';
193
198
  export type { EngineAgentRegistryClient } from './agentSession/engineAgentRegistryRead.js';
194
199
  export { stopEngineSessionBackground, engineSessionBackgroundReceiptReadingOf, ENGINE_SESSION_BACKGROUND_RECEIPT_STATES, } from './agentSession/engineSessionBackgroundStop.js';
package/dist/index.js CHANGED
@@ -65,7 +65,7 @@ export * from './engineWireSdk.js';
65
65
  export * from './classifierVerdictWire.js';
66
66
  export { stripSystemReminderBlocks, unwrapSystemReminder } from './systemReminderTag.js';
67
67
  export { findSystemReminderOpenTag } from './systemReminderTag.js';
68
- export { ACTIVE_RUN_BUSY_ERROR_CODE, asModelFallbackReason, CAPABILITY_SELF_ORCHESTRATION_REQUIRED, CONFIG_DELEGATION_ENTRY_CAPS, CONFIG_LEGACY_TOOL_NAME, CONFIG_LIMIT_INVALID, CONFIG_LIMIT_UNKNOWN_KEY, CONFIG_MEMORY_PROJECT_KEY_SPELLING, CONFIG_MEMORY_WRITE_SCOPE_MISMATCH, CONFIG_REFUSAL_CODES, CONFIG_STRATEGY_FIND_LIMIT_INVALID, CONFIG_STRATEGY_MAX_SIZE_INVALID, CORRUPT_SESSION_ERROR_CODE, DECIDE_CLAIM_LOST, DECIDE_GATE_MOVED, DECIDE_NOT_PARKED, DECIDE_PARK_MOVED_CODES, DECIDE_WORKFLOW_HOST_UNKNOWN, DECIDE_WORKFLOW_LANE_CODES, DECIDE_WORKFLOW_REMEMBER_UNSUPPORTED, DELEGATION_CAP_CODES, DELEGATION_CONCURRENCY_CAP, DELEGATION_SESSION_CAP, delegationCapDispositionOf, DRAINING_ERROR_CODE, ENGINE_STOP_REASONS, engineStopReasonToCc, ENV_LIFETIME_EXPIRED, GATE_PARKED_ERROR_CODE, isConfigRefusalCode, isCorruptSessionCode, isDecideParkMovedCode, isDelegationCapCode, isInterruptedToolEndCode, isLimitsExceededCode, isRewindFamilyCode, isStatusDerivedCoarseCode, isWorkflowParkRefusalCode, LIMITS_MAX_COST_EXCEEDED, LIMITS_MAX_TOKENS_EXCEEDED, LIMITS_MAX_TURNS_EXCEEDED, LIMITS_MAX_WALLTIME_EXCEEDED, MCP_SERVER_REVOKED, MODEL_FALLBACK_INHERIT_NO_TIER_BINDING, OUTPUT_INVALID, PARKED_RESUME_STARTUP_FAILED, RESUME_AT_ERROR_CODE_PREFIX, RESUME_CONTEXT_UNAVAILABLE, RESUME_ENV_FAILED, RESUME_PLACEMENT_MISMATCH, RESUME_POLICY_FOLD_CODE, RESUME_PREFLIGHT_REJECTED, RESUME_REOPEN_CODES, RESUME_RETRY_LATER_CODES, RESUME_TOOL_CONTRACT_MISMATCH, RESUME_TOOL_UNAVAILABLE, RESUME_USAGE_WINDOW_EXHAUSTED, REWIND_ERROR_CODE_PREFIXES, SCENARIO_NOT_ALLOWED_ERROR_CODE, STATUS_DERIVED_COARSE_CODES, STOP_CONFLICT_CODES, STREAM_MAX_DURATION, TOOL_END_INTERRUPTED_NEVER_STARTED, TOOL_END_INTERRUPTED_OUTCOME_UNKNOWN, USAGE_WINDOW_EXHAUSTED, WORKFLOW_PARK_REFUSAL_CODES, } from './engineErrorCodes.js';
68
+ export { ACTIVE_RUN_BUSY_ERROR_CODE, asModelFallbackReason, CAPABILITY_SELF_ORCHESTRATION_REQUIRED, CONFIG_DELEGATION_ENTRY_CAPS, CONFIG_LEGACY_TOOL_NAME, CONFIG_LIMIT_INVALID, CONFIG_LIMIT_UNKNOWN_KEY, CONFIG_MEMORY_PROJECT_KEY_SPELLING, CONFIG_MEMORY_WRITE_SCOPE_MISMATCH, CONFIG_REFUSAL_CODES, CONFIG_STRATEGY_FIND_LIMIT_INVALID, CONFIG_STRATEGY_MAX_SIZE_INVALID, CORRUPT_SESSION_ERROR_CODE, DECIDE_CLAIM_LOST, DECIDE_GATE_MOVED, DECIDE_NOT_PARKED, DECIDE_PARK_MOVED_CODES, DECIDE_WORKFLOW_HOST_UNKNOWN, DECIDE_WORKFLOW_LANE_CODES, DECIDE_WORKFLOW_REMEMBER_UNSUPPORTED, DELEGATION_CAP_CODES, DELEGATION_CONCURRENCY_CAP, DELEGATION_SESSION_CAP, delegationCapDispositionOf, DRAINING_ERROR_CODE, ENGINE_STOP_REASONS, engineStopReasonToCc, ENV_LIFETIME_EXPIRED, FLEET_LEASE_UNAVAILABLE, GATE_PARKED_ERROR_CODE, isConfigRefusalCode, isCorruptSessionCode, isDecideParkMovedCode, isDelegationCapCode, isInterruptedToolEndCode, isLimitsExceededCode, isRewindFamilyCode, isRulesRefusalCode, isStatusDerivedCoarseCode, isWorkflowParkRefusalCode, LIMITS_MAX_COST_EXCEEDED, LIMITS_MAX_TOKENS_EXCEEDED, LIMITS_MAX_TURNS_EXCEEDED, LIMITS_MAX_WALLTIME_EXCEEDED, MCP_SERVER_REVOKED, MODEL_FALLBACK_INHERIT_NO_TIER_BINDING, OUTPUT_INVALID, PARKED_RESUME_STARTUP_FAILED, RESUME_AT_ERROR_CODE_PREFIX, RESUME_CONTEXT_UNAVAILABLE, RESUME_ENV_FAILED, RESUME_PLACEMENT_MISMATCH, RESUME_POLICY_FOLD_CODE, RESUME_PREFLIGHT_REJECTED, RESUME_REOPEN_CODES, RESUME_RETRY_LATER_CODES, RESUME_TOOL_CONTRACT_MISMATCH, RESUME_TOOL_UNAVAILABLE, RESUME_USAGE_WINDOW_EXHAUSTED, REWIND_ERROR_CODE_PREFIXES, RULES_LEGACY_TOOL_NAME, SCENARIO_NOT_ALLOWED_ERROR_CODE, STATUS_DERIVED_COARSE_CODES, STOP_CONFLICT_CODES, STREAM_MAX_DURATION, TOOL_END_INTERRUPTED_NEVER_STARTED, TOOL_END_INTERRUPTED_OUTCOME_UNKNOWN, USAGE_WINDOW_EXHAUSTED, WORKFLOW_PARK_REFUSAL_CODES, } from './engineErrorCodes.js';
69
69
  export * from './agentsWireCaps.js';
70
70
  export * from './attachmentsWireCaps.js';
71
71
  export * from './clientContextWireCaps.js';
@@ -82,6 +82,8 @@ export * from './rewindWireCaps.js';
82
82
  export * from './rewindArchiveCapability.js';
83
83
  export * from './fileHistoryCaptureCapability.js';
84
84
  export * from './sealedKeyCapability.js';
85
+ export * from './storePostureCapability.js';
86
+ export * from './centerWiringCapability.js';
85
87
  export * from './registryQuotaUsage.js';
86
88
  export * from './selfOrchestrationWireCaps.js';
87
89
  export * from './skillsWireCaps.js';
@@ -131,8 +133,10 @@ export * from './principalWire.js';
131
133
  export * from './wireErrorTriage.js';
132
134
  export * from './corruptSession.js';
133
135
  export * from './corruptSessionCopy.js';
136
+ export { classifyToolHistoryMismatch, resolveToolHistoryRewindTarget } from './toolHistoryMismatch.js';
134
137
  export * from './resumeRefusalCopy.js';
135
138
  export * from './wireRefusalCopy.js';
139
+ export * from './inheritEnvWire.js';
136
140
  export * from './decideReceipt.js';
137
141
  export * from './sessionMap.js';
138
142
  export * from './detachWire.js';
@@ -175,6 +179,7 @@ export * from './request/printNotification.js';
175
179
  export * from './seatContract.js';
176
180
  export * from './agentSession/contract.js';
177
181
  export * from './agentSession/backgroundView.js';
182
+ export { READ_CREDENTIAL_NOT_ACCEPTED_NOTICE } from './readCredentialRefusal.js';
178
183
  export { readEngineAgentRegistry, isEngineAgentRegistryListingSuperseded } from './agentSession/engineAgentRegistryRead.js';
179
184
  export { stopEngineSessionBackground, engineSessionBackgroundReceiptReadingOf, ENGINE_SESSION_BACKGROUND_RECEIPT_STATES, } from './agentSession/engineSessionBackgroundStop.js';
180
185
  export * from './model/catalog.js';
@@ -0,0 +1,22 @@
1
+ import { type InheritEnvWord, type TaskRequestLike } from './request/taskRequest.js';
2
+ export declare const INHERIT_ENV_MIN_SERVER: readonly [number, number, number];
3
+ export type InheritEnvServerSupport = 'supported' | 'unsupported' | 'unknown';
4
+ export declare function inheritEnvServerSupport(version: string | undefined): InheritEnvServerSupport;
5
+ export type InheritEnvWithheldCause = 'server_version_unknown' | 'server_too_old';
6
+ export interface InheritEnvWithheld {
7
+ readonly cause: InheritEnvWithheldCause;
8
+ readonly word: InheritEnvWord;
9
+ }
10
+ export interface InheritEnvDeclaration {
11
+ readonly field: {
12
+ readonly inheritEnv?: InheritEnvWord;
13
+ };
14
+ readonly withheld?: InheritEnvWithheld;
15
+ }
16
+ export declare function inheritEnvDeclaration(word: unknown, serverVersion: string | undefined): InheritEnvDeclaration;
17
+ export declare function inheritEnvWithheldNotice(withheld: InheritEnvWithheld): string;
18
+ export interface InheritEnvRefusalDetail {
19
+ readonly code: string;
20
+ }
21
+ export declare function inheritEnvRefusalFromError(err: unknown, sentRequest: TaskRequestLike | undefined): InheritEnvRefusalDetail | null;
22
+ export declare function inheritEnvRefusalContent(_detail: InheritEnvRefusalDetail): string;
@@ -0,0 +1,84 @@
1
+ import { INHERIT_ENV_WORDS, isInheritEnvWord } from './request/taskRequest.js';
2
+ import { settingsPermissionBucketRefusalFromError } from './wireRefusalCopy.js';
3
+ export const INHERIT_ENV_MIN_SERVER = Object.freeze([7, 106, 0]);
4
+ export function inheritEnvServerSupport(version) {
5
+ const mm = typeof version === 'string' ? /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)$/.exec(version) : null;
6
+ if (!mm)
7
+ return 'unknown';
8
+ const got = [Number(mm[1]), Number(mm[2]), Number(mm[3])];
9
+ for (let i = 0; i < 3; i++) {
10
+ const g = got[i];
11
+ const need = INHERIT_ENV_MIN_SERVER[i];
12
+ if (g !== need)
13
+ return g > need ? 'supported' : 'unsupported';
14
+ }
15
+ return 'supported';
16
+ }
17
+ const EMPTY_DECLARATION = Object.freeze({ field: Object.freeze({}) });
18
+ export function inheritEnvDeclaration(word, serverVersion) {
19
+ if (word === undefined || word === null)
20
+ return EMPTY_DECLARATION;
21
+ if (!isInheritEnvWord(word)) {
22
+ throw new TypeError(`inheritEnvDeclaration: inheritEnv 只接受 ${INHERIT_ENV_WORDS.map((w) => `'${w}'`).join(' / ')} 或缺席 —— 收到 ${Array.isArray(word) ? 'typeof=object / array' : `typeof=${typeof word}`}。坏词在版本判定之前就拒:「这一次不发」不许顺手吞掉一个打错字的声明。错误文本只报形状,不回显值。`);
23
+ }
24
+ const support = inheritEnvServerSupport(serverVersion);
25
+ if (support === 'supported')
26
+ return Object.freeze({ field: Object.freeze({ inheritEnv: word }) });
27
+ const cause = support === 'unsupported' ? 'server_too_old' : 'server_version_unknown';
28
+ return Object.freeze({ field: Object.freeze({}), withheld: Object.freeze({ cause, word }) });
29
+ }
30
+ const WITHHELD_NOTICES = Object.freeze({
31
+ server_too_old: Object.freeze({
32
+ all: "Not sent with this request: this engine is too old to accept the setting that lets the shell inherit this machine's whole environment, so this run's shell gets the default environment, with credential-like variables removed.",
33
+ scrub: 'Not sent with this request: this engine is too old to accept the default-environment setting, so it was left out; that has the same effect, because the default environment (credential-like variables removed) is what this run gets anyway.',
34
+ }),
35
+ server_version_unknown: Object.freeze({
36
+ all: "Not sent with this request: the engine's version is not known yet, and an engine that does not know the setting that lets the shell inherit this machine's whole environment refuses the whole request, so it was held back; this run's shell gets the default environment, with credential-like variables removed, and on an engine that does know the setting, leaving it out also clears an earlier whole-environment choice for this session.",
37
+ scrub: "Not sent with this request: the engine's version is not known yet, so the default-environment setting was left out; that has the same effect, because leaving it out also gives this run the default environment (credential-like variables removed).",
38
+ }),
39
+ });
40
+ const WITHHELD_UNKNOWN_NOTICE = 'Not sent with this request: the shell-environment setting was held back for a reason this version does not recognize.';
41
+ export function inheritEnvWithheldNotice(withheld) {
42
+ try {
43
+ if (typeof withheld !== 'object' || withheld === null)
44
+ return WITHHELD_UNKNOWN_NOTICE;
45
+ const cause = withheld.cause;
46
+ const word = withheld.word;
47
+ if (typeof cause !== 'string' || !Object.hasOwn(WITHHELD_NOTICES, cause) || !isInheritEnvWord(word))
48
+ return WITHHELD_UNKNOWN_NOTICE;
49
+ return WITHHELD_NOTICES[cause][word];
50
+ }
51
+ catch {
52
+ return WITHHELD_UNKNOWN_NOTICE;
53
+ }
54
+ }
55
+ const FIELD_INVALID = 'request.field_invalid';
56
+ function readGuarded(o, key) {
57
+ if (typeof o !== 'object' || o === null)
58
+ return undefined;
59
+ try {
60
+ return o[key];
61
+ }
62
+ catch {
63
+ return undefined;
64
+ }
65
+ }
66
+ export function inheritEnvRefusalFromError(err, sentRequest) {
67
+ try {
68
+ if (readGuarded(sentRequest, 'inheritEnv') !== 'all')
69
+ return null;
70
+ if (readGuarded(err, 'errorCode') !== FIELD_INVALID)
71
+ return null;
72
+ if (settingsPermissionBucketRefusalFromError(err) !== null)
73
+ return null;
74
+ return Object.freeze({ code: FIELD_INVALID });
75
+ }
76
+ catch {
77
+ return null;
78
+ }
79
+ }
80
+ const REFUSAL_NOT_ACCEPTED = 'The engine refused this request as invalid without naming the field · ' +
81
+ "This request asked for the shell to inherit this machine's whole environment, which the engine accepts only when tools run directly on its own machine and the request belongs to a session; if that is what it refused, send it again without that setting (or with the default)";
82
+ export function inheritEnvRefusalContent(_detail) {
83
+ return REFUSAL_NOT_ACCEPTED;
84
+ }
@@ -1,4 +1,5 @@
1
1
  import { applyDisplayFace, LEGACY_NAME_FACE } from './displayUntrusted.js';
2
+ import { CORE_ENGINE_AUTHORITY_ENVELOPE_TAGS } from './generated/engineFactTables.js';
2
3
  const WIRE_KEY_FROM = 'from';
3
4
  const WIRE_KEY_BODY = 'body';
4
5
  const WIRE_KEY_KIND = 'kind';
@@ -107,16 +108,7 @@ export function classifyPeerNotification(n) {
107
108
  }
108
109
  return null;
109
110
  }
110
- const AUTHORITY_ENVELOPE_TAGS = Object.freeze([
111
- 'system-reminder',
112
- 'task-notification',
113
- 'new-diagnostics',
114
- 'user_memory',
115
- 'scope',
116
- 'skills',
117
- 'total_tokens',
118
- 'instruction-files',
119
- ]);
111
+ const AUTHORITY_ENVELOPE_TAGS = CORE_ENGINE_AUTHORITY_ENVELOPE_TAGS;
120
112
  const ZWSP = String.fromCharCode(0x200b);
121
113
  const AUTHORITY_BREAKOUT_RE = new RegExp(`<\\s*\\/?\\s*(?:${AUTHORITY_ENVELOPE_TAGS.map(t => t.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')).join('|')})(?:\\s[^>]*)?>`, 'gi');
122
114
  function neutralizeAuthorityTags(text) {
@@ -28,6 +28,12 @@ export declare function printInitRosterSignal(message: SDKMessage): PrintInitRos
28
28
  export declare function decidePrintInitToolFace(signal: Exclude<PrintInitRosterSignal, {
29
29
  kind: 'pending';
30
30
  }>, fallback: LiveInitToolFace | null): PrintInitToolFace | null;
31
+ export type PrintInitToolsSource = 'engine-roster' | 'estimate' | 'host-static';
32
+ export interface PrintInitToolFaceSupersetKeys {
33
+ _sema_tools_source: PrintInitToolsSource;
34
+ _sema_tools_fallback_reason?: PrintInitRosterFallbackReason;
35
+ }
36
+ export declare function printInitToolFaceSupersetKeys(face: PrintInitToolFace | null): PrintInitToolFaceSupersetKeys;
31
37
  export declare function printInitToolFaceDebugLine(face: PrintInitToolFace | null): string;
32
38
  export type PrintInitGateStep = {
33
39
  kind: 'hold';
@@ -36,8 +36,9 @@ export function decidePrintInitToolFace(signal, fallback) {
36
36
  const tools = fallback === null ? undefined : fallback.tools;
37
37
  if (fallback === null || !Array.isArray(tools))
38
38
  return null;
39
+ const assembly = fallback.source;
39
40
  return {
40
- source: fallback.source,
41
+ source: assembly === 'scenario-probe' ? 'scenario-probe' : 'wire-vocabulary',
41
42
  tools: tools.flatMap((t) => {
42
43
  const name = typeof t === 'object' && t !== null ? t.name : undefined;
43
44
  return typeof name === 'string' ? [{ name }] : [];
@@ -45,6 +46,116 @@ export function decidePrintInitToolFace(signal, fallback) {
45
46
  fallbackReason: signal.reason,
46
47
  };
47
48
  }
49
+ const TOOLS_SOURCE_KEY = '_sema_tools_source';
50
+ const TOOLS_FALLBACK_REASON_KEY = '_sema_tools_fallback_reason';
51
+ const FALLBACK_REASONS = ['manifest-without-roster', 'model-activity-first', 'run-ended', 'wait-timeout'];
52
+ export function printInitToolFaceSupersetKeys(face) {
53
+ const f = face;
54
+ if (typeof f !== 'object' || f === null)
55
+ return { _sema_tools_source: 'host-static' };
56
+ let source;
57
+ try {
58
+ source = f.source;
59
+ }
60
+ catch {
61
+ source = undefined;
62
+ }
63
+ let reason;
64
+ let reasonRead = true;
65
+ try {
66
+ reason = f.fallbackReason;
67
+ }
68
+ catch {
69
+ reason = undefined;
70
+ reasonRead = false;
71
+ }
72
+ if (source === 'engine-roster' && reasonRead && reason === undefined)
73
+ return { _sema_tools_source: 'engine-roster' };
74
+ return typeof reason === 'string' && FALLBACK_REASONS.includes(reason)
75
+ ? { _sema_tools_source: 'estimate', _sema_tools_fallback_reason: reason }
76
+ : { _sema_tools_source: 'estimate' };
77
+ }
78
+ const PROTO_WALK_MAX = 64;
79
+ function snapshotStampKeys(rec) {
80
+ try {
81
+ const saved = [];
82
+ for (const key of [TOOLS_SOURCE_KEY, TOOLS_FALLBACK_REASON_KEY]) {
83
+ let own;
84
+ let o = rec;
85
+ for (let depth = 0; o !== null; depth++) {
86
+ if (depth >= PROTO_WALK_MAX)
87
+ return undefined;
88
+ const d = Reflect.getOwnPropertyDescriptor(o, key);
89
+ if (d !== undefined) {
90
+ if ('get' in d || 'set' in d)
91
+ return undefined;
92
+ if (depth === 0)
93
+ own = d;
94
+ break;
95
+ }
96
+ o = Reflect.getPrototypeOf(o);
97
+ }
98
+ saved.push({ key, own });
99
+ }
100
+ return { keys: saved, extensible: Reflect.isExtensible(rec) };
101
+ }
102
+ catch {
103
+ return undefined;
104
+ }
105
+ }
106
+ function restoreStampKeys(rec, saved) {
107
+ let clean = true;
108
+ for (const s of saved) {
109
+ try {
110
+ const now = Reflect.getOwnPropertyDescriptor(rec, s.key);
111
+ let ok = true;
112
+ if (s.own !== undefined) {
113
+ if (now === undefined)
114
+ ok = Reflect.defineProperty(rec, s.key, s.own);
115
+ else if (!('value' in now) || !Object.is(now.value, s.own.value))
116
+ ok = Reflect.set(rec, s.key, s.own.value);
117
+ }
118
+ else if (now !== undefined) {
119
+ ok = Reflect.deleteProperty(rec, s.key);
120
+ }
121
+ if (!ok)
122
+ clean = false;
123
+ }
124
+ catch {
125
+ clean = false;
126
+ }
127
+ }
128
+ return clean;
129
+ }
130
+ function stampPrintInitToolFaceKeys(frame, face) {
131
+ if (typeof frame !== 'object' || frame === null || Array.isArray(frame))
132
+ return;
133
+ const keys = printInitToolFaceSupersetKeys(face);
134
+ const rec = frame;
135
+ const snap = snapshotStampKeys(rec);
136
+ if (snap === undefined)
137
+ return;
138
+ const saved = snap.keys;
139
+ const hadSource = saved[0]?.own !== undefined;
140
+ const hadReason = saved[1]?.own !== undefined;
141
+ const reason = keys._sema_tools_fallback_reason;
142
+ if (!snap.extensible && (!hadSource || (reason !== undefined && !hadReason)))
143
+ return;
144
+ const writeSource = () => Reflect.set(rec, TOOLS_SOURCE_KEY, keys._sema_tools_source);
145
+ const writeReason = () => reason !== undefined ? Reflect.set(rec, TOOLS_FALLBACK_REASON_KEY, reason) : !hadReason || Reflect.deleteProperty(rec, TOOLS_FALLBACK_REASON_KEY);
146
+ const steps = reason === undefined && hadReason && !hadSource ? [writeReason, writeSource] : [writeSource, writeReason];
147
+ try {
148
+ for (const step of steps) {
149
+ if (!step()) {
150
+ restoreStampKeys(rec, saved);
151
+ return;
152
+ }
153
+ }
154
+ }
155
+ catch {
156
+ restoreStampKeys(rec, saved);
157
+ }
158
+ }
48
159
  export function printInitToolFaceDebugLine(face) {
49
160
  if (face === null) {
50
161
  return "init tools: the host's static list — no tool roster arrived and no estimate was available";
@@ -121,7 +232,9 @@ export async function* withPrintInitFrame(source, opts) {
121
232
  }
122
233
  catch {
123
234
  }
124
- yield await opts.buildInit(step.face);
235
+ const init = await opts.buildInit(step.face);
236
+ stampPrintInitToolFaceKeys(init, step.face);
237
+ yield init;
125
238
  for (const m of step.messages)
126
239
  yield m;
127
240
  };
@@ -0,0 +1,2 @@
1
+ export declare function isReadCredentialRefusal(e: unknown): boolean;
2
+ export declare const READ_CREDENTIAL_NOT_ACCEPTED_NOTICE = "This engine requires a credential to show this, and this client did not present one it accepts.";
@@ -0,0 +1,7 @@
1
+ import { wireFailureShapeOf } from './wireFailureShape.js';
2
+ const AUTH_UNAUTHORIZED = 'auth.unauthorized';
3
+ export function isReadCredentialRefusal(e) {
4
+ const { status, errorCode } = wireFailureShapeOf(e);
5
+ return status === 401 && (errorCode === undefined || errorCode === '' || errorCode === AUTH_UNAUTHORIZED);
6
+ }
7
+ export const READ_CREDENTIAL_NOT_ACCEPTED_NOTICE = 'This engine requires a credential to show this, and this client did not present one it accepts.';
@@ -48,8 +48,8 @@ export interface TaskRequestInput {
48
48
  maxThinkingTokens?: number;
49
49
  memoryCapture?: 'off';
50
50
  memory?: 'off';
51
- approverPosture?: NonNullable<TaskRequest['approverPosture']>;
52
51
  fileHistory?: 'disabled';
52
+ inheritEnv?: InheritEnvWord;
53
53
  rewind?: Record<string, unknown>;
54
54
  repo?: string;
55
55
  council?: boolean;
@@ -101,11 +101,10 @@ export declare const MEMORY_OFF: "off";
101
101
  export declare function memoryOffDeclarationField(declared: boolean): {
102
102
  memory: 'off';
103
103
  } | Record<string, never>;
104
- export declare const APPROVER_POSTURE_BYPASS: "bypass";
105
- export declare function approverPostureDeclarationField(declared: boolean): {
106
- approverPosture: 'bypass';
107
- } | Record<string, never>;
108
104
  export declare const FILE_HISTORY_DISABLED: "disabled";
105
+ export declare const INHERIT_ENV_WORDS: readonly ["all", "scrub"];
106
+ export type InheritEnvWord = (typeof INHERIT_ENV_WORDS)[number];
107
+ export declare function isInheritEnvWord(v: unknown): v is InheritEnvWord;
109
108
  export declare function memoryOffDeclared(input: {
110
109
  flag?: unknown;
111
110
  settingsMemory?: unknown;