@sema-agent/client-core 0.111.0 → 0.112.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (115) hide show
  1. package/CHANGELOG.md +98 -0
  2. package/README.md +16 -7
  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/hitlBridge.d.ts +1 -0
  39. package/dist/hitl/hitlBridge.js +17 -4
  40. package/dist/hitl/localAllowRedemption.d.ts +9 -6
  41. package/dist/hitl/localAllowRedemption.js +20 -0
  42. package/dist/hitl/parkOwnership.js +2 -1
  43. package/dist/hitl/parkResolver.js +7 -0
  44. package/dist/hitl/planReviewCard.d.ts +3 -2
  45. package/dist/hitl/planReviewCard.js +2 -0
  46. package/dist/hitl/planReviewWire.d.ts +4 -2
  47. package/dist/hitl/planReviewWire.js +134 -97
  48. package/dist/hitl/screenDecisionCards.js +3 -2
  49. package/dist/hitl/sessionPolicyWire.js +2 -2
  50. package/dist/hitl/standingRows.d.ts +4 -2
  51. package/dist/hitl/standingRows.js +10 -3
  52. package/dist/hooksReaderGenerations.js +1 -1
  53. package/dist/i18n/messages.en.d.ts +165 -0
  54. package/dist/i18n/messages.en.js +166 -1
  55. package/dist/i18n/messages.zh.js +177 -1
  56. package/dist/index.d.ts +30 -5
  57. package/dist/index.js +15 -2
  58. package/dist/liveModelCatalog.d.ts +4 -0
  59. package/dist/liveModelCatalog.js +10 -1
  60. package/dist/localConfig/documents.d.ts +61 -0
  61. package/dist/localConfig/documents.js +51 -0
  62. package/dist/localConfig/kernel.d.ts +149 -0
  63. package/dist/localConfig/kernel.js +597 -0
  64. package/dist/localConfig/mcp/edit.d.ts +161 -0
  65. package/dist/localConfig/mcp/edit.js +846 -0
  66. package/dist/localConfig/mcp/servers.d.ts +165 -0
  67. package/dist/localConfig/mcp/servers.js +776 -0
  68. package/dist/localConfig/mcp/views.d.ts +170 -0
  69. package/dist/localConfig/mcp/views.js +429 -0
  70. package/dist/localConfig/modelPool.d.ts +262 -0
  71. package/dist/localConfig/modelPool.js +1489 -0
  72. package/dist/localConfig/modelPoolWords.d.ts +13 -0
  73. package/dist/localConfig/modelPoolWords.js +20 -0
  74. package/dist/localConfig/receiptShape.d.ts +7 -0
  75. package/dist/localConfig/receiptShape.js +135 -0
  76. package/dist/localConfig/settingsWrite.d.ts +127 -0
  77. package/dist/localConfig/settingsWrite.js +237 -0
  78. package/dist/localConfig/skills.d.ts +124 -0
  79. package/dist/localConfig/skills.js +397 -0
  80. package/dist/localConfig/skillsWords.d.ts +10 -0
  81. package/dist/localConfig/skillsWords.js +5 -0
  82. package/dist/mcpProbeWire.js +2 -1
  83. package/dist/mcpWireCaps.js +1 -1
  84. package/dist/memoryVerbsWire.js +3 -2
  85. package/dist/model/onboardJudgement.d.ts +14 -4
  86. package/dist/model/onboardJudgement.js +91 -139
  87. package/dist/modelConfigGapNotice.d.ts +20 -0
  88. package/dist/modelConfigGapNotice.js +102 -0
  89. package/dist/modsKernelIdentity.js +2 -47
  90. package/dist/notifications.js +14 -12
  91. package/dist/ownKey.d.ts +1 -0
  92. package/dist/ownKey.js +40 -8
  93. package/dist/permissionsDeclaration.d.ts +2 -1
  94. package/dist/permissionsDeclaration.js +31 -17
  95. package/dist/planReviewOutcomeCause.d.ts +2 -0
  96. package/dist/planReviewOutcomeCause.js +12 -0
  97. package/dist/promptBlockedCopy.js +2 -2
  98. package/dist/resumeRefusalCopy.d.ts +3 -1
  99. package/dist/resumeRefusalCopy.js +12 -4
  100. package/dist/runLedgerSnapshot.js +3 -3
  101. package/dist/runPermissionModeSwitch.js +2 -3
  102. package/dist/seatContract.d.ts +154 -4
  103. package/dist/seatContract.js +228 -2
  104. package/dist/sessionIdSegment.d.ts +1 -0
  105. package/dist/sessionIdSegment.js +4 -1
  106. package/dist/sessionMemoryErase.js +2 -1
  107. package/dist/sha256Bytes.d.ts +1 -0
  108. package/dist/sha256Bytes.js +46 -0
  109. package/dist/skillOverrideChain.d.ts +83 -0
  110. package/dist/skillOverrideChain.js +378 -0
  111. package/dist/skillsWireCaps.d.ts +3 -0
  112. package/dist/skillsWireCaps.js +16 -1
  113. package/dist/turnFailurePresentation.js +4 -10
  114. package/docs/INTEGRATION-CLIENTS.md +680 -14
  115. package/package.json +3 -3
@@ -4,11 +4,18 @@ import { liveDefaultModelCopy, liveModelRowCopy } from "./model/liveCatalogShape
4
4
  import { REWIND_MODES } from "./rewindWireCaps.js";
5
5
  import { SETTINGS_MODEL_API_WORDS } from "./generated/settingsSchemaTables.js";
6
6
  import { PROBE_VERDICTS } from "./modelCapabilityProbe.js";
