@sema-agent/client-core 0.110.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.
- package/CHANGELOG.md +244 -0
- package/README.md +59 -18
- package/dist/abortableSleep.d.ts +7 -0
- package/dist/abortableSleep.js +37 -0
- package/dist/adapt/arms.js +25 -4
- package/dist/adapt/toolCards.d.ts +3 -1
- package/dist/adapt/toolCards.js +4 -2
- package/dist/adapter/activeRunSelfHeal.d.ts +39 -0
- package/dist/adapter/activeRunSelfHeal.js +171 -3
- package/dist/adapter/downstream/eventToSdkMessage.js +10 -10
- package/dist/adapter/downstream/terminalToSdkResult.d.ts +2 -0
- package/dist/adapter/downstream/terminalToSdkResult.js +11 -0
- package/dist/adapter/runStream.d.ts +5 -0
- package/dist/adapter/runStream.js +15 -3
- package/dist/agentSession/engineSessionBackgroundStop.js +2 -2
- package/dist/attachmentRoute.d.ts +20 -0
- package/dist/attachmentRoute.js +39 -0
- package/dist/attachmentsWireCaps.js +1 -1
- package/dist/builtinOutputStyles.d.ts +12 -0
- package/dist/builtinOutputStyles.js +147 -0
- package/dist/checkpointRowVerdict.d.ts +3 -0
- package/dist/checkpointRowVerdict.js +14 -1
- package/dist/compactionStatus.d.ts +9 -0
- package/dist/compactionStatus.js +29 -5
- package/dist/consoleCaPin.d.ts +136 -0
- package/dist/consoleCaPin.js +827 -0
- package/dist/controlRouter.js +2 -1
- package/dist/coreValuePorts.d.ts +39 -1
- package/dist/coreValuePorts.js +10 -0
- package/dist/decideReceipt.d.ts +2 -1
- package/dist/deviceRebind.js +3 -3
- package/dist/displayUntrusted.d.ts +1 -0
- package/dist/displayUntrusted.js +6 -0
- package/dist/effectiveFacts.d.ts +9 -0
- package/dist/effectiveFacts.js +33 -0
- package/dist/engineAddress.d.ts +1 -0
- package/dist/engineAddress.js +4 -1
- package/dist/engineCredentialRelease.d.ts +54 -0
- package/dist/engineCredentialRelease.js +146 -0
- package/dist/engineErrorCodes.d.ts +1 -0
- package/dist/engineErrorCodes.js +1 -0
- package/dist/engineHealthProbeVerdict.d.ts +24 -0
- package/dist/engineHealthProbeVerdict.js +123 -0
- package/dist/engineNoticeCodes.js +5 -7
- package/dist/engineRepoint.d.ts +12 -5
- package/dist/engineRepoint.js +44 -19
- package/dist/engineRowRef.d.ts +3 -0
- package/dist/engineRowRef.js +11 -1
- package/dist/engineSwapCrossing.d.ts +57 -0
- package/dist/engineSwapCrossing.js +297 -0
- package/dist/engineUnavailable.d.ts +45 -0
- package/dist/engineUnavailable.js +496 -0
- package/dist/engineUrl.js +4 -2
- package/dist/eventLeg.js +3 -3
- package/dist/gateFailureCodes.js +2 -2
- package/dist/generated/sdkFactTables.d.ts +2 -1
- package/dist/generated/sdkFactTables.js +14 -0
- package/dist/generated/settingsSchemaFns.d.ts +1 -0
- package/dist/generated/settingsSchemaFns.js +3 -0
- package/dist/generated/settingsSchemaHooksClassifier.js +38 -9
- package/dist/generated/settingsSchemaTables.d.ts +56 -0
- package/dist/generated/settingsSchemaTables.js +19 -0
- package/dist/generated/settingsSchemaTypes.d.ts +23 -13
- package/dist/generated/settingsSchemaUrlShape.d.ts +1 -0
- package/dist/generated/settingsSchemaUrlShape.js +17 -0
- package/dist/hitl/approvalDelivery.d.ts +1 -0
- package/dist/hitl/approvalDelivery.js +1 -1
- package/dist/hitl/approvalResolution.d.ts +1 -1
- package/dist/hitl/approvalResolution.js +2 -1
- package/dist/hitl/askGateWire.js +5 -6
- package/dist/hitl/decisionRefusal.d.ts +6 -0
- package/dist/hitl/decisionRefusal.js +19 -10
- package/dist/hitl/decisionRefusalCarrier.d.ts +3 -0
- package/dist/hitl/decisionRefusalCarrier.js +348 -0
- package/dist/hitl/decisionSend.d.ts +7 -0
- package/dist/hitl/decisionSend.js +34 -12
- package/dist/hitl/editedApprovalAcceptance.js +1 -1
- package/dist/hitl/elicitationRefusal.d.ts +4 -0
- package/dist/hitl/elicitationRefusal.js +23 -0
- package/dist/hitl/frameRouter.d.ts +2 -2
- package/dist/hitl/frameRouter.js +8 -15
- package/dist/hitl/gateIdentity.d.ts +5 -0
- package/dist/hitl/gateIdentity.js +23 -0
- package/dist/hitl/hitlBridge.d.ts +6 -0
- package/dist/hitl/hitlBridge.js +10 -4
- package/dist/hitl/hitlHostSurface.d.ts +2 -1
- package/dist/hitl/hitlHostSurface.js +7 -2
- package/dist/hitl/localAllowRedemption.d.ts +70 -0
- package/dist/hitl/localAllowRedemption.js +276 -0
- package/dist/hitl/parkOwnership.js +2 -1
- package/dist/hitl/parkResolver.js +14 -4
- package/dist/hitl/persistedRulesWire.d.ts +16 -0
- package/dist/hitl/persistedRulesWire.js +70 -0
- package/dist/hitl/planReviewWire.d.ts +3 -0
- package/dist/hitl/planReviewWire.js +23 -6
- package/dist/hitl/policyDenyCause.d.ts +1 -1
- package/dist/hitl/policyDenyCause.js +1 -1
- package/dist/hitl/resumeRunningCard.d.ts +1 -0
- package/dist/hitl/resumeRunningCard.js +1 -0
- package/dist/hitl/screenCardCarriers.d.ts +15 -0
- package/dist/hitl/screenCardCarriers.js +41 -0
- package/dist/hitl/screenDecisionCards.d.ts +98 -0
- package/dist/hitl/screenDecisionCards.js +363 -0
- package/dist/hitl/sessionPolicyWire.js +2 -2
- package/dist/hitl/standingRows.d.ts +6 -2
- package/dist/hitl/standingRows.js +27 -2
- package/dist/hitl/toolApprovalWire.d.ts +30 -8
- package/dist/hitl/toolApprovalWire.js +264 -121
- package/dist/hooksReaderGenerations.js +1 -1
- package/dist/hooksWireCaps.js +3 -3
- package/dist/hostSettingNoticeArm.d.ts +3 -0
- package/dist/hostSettingNoticeArm.js +12 -0
- package/dist/hostTurnSettings.d.ts +3 -0
- package/dist/hostTurnSettings.js +38 -5
- package/dist/humanTurnRead.js +11 -1
- package/dist/i18n/messages.en.d.ts +292 -0
- package/dist/i18n/messages.en.js +298 -7
- package/dist/i18n/messages.zh.js +316 -6
- package/dist/i18n/translate.d.ts +3 -0
- package/dist/i18n/translate.js +78 -10
- package/dist/i18n/zh.d.ts +1 -0
- package/dist/i18n/zh.js +1 -0
- package/dist/index.d.ts +71 -20
- package/dist/index.js +44 -13
- package/dist/interactiveHalt.js +2 -1
- package/dist/interactiveInterrupt.js +20 -2
- package/dist/liveModelCatalog.d.ts +4 -0
- package/dist/liveModelCatalog.js +12 -3
- package/dist/localConfig/documents.d.ts +61 -0
- package/dist/localConfig/documents.js +51 -0
- package/dist/localConfig/kernel.d.ts +149 -0
- package/dist/localConfig/kernel.js +597 -0
- package/dist/localConfig/mcp/edit.d.ts +161 -0
- package/dist/localConfig/mcp/edit.js +846 -0
- package/dist/localConfig/mcp/servers.d.ts +165 -0
- package/dist/localConfig/mcp/servers.js +776 -0
- package/dist/localConfig/mcp/views.d.ts +170 -0
- package/dist/localConfig/mcp/views.js +429 -0
- package/dist/localConfig/modelPool.d.ts +262 -0
- package/dist/localConfig/modelPool.js +1489 -0
- package/dist/localConfig/modelPoolWords.d.ts +13 -0
- package/dist/localConfig/modelPoolWords.js +20 -0
- package/dist/localConfig/receiptShape.d.ts +7 -0
- package/dist/localConfig/receiptShape.js +135 -0
- package/dist/localConfig/settingsWrite.d.ts +127 -0
- package/dist/localConfig/settingsWrite.js +237 -0
- package/dist/localConfig/skills.d.ts +124 -0
- package/dist/localConfig/skills.js +397 -0
- package/dist/localConfig/skillsWords.d.ts +10 -0
- package/dist/localConfig/skillsWords.js +5 -0
- package/dist/localEngineSeatReading.d.ts +2 -2
- package/dist/localEngineSeatReading.js +5 -3
- package/dist/localEngineSpawn.d.ts +0 -7
- package/dist/localEngineSpawn.js +0 -92
- package/dist/localEngineStep.d.ts +2 -2
- package/dist/localEngineStep.js +2 -0
- package/dist/mcpProbeWire.js +2 -1
- package/dist/mcpReconnect.js +3 -3
- package/dist/mcpWireCaps.js +1 -1
- package/dist/memoryVerbsWire.js +3 -2
- package/dist/model/engineModelWords.d.ts +3 -0
- package/dist/model/engineModelWords.js +13 -0
- package/dist/model/onboardJudgement.d.ts +14 -4
- package/dist/model/onboardJudgement.js +91 -139
- package/dist/model/subagentModelWord.d.ts +21 -2
- package/dist/model/subagentModelWord.js +100 -29
- package/dist/modelCapabilityProbe.js +3 -40
- package/dist/modelConfigGapNotice.d.ts +20 -0
- package/dist/modelConfigGapNotice.js +102 -0
- package/dist/modsKernelIdentity.js +2 -47
- package/dist/notifications.d.ts +19 -0
- package/dist/notifications.js +114 -12
- package/dist/ownKey.d.ts +7 -0
- package/dist/ownKey.js +71 -8
- package/dist/pendingUserRow.d.ts +4 -0
- package/dist/pendingUserRow.js +16 -0
- package/dist/permissionsDeclaration.d.ts +3 -1
- package/dist/permissionsDeclaration.js +33 -9
- package/dist/planReviewCardFacts.d.ts +3 -0
- package/dist/planReviewCardFacts.js +52 -2
- package/dist/pluginHooksWire.d.ts +9 -1
- package/dist/pluginHooksWire.js +40 -6
- package/dist/printToolResultFrame.js +4 -2
- package/dist/promptBlockedCopy.js +12 -7
- package/dist/promptSuggestionBatch.d.ts +7 -0
- package/dist/promptSuggestionBatch.js +9 -0
- package/dist/promptSuggestionsTail.d.ts +39 -0
- package/dist/promptSuggestionsTail.js +116 -0
- package/dist/request/taskRequest.js +10 -6
- package/dist/requestCoordinate.d.ts +1 -0
- package/dist/requestCoordinate.js +13 -0
- package/dist/resumeRefusalCopy.d.ts +3 -1
- package/dist/resumeRefusalCopy.js +12 -4
- package/dist/rewindArchiveReading.js +4 -4
- package/dist/runCancelContext.d.ts +2 -1
- package/dist/runCancelContext.js +1 -0
- package/dist/runLedgerSnapshot.js +3 -3
- package/dist/runPermissionModeSwitch.js +3 -4
- package/dist/scenarioRefusal.js +11 -13
- package/dist/scenarioSkills.js +11 -6
- package/dist/seam.d.ts +16 -2
- package/dist/seam.js +10 -0
- package/dist/seatContract.d.ts +259 -9
- package/dist/seatContract.js +444 -15
- package/dist/sessionCostReading.d.ts +70 -0
- package/dist/sessionCostReading.js +150 -0
- package/dist/sessionHooksRoster.d.ts +4 -0
- package/dist/sessionHooksRoster.js +158 -0
- package/dist/sessionIdSegment.d.ts +1 -0
- package/dist/sessionIdSegment.js +4 -1
- package/dist/sessionMemoryErase.js +2 -1
- package/dist/sessionMemoryStatus.js +2 -2
- package/dist/sessionReadRedaction.d.ts +7 -0
- package/dist/sessionReadRedaction.js +26 -0
- package/dist/sessionSyncFileHistory.js +8 -9
- package/dist/settingsHooksSalvage.js +2 -1
- package/dist/sha256Bytes.d.ts +1 -0
- package/dist/sha256Bytes.js +46 -0
- package/dist/skillOverrideChain.d.ts +83 -0
- package/dist/skillOverrideChain.js +378 -0
- package/dist/skillsWireCaps.d.ts +3 -0
- package/dist/skillsWireCaps.js +16 -1
- package/dist/sseIdleTriage.js +2 -1
- package/dist/storeDurabilityWord.d.ts +15 -0
- package/dist/storeDurabilityWord.js +18 -0
- package/dist/storePostureCapability.d.ts +7 -3
- package/dist/storePostureCapability.js +69 -39
- package/dist/subagent/engineSubagentResume.js +2 -2
- package/dist/subagent/engineSubagentTail.js +2 -1
- package/dist/subagentContentStore.d.ts +11 -0
- package/dist/subagentContentStore.js +28 -2
- package/dist/toolResult.d.ts +1 -0
- package/dist/toolResult.js +2 -0
- package/dist/turnFailurePresentation.js +4 -10
- package/dist/userAttachmentEnvelope.d.ts +2 -1
- package/dist/userAttachmentEnvelope.js +10 -0
- package/dist/wireErrorTriage.js +2 -1
- package/dist/wireFailureShape.d.ts +4 -0
- package/dist/wireFailureShape.js +141 -19
- package/dist/wireRefusalCopy.d.ts +6 -5
- package/dist/wireRefusalCopy.js +49 -92
- package/docs/INTEGRATION-CLIENTS.md +2718 -17
- package/package.json +7 -3
package/dist/seatContract.js
CHANGED
|
@@ -1,16 +1,28 @@
|
|
|
1
1
|
import { PERMISSION_MODE_WORDS, REASONING_EFFORT_WORDS } from "./taskRequestWords.js";
|
|
2
|
+
import { CC_TOOL_DENIAL_KINDS } from "./gateVocabulary.js";
|
|
2
3
|
import { liveDefaultModelCopy, liveModelRowCopy } from "./model/liveCatalogShape.js";
|
|
3
4
|
import { REWIND_MODES } from "./rewindWireCaps.js";
|
|
4
5
|
import { SETTINGS_MODEL_API_WORDS } from "./generated/settingsSchemaTables.js";
|
|
5
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";
|
|
6
11
|
import { guardedRead, ownDataField, ownDataRefusalKeyOf, ownSendableField, readOwnDataValue } from "./ownKey.js";
|
|
7
12
|
import { isPlainRecord as isJsonPlainRecord } from "./jsonFaithful.js";
|
|
8
13
|
import { displayUntrustedMarks, quoteUntrustedForSentence } from "./displayUntrusted.js";
|
|
9
14
|
import { MCP_LIVENESS_STATES } from "./mcpLiveness.js";
|
|
15
|
+
import { checkMcpServerReportView, checkMcpServerEditOutcomeView, checkMcpServerProbeView } from "./localConfig/mcp/views.js";
|
|
10
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";
|
|
11
19
|
import { EXECUTION_PLACEMENT_ROLES } from "./executionPlacementWords.js";
|
|
12
20
|
import { isSessionEngineView } from "./sessionEngine.js";
|
|
13
21
|
import { LOCAL_ENGINE_SWAP_CAUSES } from "./localEngineSwapCard.js";
|
|
22
|
+
import { HOOK_ENTRY_TYPE_WORDS, PLUGIN_HOOK_EXCLUSION_REASONS, PLUGIN_HOOK_REASONS, SETTINGS_HOOK_DROP_REASONS, } from "./pluginHooksWire.js";
|
|
23
|
+
import { HTTP_POLICY_DROP_REASONS } from "./httpHookPolicy.js";
|
|
24
|
+
import { HOOK_SETTINGS_SOURCE_TEXT } from "./settingsHooksSalvage.js";
|
|
25
|
+
import { SETTINGS_HOOK_EVENTS, SETTINGS_HOOKS_DROPPED_PIECE_CODES, SETTINGS_HOOKS_REJECTION_CODES } from "./generated/settingsSchemaFns.js";
|
|
14
26
|
const bad = (reason, field) => field === undefined ? { reason } : { reason, field };
|
|
15
27
|
const nested = (prefix, verdict) => {
|
|
16
28
|
const path = verdict.field === undefined
|
|
@@ -311,6 +323,8 @@ const CHROME_ARM_SEAT_ROUTE = {
|
|
|
311
323
|
engine_notice: "seat",
|
|
312
324
|
subagent_alias: "seat",
|
|
313
325
|
session_box_notice: "seat",
|
|
326
|
+
resupply_truncated: "seat",
|
|
327
|
+
host_setting_notice: "seat",
|
|
314
328
|
workflow_notification_enqueue: "host",
|
|
315
329
|
plan_review_park: "host",
|
|
316
330
|
approval_request: "host",
|
|
@@ -399,7 +413,7 @@ export function readSeatStreamDelta(message) {
|
|
|
399
413
|
return Object.freeze({ kind: "malformed" });
|
|
400
414
|
}
|
|
401
415
|
}
|
|
402
|
-
export const SEAT_CAPABILITY_NAMES = Object.freeze(["pickFolder", "rewind", "recents", "patchSession", "devices", "engineTarget", "onboard", "mcpToolToggles", "thinkingLatch", "computerUseSwitch", "engineModeDefaultOnly", "seatActions", "notificationLevels", "modsView"]);
|
|
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"]);
|
|
403
417
|
const notReported = () => Object.freeze({ kind: "not_reported" });
|
|
404
418
|
const malformedReading = () => Object.freeze({ kind: "malformed" });
|
|
405
419
|
const reported = (available) => Object.freeze({ kind: "reported", available });
|
|
@@ -481,6 +495,14 @@ const SEAT_CAPABILITY_PHRASES = Object.freeze({
|
|
|
481
495
|
seatActions: Object.freeze({ action: "App menu actions", ability: "send actions to this window", support: "app action support" }),
|
|
482
496
|
notificationLevels: Object.freeze({ action: "Choosing notification levels", ability: "keep notification levels", support: "notification-level support" }),
|
|
483
497
|
modsView: Object.freeze({ action: "Showing mods", ability: "show mods", support: "mods support" }),
|
|
498
|
+
quickEntryShortcut: Object.freeze({ action: "Changing the Quick Entry shortcut", ability: "change the Quick Entry shortcut", support: "Quick Entry shortcut support" }),
|
|
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" }),
|
|
484
506
|
});
|
|
485
507
|
export function seatCapabilityUnavailableDetail(name, reading) {
|
|
486
508
|
const phrase = Object.hasOwn(SEAT_CAPABILITY_PHRASES, name)
|
|
@@ -715,6 +737,7 @@ export const LOCAL_ENGINE_DOWN_REASONS = Object.freeze([
|
|
|
715
737
|
"stop-failed",
|
|
716
738
|
"crash-loop",
|
|
717
739
|
"high-water-unreadable",
|
|
740
|
+
"exited-once",
|
|
718
741
|
"principal-unknown",
|
|
719
742
|
]);
|
|
720
743
|
export const LOCAL_ENGINE_WAITING_REASONS = Object.freeze(["starting", "dormant", "draining", "unanswered", "peer"]);
|
|
@@ -874,7 +897,7 @@ const ENGINE_TARGET_STATE = shapeRule("engine target", {
|
|
|
874
897
|
mode: reqF(R_ENGINE_LANE),
|
|
875
898
|
generation: reqF(R_INT0),
|
|
876
899
|
cloud: reqF(ENGINE_TARGET_CLOUD),
|
|
877
|
-
local:
|
|
900
|
+
local: optF(ENGINE_TARGET_LOCAL),
|
|
878
901
|
});
|
|
879
902
|
const checkEngineTargetState = seatShapeCheck(ENGINE_TARGET_STATE);
|
|
880
903
|
const okArmsRule = (label, okSpec, refusedSpec) => ({
|
|
@@ -929,6 +952,7 @@ const ONBOARD_PROBE_RESULT = shapeRule("probe result", {
|
|
|
929
952
|
verdict: reqF(oneOfRule("probe verdict", PROBE_VERDICTS)),
|
|
930
953
|
detail: reqF(R_STR),
|
|
931
954
|
thinking: optF(R_NONEMPTY),
|
|
955
|
+
firstOutputMs: optF(R_INT0),
|
|
932
956
|
});
|
|
933
957
|
const ENGINE_UP_SPEC = { model: reqF(ruleOf("string|null", (x) => x === null || typeof x === "string")) };
|
|
934
958
|
const ENGINE_NOT_UP_SPEC = { reason: reqF(R_STR) };
|
|
@@ -992,6 +1016,7 @@ const checkOnboardProvidersResult = seatShapeCheck(shapeRule("onboard providers"
|
|
|
992
1016
|
maxTokens: reqF(R_INT1),
|
|
993
1017
|
}))),
|
|
994
1018
|
consoleUrl: optF(R_STR),
|
|
1019
|
+
signupUrl: optF(R_STR),
|
|
995
1020
|
}))),
|
|
996
1021
|
importable: optF(arrayRule(shapeRule("importable profile", {
|
|
997
1022
|
id: reqF(R_NONEMPTY),
|
|
@@ -1003,6 +1028,148 @@ const checkOnboardProvidersResult = seatShapeCheck(shapeRule("onboard providers"
|
|
|
1003
1028
|
isCurrent: optF(R_BOOL),
|
|
1004
1029
|
}))),
|
|
1005
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) }));
|
|
1006
1173
|
const checkSessionMcpPanelFailure = seatShapeCheck(armsRule("readSessionMcpPanel failure", "kind", {
|
|
1007
1174
|
unreadable: DEVICE_UNREADABLE_SPEC,
|
|
1008
1175
|
transport: DEVICE_TRANSPORT_SPEC,
|
|
@@ -1116,6 +1283,114 @@ const checkSessionModsResult = seatCheck((v) => {
|
|
|
1116
1283
|
return bad("not object");
|
|
1117
1284
|
return Object.hasOwn(v, "kind") ? checkSessionModsFailure(v) : checkSessionModsView(v);
|
|
1118
1285
|
});
|
|
1286
|
+
export const SESSION_HOOKS_ROSTER_STATUSES = Object.freeze(["engine", "shell", "not_run"]);
|
|
1287
|
+
const HOOKS_ROSTER_CLOSED_BY = Object.freeze(["workspace_untrusted", "governance_unreadable", "policy_disable_all"]);
|
|
1288
|
+
const HOOKS_ROSTER_REASONS = Object.freeze([...new Set([...PLUGIN_HOOK_REASONS, ...PLUGIN_HOOK_EXCLUSION_REASONS, ...SETTINGS_HOOK_DROP_REASONS])]);
|
|
1289
|
+
const R_HOOK_SOURCE = ruleOf("hook source", (v) => typeof v === "string" && Object.hasOwn(HOOK_SETTINGS_SOURCE_TEXT, v));
|
|
1290
|
+
const R_HOOK_EVENT = oneOfRule("hook event", SETTINGS_HOOK_EVENTS);
|
|
1291
|
+
const HOOKS_ROSTER_ROW_SHAPE = shapeRule("hooks roster row", {
|
|
1292
|
+
source: reqF(R_HOOK_SOURCE),
|
|
1293
|
+
event: reqF(R_HOOK_EVENT),
|
|
1294
|
+
groupIndex: reqF(R_INT0),
|
|
1295
|
+
hookIndex: reqF(R_INT0),
|
|
1296
|
+
type: optF(oneOfRule("hook type", HOOK_ENTRY_TYPE_WORDS)),
|
|
1297
|
+
status: reqF(oneOfRule("hooks roster status", SESSION_HOOKS_ROSTER_STATUSES)),
|
|
1298
|
+
reason: reqF(oneOfRule("hooks roster reason", HOOKS_ROSTER_REASONS)),
|
|
1299
|
+
});
|
|
1300
|
+
const HOOKS_ROSTER_ROW = {
|
|
1301
|
+
label: HOOKS_ROSTER_ROW_SHAPE.label,
|
|
1302
|
+
test: (v, path) => {
|
|
1303
|
+
const verdict = HOOKS_ROSTER_ROW_SHAPE.test(v, path);
|
|
1304
|
+
if (verdict !== true)
|
|
1305
|
+
return verdict;
|
|
1306
|
+
const rec = v;
|
|
1307
|
+
const status = own(rec, "status");
|
|
1308
|
+
const reason = own(rec, "reason");
|
|
1309
|
+
if (status === "engine" && !PLUGIN_HOOK_REASONS.includes(reason))
|
|
1310
|
+
return bad("status conflict", pathAt(path, "reason"));
|
|
1311
|
+
return true;
|
|
1312
|
+
},
|
|
1313
|
+
};
|
|
1314
|
+
const HOOKS_ROSTER_LAYER = armsRule("hooks roster layer", "state", {
|
|
1315
|
+
"loaded-partial": { source: reqF(R_HOOK_SOURCE), codes: reqF(arrayRule(oneOfRule("hooks drop code", SETTINGS_HOOKS_DROPPED_PIECE_CODES), true)) },
|
|
1316
|
+
rejected: { source: reqF(R_HOOK_SOURCE), codes: reqF(arrayRule(oneOfRule("hooks rejection code", SETTINGS_HOOKS_REJECTION_CODES), true)) },
|
|
1317
|
+
trust_withheld: { source: reqF(R_HOOK_SOURCE) },
|
|
1318
|
+
});
|
|
1319
|
+
const HOOKS_ROSTER_HTTP_ROW = shapeRule("hooks roster http row", {
|
|
1320
|
+
source: reqF(R_HOOK_SOURCE),
|
|
1321
|
+
event: reqF(R_HOOK_EVENT),
|
|
1322
|
+
reason: reqF(oneOfRule("http policy reason", HTTP_POLICY_DROP_REASONS)),
|
|
1323
|
+
});
|
|
1324
|
+
const HOOKS_ROSTER_SHAPE = shapeRule("hooks roster", {
|
|
1325
|
+
closedBy: reqF(ruleOf("closedBy", (v) => v === null || (typeof v === "string" && inTuple(HOOKS_ROSTER_CLOSED_BY, v)))),
|
|
1326
|
+
sources: optF(arrayRule(R_HOOK_SOURCE)),
|
|
1327
|
+
rows: reqF(arrayRule(HOOKS_ROSTER_ROW)),
|
|
1328
|
+
layers: reqF(arrayRule(HOOKS_ROSTER_LAYER)),
|
|
1329
|
+
http: reqF(arrayRule(HOOKS_ROSTER_HTTP_ROW)),
|
|
1330
|
+
unlisted: reqF(R_INT0),
|
|
1331
|
+
});
|
|
1332
|
+
const checkSessionHooksRosterView = seatShapeCheck({
|
|
1333
|
+
label: HOOKS_ROSTER_SHAPE.label,
|
|
1334
|
+
test: (v, path) => {
|
|
1335
|
+
const verdict = HOOKS_ROSTER_SHAPE.test(v, path);
|
|
1336
|
+
if (verdict !== true)
|
|
1337
|
+
return verdict;
|
|
1338
|
+
const rec = v;
|
|
1339
|
+
if (own(rec, "closedBy") === null)
|
|
1340
|
+
return true;
|
|
1341
|
+
const rows = ownItems(own(rec, "rows"));
|
|
1342
|
+
for (let i = 0; i < rows.length; i += 1) {
|
|
1343
|
+
if (own(rows[i], "status") !== "not_run")
|
|
1344
|
+
return bad("status conflict", pathAt(path, `rows[${i}].status`));
|
|
1345
|
+
}
|
|
1346
|
+
return true;
|
|
1347
|
+
},
|
|
1348
|
+
});
|
|
1349
|
+
const checkSessionHooksRosterFailure = seatShapeCheck(armsRule("readSessionHooksRoster failure", "kind", {
|
|
1350
|
+
unreadable: DEVICE_UNREADABLE_SPEC,
|
|
1351
|
+
unarmed: {},
|
|
1352
|
+
}));
|
|
1353
|
+
const checkSessionHooksRosterResult = seatCheck((v) => {
|
|
1354
|
+
if (!isPlainRecord(v))
|
|
1355
|
+
return bad("not object");
|
|
1356
|
+
return Object.hasOwn(v, "kind") ? checkSessionHooksRosterFailure(v) : checkSessionHooksRosterView(v);
|
|
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) }));
|
|
1119
1394
|
const MCP_TOOL_TOGGLE_KEY = shapeRule("toggle key", {
|
|
1120
1395
|
server: reqF(R_NONEMPTY),
|
|
1121
1396
|
tool: reqF(R_NONEMPTY),
|
|
@@ -1280,7 +1555,75 @@ export function planSetNotificationLevel(type, level, supported) {
|
|
|
1280
1555
|
return Object.freeze({ kind: "refused", reason: "unsupported-level" });
|
|
1281
1556
|
return Object.freeze({ kind: "apply", type, level });
|
|
1282
1557
|
}
|
|
1283
|
-
export const
|
|
1558
|
+
export const QUICK_ENTRY_SHORTCUT_FAILURES = Object.freeze(["invalid-accelerator", "registration-failed"]);
|
|
1559
|
+
export const QUICK_ENTRY_SHORTCUT_REFUSAL_REASONS = Object.freeze(["invalid-request", "invalid-accelerator", "registration-failed", "write-failed"]);
|
|
1560
|
+
const QUICK_ENTRY_ACCELERATOR_SPEC = { accelerator: reqF(R_NONEMPTY) };
|
|
1561
|
+
const R_QUICK_ENTRY_SHORTCUT = {
|
|
1562
|
+
label: "quick entry shortcut",
|
|
1563
|
+
test: (v, path) => (v === "off" ? true : shapeVerdict(QUICK_ENTRY_ACCELERATOR_SPEC, v, path)),
|
|
1564
|
+
};
|
|
1565
|
+
const QUICK_ENTRY_STATE_SHAPE = shapeRule("quick entry shortcut state", {
|
|
1566
|
+
saved: reqF(R_QUICK_ENTRY_SHORTCUT),
|
|
1567
|
+
active: reqF(ruleOf("active accelerator", (v) => v === null || (typeof v === "string" && v.length > 0))),
|
|
1568
|
+
savedFailure: reqF(ruleOf("saved failure", (v) => v === null || (typeof v === "string" && inTuple(QUICK_ENTRY_SHORTCUT_FAILURES, v)))),
|
|
1569
|
+
});
|
|
1570
|
+
const QUICK_ENTRY_STATE = {
|
|
1571
|
+
label: QUICK_ENTRY_STATE_SHAPE.label,
|
|
1572
|
+
test: (v, path) => {
|
|
1573
|
+
const verdict = QUICK_ENTRY_STATE_SHAPE.test(v, path);
|
|
1574
|
+
if (verdict !== true)
|
|
1575
|
+
return verdict;
|
|
1576
|
+
const rec = v;
|
|
1577
|
+
if (own(rec, "savedFailure") === null)
|
|
1578
|
+
return true;
|
|
1579
|
+
const saved = own(rec, "saved");
|
|
1580
|
+
if (saved === "off")
|
|
1581
|
+
return bad("failure conflict", pathAt(path, "savedFailure"));
|
|
1582
|
+
if (own(rec, "active") === own(saved, "accelerator"))
|
|
1583
|
+
return bad("failure conflict", pathAt(path, "active"));
|
|
1584
|
+
return true;
|
|
1585
|
+
},
|
|
1586
|
+
};
|
|
1587
|
+
const checkQuickEntryShortcutState = seatShapeCheck(QUICK_ENTRY_STATE);
|
|
1588
|
+
const SET_QUICK_ENTRY_SHORTCUT_RESULT = okArmsRule("setQuickEntryShortcut result", { state: reqF(QUICK_ENTRY_STATE) }, {
|
|
1589
|
+
reason: reqF(oneOfRule("quick entry refusal", QUICK_ENTRY_SHORTCUT_REFUSAL_REASONS)),
|
|
1590
|
+
state: reqF(QUICK_ENTRY_STATE),
|
|
1591
|
+
});
|
|
1592
|
+
const checkSetQuickEntryShortcutResult = seatShapeCheck({
|
|
1593
|
+
label: SET_QUICK_ENTRY_SHORTCUT_RESULT.label,
|
|
1594
|
+
test: (v, path) => {
|
|
1595
|
+
const verdict = SET_QUICK_ENTRY_SHORTCUT_RESULT.test(v, path);
|
|
1596
|
+
if (verdict !== true)
|
|
1597
|
+
return verdict;
|
|
1598
|
+
const rec = v;
|
|
1599
|
+
if (own(rec, "ok") === true && own(own(rec, "state"), "savedFailure") !== null)
|
|
1600
|
+
return bad("failure conflict", pathAt(path, "state.savedFailure"));
|
|
1601
|
+
return true;
|
|
1602
|
+
},
|
|
1603
|
+
});
|
|
1604
|
+
export function planSetQuickEntryShortcut(request) {
|
|
1605
|
+
const refused = Object.freeze({ kind: "refused", reason: "invalid-request" });
|
|
1606
|
+
if (request === "off")
|
|
1607
|
+
return Object.freeze({ kind: "apply", next: "off" });
|
|
1608
|
+
try {
|
|
1609
|
+
if (!isPlainRecord(request) || firstAccessorPath(request) !== undefined)
|
|
1610
|
+
return refused;
|
|
1611
|
+
const snap = new Map();
|
|
1612
|
+
for (const k of Reflect.ownKeys(request))
|
|
1613
|
+
if (typeof k === "string")
|
|
1614
|
+
snap.set(k, own(request, k));
|
|
1615
|
+
if (snap.size !== 1 || !snap.has("accelerator"))
|
|
1616
|
+
return refused;
|
|
1617
|
+
const accelerator = snap.get("accelerator");
|
|
1618
|
+
if (typeof accelerator !== "string" || accelerator.length === 0)
|
|
1619
|
+
return refused;
|
|
1620
|
+
return Object.freeze({ kind: "apply", next: Object.freeze({ accelerator }) });
|
|
1621
|
+
}
|
|
1622
|
+
catch {
|
|
1623
|
+
return refused;
|
|
1624
|
+
}
|
|
1625
|
+
}
|
|
1626
|
+
export const SEAT_ACTION_NAMES = Object.freeze(["new-project", "prefill-composer", "open-local-setup"]);
|
|
1284
1627
|
const SEAT_PREFILL_TEXT_MAX = 14336;
|
|
1285
1628
|
const SEAT_PREFILL_CWD_MAX = 4096;
|
|
1286
1629
|
const SEAT_ACTIONS_CLAIM_MAX = 16;
|
|
@@ -1293,6 +1636,7 @@ const R_PREFILL_CWD = ruleOf(`folder path (1–${SEAT_PREFILL_CWD_MAX} chars, no
|
|
|
1293
1636
|
const SEAT_ACTION_ARMS = {
|
|
1294
1637
|
"new-project": {},
|
|
1295
1638
|
"prefill-composer": { text: reqF(R_PREFILL_TEXT), cwd: optF(R_PREFILL_CWD) },
|
|
1639
|
+
"open-local-setup": {},
|
|
1296
1640
|
};
|
|
1297
1641
|
export const checkSeatAction = seatShapeCheck(armsRule("seat action", "action", SEAT_ACTION_ARMS));
|
|
1298
1642
|
const seatActionMalformed = (reason) => Object.freeze({ kind: "malformed", reason });
|
|
@@ -1311,6 +1655,8 @@ export function readSeatAction(ev) {
|
|
|
1311
1655
|
}
|
|
1312
1656
|
if (name === "new-project")
|
|
1313
1657
|
return Object.freeze({ kind: "action", action: Object.freeze({ action: "new-project" }) });
|
|
1658
|
+
if (name === "open-local-setup")
|
|
1659
|
+
return Object.freeze({ kind: "action", action: Object.freeze({ action: "open-local-setup" }) });
|
|
1314
1660
|
const text = own(ev, "text");
|
|
1315
1661
|
const cwd = own(ev, "cwd");
|
|
1316
1662
|
if (R_PREFILL_TEXT.test(text, "text") !== true || typeof text !== "string")
|
|
@@ -1763,6 +2109,8 @@ const SUBAGENT_CONTENT_SHAPE = shapeRule("subagent content", {
|
|
|
1763
2109
|
output: optF(R_STR),
|
|
1764
2110
|
isError: optF(R_BOOL),
|
|
1765
2111
|
notExecuted: optF(R_TRUE),
|
|
2112
|
+
denialKind: optF(oneOfRule("denial kind", CC_TOOL_DENIAL_KINDS)),
|
|
2113
|
+
refusalNoted: optF(R_TRUE),
|
|
1766
2114
|
});
|
|
1767
2115
|
export function readSeatSubagentContent(event) {
|
|
1768
2116
|
try {
|
|
@@ -2037,23 +2385,43 @@ const R_SETTLED_ELSEWHERE = shapeRule("settled elsewhere", {
|
|
|
2037
2385
|
firstDecision: reqF(oneOfRule("decision word", TOOL_PERMISSION_SETTLED_WORDS)),
|
|
2038
2386
|
contrary: reqF(R_BOOL),
|
|
2039
2387
|
});
|
|
2040
|
-
const
|
|
2041
|
-
|
|
2042
|
-
|
|
2043
|
-
return base;
|
|
2044
|
-
const slot = own(v, "settledElsewhere");
|
|
2045
|
-
return isAbsent(slot) ? true : R_SETTLED_ELSEWHERE.test(slot, "settledElsewhere");
|
|
2388
|
+
const TOOL_PERMISSION_UNCONFIRMED_CAUSES = Object.freeze(["transport", "server_error", "local_error", "aborted", "gone_after_retry", "registry_unreadable"]);
|
|
2389
|
+
const R_UNCONFIRMED = shapeRule("unconfirmed", {
|
|
2390
|
+
cause: reqF(oneOfRule("cause word", TOOL_PERMISSION_UNCONFIRMED_CAUSES)),
|
|
2046
2391
|
});
|
|
2047
|
-
const
|
|
2392
|
+
const R_TOOL_PERMISSION_ACK = shapeRule("permission ack", {
|
|
2393
|
+
ok: reqF(R_BOOL),
|
|
2394
|
+
settledElsewhere: optF(R_SETTLED_ELSEWHERE),
|
|
2395
|
+
unconfirmed: optF(R_UNCONFIRMED),
|
|
2396
|
+
});
|
|
2397
|
+
const TOOL_PERMISSION_ACK_SLOTS = [["settledElsewhere"], ["unconfirmed"]];
|
|
2398
|
+
const R_FALSE = ruleOf("false", (v) => v === false);
|
|
2399
|
+
function toolPermissionAckVerdict(v) {
|
|
2400
|
+
if (!isPlainRecord(v))
|
|
2401
|
+
return okAckVerdict(v);
|
|
2402
|
+
const shape = R_TOOL_PERMISSION_ACK.test(v, "");
|
|
2403
|
+
if (shape !== true)
|
|
2404
|
+
return shape;
|
|
2405
|
+
const ack = v;
|
|
2406
|
+
const groups = keyGroupsVerdict(TOOL_PERMISSION_ACK_SLOTS, ack, "");
|
|
2407
|
+
if (groups !== true)
|
|
2408
|
+
return groups;
|
|
2409
|
+
const ok = own(ack, "ok");
|
|
2410
|
+
if (!isAbsent(own(ack, "unconfirmed")))
|
|
2411
|
+
return R_FALSE.test(ok, "ok");
|
|
2412
|
+
const settled = own(ack, "settledElsewhere");
|
|
2413
|
+
if (isAbsent(settled))
|
|
2414
|
+
return true;
|
|
2415
|
+
return own(settled, "contrary") === true ? R_FALSE.test(ok, "ok") : R_TRUE.test(ok, "ok");
|
|
2416
|
+
}
|
|
2417
|
+
const checkToolPermissionAck = seatShapeCheck({ label: "permission ack", test: (v) => toolPermissionAckVerdict(v) });
|
|
2048
2418
|
export function readToolPermissionSettledElsewhere(ack) {
|
|
2049
2419
|
try {
|
|
2050
|
-
if (
|
|
2420
|
+
if (checkToolPermissionAck(ack) !== true)
|
|
2051
2421
|
return undefined;
|
|
2052
2422
|
const slot = own(ack, "settledElsewhere");
|
|
2053
2423
|
if (isAbsent(slot))
|
|
2054
2424
|
return undefined;
|
|
2055
|
-
if (checkSettledElsewhereSlot(slot) !== true)
|
|
2056
|
-
return undefined;
|
|
2057
2425
|
const first = own(slot, "firstDecision");
|
|
2058
2426
|
return Object.freeze({ firstDecision: first === "allow" ? "allow" : "deny", contrary: own(slot, "contrary") === true });
|
|
2059
2427
|
}
|
|
@@ -2061,6 +2429,22 @@ export function readToolPermissionSettledElsewhere(ack) {
|
|
|
2061
2429
|
return undefined;
|
|
2062
2430
|
}
|
|
2063
2431
|
}
|
|
2432
|
+
export function readToolPermissionAckState(ack) {
|
|
2433
|
+
try {
|
|
2434
|
+
if (checkToolPermissionAck(ack) !== true)
|
|
2435
|
+
return undefined;
|
|
2436
|
+
const un = own(ack, "unconfirmed");
|
|
2437
|
+
if (!isAbsent(un)) {
|
|
2438
|
+
const word = own(un, "cause");
|
|
2439
|
+
const cause = TOOL_PERMISSION_UNCONFIRMED_CAUSES.find((w) => w === word);
|
|
2440
|
+
return cause === undefined ? undefined : Object.freeze({ kind: "unconfirmed", cause });
|
|
2441
|
+
}
|
|
2442
|
+
return own(ack, "ok") === true ? Object.freeze({ kind: "applied" }) : Object.freeze({ kind: "not_applied" });
|
|
2443
|
+
}
|
|
2444
|
+
catch {
|
|
2445
|
+
return undefined;
|
|
2446
|
+
}
|
|
2447
|
+
}
|
|
2064
2448
|
const checkBooleanAck = (v) => typeof v === "boolean" ? true : bad("expected a bare boolean result");
|
|
2065
2449
|
const checkGetTranscriptResult = seatCheck((v) => {
|
|
2066
2450
|
if (!isPlainRecord(v))
|
|
@@ -2213,6 +2597,9 @@ export const LOCAL_SESSIONS_SPEC = {
|
|
|
2213
2597
|
listOnboardProviders: { kind: "invoke", check: checkOnboardProvidersResult },
|
|
2214
2598
|
probeOnboardEntry: { kind: "invoke", check: checkOnboardProbeResult },
|
|
2215
2599
|
applyOnboardEntry: { kind: "invoke", check: checkOnboardApplyResult },
|
|
2600
|
+
listModelPool: { kind: "invoke", check: checkModelPoolListResult },
|
|
2601
|
+
editModelPool: { kind: "invoke", check: checkModelPoolEditResult },
|
|
2602
|
+
discoverModels: { kind: "invoke", check: checkModelDiscoveryResult },
|
|
2216
2603
|
readSessionMcpPanel: { kind: "invoke", check: checkSessionMcpPanelResult },
|
|
2217
2604
|
listMcpToolToggles: { kind: "invoke", check: checkMcpToolTogglesResult },
|
|
2218
2605
|
setMcpToolToggle: { kind: "invoke", check: checkOkAck },
|
|
@@ -2221,8 +2608,16 @@ export const LOCAL_SESSIONS_SPEC = {
|
|
|
2221
2608
|
setComputerUse: { kind: "invoke", check: checkSetComputerUseResult },
|
|
2222
2609
|
getNotificationLevels: { kind: "invoke", check: checkNotificationLevelsState },
|
|
2223
2610
|
setNotificationLevel: { kind: "invoke", check: checkSetNotificationLevelResult },
|
|
2611
|
+
getQuickEntryShortcut: { kind: "invoke", check: checkQuickEntryShortcutState },
|
|
2612
|
+
setQuickEntryShortcut: { kind: "invoke", check: checkSetQuickEntryShortcutResult },
|
|
2224
2613
|
claimSeatActions: { kind: "invoke", check: checkOkAck },
|
|
2225
2614
|
readSessionMods: { kind: "invoke", check: checkSessionModsResult },
|
|
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 },
|
|
2226
2621
|
onEvent: { kind: "event", check: checkLocalSessionEvent },
|
|
2227
2622
|
onToolPermissionRequest: { kind: "event", check: checkToolPermissionRequest },
|
|
2228
2623
|
onSeatAction: { kind: "event", check: checkSeatAction },
|
|
@@ -2270,6 +2665,9 @@ export const SEAT_METHOD_NAMES = [
|
|
|
2270
2665
|
"listOnboardProviders",
|
|
2271
2666
|
"probeOnboardEntry",
|
|
2272
2667
|
"applyOnboardEntry",
|
|
2668
|
+
"listModelPool",
|
|
2669
|
+
"editModelPool",
|
|
2670
|
+
"discoverModels",
|
|
2273
2671
|
"readSessionMcpPanel",
|
|
2274
2672
|
"listMcpToolToggles",
|
|
2275
2673
|
"setMcpToolToggle",
|
|
@@ -2278,8 +2676,16 @@ export const SEAT_METHOD_NAMES = [
|
|
|
2278
2676
|
"setComputerUse",
|
|
2279
2677
|
"getNotificationLevels",
|
|
2280
2678
|
"setNotificationLevel",
|
|
2679
|
+
"getQuickEntryShortcut",
|
|
2680
|
+
"setQuickEntryShortcut",
|
|
2281
2681
|
"claimSeatActions",
|
|
2282
2682
|
"readSessionMods",
|
|
2683
|
+
"readSessionHooksRoster",
|
|
2684
|
+
"listMcpServers",
|
|
2685
|
+
"probeMcpServerEntry",
|
|
2686
|
+
"editMcpServer",
|
|
2687
|
+
"listSkills",
|
|
2688
|
+
"editSkills",
|
|
2283
2689
|
"onEvent",
|
|
2284
2690
|
"onToolPermissionRequest",
|
|
2285
2691
|
"onSeatAction",
|
|
@@ -2524,6 +2930,10 @@ export const SEAT_VALIDATOR_KEY_COVERAGE = {
|
|
|
2524
2930
|
key: "aliases",
|
|
2525
2931
|
why: "受理面(0.108.0 CC-944;除行名之外引擎还认的模型词),读法归 modelAcceptanceOf(缺席 = 更早的服务端,照旧判;在场而坏形 ⇒ 没找到行的词读 catalog_unreadable);出站门为它拒掉整份目录 = 选单为一份受理数据整个消失。",
|
|
2526
2932
|
},
|
|
2933
|
+
{
|
|
2934
|
+
key: "unreadableRows",
|
|
2935
|
+
why: "完整性面(0.112.0 CC-1229;回体读口丢掉的行数,`> 0` 才在场),读法归 modelAcceptanceOf 的读不全判(非正数 / 非数一律不算丢行);出站门为它拒掉整份目录 = 选单为一个计数整个消失。",
|
|
2936
|
+
},
|
|
2527
2937
|
],
|
|
2528
2938
|
},
|
|
2529
2939
|
SendMessageRequest: {
|
|
@@ -2601,7 +3011,7 @@ export const SEAT_VALIDATOR_KEY_COVERAGE = {
|
|
|
2601
3011
|
},
|
|
2602
3012
|
ToolPermissionAck: {
|
|
2603
3013
|
check: checkToolPermissionAck,
|
|
2604
|
-
validated: ["ok", "settledElsewhere"],
|
|
3014
|
+
validated: ["ok", "settledElsewhere", "unconfirmed"],
|
|
2605
3015
|
unchecked: [],
|
|
2606
3016
|
},
|
|
2607
3017
|
GetTranscriptResult: {
|
|
@@ -2631,7 +3041,7 @@ export const SEAT_VALIDATOR_KEY_COVERAGE = {
|
|
|
2631
3041
|
},
|
|
2632
3042
|
SeatCapabilitiesState: {
|
|
2633
3043
|
check: checkSeatCapabilitiesState,
|
|
2634
|
-
validated: ["pickFolder", "rewind", "recents", "patchSession", "devices", "engineTarget", "onboard", "mcpToolToggles", "thinkingLatch", "computerUseSwitch", "engineModeDefaultOnly", "seatActions", "notificationLevels", "modsView"],
|
|
3044
|
+
validated: ["pickFolder", "rewind", "recents", "patchSession", "devices", "engineTarget", "onboard", "mcpToolToggles", "thinkingLatch", "computerUseSwitch", "engineModeDefaultOnly", "seatActions", "notificationLevels", "modsView", "quickEntryShortcut", "hooksRoster", "mcpServers", "mcpServerEdit", "skills", "skillsEdit", "modelPool", "modelPoolEdit"],
|
|
2635
3045
|
unchecked: [],
|
|
2636
3046
|
},
|
|
2637
3047
|
RecentFoldersResult: {
|
|
@@ -2699,10 +3109,23 @@ export const SEAT_VALIDATOR_COVERAGE_EXEMPT = [
|
|
|
2699
3109
|
["SetComputerUseRequest", checkSetComputerUseRequest],
|
|
2700
3110
|
["NotificationLevelsState", checkNotificationLevelsState],
|
|
2701
3111
|
["SetNotificationLevelResult", checkSetNotificationLevelResult],
|
|
3112
|
+
["ModelPoolListResult", checkModelPoolListResult],
|
|
3113
|
+
["ModelPoolEditResult", checkModelPoolEditResult],
|
|
3114
|
+
["ModelDiscoveryResult", checkModelDiscoveryResult],
|
|
3115
|
+
["ModelPoolEditRequest", checkModelPoolEditRequest],
|
|
3116
|
+
["ModelDiscoveryRequest", checkModelDiscoveryRequest],
|
|
2702
3117
|
["SeatAction", checkSeatAction],
|
|
2703
3118
|
["EngineSwapAnswerOutcome", checkEngineSwapAnswerOutcome],
|
|
2704
3119
|
["SelfUpgradeOutcome", checkSelfUpgradeOutcome],
|
|
2705
3120
|
["SessionModsResult", checkSessionModsResult],
|
|
3121
|
+
["QuickEntryShortcutState", checkQuickEntryShortcutState],
|
|
3122
|
+
["SetQuickEntryShortcutResult", checkSetQuickEntryShortcutResult],
|
|
3123
|
+
["SessionHooksRosterResult", checkSessionHooksRosterResult],
|
|
3124
|
+
["McpServersListResult", checkMcpServersListResult],
|
|
3125
|
+
["McpServerProbeResult", checkMcpServerProbeResult],
|
|
3126
|
+
["McpServerEditResult", checkMcpServerEditResult],
|
|
3127
|
+
["ListSkillsResult", checkListSkillsResult],
|
|
3128
|
+
["EditSkillsResult", checkEditSkillsResult],
|
|
2706
3129
|
].map(([label, check]) => ({
|
|
2707
3130
|
label,
|
|
2708
3131
|
check,
|
|
@@ -2753,6 +3176,7 @@ const _seatContractPins = [
|
|
|
2753
3176
|
true, true,
|
|
2754
3177
|
true, true, true, true,
|
|
2755
3178
|
true, true, true,
|
|
3179
|
+
true, true, true, true,
|
|
2756
3180
|
true,
|
|
2757
3181
|
true, true, true,
|
|
2758
3182
|
true, true, true, true, true, true,
|
|
@@ -2769,6 +3193,11 @@ const _seatContractPins = [
|
|
|
2769
3193
|
true, true, true, true, true, true, true, true,
|
|
2770
3194
|
true, true, true, true, true,
|
|
2771
3195
|
true, true, true,
|
|
3196
|
+
true, true, true, true, true, true,
|
|
3197
|
+
true, true, true, true, true, true,
|
|
2772
3198
|
true, true, true, true,
|
|
3199
|
+
true, true, true, true,
|
|
3200
|
+
true, true, true, true, true, true,
|
|
3201
|
+
true, true, true, true, true,
|
|
2773
3202
|
];
|
|
2774
3203
|
void _seatContractPins;
|