@sema-agent/client-core 0.111.0 → 0.112.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 (106) hide show
  1. package/CHANGELOG.md +75 -0
  2. package/README.md +15 -6
  3. package/dist/agentSession/engineSessionBackgroundStop.js +2 -2
  4. package/dist/checkpointRowVerdict.d.ts +3 -0
  5. package/dist/checkpointRowVerdict.js +14 -1
  6. package/dist/consoleCaPin.d.ts +136 -0
  7. package/dist/consoleCaPin.js +827 -0
  8. package/dist/decideReceipt.d.ts +2 -1
  9. package/dist/deviceRebind.js +3 -3
  10. package/dist/effectiveFacts.d.ts +9 -0
  11. package/dist/effectiveFacts.js +33 -0
  12. package/dist/engineAddress.d.ts +1 -0
  13. package/dist/engineAddress.js +4 -1
  14. package/dist/engineCredentialRelease.d.ts +54 -0
  15. package/dist/engineCredentialRelease.js +146 -0
  16. package/dist/engineErrorCodes.d.ts +1 -0
  17. package/dist/engineErrorCodes.js +1 -0
  18. package/dist/engineHealthFacts.d.ts +0 -11
  19. package/dist/engineHealthFacts.js +0 -21
  20. package/dist/engineHealthProbeVerdict.d.ts +1 -0
  21. package/dist/engineHealthProbeVerdict.js +21 -13
  22. package/dist/engineUnavailable.d.ts +3 -2
  23. package/dist/engineUnavailable.js +16 -12
  24. package/dist/engineUrl.js +4 -2
  25. package/dist/gateFailureCodes.js +2 -2
  26. package/dist/generated/sdkFactTables.d.ts +1 -0
  27. package/dist/generated/sdkFactTables.js +13 -0
  28. package/dist/generated/settingsSchemaFns.d.ts +1 -0
  29. package/dist/generated/settingsSchemaFns.js +3 -0
  30. package/dist/generated/settingsSchemaHooksClassifier.js +38 -9
  31. package/dist/generated/settingsSchemaTables.d.ts +52 -0
  32. package/dist/generated/settingsSchemaTables.js +18 -0
  33. package/dist/generated/settingsSchemaTypes.d.ts +23 -13
  34. package/dist/generated/settingsSchemaUrlShape.d.ts +1 -0
  35. package/dist/generated/settingsSchemaUrlShape.js +17 -0
  36. package/dist/hitl/decisionRefusal.d.ts +4 -0
  37. package/dist/hitl/decisionRefusal.js +12 -2
  38. package/dist/hitl/localAllowRedemption.d.ts +9 -6
  39. package/dist/hitl/localAllowRedemption.js +20 -0
  40. package/dist/hitl/parkOwnership.js +2 -1
  41. package/dist/hitl/parkResolver.js +7 -0
  42. package/dist/hitl/screenDecisionCards.js +3 -2
  43. package/dist/hitl/sessionPolicyWire.js +2 -2
  44. package/dist/hitl/standingRows.d.ts +4 -2
  45. package/dist/hitl/standingRows.js +10 -3
  46. package/dist/hooksReaderGenerations.js +1 -1
  47. package/dist/i18n/messages.en.d.ts +163 -0
  48. package/dist/i18n/messages.en.js +163 -0
  49. package/dist/i18n/messages.zh.js +174 -0
  50. package/dist/index.d.ts +30 -5
  51. package/dist/index.js +15 -2
  52. package/dist/liveModelCatalog.d.ts +4 -0
  53. package/dist/liveModelCatalog.js +10 -1
  54. package/dist/localConfig/documents.d.ts +61 -0
  55. package/dist/localConfig/documents.js +51 -0
  56. package/dist/localConfig/kernel.d.ts +149 -0
  57. package/dist/localConfig/kernel.js +597 -0
  58. package/dist/localConfig/mcp/edit.d.ts +161 -0
  59. package/dist/localConfig/mcp/edit.js +846 -0
  60. package/dist/localConfig/mcp/servers.d.ts +165 -0
  61. package/dist/localConfig/mcp/servers.js +776 -0
  62. package/dist/localConfig/mcp/views.d.ts +170 -0
  63. package/dist/localConfig/mcp/views.js +429 -0
  64. package/dist/localConfig/modelPool.d.ts +262 -0
  65. package/dist/localConfig/modelPool.js +1489 -0
  66. package/dist/localConfig/modelPoolWords.d.ts +13 -0
  67. package/dist/localConfig/modelPoolWords.js +20 -0
  68. package/dist/localConfig/receiptShape.d.ts +7 -0
  69. package/dist/localConfig/receiptShape.js +135 -0
  70. package/dist/localConfig/settingsWrite.d.ts +127 -0
  71. package/dist/localConfig/settingsWrite.js +237 -0
  72. package/dist/localConfig/skills.d.ts +124 -0
  73. package/dist/localConfig/skills.js +397 -0
  74. package/dist/localConfig/skillsWords.d.ts +10 -0
  75. package/dist/localConfig/skillsWords.js +5 -0
  76. package/dist/mcpProbeWire.js +2 -1
  77. package/dist/mcpWireCaps.js +1 -1
  78. package/dist/memoryVerbsWire.js +3 -2
  79. package/dist/model/onboardJudgement.d.ts +14 -4
  80. package/dist/model/onboardJudgement.js +91 -139
  81. package/dist/modelConfigGapNotice.d.ts +20 -0
  82. package/dist/modelConfigGapNotice.js +102 -0
  83. package/dist/modsKernelIdentity.js +2 -47
  84. package/dist/ownKey.d.ts +1 -0
  85. package/dist/ownKey.js +40 -8
  86. package/dist/permissionsDeclaration.d.ts +2 -1
  87. package/dist/permissionsDeclaration.js +31 -17
  88. package/dist/promptBlockedCopy.js +2 -2
  89. package/dist/resumeRefusalCopy.d.ts +3 -1
  90. package/dist/resumeRefusalCopy.js +12 -4
  91. package/dist/runLedgerSnapshot.js +3 -3
  92. package/dist/runPermissionModeSwitch.js +2 -3
  93. package/dist/seatContract.d.ts +154 -4
  94. package/dist/seatContract.js +228 -2
  95. package/dist/sessionIdSegment.d.ts +1 -0
  96. package/dist/sessionIdSegment.js +4 -1
  97. package/dist/sessionMemoryErase.js +2 -1
  98. package/dist/sha256Bytes.d.ts +1 -0
  99. package/dist/sha256Bytes.js +46 -0
  100. package/dist/skillOverrideChain.d.ts +83 -0
  101. package/dist/skillOverrideChain.js +378 -0
  102. package/dist/skillsWireCaps.d.ts +3 -0
  103. package/dist/skillsWireCaps.js +16 -1
  104. package/dist/turnFailurePresentation.js +4 -10
  105. package/docs/INTEGRATION-CLIENTS.md +614 -14
  106. package/package.json +3 -3
