@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
|
@@ -50,6 +50,7 @@ export type OnboardWriteVerdict = {
|
|
|
50
50
|
readonly refusal: 'probe_failed' | 'probe_unverified';
|
|
51
51
|
};
|
|
52
52
|
export declare function onboardWriteVerdict(verdict: OnboardProbeVerdict, acceptUnverified?: boolean): OnboardWriteVerdict;
|
|
53
|
+
export declare const KEY_SLOT_PREFIX = "SEMA_MODEL_KEY_";
|
|
53
54
|
export declare function keyEnvNameForEntry(entryName: string): string;
|
|
54
55
|
export declare function poolEntryNameOf(modelId: string, channel: string, taken: ReadonlySet<string>): string;
|
|
55
56
|
export interface OnboardPlanEntry {
|
|
@@ -206,7 +206,7 @@ export function onboardWriteVerdict(verdict, acceptUnverified) {
|
|
|
206
206
|
return Object.freeze({ write: false, refusal: 'probe_failed' });
|
|
207
207
|
return acceptUnverified === true ? Object.freeze({ write: true, unverified: true }) : Object.freeze({ write: false, refusal: 'probe_unverified' });
|
|
208
208
|
}
|
|
209
|
-
const KEY_SLOT_PREFIX = 'SEMA_MODEL_KEY_';
|
|
209
|
+
export const KEY_SLOT_PREFIX = 'SEMA_MODEL_KEY_';
|
|
210
210
|
export function keyEnvNameForEntry(entryName) {
|
|
211
211
|
const base = String(entryName).toUpperCase().replace(/[^A-Z0-9]+/g, '_').replace(/^_+|_+$/g, '') || 'ENTRY';
|
|
212
212
|
return `${KEY_SLOT_PREFIX}${base}`;
|
|
@@ -8,7 +8,7 @@ function ownData(v, key) {
|
|
|
8
8
|
return undefined;
|
|
9
9
|
try {
|
|
10
10
|
const d = Object.getOwnPropertyDescriptor(v, key);
|
|
11
|
-
return d !== undefined && 'value'
|
|
11
|
+
return d !== undefined && Object.hasOwn(d, 'value') ? d.value : undefined;
|
|
12
12
|
}
|
|
13
13
|
catch {
|
|
14
14
|
return undefined;
|
|
@@ -74,7 +74,7 @@ function ownSlot(v, key) {
|
|
|
74
74
|
const d = Object.getOwnPropertyDescriptor(v, key);
|
|
75
75
|
if (d === undefined)
|
|
76
76
|
return { kind: 'absent' };
|
|
77
|
-
return 'value'
|
|
77
|
+
return Object.hasOwn(d, 'value') ? { kind: 'value', value: d.value } : { kind: 'unreadable' };
|
|
78
78
|
}
|
|
79
79
|
catch {
|
|
80
80
|
return { kind: 'unreadable' };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { ModelApiWord } from './model/providerPresets.js';
|
|
2
|
+
import type { UiLanguage } from './env/uiLanguage.js';
|
|
2
3
|
export interface OpenAICompletionsProbeBody {
|
|
3
4
|
model: string;
|
|
4
5
|
messages: ReadonlyArray<{
|
|
@@ -129,5 +130,5 @@ export interface ProbeVerdictFacts {
|
|
|
129
130
|
}
|
|
130
131
|
export declare function probeVerdictNotice(facts: ProbeVerdictFacts | null | undefined, ctx?: {
|
|
131
132
|
readonly modelName?: string;
|
|
132
|
-
}): ProbeVerdictNotice;
|
|
133
|
+
}, lang?: UiLanguage): ProbeVerdictNotice;
|
|
133
134
|
export {};
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { displayUntrusted } from './displayUntrusted.js';
|
|
2
2
|
import { abortableSleep } from './abortableSleep.js';
|
|
3
|
+
import { causeSlotProtected, walkCauseChain } from './engineWireFor.js';
|
|
3
4
|
import { readThrownSlot } from './wireFailureShape.js';
|
|
4
5
|
import { guardedRead, readOwnDataValue } from './ownKey.js';
|
|
6
|
+
import { msg, renderMessage } from './i18n/translate.js';
|
|
5
7
|
export const THINKING_FORMATS = Object.freeze([
|
|
6
8
|
'openai',
|
|
7
9
|
'openrouter',
|
|
@@ -466,18 +468,17 @@ function nearestFromCatalogText(text, modelId) {
|
|
|
466
468
|
}
|
|
467
469
|
function unwrapFetchCause(e) {
|
|
468
470
|
const parts = [];
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
const
|
|
472
|
-
const message = readThrownSlot(cur, 'message');
|
|
471
|
+
walkCauseChain(e, (layer) => {
|
|
472
|
+
const code = readThrownSlot(layer, 'code');
|
|
473
|
+
const message = readThrownSlot(layer, 'message');
|
|
473
474
|
const c = typeof code === 'string' && code !== '' ? code : undefined;
|
|
474
475
|
const m = typeof message === 'string' && message !== '' ? message : undefined;
|
|
475
476
|
if (c !== undefined)
|
|
476
477
|
parts.push(m !== undefined && m !== c ? `${c} ${m}` : c);
|
|
477
478
|
else if (m !== undefined)
|
|
478
479
|
parts.push(m);
|
|
479
|
-
|
|
480
|
-
}
|
|
480
|
+
return undefined;
|
|
481
|
+
}, causeSlotProtected);
|
|
481
482
|
if (parts.length === 0 && typeof e === 'string')
|
|
482
483
|
parts.push(e);
|
|
483
484
|
return [...new Set(parts)].join(' ← ');
|
|
@@ -698,7 +699,7 @@ function probeSeconds(ms) {
|
|
|
698
699
|
return `${Number.isInteger(sec) ? sec : sec.toFixed(1)}s`;
|
|
699
700
|
}
|
|
700
701
|
const readFacts = (o, key) => guardedRead(() => readOwnDataValue(o, key));
|
|
701
|
-
export function probeVerdictNotice(facts, ctx) {
|
|
702
|
+
export function probeVerdictNotice(facts, ctx, lang) {
|
|
702
703
|
const rawWord = readFacts(facts, 'verdict');
|
|
703
704
|
const word = typeof rawWord === 'string' && PROBE_VERDICTS.includes(rawWord) ? rawWord : 'other';
|
|
704
705
|
const rawStatus = readFacts(facts, 'httpStatus');
|
|
@@ -713,31 +714,31 @@ export function probeVerdictNotice(facts, ctx) {
|
|
|
713
714
|
let recourse;
|
|
714
715
|
switch (word) {
|
|
715
716
|
case 'ok':
|
|
716
|
-
line =
|
|
717
|
+
line = renderMessage(waited === undefined ? msg('model.probe.verdict.ok') : msg('model.probe.verdict.okWaited', { time: probeSeconds(waited) }), lang);
|
|
717
718
|
break;
|
|
718
719
|
case 'auth':
|
|
719
|
-
line =
|
|
720
|
+
line = renderMessage(msg('model.probe.verdict.auth', { http }), lang);
|
|
720
721
|
recourse = 'check_credentials';
|
|
721
722
|
break;
|
|
722
723
|
case 'unreachable':
|
|
723
|
-
line =
|
|
724
|
+
line = renderMessage(waited === undefined ? msg('model.probe.verdict.unreachable') : msg('model.probe.verdict.unreachableWaited', { time: probeSeconds(waited) }), lang);
|
|
724
725
|
break;
|
|
725
726
|
case 'model':
|
|
726
|
-
line =
|
|
727
|
+
line = renderMessage(msg('model.probe.verdict.model', { http }), lang);
|
|
727
728
|
break;
|
|
728
729
|
case 'shape':
|
|
729
|
-
line =
|
|
730
|
+
line = renderMessage(msg('model.probe.verdict.shape', { http }), lang);
|
|
730
731
|
break;
|
|
731
732
|
case 'busy':
|
|
732
|
-
line =
|
|
733
|
+
line = renderMessage(msg('model.probe.verdict.busy', { http }), lang);
|
|
733
734
|
recourse = 'switch_model';
|
|
734
735
|
break;
|
|
735
736
|
case 'no_token':
|
|
736
|
-
line =
|
|
737
|
+
line = renderMessage(waited === undefined ? msg('model.probe.verdict.noToken') : msg('model.probe.verdict.noTokenWaited', { time: probeSeconds(waited) }), lang);
|
|
737
738
|
recourse = 'switch_model';
|
|
738
739
|
break;
|
|
739
740
|
case 'other':
|
|
740
|
-
line =
|
|
741
|
+
line = renderMessage(msg('model.probe.verdict.other', { http }), lang);
|
|
741
742
|
break;
|
|
742
743
|
}
|
|
743
744
|
return Object.freeze(recourse === undefined ? { line: `${prefix}${line}` } : { line: `${prefix}${line}`, recourse });
|
|
@@ -12,11 +12,16 @@ export type ModelIdentityLanes = {
|
|
|
12
12
|
[L in ModelIdentityLane]: ModelIdentityLaneReading;
|
|
13
13
|
};
|
|
14
14
|
export type EngineAnswerObservation = 'answered' | 'not_observed' | 'unreachable';
|
|
15
|
+
export type EngineCatalogAdoptionReading = 'absent' | 'refused' | 'undetermined';
|
|
15
16
|
export interface LocalEngineModelIdentityReading {
|
|
16
17
|
engine: 'local';
|
|
17
18
|
lanes: ModelIdentityLanes;
|
|
18
19
|
engineAnswer?: EngineAnswerObservation;
|
|
19
|
-
|
|
20
|
+
catalogAdoption?: EngineCatalogAdoptionReading;
|
|
21
|
+
catalogFacts?: {
|
|
22
|
+
readonly listed?: number;
|
|
23
|
+
readonly shapeRefused?: boolean;
|
|
24
|
+
};
|
|
20
25
|
routeGap?: ModelRouteGapReading;
|
|
21
26
|
}
|
|
22
27
|
export type ModelRouteGapReading = 'endpoint_missing' | 'lane_credential_missing' | 'none';
|
|
@@ -28,6 +33,12 @@ export type ModelIdentityReading = LocalEngineModelIdentityReading | RemoteEngin
|
|
|
28
33
|
export type ModelIdentityResolvability = 'resolvable' | 'not_resolvable' | 'unknown';
|
|
29
34
|
export type ModelSetupDecision = 'offer_setup' | 'offer_route_setup' | 'explain_unconfigured' | 'explain_route_gap' | 'explain_route_unconfigurable' | 'proceed';
|
|
30
35
|
export declare function modelIdentityResolvability(reading: ModelIdentityReading): ModelIdentityResolvability;
|
|
36
|
+
export interface ModelIdentityCatalogDeviation {
|
|
37
|
+
readonly kind: 'catalog_lane_overridden_by_facts';
|
|
38
|
+
readonly reported: ModelIdentityLaneReading | 'unusable';
|
|
39
|
+
readonly derived: 'partial' | 'absent';
|
|
40
|
+
}
|
|
41
|
+
export declare function modelIdentityCatalogDeviationOf(reading: ModelIdentityReading): ModelIdentityCatalogDeviation | undefined;
|
|
31
42
|
export declare function modelRouteGapSentence(lane: ModelIdentityLane, gap: ModelRouteGapReading, lang?: UiLanguage): string | undefined;
|
|
32
43
|
export declare function modelRouteGapFact(gap: ModelRouteGapReading, lang?: UiLanguage): string | undefined;
|
|
33
44
|
export declare function modelIdentityDetail(reading: ModelIdentityReading): string;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { engineCapsLandingOf } from './engineCapsCache.js';
|
|
2
|
-
import {
|
|
2
|
+
import { engineWireTargetBaseUrl } from './engineWireTarget.js';
|
|
3
3
|
import { msg, renderMessage } from './i18n/translate.js';
|
|
4
|
+
import { guardedRead, readOwnDataValue } from './ownKey.js';
|
|
4
5
|
function laneOrder() {
|
|
5
6
|
return ['processEnv', 'settingsEnv', 'modelCatalogFile', 'followedSettingsFile', 'followedProviderEnv'];
|
|
6
7
|
}
|
|
@@ -22,15 +23,37 @@ function laneState(lanes, lane) {
|
|
|
22
23
|
const v = hit.v;
|
|
23
24
|
return v === 'complete' || v === 'partial' || v === 'absent' || v === 'unreadable' ? v : 'unusable';
|
|
24
25
|
}
|
|
25
|
-
function catalogDefaultEvidence(catalog,
|
|
26
|
+
function catalogDefaultEvidence(catalog, adoption) {
|
|
26
27
|
const _evidencePin = true;
|
|
27
28
|
void _evidencePin;
|
|
28
|
-
return catalog === 'complete' &&
|
|
29
|
+
return catalog === 'complete' && adoption !== 'refused' ? { catalog, adoption: adoption ?? 'not_reported' } : undefined;
|
|
29
30
|
}
|
|
30
31
|
function routeGapOf(reading) {
|
|
31
32
|
const v = own(reading, 'routeGap')?.v;
|
|
32
33
|
return v === 'endpoint_missing' || v === 'lane_credential_missing' || v === 'none' ? v : undefined;
|
|
33
34
|
}
|
|
35
|
+
function catalogAdoptionOf(reading) {
|
|
36
|
+
const v = own(reading, 'catalogAdoption')?.v;
|
|
37
|
+
return v === 'absent' || v === 'refused' || v === 'undetermined' ? v : undefined;
|
|
38
|
+
}
|
|
39
|
+
const ownDataValue = (o, key) => guardedRead(() => readOwnDataValue(o, key));
|
|
40
|
+
function isPlainObjectSafe(v) {
|
|
41
|
+
try {
|
|
42
|
+
return isPlainObject(v);
|
|
43
|
+
}
|
|
44
|
+
catch {
|
|
45
|
+
return false;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
function catalogFactsDerivedOf(reading) {
|
|
49
|
+
const facts = ownDataValue(reading, 'catalogFacts');
|
|
50
|
+
if (!isPlainObjectSafe(facts) || ownDataValue(facts, 'shapeRefused') !== true)
|
|
51
|
+
return undefined;
|
|
52
|
+
if (catalogAdoptionOf(reading) !== 'refused')
|
|
53
|
+
return undefined;
|
|
54
|
+
const listed = ownDataValue(facts, 'listed');
|
|
55
|
+
return typeof listed === 'number' && Number.isSafeInteger(listed) && listed > 0 ? 'partial' : 'absent';
|
|
56
|
+
}
|
|
34
57
|
function analyse(reading) {
|
|
35
58
|
try {
|
|
36
59
|
if (!isPlainObject(reading))
|
|
@@ -47,29 +70,32 @@ function analyse(reading) {
|
|
|
47
70
|
const lanesHit = own(reading, 'lanes')?.v;
|
|
48
71
|
const order = laneOrder();
|
|
49
72
|
if (!isPlainObject(lanesHit)) {
|
|
50
|
-
return { verdict: 'unknown', why: 'lanes', unreadable: [], unreported: [...order], unusable: [],
|
|
73
|
+
return { verdict: 'unknown', why: 'lanes', unreadable: [], unreported: [...order], unusable: [], catalogRefused: false };
|
|
51
74
|
}
|
|
52
75
|
const partial = [];
|
|
53
76
|
const unreadable = [];
|
|
54
77
|
const unreported = [];
|
|
55
78
|
const unusable = [];
|
|
56
79
|
let catalogRefused = false;
|
|
57
|
-
let catalogUnconfirmed = null;
|
|
58
80
|
for (const lane of order) {
|
|
81
|
+
if (lane === 'modelCatalogFile') {
|
|
82
|
+
const factsDerived = catalogFactsDerivedOf(reading);
|
|
83
|
+
if (factsDerived !== undefined) {
|
|
84
|
+
if (factsDerived === 'partial') {
|
|
85
|
+
partial.push(lane);
|
|
86
|
+
catalogRefused = true;
|
|
87
|
+
}
|
|
88
|
+
continue;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
59
91
|
const s = laneState(lanesHit, lane);
|
|
60
92
|
if (lane === 'modelCatalogFile') {
|
|
61
93
|
if (s === 'complete') {
|
|
62
|
-
const
|
|
63
|
-
const evidence = catalogDefaultEvidence(s, bit?.v);
|
|
94
|
+
const evidence = catalogDefaultEvidence(s, catalogAdoptionOf(reading));
|
|
64
95
|
if (evidence !== undefined)
|
|
65
96
|
return { verdict: 'resolvable', why: 'catalog_default', evidence };
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
catalogRefused = true;
|
|
69
|
-
}
|
|
70
|
-
else {
|
|
71
|
-
catalogUnconfirmed = bit === undefined || bit.v === undefined ? 'not_reported' : 'unusable';
|
|
72
|
-
}
|
|
97
|
+
partial.push(lane);
|
|
98
|
+
catalogRefused = true;
|
|
73
99
|
continue;
|
|
74
100
|
}
|
|
75
101
|
}
|
|
@@ -88,8 +114,8 @@ function analyse(reading) {
|
|
|
88
114
|
else if (s === 'unusable')
|
|
89
115
|
unusable.push(lane);
|
|
90
116
|
}
|
|
91
|
-
if (unreadable.length > 0 || unreported.length > 0 || unusable.length > 0
|
|
92
|
-
return { verdict: 'unknown', why: 'lanes', unreadable, unreported, unusable,
|
|
117
|
+
if (unreadable.length > 0 || unreported.length > 0 || unusable.length > 0) {
|
|
118
|
+
return { verdict: 'unknown', why: 'lanes', unreadable, unreported, unusable, catalogRefused };
|
|
93
119
|
}
|
|
94
120
|
return { verdict: 'not_resolvable', why: 'lanes', partial, catalogRefused };
|
|
95
121
|
}
|
|
@@ -100,6 +126,26 @@ function analyse(reading) {
|
|
|
100
126
|
export function modelIdentityResolvability(reading) {
|
|
101
127
|
return analyse(reading).verdict;
|
|
102
128
|
}
|
|
129
|
+
export function modelIdentityCatalogDeviationOf(reading) {
|
|
130
|
+
try {
|
|
131
|
+
if (!isPlainObject(reading) || own(reading, 'engine')?.v !== 'local')
|
|
132
|
+
return undefined;
|
|
133
|
+
const lanesHit = own(reading, 'lanes')?.v;
|
|
134
|
+
if (!isPlainObject(lanesHit))
|
|
135
|
+
return undefined;
|
|
136
|
+
const derived = catalogFactsDerivedOf(reading);
|
|
137
|
+
if (derived === undefined)
|
|
138
|
+
return undefined;
|
|
139
|
+
const reported = laneState(lanesHit, 'modelCatalogFile');
|
|
140
|
+
if (reported === 'not_reported')
|
|
141
|
+
return undefined;
|
|
142
|
+
const withoutFacts = reported === 'complete' ? 'partial' : reported;
|
|
143
|
+
return withoutFacts === derived ? undefined : Object.freeze({ kind: 'catalog_lane_overridden_by_facts', reported, derived });
|
|
144
|
+
}
|
|
145
|
+
catch {
|
|
146
|
+
return undefined;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
103
149
|
const LANE_LABEL_KEYS = Object.freeze({
|
|
104
150
|
processEnv: 'model.identity.lane.processEnv',
|
|
105
151
|
settingsEnv: 'model.identity.lane.settingsEnv',
|
|
@@ -152,9 +198,10 @@ export function modelIdentityDetail(reading) {
|
|
|
152
198
|
? `${joinPhrases(others.map(laneLabel))} ${others.length > 1 ? 'carry' : 'carries'} part of a model configuration (such as a gateway address or a credential) but no model name`
|
|
153
199
|
: '';
|
|
154
200
|
if (a.catalogRefused) {
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
',
|
|
201
|
+
const clause = msg('model.identity.catalogAdoption.refused', { lane: msg(LANE_LABEL_KEYS.modelCatalogFile) });
|
|
202
|
+
return partialClause !== ''
|
|
203
|
+
? renderMessage(msg('model.identity.catalogAdoption.notResolvableWithPartial', { clause, partial: partialClause }))
|
|
204
|
+
: renderMessage(msg('model.identity.catalogAdoption.notResolvable', { clause }));
|
|
158
205
|
}
|
|
159
206
|
if (others.length > 0) {
|
|
160
207
|
return `no model name is configured for the local engine — ${partialClause}, and the engine does not start without one`;
|
|
@@ -173,14 +220,8 @@ export function modelIdentityDetail(reading) {
|
|
|
173
220
|
...a.unreported.map((l) => `${laneLabel(l)} was not reported`),
|
|
174
221
|
...a.unusable.map((l) => `${laneLabel(l)} gave no usable reading`),
|
|
175
222
|
];
|
|
176
|
-
if (a.
|
|
177
|
-
parts.push(
|
|
178
|
-
}
|
|
179
|
-
else if (a.catalogUnconfirmed === 'unusable') {
|
|
180
|
-
parts.push(`${laneLabel('modelCatalogFile')} names a default model, but the report of whether the local engine accepts a catalog default in place of a startup model name gave no usable reading`);
|
|
181
|
-
}
|
|
182
|
-
else if (a.catalogRefused) {
|
|
183
|
-
parts.push(`${laneLabel('modelCatalogFile')} names a default model, but the local engine is reported not to accept a catalog default in place of a startup model name`);
|
|
223
|
+
if (a.catalogRefused) {
|
|
224
|
+
parts.push(renderMessage(msg('model.identity.catalogAdoption.refused', { lane: msg(LANE_LABEL_KEYS.modelCatalogFile) })));
|
|
184
225
|
}
|
|
185
226
|
return `whether the local engine has a model name is unknown — ${joinPhrases(parts)}, and no other place this client reads provides one`;
|
|
186
227
|
}
|
|
@@ -220,6 +261,6 @@ export function modelSetupNotice(decision) {
|
|
|
220
261
|
return null;
|
|
221
262
|
}
|
|
222
263
|
}
|
|
223
|
-
export function observedEngineAnswer(baseUrl =
|
|
264
|
+
export function observedEngineAnswer(baseUrl = engineWireTargetBaseUrl()) {
|
|
224
265
|
return engineCapsLandingOf(baseUrl).kind === 'not_landed' ? 'not_observed' : 'answered';
|
|
225
266
|
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ModEventRow } from '@sema-agent/mods-kernel';
|
|
2
|
+
export interface ModsKernelSource {
|
|
3
|
+
readonly KERNEL_CONTRACT_VERSION: number;
|
|
4
|
+
readonly MOD_EVENT_TABLE: Readonly<Record<string, ModEventRow>>;
|
|
5
|
+
}
|
|
6
|
+
export interface ModsKernelIdentity {
|
|
7
|
+
readonly contractVersion: number;
|
|
8
|
+
readonly tableDigest: string;
|
|
9
|
+
}
|
|
10
|
+
export declare function modsKernelIdentity(kernel?: ModsKernelSource): ModsKernelIdentity;
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { KERNEL_CONTRACT_VERSION, MOD_EVENT_TABLE } from '@sema-agent/mods-kernel';
|
|
2
|
+
const MAX_DEPTH = 16;
|
|
3
|
+
const MAX_NODES = 100_000;
|
|
4
|
+
function canonical(v, depth, budget) {
|
|
5
|
+
budget.nodes += 1;
|
|
6
|
+
if (budget.nodes > MAX_NODES)
|
|
7
|
+
throw new TypeError('modsKernelIdentity: the event table is larger than a data table is');
|
|
8
|
+
if (depth > MAX_DEPTH)
|
|
9
|
+
throw new TypeError('modsKernelIdentity: the event table nests deeper than a data table does');
|
|
10
|
+
if (v === null || typeof v === 'string' || typeof v === 'boolean')
|
|
11
|
+
return JSON.stringify(v);
|
|
12
|
+
if (typeof v === 'number') {
|
|
13
|
+
if (!Number.isFinite(v))
|
|
14
|
+
throw new TypeError('modsKernelIdentity: the event table holds a number that is not finite');
|
|
15
|
+
return JSON.stringify(v);
|
|
16
|
+
}
|
|
17
|
+
if (Array.isArray(v)) {
|
|
18
|
+
const parts = [];
|
|
19
|
+
for (let i = 0; i < v.length; i++) {
|
|
20
|
+
if (!(i in v))
|
|
21
|
+
throw new TypeError('modsKernelIdentity: the event table holds an array with a hole');
|
|
22
|
+
parts.push(canonical(v[i], depth + 1, budget));
|
|
23
|
+
}
|
|
24
|
+
return `[${parts.join(',')}]`;
|
|
25
|
+
}
|
|
26
|
+
if (typeof v === 'object') {
|
|
27
|
+
const proto = Object.getPrototypeOf(v);
|
|
28
|
+
if (proto !== Object.prototype && proto !== null)
|
|
29
|
+
throw new TypeError('modsKernelIdentity: the event table holds an object that is not a plain record');
|
|
30
|
+
const o = v;
|
|
31
|
+
return `{${Object.keys(o)
|
|
32
|
+
.sort()
|
|
33
|
+
.map((k) => `${JSON.stringify(k)}:${canonical(o[k], depth + 1, budget)}`)
|
|
34
|
+
.join(',')}}`;
|
|
35
|
+
}
|
|
36
|
+
throw new TypeError('modsKernelIdentity: the event table holds a value that is not plain data');
|
|
37
|
+
}
|
|
38
|
+
function sha256Hex(msg) {
|
|
39
|
+
const k = [
|
|
40
|
+
0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5, 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174,
|
|
41
|
+
0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da, 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967,
|
|
42
|
+
0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85, 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070,
|
|
43
|
+
0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3, 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2,
|
|
44
|
+
];
|
|
45
|
+
const h = [0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19];
|
|
46
|
+
const len = msg.length;
|
|
47
|
+
const padded = new Uint8Array(((len + 8) >>> 6) * 64 + 64);
|
|
48
|
+
padded.set(msg);
|
|
49
|
+
padded[len] = 0x80;
|
|
50
|
+
const view = new DataView(padded.buffer);
|
|
51
|
+
view.setUint32(padded.length - 8, Math.floor(len / 0x20000000));
|
|
52
|
+
view.setUint32(padded.length - 4, (len << 3) >>> 0);
|
|
53
|
+
const w = new Array(64).fill(0);
|
|
54
|
+
const rotr = (x, n) => (x >>> n) | (x << (32 - n));
|
|
55
|
+
for (let off = 0; off < padded.length; off += 64) {
|
|
56
|
+
for (let t = 0; t < 16; t++)
|
|
57
|
+
w[t] = view.getUint32(off + t * 4);
|
|
58
|
+
for (let t = 16; t < 64; t++) {
|
|
59
|
+
const x = w[t - 15] ?? 0;
|
|
60
|
+
const y = w[t - 2] ?? 0;
|
|
61
|
+
const s0 = rotr(x, 7) ^ rotr(x, 18) ^ (x >>> 3);
|
|
62
|
+
const s1 = rotr(y, 17) ^ rotr(y, 19) ^ (y >>> 10);
|
|
63
|
+
w[t] = ((w[t - 16] ?? 0) + s0 + (w[t - 7] ?? 0) + s1) | 0;
|
|
64
|
+
}
|
|
65
|
+
let [a, b, c, d, e, f, g, hh] = h;
|
|
66
|
+
for (let t = 0; t < 64; t++) {
|
|
67
|
+
const t1 = (hh + (rotr(e, 6) ^ rotr(e, 11) ^ rotr(e, 25)) + ((e & f) ^ (~e & g)) + (k[t] ?? 0) + (w[t] ?? 0)) | 0;
|
|
68
|
+
const t2 = ((rotr(a, 2) ^ rotr(a, 13) ^ rotr(a, 22)) + ((a & b) ^ (a & c) ^ (b & c))) | 0;
|
|
69
|
+
hh = g;
|
|
70
|
+
g = f;
|
|
71
|
+
f = e;
|
|
72
|
+
e = (d + t1) | 0;
|
|
73
|
+
d = c;
|
|
74
|
+
c = b;
|
|
75
|
+
b = a;
|
|
76
|
+
a = (t1 + t2) | 0;
|
|
77
|
+
}
|
|
78
|
+
const next = [a, b, c, d, e, f, g, hh];
|
|
79
|
+
for (let i = 0; i < 8; i++)
|
|
80
|
+
h[i] = ((h[i] ?? 0) + (next[i] ?? 0)) | 0;
|
|
81
|
+
}
|
|
82
|
+
return h.map((x) => (x >>> 0).toString(16).padStart(8, '0')).join('');
|
|
83
|
+
}
|
|
84
|
+
export function modsKernelIdentity(kernel = { KERNEL_CONTRACT_VERSION, MOD_EVENT_TABLE }) {
|
|
85
|
+
try {
|
|
86
|
+
if (typeof kernel !== 'object' || kernel === null)
|
|
87
|
+
throw new TypeError('modsKernelIdentity: the source is not a kernel module');
|
|
88
|
+
const contractVersion = kernel.KERNEL_CONTRACT_VERSION;
|
|
89
|
+
const table = kernel.MOD_EVENT_TABLE;
|
|
90
|
+
if (typeof contractVersion !== 'number' || !Number.isFinite(contractVersion)) {
|
|
91
|
+
throw new TypeError('modsKernelIdentity: the source carries no readable contract number');
|
|
92
|
+
}
|
|
93
|
+
if (typeof table !== 'object' || table === null || Array.isArray(table)) {
|
|
94
|
+
throw new TypeError('modsKernelIdentity: the source carries no readable event table');
|
|
95
|
+
}
|
|
96
|
+
return { contractVersion, tableDigest: sha256Hex(new TextEncoder().encode(canonical(table, 0, { nodes: 0 }))) };
|
|
97
|
+
}
|
|
98
|
+
catch (e) {
|
|
99
|
+
if (e instanceof TypeError)
|
|
100
|
+
throw e;
|
|
101
|
+
throw new TypeError('modsKernelIdentity: the source could not be read', { cause: e });
|
|
102
|
+
}
|
|
103
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { KERNEL_CONTRACT_VERSION, MOD_TIERS, MOD_SEATS, MOD_EVENT_SIDES, MOD_FAILURE_ANSWERS, MOD_ABORT_POSTURES, NEXT_TO_TABLE, SEAT_TIER_TABLE, MOD_EVENT_TABLE, nextToRefusal, expandModPattern, isModEventName, stationOn, readOnSide, } from '@sema-agent/mods-kernel';
|
|
2
|
+
export { DEFAULT_MOD_BUDGET_MS, CATCH_BUDGET_MS, RUNAWAY_AFTER_MS, POST_ABORT_GRACE_MS, MAX_TIMER_MS, resolveModBudgetMs, } from '@sema-agent/mods-kernel';
|
|
3
|
+
export { MOD_FAILURE_CAUSES } from '@sema-agent/mods-kernel';
|
|
4
|
+
export { ENGINE_ORIGIN, MODS_INVALID_CODE, MODS_REGISTRATION_REFUSED_CODE, MOD_TRACE_OUTCOMES } from '@sema-agent/mods-kernel';
|
|
5
|
+
export { admitMods } from '@sema-agent/mods-kernel';
|
|
6
|
+
export type { ModTier, ModRegistrationTier, ModSeat, ModEventSide, ModBusSide, ModFailureAnswer, ModAbortPosture, ModStation, ModEventRow, ModEventName, ModBudgetReading, ModFailureCause, ModEventPayload, ModAnswerCheck, ModAnswerer, ModMatcher, ModSkip, ModTraceOutcome, ModUses, ModOrigin, ModPluginFacts, ModDollarBase, ModTraceEntry, ModCaughtError, ModNext, ModHandler, ModHandlerOptions, On, ModRegistration, ModAdmissionRecord, ModSeats, ModFrame, ModBottomContext, ModMethodBottom, ModMethodSeat, ModMethodBottoms, ModDispatchOutcome, ModDispatchOptions, ModBus, ModMountedHandler, ModBusInput, } from '@sema-agent/mods-kernel';
|
|
7
|
+
export { modsKernelIdentity } from './modsKernelIdentity.js';
|
|
8
|
+
export type { ModsKernelIdentity, ModsKernelSource } from './modsKernelIdentity.js';
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { KERNEL_CONTRACT_VERSION, MOD_TIERS, MOD_SEATS, MOD_EVENT_SIDES, MOD_FAILURE_ANSWERS, MOD_ABORT_POSTURES, NEXT_TO_TABLE, SEAT_TIER_TABLE, MOD_EVENT_TABLE, nextToRefusal, expandModPattern, isModEventName, stationOn, readOnSide, } from '@sema-agent/mods-kernel';
|
|
2
|
+
export { DEFAULT_MOD_BUDGET_MS, CATCH_BUDGET_MS, RUNAWAY_AFTER_MS, POST_ABORT_GRACE_MS, MAX_TIMER_MS, resolveModBudgetMs, } from '@sema-agent/mods-kernel';
|
|
3
|
+
export { MOD_FAILURE_CAUSES } from '@sema-agent/mods-kernel';
|
|
4
|
+
export { ENGINE_ORIGIN, MODS_INVALID_CODE, MODS_REGISTRATION_REFUSED_CODE, MOD_TRACE_OUTCOMES } from '@sema-agent/mods-kernel';
|
|
5
|
+
export { admitMods } from '@sema-agent/mods-kernel';
|
|
6
|
+
export { modsKernelIdentity } from './modsKernelIdentity.js';
|
package/dist/notifications.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { PlanReviewOutcomeMeta } from './hitl/planReviewWire.js';
|
|
2
|
+
import type { SubmissionKind } from './request/submissionIdentity.js';
|
|
2
3
|
export interface TaskNotificationFields {
|
|
3
4
|
taskId: string;
|
|
4
5
|
status: string;
|
|
@@ -15,17 +16,33 @@ export interface TaskNotificationFields {
|
|
|
15
16
|
recentSteps?: string[];
|
|
16
17
|
resumable?: boolean;
|
|
17
18
|
externalSource?: string;
|
|
19
|
+
completionId?: string;
|
|
20
|
+
seq?: number;
|
|
21
|
+
}
|
|
22
|
+
export declare const CORE_TASK_NOTIFICATION_TAGS: readonly string[];
|
|
23
|
+
export declare function renderTaskNotificationXml(raw: TaskNotificationFields): string;
|
|
24
|
+
export declare function freezeTaskNotificationFields(n: TaskNotificationFields): Readonly<TaskNotificationFields>;
|
|
25
|
+
export interface PendingNotificationCommand {
|
|
26
|
+
readonly value: string;
|
|
27
|
+
readonly mode: 'task-notification';
|
|
28
|
+
readonly _sema_task_notification?: Readonly<TaskNotificationFields>;
|
|
29
|
+
}
|
|
30
|
+
export interface TaskNotificationQueueCommand {
|
|
31
|
+
readonly value: string;
|
|
32
|
+
readonly mode: 'task-notification';
|
|
33
|
+
readonly _sema_task_notification: Readonly<TaskNotificationFields>;
|
|
18
34
|
}
|
|
19
|
-
export declare function
|
|
20
|
-
export declare function
|
|
21
|
-
export declare function
|
|
35
|
+
export declare function taskNotificationQueueCommand(n: TaskNotificationFields): TaskNotificationQueueCommand;
|
|
36
|
+
export declare function taskNotificationOf(carrier: object | null | undefined): Readonly<TaskNotificationFields> | undefined;
|
|
37
|
+
export declare function deriveNotificationResidualLines(raw: Record<string, unknown>): string[];
|
|
38
|
+
export declare function normalizeTaskNotification(raw: Record<string, unknown>): TaskNotificationFields | null;
|
|
22
39
|
export declare function taskNotificationDedupKey(n: {
|
|
23
40
|
taskId: string;
|
|
24
41
|
status: string;
|
|
25
42
|
seq?: number | string;
|
|
26
43
|
taskType?: string;
|
|
27
44
|
}): string;
|
|
28
|
-
export declare function taskNotificationDedupKeyFromWire(
|
|
45
|
+
export declare function taskNotificationDedupKeyFromWire(raw: Record<string, unknown>): string;
|
|
29
46
|
export interface TranscriptNotificationSeeds {
|
|
30
47
|
renderedKeys: string[];
|
|
31
48
|
notifiedKeys: string[];
|
|
@@ -38,16 +55,15 @@ export interface TaskNotificationXmlRead {
|
|
|
38
55
|
readonly external: boolean;
|
|
39
56
|
}
|
|
40
57
|
export declare function readTaskNotificationXml(xml: string): TaskNotificationXmlRead | undefined;
|
|
58
|
+
export declare const TASK_NOTIFICATION_TAG = "task-notification";
|
|
41
59
|
export interface QueuedCommandLike {
|
|
42
60
|
mode?: unknown;
|
|
43
61
|
agentId?: unknown;
|
|
44
62
|
value?: unknown;
|
|
63
|
+
_sema_task_notification?: {} | null;
|
|
45
64
|
}
|
|
46
65
|
export interface NotificationQueuePort {
|
|
47
|
-
enqueuePendingNotification(command:
|
|
48
|
-
value: string;
|
|
49
|
-
mode: 'task-notification';
|
|
50
|
-
}): void;
|
|
66
|
+
enqueuePendingNotification(command: PendingNotificationCommand): void;
|
|
51
67
|
removeByFilter(predicate: (cmd: QueuedCommandLike) => boolean): QueuedCommandLike[];
|
|
52
68
|
enqueueMetaPrompt?(command: {
|
|
53
69
|
value: string;
|
|
@@ -91,6 +107,7 @@ export declare function installWorkflowStatusProbe(probe: WorkflowStatusProbe):
|
|
|
91
107
|
type BgTaskStatusProbe = (taskId: string) => Promise<{
|
|
92
108
|
terminal: boolean;
|
|
93
109
|
status: string;
|
|
110
|
+
completionId?: string;
|
|
94
111
|
} | null>;
|
|
95
112
|
export declare function outstandingBgTaskPrompt(taskId: string): string | undefined;
|
|
96
113
|
export declare function installBgTaskStatusProbe(probe: BgTaskStatusProbe): void;
|
|
@@ -104,21 +121,22 @@ export interface EngineWorkflowCompletion {
|
|
|
104
121
|
status: 'completed' | 'failed';
|
|
105
122
|
summary: string;
|
|
106
123
|
}
|
|
107
|
-
export declare function enqueueBgChildNotification(
|
|
124
|
+
export declare function enqueueBgChildNotification(raw: {
|
|
108
125
|
taskId: string;
|
|
109
126
|
status: string;
|
|
110
127
|
seq?: number;
|
|
111
128
|
summary?: string;
|
|
129
|
+
completionId?: string;
|
|
112
130
|
}): void;
|
|
113
|
-
export declare function enqueueEngineWorkflowNotification(
|
|
131
|
+
export declare function enqueueEngineWorkflowNotification(raw: EngineWorkflowCompletion): void;
|
|
114
132
|
export declare function _resetEngineTaskNotificationForTest(): void;
|
|
115
133
|
export declare function _tickWatchOnceForTest(nowMs?: number): Promise<void>;
|
|
116
134
|
export declare function _setWatcherTimingForTest(o: {
|
|
117
135
|
probeTimeoutMs?: number;
|
|
118
136
|
stuckTickResetMs?: number;
|
|
119
137
|
} | null): void;
|
|
120
|
-
export declare function isTaskNotificationObjective(objective: unknown): boolean;
|
|
121
|
-
export declare function taskNotificationDeliverySupplement(objective: unknown): string | undefined;
|
|
138
|
+
export declare function isTaskNotificationObjective(objective: unknown, kind?: SubmissionKind): boolean;
|
|
139
|
+
export declare function taskNotificationDeliverySupplement(objective: unknown, kind?: SubmissionKind, notification?: Pick<TaskNotificationFields, 'status'>): string | undefined;
|
|
122
140
|
export declare function splitApiErrorSupplement(text: string): {
|
|
123
141
|
main: string;
|
|
124
142
|
supplement?: string;
|