@sema-agent/client-core 0.99.0 → 0.101.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 +572 -0
- package/README.md +174 -114
- package/dist/adapt/arms.js +109 -50
- package/dist/adapt/panelTasks.d.ts +2 -1
- package/dist/adapt/panelTasks.js +32 -9
- package/dist/adapt/textStream.d.ts +1 -1
- package/dist/adapt/textStream.js +58 -32
- package/dist/adapt/toolCards.js +9 -8
- package/dist/adapt.js +7 -1
- package/dist/adapter/activeRunSelfHeal.d.ts +31 -2
- package/dist/adapter/activeRunSelfHeal.js +162 -13
- package/dist/adapter/downstream/eventToSdkMessage.d.ts +25 -6
- package/dist/adapter/downstream/eventToSdkMessage.js +157 -20
- package/dist/adapter/downstream/terminalToSdkResult.d.ts +60 -1
- package/dist/adapter/downstream/terminalToSdkResult.js +219 -39
- package/dist/adapter/downstream/wiringManifestView.d.ts +3 -1
- package/dist/adapter/downstream/wiringManifestView.js +1 -0
- package/dist/adapter/runStream.d.ts +4 -4
- package/dist/adapter/runStream.js +184 -42
- package/dist/adapter/types.d.ts +2 -0
- package/dist/agentsWireCaps.d.ts +9 -7
- package/dist/agentsWireCaps.js +101 -17
- package/dist/approvalDecidedByCapability.js +2 -2
- package/dist/approvalFrameFamilies.d.ts +33 -0
- package/dist/approvalFrameFamilies.js +120 -0
- package/dist/approvalsStreamLiveCapability.js +2 -2
- package/dist/attachmentsWireCaps.js +41 -13
- package/dist/callerCwdCapability.js +2 -2
- package/dist/centerWiringCapability.js +2 -2
- package/dist/clockReading.d.ts +2 -0
- package/dist/clockReading.js +4 -0
- package/dist/cloudConfigWireCaps.d.ts +28 -5
- package/dist/cloudConfigWireCaps.js +334 -103
- package/dist/compactionStatus.d.ts +34 -0
- package/dist/compactionStatus.js +196 -0
- package/dist/coreValuePorts.d.ts +12 -2
- package/dist/coreValuePorts.js +9 -0
- package/dist/decideFailureNote.js +8 -6
- package/dist/decideReceipt.js +2 -2
- package/dist/deviceExecutorManagementCapability.js +2 -2
- package/dist/deviceFlowPolling.js +1 -1
- package/dist/disableSkillsWire.d.ts +1 -1
- package/dist/disableSkillsWire.js +4 -3
- package/dist/displayUntrusted.d.ts +1 -0
- package/dist/displayUntrusted.js +215 -13
- package/dist/engineAgentPanelStore.d.ts +7 -4
- package/dist/engineCapReader.js +1 -1
- package/dist/engineConfigDrift.js +1 -1
- package/dist/engineErrorCodes.d.ts +23 -6
- package/dist/engineErrorCodes.js +36 -11
- package/dist/engineGenerationConvergence.d.ts +39 -0
- package/dist/engineGenerationConvergence.js +95 -0
- package/dist/engineGenerationPort.d.ts +61 -0
- package/dist/engineGenerationPort.js +144 -0
- package/dist/engineHealthFacts.d.ts +23 -0
- package/dist/engineHealthFacts.js +92 -0
- package/dist/engineIdentity.d.ts +4 -0
- package/dist/engineIdentity.js +11 -0
- package/dist/engineNoticeCodes.d.ts +2 -5
- package/dist/engineRowRef.js +4 -0
- package/dist/engineSessionMessages.js +2 -2
- package/dist/engineToolDirectory.d.ts +3 -0
- package/dist/engineToolDirectory.js +6 -4
- package/dist/engineWireFor.d.ts +99 -0
- package/dist/engineWireFor.js +248 -6
- package/dist/engineWireTarget.d.ts +1 -0
- package/dist/engineWireTarget.js +8 -0
- package/dist/env/uiLanguage.js +1 -1
- package/dist/errorSupplementRoles.d.ts +3 -0
- package/dist/errorSupplementRoles.js +37 -0
- package/dist/eventLeg.d.ts +1 -7
- package/dist/eventLeg.js +7 -8
- package/dist/executionLaneCapability.js +2 -2
- package/dist/fileHistoryCaptureCapability.d.ts +0 -3
- package/dist/fileHistoryCaptureCapability.js +3 -7
- package/dist/finalVerifyWire.d.ts +6 -3
- package/dist/finalVerifyWire.js +6 -23
- package/dist/flagInput.d.ts +4 -0
- package/dist/flagInput.js +24 -0
- package/dist/fleet/fleetLedger.js +5 -2
- package/dist/fleet/fleetProjection.d.ts +1 -0
- package/dist/fleet/fleetProjection.js +15 -2
- package/dist/gateVocabulary.js +3 -0
- package/dist/generated/engineFactTables.d.ts +7 -2
- package/dist/generated/engineFactTables.js +79 -0
- package/dist/generated/engineNoticeTables.js +15 -0
- package/dist/generated/settingsSchemaActiveTiers.d.ts +1 -0
- package/dist/generated/settingsSchemaActiveTiers.js +14 -0
- package/dist/generated/settingsSchemaCallerTextEcho.d.ts +1 -0
- package/dist/generated/settingsSchemaCallerTextEcho.js +8 -0
- package/dist/generated/settingsSchemaControlAndBidi.d.ts +1 -0
- package/dist/generated/settingsSchemaControlAndBidi.js +8 -0
- package/dist/generated/settingsSchemaDefaultModel.d.ts +11 -0
- package/dist/generated/settingsSchemaDefaultModel.js +25 -0
- package/dist/generated/settingsSchemaFns.d.ts +66 -0
- package/dist/generated/settingsSchemaFns.js +38 -0
- package/dist/generated/settingsSchemaMcpRequestEntry.d.ts +1 -0
- package/dist/generated/settingsSchemaMcpRequestEntry.js +156 -0
- package/dist/generated/settingsSchemaSafetyMergeSpec.d.ts +1 -0
- package/dist/generated/settingsSchemaSafetyMergeSpec.js +95 -0
- package/dist/generated/settingsSchemaSettingsSources.d.ts +1 -0
- package/dist/generated/settingsSchemaSettingsSources.js +58 -0
- package/dist/generated/settingsSchemaTables.d.ts +3 -0
- package/dist/generated/settingsSchemaTables.js +18 -0
- package/dist/generated/settingsSchemaTypes.d.ts +28 -0
- package/dist/generated/settingsSchemaUrlPattern.d.ts +1 -0
- package/dist/generated/settingsSchemaUrlPattern.js +183 -0
- package/dist/headlessPermissionModeWire.d.ts +18 -2
- package/dist/headlessPermissionModeWire.js +30 -19
- package/dist/hitl/allowRuleShadow.js +9 -7
- package/dist/hitl/approvalCardReading.d.ts +3 -0
- package/dist/hitl/approvalCardReading.js +17 -0
- package/dist/hitl/approvalCardReasons.js +2 -2
- package/dist/hitl/approvalCompleteParked.js +1 -1
- package/dist/hitl/approvalDelivery.d.ts +87 -0
- package/dist/hitl/approvalDelivery.js +193 -0
- package/dist/hitl/approvalHolds.d.ts +14 -0
- package/dist/hitl/approvalHolds.js +41 -0
- package/dist/hitl/approvalResolution.d.ts +11 -0
- package/dist/hitl/approvalResolution.js +50 -11
- package/dist/hitl/askClassPair.d.ts +8 -2
- package/dist/hitl/askClassPair.js +31 -4
- package/dist/hitl/askParkAutoReopenBlock.d.ts +30 -0
- package/dist/hitl/askParkAutoReopenBlock.js +117 -0
- package/dist/hitl/askParkRowRouting.js +4 -1
- package/dist/hitl/attributionLadder.d.ts +62 -0
- package/dist/hitl/attributionLadder.js +138 -0
- package/dist/hitl/automaticAnswerVerdict.d.ts +6 -1
- package/dist/hitl/automaticAnswerVerdict.js +46 -11
- package/dist/hitl/crashConverged.js +2 -2
- package/dist/hitl/decisionConflict.d.ts +6 -2
- package/dist/hitl/decisionConflict.js +24 -9
- package/dist/hitl/decisionLedger.d.ts +55 -0
- package/dist/hitl/decisionLedger.js +156 -0
- package/dist/hitl/decisionRefusal.d.ts +21 -10
- package/dist/hitl/decisionRefusal.js +100 -55
- package/dist/hitl/decisionSend.d.ts +116 -0
- package/dist/hitl/decisionSend.js +563 -0
- package/dist/hitl/frameRouter.d.ts +1 -0
- package/dist/hitl/frameRouter.js +9 -2
- package/dist/hitl/hitlBridge.d.ts +18 -6
- package/dist/hitl/hitlBridge.js +59 -43
- package/dist/hitl/livePendingAsk.js +4 -3
- package/dist/hitl/noAllowCause.js +1 -1
- package/dist/hitl/parkResolver.js +3 -2
- package/dist/hitl/persistedRulesWire.js +1 -0
- package/dist/hitl/planReviewWire.d.ts +4 -0
- package/dist/hitl/planReviewWire.js +104 -106
- package/dist/hitl/resumeRunningCard.d.ts +3 -2
- package/dist/hitl/resumeRunningCard.js +17 -11
- package/dist/hitl/sessionPolicyDeliverable.d.ts +5 -2
- package/dist/hitl/sessionPolicyDeliverable.js +65 -35
- package/dist/hitl/sessionPolicyWire.d.ts +13 -3
- package/dist/hitl/sessionPolicyWire.js +81 -16
- package/dist/hitl/standingRows.js +1 -1
- package/dist/hitl/toolApprovalWire.d.ts +9 -10
- package/dist/hitl/toolApprovalWire.js +103 -151
- package/dist/hookMatcherVerdict.d.ts +2 -0
- package/dist/hookMatcherVerdict.js +12 -0
- package/dist/hooksCompactTransition.d.ts +19 -0
- package/dist/hooksCompactTransition.js +41 -0
- package/dist/hooksWireCaps.d.ts +1 -1
- package/dist/hooksWireCaps.js +202 -203
- package/dist/host.d.ts +1 -14
- package/dist/host.js +0 -8
- package/dist/hostCallbackGuard.d.ts +1 -0
- package/dist/hostCallbackGuard.js +1 -1
- package/dist/hostSettingsSource.d.ts +172 -0
- package/dist/hostSettingsSource.js +675 -0
- package/dist/hostTurnSettings.d.ts +114 -19
- package/dist/hostTurnSettings.js +966 -68
- package/dist/httpHookPolicy.d.ts +37 -0
- package/dist/httpHookPolicy.js +176 -0
- package/dist/humanTurn.d.ts +4 -2
- package/dist/humanTurn.js +40 -10
- package/dist/humanTurnRead.js +4 -3
- package/dist/humanTurnSentences.d.ts +10 -0
- package/dist/humanTurnSentences.js +74 -0
- package/dist/i18n/messages.en.d.ts +313 -0
- package/dist/i18n/messages.en.js +326 -13
- package/dist/i18n/messages.zh.js +341 -13
- package/dist/i18n/translate.js +3 -3
- package/dist/index.d.ts +85 -15
- package/dist/index.js +53 -12
- package/dist/inheritEnvCapability.d.ts +4 -1
- package/dist/inheritEnvCapability.js +38 -17
- package/dist/inheritEnvWire.d.ts +2 -1
- package/dist/inheritEnvWire.js +11 -5
- package/dist/injectionLaneNotice.d.ts +5 -0
- package/dist/injectionLaneNotice.js +46 -0
- package/dist/interactiveToolsWire.d.ts +4 -2
- package/dist/interactiveToolsWire.js +5 -5
- package/dist/jsonFaithful.d.ts +20 -0
- package/dist/jsonFaithful.js +152 -0
- package/dist/limitsWire.d.ts +7 -2
- package/dist/limitsWire.js +19 -13
- package/dist/liveInitToolFace.d.ts +6 -1
- package/dist/liveInitToolFace.js +5 -3
- package/dist/liveModelCatalog.d.ts +22 -0
- package/dist/liveModelCatalog.js +132 -18
- package/dist/mcpPanel.js +3 -1
- package/dist/mcpProbeCapability.js +2 -2
- package/dist/mcpReconnect.js +2 -2
- package/dist/mcpStatusSupersetKeys.d.ts +24 -0
- package/dist/mcpStatusSupersetKeys.js +45 -0
- package/dist/mcpToolToggles.d.ts +6 -0
- package/dist/mcpToolToggles.js +47 -0
- package/dist/mcpWireCaps.d.ts +48 -4
- package/dist/mcpWireCaps.js +338 -99
- package/dist/mcpWireTransport.d.ts +4 -0
- package/dist/mcpWireTransport.js +18 -0
- package/dist/memoryComplianceCapability.js +2 -2
- package/dist/memoryOriginCapability.js +2 -2
- package/dist/model/catalogDefault.d.ts +24 -0
- package/dist/model/catalogDefault.js +4 -0
- package/dist/model/liveCatalogShape.js +5 -4
- package/dist/model/modelsPolicy.js +4 -3
- package/dist/model/onboardJudgement.d.ts +1 -0
- package/dist/model/onboardJudgement.js +1 -1
- package/dist/model/subagentModelWord.js +2 -2
- package/dist/modelCapabilityProbe.d.ts +2 -1
- package/dist/modelCapabilityProbe.js +16 -15
- package/dist/modelIdentityResolvability.d.ts +12 -1
- package/dist/modelIdentityResolvability.js +69 -28
- package/dist/modsKernelIdentity.d.ts +10 -0
- package/dist/modsKernelIdentity.js +103 -0
- package/dist/modsKernelTransit.d.ts +8 -0
- package/dist/modsKernelTransit.js +6 -0
- package/dist/notifications.d.ts +30 -12
- package/dist/notifications.js +241 -53
- package/dist/outputStyleSeatCapability.js +2 -2
- package/dist/ownKey.d.ts +37 -0
- package/dist/ownKey.js +238 -2
- package/dist/panelReduce.d.ts +5 -0
- package/dist/panelReduce.js +45 -13
- package/dist/panelStateHolder.d.ts +1 -0
- package/dist/panelStateHolder.js +10 -1
- package/dist/peerFrames.d.ts +1 -1
- package/dist/peerFrames.js +6 -2
- package/dist/peerLaneCapability.js +2 -2
- package/dist/permissionModesCapability.js +4 -4
- package/dist/permissionRuleIssue.d.ts +2 -1
- package/dist/permissionRuleIssue.js +24 -21
- package/dist/permissionRulesWriteCapability.js +2 -2
- package/dist/permissionsAllowGrantCapability.js +2 -2
- package/dist/permissionsDeclaration.d.ts +43 -4
- package/dist/permissionsDeclaration.js +102 -35
- package/dist/pluginHooksWire.d.ts +20 -4
- package/dist/pluginHooksWire.js +101 -60
- package/dist/prepareRefusal.d.ts +9 -0
- package/dist/prepareRefusal.js +90 -0
- package/dist/printInitToolFace.js +2 -2
- package/dist/printModelStatus.js +1 -1
- package/dist/projectMemory.d.ts +32 -0
- package/dist/projectMemory.js +70 -0
- package/dist/promptBlockedCopy.d.ts +2 -1
- package/dist/promptBlockedCopy.js +2 -1
- package/dist/promptDelivery.d.ts +23 -3
- package/dist/promptDelivery.js +169 -30
- package/dist/providerRejection.d.ts +19 -1
- package/dist/providerRejection.js +75 -4
- package/dist/queuedDelivery.d.ts +48 -0
- package/dist/queuedDelivery.js +233 -0
- package/dist/reattachWindow.d.ts +94 -0
- package/dist/reattachWindow.js +127 -0
- package/dist/request/printNotification.d.ts +1 -1
- package/dist/request/printNotification.js +5 -1
- package/dist/request/submissionIdentity.d.ts +37 -0
- package/dist/request/submissionIdentity.js +65 -0
- package/dist/request/taskRequest.d.ts +22 -14
- package/dist/request/taskRequest.js +312 -202
- package/dist/resultFrameKeys.d.ts +1 -0
- package/dist/resultFrameKeys.js +4 -1
- package/dist/resumeRefusalCopy.d.ts +3 -1
- package/dist/resumeRefusalCopy.js +22 -4
- package/dist/retryStatus.d.ts +26 -0
- package/dist/retryStatus.js +133 -28
- package/dist/rewindArchiveCapability.js +2 -2
- package/dist/rewindEngineAction.d.ts +2 -0
- package/dist/rewindEngineAction.js +23 -1
- package/dist/rowKind.d.ts +36 -0
- package/dist/rowKind.js +97 -0
- package/dist/ruleCompileVerdict.d.ts +18 -0
- package/dist/ruleCompileVerdict.js +67 -2
- package/dist/ruleReadings.d.ts +58 -0
- package/dist/ruleReadings.js +132 -0
- package/dist/ruleRefusalSentence.d.ts +8 -0
- package/dist/ruleRefusalSentence.js +64 -0
- package/dist/runCancelContext.d.ts +0 -1
- package/dist/runCancelContext.js +1 -2
- package/dist/runTerminal.d.ts +5 -0
- package/dist/runTerminal.js +52 -17
- package/dist/sandboxWire.d.ts +3 -2
- package/dist/sandboxWire.js +59 -27
- package/dist/scenarioRefusal.d.ts +2 -1
- package/dist/scenarioRefusal.js +6 -6
- package/dist/scenarioSkills.d.ts +20 -0
- package/dist/scenarioSkills.js +72 -0
- package/dist/scenarioWire.d.ts +5 -2
- package/dist/scenarioWire.js +9 -9
- package/dist/sealedKeyCapability.js +2 -2
- package/dist/seam.d.ts +26 -9
- package/dist/seam.js +44 -4
- package/dist/seatContract.d.ts +62 -9
- package/dist/seatContract.js +70 -25
- package/dist/selfOrchestrationDenial.js +1 -1
- package/dist/sessionPolicyCapability.js +2 -2
- package/dist/sessionRulesChildrenReadLive.d.ts +6 -0
- package/dist/sessionRulesChildrenReadLive.js +5 -0
- package/dist/sessionRulesNamespaceFormsCapability.d.ts +12 -0
- package/dist/sessionRulesNamespaceFormsCapability.js +29 -0
- package/dist/sessionSyncFileHistoryCapability.js +2 -2
- package/dist/settingsCredentialKeyPaths.d.ts +8 -0
- package/dist/settingsCredentialKeyPaths.js +274 -0
- package/dist/settingsHooksSalvage.d.ts +1 -0
- package/dist/settingsHooksSalvage.js +7 -1
- package/dist/settingsLayerAdmission.d.ts +4 -0
- package/dist/settingsLayerAdmission.js +16 -0
- package/dist/skillToolListsCapability.js +6 -5
- package/dist/skillsWireCaps.d.ts +14 -3
- package/dist/skillsWireCaps.js +48 -18
- package/dist/slashCommandGate.d.ts +24 -0
- package/dist/slashCommandGate.js +74 -0
- package/dist/slashCommandTable.d.ts +14 -0
- package/dist/slashCommandTable.js +99 -0
- package/dist/sqlEngineCapability.js +2 -2
- package/dist/steerPriorityCapability.js +2 -2
- package/dist/storePostureCapability.js +2 -2
- package/dist/subagent/agentStateDetail.js +1 -1
- package/dist/subagent/engineDelegatedPrompt.d.ts +9 -0
- package/dist/subagent/engineDelegatedPrompt.js +38 -7
- package/dist/subagent/engineRowStopGate.js +2 -2
- package/dist/subagent/engineSubagentResume.js +3 -3
- package/dist/subagent/engineTaskHandleWire.d.ts +1 -0
- package/dist/subagent/engineTaskHandleWire.js +10 -0
- package/dist/subagentContentStore.d.ts +1 -0
- package/dist/subagentContentStore.js +135 -27
- package/dist/submitFailure.d.ts +8 -0
- package/dist/submitFailure.js +17 -0
- package/dist/supportFloor.d.ts +1 -0
- package/dist/supportFloor.js +7 -0
- package/dist/terminationIntent.d.ts +55 -0
- package/dist/terminationIntent.js +352 -0
- package/dist/toolHistoryMismatch.d.ts +8 -0
- package/dist/toolHistoryMismatch.js +37 -6
- package/dist/toolResult.d.ts +13 -3
- package/dist/toolResult.js +158 -9
- package/dist/toolResultContent.d.ts +13 -0
- package/dist/toolResultContent.js +82 -7
- package/dist/toolRoster.d.ts +18 -0
- package/dist/toolRoster.js +64 -0
- package/dist/toolsFlagNames.d.ts +8 -0
- package/dist/toolsFlagNames.js +110 -0
- package/dist/turnFailurePresentation.js +41 -96
- package/dist/usageLimitAutoResume.d.ts +74 -0
- package/dist/usageLimitAutoResume.js +227 -0
- package/dist/userAttachmentEnvelope.js +1 -1
- package/dist/userAttachmentSeat.js +5 -5
- package/dist/userInvokedSkillsCapability.js +2 -2
- package/dist/webSearchBackendCapability.js +2 -2
- package/dist/wireErrorTriage.js +99 -50
- package/dist/wireFailureShape.d.ts +25 -1
- package/dist/wireFailureShape.js +92 -5
- package/dist/wireRefusalCopy.d.ts +75 -18
- package/dist/wireRefusalCopy.js +532 -148
- package/dist/wiringFleetDoctor.d.ts +3 -0
- package/dist/wiringFleetDoctor.js +21 -0
- package/dist/workflow.d.ts +2 -1
- package/dist/workflow.js +38 -1
- package/dist/workflowClient.d.ts +2 -7
- package/dist/workflowsJournalCapability.js +2 -2
- package/dist/writeProtectionCapability.js +2 -2
- package/docs/INTEGRATION-CLIENTS.md +1013 -190
- package/package.json +15 -4
package/dist/seatContract.js
CHANGED
|
@@ -62,7 +62,7 @@ const firstAccessorPath = (root) => {
|
|
|
62
62
|
const at = path === "" ? k : `${path}.${k}`;
|
|
63
63
|
if (!Object.hasOwn(d, "value"))
|
|
64
64
|
return at;
|
|
65
|
-
stack.
|
|
65
|
+
Object.defineProperty(stack, stack.length, { value: [d.value, at], writable: true, enumerable: true, configurable: true });
|
|
66
66
|
}
|
|
67
67
|
}
|
|
68
68
|
return undefined;
|
|
@@ -197,7 +197,7 @@ const firstSecretKeyPath = (root, allow) => {
|
|
|
197
197
|
const at = isArr && /^[0-9]+$/.test(k) ? `${path}[${k}]` : pathAt(path, k);
|
|
198
198
|
if (isSecretKeyName(k) && !allow.has(at))
|
|
199
199
|
return at;
|
|
200
|
-
stack.
|
|
200
|
+
Object.defineProperty(stack, stack.length, { value: [d.value, at], writable: true, enumerable: true, configurable: true });
|
|
201
201
|
}
|
|
202
202
|
}
|
|
203
203
|
return undefined;
|
|
@@ -251,22 +251,49 @@ const SEAT_EVENT_TYPE_TUPLE = [
|
|
|
251
251
|
"subagent_content",
|
|
252
252
|
];
|
|
253
253
|
export const SEAT_EVENT_TYPES = Object.freeze(SEAT_EVENT_TYPE_TUPLE);
|
|
254
|
-
const
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
254
|
+
const CHROME_ARM_SEAT_ROUTE = {
|
|
255
|
+
panel_task: "seat",
|
|
256
|
+
notification_terminal: "seat",
|
|
257
|
+
prompt_suggestions: "seat",
|
|
258
|
+
subagent_lifecycle: "seat",
|
|
259
|
+
text_segment_end: "seat",
|
|
260
|
+
thinking_segment_end: "seat",
|
|
261
|
+
retry_status: "seat",
|
|
262
|
+
context_usage: "seat",
|
|
263
|
+
last_turn_usage: "seat",
|
|
264
|
+
bgshell_register: "seat",
|
|
265
|
+
bgshell_settle: "seat",
|
|
266
|
+
memory_saved: "seat",
|
|
267
|
+
result_replayed: "seat",
|
|
268
|
+
tool_parked: "seat",
|
|
269
|
+
compaction_started: "seat",
|
|
270
|
+
compaction_outcome: "seat",
|
|
271
|
+
engine_notice: "seat",
|
|
272
|
+
workflow_notification_enqueue: "host",
|
|
273
|
+
plan_review_park: "host",
|
|
274
|
+
approval_request: "host",
|
|
275
|
+
approval_revoke: "host",
|
|
276
|
+
task_ledger_sync: "host",
|
|
277
|
+
inline_task_stats: "host",
|
|
278
|
+
stream_delta: "host",
|
|
279
|
+
thinking_activity: "host",
|
|
280
|
+
request_start: "host",
|
|
281
|
+
response_metrics: "host",
|
|
282
|
+
attachment: "host",
|
|
283
|
+
subagent_turn_usage: "host",
|
|
284
|
+
run_cost_reconciled: "host",
|
|
285
|
+
message_committed: "host",
|
|
286
|
+
human_input: "host",
|
|
287
|
+
tool_roster_delta: "host",
|
|
288
|
+
subagent_started: "host",
|
|
289
|
+
prompt_assembled: "host",
|
|
290
|
+
tool_disclosure: "host",
|
|
291
|
+
tool_progress: "host",
|
|
292
|
+
wiring_manifest: "host",
|
|
293
|
+
suspended_reopened: "host",
|
|
294
|
+
result_text_diverged: "host",
|
|
295
|
+
};
|
|
296
|
+
const CHROME_EVENT_KIND_TUPLE = Object.keys(CHROME_ARM_SEAT_ROUTE).filter((k) => CHROME_ARM_SEAT_ROUTE[k] === "seat");
|
|
270
297
|
export const CHROME_EVENT_KINDS = Object.freeze(CHROME_EVENT_KIND_TUPLE);
|
|
271
298
|
const LANE_PROOF_LANE_TUPLE = ["main", "subagent", "workflow"];
|
|
272
299
|
export const SEAT_CHROME_ENVELOPE_KEYS = ["kind", "laneProof"];
|
|
@@ -327,7 +354,7 @@ export function readSeatStreamDelta(message) {
|
|
|
327
354
|
return Object.freeze({ kind: "malformed" });
|
|
328
355
|
}
|
|
329
356
|
}
|
|
330
|
-
export const SEAT_CAPABILITY_NAMES = Object.freeze(["pickFolder", "rewind", "recents", "patchSession", "devices", "engineTarget", "onboard"]);
|
|
357
|
+
export const SEAT_CAPABILITY_NAMES = Object.freeze(["pickFolder", "rewind", "recents", "patchSession", "devices", "engineTarget", "onboard", "mcpToolToggles"]);
|
|
331
358
|
const notReported = () => Object.freeze({ kind: "not_reported" });
|
|
332
359
|
const malformedReading = () => Object.freeze({ kind: "malformed" });
|
|
333
360
|
const reported = (available) => Object.freeze({ kind: "reported", available });
|
|
@@ -340,7 +367,7 @@ export function seatCapability(state, name) {
|
|
|
340
367
|
const desc = Object.getOwnPropertyDescriptor(state, name);
|
|
341
368
|
if (desc === undefined)
|
|
342
369
|
return notReported();
|
|
343
|
-
if (!("value"
|
|
370
|
+
if (!Object.hasOwn(desc, "value"))
|
|
344
371
|
return malformedReading();
|
|
345
372
|
const v = desc.value;
|
|
346
373
|
if (v === undefined)
|
|
@@ -402,6 +429,7 @@ const SEAT_CAPABILITY_PHRASES = Object.freeze({
|
|
|
402
429
|
devices: Object.freeze({ action: "Managing devices", ability: "manage devices", support: "device support" }),
|
|
403
430
|
engineTarget: Object.freeze({ action: "Switching engines", ability: "switch engines", support: "engine-switching support" }),
|
|
404
431
|
onboard: Object.freeze({ action: "Model setup", ability: "add models", support: "model-setup support" }),
|
|
432
|
+
mcpToolToggles: Object.freeze({ action: "Per-tool switching", ability: "toggle tools", support: "per-tool switches" }),
|
|
405
433
|
});
|
|
406
434
|
export function seatCapabilityUnavailableDetail(name, reading) {
|
|
407
435
|
const phrase = Object.hasOwn(SEAT_CAPABILITY_PHRASES, name)
|
|
@@ -520,10 +548,10 @@ export const SEAT_REASONING_EFFORTS = [...REASONING_EFFORT_WORDS];
|
|
|
520
548
|
export const SEAT_TURN_SETTINGS_KEYS = ["ultracode"];
|
|
521
549
|
export const SEAT_TURN_SETTINGS_ORIGINS = Object.freeze({
|
|
522
550
|
ultracode: Object.freeze({ carriedBy: "renderer" }),
|
|
523
|
-
webSearch: Object.freeze({ hostSupplied: "
|
|
524
|
-
hooks: Object.freeze({ hostSupplied: "hooks
|
|
525
|
-
resolved: Object.freeze({ hostSupplied: "
|
|
526
|
-
outputStyle: Object.freeze({ hostSupplied: "
|
|
551
|
+
webSearch: Object.freeze({ hostSupplied: "settings.webSearch" }),
|
|
552
|
+
hooks: Object.freeze({ hostSupplied: "settings.hooks" }),
|
|
553
|
+
resolved: Object.freeze({ hostSupplied: "settings.resolved" }),
|
|
554
|
+
outputStyle: Object.freeze({ hostSupplied: "settings.outputStyle" }),
|
|
527
555
|
});
|
|
528
556
|
export const SEAT_REWIND_INTENT_KEYS = ["mode", "targetMessageUuid"];
|
|
529
557
|
export const ATTACHMENT_UPLOAD_REQUEST_KEYS = ["name", "mimeType", "bytes"];
|
|
@@ -902,6 +930,12 @@ const checkSessionMcpPanelResult = seatCheck((v) => {
|
|
|
902
930
|
return checkSessionMcpPanelFailure(v);
|
|
903
931
|
return Object.hasOwn(v, "scenarioRefusal") ? checkSessionMcpPanelRefusalView(v) : checkSessionMcpPanelServersView(v);
|
|
904
932
|
});
|
|
933
|
+
const MCP_TOOL_TOGGLE_KEY = shapeRule("toggle key", {
|
|
934
|
+
server: reqF(R_NONEMPTY),
|
|
935
|
+
tool: reqF(R_NONEMPTY),
|
|
936
|
+
});
|
|
937
|
+
export const checkMcpToolToggleKey = seatShapeCheck(MCP_TOOL_TOGGLE_KEY);
|
|
938
|
+
const checkMcpToolTogglesResult = seatShapeCheck(shapeRule("toggles result", { off: reqF(arrayRule(MCP_TOOL_TOGGLE_KEY)) }));
|
|
905
939
|
const checkLocalSessionRecord = seatCheck((s) => {
|
|
906
940
|
if (!isPlainRecord(s))
|
|
907
941
|
return bad("session record is not a plain object");
|
|
@@ -1077,9 +1111,11 @@ const SEAT_CHROME_PAYLOAD_SPECS = {
|
|
|
1077
1111
|
registration: reqF(shapeRule("registration", {
|
|
1078
1112
|
kind: reqF(oneOfRule("registration kind", ["register"])),
|
|
1079
1113
|
taskId: reqF(R_NONEMPTY),
|
|
1114
|
+
toolUseId: optF(R_NONEMPTY),
|
|
1080
1115
|
command: reqF(R_STR),
|
|
1081
1116
|
description: optF(R_STR),
|
|
1082
1117
|
receipt: reqF(R_STR),
|
|
1118
|
+
outputFile: optF(R_NONEMPTY),
|
|
1083
1119
|
source: reqF(oneOfRule("registration source", ["bash", "monitor"])),
|
|
1084
1120
|
})),
|
|
1085
1121
|
},
|
|
@@ -1571,6 +1607,8 @@ export const LOCAL_SESSIONS_SPEC = {
|
|
|
1571
1607
|
probeOnboardEntry: { kind: "invoke", check: checkOnboardProbeResult },
|
|
1572
1608
|
applyOnboardEntry: { kind: "invoke", check: checkOnboardApplyResult },
|
|
1573
1609
|
readSessionMcpPanel: { kind: "invoke", check: checkSessionMcpPanelResult },
|
|
1610
|
+
listMcpToolToggles: { kind: "invoke", check: checkMcpToolTogglesResult },
|
|
1611
|
+
setMcpToolToggle: { kind: "invoke", check: checkOkAck },
|
|
1574
1612
|
onEvent: { kind: "event", check: checkLocalSessionEvent },
|
|
1575
1613
|
onToolPermissionRequest: { kind: "event", check: checkToolPermissionRequest },
|
|
1576
1614
|
},
|
|
@@ -1616,6 +1654,8 @@ export const SEAT_METHOD_NAMES = [
|
|
|
1616
1654
|
"probeOnboardEntry",
|
|
1617
1655
|
"applyOnboardEntry",
|
|
1618
1656
|
"readSessionMcpPanel",
|
|
1657
|
+
"listMcpToolToggles",
|
|
1658
|
+
"setMcpToolToggle",
|
|
1619
1659
|
"onEvent",
|
|
1620
1660
|
"onToolPermissionRequest",
|
|
1621
1661
|
];
|
|
@@ -1895,7 +1935,7 @@ export const SEAT_VALIDATOR_KEY_COVERAGE = {
|
|
|
1895
1935
|
},
|
|
1896
1936
|
SeatCapabilitiesState: {
|
|
1897
1937
|
check: checkSeatCapabilitiesState,
|
|
1898
|
-
validated: ["pickFolder", "rewind", "recents", "patchSession", "devices", "engineTarget", "onboard"],
|
|
1938
|
+
validated: ["pickFolder", "rewind", "recents", "patchSession", "devices", "engineTarget", "onboard", "mcpToolToggles"],
|
|
1899
1939
|
unchecked: [],
|
|
1900
1940
|
},
|
|
1901
1941
|
RecentFoldersResult: {
|
|
@@ -1956,6 +1996,8 @@ export const SEAT_VALIDATOR_COVERAGE_EXEMPT = [
|
|
|
1956
1996
|
["OnboardApplyResult", checkOnboardApplyResult],
|
|
1957
1997
|
["OnboardEntryRequest", checkOnboardEntryRequest],
|
|
1958
1998
|
["OnboardApplyRequest", checkOnboardApplyRequest],
|
|
1999
|
+
["McpToolTogglesResult", checkMcpToolTogglesResult],
|
|
2000
|
+
["McpToolToggleKey", checkMcpToolToggleKey],
|
|
1959
2001
|
].map(([label, check]) => ({
|
|
1960
2002
|
label,
|
|
1961
2003
|
check,
|
|
@@ -2006,5 +2048,8 @@ const _seatContractPins = [
|
|
|
2006
2048
|
true, true,
|
|
2007
2049
|
true, true, true, true,
|
|
2008
2050
|
true, true, true,
|
|
2051
|
+
true,
|
|
2052
|
+
true, true, true,
|
|
2053
|
+
true, true,
|
|
2009
2054
|
];
|
|
2010
2055
|
void _seatContractPins;
|
|
@@ -43,7 +43,7 @@ function ownRead(o, key) {
|
|
|
43
43
|
const d = Object.getOwnPropertyDescriptor(o, key);
|
|
44
44
|
if (d === undefined)
|
|
45
45
|
return ABSENT;
|
|
46
|
-
if ('get'
|
|
46
|
+
if (Object.hasOwn(d, 'get') || Object.hasOwn(d, 'set'))
|
|
47
47
|
return ACCESSOR;
|
|
48
48
|
return { kind: 'data', value: d.value };
|
|
49
49
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { engineWireTargetBaseUrl } from './engineWireTarget.js';
|
|
2
2
|
import { createEngineCapReader, unreadableReadingDetail } from './engineCapReader.js';
|
|
3
3
|
import { msg, renderMessage } from './i18n/translate.js';
|
|
4
4
|
import { ownDataField } from './ownKey.js';
|
|
@@ -22,7 +22,7 @@ const reader = createEngineCapReader({
|
|
|
22
22
|
name: 'sessionPolicy',
|
|
23
23
|
project: projectSessionPolicyCapability,
|
|
24
24
|
});
|
|
25
|
-
export function observedSessionPolicy(baseUrl =
|
|
25
|
+
export function observedSessionPolicy(baseUrl = engineWireTargetBaseUrl()) {
|
|
26
26
|
return reader.observed(baseUrl);
|
|
27
27
|
}
|
|
28
28
|
export function sessionPolicyFaceAvailable(reading) {
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { guardedRead, readOwnDataValue } from './ownKey.js';
|
|
2
|
+
export function sessionRulesChildrenReadLiveOf(manifest) {
|
|
3
|
+
const raw = guardedRead(() => readOwnDataValue(readOwnDataValue(manifest, 'sessionRules'), 'childrenReadLive'));
|
|
4
|
+
return typeof raw === 'boolean' ? raw : undefined;
|
|
5
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export type SessionRulesNamespaceFormsReading = {
|
|
2
|
+
readonly kind: 'confirmed';
|
|
3
|
+
} | {
|
|
4
|
+
readonly kind: 'absent';
|
|
5
|
+
} | {
|
|
6
|
+
readonly kind: 'declined';
|
|
7
|
+
} | {
|
|
8
|
+
readonly kind: 'unreadable';
|
|
9
|
+
} | {
|
|
10
|
+
readonly kind: 'unobserved';
|
|
11
|
+
};
|
|
12
|
+
export declare function observedSessionRulesNamespaceForms(baseUrl?: string | undefined): SessionRulesNamespaceFormsReading;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { engineCapValue } from './engineCapsCache.js';
|
|
2
|
+
import { engineWireTargetBaseUrl } from './engineWireTarget.js';
|
|
3
|
+
const SESSION_RULES_NAMESPACE_FORMS_KEY = 'sessionRulesNamespaceForms';
|
|
4
|
+
const CONFIRMED = Object.freeze({ kind: 'confirmed' });
|
|
5
|
+
const ABSENT = Object.freeze({ kind: 'absent' });
|
|
6
|
+
const DECLINED = Object.freeze({ kind: 'declined' });
|
|
7
|
+
const UNREADABLE = Object.freeze({ kind: 'unreadable' });
|
|
8
|
+
const UNOBSERVED = Object.freeze({ kind: 'unobserved' });
|
|
9
|
+
export function observedSessionRulesNamespaceForms(baseUrl) {
|
|
10
|
+
try {
|
|
11
|
+
const base = baseUrl === undefined ? engineWireTargetBaseUrl() : baseUrl;
|
|
12
|
+
const slot = engineCapValue(typeof base === 'string' ? base : undefined, SESSION_RULES_NAMESPACE_FORMS_KEY);
|
|
13
|
+
switch (slot.kind) {
|
|
14
|
+
case 'unobserved':
|
|
15
|
+
return UNOBSERVED;
|
|
16
|
+
case 'not_reported':
|
|
17
|
+
return ABSENT;
|
|
18
|
+
case 'unreadable':
|
|
19
|
+
return UNREADABLE;
|
|
20
|
+
case 'null':
|
|
21
|
+
return DECLINED;
|
|
22
|
+
case 'value':
|
|
23
|
+
return slot.value === true ? CONFIRMED : DECLINED;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
catch {
|
|
27
|
+
return UNOBSERVED;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { engineWireTargetBaseUrl } from './engineWireTarget.js';
|
|
2
2
|
import { createEngineCapReader, unreadableReadingDetail } from './engineCapReader.js';
|
|
3
3
|
import { ownDataField } from './ownKey.js';
|
|
4
4
|
export function projectSessionSyncFileHistoryCapability(caps) {
|
|
@@ -20,7 +20,7 @@ const reader = createEngineCapReader({
|
|
|
20
20
|
name: 'sessionSyncFileHistory',
|
|
21
21
|
project: projectSessionSyncFileHistoryCapability,
|
|
22
22
|
});
|
|
23
|
-
export function observedSessionSyncFileHistory(baseUrl =
|
|
23
|
+
export function observedSessionSyncFileHistory(baseUrl = engineWireTargetBaseUrl()) {
|
|
24
24
|
return reader.observed(baseUrl);
|
|
25
25
|
}
|
|
26
26
|
export function sessionSyncFileHistoryAvailable(reading) {
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export interface CredentialKeyFinding {
|
|
2
|
+
readonly path: string;
|
|
3
|
+
readonly numericByNameOnly?: true;
|
|
4
|
+
}
|
|
5
|
+
export declare function credentialNameWords(name: string): string[];
|
|
6
|
+
export declare function isCredentialEnvName(name: string): boolean;
|
|
7
|
+
export declare function isCredentialConfigKey(name: string): boolean;
|
|
8
|
+
export declare function settingsCredentialKeyPaths(doc: object | null | undefined): CredentialKeyFinding[];
|
|
@@ -0,0 +1,274 @@
|
|
|
1
|
+
import { looksLikeKnownSecret, percentBoundaryReadingOf, queryCarriesCredential } from './displayUntrusted.js';
|
|
2
|
+
const CREDENTIAL_WORDS = new Set([
|
|
3
|
+
'key', 'keys', 'apikey', 'token', 'tokens', 'secret', 'secrets', 'password', 'passwd', 'pass', 'pwd', 'pin', 'otp',
|
|
4
|
+
'auth', 'authorization', 'credential', 'credentials', 'cookie', 'cookies', 'session', 'private', 'cert', 'signature', 'salt',
|
|
5
|
+
]);
|
|
6
|
+
const CREDENTIAL_STEMS = ['PASSWORD', 'PASSWD', 'SECRET', 'TOKEN', 'APIKEY', 'CREDENTIAL', 'COOKIE', 'PRIVATE'];
|
|
7
|
+
const CREDENTIAL_SUFFIXES = ['PASS', 'PWD', 'KEY', 'AUTH'];
|
|
8
|
+
const SECRET_CONFIG_NAME = /(?:^|[-_.])(?:token|key|secret|password|authorization|credential|cookie)s?$/i;
|
|
9
|
+
const FLATTENED_CREDENTIAL_TAILS = [
|
|
10
|
+
'apikey', 'token', 'tokens', 'secret', 'secrets', 'password', 'passwd', 'credential', 'credentials', 'cookie', 'cookies', 'authorization',
|
|
11
|
+
];
|
|
12
|
+
export function credentialNameWords(name) {
|
|
13
|
+
if (typeof name !== 'string')
|
|
14
|
+
return [];
|
|
15
|
+
return name
|
|
16
|
+
.replace(/([A-Z])(?=[A-Z][a-z])/g, '$1_')
|
|
17
|
+
.replace(/([a-z0-9])([A-Z])/g, '$1_$2')
|
|
18
|
+
.split(/[_\-.\s]+/)
|
|
19
|
+
.filter((w) => w.length > 0)
|
|
20
|
+
.map((w) => w.toLowerCase());
|
|
21
|
+
}
|
|
22
|
+
export function isCredentialEnvName(name) {
|
|
23
|
+
if (typeof name !== 'string')
|
|
24
|
+
return false;
|
|
25
|
+
if (credentialNameWords(name).some((w) => CREDENTIAL_WORDS.has(w)))
|
|
26
|
+
return true;
|
|
27
|
+
const upper = name.toUpperCase();
|
|
28
|
+
return CREDENTIAL_STEMS.some((stem) => upper.includes(stem)) || CREDENTIAL_SUFFIXES.some((suffix) => upper.endsWith(suffix));
|
|
29
|
+
}
|
|
30
|
+
function legacyNameWords(name) {
|
|
31
|
+
return name
|
|
32
|
+
.replace(/([a-z0-9])([A-Z])/g, '$1_$2')
|
|
33
|
+
.split(/[_\-.\s]+/)
|
|
34
|
+
.filter((w) => w.length > 0)
|
|
35
|
+
.map((w) => w.toLowerCase());
|
|
36
|
+
}
|
|
37
|
+
export function isCredentialConfigKey(name) {
|
|
38
|
+
if (typeof name !== 'string')
|
|
39
|
+
return false;
|
|
40
|
+
const words = credentialNameWords(name);
|
|
41
|
+
const last = words[words.length - 1];
|
|
42
|
+
if (SECRET_CONFIG_NAME.test(name) || (last !== undefined && CREDENTIAL_WORDS.has(last)))
|
|
43
|
+
return true;
|
|
44
|
+
const legacy = legacyNameWords(name);
|
|
45
|
+
const legacyLast = legacy[legacy.length - 1];
|
|
46
|
+
if (legacyLast !== undefined && CREDENTIAL_WORDS.has(legacyLast))
|
|
47
|
+
return true;
|
|
48
|
+
const flattened = name.replace(/[_\-.\s]+/g, '').toLowerCase();
|
|
49
|
+
return FLATTENED_CREDENTIAL_TAILS.some((tail) => flattened.endsWith(tail));
|
|
50
|
+
}
|
|
51
|
+
const DECIMAL_INTEGER_RE = /^\s*\d+\s*$/;
|
|
52
|
+
function percentDecodeOnce(s) {
|
|
53
|
+
return s.indexOf('%') === -1 ? s : s.replace(/%([0-7][0-9A-Fa-f])/g, (_m, hex) => String.fromCharCode(Number.parseInt(hex, 16)));
|
|
54
|
+
}
|
|
55
|
+
const SCHEME_THEN_ENCODED_SPACE = /(?:^|[^A-Za-z0-9])(?:bearer|basic)(?:\+|%20)[^\s+%]{1,4096}/i;
|
|
56
|
+
const FORM_READING_MAX_LAYERS = 3;
|
|
57
|
+
function formEncodedCarriesCredential(value) {
|
|
58
|
+
if (value.indexOf('+') === -1 && value.indexOf('%') === -1)
|
|
59
|
+
return false;
|
|
60
|
+
let layer = value;
|
|
61
|
+
for (let depth = 0;; depth++) {
|
|
62
|
+
const boundary = percentBoundaryReadingOf(layer);
|
|
63
|
+
for (const reading of boundary === layer ? [layer] : [layer, boundary]) {
|
|
64
|
+
if (SCHEME_THEN_ENCODED_SPACE.test(reading))
|
|
65
|
+
return true;
|
|
66
|
+
if (reading.indexOf('+') !== -1 && looksLikeKnownSecret(reading.replace(/\+/g, ' ')))
|
|
67
|
+
return true;
|
|
68
|
+
}
|
|
69
|
+
const next = percentDecodeOnce(layer);
|
|
70
|
+
if (next === layer)
|
|
71
|
+
return false;
|
|
72
|
+
if (depth === FORM_READING_MAX_LAYERS)
|
|
73
|
+
return true;
|
|
74
|
+
layer = next;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
function urlCarriesCredential(value) {
|
|
78
|
+
const text = value.trim();
|
|
79
|
+
if (!text.includes('://'))
|
|
80
|
+
return false;
|
|
81
|
+
let url;
|
|
82
|
+
try {
|
|
83
|
+
url = new URL(text);
|
|
84
|
+
}
|
|
85
|
+
catch {
|
|
86
|
+
return false;
|
|
87
|
+
}
|
|
88
|
+
if (url.username !== '' || url.password !== '')
|
|
89
|
+
return true;
|
|
90
|
+
return url.search.length > 1 && queryCarriesCredential(url.search.slice(1));
|
|
91
|
+
}
|
|
92
|
+
function stringCarriesCredential(value) {
|
|
93
|
+
if (looksLikeKnownSecret(value) || formEncodedCarriesCredential(value))
|
|
94
|
+
return true;
|
|
95
|
+
let layer = value;
|
|
96
|
+
for (let depth = 0;; depth++) {
|
|
97
|
+
if (urlCarriesCredential(layer))
|
|
98
|
+
return true;
|
|
99
|
+
if (depth === FORM_READING_MAX_LAYERS)
|
|
100
|
+
return false;
|
|
101
|
+
const next = percentDecodeOnce(layer);
|
|
102
|
+
if (next === layer)
|
|
103
|
+
return false;
|
|
104
|
+
layer = next;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
const ENV_ASSIGNMENT_RE = /^([A-Za-z_][A-Za-z0-9_]*)=(.*)$/s;
|
|
108
|
+
const LONG_OPTION_RE = /^--?([A-Za-z][A-Za-z0-9_-]*)(?:=(.*))?$/s;
|
|
109
|
+
const HEADER_FORM_RE = /^\s*([A-Za-z][A-Za-z0-9_-]*)\s*:\s*\S/;
|
|
110
|
+
function argvFindings(args) {
|
|
111
|
+
const hits = new Map();
|
|
112
|
+
const add = (i, numericByNameOnly) => {
|
|
113
|
+
hits.set(i, (hits.get(i) ?? true) && numericByNameOnly);
|
|
114
|
+
};
|
|
115
|
+
const valueCarries = (value) => {
|
|
116
|
+
const header = HEADER_FORM_RE.exec(value);
|
|
117
|
+
return stringCarriesCredential(value) || (header !== null && isCredentialConfigKey(header[1] ?? ''));
|
|
118
|
+
};
|
|
119
|
+
args.forEach((arg, i) => {
|
|
120
|
+
if (valueCarries(arg))
|
|
121
|
+
add(i, false);
|
|
122
|
+
const assignment = ENV_ASSIGNMENT_RE.exec(arg);
|
|
123
|
+
if (assignment !== null && assignment[2] !== '') {
|
|
124
|
+
const assigned = assignment[2] ?? '';
|
|
125
|
+
if (valueCarries(assigned))
|
|
126
|
+
add(i, false);
|
|
127
|
+
if (isCredentialEnvName(assignment[1] ?? ''))
|
|
128
|
+
add(i, DECIMAL_INTEGER_RE.test(assigned));
|
|
129
|
+
}
|
|
130
|
+
const option = LONG_OPTION_RE.exec(arg);
|
|
131
|
+
if (option === null)
|
|
132
|
+
return;
|
|
133
|
+
const inline = option[2];
|
|
134
|
+
if (inline !== undefined && inline !== '' && valueCarries(inline))
|
|
135
|
+
add(i, false);
|
|
136
|
+
const optionName = option[1] ?? '';
|
|
137
|
+
if (optionName.length <= 1 || !isCredentialEnvName(optionName))
|
|
138
|
+
return;
|
|
139
|
+
if (inline !== undefined) {
|
|
140
|
+
if (inline !== '')
|
|
141
|
+
add(i, DECIMAL_INTEGER_RE.test(inline));
|
|
142
|
+
}
|
|
143
|
+
else {
|
|
144
|
+
const next = args[i + 1];
|
|
145
|
+
if (next !== undefined && next !== '')
|
|
146
|
+
add(i + 1, DECIMAL_INTEGER_RE.test(next));
|
|
147
|
+
}
|
|
148
|
+
});
|
|
149
|
+
return hits;
|
|
150
|
+
}
|
|
151
|
+
function isPresent(value) {
|
|
152
|
+
return value !== undefined && value !== null && value !== '' && value !== false;
|
|
153
|
+
}
|
|
154
|
+
function arrayKindOf(node) {
|
|
155
|
+
try {
|
|
156
|
+
return Array.isArray(node);
|
|
157
|
+
}
|
|
158
|
+
catch {
|
|
159
|
+
return undefined;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
function ownKeysOf(node) {
|
|
163
|
+
try {
|
|
164
|
+
return Object.keys(node);
|
|
165
|
+
}
|
|
166
|
+
catch {
|
|
167
|
+
return undefined;
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
function readSlot(node, key) {
|
|
171
|
+
try {
|
|
172
|
+
return { ok: true, value: node[key] };
|
|
173
|
+
}
|
|
174
|
+
catch {
|
|
175
|
+
return { ok: false };
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
export function settingsCredentialKeyPaths(doc) {
|
|
179
|
+
const found = [];
|
|
180
|
+
if (doc === null || doc === undefined || typeof doc !== 'object')
|
|
181
|
+
return found;
|
|
182
|
+
const finding = (path, numericByNameOnly) => (numericByNameOnly ? { path, numericByNameOnly: true } : { path });
|
|
183
|
+
const ancestors = new WeakSet();
|
|
184
|
+
const stack = [{ node: doc, path: '', inEnv: false }];
|
|
185
|
+
while (stack.length > 0) {
|
|
186
|
+
const frame = stack.pop();
|
|
187
|
+
if (frame === undefined)
|
|
188
|
+
continue;
|
|
189
|
+
const { node, path, inEnv } = frame;
|
|
190
|
+
if (frame.exit === true) {
|
|
191
|
+
ancestors.delete(node);
|
|
192
|
+
continue;
|
|
193
|
+
}
|
|
194
|
+
if (ancestors.has(node))
|
|
195
|
+
continue;
|
|
196
|
+
ancestors.add(node);
|
|
197
|
+
stack.push({ node, path, inEnv, exit: true });
|
|
198
|
+
const isArray = arrayKindOf(node);
|
|
199
|
+
if (isArray === undefined) {
|
|
200
|
+
if (path !== '')
|
|
201
|
+
found.push(finding(path, false));
|
|
202
|
+
continue;
|
|
203
|
+
}
|
|
204
|
+
if (isArray) {
|
|
205
|
+
let items;
|
|
206
|
+
try {
|
|
207
|
+
items = Array.from(node);
|
|
208
|
+
}
|
|
209
|
+
catch {
|
|
210
|
+
if (path !== '')
|
|
211
|
+
found.push(finding(path, false));
|
|
212
|
+
continue;
|
|
213
|
+
}
|
|
214
|
+
if (items.length > 0 && items.every((item) => typeof item === 'string')) {
|
|
215
|
+
const hits = argvFindings(items);
|
|
216
|
+
for (const i of [...hits.keys()].sort((a, b) => a - b))
|
|
217
|
+
found.push(finding(`${path}[${i}]`, hits.get(i) === true));
|
|
218
|
+
continue;
|
|
219
|
+
}
|
|
220
|
+
items.forEach((item, i) => {
|
|
221
|
+
const itemPath = `${path}[${i}]`;
|
|
222
|
+
if (typeof item === 'string') {
|
|
223
|
+
if (stringCarriesCredential(item))
|
|
224
|
+
found.push(finding(itemPath, false));
|
|
225
|
+
}
|
|
226
|
+
else if (item !== null && typeof item === 'object') {
|
|
227
|
+
stack.push({ node: item, path: itemPath, inEnv: false });
|
|
228
|
+
}
|
|
229
|
+
});
|
|
230
|
+
continue;
|
|
231
|
+
}
|
|
232
|
+
const keys = ownKeysOf(node);
|
|
233
|
+
if (keys === undefined) {
|
|
234
|
+
if (path !== '')
|
|
235
|
+
found.push(finding(path, false));
|
|
236
|
+
continue;
|
|
237
|
+
}
|
|
238
|
+
for (const key of keys) {
|
|
239
|
+
const keyPath = path === '' ? key : `${path}.${key}`;
|
|
240
|
+
const nameIsCredential = inEnv ? isCredentialEnvName(key) : isCredentialConfigKey(key);
|
|
241
|
+
const slot = readSlot(node, key);
|
|
242
|
+
if (!slot.ok) {
|
|
243
|
+
if (nameIsCredential)
|
|
244
|
+
found.push(finding(keyPath, false));
|
|
245
|
+
continue;
|
|
246
|
+
}
|
|
247
|
+
const value = slot.value;
|
|
248
|
+
if (typeof value === 'string') {
|
|
249
|
+
const byValue = stringCarriesCredential(value);
|
|
250
|
+
if (byValue || (nameIsCredential && isPresent(value)))
|
|
251
|
+
found.push(finding(keyPath, !byValue && DECIMAL_INTEGER_RE.test(value)));
|
|
252
|
+
continue;
|
|
253
|
+
}
|
|
254
|
+
if (value !== null && typeof value === 'object') {
|
|
255
|
+
let nonEmpty;
|
|
256
|
+
try {
|
|
257
|
+
nonEmpty = Array.isArray(value) ? value.length > 0 : Object.keys(value).length > 0;
|
|
258
|
+
}
|
|
259
|
+
catch {
|
|
260
|
+
nonEmpty = true;
|
|
261
|
+
}
|
|
262
|
+
if (nameIsCredential && nonEmpty) {
|
|
263
|
+
found.push(finding(keyPath, false));
|
|
264
|
+
continue;
|
|
265
|
+
}
|
|
266
|
+
stack.push({ node: value, path: keyPath, inEnv: key === 'env' });
|
|
267
|
+
continue;
|
|
268
|
+
}
|
|
269
|
+
if (nameIsCredential && isPresent(value))
|
|
270
|
+
found.push(finding(keyPath, typeof value === 'number'));
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
return found;
|
|
274
|
+
}
|
|
@@ -41,4 +41,5 @@ export declare function hooksSalvageMaskOf(dropped: readonly {
|
|
|
41
41
|
}[]): HooksSalvageMask;
|
|
42
42
|
export declare function salvageSettingsHooksEntries(doc: SettingsDocument | null | undefined): HooksSalvage;
|
|
43
43
|
export declare const HOOK_SETTINGS_SOURCE_TEXT: Readonly<Record<HookSettingsSource, string>>;
|
|
44
|
+
export declare function layerNotAppliedRefusesTurn(source: HookSettingsSource): boolean;
|
|
44
45
|
export declare function settingsHooksSalvageNotice(salvage: HooksSalvage, source: HookSettingsSource, doc?: SettingsDocument | null): string | undefined;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { displayUntrusted } from './displayUntrusted.js';
|
|
2
|
+
import { msg, renderMessage } from './i18n/translate.js';
|
|
2
3
|
import { SETTINGS_CLASSIFY_HOOKS_CONFIG, } from './generated/settingsSchemaFns.js';
|
|
3
4
|
const _tuplePins = [true, true, true, true, true, true];
|
|
4
5
|
void _tuplePins;
|
|
@@ -116,6 +117,9 @@ export const HOOK_SETTINGS_SOURCE_TEXT = Object.freeze({
|
|
|
116
117
|
localSettings: 'Local settings',
|
|
117
118
|
flagSettings: 'Flag settings',
|
|
118
119
|
});
|
|
120
|
+
export function layerNotAppliedRefusesTurn(source) {
|
|
121
|
+
return source === 'policySettings';
|
|
122
|
+
}
|
|
119
123
|
const SALVAGE_LABEL_MAX = 80;
|
|
120
124
|
const SALVAGE_PIECES_SHOWN = 3;
|
|
121
125
|
const labelOf = (s) => (typeof s === 'number' ? String(s) : displayUntrusted(s, { max: SALVAGE_LABEL_MAX }));
|
|
@@ -194,11 +198,13 @@ export function settingsHooksSalvageNotice(salvage, source, doc) {
|
|
|
194
198
|
try {
|
|
195
199
|
if (salvage.outcome === 'loaded-partial') {
|
|
196
200
|
const what = joinPhrases(salvage.dropped.map((d) => ({ key: d.path.join('\u0000'), text: dropPhrase(d, doc) })));
|
|
201
|
+
if (layerNotAppliedRefusesTurn(source))
|
|
202
|
+
return renderMessage(msg('config.hooks.salvage.managedPartial', { layer, what }));
|
|
197
203
|
return `${layer}: ${what}. The rest of this file's hooks are applied.`;
|
|
198
204
|
}
|
|
199
205
|
if (salvage.outcome === 'rejected') {
|
|
200
206
|
const why = joinPhrases(salvage.rejections.map((r) => ({ key: r.path.join('\u0000'), text: rejectionPhrase(r) })));
|
|
201
|
-
if (source
|
|
207
|
+
if (layerNotAppliedRefusesTurn(source)) {
|
|
202
208
|
return `${layer}: hooks could not be loaded — ${why}. Requests are not sent while the managed hooks cannot be applied; ask your administrator to fix the managed settings.`;
|
|
203
209
|
}
|
|
204
210
|
return `${layer}: hooks were not loaded — ${why}; ${GUARD_RISK_TAIL}.`;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { HostSettingsLayer, WorkspaceTrustState } from './hostSettingsSource.js';
|
|
2
|
+
export declare function layerAdmissionWord(layer: HostSettingsLayer, trust: WorkspaceTrustState | 'unreadable', category: string, member?: string): string;
|
|
3
|
+
export declare function layerAdmitted(layer: HostSettingsLayer, trust: WorkspaceTrustState | 'unreadable', category: string, member?: string): boolean;
|
|
4
|
+
export declare function admittedLayers<L extends HostSettingsLayer>(layers: readonly L[], trust: WorkspaceTrustState | 'unreadable', category: string, member?: string): readonly L[];
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { SETTINGS_LAYER_ADMISSION } from './generated/settingsSchemaFns.js';
|
|
2
|
+
const TRUST_UNREADABLE_READING = 'declined';
|
|
3
|
+
const ADMITTED = 'admitted';
|
|
4
|
+
function layerAdmissionOf(layer, trust, category, member) {
|
|
5
|
+
const reading = trust === 'unreadable' ? TRUST_UNREADABLE_READING : trust;
|
|
6
|
+
return member === undefined ? SETTINGS_LAYER_ADMISSION(layer, reading, category) : SETTINGS_LAYER_ADMISSION(layer, reading, category, member);
|
|
7
|
+
}
|
|
8
|
+
export function layerAdmissionWord(layer, trust, category, member) {
|
|
9
|
+
return layerAdmissionOf(layer, trust, category, member);
|
|
10
|
+
}
|
|
11
|
+
export function layerAdmitted(layer, trust, category, member) {
|
|
12
|
+
return layerAdmissionOf(layer, trust, category, member) === ADMITTED;
|
|
13
|
+
}
|
|
14
|
+
export function admittedLayers(layers, trust, category, member) {
|
|
15
|
+
return layers.filter((layer) => layerAdmitted(layer, trust, category, member));
|
|
16
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { engineWireTargetBaseUrl } from './engineWireTarget.js';
|
|
2
2
|
import { createEngineCapReader, unreadableReadingDetail } from './engineCapReader.js';
|
|
3
3
|
import { msg, renderMessage } from './i18n/translate.js';
|
|
4
|
-
import { ownDataField } from './ownKey.js';
|
|
4
|
+
import { guardedRead, ownDataField, readOwnDataValue } from './ownKey.js';
|
|
5
5
|
export function projectSkillToolListsCapability(caps) {
|
|
6
6
|
try {
|
|
7
7
|
if (caps === null || typeof caps !== 'object' || Array.isArray(caps))
|
|
@@ -21,13 +21,14 @@ const reader = createEngineCapReader({
|
|
|
21
21
|
name: 'skillToolLists',
|
|
22
22
|
project: projectSkillToolListsCapability,
|
|
23
23
|
});
|
|
24
|
-
export function observedSkillToolLists(baseUrl =
|
|
24
|
+
export function observedSkillToolLists(baseUrl = engineWireTargetBaseUrl()) {
|
|
25
25
|
return reader.observed(baseUrl);
|
|
26
26
|
}
|
|
27
27
|
export function skillToolListsAvailable(reading) {
|
|
28
|
-
|
|
28
|
+
const kind = guardedRead(() => readOwnDataValue(reading, 'kind'));
|
|
29
|
+
if (kind === 'present')
|
|
29
30
|
return 'yes';
|
|
30
|
-
if (
|
|
31
|
+
if (kind === 'absent' || kind === 'not_reported')
|
|
31
32
|
return 'no';
|
|
32
33
|
return 'unknown';
|
|
33
34
|
}
|