@@ -5,6 +5,7 @@ import { allowRulesGate, allowWireForm } from './permissionsAllowGrantCapability
5
5
  import { SETTINGS_IS_AT_LEAST } from './generated/settingsSchemaFns.js';
6
6
  import { THROWN_SLOT_UNREADABLE, asAssemblyRefusal, assemblyRefusalOf, isSlotCarrier, readThrownSlot, withAssemblyRefusal } from './wireFailureShape.js';
7
7
  import { appendOwnElement } from './ownKey.js';
8
+ import { msg, renderMessage } from './i18n/translate.js';
8
9
  const SETTINGS_SOURCE_TIERS = Object.freeze({
9
10
  policySettings: 'managed',
10
11
  flagSettings: 'global',
@@ -530,7 +531,24 @@ function allowHeldBySettingsReadCount(report) {
530
531
  }
531
532
  return n;
532
533
  }
533
- export function permissionsAllowKeptNotice(report, settingsRead, facts) {
534
+ const ALLOW_KEPT_MANAGED_KEYS = Object.freeze({
535
+ in_progress: Object.freeze({ one: 'session.hostSettings.allowKept.managed.inProgress.one', other: 'session.hostSettings.allowKept.managed.inProgress.other' }),
536
+ failed: Object.freeze({ one: 'session.hostSettings.allowKept.managed.failed.one', other: 'session.hostSettings.allowKept.managed.failed.other' }),
537
+ unknown: Object.freeze({ one: 'session.hostSettings.allowKept.managed.unknown.one', other: 'session.hostSettings.allowKept.managed.unknown.other' }),
538
+ });
539
+ const ALLOW_KEPT_GENERIC_KEYS = Object.freeze({
540
+ one: 'session.hostSettings.allowKept.generic.one',
541
+ other: 'session.hostSettings.allowKept.generic.other',
542
+ });
543
+ const ALLOW_KEPT_COUNTED_KEYS = Object.freeze({
544
+ one: 'session.hostSettings.allowKept.why.counted.one',
545
+ other: 'session.hostSettings.allowKept.why.counted.other',
546
+ });
547
+ const ALLOW_KEPT_COUNTED_WHERE_KEYS = Object.freeze({
548
+ one: 'session.hostSettings.allowKept.why.countedWhere.one',
549
+ other: 'session.hostSettings.allowKept.why.countedWhere.other',
550
+ });
551
+ export function permissionsAllowKeptNotice(report, settingsRead, facts, lang) {
534
552
  const held = allowHeldBySettingsReadCount(report);
535
553
  if (held <= 0)
536
554
  return undefined;
@@ -547,22 +565,18 @@ export function permissionsAllowKeptNotice(report, settingsRead, facts) {
547
565
  const fetchState = rawFetch === 'in_progress' || rawFetch === 'failed' ? rawFetch : 'unknown';
548
566
  const count = typeof rawCount === 'number' && Number.isInteger(rawCount) && rawCount >= 1 ? rawCount : undefined;
549
567
  const where = typeof rawWhere === 'string' && rawWhere.length >= 1 && rawWhere.length <= 200 && !/\p{Cc}/u.test(rawWhere) ? rawWhere : undefined;
550
- const head = `${String(held)} permissions.allow rule${held === 1 ? ' was' : 's were'} not sent to the engine for this run because `;
568
+ const plural = held === 1 ? 'one' : 'other';
551
569
  if (settingsRead === 'partial' && managedPending && count === 1) {
552
- if (fetchState === 'in_progress') {
553
- return (`${head}the managed policy for your account has not been received yet (sema keeps fetching it; allow rules apply once it arrives). ` +
554
- 'Run again once it has been received (deny and ask rules, and rules given with --allowedTools, are still sent).');
555
- }
556
- if (fetchState === 'failed') {
557
- return (`${head}the managed policy for your account has not been received yet (this run will not fetch again; the next run retries). ` +
558
- 'Run again to retry fetching it (deny and ask rules, and rules given with --allowedTools, are still sent).');
559
- }
560
- return (`${head}the managed policy for your account has not been received yet. ` +
561
- 'Run again once it has been received (deny and ask rules, and rules given with --allowedTools, are still sent).');
570
+ return renderMessage(msg(ALLOW_KEPT_MANAGED_KEYS[fetchState][plural], { held }), lang);
562
571
  }
563
- const why = settingsRead === 'partial'
564
- ? `the settings read reported ${count === undefined ? 'problems' : `${String(count)} problem${count === 1 ? '' : 's'}`}${where === undefined ? '' : ` (${where})`}`
565
- : 'the health of this settings read could not be checked';
566
- return (`${head}${why}; an allow rule from a settings file is only sent from a settings read with no problems. Fix the reported settings, then run again ` +
567
- '(deny and ask rules from this read, and rules given with --allowedTools, are still sent).');
572
+ const why = settingsRead !== 'partial'
573
+ ? msg('session.hostSettings.allowKept.why.unreadable')
574
+ : count === undefined
575
+ ? where === undefined
576
+ ? msg('session.hostSettings.allowKept.why.problems')
577
+ : msg('session.hostSettings.allowKept.why.problemsWhere', { where })
578
+ : where === undefined
579
+ ? msg(ALLOW_KEPT_COUNTED_KEYS[count === 1 ? 'one' : 'other'], { count })
580
+ : msg(ALLOW_KEPT_COUNTED_WHERE_KEYS[count === 1 ? 'one' : 'other'], { count, where });
581
+ return renderMessage(msg(ALLOW_KEPT_GENERIC_KEYS[plural], { held, why }), lang);
568
582
  }
@@ -1,4 +1,4 @@
1
- import { displayUntrusted } from './displayUntrusted.js';
1
+ import { displayUntrustedCapped } from './displayUntrusted.js';
2
2
  import { stripSystemReminderTagTokens, unwrapSystemReminder } from './systemReminderTag.js';
3
3
  import { PROMPT_BLOCKED_BY_HOOK_ROW_LEAD } from './rowKind.js';
4
4
  export { PROMPT_BLOCKED_BY_HOOK_ROW_LEAD };
@@ -6,7 +6,7 @@ const RUN_BLOCKED_REASONED = 'Run blocked';
6
6
  const RUN_BLOCKED_NO_REASON = 'Run blocked (the agent reported it cannot proceed)';
7
7
  const WORDS_SHOWN_MAX = 1000;
8
8
  function shownWords(words) {
9
- return displayUntrusted(words, { max: WORDS_SHOWN_MAX }).trim();
9
+ return displayUntrustedCapped(words, WORDS_SHOWN_MAX).trim();
10
10
  }
11
11
  const CAUSE_CLAUSE = Object.freeze({
12
12
  crashed: 'the hook failed before it answered; the prompt was not submitted',
@@ -1,6 +1,7 @@
1
1
  import type { UiLanguage } from './env/uiLanguage.js';
2
2
  import type { ResumeStartupCause } from '@sema-agent/sdk';
3
3
  import { RESUME_CONTEXT_UNAVAILABLE, CHECKPOINT_UNSUPPORTED_VERSION, CHECKPOINT_WALLTIME_AXIS_RETIRED, CHECKPOINT_CONFIG_REFUSED } from './engineErrorCodes.js';
4
+ import { type DecisionRefusalWayOut } from './checkpointRowVerdict.js';
4
5
  export declare const RESUME_REFUSAL_CODES: readonly string[];
5
6
  export interface ResumeRefusalDetail {
6
7
  code: string;
@@ -50,7 +51,7 @@ export interface ParkedResumeStartupDetail {
50
51
  export declare function parkedResumeStartupFromError(err: unknown, decision?: ParkedResumeStartupDecision): ParkedResumeStartupDetail | null;
51
52
  export declare function parkedResumeStartupContent(detail: ParkedResumeStartupDetail, lang?: UiLanguage): string;
52
53
  export interface CheckpointUnsupportedVersionDetail {
53
- code: 'checkpoint.unsupported_version';
54
+ code: typeof CHECKPOINT_UNSUPPORTED_VERSION;
54
55
  retriable: true;
55
56
  writerVersion?: string;
56
57
  readerVersion?: string;
@@ -76,6 +77,7 @@ export interface RefusedParkContentInput {
76
77
  readonly facts: RefusedParkFacts;
77
78
  readonly lane: 'interactive' | 'print';
78
79
  readonly runId?: string;
80
+ readonly wayOut?: DecisionRefusalWayOut | (string & {});
79
81
  }
80
82
  export declare function refusedParkContent(input: RefusedParkContentInput, lang?: UiLanguage): string;
81
83
  export declare function refusedParkBlockedContent(taskId: string, lane?: 'interactive' | 'print', lang?: UiLanguage): string;
@@ -4,6 +4,7 @@ import { guardedRead, ownDataField, readOwnDataNonEmptyString, readOwnDataValue
4
4
  import { CORE_RESUME_STARTUP_CAUSES } from './generated/engineFactTables.js';
5
5
  import { RESUME_CONTEXT_UNAVAILABLE, RESUME_PLACEMENT_MISMATCH, RESUME_PREFLIGHT_REJECTED, RESUME_PRINCIPAL_MISMATCH, RESUME_COMPOSITION_MISMATCH, RESUME_PARENT_CONSTRAINT_MISSING, RESUME_PARENT_CONSTRAINT_MISMATCH, RESUME_CONSTRAINT_UNPROJECTABLE, RESUME_POLICY_FOLD_CODE, PARKED_RESUME_STARTUP_FAILED, isStatusDerivedCoarseCode, RESUME_SESSION_NOT_FOUND, REQUEST_FIELD_CONFLICT, CHECKPOINT_UNSUPPORTED_VERSION, CHECKPOINT_WALLTIME_AXIS_RETIRED, CHECKPOINT_CONFIG_REFUSED, isRefusedParkCode, refusalSaysStillPending, refusalRetriableReading, } from './engineErrorCodes.js';
6
6
  import { capForDisplay } from './fleetTaskDesc.js';
7
+ import { decisionRefusalWayOutContent } from './checkpointRowVerdict.js';
7
8
  import { engineVersionTier } from './supportFloor.js';
8
9
  import { resumeRetryLaterFromError } from './wireErrorTriage.js';
9
10
  const REFUSAL_COPY_KEYS = Object.freeze({
@@ -286,7 +287,7 @@ export function refusedParkFromError(failure) {
286
287
  function refusedParkShownRunId(runId) {
287
288
  return typeof runId === 'string' && /^[A-Za-z0-9._:-]{1,128}$/.test(runId) ? runId : undefined;
288
289
  }
289
- function refusedParkWhy(code, field) {
290
+ function refusedParkWhy(code, field, newerEngine = false) {
290
291
  switch (code) {
291
292
  case CHECKPOINT_WALLTIME_AXIS_RETIRED:
292
293
  return msg('resume.refusal.park.whyWalltime');
@@ -295,7 +296,7 @@ function refusedParkWhy(code, field) {
295
296
  return msg('resume.refusal.park.whyDeps');
296
297
  return msg(field === 'inheritedGate' ? 'resume.refusal.park.whyInheritedGate' : 'resume.refusal.park.whyConfigRefused');
297
298
  default:
298
- return msg('resume.refusal.park.whyUnsupported');
299
+ return msg(newerEngine ? 'resume.refusal.park.whyNewerEngine' : 'resume.refusal.park.whyUnsupported');
299
300
  }
300
301
  }
301
302
  export function refusedParkContent(input, lang) {
@@ -306,13 +307,15 @@ export function refusedParkContent(input, lang) {
306
307
  let field;
307
308
  let stillPending;
308
309
  let blockedBy;
310
+ let wayOut;
309
311
  try {
310
312
  what = input.what;
311
313
  lane = input.lane;
312
314
  runId = input.runId;
315
+ wayOut = input.wayOut;
313
316
  }
314
317
  catch {
315
- what = lane = runId = undefined;
318
+ what = lane = runId = wayOut = undefined;
316
319
  }
317
320
  try {
318
321
  const facts = input.facts;
@@ -326,7 +329,8 @@ export function refusedParkContent(input, lang) {
326
329
  }
327
330
  const code = rawCode === CHECKPOINT_WALLTIME_AXIS_RETIRED || rawCode === CHECKPOINT_CONFIG_REFUSED ? rawCode : CHECKPOINT_UNSUPPORTED_VERSION;
328
331
  const shownWhat = typeof what === 'string' && what !== '' ? capForDisplay(what, 40) : msg('resume.refusal.park.whatDefault');
329
- const why = refusedParkWhy(code, typeof field === 'string' ? field : undefined);
332
+ const newerWorker = wayOut === 'newer_worker' && stillPending !== false;
333
+ const why = refusedParkWhy(code, typeof field === 'string' ? field : undefined, newerWorker);
330
334
  const shownRun = refusedParkShownRunId(runId);
331
335
  const head = msg('resume.refusal.park.head', { what: shownWhat, why });
332
336
  const configMayReturn = code === CHECKPOINT_CONFIG_REFUSED && field !== 'inheritedGate' ? msg(field === 'deps' ? 'resume.refusal.park.depsMayReturn' : 'resume.refusal.park.configMayReturn') : '';
@@ -335,10 +339,14 @@ export function refusedParkContent(input, lang) {
335
339
  if (stillPending === false)
336
340
  return renderMessage(msg('resume.refusal.park.printEnded', { head, code, blocked }), lang);
337
341
  const cancel = `POST /v1/runs/${shownRun ?? '<run id>'}/cancel`;
342
+ if (newerWorker)
343
+ return renderMessage(msg('resume.refusal.park.printNewerWorker', { head, configMayReturn, code, wayOut: decisionRefusalWayOutContent('newer_worker', lang) ?? '', cancel, blocked }), lang);
338
344
  return renderMessage(msg('resume.refusal.park.printHolds', { head, configMayReturn, code, cancel, blocked }), lang);
339
345
  }
340
346
  if (stillPending === false)
341
347
  return renderMessage(msg('resume.refusal.park.interactiveEnded', { head }), lang);
348
+ if (newerWorker)
349
+ return renderMessage(msg('resume.refusal.park.interactiveNewerWorker', { head, configMayReturn, wayOut: decisionRefusalWayOutContent('newer_worker', lang) ?? '' }), lang);
342
350
  return renderMessage(msg('resume.refusal.park.interactiveBusy', { head, configMayReturn }), lang);
343
351
  }
344
352
  export function refusedParkBlockedContent(taskId, lane = 'interactive', lang) {
@@ -1,6 +1,7 @@
1
1
  import { createStreamDrainingLegs } from './streamDrainingLegs.js';
2
2
  import { abortableSleep, settleWithinDeadline } from './abortableSleep.js';
3
3
  import { readOwnDataValue } from './ownKey.js';
4
+ import { isStreamEndedWithoutTerminalError } from './sseIdleTriage.js';
4
5
  const RUN_LEDGER_SNAPSHOT_BUDGET_MS = 8_000;
5
6
  const UNNUMBERED_FRAME_CAP = 64;
6
7
  const PARK_TRAILER_MAX = 4;
@@ -168,11 +169,10 @@ export async function readRunLedgerSnapshot(taskId, callId, deps, signal) {
168
169
  }
169
170
  catch (e) {
170
171
  drainLegs.legEnded('threw');
171
- const name = errorNameOf(e);
172
- if (!ac.signal.aborted && name === 'StreamEndedWithoutTerminalError')
172
+ if (!ac.signal.aborted && isStreamEndedWithoutTerminalError(e))
173
173
  complete = true;
174
174
  else
175
- log(`[ledgerSnapshot] read-ended-unproven task=${taskId} name=${name}`);
175
+ log(`[ledgerSnapshot] read-ended-unproven task=${taskId} name=${errorNameOf(e)}`);
176
176
  }
177
177
  finally {
178
178
  passAc.abort();
@@ -1,7 +1,7 @@
1
1
  import { atMostOnceVerdictOf } from './atMostOnce.js';
2
2
  import { readPermissionModeReceiptSegment } from './adapter/downstream/wiringManifestView.js';
3
3
  import { displayUntrusted } from './displayUntrusted.js';
4
- import { STEERING_NOT_RUNNING } from './engineErrorCodes.js';
4
+ import { CORRUPT_ROW_ERROR_CODE, STEERING_NOT_RUNNING } from './engineErrorCodes.js';
5
5
  import { SDK_PERMISSION_MODE_ADMISSION_FOLDS, SDK_PERMISSION_MODE_PERSIST_MISSES } from './generated/sdkFactTables.js';
6
6
  import { msg, renderMessage } from './i18n/translate.js';
7
7
  import { ownDataField, readOwnDataValue } from './ownKey.js';
@@ -9,7 +9,6 @@ import { permissionModeWriteAvailable } from './permissionModeWriteCapability.js
9
9
  import { permissionModeTitle } from './permissionWireCaps.js';
10
10
  import { isDisplayableWireCode } from './wireFailureShape.js';
11
11
  export const PERMISSION_MODE_SWITCH_RESULT_KEYS = Object.freeze(['taskId', 'sessionId', 'status', 'permissionMode', 'admission', 'persisted', 'persistMiss']);
12
- const PRE_SWITCH_CORRUPT_CODE = 'corrupt';
13
12
  function guardedSlot(o, key) {
14
13
  if (o === null || (typeof o !== 'object' && typeof o !== 'function'))
15
14
  return undefined;
@@ -83,7 +82,7 @@ function failureOutcomeOf(e) {
83
82
  return Object.freeze({ kind: 'not-running' });
84
83
  return Object.freeze({ kind: 'refused', status: v.status, ...(v.code !== undefined ? { errorCode: v.code } : {}) });
85
84
  }
86
- if (v.status === 500 && v.code === PRE_SWITCH_CORRUPT_CODE)
85
+ if (v.status === 500 && v.code === CORRUPT_ROW_ERROR_CODE)
87
86
  return Object.freeze({ kind: 'refused', status: 500, errorCode: v.code });
88
87
  return v.status !== undefined
89
88
  ? Object.freeze({ kind: 'unconfirmed', why: 'server-error', status: v.status })
@@ -11,12 +11,20 @@ import type { ModelApiWord } from "./model/providerPresets.js";
11
11
  import type { LiveModelCatalog } from "./liveModelCatalog.js";
12
12
  import { type RewindMode } from "./rewindWireCaps.js";
13
13
  import { type ProbeVerdictWord } from "./modelCapabilityProbe.js";
14
+ import { type ModelPoolChannelSource } from "./localConfig/modelPoolWords.js";
15
+ import { type LocalConfigPreview, type LocalConfigReceipt } from "./localConfig/kernel.js";
16
+ import type { ModelPoolPlannedEntry, ModelPoolProblem, ModelPoolView } from "./localConfig/modelPool.js";
17
+ import type { PoolDeleteWarning } from "./model/modelSupplyRules.js";
18
+ import { type Tier } from "./model/tierVocabulary.js";
14
19
  import type { SubagentContentEvent } from "./subagentContentStore.js";
15
20
  import type { DeviceEnrollTokenOutcome, DeviceListOutcome, DeviceRebindOutcome, DeviceRevokeOutcome, DeviceSessionBindingOutcome, DeviceTransport, DeviceUnarmed, DeviceUnreadable } from "./deviceRebind.js";
16
21
  import type { McpPanelView } from "./mcpPanel.js";
17
22
  import type { WiringManifestModView } from "./adapter/downstream/eventToSdkMessage.js";
18
23
  import type { McpToolToggleKey } from "./mcpToolToggles.js";
24
+ import { type McpServerReportView, type McpServerEditOutcomeView, type McpServerProbeView } from "./localConfig/mcp/views.js";
25
+ import type { McpServerEdit } from "./localConfig/mcp/edit.js";
19
26
  import { type ThinkingLatchEvent, type ThinkingLatchRowWord } from "./thinkingLatchWords.js";
27
+ import type { SkillsEdit, SkillsView } from "./localConfig/skills.js";
20
28
  import type { SessionRowPatchFields, SessionRowUnreadable } from "./sessionRowTag.js";
21
29
  import { type SessionEngineKind, type SessionEngineView } from "./sessionEngine.js";
22
30
  import type { ParkedUnresumableRow } from "./hitl/parkedUnresumable.js";
@@ -223,7 +231,7 @@ export type SeatStreamReading = {
223
231
  };
224
232
  export declare function seatStreamDeltaMessage(event: SeatStreamDeltaSource, ids: SeatStreamDeltaIds): SeatStreamEventMessage | undefined;
225
233
  export declare function readSeatStreamDelta(message: object): SeatStreamReading;
226
- export declare const SEAT_CAPABILITY_NAMES: readonly ["pickFolder", "rewind", "recents", "patchSession", "devices", "engineTarget", "onboard", "mcpToolToggles", "thinkingLatch", "computerUseSwitch", "engineModeDefaultOnly", "seatActions", "notificationLevels", "modsView", "quickEntryShortcut", "hooksRoster"];
234
+ export declare const SEAT_CAPABILITY_NAMES: readonly ["pickFolder", "rewind", "recents", "patchSession", "devices", "engineTarget", "onboard", "mcpToolToggles", "thinkingLatch", "computerUseSwitch", "engineModeDefaultOnly", "seatActions", "notificationLevels", "modsView", "quickEntryShortcut", "hooksRoster", "mcpServers", "mcpServerEdit", "skills", "skillsEdit", "modelPool", "modelPoolEdit"];
227
235
  export type SeatCapabilityName = (typeof SEAT_CAPABILITY_NAMES)[number];
228
236
  export interface SeatCapabilitiesState {
229
237
  pickFolder?: boolean;
@@ -242,6 +250,12 @@ export interface SeatCapabilitiesState {
242
250
  modsView?: boolean;
243
251
  quickEntryShortcut?: boolean;
244
252
  hooksRoster?: boolean;
253
+ mcpServers?: boolean;
254
+ mcpServerEdit?: boolean;
255
+ skills?: boolean;
256
+ skillsEdit?: boolean;
257
+ modelPool?: boolean;
258
+ modelPoolEdit?: boolean;
245
259
  }
246
260
  export type SeatCapabilityReading = {
247
261
  readonly kind: "reported";
@@ -354,6 +368,11 @@ export interface SetThinkingLatchRequest {
354
368
  readonly sessionId: string;
355
369
  readonly event: ThinkingLatchEvent;
356
370
  }
371
+ export interface McpServerEditRequest {
372
+ readonly sessionId?: string;
373
+ readonly edit: McpServerEdit;
374
+ readonly dryRun?: true;
375
+ }
357
376
  export interface AttachmentUploadReceipt {
358
377
  id: string;
359
378
  name: string;
@@ -644,6 +663,7 @@ export interface OnboardProbeResult {
644
663
  verdict: OnboardProbeVerdict;
645
664
  detail: string;
646
665
  thinking?: string;
666
+ firstOutputMs?: number;
647
667
  }
648
668
  export interface OnboardCatalogIssue {
649
669
  name: string;
@@ -679,6 +699,7 @@ export interface OnboardProviderRow {
679
699
  authEnv: string;
680
700
  models: OnboardProviderModel[];
681
701
  consoleUrl?: string;
702
+ signupUrl?: string;
682
703
  }
683
704
  export interface OnboardImportableProfile {
684
705
  id: string;
@@ -695,6 +716,105 @@ export interface OnboardProvidersResult {
695
716
  }
696
717
  export declare const checkOnboardEntryRequest: (v: unknown) => SeatValidation;
697
718
  export declare const checkOnboardApplyRequest: (v: unknown) => SeatValidation;
719
+ export interface SeatModelPoolEntry {
720
+ modelId: string;
721
+ api: ModelApiWord;
722
+ baseUrl: string;
723
+ credential: {
724
+ kind: "key";
725
+ apiKey: string;
726
+ } | {
727
+ kind: "none";
728
+ };
729
+ label?: string;
730
+ vision?: boolean;
731
+ contextWindow?: number;
732
+ maxTokens?: number;
733
+ channel?: string;
734
+ acceptUnverified?: boolean;
735
+ }
736
+ export type SeatModelPoolEdit = {
737
+ kind: "add";
738
+ entries: SeatModelPoolEntry[];
739
+ defaultIndex?: number;
740
+ } | {
741
+ kind: "update";
742
+ name: string;
743
+ label?: string | null;
744
+ vision?: boolean | null;
745
+ contextWindow?: number;
746
+ maxTokens?: number;
747
+ } | {
748
+ kind: "remove";
749
+ name: string;
750
+ } | {
751
+ kind: "setDefault";
752
+ name: string;
753
+ } | {
754
+ kind: "importEnvModels";
755
+ } | {
756
+ kind: "importChannel";
757
+ source: ModelPoolChannelSource;
758
+ profileId: string;
759
+ modelIds: string[];
760
+ defaultIndex?: number;
761
+ acceptUnverified?: boolean;
762
+ } | {
763
+ kind: "bindTier";
764
+ group: string;
765
+ tier: Tier;
766
+ name: string | null;
767
+ } | {
768
+ kind: "switchTierGroup";
769
+ group: string;
770
+ } | {
771
+ kind: "addTierGroup";
772
+ group: string;
773
+ tiers?: Partial<Record<Tier, string>>;
774
+ } | {
775
+ kind: "removeTierGroup";
776
+ group: string;
777
+ } | {
778
+ kind: "migrateTierGroups";
779
+ } | {
780
+ kind: "sweepOrphanKeySlots";
781
+ };
782
+ export interface ModelPoolEditRequest {
783
+ edit: SeatModelPoolEdit;
784
+ dryRun?: boolean;
785
+ }
786
+ export interface ModelPoolEditResult {
787
+ receipt: LocalConfigReceipt | LocalConfigPreview;
788
+ problems?: ModelPoolProblem[];
789
+ entries?: ModelPoolPlannedEntry[];
790
+ warnings?: PoolDeleteWarning[];
791
+ otherIssues?: OnboardCatalogIssue[];
792
+ engine?: EngineRestartOutcome;
793
+ }
794
+ export type ModelPoolListResult = ModelPoolView | Extract<LocalConfigReceipt, {
795
+ readonly kind: "unavailable";
796
+ }>;
797
+ export interface ModelDiscoveryRequest {
798
+ source: OnboardSource;
799
+ baseUrl?: string;
800
+ api?: ModelApiWord;
801
+ apiKey?: string;
802
+ }
803
+ export interface ModelDiscoveryCandidate {
804
+ id: string;
805
+ contextWindow?: number;
806
+ maxTokens?: number;
807
+ }
808
+ export type ModelDiscoveryResult = {
809
+ ok: true;
810
+ candidates: ModelDiscoveryCandidate[];
811
+ } | {
812
+ ok: false;
813
+ verdict: OnboardProbeVerdict;
814
+ detail: string;
815
+ };
816
+ export declare const checkModelPoolEditRequest: (v: unknown) => SeatValidation;
817
+ export declare const checkModelDiscoveryRequest: (v: unknown) => SeatValidation;
698
818
  export interface SessionModsView {
699
819
  readonly rows: readonly WiringManifestModView[];
700
820
  }
@@ -735,6 +855,14 @@ export interface SessionHooksRoster {
735
855
  readonly http: readonly SessionHooksRosterHttpRow[];
736
856
  readonly unlisted: number;
737
857
  }
858
+ export interface ListSkillsRequest {
859
+ readonly sessionId?: string;
860
+ }
861
+ export interface EditSkillsRequest {
862
+ readonly sessionId?: string;
863
+ readonly edit: SkillsEdit;
864
+ readonly dryRun?: boolean;
865
+ }
738
866
  export declare const checkMcpToolToggleKey: (v: unknown) => SeatValidation;
739
867
  export interface McpToolTogglesResult {
740
868
  off: McpToolToggleKey[];
@@ -894,6 +1022,9 @@ export interface LocalSessionsApi {
894
1022
  listOnboardProviders(): Promise<OnboardProvidersResult>;
895
1023
  probeOnboardEntry(req: OnboardEntryRequest): Promise<OnboardProbeResult>;
896
1024
  applyOnboardEntry(req: OnboardApplyRequest): Promise<OnboardApplyResult>;
1025
+ listModelPool(): Promise<ModelPoolListResult>;
1026
+ editModelPool(req: ModelPoolEditRequest): Promise<ModelPoolEditResult>;
1027
+ discoverModels(req: ModelDiscoveryRequest): Promise<ModelDiscoveryResult>;
897
1028
  readSessionMcpPanel(sessionId: string): Promise<McpPanelView | DeviceUnreadable | DeviceTransport | DeviceUnarmed>;
898
1029
  listMcpToolToggles(): Promise<McpToolTogglesResult>;
899
1030
  setMcpToolToggle(key: McpToolToggleKey, enabled: boolean): Promise<OkAck>;
@@ -905,8 +1036,24 @@ export interface LocalSessionsApi {
905
1036
  getQuickEntryShortcut(): Promise<QuickEntryShortcutState>;
906
1037
  setQuickEntryShortcut(next: QuickEntryShortcut): Promise<SetQuickEntryShortcutResult>;
907
1038
  claimSeatActions(req: SeatActionsClaim): Promise<OkAck>;
1039
+ listMcpServers(req: {
1040
+ readonly sessionId?: string;
1041
+ }): Promise<McpServerReportView | Extract<LocalConfigReceipt, {
1042
+ readonly kind: "unavailable";
1043
+ }>>;
1044
+ probeMcpServerEntry(req: {
1045
+ readonly sessionId?: string;
1046
+ readonly edit: McpServerEdit;
1047
+ }): Promise<McpServerProbeView>;
1048
+ editMcpServer(req: McpServerEditRequest): Promise<McpServerEditOutcomeView>;
908
1049
  readSessionMods(sessionId: string): Promise<SessionModsView | DeviceUnreadable | DeviceUnarmed>;
909
1050
  readSessionHooksRoster(sessionId: string): Promise<SessionHooksRoster | DeviceUnreadable | DeviceUnarmed>;
1051
+ listSkills(req: ListSkillsRequest): Promise<SkillsView | Extract<LocalConfigReceipt, {
1052
+ readonly kind: "unavailable";
1053
+ }>>;
1054
+ editSkills(req: EditSkillsRequest): Promise<{
1055
+ receipt: LocalConfigReceipt | LocalConfigPreview;
1056
+ }>;
910
1057
  onEvent(cb: (ev: LocalSessionEvent) => void): () => void;
911
1058
  onToolPermissionRequest(cb: (req: ToolPermissionRequest) => void): () => void;
912
1059
  onSeatAction(cb: (action: SeatAction) => void): () => void;
@@ -958,7 +1105,7 @@ export declare function isSendMessageAck(v: unknown): v is SendMessageAck;
958
1105
  export declare function readToolPermissionSettledElsewhere(ack: object | null | undefined): ToolPermissionSettledElsewhere | undefined;
959
1106
  export declare function readToolPermissionAckState(ack: ToolPermissionAck | null | undefined): ToolPermissionAckState | undefined;
960
1107
  export declare const LOCAL_SESSIONS_SPEC: EipcServiceSpec;
961
- export declare const SEAT_METHOD_NAMES: readonly ["start", "sendMessage", "interrupt", "stop", "respondToToolPermission", "cancelQueuedMessage", "reorderQueuedMessage", "promoteQueuedMessage", "setFocusedSession", "setModel", "getTranscript", "searchSessions", "uploadAttachment", "listModels", "applyModelConfig", "pickFolder", "listRecentFolders", "noteRecentFolder", "patchSession", "listDevices", "readSessionBinding", "rebindSession", "issueEnrollToken", "revokeDevice", "setEngineMode", "startCloudLogin", "cancelCloudLogin", "connectCloudEngine", "configureCloudEngine", "clearCloudEngine", "answerEngineSwap", "beginSelfUpgrade", "listOnboardProviders", "probeOnboardEntry", "applyOnboardEntry", "readSessionMcpPanel", "listMcpToolToggles", "setMcpToolToggle", "setThinkingLatch", "getComputerUse", "setComputerUse", "getNotificationLevels", "setNotificationLevel", "getQuickEntryShortcut", "setQuickEntryShortcut", "claimSeatActions", "readSessionMods", "readSessionHooksRoster", "onEvent", "onToolPermissionRequest", "onSeatAction"];
1108
+ export declare const SEAT_METHOD_NAMES: readonly ["start", "sendMessage", "interrupt", "stop", "respondToToolPermission", "cancelQueuedMessage", "reorderQueuedMessage", "promoteQueuedMessage", "setFocusedSession", "setModel", "getTranscript", "searchSessions", "uploadAttachment", "listModels", "applyModelConfig", "pickFolder", "listRecentFolders", "noteRecentFolder", "patchSession", "listDevices", "readSessionBinding", "rebindSession", "issueEnrollToken", "revokeDevice", "setEngineMode", "startCloudLogin", "cancelCloudLogin", "connectCloudEngine", "configureCloudEngine", "clearCloudEngine", "answerEngineSwap", "beginSelfUpgrade", "listOnboardProviders", "probeOnboardEntry", "applyOnboardEntry", "listModelPool", "editModelPool", "discoverModels", "readSessionMcpPanel", "listMcpToolToggles", "setMcpToolToggle", "setThinkingLatch", "getComputerUse", "setComputerUse", "getNotificationLevels", "setNotificationLevel", "getQuickEntryShortcut", "setQuickEntryShortcut", "claimSeatActions", "readSessionMods", "readSessionHooksRoster", "listMcpServers", "probeMcpServerEntry", "editMcpServer", "listSkills", "editSkills", "onEvent", "onToolPermissionRequest", "onSeatAction"];
962
1109
  export declare const SEAT_STORE_PROPS: readonly ["sessionsStateStore", "focusedSessionStateStore", "settingsStateStore", "seatCapabilitiesStateStore", "engineTargetStateStore"];
963
1110
  export declare const SEAT_EVENT_METHOD_NAMES: readonly ["onEvent", "onToolPermissionRequest", "onSeatAction"];
964
1111
  export declare const LOCAL_SESSION_EVENT_KEYS: readonly ["type", "sessionId", "message", "error", "errorCategory", "code", "session", "userMessageUuid", "requestId", "outcome", "parked", "chrome", "_sema_turnFailure", "subagentContent"];
@@ -1103,6 +1250,9 @@ export declare const SEAT_VALIDATOR_KEY_COVERAGE: {
1103
1250
  }, {
1104
1251
  readonly key: "aliases";
1105
1252
  readonly why: "受理面(0.108.0 CC-944;除行名之外引擎还认的模型词),读法归 modelAcceptanceOf(缺席 = 更早的服务端,照旧判;在场而坏形 ⇒ 没找到行的词读 catalog_unreadable);出站门为它拒掉整份目录 = 选单为一份受理数据整个消失。";
1253
+ }, {
1254
+ readonly key: "unreadableRows";
1255
+ readonly why: "完整性面(0.112.0 CC-1229;回体读口丢掉的行数,`> 0` 才在场),读法归 modelAcceptanceOf 的读不全判(非正数 / 非数一律不算丢行);出站门为它拒掉整份目录 = 选单为一个计数整个消失。";
1106
1256
  }];
1107
1257
  };
1108
1258
  readonly SendMessageRequest: {
@@ -1196,7 +1346,7 @@ export declare const SEAT_VALIDATOR_KEY_COVERAGE: {
1196
1346
  };
1197
1347
  readonly SeatCapabilitiesState: {
1198
1348
  readonly check: (v: unknown) => SeatValidation;
1199
- readonly validated: readonly ["pickFolder", "rewind", "recents", "patchSession", "devices", "engineTarget", "onboard", "mcpToolToggles", "thinkingLatch", "computerUseSwitch", "engineModeDefaultOnly", "seatActions", "notificationLevels", "modsView", "quickEntryShortcut", "hooksRoster"];
1349
+ readonly validated: readonly ["pickFolder", "rewind", "recents", "patchSession", "devices", "engineTarget", "onboard", "mcpToolToggles", "thinkingLatch", "computerUseSwitch", "engineModeDefaultOnly", "seatActions", "notificationLevels", "modsView", "quickEntryShortcut", "hooksRoster", "mcpServers", "mcpServerEdit", "skills", "skillsEdit", "modelPool", "modelPoolEdit"];
1200
1350
  readonly unchecked: readonly [];
1201
1351
  };
1202
1352
  readonly RecentFoldersResult: {
@@ -1236,7 +1386,7 @@ export declare const SEAT_VALIDATOR_KEY_COVERAGE: {
1236
1386
  };
1237
1387
  };
1238
1388
  export declare const SEAT_VALIDATOR_COVERAGE_EXEMPT: readonly [...{
1239
- label: "DeviceListOutcome" | "DeviceSessionBindingOutcome" | "DeviceRebindOutcome" | "DeviceEnrollTokenOutcome" | "DeviceRevokeOutcome" | "SeatDeviceRebindRequest" | "SeatDeviceRevokeRequest" | "EngineTargetState" | "EngineTargetResult" | "CloudLoginStart" | "CloudLoginCancelAck" | "CloudConnectResult" | "CloudLoginRequest" | "CloudEngineConnectRequest" | "CloudEngineConfigureRequest" | "OnboardProvidersResult" | "OnboardProbeResult" | "OnboardApplyResult" | "OnboardEntryRequest" | "OnboardApplyRequest" | "McpToolTogglesResult" | "McpToolToggleKey" | "ComputerUseState" | "SetComputerUseResult" | "SetComputerUseRequest" | "NotificationLevelsState" | "SetNotificationLevelResult" | "SeatAction" | "EngineSwapAnswerOutcome" | "SelfUpgradeOutcome" | "SessionModsResult" | "QuickEntryShortcutState" | "SetQuickEntryShortcutResult" | "SessionHooksRosterResult";
1389
+ label: "DeviceListOutcome" | "DeviceSessionBindingOutcome" | "DeviceRebindOutcome" | "DeviceEnrollTokenOutcome" | "DeviceRevokeOutcome" | "SeatDeviceRebindRequest" | "SeatDeviceRevokeRequest" | "EngineTargetState" | "EngineTargetResult" | "CloudLoginStart" | "CloudLoginCancelAck" | "CloudConnectResult" | "CloudLoginRequest" | "CloudEngineConnectRequest" | "CloudEngineConfigureRequest" | "OnboardProvidersResult" | "OnboardProbeResult" | "OnboardApplyResult" | "OnboardEntryRequest" | "OnboardApplyRequest" | "McpToolTogglesResult" | "McpToolToggleKey" | "ComputerUseState" | "SetComputerUseResult" | "SetComputerUseRequest" | "NotificationLevelsState" | "SetNotificationLevelResult" | "ModelPoolListResult" | "ModelPoolEditResult" | "ModelDiscoveryResult" | "ModelPoolEditRequest" | "ModelDiscoveryRequest" | "SeatAction" | "EngineSwapAnswerOutcome" | "SelfUpgradeOutcome" | "SessionModsResult" | "QuickEntryShortcutState" | "SetQuickEntryShortcutResult" | "SessionHooksRosterResult" | "McpServersListResult" | "McpServerProbeResult" | "McpServerEditResult" | "ListSkillsResult" | "EditSkillsResult";
1240
1390
  check: (v: unknown) => SeatValidation;
1241
1391
  why: string;
1242
1392
  }[], {