7
+ import { MODEL_POOL_CHANNEL_SOURCES, MODEL_POOL_COMPLETENESS, MODEL_POOL_MAX_BATCH, MODEL_POOL_PROBE_STATES } from "./localConfig/modelPoolWords.js";
8
+ import { LOCAL_CONFIG_REFUSALS } from "./localConfig/kernel.js";
9
+ import { localConfigDisclosureShapeOf, localConfigReceiptShapeOf, localConfigUnavailableShapeOf } from "./localConfig/receiptShape.js";
10
+ import { TIER_ORDER } from "./model/tierVocabulary.js";
7
11
  import { guardedRead, ownDataField, ownDataRefusalKeyOf, ownSendableField, readOwnDataValue } from "./ownKey.js";
8
12
  import { isPlainRecord as isJsonPlainRecord } from "./jsonFaithful.js";
9
13
  import { displayUntrustedMarks, quoteUntrustedForSentence } from "./displayUntrusted.js";
10
14
  import { MCP_LIVENESS_STATES } from "./mcpLiveness.js";
15
+ import { checkMcpServerReportView, checkMcpServerEditOutcomeView, checkMcpServerProbeView } from "./localConfig/mcp/views.js";
11
16
  import { THINKING_LATCH_EVENTS, THINKING_LATCH_ROW_WORDS } from "./thinkingLatchWords.js";
17
+ import { SKILLS_VIEW_EXCLUDED_REASONS, SKILLS_VIEW_LAYERS } from "./localConfig/skillsWords.js";
18
+ import { SKILL_OVERRIDE_DECIDERS, SKILL_OVERRIDE_LOCK_SOURCES, SKILL_OVERRIDE_STATES } from "./skillOverrideChain.js";
12
19
  import { EXECUTION_PLACEMENT_ROLES } from "./executionPlacementWords.js";
13
20
  import { isSessionEngineView } from "./sessionEngine.js";
14
21
  import { LOCAL_ENGINE_SWAP_CAUSES } from "./localEngineSwapCard.js";
@@ -406,7 +413,7 @@ export function readSeatStreamDelta(message) {
406
413
  return Object.freeze({ kind: "malformed" });
407
414
  }
408
415
  }
409
- export const SEAT_CAPABILITY_NAMES = Object.freeze(["pickFolder", "rewind", "recents", "patchSession", "devices", "engineTarget", "onboard", "mcpToolToggles", "thinkingLatch", "computerUseSwitch", "engineModeDefaultOnly", "seatActions", "notificationLevels", "modsView", "quickEntryShortcut", "hooksRoster"]);
416
+ export const SEAT_CAPABILITY_NAMES = Object.freeze(["pickFolder", "rewind", "recents", "patchSession", "devices", "engineTarget", "onboard", "mcpToolToggles", "thinkingLatch", "computerUseSwitch", "engineModeDefaultOnly", "seatActions", "notificationLevels", "modsView", "quickEntryShortcut", "hooksRoster", "mcpServers", "mcpServerEdit", "skills", "skillsEdit", "modelPool", "modelPoolEdit"]);
410
417
  const notReported = () => Object.freeze({ kind: "not_reported" });
411
418
  const malformedReading = () => Object.freeze({ kind: "malformed" });
412
419
  const reported = (available) => Object.freeze({ kind: "reported", available });
@@ -490,6 +497,12 @@ const SEAT_CAPABILITY_PHRASES = Object.freeze({
490
497
  modsView: Object.freeze({ action: "Showing mods", ability: "show mods", support: "mods support" }),
491
498
  quickEntryShortcut: Object.freeze({ action: "Changing the Quick Entry shortcut", ability: "change the Quick Entry shortcut", support: "Quick Entry shortcut support" }),
492
499
  hooksRoster: Object.freeze({ action: "Showing hooks", ability: "show hooks", support: "hooks support" }),
500
+ mcpServers: Object.freeze({ action: "Listing MCP servers", ability: "list MCP servers", support: "MCP server listing" }),
501
+ mcpServerEdit: Object.freeze({ action: "Editing MCP servers", ability: "edit MCP servers", support: "MCP server editing" }),
502
+ skills: Object.freeze({ action: "Showing skills", ability: "show skills", support: "skills support" }),
503
+ skillsEdit: Object.freeze({ action: "Changing skills", ability: "change skills", support: "skill editing support" }),
504
+ modelPool: Object.freeze({ action: "Showing your models", ability: "show your models", support: "model list support" }),
505
+ modelPoolEdit: Object.freeze({ action: "Editing your models", ability: "edit your models", support: "model editing support" }),
493
506
  });
494
507
  export function seatCapabilityUnavailableDetail(name, reading) {
495
508
  const phrase = Object.hasOwn(SEAT_CAPABILITY_PHRASES, name)
@@ -939,6 +952,7 @@ const ONBOARD_PROBE_RESULT = shapeRule("probe result", {
939
952
  verdict: reqF(oneOfRule("probe verdict", PROBE_VERDICTS)),
940
953
  detail: reqF(R_STR),
941
954
  thinking: optF(R_NONEMPTY),
955
+ firstOutputMs: optF(R_INT0),
942
956
  });
943
957
  const ENGINE_UP_SPEC = { model: reqF(ruleOf("string|null", (x) => x === null || typeof x === "string")) };
944
958
  const ENGINE_NOT_UP_SPEC = { reason: reqF(R_STR) };
@@ -1002,6 +1016,7 @@ const checkOnboardProvidersResult = seatShapeCheck(shapeRule("onboard providers"
1002
1016
  maxTokens: reqF(R_INT1),
1003
1017
  }))),
1004
1018
  consoleUrl: optF(R_STR),
1019
+ signupUrl: optF(R_STR),
1005
1020
  }))),
