@sema-agent/client-core 0.104.1 → 0.105.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 (86) hide show
  1. package/CHANGELOG.md +90 -0
  2. package/README.md +11 -4
  3. package/dist/adapt/arms.js +14 -6
  4. package/dist/adapter/activeRunSelfHeal.d.ts +1 -0
  5. package/dist/adapter/activeRunSelfHeal.js +10 -5
  6. package/dist/adapter/downstream/eventToSdkMessage.js +4 -4
  7. package/dist/adapter/downstream/wiringManifestView.d.ts +6 -0
  8. package/dist/adapter/downstream/wiringManifestView.js +25 -0
  9. package/dist/adapter/runStream.js +5 -1
  10. package/dist/cloudConfigWireCaps.js +3 -0
  11. package/dist/compensations.js +6 -6
  12. package/dist/coreValuePorts.d.ts +3 -1
  13. package/dist/coreValuePorts.js +4 -0
  14. package/dist/displayUntrusted.d.ts +4 -2
  15. package/dist/displayUntrusted.js +45 -22
  16. package/dist/engineGenerationPort.d.ts +11 -2
  17. package/dist/engineGenerationPort.js +63 -9
  18. package/dist/engineHealthFacts.d.ts +5 -0
  19. package/dist/engineHealthFacts.js +11 -0
  20. package/dist/eventLeg.d.ts +1 -1
  21. package/dist/eventLeg.js +23 -3
  22. package/dist/generated/engineFactTables.d.ts +1 -0
  23. package/dist/generated/engineFactTables.js +1 -0
  24. package/dist/generated/sdkFactTables.d.ts +2 -0
  25. package/dist/generated/sdkFactTables.js +9 -0
  26. package/dist/headlessReconnectWire.js +31 -4
  27. package/dist/hitl/askGateWire.js +26 -2
  28. package/dist/hitl/frameRouter.d.ts +4 -0
  29. package/dist/hitl/frameRouter.js +14 -0
  30. package/dist/hitl/gateIdentity.d.ts +1 -0
  31. package/dist/hitl/gateIdentity.js +3 -0
  32. package/dist/hitl/planReviewCard.d.ts +21 -0
  33. package/dist/hitl/planReviewCard.js +229 -0
  34. package/dist/hitl/planReviewWire.d.ts +38 -13
  35. package/dist/hitl/planReviewWire.js +355 -133
  36. package/dist/hostSettingsSource.d.ts +1 -1
  37. package/dist/hostSettingsSource.js +8 -4
  38. package/dist/hostTurnSettings.d.ts +1 -1
  39. package/dist/hostTurnSettings.js +29 -10
  40. package/dist/i18n/messages.en.d.ts +50 -0
  41. package/dist/i18n/messages.en.js +50 -0
  42. package/dist/i18n/messages.zh.js +51 -0
  43. package/dist/index.d.ts +15 -3
  44. package/dist/index.js +9 -1
  45. package/dist/mcpTransportKindsCapability.d.ts +18 -0
  46. package/dist/mcpTransportKindsCapability.js +75 -0
  47. package/dist/mcpWireCaps.d.ts +4 -1
  48. package/dist/mcpWireCaps.js +24 -13
  49. package/dist/notifications.d.ts +9 -0
  50. package/dist/notifications.js +11 -2
  51. package/dist/ownKey.d.ts +4 -0
  52. package/dist/ownKey.js +8 -0
  53. package/dist/permissionModeWriteCapability.d.ts +13 -0
  54. package/dist/permissionModeWriteCapability.js +35 -0
  55. package/dist/permissionsAllowGrantCapability.d.ts +3 -0
  56. package/dist/permissionsAllowGrantCapability.js +26 -3
  57. package/dist/permissionsDeclaration.d.ts +23 -1
  58. package/dist/permissionsDeclaration.js +60 -30
  59. package/dist/planReviewCardFacts.d.ts +116 -0
  60. package/dist/planReviewCardFacts.js +469 -0
  61. package/dist/reattachWindow.d.ts +8 -1
  62. package/dist/reattachWindow.js +44 -12
  63. package/dist/runFollow.d.ts +30 -0
  64. package/dist/runFollow.js +117 -0
  65. package/dist/runLedgerSnapshot.d.ts +20 -0
  66. package/dist/runLedgerSnapshot.js +272 -0
  67. package/dist/runPermissionModeSwitch.d.ts +57 -0
  68. package/dist/runPermissionModeSwitch.js +135 -0
  69. package/dist/runReattachPolicy.d.ts +13 -5
  70. package/dist/runReattachPolicy.js +58 -23
  71. package/dist/seam.d.ts +3 -0
  72. package/dist/seam.js +1 -1
  73. package/dist/seatContract.js +1 -0
  74. package/dist/sessionMemoryErase.d.ts +1 -1
  75. package/dist/sessionMemoryErase.js +5 -0
  76. package/dist/sessionMemoryStatus.d.ts +27 -1
  77. package/dist/sessionMemoryStatus.js +117 -0
  78. package/dist/sseIdleTriage.d.ts +3 -1
  79. package/dist/sseIdleTriage.js +19 -4
  80. package/dist/subagent/engineSubagentTail.js +2 -0
  81. package/dist/subagentContentStore.d.ts +3 -0
  82. package/dist/subagentContentStore.js +10 -1
  83. package/dist/turnFailurePresentation.d.ts +5 -2
  84. package/dist/turnFailurePresentation.js +12 -4
  85. package/docs/INTEGRATION-CLIENTS.md +493 -10
  86. package/package.json +2 -2
