@sema-agent/client-core 0.97.1 → 0.99.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 +607 -0
- package/README.md +96 -46
- package/dist/adapt/arms.d.ts +1 -0
- package/dist/adapt/arms.js +188 -53
- package/dist/adapt/ids.d.ts +12 -1
- package/dist/adapt/ids.js +59 -8
- package/dist/adapt/instanceLedger.d.ts +50 -0
- package/dist/adapt/instanceLedger.js +147 -0
- package/dist/adapt/panelTasks.d.ts +1 -1
- package/dist/adapt/panelTasks.js +2 -2
- package/dist/adapt/textStream.d.ts +1 -0
- package/dist/adapt/textStream.js +24 -7
- package/dist/adapt/toolCards.d.ts +27 -5
- package/dist/adapt/toolCards.js +39 -6
- package/dist/adapt/wireShapes.js +6 -2
- package/dist/adapt.d.ts +2 -0
- package/dist/adapt.js +8 -3
- package/dist/adapter/activeRunSelfHeal.d.ts +9 -3
- package/dist/adapter/activeRunSelfHeal.js +205 -313
- package/dist/adapter/downstream/eventToSdkMessage.d.ts +2 -5
- package/dist/adapter/downstream/eventToSdkMessage.js +77 -36
- package/dist/adapter/downstream/terminalToSdkResult.js +11 -4
- package/dist/adapter/downstream/turnUsageToModelUsage.d.ts +5 -2
- package/dist/adapter/downstream/turnUsageToModelUsage.js +2 -0
- package/dist/adapter/runStream.js +79 -48
- package/dist/adapter/types.d.ts +4 -4
- package/dist/adapter/types.js +2 -1
- package/dist/agentSession/backgroundView.js +2 -1
- package/dist/agentSession/engineAgentRegistryRead.d.ts +2 -2
- package/dist/agentSession/engineAgentRegistryRead.js +12 -13
- package/dist/agentSession/engineSessionBackgroundStop.js +16 -8
- package/dist/agentsWireCaps.d.ts +8 -11
- package/dist/agentsWireCaps.js +196 -194
- package/dist/approvalDecidedByCapability.d.ts +0 -4
- package/dist/approvalDecidedByCapability.js +0 -6
- package/dist/approvalsStreamLiveCapability.d.ts +0 -4
- package/dist/approvalsStreamLiveCapability.js +0 -6
- package/dist/assistantInbox.d.ts +34 -0
- package/dist/assistantInbox.js +118 -0
- package/dist/centerWiringCapability.js +9 -1
- package/dist/clientSlice.d.ts +0 -9
- package/dist/clientSlice.js +0 -3
- package/dist/cloudConfigWireCaps.d.ts +5 -3
- package/dist/cloudConfigWireCaps.js +106 -64
- package/dist/compensations.js +1 -1
- package/dist/connectorStatus.d.ts +21 -0
- package/dist/connectorStatus.js +112 -0
- package/dist/controlRouter.d.ts +18 -3
- package/dist/controlRouter.js +106 -67
- package/dist/coreValuePorts.d.ts +29 -4
- package/dist/coreValuePorts.js +10 -0
- package/dist/corruptSessionCopy.d.ts +2 -1
- package/dist/corruptSessionCopy.js +3 -3
- package/dist/decideReceipt.d.ts +2 -2
- package/dist/decideReceipt.js +5 -2
- package/dist/declared/supportFloorDeclared.js +3 -3
- package/dist/detachWire.js +3 -2
- package/dist/deviceExecutorManagementCapability.d.ts +0 -4
- package/dist/deviceExecutorManagementCapability.js +0 -6
- package/dist/deviceRebind.d.ts +49 -1
- package/dist/deviceRebind.js +221 -3
- package/dist/devicesFace.d.ts +34 -0
- package/dist/devicesFace.js +90 -0
- package/dist/displayUntrusted.d.ts +2 -0
- package/dist/displayUntrusted.js +253 -76
- package/dist/engineAgentAbsence.d.ts +1 -1
- package/dist/engineAgentPanelStore.d.ts +12 -4
- package/dist/engineAgentPanelStore.js +16 -11
- package/dist/engineCapReader.d.ts +2 -5
- package/dist/engineCapReader.js +8 -10
- package/dist/engineCapsCache.d.ts +12 -0
- package/dist/engineCapsCache.js +76 -18
- package/dist/engineCapsChange.d.ts +2 -0
- package/dist/engineCapsChange.js +9 -0
- package/dist/engineClosedSets.d.ts +1 -0
- package/dist/engineClosedSets.js +4 -1
- package/dist/engineErrorCodes.d.ts +11 -3
- package/dist/engineErrorCodes.js +11 -8
- package/dist/engineIdentity.d.ts +1 -0
- package/dist/engineIdentity.js +8 -0
- package/dist/engineRowRef.d.ts +28 -0
- package/dist/engineRowRef.js +114 -0
- package/dist/engineSessionMessages.d.ts +68 -0
- package/dist/engineSessionMessages.js +370 -0
- package/dist/engineTargetSeat.d.ts +27 -0
- package/dist/engineTargetSeat.js +199 -0
- package/dist/engineToolDirectory.d.ts +0 -9
- package/dist/engineToolDirectory.js +1 -94
- package/dist/engineUrl.d.ts +18 -0
- package/dist/engineUrl.js +52 -0
- package/dist/engineWireFor.js +3 -8
- package/dist/env/uiLanguage.d.ts +11 -1
- package/dist/env/uiLanguage.js +38 -2
- package/dist/eventLeg.d.ts +100 -0
- package/dist/eventLeg.js +305 -0
- package/dist/executionLaneCapability.d.ts +0 -4
- package/dist/executionLaneCapability.js +3 -16
- package/dist/fileHistoryCaptureCapability.d.ts +2 -5
- package/dist/fileHistoryCaptureCapability.js +13 -21
- package/dist/fileHistoryLegNotice.d.ts +2 -1
- package/dist/fileHistoryLegNotice.js +3 -3
- package/dist/fleet/fleetLedger.d.ts +0 -3
- package/dist/fleet/fleetLedger.js +21 -36
- package/dist/fleet/fleetProjection.d.ts +2 -2
- package/dist/fleet/fleetProjection.js +10 -8
- package/dist/frameBinding.d.ts +8 -0
- package/dist/frameBinding.js +35 -0
- package/dist/gateFailureCodes.d.ts +2 -0
- package/dist/gateFailureCodes.js +15 -0
- package/dist/gateOutcome.d.ts +3 -1
- package/dist/gateOutcome.js +41 -8
- package/dist/gateVocabulary.d.ts +10 -4
- package/dist/gateVocabulary.js +107 -47
- package/dist/generated/engineAskFaceTables.js +2 -2
- package/dist/generated/engineFactTables.d.ts +22 -3
- package/dist/generated/engineFactTables.js +51 -4
- package/dist/generated/engineNoticeTables.js +18 -3
- package/dist/generated/settingsSchemaFns.d.ts +6 -0
- package/dist/generated/settingsSchemaFns.js +57 -0
- package/dist/generated/settingsSchemaHooksClassifier.d.ts +2 -0
- package/dist/generated/settingsSchemaHooksClassifier.js +254 -0
- package/dist/generated/settingsSchemaTables.d.ts +1 -0
- package/dist/generated/settingsSchemaTables.js +4 -0
- package/dist/generated/settingsSchemaTypes.d.ts +105 -0
- package/dist/generated/settingsSchemaTypes.js +1 -0
- package/dist/generated/toolNameTables.d.ts +1 -0
- package/dist/generated/toolNameTables.js +1 -0
- package/dist/hitl/allowRuleShadow.d.ts +8 -2
- package/dist/hitl/allowRuleShadow.js +36 -29
- package/dist/hitl/approvalCardReading.d.ts +15 -0
- package/dist/hitl/approvalCardReading.js +154 -0
- package/dist/hitl/approvalCardReasons.d.ts +14 -0
- package/dist/hitl/approvalCardReasons.js +119 -0
- package/dist/hitl/approvalHolds.d.ts +50 -15
- package/dist/hitl/approvalHolds.js +177 -27
- package/dist/hitl/approvalResolution.d.ts +51 -26
- package/dist/hitl/approvalResolution.js +86 -122
- package/dist/hitl/approvalsFeed.js +6 -18
- package/dist/hitl/askClassPair.d.ts +2 -0
- package/dist/hitl/askClassPair.js +17 -0
- package/dist/hitl/askGateWire.d.ts +20 -2
- package/dist/hitl/askGateWire.js +50 -1
- package/dist/hitl/askParkRowRouting.d.ts +5 -0
- package/dist/hitl/askParkRowRouting.js +32 -1
- package/dist/hitl/askSettlementLine.d.ts +28 -0
- package/dist/hitl/askSettlementLine.js +99 -0
- package/dist/hitl/automaticAnswerVerdict.d.ts +3 -2
- package/dist/hitl/automaticAnswerVerdict.js +29 -13
- package/dist/hitl/crashConverged.d.ts +11 -20
- package/dist/hitl/crashConverged.js +56 -0
- package/dist/hitl/crashConvergedNotice.d.ts +6 -3
- package/dist/hitl/crashConvergedNotice.js +48 -24
- package/dist/hitl/decisionConflict.js +3 -10
- package/dist/hitl/decisionRefusal.d.ts +40 -1
- package/dist/hitl/decisionRefusal.js +199 -42
- package/dist/hitl/frameRouter.d.ts +5 -2
- package/dist/hitl/frameRouter.js +27 -24
- package/dist/hitl/gateLedger.d.ts +2 -0
- package/dist/hitl/gateLedger.js +50 -13
- package/dist/hitl/hitlBridge.d.ts +2 -2
- package/dist/hitl/hitlBridge.js +13 -10
- package/dist/hitl/livePendingAsk.d.ts +3 -3
- package/dist/hitl/livePendingAsk.js +7 -18
- package/dist/hitl/parkResolver.d.ts +2 -24
- package/dist/hitl/parkResolver.js +61 -97
- package/dist/hitl/persistedRulesWire.d.ts +25 -0
- package/dist/hitl/persistedRulesWire.js +104 -2
- package/dist/hitl/planReviewWire.d.ts +31 -13
- package/dist/hitl/planReviewWire.js +120 -78
- package/dist/hitl/refusedToolNameProse.d.ts +0 -1
- package/dist/hitl/refusedToolNameProse.js +0 -3
- package/dist/hitl/replayedApproval.d.ts +4 -3
- package/dist/hitl/replayedApproval.js +7 -4
- package/dist/hitl/sessionPolicyDeliverable.d.ts +2 -0
- package/dist/hitl/sessionPolicyDeliverable.js +48 -7
- package/dist/hitl/sessionPolicyWire.d.ts +34 -21
- package/dist/hitl/sessionPolicyWire.js +179 -70
- package/dist/hitl/standingRows.d.ts +20 -2
- package/dist/hitl/standingRows.js +69 -8
- package/dist/hitl/suspendedReopen.d.ts +2 -1
- package/dist/hitl/suspendedReopen.js +7 -10
- package/dist/hitl/toolApprovalWire.d.ts +103 -156
- package/dist/hitl/toolApprovalWire.js +661 -411
- package/dist/hookMatcherVerdict.d.ts +6 -1
- package/dist/hookMatcherVerdict.js +14 -7
- package/dist/hooksWireCaps.d.ts +2 -2
- package/dist/hooksWireCaps.js +174 -81
- package/dist/host.d.ts +21 -0
- package/dist/hostTurnSettings.d.ts +71 -0
- package/dist/hostTurnSettings.js +291 -0
- package/dist/humanTurn.d.ts +14 -1
- package/dist/humanTurn.js +100 -12
- package/dist/humanTurnRead.d.ts +2 -0
- package/dist/humanTurnRead.js +22 -1
- package/dist/i18n/messages.en.d.ts +703 -0
- package/dist/i18n/messages.en.js +701 -0
- package/dist/i18n/messages.zh.d.ts +3 -0
- package/dist/i18n/messages.zh.js +837 -0
- package/dist/i18n/translate.d.ts +25 -0
- package/dist/i18n/translate.js +127 -0
- package/dist/index.d.ts +78 -29
- package/dist/index.js +54 -18
- package/dist/inheritEnvCapability.d.ts +32 -0
- package/dist/inheritEnvCapability.js +104 -0
- package/dist/inheritEnvWire.d.ts +3 -2
- package/dist/inheritEnvWire.js +12 -14
- package/dist/interactiveHalt.js +17 -6
- package/dist/liveModelCatalog.d.ts +3 -3
- package/dist/liveModelCatalog.js +15 -13
- package/dist/liveQuestionStore.d.ts +2 -21
- package/dist/mcpLiveness.d.ts +2 -1
- package/dist/mcpPanel.d.ts +10 -1
- package/dist/mcpPanel.js +40 -13
- package/dist/mcpProbeCapability.d.ts +2 -1
- package/dist/mcpProbeCapability.js +7 -11
- package/dist/mcpProbeWire.d.ts +9 -2
- package/dist/mcpProbeWire.js +6 -1
- package/dist/mcpWireCaps.d.ts +47 -2
- package/dist/mcpWireCaps.js +164 -16
- package/dist/memoryEntriesWire.d.ts +4 -9
- package/dist/memoryEntriesWire.js +5 -10
- package/dist/model/modelSupplyRules.d.ts +0 -2
- package/dist/model/modelSupplyRules.js +3 -12
- package/dist/model/modelsPolicy.d.ts +0 -5
- package/dist/model/modelsPolicy.js +6 -36
- package/dist/model/onboardJudgement.d.ts +93 -0
- package/dist/model/onboardJudgement.js +415 -0
- package/dist/model/subagentModelWord.d.ts +31 -0
- package/dist/model/subagentModelWord.js +261 -0
- package/dist/model/tierVocabulary.d.ts +2 -0
- package/dist/model/tierVocabulary.js +17 -5
- package/dist/modelCapabilityProbe.d.ts +64 -0
- package/dist/modelCapabilityProbe.js +600 -0
- package/dist/modelIdentityResolvability.d.ts +3 -0
- package/dist/modelIdentityResolvability.js +26 -17
- package/dist/notifications.d.ts +6 -0
- package/dist/notifications.js +71 -23
- package/dist/outputStyleSeatCapability.d.ts +0 -3
- package/dist/outputStyleSeatCapability.js +0 -3
- package/dist/ownKey.d.ts +22 -0
- package/dist/ownKey.js +94 -3
- package/dist/panelReduce.d.ts +21 -10
- package/dist/panelReduce.js +728 -550
- package/dist/panelStateHolder.d.ts +3 -7
- package/dist/panelStateHolder.js +14 -130
- package/dist/peerLaneCapability.d.ts +0 -4
- package/dist/peerLaneCapability.js +0 -6
- package/dist/permissionRuleIssue.js +2 -0
- package/dist/permissionRulesWriteCapability.d.ts +2 -5
- package/dist/permissionRulesWriteCapability.js +8 -12
- package/dist/permissionWireCaps.d.ts +2 -2
- package/dist/permissionWireCaps.js +2 -0
- package/dist/permissionsAllowGrantCapability.d.ts +0 -4
- package/dist/permissionsAllowGrantCapability.js +0 -6
- package/dist/permissionsDeclaration.d.ts +0 -11
- package/dist/permissionsDeclaration.js +60 -53
- package/dist/pluginHooksWire.d.ts +46 -3
- package/dist/pluginHooksWire.js +219 -16
- package/dist/preemptWire.d.ts +44 -0
- package/dist/preemptWire.js +83 -0
- package/dist/printModelStatus.d.ts +63 -0
- package/dist/printModelStatus.js +155 -0
- package/dist/printToolResultFrame.js +15 -4
- package/dist/replayBody.d.ts +3 -0
- package/dist/replayBody.js +14 -0
- package/dist/request/taskRequest.d.ts +11 -6
- package/dist/request/taskRequest.js +112 -19
- package/dist/resumeRefusalCopy.d.ts +13 -9
- package/dist/resumeRefusalCopy.js +81 -118
- package/dist/retryStatus.d.ts +45 -0
- package/dist/retryStatus.js +185 -1
- package/dist/rewindArchiveCapability.d.ts +0 -4
- package/dist/rewindArchiveCapability.js +2 -10
- package/dist/rewindArchiveReading.d.ts +0 -1
- package/dist/rewindArchiveReading.js +0 -3
- package/dist/runCancelContext.d.ts +2 -1
- package/dist/runCancelContext.js +4 -2
- package/dist/runReattachPolicy.d.ts +31 -0
- package/dist/runReattachPolicy.js +46 -0
- package/dist/runTerminal.d.ts +3 -6
- package/dist/runTerminal.js +8 -9
- package/dist/sandboxWire.d.ts +3 -1
- package/dist/sandboxWire.js +76 -27
- package/dist/scenarioRefusal.d.ts +9 -0
- package/dist/scenarioRefusal.js +111 -0
- package/dist/scenarioWire.js +1 -1
- package/dist/seam.d.ts +48 -2
- package/dist/seam.js +25 -4
- package/dist/seatContract.d.ts +311 -18
- package/dist/seatContract.js +824 -100
- package/dist/selfOrchestrationDenial.js +7 -19
- package/dist/sessionIdSegment.d.ts +6 -0
- package/dist/sessionIdSegment.js +24 -0
- package/dist/sessionMemoryStatus.js +6 -11
- package/dist/sessionPolicyCapability.d.ts +2 -5
- package/dist/sessionPolicyCapability.js +8 -12
- package/dist/sessionSyncFileHistoryCapability.d.ts +0 -3
- package/dist/sessionSyncFileHistoryCapability.js +0 -3
- package/dist/settingsHooksSalvage.d.ts +44 -0
- package/dist/settingsHooksSalvage.js +211 -0
- package/dist/skillToolListsCapability.d.ts +2 -4
- package/dist/skillToolListsCapability.js +8 -9
- package/dist/sqlEngineCapability.d.ts +0 -4
- package/dist/sqlEngineCapability.js +0 -6
- package/dist/sseIdleTriage.js +3 -2
- package/dist/steerPriorityCapability.d.ts +0 -3
- package/dist/steerPriorityCapability.js +0 -3
- package/dist/streamDrainingLegs.d.ts +4 -0
- package/dist/streamDrainingLegs.js +6 -1
- package/dist/subagent/engineCompactWire.d.ts +0 -1
- package/dist/subagent/engineCompactWire.js +7 -5
- package/dist/subagent/engineSubagentResume.js +15 -9
- package/dist/subagent/engineTaskHandleWire.js +4 -7
- package/dist/subagentContentStore.d.ts +3 -0
- package/dist/subagentContentStore.js +22 -10
- package/dist/submitReopen.d.ts +24 -0
- package/dist/submitReopen.js +75 -0
- package/dist/terminalStatuses.d.ts +3 -0
- package/dist/terminalStatuses.js +10 -2
- package/dist/toolHistoryMismatch.js +3 -2
- package/dist/toolResult.d.ts +10 -1
- package/dist/toolResult.js +34 -6
- package/dist/toolRoster.d.ts +3 -4
- package/dist/toolRoster.js +21 -22
- package/dist/turnFailurePresentation.d.ts +39 -0
- package/dist/turnFailurePresentation.js +402 -0
- package/dist/usageAnalytics.js +6 -11
- package/dist/userAttachmentEnvelope.d.ts +1 -0
- package/dist/userAttachmentEnvelope.js +37 -7
- package/dist/userAttachmentSeat.d.ts +21 -0
- package/dist/userAttachmentSeat.js +75 -0
- package/dist/userInvokedSkillsCapability.d.ts +11 -4
- package/dist/userInvokedSkillsCapability.js +31 -10
- package/dist/webSearchBackendCapability.d.ts +0 -4
- package/dist/webSearchBackendCapability.js +0 -6
- package/dist/wireErrorTriage.d.ts +7 -0
- package/dist/wireErrorTriage.js +26 -23
- package/dist/wireFailureShape.d.ts +62 -5
- package/dist/wireFailureShape.js +106 -5
- package/dist/wireRefusalCopy.d.ts +25 -3
- package/dist/wireRefusalCopy.js +74 -80
- package/dist/workflowsJournalCapability.d.ts +2 -5
- package/dist/workflowsJournalCapability.js +8 -12
- package/dist/writeProtectionCapability.d.ts +0 -4
- package/dist/writeProtectionCapability.js +0 -6
- package/docs/INTEGRATION-CLIENTS.md +1775 -56
- package/package.json +6 -5
- package/dist/attachmentSeatCapability.d.ts +0 -12
- package/dist/attachmentSeatCapability.js +0 -23
- package/dist/hitl/approvalOutcomeNote.d.ts +0 -10
- package/dist/hitl/approvalOutcomeNote.js +0 -29
- package/dist/sessionReadRedactionCapability.d.ts +0 -13
- package/dist/sessionReadRedactionCapability.js +0 -35
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { frozenSet } from './frozenSet.js';
|
|
2
2
|
import { ownDataField } from './ownKey.js';
|
|
3
|
-
import { hasCoreValuePort, mcpNamespace, mintNamespacePrefix
|
|
4
|
-
import { CORE_PROTOCOL_PREFIXES } from './generated/toolNameTables.js';
|
|
3
|
+
import { hasCoreValuePort, mcpNamespace, mintNamespacePrefix } from './coreValuePorts.js';
|
|
5
4
|
const notLanded = () => Object.freeze({ state: 'not_landed' });
|
|
6
5
|
const unreadable = () => Object.freeze({ state: 'unreadable' });
|
|
7
6
|
function readHalf(half) {
|
|
@@ -54,77 +53,11 @@ export function engineToolDirectoryOf(source) {
|
|
|
54
53
|
return unreadable();
|
|
55
54
|
}
|
|
56
55
|
}
|
|
57
|
-
export function mcpEntryReadingOf(toolName, directory) {
|
|
58
|
-
let ns;
|
|
59
|
-
try {
|
|
60
|
-
const mcp = namingPorts();
|
|
61
|
-
if (mcp === undefined)
|
|
62
|
-
return CORE_PROTOCOL_PREFIXES.some((p) => toolName.startsWith(p)) ? 'unchecked' : 'outside';
|
|
63
|
-
ns = protocolOf(toolName);
|
|
64
|
-
if (ns === undefined || ns.id !== mcp.id)
|
|
65
|
-
return 'outside';
|
|
66
|
-
}
|
|
67
|
-
catch {
|
|
68
|
-
return CORE_PROTOCOL_PREFIXES.some((p) => toolName.startsWith(p)) ? 'unchecked' : 'outside';
|
|
69
|
-
}
|
|
70
|
-
const prefixes = prefixesInHand(directory);
|
|
71
|
-
if (prefixes === undefined)
|
|
72
|
-
return 'unchecked';
|
|
73
|
-
let prefix;
|
|
74
|
-
try {
|
|
75
|
-
const peer = peerSegmentOf(ns, toolName);
|
|
76
|
-
if (peer === undefined || peer.includes('*'))
|
|
77
|
-
return 'unparsable';
|
|
78
|
-
prefix = mintNamespacePrefix(ns, peer);
|
|
79
|
-
}
|
|
80
|
-
catch {
|
|
81
|
-
return 'unparsable';
|
|
82
|
-
}
|
|
83
|
-
if (typeof prefix !== 'string' || prefix.length === 0)
|
|
84
|
-
return 'unchecked';
|
|
85
|
-
try {
|
|
86
|
-
return prefixes.has(prefix) ? 'answers' : 'unanswered';
|
|
87
|
-
}
|
|
88
|
-
catch {
|
|
89
|
-
return 'unchecked';
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
function prefixesInHand(directory) {
|
|
93
|
-
try {
|
|
94
|
-
if (directory === undefined || directory === null || typeof directory !== 'object' || directory.state !== 'directory')
|
|
95
|
-
return undefined;
|
|
96
|
-
const prefixes = directory.mcpServerPrefixes;
|
|
97
|
-
if (prefixes === null || typeof prefixes !== 'object' || typeof prefixes.has !== 'function')
|
|
98
|
-
return undefined;
|
|
99
|
-
return prefixes;
|
|
100
|
-
}
|
|
101
|
-
catch {
|
|
102
|
-
return undefined;
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
56
|
function namingPorts() {
|
|
106
57
|
if (!hasCoreValuePort('protocolOf') || !hasCoreValuePort('mintNamespacePrefix'))
|
|
107
58
|
return undefined;
|
|
108
59
|
return mcpNamespace();
|
|
109
60
|
}
|
|
110
|
-
function peerSegmentOf(ns, toolName) {
|
|
111
|
-
const read = (n) => {
|
|
112
|
-
const parsed = ns.parse(n);
|
|
113
|
-
if (parsed === null || typeof parsed !== 'object')
|
|
114
|
-
return undefined;
|
|
115
|
-
const peer = ownDataField(parsed, 'peer');
|
|
116
|
-
return typeof peer === 'string' && peer.length > 0 ? peer : undefined;
|
|
117
|
-
};
|
|
118
|
-
const direct = read(toolName);
|
|
119
|
-
if (direct !== undefined)
|
|
120
|
-
return direct;
|
|
121
|
-
if (!toolName.startsWith(ns.prefix))
|
|
122
|
-
return undefined;
|
|
123
|
-
const rest = toolName.slice(ns.prefix.length);
|
|
124
|
-
if (rest.length === 0)
|
|
125
|
-
return undefined;
|
|
126
|
-
return read(ns.makeName(rest, 'x')) === rest ? rest : undefined;
|
|
127
|
-
}
|
|
128
61
|
function unescapedIndexOf(s, ch, last) {
|
|
129
62
|
for (let k = 0; k < s.length; k++) {
|
|
130
63
|
const i = last ? s.length - 1 - k : k;
|
|
@@ -150,29 +83,3 @@ export function deniedEntryToolName(entry) {
|
|
|
150
83
|
const name = entry.substring(0, open);
|
|
151
84
|
return name.length === 0 ? entry : name.trim();
|
|
152
85
|
}
|
|
153
|
-
export function excludeToolsAgainstDirectory(exclude, directory) {
|
|
154
|
-
if (!Array.isArray(exclude))
|
|
155
|
-
throw new TypeError('excludeToolsAgainstDirectory: exclude must be an array of tool names');
|
|
156
|
-
const verdict = prefixesInHand(directory) !== undefined ? 'filtered' : 'directory_absent';
|
|
157
|
-
const send = [];
|
|
158
|
-
const omitted = [];
|
|
159
|
-
for (const entry of exclude) {
|
|
160
|
-
if (verdict === 'filtered' && typeof entry === 'string') {
|
|
161
|
-
const name = deniedEntryToolName(entry);
|
|
162
|
-
if (name !== undefined && mcpEntryReadingOf(name, directory) === 'unanswered') {
|
|
163
|
-
omitted.push(entry);
|
|
164
|
-
continue;
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
send.push(entry);
|
|
168
|
-
}
|
|
169
|
-
if (omitted.length === 0)
|
|
170
|
-
return { send, omitted, verdict };
|
|
171
|
-
const one = omitted.length === 1;
|
|
172
|
-
return {
|
|
173
|
-
send,
|
|
174
|
-
omitted,
|
|
175
|
-
verdict,
|
|
176
|
-
disclosure: `excludeTools: ${omitted.map((e) => JSON.stringify(e)).join(', ')} ${one ? 'names' : 'name'} no tool this deployment answers to (no MCP server of that name is declared for this session) — omitted. Excluding a tool that cannot be mounted changes nothing; the engine refuses a request that names one.`,
|
|
177
|
-
};
|
|
178
|
-
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export type EngineBaseUrlRefusalReason = 'empty' | 'scheme' | 'unparseable' | 'userinfo' | 'query_or_fragment';
|
|
2
|
+
export type EngineBaseUrlReading = {
|
|
3
|
+
readonly ok: true;
|
|
4
|
+
readonly url: string;
|
|
5
|
+
} | {
|
|
6
|
+
readonly ok: false;
|
|
7
|
+
readonly reason: EngineBaseUrlRefusalReason;
|
|
8
|
+
};
|
|
9
|
+
export type EngineUrlTransportRefusalReason = 'plaintext_remote' | 'not_http_url';
|
|
10
|
+
export type EngineUrlTransportVerdict = {
|
|
11
|
+
readonly ok: true;
|
|
12
|
+
readonly loopback: boolean;
|
|
13
|
+
} | {
|
|
14
|
+
readonly ok: false;
|
|
15
|
+
readonly reason: EngineUrlTransportRefusalReason;
|
|
16
|
+
};
|
|
17
|
+
export declare function normalizeEngineBaseUrl(raw: string | null | undefined): EngineBaseUrlReading;
|
|
18
|
+
export declare function engineUrlTransportVerdict(url: string): EngineUrlTransportVerdict;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { isLoopbackWireUrl } from './engineWireSdk.js';
|
|
2
|
+
const SLASH = 47;
|
|
3
|
+
function refusedBase(reason) {
|
|
4
|
+
return Object.freeze({ ok: false, reason });
|
|
5
|
+
}
|
|
6
|
+
function refusedTransport(reason) {
|
|
7
|
+
return Object.freeze({ ok: false, reason });
|
|
8
|
+
}
|
|
9
|
+
function withoutTrailingSlashes(s) {
|
|
10
|
+
let end = s.length;
|
|
11
|
+
while (end > 0 && s.charCodeAt(end - 1) === SLASH)
|
|
12
|
+
end--;
|
|
13
|
+
return s.slice(0, end);
|
|
14
|
+
}
|
|
15
|
+
export function normalizeEngineBaseUrl(raw) {
|
|
16
|
+
if (typeof raw !== 'string')
|
|
17
|
+
return refusedBase('empty');
|
|
18
|
+
const trimmed = raw.trim();
|
|
19
|
+
if (trimmed.length === 0)
|
|
20
|
+
return refusedBase('empty');
|
|
21
|
+
if (!/^https?:\/\//i.test(trimmed))
|
|
22
|
+
return refusedBase('scheme');
|
|
23
|
+
let parsed;
|
|
24
|
+
try {
|
|
25
|
+
parsed = new URL(trimmed);
|
|
26
|
+
}
|
|
27
|
+
catch {
|
|
28
|
+
return refusedBase('unparseable');
|
|
29
|
+
}
|
|
30
|
+
if (parsed.username !== '' || parsed.password !== '')
|
|
31
|
+
return refusedBase('userinfo');
|
|
32
|
+
if (trimmed.includes('?') || trimmed.includes('#'))
|
|
33
|
+
return refusedBase('query_or_fragment');
|
|
34
|
+
return Object.freeze({ ok: true, url: withoutTrailingSlashes(trimmed) });
|
|
35
|
+
}
|
|
36
|
+
export function engineUrlTransportVerdict(url) {
|
|
37
|
+
if (typeof url !== 'string')
|
|
38
|
+
return refusedTransport('not_http_url');
|
|
39
|
+
let parsed;
|
|
40
|
+
try {
|
|
41
|
+
parsed = new URL(url);
|
|
42
|
+
}
|
|
43
|
+
catch {
|
|
44
|
+
return refusedTransport('not_http_url');
|
|
45
|
+
}
|
|
46
|
+
const loopback = isLoopbackWireUrl(url);
|
|
47
|
+
if (parsed.protocol === 'https:')
|
|
48
|
+
return Object.freeze({ ok: true, loopback });
|
|
49
|
+
if (parsed.protocol === 'http:')
|
|
50
|
+
return loopback ? Object.freeze({ ok: true, loopback: true }) : refusedTransport('plaintext_remote');
|
|
51
|
+
return refusedTransport('not_http_url');
|
|
52
|
+
}
|
package/dist/engineWireFor.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { settleWithinDeadline } from './abortableSleep.js';
|
|
2
2
|
import { makeEngineWireClient } from './engineWireSdk.js';
|
|
3
3
|
import { engineWireTargetFor } from './engineWireTarget.js';
|
|
4
|
+
import { readThrownSlot } from './wireFailureShape.js';
|
|
4
5
|
export const INJECTED_WIRE_SETTLE_MS = 60_000;
|
|
5
6
|
export function engineWireFor(wire, sessionKey, usable) {
|
|
6
7
|
if (wire !== undefined) {
|
|
@@ -285,15 +286,9 @@ function abortedBeforeSendError() {
|
|
|
285
286
|
return e;
|
|
286
287
|
}
|
|
287
288
|
function answeredByEngine(e) {
|
|
288
|
-
|
|
289
|
-
if (e === null || typeof e !== 'object')
|
|
290
|
-
return false;
|
|
291
|
-
const o = e;
|
|
292
|
-
return typeof o.status === 'number' || typeof o.errorCode === 'string';
|
|
293
|
-
}
|
|
294
|
-
catch {
|
|
289
|
+
if (e === null || typeof e !== 'object')
|
|
295
290
|
return false;
|
|
296
|
-
|
|
291
|
+
return typeof readThrownSlot(e, 'status', 'data') === 'number' || typeof readThrownSlot(e, 'errorCode', 'data') === 'string';
|
|
297
292
|
}
|
|
298
293
|
const SETTLED_BY_PACKAGE_BRAND = Symbol.for('@sema-agent/client-core:engine-wire-settled');
|
|
299
294
|
function settledByPackage(value) {
|
package/dist/env/uiLanguage.d.ts
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
|
-
|
|
1
|
+
import { SETTINGS_UI_LANGUAGE_VALUES } from '../generated/settingsSchemaTables.js';
|
|
2
|
+
export type UiLanguage = (typeof SETTINGS_UI_LANGUAGE_VALUES)[number];
|
|
2
3
|
export declare const UI_LANGUAGES: readonly UiLanguage[];
|
|
3
4
|
export declare const UI_LANGUAGE_ENDONYMS: Record<UiLanguage, string>;
|
|
4
5
|
export declare function isUiLanguage(v: unknown): v is UiLanguage;
|
|
5
6
|
export declare function pickUiLanguage(localeTag: string | undefined): UiLanguage;
|
|
7
|
+
export type UiLanguageSource = 'saved' | 'host' | 'default';
|
|
8
|
+
export interface UiLanguageResolution {
|
|
9
|
+
readonly language: UiLanguage;
|
|
10
|
+
readonly source: UiLanguageSource;
|
|
11
|
+
}
|
|
12
|
+
export declare function resolveUiLanguageFrom(input: {
|
|
13
|
+
readonly saved?: string | null | undefined;
|
|
14
|
+
readonly hostTags?: readonly (string | null | undefined)[] | null | undefined;
|
|
15
|
+
} | null | undefined): UiLanguageResolution;
|
package/dist/env/uiLanguage.js
CHANGED
|
@@ -1,12 +1,48 @@
|
|
|
1
1
|
import { parseLocaleTag } from './localeTag.js';
|
|
2
|
-
|
|
2
|
+
import { SETTINGS_UI_LANGUAGE_VALUES } from '../generated/settingsSchemaTables.js';
|
|
3
|
+
export const UI_LANGUAGES = SETTINGS_UI_LANGUAGE_VALUES;
|
|
3
4
|
export const UI_LANGUAGE_ENDONYMS = {
|
|
4
5
|
en: 'English',
|
|
5
6
|
zh: '中文',
|
|
6
7
|
};
|
|
7
8
|
export function isUiLanguage(v) {
|
|
8
|
-
return v === '
|
|
9
|
+
return typeof v === 'string' && UI_LANGUAGES.includes(v);
|
|
9
10
|
}
|
|
10
11
|
export function pickUiLanguage(localeTag) {
|
|
11
12
|
return parseLocaleTag(localeTag).language === 'zh' ? 'zh' : 'en';
|
|
12
13
|
}
|
|
14
|
+
const HOST_TAGS_READ_LIMIT = 64;
|
|
15
|
+
function ownDataOf(v, key) {
|
|
16
|
+
if (v === null || typeof v !== 'object')
|
|
17
|
+
return undefined;
|
|
18
|
+
try {
|
|
19
|
+
const d = Object.getOwnPropertyDescriptor(v, key);
|
|
20
|
+
return d !== undefined && 'value' in d ? d.value : undefined;
|
|
21
|
+
}
|
|
22
|
+
catch {
|
|
23
|
+
return undefined;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
export function resolveUiLanguageFrom(input) {
|
|
27
|
+
const saved = ownDataOf(input, 'saved');
|
|
28
|
+
if (isUiLanguage(saved))
|
|
29
|
+
return Object.freeze({ language: saved, source: 'saved' });
|
|
30
|
+
const tags = ownDataOf(input, 'hostTags');
|
|
31
|
+
let isList = false;
|
|
32
|
+
try {
|
|
33
|
+
isList = Array.isArray(tags);
|
|
34
|
+
}
|
|
35
|
+
catch {
|
|
36
|
+
isList = false;
|
|
37
|
+
}
|
|
38
|
+
if (isList) {
|
|
39
|
+
const n = ownDataOf(tags, 'length');
|
|
40
|
+
const limit = typeof n === 'number' && Number.isSafeInteger(n) && n > 0 ? Math.min(n, HOST_TAGS_READ_LIMIT) : 0;
|
|
41
|
+
for (let i = 0; i < limit; i += 1) {
|
|
42
|
+
const tag = ownDataOf(tags, String(i));
|
|
43
|
+
if (typeof tag === 'string' && tag.length > 0)
|
|
44
|
+
return Object.freeze({ language: pickUiLanguage(tag), source: 'host' });
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
return Object.freeze({ language: 'en', source: 'default' });
|
|
48
|
+
}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import type { AgentEvent } from '@sema-agent/sdk';
|
|
2
|
+
import type { EngineBoundRun } from './engineRowRef.js';
|
|
3
|
+
import { type AskGateWireDeps } from './hitl/askGateWire.js';
|
|
4
|
+
import { type ActiveRunBusySignal } from './adapter/runStream.js';
|
|
5
|
+
import type { ApprovalRequestChromeEvent, ApprovalRevokeChromeEvent } from './seam.js';
|
|
6
|
+
export declare const EVENT_LEG_KINDS: readonly ["live", "durable", "continuation"];
|
|
7
|
+
export type EventLegKind = (typeof EVENT_LEG_KINDS)[number];
|
|
8
|
+
export type EventLegStage = 'bindRun' | 'stampOwner' | 'hitlFrames' | 'askBridge' | 'idleTriage';
|
|
9
|
+
export interface EventLegRow {
|
|
10
|
+
readonly stages: readonly EventLegStage[];
|
|
11
|
+
readonly windowIsCurrent: boolean;
|
|
12
|
+
}
|
|
13
|
+
export declare const EVENT_LEG_TABLE: Readonly<Record<EventLegKind, EventLegRow>>;
|
|
14
|
+
export interface EventLegLiveSpec {
|
|
15
|
+
readonly kind: 'live';
|
|
16
|
+
}
|
|
17
|
+
export interface EventLegRunSpec {
|
|
18
|
+
readonly kind: 'durable' | 'continuation';
|
|
19
|
+
readonly runId: string;
|
|
20
|
+
}
|
|
21
|
+
export type EventLegSpec = EventLegLiveSpec | EventLegRunSpec;
|
|
22
|
+
export type EventLegBindCause = 'open' | 'frame' | 'handoff';
|
|
23
|
+
export interface EventLegBoundInfo {
|
|
24
|
+
readonly cause: EventLegBindCause;
|
|
25
|
+
readonly leg: EventLegKind;
|
|
26
|
+
}
|
|
27
|
+
export interface EventLegFrameInfo {
|
|
28
|
+
readonly leg: EventLegKind;
|
|
29
|
+
}
|
|
30
|
+
export interface EventLegHitlEnvelope {
|
|
31
|
+
readonly windowIsCurrent: boolean;
|
|
32
|
+
readonly leg: EventLegKind;
|
|
33
|
+
}
|
|
34
|
+
export type EventLegQuestionFrame = Extract<AgentEvent, {
|
|
35
|
+
type: 'question' | 'question_complete';
|
|
36
|
+
}>;
|
|
37
|
+
export type EventLegElicitationFrame = Extract<AgentEvent, {
|
|
38
|
+
type: 'elicitation' | 'elicitation_complete';
|
|
39
|
+
}>;
|
|
40
|
+
export type EventLegToolApprovalFrame = Extract<AgentEvent, {
|
|
41
|
+
type: 'tool_approval' | 'tool_approval_complete';
|
|
42
|
+
}>;
|
|
43
|
+
export interface EventLegRunPorts {
|
|
44
|
+
headerRunId?(): string | undefined;
|
|
45
|
+
onBound?(binding: EngineBoundRun, info: EventLegBoundInfo): void;
|
|
46
|
+
onRefused?(refusal: EventLegRefusal, info: EventLegFrameInfo): void;
|
|
47
|
+
onTerminal?(frame: AgentEvent, binding: EngineBoundRun | undefined, info: EventLegFrameInfo): void;
|
|
48
|
+
isCurrent?(): boolean;
|
|
49
|
+
}
|
|
50
|
+
export interface EventLegRefusal {
|
|
51
|
+
readonly kind: 'busy' | 'not_created';
|
|
52
|
+
readonly candidateRunId?: string;
|
|
53
|
+
readonly busy?: ActiveRunBusySignal;
|
|
54
|
+
readonly errorCode?: string;
|
|
55
|
+
}
|
|
56
|
+
export interface EventLegOwnerPorts {
|
|
57
|
+
readonly sessionKey?: string;
|
|
58
|
+
}
|
|
59
|
+
export interface EventLegHitlPorts {
|
|
60
|
+
question?(frame: EventLegQuestionFrame, env: EventLegHitlEnvelope): void;
|
|
61
|
+
elicitation?(frame: EventLegElicitationFrame, env: EventLegHitlEnvelope): void;
|
|
62
|
+
toolApproval?(frame: EventLegToolApprovalFrame, env: EventLegHitlEnvelope): void;
|
|
63
|
+
}
|
|
64
|
+
export interface EventLegIdleTriagePorts {
|
|
65
|
+
readonly baseUrl: string;
|
|
66
|
+
}
|
|
67
|
+
export type EventLegTap = (frame: AgentEvent) => void;
|
|
68
|
+
export type EventLegStreamDecorator = (stream: AsyncGenerator<AgentEvent>, ctx: EventLegStreamContext) => AsyncGenerator<AgentEvent>;
|
|
69
|
+
export interface EventLegStreamContext {
|
|
70
|
+
readonly leg: EventLegKind;
|
|
71
|
+
readonly runId: string | undefined;
|
|
72
|
+
}
|
|
73
|
+
export interface ApprovalFrameContext {
|
|
74
|
+
readonly leg: EventLegKind;
|
|
75
|
+
readonly windowIsCurrent: boolean;
|
|
76
|
+
readonly receivedAtMs: number;
|
|
77
|
+
readonly streamEnded: AbortSignal;
|
|
78
|
+
}
|
|
79
|
+
export declare function approvalFrameContextOf(arm: ApprovalRequestChromeEvent | ApprovalRevokeChromeEvent): ApprovalFrameContext | undefined;
|
|
80
|
+
export interface EventLegPorts {
|
|
81
|
+
readonly run?: EventLegRunPorts;
|
|
82
|
+
readonly owner?: EventLegOwnerPorts;
|
|
83
|
+
readonly hitl?: EventLegHitlPorts;
|
|
84
|
+
readonly askBridge?: AskGateWireDeps;
|
|
85
|
+
readonly idleTriage?: EventLegIdleTriagePorts;
|
|
86
|
+
readonly signal?: AbortSignal;
|
|
87
|
+
readonly taps?: readonly EventLegTap[];
|
|
88
|
+
readonly perStream?: readonly EventLegStreamDecorator[];
|
|
89
|
+
}
|
|
90
|
+
export type EventLegPortName = 'run.headerRunId' | 'run.onBound' | 'run.onRefused' | 'run.onTerminal' | 'run.isCurrent' | 'hitl.question' | 'hitl.elicitation' | 'hitl.toolApproval' | 'askBridge.respondToolApproval' | 'taps' | 'perStream';
|
|
91
|
+
export interface EventLegReport {
|
|
92
|
+
readonly missingPorts: readonly EventLegPortName[];
|
|
93
|
+
readonly portFaults: Readonly<Partial<Record<EventLegPortName, number>>>;
|
|
94
|
+
readonly hitlUndelivered: number;
|
|
95
|
+
}
|
|
96
|
+
export interface EventLeg {
|
|
97
|
+
readonly events: AsyncGenerator<AgentEvent>;
|
|
98
|
+
report(): EventLegReport;
|
|
99
|
+
}
|
|
100
|
+
export declare function composeEventLeg(source: AsyncIterable<AgentEvent>, leg: EventLegSpec, ports: EventLegPorts): EventLeg;
|