1006
1021
  importable: optF(arrayRule(shapeRule("importable profile", {
1007
1022
  id: reqF(R_NONEMPTY),
@@ -1013,6 +1028,148 @@ const checkOnboardProvidersResult = seatShapeCheck(shapeRule("onboard providers"
1013
1028
  isCurrent: optF(R_BOOL),
1014
1029
  }))),
1015
1030
  }));
1031
+ const R_TIER = oneOfRule("tier", TIER_ORDER);
1032
+ const R_CREDENTIAL = armsRule("credential", "kind", { key: { apiKey: reqF(R_NONEMPTY) }, none: {} });
1033
+ const R_TIER_MAP = ruleOf("tier map", (v) => isPlainRecord(v) && Object.keys(v).every((k) => TIER_ORDER.includes(k) && typeof own(v, k) === "string"));
1034
+ const R_NULLABLE_STR = ruleOf("string|null", (v) => v === null || typeof v === "string");
1035
+ const R_NULLABLE_BOOL = ruleOf("boolean|null", (v) => v === null || typeof v === "boolean");
1036
+ const SEAT_POOL_ENTRY = shapeRule("pool entry", {
1037
+ modelId: reqF(R_NONEMPTY),
1038
+ api: reqF(R_API_WORD),
1039
+ baseUrl: reqF(R_NONEMPTY),
1040
+ credential: reqF(R_CREDENTIAL),
1041
+ label: optF(R_STR),
1042
+ vision: optF(R_BOOL),
1043
+ contextWindow: optF(R_INT1),
1044
+ maxTokens: optF(R_INT1),
1045
+ channel: optF(R_NONEMPTY),
1046
+ acceptUnverified: optF(R_BOOL),
1047
+ });
1048
+ const SEAT_POOL_EDIT = armsRule("pool edit", "kind", {
1049
+ add: { entries: reqF(arrayRule(SEAT_POOL_ENTRY, true)), defaultIndex: optF(R_INT0) },
1050
+ update: { name: reqF(R_NONEMPTY), label: optF(R_NULLABLE_STR), vision: optF(R_NULLABLE_BOOL), contextWindow: optF(R_INT1), maxTokens: optF(R_INT1) },
1051
+ remove: { name: reqF(R_NONEMPTY) },
1052
+ setDefault: { name: reqF(R_NONEMPTY) },
1053
+ importEnvModels: {},
1054
+ importChannel: {
1055
+ source: reqF(oneOfRule("channel source", MODEL_POOL_CHANNEL_SOURCES)),
1056
+ profileId: reqF(R_NONEMPTY),
1057
+ modelIds: reqF(arrayRule(R_NONEMPTY, true)),
1058
+ defaultIndex: optF(R_INT0),
1059
+ acceptUnverified: optF(R_BOOL),
1060
+ },
1061
+ bindTier: { group: reqF(R_NONEMPTY), tier: reqF(R_TIER), name: reqF(R_NULLABLE_STR) },
1062
+ switchTierGroup: { group: reqF(R_NONEMPTY) },
1063
+ addTierGroup: { group: reqF(R_NONEMPTY), tiers: optF(R_TIER_MAP) },
1064
+ removeTierGroup: { group: reqF(R_NONEMPTY) },
1065
+ migrateTierGroups: {},
1066
+ sweepOrphanKeySlots: {},
1067
+ });
1068
+ const POOL_EDIT_KEY_ALLOW = new Set(Array.from({ length: MODEL_POOL_MAX_BATCH }, (_, i) => `edit.entries[${i}].credential.apiKey`));
1069
+ export const checkModelPoolEditRequest = seatShapeCheck(shapeRule("editModelPool request", { edit: reqF(SEAT_POOL_EDIT), dryRun: optF(R_BOOL) }), POOL_EDIT_KEY_ALLOW);
1070
+ export const checkModelDiscoveryRequest = seatShapeCheck(shapeRule("discoverModels request", { source: reqF(ONBOARD_SOURCE), baseUrl: optF(R_NONEMPTY), api: optF(R_API_WORD), apiKey: optF(R_NONEMPTY) }), ONBOARD_KEY_ALLOW);
1071
+ const leafVerdict = (r) => (r === true ? true : bad(r.reason, r.field));
1072
+ const leafRule = (label, judge) => ({
1073
+ label,
1074
+ test: (v, path) => leafVerdict(judge(v, path)),
1075
+ });
1076
+ const R_DISCLOSURE = leafRule("disclosure", localConfigDisclosureShapeOf);
1077
+ const R_LOCAL_CONFIG_RECEIPT = leafRule("receipt", localConfigReceiptShapeOf);
1078
+ const localConfigListCheck = (view) => seatCheck((v) => {
1079
+ if (!isPlainRecord(v))
1080
+ return bad("not object");
1081
+ return own(v, "kind") === "unavailable" ? leafVerdict(localConfigUnavailableShapeOf(v)) : view(v);
1082
+ });
1083
+ const R_POOL_PROBLEM = shapeRule("pool problem", {
1084
+ reason: reqF(oneOfRule("refusal", LOCAL_CONFIG_REFUSALS)),
1085
+ detail: reqF(R_STR),
1086
+ index: optF(R_INT0),
1087
+ name: optF(R_NONEMPTY),
1088
+ });
1089
+ const R_PROBE_STATE = oneOfRule("probe state", MODEL_POOL_PROBE_STATES);
1090
+ const R_PLANNED_ENTRY = shapeRule("planned entry", {
1091
+ name: reqF(R_NONEMPTY),
1092
+ modelId: reqF(R_NONEMPTY),
1093
+ keyEnv: reqF(ruleOf("string|null", (v) => v === null || (typeof v === "string" && v.length > 0))),
1094
+ updatedExisting: reqF(R_BOOL),
1095
+ probe: reqF(R_PROBE_STATE),
1096
+ });
1097
+ const R_DELETE_WARNING = shapeRule("delete warning", { kind: reqF(oneOfRule("warning kind", ["allowlist-empties", "tier-binding"])), consequence: reqF(R_NONEMPTY) });
1098
+ const R_DELETE_BLOCKER = shapeRule("delete blocker", {
1099
+ kind: reqF(oneOfRule("blocker kind", ["default", "roles", "roster", "unreadable"])),
1100
+ where: reqF(R_NONEMPTY),
1101
+ fix: reqF(R_NONEMPTY),
1102
+ });
1103
+ const R_CATALOG_ISSUE = shapeRule("catalog issue", { name: reqF(R_NONEMPTY), modelId: reqF(R_STR), issue: reqF(R_NONEMPTY) });
1104
+ const checkModelPoolEditResult = seatShapeCheck(shapeRule("editModelPool result", {
1105
+ receipt: reqF(R_LOCAL_CONFIG_RECEIPT),
1106
+ problems: optF(arrayRule(R_POOL_PROBLEM, true)),
1107
+ entries: optF(arrayRule(R_PLANNED_ENTRY, true)),
1108
+ warnings: optF(arrayRule(R_DELETE_WARNING, true)),
1109
+ otherIssues: optF(arrayRule(R_CATALOG_ISSUE, true)),
1110
+ engine: optF(ENGINE_RESTART_OUTCOME),
1111
+ }));
1112
+ const R_VIEW_ENTRY = shapeRule("pool view entry", {
1113
+ name: reqF(R_NONEMPTY),
1114
+ modelId: reqF(R_NONEMPTY),
1115
+ api: reqF(R_STR),
1116
+ baseUrl: reqF(R_STR),
1117
+ enabled: reqF(R_BOOL),
1118
+ label: optF(R_STR),
1119
+ vision: reqF(shapeRule("vision", { source: reqF(oneOfRule("vision source", ["entry", "family", "unknown"])), value: optF(R_BOOL) })),
1120
+ keyless: reqF(R_BOOL),
1121
+ keyEnv: optF(R_NONEMPTY),
1122
+ contextWindow: optF(R_INT1),
1123
+ maxTokens: optF(R_INT1),
1124
+ probe: reqF(R_PROBE_STATE),
1125
+ probeVerdict: optF(R_NONEMPTY),
1126
+ probedAt: optF(R_NUM),
1127
+ isDefault: reqF(R_BOOL),
1128
+ tiers: reqF(arrayRule(shapeRule("bound tier", { group: reqF(R_NONEMPTY), tier: reqF(R_TIER) }))),
1129
+ deleteBlockers: reqF(arrayRule(R_DELETE_BLOCKER)),
1130
+ deleteWarnings: reqF(arrayRule(R_DELETE_WARNING)),
1131
+ credentialIssue: optF(R_NONEMPTY),
1132
+ });
1133
+ const R_DEFAULT_MODEL = armsRule("default model", "kind", {
1134
+ named: {
1135
+ name: reqF(R_NONEMPTY),
1136
+ source: reqF(R_NONEMPTY),
1137
+ dangling: reqF(arrayRule(shapeRule("dangling", { source: reqF(R_NONEMPTY), name: reqF(R_STR) }))),
1138
+ disclosures: reqF(arrayRule(R_DISCLOSURE)),
1139
+ },
1140
+ select: {
1141
+ select: reqF(shapeRule("select", { tier: optF(R_STR), needs: optF(arrayRule(R_STR)), prefer: optF(R_STR) })),
1142
+ disclosures: reqF(arrayRule(R_DISCLOSURE)),
1143
+ },
1144
+ none: { disclosures: reqF(arrayRule(R_DISCLOSURE)) },
1145
+ unknown: { disclosures: reqF(arrayRule(R_DISCLOSURE)) },
1146
+ });
1147
+ const R_POOL_VIEW = shapeRule("pool view", {
1148
+ catalog: reqF(oneOfRule("catalog", ["read", "absent", "unreadable"])),
1149
+ completeness: reqF(oneOfRule("completeness", MODEL_POOL_COMPLETENESS)),
1150
+ unreadableRows: reqF(R_INT0),
1151
+ entries: reqF(arrayRule(R_VIEW_ENTRY)),
1152
+ roles: reqF(arrayRule(shapeRule("role", { role: reqF(R_NONEMPTY), model: optF(R_NONEMPTY), select: optF(R_TRUE) }))),
1153
+ tierGroups: reqF(arrayRule(shapeRule("tier group", { name: reqF(R_NONEMPTY), active: reqF(R_BOOL), tiers: reqF(R_TIER_MAP), resolved: reqF(R_TIER_MAP) }))),
1154
+ activeTierGroup: optF(R_NONEMPTY),
1155
+ defaultModel: reqF(R_DEFAULT_MODEL),
1156
+ legacyTierSettings: reqF(R_BOOL),
1157
+ orphanKeySlots: reqF(R_INT0),
1158
+ envModels: reqF(arrayRule(R_NONEMPTY)),
1159
+ providers: reqF(arrayRule(shapeRule("pool provider", {
1160
+ id: reqF(R_NONEMPTY),
1161
+ name: reqF(R_NONEMPTY),
1162
+ baseUrl: reqF(R_NONEMPTY),
1163
+ api: reqF(R_API_WORD),
1164
+ authEnv: reqF(R_STR),
1165
+ consoleUrl: optF(R_STR),
1166
+ signupUrl: optF(R_STR),
1167
+ keyOptional: reqF(R_BOOL),
1168
+ models: reqF(arrayRule(shapeRule("provider model", { id: reqF(R_NONEMPTY), contextWindow: reqF(R_INT1), maxTokens: reqF(R_INT1) }))),
1169
+ }))),
1170
+ });
1171
+ const checkModelPoolListResult = localConfigListCheck(seatShapeCheck(R_POOL_VIEW));
1172
+ const checkModelDiscoveryResult = seatShapeCheck(okArmsRule("discoverModels result", { candidates: reqF(arrayRule(shapeRule("candidate", { id: reqF(R_NONEMPTY), contextWindow: optF(R_INT1), maxTokens: optF(R_INT1) }))) }, { verdict: reqF(oneOfRule("probe verdict", PROBE_VERDICTS)), detail: reqF(R_STR) }));
1016
1173
  const checkSessionMcpPanelFailure = seatShapeCheck(armsRule("readSessionMcpPanel failure", "kind", {
1017
1174
  unreadable: DEVICE_UNREADABLE_SPEC,
1018
1175
  transport: DEVICE_TRANSPORT_SPEC,
@@ -1198,6 +1355,42 @@ const checkSessionHooksRosterResult = seatCheck((v) => {
1198
1355
  return bad("not object");
1199
1356
  return Object.hasOwn(v, "kind") ? checkSessionHooksRosterFailure(v) : checkSessionHooksRosterView(v);
1200
1357
  });
1358
+ const checkMcpServersListResult = localConfigListCheck((v) => leafVerdict(checkMcpServerReportView(v)));
1359
+ const checkMcpServerProbeResult = seatCheck((v) => leafVerdict(checkMcpServerProbeView(v)));
1360
+ const checkMcpServerEditResult = seatCheck((v) => leafVerdict(checkMcpServerEditOutcomeView(v)));
1361
+ const SKILL_EFFECTIVE = shapeRule("skill effective", {
1362
+ value: reqF(oneOfRule("skill state", SKILL_OVERRIDE_STATES)),
1363
+ decidedBy: reqF(oneOfRule("skill decider", SKILL_OVERRIDE_DECIDERS)),
1364
+ });
1365
+ const SKILL_EDITABLE = {
1366
+ label: "skill editable",
1367
+ test: (v, path) => {
1368
+ if (!isPlainRecord(v))
1369
+ return bad("not object", path === "" ? undefined : path);
1370
+ const ok = own(v, "ok");
1371
+ if (ok === true)
1372
+ return shapeVerdict({ ok: reqF(R_TRUE) }, v, path);
1373
+ if (ok === false)
1374
+ return shapeVerdict({ ok: reqF(R_FALSE), lockedBy: reqF(oneOfRule("skill lock source", SKILL_OVERRIDE_LOCK_SOURCES)) }, v, path);
1375
+ return bad("bad value (skill editable)", pathAt(path, "ok"));
1376
+ },
1377
+ };
1378
+ const SKILL_ENTRY_BASE = {
1379
+ name: reqF(R_NONEMPTY),
1380
+ layer: reqF(oneOfRule("skill layer", SKILLS_VIEW_LAYERS)),
1381
+ effective: reqF(SKILL_EFFECTIVE),
1382
+ editable: reqF(SKILL_EDITABLE),
1383
+ };
1384
+ const SKILL_ENTRY = armsRule("skill entry", "status", {
1385
+ applied: { ...SKILL_ENTRY_BASE, description: optF(R_NONEMPTY), nameOnly: optF(R_TRUE) },
1386
+ excluded: { ...SKILL_ENTRY_BASE, reason: reqF(oneOfRule("skill excluded reason", SKILLS_VIEW_EXCLUDED_REASONS)) },
1387
+ }, { applied: [["description"], ["nameOnly"]] });
1388
+ const checkSkillsView = seatShapeCheck(shapeRule("skills view", {
1389
+ entries: reqF(arrayRule(SKILL_ENTRY)),
1390
+ withheldRoots: reqF(shapeRule("withheld roots", { untrusted: reqF(R_INT0), unconfirmed: reqF(R_INT0) })),
1391
+ }));
1392
+ const checkListSkillsResult = localConfigListCheck(checkSkillsView);
1393
+ const checkEditSkillsResult = seatShapeCheck(shapeRule("editSkills result", { receipt: reqF(R_LOCAL_CONFIG_RECEIPT) }));
1201
1394
  const MCP_TOOL_TOGGLE_KEY = shapeRule("toggle key", {
1202
1395
  server: reqF(R_NONEMPTY),
1203
1396
  tool: reqF(R_NONEMPTY),
@@ -2404,6 +2597,9 @@ export const LOCAL_SESSIONS_SPEC = {
2404
2597
  listOnboardProviders: { kind: "invoke", check: checkOnboardProvidersResult },
2405
2598
  probeOnboardEntry: { kind: "invoke", check: checkOnboardProbeResult },
2406
2599
  applyOnboardEntry: { kind: "invoke", check: checkOnboardApplyResult },
2600
+ listModelPool: { kind: "invoke", check: checkModelPoolListResult },
2601
+ editModelPool: { kind: "invoke", check: checkModelPoolEditResult },
2602
+ discoverModels: { kind: "invoke", check: checkModelDiscoveryResult },
2407
2603
  readSessionMcpPanel: { kind: "invoke", check: checkSessionMcpPanelResult },
2408
2604
  listMcpToolToggles: { kind: "invoke", check: checkMcpToolTogglesResult },
2409
2605
  setMcpToolToggle: { kind: "invoke", check: checkOkAck },
@@ -2417,6 +2613,11 @@ export const LOCAL_SESSIONS_SPEC = {
2417
2613
  claimSeatActions: { kind: "invoke", check: checkOkAck },
2418
2614
  readSessionMods: { kind: "invoke", check: checkSessionModsResult },
2419
2615
  readSessionHooksRoster: { kind: "invoke", check: checkSessionHooksRosterResult },
2616
+ listMcpServers: { kind: "invoke", check: checkMcpServersListResult },
2617
+ probeMcpServerEntry: { kind: "invoke", check: checkMcpServerProbeResult },
2618
+ editMcpServer: { kind: "invoke", check: checkMcpServerEditResult },
2619
+ listSkills: { kind: "invoke", check: checkListSkillsResult },
2620
+ editSkills: { kind: "invoke", check: checkEditSkillsResult },
2420
2621
  onEvent: { kind: "event", check: checkLocalSessionEvent },
2421
2622
  onToolPermissionRequest: { kind: "event", check: checkToolPermissionRequest },
2422
2623
  onSeatAction: { kind: "event", check: checkSeatAction },
@@ -2464,6 +2665,9 @@ export const SEAT_METHOD_NAMES = [
2464
2665
  "listOnboardProviders",
2465
2666
  "probeOnboardEntry",
2466
2667
  "applyOnboardEntry",
2668
+ "listModelPool",
2669
+ "editModelPool",
2670
+ "discoverModels",
2467
2671
  "readSessionMcpPanel",
2468
2672
  "listMcpToolToggles",
2469
2673
  "setMcpToolToggle",
@@ -2477,6 +2681,11 @@ export const SEAT_METHOD_NAMES = [
2477
2681
  "claimSeatActions",
2478
2682
  "readSessionMods",
2479
2683
  "readSessionHooksRoster",
2684
+ "listMcpServers",
2685
+ "probeMcpServerEntry",
2686
+ "editMcpServer",
2687
+ "listSkills",
2688
+ "editSkills",
2480
2689
  "onEvent",
2481
2690
  "onToolPermissionRequest",
2482
2691
  "onSeatAction",
@@ -2721,6 +2930,10 @@ export const SEAT_VALIDATOR_KEY_COVERAGE = {
2721
2930
  key: "aliases",
2722
2931
  why: "受理面(0.108.0 CC-944;除行名之外引擎还认的模型词),读法归 modelAcceptanceOf(缺席 = 更早的服务端,照旧判;在场而坏形 ⇒ 没找到行的词读 catalog_unreadable);出站门为它拒掉整份目录 = 选单为一份受理数据整个消失。",
2723
2932
  },
2933
+ {
2934
+ key: "unreadableRows",
2935
+ why: "完整性面(0.112.0 CC-1229;回体读口丢掉的行数,`> 0` 才在场),读法归 modelAcceptanceOf 的读不全判(非正数 / 非数一律不算丢行);出站门为它拒掉整份目录 = 选单为一个计数整个消失。",
2936
+ },
2724
2937
  ],
2725
2938
  },
2726
2939
  SendMessageRequest: {
@@ -2828,7 +3041,7 @@ export const SEAT_VALIDATOR_KEY_COVERAGE = {
2828
3041
  },
2829
3042
  SeatCapabilitiesState: {
2830
3043
  check: checkSeatCapabilitiesState,
2831
- validated: ["pickFolder", "rewind", "recents", "patchSession", "devices", "engineTarget", "onboard", "mcpToolToggles", "thinkingLatch", "computerUseSwitch", "engineModeDefaultOnly", "seatActions", "notificationLevels", "modsView", "quickEntryShortcut", "hooksRoster"],
3044
+ validated: ["pickFolder", "rewind", "recents", "patchSession", "devices", "engineTarget", "onboard", "mcpToolToggles", "thinkingLatch", "computerUseSwitch", "engineModeDefaultOnly", "seatActions", "notificationLevels", "modsView", "quickEntryShortcut", "hooksRoster", "mcpServers", "mcpServerEdit", "skills", "skillsEdit", "modelPool", "modelPoolEdit"],
2832
3045
  unchecked: [],
2833
3046
  },
2834
3047
  RecentFoldersResult: {
@@ -2896,6 +3109,11 @@ export const SEAT_VALIDATOR_COVERAGE_EXEMPT = [
2896
3109
  ["SetComputerUseRequest", checkSetComputerUseRequest],
2897
3110
  ["NotificationLevelsState", checkNotificationLevelsState],
2898
3111
  ["SetNotificationLevelResult", checkSetNotificationLevelResult],
3112
+ ["ModelPoolListResult", checkModelPoolListResult],
3113
+ ["ModelPoolEditResult", checkModelPoolEditResult],
3114
+ ["ModelDiscoveryResult", checkModelDiscoveryResult],
3115
+ ["ModelPoolEditRequest", checkModelPoolEditRequest],
3116
+ ["ModelDiscoveryRequest", checkModelDiscoveryRequest],
2899
3117
  ["SeatAction", checkSeatAction],
2900
3118
  ["EngineSwapAnswerOutcome", checkEngineSwapAnswerOutcome],
2901
3119
  ["SelfUpgradeOutcome", checkSelfUpgradeOutcome],
@@ -2903,6 +3121,11 @@ export const SEAT_VALIDATOR_COVERAGE_EXEMPT = [
2903
3121
  ["QuickEntryShortcutState", checkQuickEntryShortcutState],
2904
3122
  ["SetQuickEntryShortcutResult", checkSetQuickEntryShortcutResult],
2905
3123
  ["SessionHooksRosterResult", checkSessionHooksRosterResult],
3124
+ ["McpServersListResult", checkMcpServersListResult],
3125
+ ["McpServerProbeResult", checkMcpServerProbeResult],
3126
+ ["McpServerEditResult", checkMcpServerEditResult],
3127
+ ["ListSkillsResult", checkListSkillsResult],
3128
+ ["EditSkillsResult", checkEditSkillsResult],
2906
3129
  ].map(([label, check]) => ({
2907
3130
  label,
2908
3131
  check,
@@ -2953,6 +3176,7 @@ const _seatContractPins = [
2953
3176
  true, true,
2954
3177
  true, true, true, true,
2955
3178
  true, true, true,
3179
+ true, true, true, true,
2956
3180
  true,
2957
3181
  true, true, true,
2958
3182
  true, true, true, true, true, true,
@@ -2969,6 +3193,8 @@ const _seatContractPins = [
2969
3193
  true, true, true, true, true, true, true, true,
2970
3194
  true, true, true, true, true,
2971
3195
  true, true, true,
3196
+ true, true, true, true, true, true,
3197
+ true, true, true, true, true, true,
2972
3198
  true, true, true, true,
2973
3199
  true, true, true, true,
2974
3200
  true, true, true, true, true, true,
@@ -1,3 +1,4 @@
1
+ export declare function isDotSegment(seg: string): boolean;
1
2
  export declare function isSessionIdPathSegment(id: unknown): id is string;
2
3
  export type SessionIdRefusalWhy = 'not_string' | 'bad_shape' | 'bad_version' | 'bad_variant';
3
4
  export interface SessionIdRefusal {
@@ -1,5 +1,8 @@
1
+ export function isDotSegment(seg) {
2
+ return seg === '.' || seg === '..';
3
+ }
1
4
  export function isSessionIdPathSegment(id) {
2
- if (typeof id !== 'string' || id === '' || id === '.' || id === '..')
5
+ if (typeof id !== 'string' || id === '' || isDotSegment(id))
3
6
  return false;
4
7
  try {
5
8
  encodeURIComponent(id);
@@ -2,6 +2,7 @@ import { isLoopbackWireUrl, resolveWireAuth } from './engineWireSdk.js';
2
2
  import { INJECTED_WIRE_SETTLE_MS, connectionLostDetail, noAnswerDetailFrom, noAnswerKindOf, provablyNotSent, settleInjected } from './engineWireFor.js';
3
3
  import { memoryEraseReplayPosture, readMemoryEraseReceipt } from './memoryEntriesWire.js';
4
4
  import { normalizeWirePrincipal } from './principalWire.js';
5
+ import { MEMORY_CONTROL_PLANE_CORRUPT } from './engineErrorCodes.js';
5
6
  import { isSessionIdPathSegment } from './sessionIdSegment.js';
6
7
  import { msg, renderMessage } from './i18n/translate.js';
7
8
  const PRINCIPAL_HEADER = 'x-agent-principal';
@@ -359,7 +360,7 @@ function bandOfCode(code) {
359
360
  return { unconfirmed: 'store_link_outside' };
360
361
  case 'memory.scope_home_not_directory':
361
362
  return { unconfirmed: 'store_home_not_directory' };
362
- case 'internal.memory_control_plane_corrupt':
363
+ case MEMORY_CONTROL_PLANE_CORRUPT:
363
364
  return { unconfirmed: 'control_plane_corrupt' };
364
365
  case 'internal.error':
365
366
  return { unconfirmed: 'engine_fault' };
@@ -0,0 +1 @@
1
+ export declare function sha256BytesHex(msg: Uint8Array): string;
@@ -0,0 +1,46 @@
1
+ export function sha256BytesHex(msg) {
2
+ const k = [
3
+ 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5, 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174,
4
+ 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da, 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967,
5
+ 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85, 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070,
6
+ 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3, 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2,
7
+ ];
8
+ const h = [0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19];
9
+ const len = msg.length;
10
+ const padded = new Uint8Array(((len + 8) >>> 6) * 64 + 64);
11
+ padded.set(msg);
12
+ padded[len] = 0x80;
13
+ const view = new DataView(padded.buffer);
14
+ view.setUint32(padded.length - 8, Math.floor(len / 0x20000000));
15
+ view.setUint32(padded.length - 4, (len << 3) >>> 0);
16
+ const w = new Array(64).fill(0);
17
+ const rotr = (x, n) => (x >>> n) | (x << (32 - n));
18
+ for (let off = 0; off < padded.length; off += 64) {
19
+ for (let t = 0; t < 16; t++)
20
+ w[t] = view.getUint32(off + t * 4);
21
+ for (let t = 16; t < 64; t++) {
22
+ const x = w[t - 15] ?? 0;
23
+ const y = w[t - 2] ?? 0;
24
+ const s0 = rotr(x, 7) ^ rotr(x, 18) ^ (x >>> 3);
25
+ const s1 = rotr(y, 17) ^ rotr(y, 19) ^ (y >>> 10);
26
+ w[t] = ((w[t - 16] ?? 0) + s0 + (w[t - 7] ?? 0) + s1) | 0;
27
+ }
28
+ let [a, b, c, d, e, f, g, hh] = h;
29
+ for (let t = 0; t < 64; t++) {
30
+ const t1 = (hh + (rotr(e, 6) ^ rotr(e, 11) ^ rotr(e, 25)) + ((e & f) ^ (~e & g)) + (k[t] ?? 0) + (w[t] ?? 0)) | 0;
31
+ const t2 = ((rotr(a, 2) ^ rotr(a, 13) ^ rotr(a, 22)) + ((a & b) ^ (a & c) ^ (b & c))) | 0;
32
+ hh = g;
33
+ g = f;
34
+ f = e;
35
+ e = (d + t1) | 0;
36
+ d = c;
37
+ c = b;
38
+ b = a;
39
+ a = (t1 + t2) | 0;
40
+ }
41
+ const next = [a, b, c, d, e, f, g, hh];
42
+ for (let i = 0; i < 8; i++)
43
+ h[i] = ((h[i] ?? 0) + (next[i] ?? 0)) | 0;
44
+ }
45
+ return h.map((x) => (x >>> 0).toString(16).padStart(8, '0')).join('');
46
+ }
@@ -0,0 +1,83 @@
1
+ import type { SettingsDocument } from './host.js';
2
+ export declare const SKILL_OVERRIDE_STATES: readonly ["on", "name-only", "user-invocable-only", "off"];
3
+ export type SkillOverrideState = (typeof SKILL_OVERRIDE_STATES)[number];
4
+ export declare const SKILL_ORIGINS: readonly ["skills", "synced", "commands", "mcp", "plugin", "builtin", "bundled"];
5
+ export type SkillOrigin = (typeof SKILL_ORIGINS)[number];
6
+ export declare const SKILL_OVERRIDE_LAYERS: readonly ["policySettings", "flagSettings", "localSettings", "projectSettings", "userSettings"];
7
+ export type SkillOverrideLayer = (typeof SKILL_OVERRIDE_LAYERS)[number];
8
+ type PlainLayer = 'localSettings' | 'projectSettings' | 'userSettings';
9
+ export declare const SKILL_OVERRIDE_DECIDERS: readonly ["policySettings", "flagSettings", "localSettings", "projectSettings", "userSettings", "session", "default", "plugin", "builtin_clamp", "hidden_behind_plugin"];
10
+ export type SkillOverrideDecider = (typeof SKILL_OVERRIDE_DECIDERS)[number];
11
+ export declare const SKILL_OVERRIDE_LOCK_SOURCES: readonly ["policy", "flag", "plugin", "skill-author", "reserved-name"];
12
+ export type SkillOverrideLockSource = (typeof SKILL_OVERRIDE_LOCK_SOURCES)[number];
13
+ export interface SkillSyncedName {
14
+ readonly name: string;
15
+ readonly bare: string;
16
+ }
17
+ export interface SkillOverrideSubject {
18
+ readonly name: string;
19
+ readonly origin: SkillOrigin;
20
+ readonly unqualifiedName?: string;
21
+ readonly bareNameReserved?: boolean;
22
+ readonly aliases?: readonly string[];
23
+ readonly mcpLabels?: readonly string[];
24
+ readonly reservedLabels?: readonly string[];
25
+ readonly syncedNames?: readonly SkillSyncedName[];
26
+ readonly followsSyncedSkillState?: boolean;
27
+ readonly disableModelInvocation?: boolean;
28
+ readonly hiddenBehindPlugin?: boolean;
29
+ }
30
+ export interface SkillOverrideLayers {
31
+ readonly policySettings?: SettingsDocument | null;
32
+ readonly flagSettings?: SettingsDocument | null;
33
+ readonly localSettings?: SettingsDocument | null;
34
+ readonly projectSettings?: SettingsDocument | null;
35
+ readonly userSettings?: SettingsDocument | null;
36
+ readonly session?: {
37
+ readonly [name: string]: string;
38
+ } | null;
39
+ readonly disabledSources?: readonly PlainLayer[];
40
+ readonly bundledSkillsDisabledByEnv?: boolean;
41
+ }
42
+ export interface SkillOverrideEffective {
43
+ readonly value: SkillOverrideState;
44
+ readonly decidedBy: SkillOverrideDecider;
45
+ }
46
+ export interface SkillOverrideLock {
47
+ readonly source: SkillOverrideLockSource;
48
+ readonly value: SkillOverrideState;
49
+ }
50
+ export interface ShapedSkillSubject {
51
+ readonly name: string;
52
+ readonly origin: SkillOrigin;
53
+ readonly unqualifiedName: string | undefined;
54
+ readonly bareNameReserved: boolean;
55
+ readonly aliases: readonly string[];
56
+ readonly mcpLabels: readonly string[];
57
+ readonly reservedLabels: readonly string[];
58
+ readonly syncedNames: readonly SkillSyncedName[];
59
+ readonly followsSyncedSkillState: boolean;
60
+ readonly disableModelInvocation: boolean;
61
+ readonly hiddenBehindPlugin: boolean;
62
+ }
63
+ export declare function shapeSkillSubject(v: SkillOverrideSubject | null | undefined): ShapedSkillSubject | undefined;
64
+ export interface ShapedSkillLayers {
65
+ readonly docs: {
66
+ readonly [L in SkillOverrideLayer]: object | undefined;
67
+ };
68
+ readonly session: object | undefined;
69
+ readonly enabled: (layer: SkillOverrideLayer) => boolean;
70
+ readonly bundledDisabled: boolean;
71
+ }
72
+ export declare function shapeSkillLayers(v: SkillOverrideLayers | null | undefined): ShapedSkillLayers;
73
+ export declare function bareNameOf(s: ShapedSkillSubject): string | undefined;
74
+ export declare function secondaryNamesOf(s: ShapedSkillSubject): string[];
75
+ export declare function effectiveOfShaped(L: ShapedSkillLayers, s: ShapedSkillSubject): SkillOverrideEffective;
76
+ export declare function lockOfShaped(L: ShapedSkillLayers, s: ShapedSkillSubject): SkillOverrideLock | undefined;
77
+ export declare function skillOverrideEffectiveOf(layers: SkillOverrideLayers, skill: SkillOverrideSubject): SkillOverrideEffective | undefined;
78
+ export declare function skillOverrideLockOf(layers: SkillOverrideLayers, skill: SkillOverrideSubject): SkillOverrideLock | undefined;
79
+ export declare function ownValueIn(ov: object | undefined, s: ShapedSkillSubject): SkillOverrideState | undefined;
80
+ export declare function stateAt(ov: object | undefined, key: string | undefined): SkillOverrideState | undefined;
81
+ export declare function lowerTierOf(L: ShapedSkillLayers, s: ShapedSkillSubject, target: 'localSettings' | 'userSettings', skipTargetBare: boolean): SkillOverrideState | undefined;
82
+ export declare function withLayerDoc(L: ShapedSkillLayers, layer: SkillOverrideLayer, doc: SettingsDocument): ShapedSkillLayers;
83
+ export {};