@@ -11,6 +11,7 @@ export type SubagentContentItem = {
11
11
  input: unknown;
12
12
  output?: string;
13
13
  isError?: boolean;
14
+ notExecuted?: true;
14
15
  } | {
15
16
  kind: 'echo';
16
17
  text: string;
@@ -31,6 +32,7 @@ export interface SubagentContentEvent {
31
32
  args?: unknown;
32
33
  output?: string | undefined;
33
34
  isError?: boolean | undefined;
35
+ notExecuted?: true | undefined;
34
36
  }
35
37
  export declare function coerceOutput(v: unknown): string | undefined;
36
38
  export declare function subagentContentEventOf(ev: {
@@ -82,6 +84,7 @@ export type SubagentViewSlot = {
82
84
  input: unknown;
83
85
  output?: string;
84
86
  isError?: boolean;
87
+ notExecuted?: true;
85
88
  };
86
89
  export declare function planSubagentViewSlots(taskId: string): SubagentViewSlot[];
87
90
  export declare function parentToolCallIdOf(taskId: string): string | undefined;
@@ -1,4 +1,5 @@
1
1
  import { DEFAULT_SESSION_KEY } from './sessionSlot.js';
2
+ import { readFrameTrueMark } from './ownKey.js';
2
3
  import { toolEndOutputText } from './toolResultContent.js';
3
4
  export function coerceOutput(v) {
4
5
  return toolEndOutputText(v);
@@ -23,6 +24,7 @@ export function subagentContentEventOf(ev) {
23
24
  args: sub.args,
24
25
  output: coerceOutput(sub.output),
25
26
  isError: sub.isError,
27
+ notExecuted: readFrameTrueMark(sub, 'notExecuted') ? true : undefined,
26
28
  };
27
29
  }
28
30
  const MAX_ITEMS_PER_TASK = 200;
@@ -567,12 +569,17 @@ export function publishSubagentContentEvent(ev) {
567
569
  const before = itemBytesOf(it);
568
570
  const outBefore = it.output;
569
571
  const errBefore = it.isError;
572
+ const notExecBefore = it.notExecuted;
570
573
  it.output = ev.output ?? '';
571
574
  it.isError = ev.isError === true;
575
+ if (ev.notExecuted === true)
576
+ it.notExecuted = true;
577
+ else
578
+ delete it.notExecuted;
572
579
  const delta = itemBytesOf(it) - before;
573
580
  s.itemBytes[at] = (s.itemBytes[at] ?? 0) + delta;
574
581
  addBytes(s, delta);
575
- stampPhase(s, it.id, 'end', ev.eventId, it.output !== outBefore || it.isError !== errBefore);
582
+ stampPhase(s, it.id, 'end', ev.eventId, it.output !== outBefore || it.isError !== errBefore || it.notExecuted !== notExecBefore);
576
583
  break;
577
584
  }
578
585
  const synthId = id ?? `${ev.taskId}-tool-${s.items.length}`;
@@ -583,6 +590,7 @@ export function publishSubagentContentEvent(ev) {
583
590
  input: ev.args ?? {},
584
591
  output: ev.output ?? '',
585
592
  isError: ev.isError === true,
593
+ ...(ev.notExecuted === true ? { notExecuted: true } : {}),
586
594
  });
587
595
  recordCut(s);
588
596
  stampPhase(s, synthId, 'end', ev.eventId, true);
@@ -626,6 +634,7 @@ export function planSubagentViewSlots(taskId) {
626
634
  input: it.input,
627
635
  ...(it.output !== undefined ? { output: it.output } : {}),
628
636
  ...(it.isError === true ? { isError: true } : {}),
637
+ ...(it.notExecuted === true ? { notExecuted: true } : {}),
629
638
  });
630
639
  }
631
640
  else if (it.kind === 'text') {
@@ -4,10 +4,13 @@ import { type LiveModelCatalog } from './liveModelCatalog.js';
4
4
  import type { TaskRequestLike } from './request/taskRequest.js';
5
5
  export type TurnFailureCategory = 'auth' | 'billing' | 'rate_limited' | 'invalid_request' | 'capability_unavailable' | 'timeout' | 'server_error' | 'connection_lost' | 'parked' | 'internal';
6
6
  export declare const TURN_FAILURE_CATEGORIES: readonly TurnFailureCategory[];
7
- export interface TurnFailureRetry {
7
+ export type TurnFailureRetry = {
8
8
  readonly offer: boolean;
9
9
  readonly basis: 'wire' | 'category';
10
- }
10
+ } | {
11
+ readonly offer: false;
12
+ readonly basis: 'not_followed';
13
+ };
11
14
  export interface TurnFailurePresentation {
12
15
  readonly category: TurnFailureCategory;
13
16
  readonly kind: TurnWireErrorVerdict['kind'];
@@ -1,6 +1,7 @@
1
1
  import { msg, renderMessage } from './i18n/translate.js';
2
2
  import { classifyTurnWireError, isPreStreamDrainingReject } from './wireErrorTriage.js';
3
3
  import { isSseIdleError } from './sseIdleTriage.js';
4
+ import { runNotFollowedOf } from './runFollow.js';
4
5
  import { isCodeClassifiedGateFailure } from './gateFailureCodes.js';
5
6
  import { CORRUPT_ROW_ERROR_CODE, CORRUPT_SESSION_ERROR_CODE, MEMORY_CONTROL_PLANE_CORRUPT, SCENARIO_ASSIGNMENT_UNKNOWN_ERROR_CODE } from './engineErrorCodes.js';
6
7
  import { admissionWallRefusalContent, admissionWallRefusalFromError, bodyShapeRefusalFromError, bodyShapeRefusalTouchesSettings, fleetLeaseUnavailableContent, fleetLeaseUnavailableFromError, hostPostureRefusalContent, hostPostureRefusalFromError, fieldLimitRefusalContent, fieldLimitRefusalFromError, toolDeclarationRefusalContent, toolDeclarationRefusalFromError, usageWindowExhaustedContent, usageWindowExhaustedFromError, quotaExhaustedContent, quotaExhaustedFromError, userAttachmentRefusalFromError, } from './wireRefusalCopy.js';
@@ -158,7 +159,12 @@ export function turnFailurePresentation(err, evidence, notesCtx, lang) {
158
159
  const status = verdict.kind === 'http' ? verdict.status : undefined;
159
160
  const errorCode = verdict.kind === 'http' ? httpCode : undefined;
160
161
  const wireRetriable = readThrownSlot(subject, 'retriable', 'data') === true && !isCodeClassifiedGateFailure(errorCode, true);
161
- const retry = wireRetriable && shape.category !== 'parked' ? { offer: true, basis: 'wire' } : { offer: shape.offer, basis: 'category' };
162
+ const notFollowed = runNotFollowedOf(err) !== undefined;
163
+ const retry = notFollowed
164
+ ? { offer: false, basis: 'not_followed' }
165
+ : wireRetriable && shape.category !== 'parked'
166
+ ? { offer: true, basis: 'wire' }
167
+ : { offer: shape.offer, basis: 'category' };
162
168
  const waitSec = waitSecOf(subject);
163
169
  const chain = turnFailureNotesOf(subject, verdict, notesCtx, waitSec, lang);
164
170
  const headline = headlineKey !== undefined ? renderMessage(msg(headlineKey), lang) : undefined;
@@ -298,7 +304,7 @@ export function seatTurnFailureOf(err, evidence) {
298
304
  const p = turnFailurePresentation(err, evidence);
299
305
  return {
300
306
  category: p.category,
301
- retry: { offer: p.retry.offer, basis: p.retry.basis },
307
+ retry: p.retry.basis === 'not_followed' ? { offer: false, basis: 'not_followed' } : { offer: p.retry.offer, basis: p.retry.basis },
302
308
  ...(p.waitSec !== undefined ? { waitSec: p.waitSec } : {}),
303
309
  ...(p.headline !== undefined ? { headline: p.headline } : {}),
304
310
  ...(p.errorCode !== undefined ? { errorCode: p.errorCode } : {}),
@@ -333,7 +339,9 @@ function seatTurnFailureShapeOf(event) {
333
339
  return undefined;
334
340
  const offer = seatDataField(retry, 'offer');
335
341
  const basis = seatDataField(retry, 'basis');
336
- if (typeof offer !== 'boolean' || (basis !== 'wire' && basis !== 'category'))
342
+ if (typeof offer !== 'boolean' || (basis !== 'wire' && basis !== 'category' && basis !== 'not_followed'))
343
+ return undefined;
344
+ if (basis === 'not_followed' && offer !== false)
337
345
  return undefined;
338
346
  const waitSec = seatDataField(raw, 'waitSec');
339
347
  if (waitSec !== undefined && !(typeof waitSec === 'number' && Number.isInteger(waitSec) && waitSec >= 1))
@@ -346,7 +354,7 @@ function seatTurnFailureShapeOf(event) {
346
354
  return undefined;
347
355
  return Object.freeze({
348
356
  category: category,
349
- retry: Object.freeze({ offer, basis }),
357
+ retry: Object.freeze(basis === 'not_followed' ? { offer: false, basis } : { offer, basis }),
350
358
  ...(waitSec !== undefined ? { waitSec } : {}),
351
359
  ...(headline !== undefined ? { headline } : {}),
352
360
  ...(errorCode !== undefined ? { errorCode } : {}),