@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/ownKey.js
CHANGED
|
@@ -34,6 +34,12 @@ export function readOwnDataValue(v, key) {
|
|
|
34
34
|
const d = Object.getOwnPropertyDescriptor(v, key);
|
|
35
35
|
return d !== undefined && Object.hasOwn(d, 'value') ? d.value : undefined;
|
|
36
36
|
}
|
|
37
|
+
export function carriesAnswerText(text) {
|
|
38
|
+
return text.trim().length > 0;
|
|
39
|
+
}
|
|
40
|
+
export function appendOwnElement(list, value) {
|
|
41
|
+
Object.defineProperty(list, list.length, { value, writable: true, enumerable: true, configurable: true });
|
|
42
|
+
}
|
|
37
43
|
export function guardedRead(read) {
|
|
38
44
|
try {
|
|
39
45
|
return read();
|
|
@@ -106,7 +112,7 @@ function contextUsageSectionRowsOf(raw) {
|
|
|
106
112
|
for (let i = 0; i < n; i++) {
|
|
107
113
|
const row = guardedRead(() => contextUsageSectionRowOf(raw, i));
|
|
108
114
|
if (row !== undefined)
|
|
109
|
-
rows
|
|
115
|
+
appendOwnElement(rows, row);
|
|
110
116
|
}
|
|
111
117
|
return rows.length > 0 ? rows : undefined;
|
|
112
118
|
}
|
|
@@ -157,7 +163,7 @@ export function humanInputAttachmentsOf(frame) {
|
|
|
157
163
|
return { ordinal, ...(kind !== undefined ? { kind } : {}), outcome, ...(label !== undefined ? { label } : {}) };
|
|
158
164
|
});
|
|
159
165
|
if (row !== undefined)
|
|
160
|
-
rows
|
|
166
|
+
appendOwnElement(rows, row);
|
|
161
167
|
}
|
|
162
168
|
return rows.length > 0 ? rows : undefined;
|
|
163
169
|
}
|
|
@@ -189,3 +195,233 @@ export function mcpSectionDroppedNamedRowsOf(rows, name) {
|
|
|
189
195
|
return 0;
|
|
190
196
|
}
|
|
191
197
|
}
|
|
198
|
+
export function promptManifestSectionViewOf(row) {
|
|
199
|
+
const o = row;
|
|
200
|
+
const str = (v) => (typeof v === 'string' && v.length > 0 ? v : undefined);
|
|
201
|
+
const id = str(o.id);
|
|
202
|
+
const chars = typeof o.chars === 'number' && Number.isFinite(o.chars) && o.chars >= 0 ? o.chars : undefined;
|
|
203
|
+
if (id === undefined || chars === undefined)
|
|
204
|
+
return undefined;
|
|
205
|
+
const band = str(o.band);
|
|
206
|
+
const locale = str(o.locale);
|
|
207
|
+
const variant = str(o.variant);
|
|
208
|
+
const contentHash = band !== undefined ? str(o.contentHash) : undefined;
|
|
209
|
+
const slot = str(o.slot);
|
|
210
|
+
return {
|
|
211
|
+
id,
|
|
212
|
+
chars,
|
|
213
|
+
...(band !== undefined ? { band } : {}),
|
|
214
|
+
...(locale !== undefined ? { locale } : {}),
|
|
215
|
+
...(variant !== undefined ? { variant } : {}),
|
|
216
|
+
...(contentHash !== undefined ? { contentHash } : {}),
|
|
217
|
+
...(slot !== undefined ? { slot } : {}),
|
|
218
|
+
};
|
|
219
|
+
}
|
|
220
|
+
export function promptManifestIdentityOfFrame(frame) {
|
|
221
|
+
let raw;
|
|
222
|
+
try {
|
|
223
|
+
raw = frame.identity;
|
|
224
|
+
}
|
|
225
|
+
catch {
|
|
226
|
+
return undefined;
|
|
227
|
+
}
|
|
228
|
+
return promptManifestIdentityOf(typeof raw === 'object' && raw !== null ? raw : undefined);
|
|
229
|
+
}
|
|
230
|
+
export function promptManifestIdentityOf(raw) {
|
|
231
|
+
try {
|
|
232
|
+
const plain = (v) => typeof v === 'object' && v !== null && !Array.isArray(v);
|
|
233
|
+
const str = (v) => (typeof v === 'string' && v.length > 0 ? v : undefined);
|
|
234
|
+
if (!plain(raw))
|
|
235
|
+
return undefined;
|
|
236
|
+
const artifact = str(raw.artifact);
|
|
237
|
+
const activatedBy = str(raw.activatedBy);
|
|
238
|
+
const epochRaw = raw.epoch;
|
|
239
|
+
const epoch = typeof epochRaw === 'number' && Number.isInteger(epochRaw) && epochRaw >= 0 ? epochRaw : undefined;
|
|
240
|
+
const layersRaw = raw.layers;
|
|
241
|
+
if (artifact === undefined || activatedBy === undefined || epoch === undefined || !plain(layersRaw))
|
|
242
|
+
return undefined;
|
|
243
|
+
const catalog = str(layersRaw.catalog);
|
|
244
|
+
const binding = str(layersRaw.binding);
|
|
245
|
+
if (catalog === undefined || binding === undefined)
|
|
246
|
+
return undefined;
|
|
247
|
+
const optional = {};
|
|
248
|
+
for (const k of ['center', 'deploy', 'task']) {
|
|
249
|
+
const v = layersRaw[k];
|
|
250
|
+
if (v === undefined)
|
|
251
|
+
continue;
|
|
252
|
+
const t = str(v);
|
|
253
|
+
if (t === undefined)
|
|
254
|
+
return undefined;
|
|
255
|
+
optional[k] = t;
|
|
256
|
+
}
|
|
257
|
+
const renderersRaw = layersRaw.renderers;
|
|
258
|
+
if (!plain(renderersRaw))
|
|
259
|
+
return undefined;
|
|
260
|
+
const entries = [];
|
|
261
|
+
for (const [k, v] of Object.entries(renderersRaw)) {
|
|
262
|
+
if (typeof v !== 'number' || !Number.isFinite(v))
|
|
263
|
+
return undefined;
|
|
264
|
+
appendOwnElement(entries, [k, v]);
|
|
265
|
+
}
|
|
266
|
+
const renderers = Object.fromEntries(entries);
|
|
267
|
+
return { artifact, layers: { catalog, renderers, ...optional, binding }, epoch, activatedBy };
|
|
268
|
+
}
|
|
269
|
+
catch {
|
|
270
|
+
return undefined;
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
const SAMPLED = new WeakSet();
|
|
274
|
+
const SAMPLE_MAX_DEPTH = 256;
|
|
275
|
+
export function isOwnSnapshot(v) {
|
|
276
|
+
return isBranded(v);
|
|
277
|
+
}
|
|
278
|
+
function isBranded(v) {
|
|
279
|
+
return typeof v === 'object' && v !== null && SAMPLED.has(v);
|
|
280
|
+
}
|
|
281
|
+
function arrayIndexOfKey(k) {
|
|
282
|
+
if (!/^(?:0|[1-9]\d*)$/.test(k))
|
|
283
|
+
return undefined;
|
|
284
|
+
const n = Number(k);
|
|
285
|
+
return n < 4294967295 ? n : undefined;
|
|
286
|
+
}
|
|
287
|
+
export function ownSnapshot(value) {
|
|
288
|
+
return snapshotOf(value);
|
|
289
|
+
}
|
|
290
|
+
function snapshotOf(value) {
|
|
291
|
+
if (typeof value === 'object' && value !== null) {
|
|
292
|
+
if (SAMPLED.has(value))
|
|
293
|
+
return value;
|
|
294
|
+
return sampleObject(value, 0, { done: new Map(), path: new Set(), seen: new Set(), rework: 0, depthCuts: 0 });
|
|
295
|
+
}
|
|
296
|
+
return samplePrimitive(value);
|
|
297
|
+
}
|
|
298
|
+
export function ownSnapshotWhenTyped(value, word) {
|
|
299
|
+
return snapshotWhenTyped(value, word);
|
|
300
|
+
}
|
|
301
|
+
function snapshotWhenTyped(value, word) {
|
|
302
|
+
if (typeof value !== 'object' || value === null)
|
|
303
|
+
return value;
|
|
304
|
+
if (guardedRead(() => Array.isArray(value)) === true)
|
|
305
|
+
return value;
|
|
306
|
+
const read = guardedRead(() => ({ own: Object.getOwnPropertyDescriptor(value, 'type') }));
|
|
307
|
+
if (read !== undefined) {
|
|
308
|
+
const own = read.own;
|
|
309
|
+
if (own === undefined) {
|
|
310
|
+
if (guardedRead(() => 'type' in value) === false)
|
|
311
|
+
return value;
|
|
312
|
+
}
|
|
313
|
+
else if (Object.hasOwn(own, 'value') && typeof own.value === 'string' && own.value !== '' && own.value !== word) {
|
|
314
|
+
return value;
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
return recordOf(value);
|
|
318
|
+
}
|
|
319
|
+
export function ownSnapshotTyped(value) {
|
|
320
|
+
return recordOf(value);
|
|
321
|
+
}
|
|
322
|
+
export function ownSnapshotRecord(value) {
|
|
323
|
+
return recordOf(value);
|
|
324
|
+
}
|
|
325
|
+
function recordOf(value) {
|
|
326
|
+
const s = snapshotOf(value);
|
|
327
|
+
return typeof s === 'object' && s !== null && !Array.isArray(s) ? s : undefined;
|
|
328
|
+
}
|
|
329
|
+
function samplePrimitive(v) {
|
|
330
|
+
return typeof v === 'string' || typeof v === 'number' || typeof v === 'boolean' ? v : v === null ? null : undefined;
|
|
331
|
+
}
|
|
332
|
+
const SAMPLE_MAX_TRAILING_HOLES = 1024;
|
|
333
|
+
const SAMPLE_MAX_INDEX = 1 << 20;
|
|
334
|
+
const SAMPLE_MAX_REWORK = 2048;
|
|
335
|
+
function sampleValue(v, depth, run) {
|
|
336
|
+
return typeof v === 'object' && v !== null ? sampleObject(v, depth, run) : samplePrimitive(v);
|
|
337
|
+
}
|
|
338
|
+
function sampleObject(src, depth, run) {
|
|
339
|
+
const hit = run.done.get(src);
|
|
340
|
+
if (hit !== undefined)
|
|
341
|
+
return hit ?? undefined;
|
|
342
|
+
if (SAMPLED.has(src))
|
|
343
|
+
return src;
|
|
344
|
+
if (run.path.has(src))
|
|
345
|
+
return undefined;
|
|
346
|
+
if (depth >= SAMPLE_MAX_DEPTH) {
|
|
347
|
+
run.depthCuts++;
|
|
348
|
+
return undefined;
|
|
349
|
+
}
|
|
350
|
+
if (run.seen.has(src)) {
|
|
351
|
+
if (++run.rework > SAMPLE_MAX_REWORK) {
|
|
352
|
+
run.depthCuts++;
|
|
353
|
+
return undefined;
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
else {
|
|
357
|
+
run.seen.add(src);
|
|
358
|
+
}
|
|
359
|
+
let isArray;
|
|
360
|
+
let keys;
|
|
361
|
+
try {
|
|
362
|
+
isArray = Array.isArray(src);
|
|
363
|
+
keys = Reflect.ownKeys(src);
|
|
364
|
+
}
|
|
365
|
+
catch {
|
|
366
|
+
run.done.set(src, null);
|
|
367
|
+
return undefined;
|
|
368
|
+
}
|
|
369
|
+
run.path.add(src);
|
|
370
|
+
const cutsBefore = run.depthCuts;
|
|
371
|
+
try {
|
|
372
|
+
const rec = {};
|
|
373
|
+
const arr = [];
|
|
374
|
+
let tail = 0;
|
|
375
|
+
let good = 0;
|
|
376
|
+
let declared = 0;
|
|
377
|
+
for (const k of keys) {
|
|
378
|
+
if (typeof k !== 'string')
|
|
379
|
+
continue;
|
|
380
|
+
if (isArray && k === 'length') {
|
|
381
|
+
const lv = guardedRead(() => {
|
|
382
|
+
const ld = Object.getOwnPropertyDescriptor(src, 'length');
|
|
383
|
+
return ld !== undefined && Object.hasOwn(ld, 'value') ? ld.value : undefined;
|
|
384
|
+
});
|
|
385
|
+
if (typeof lv === 'number' && Number.isInteger(lv) && lv > 0 && lv <= 0xffffffff)
|
|
386
|
+
declared = lv;
|
|
387
|
+
continue;
|
|
388
|
+
}
|
|
389
|
+
const index = isArray ? arrayIndexOfKey(k) : undefined;
|
|
390
|
+
if (isArray && index === undefined)
|
|
391
|
+
continue;
|
|
392
|
+
if (index !== undefined && index >= SAMPLE_MAX_INDEX)
|
|
393
|
+
continue;
|
|
394
|
+
if (index !== undefined && index + 1 > tail)
|
|
395
|
+
tail = index + 1;
|
|
396
|
+
const d = guardedRead(() => Object.getOwnPropertyDescriptor(src, k));
|
|
397
|
+
if (d === undefined)
|
|
398
|
+
continue;
|
|
399
|
+
if (d.enumerable !== true || !Object.hasOwn(d, 'value'))
|
|
400
|
+
continue;
|
|
401
|
+
const child = sampleValue(d.value, depth + 1, run);
|
|
402
|
+
if (child === undefined)
|
|
403
|
+
continue;
|
|
404
|
+
if (index !== undefined) {
|
|
405
|
+
Object.defineProperty(arr, index, { value: child, writable: true, enumerable: true, configurable: true });
|
|
406
|
+
if (index + 1 > good)
|
|
407
|
+
good = index + 1;
|
|
408
|
+
}
|
|
409
|
+
else
|
|
410
|
+
putOwnKey(rec, k, child);
|
|
411
|
+
}
|
|
412
|
+
if (isArray) {
|
|
413
|
+
const want = Math.max(good, Math.min(Math.max(tail, declared), good + SAMPLE_MAX_TRAILING_HOLES));
|
|
414
|
+
if (arr.length < want)
|
|
415
|
+
arr.length = want;
|
|
416
|
+
}
|
|
417
|
+
const out = isArray ? arr : rec;
|
|
418
|
+
Object.freeze(out);
|
|
419
|
+
SAMPLED.add(out);
|
|
420
|
+
if (run.depthCuts === cutsBefore)
|
|
421
|
+
run.done.set(src, out);
|
|
422
|
+
return out;
|
|
423
|
+
}
|
|
424
|
+
finally {
|
|
425
|
+
run.path.delete(src);
|
|
426
|
+
}
|
|
427
|
+
}
|
package/dist/panelReduce.d.ts
CHANGED
|
@@ -116,6 +116,11 @@ export declare function reducePanelFrame(state: PanelReduceState, frame: PanelFr
|
|
|
116
116
|
};
|
|
117
117
|
export declare function panelRowSnapshot(state: PanelReduceState): PanelDelta[];
|
|
118
118
|
export declare function panelResolveTaskId(state: PanelReduceState, wireTaskId: string): EnginePanelTaskIdentity;
|
|
119
|
+
export interface PanelSubagentIdentity {
|
|
120
|
+
readonly key: string;
|
|
121
|
+
readonly ids: readonly string[];
|
|
122
|
+
}
|
|
123
|
+
export declare function panelSubagentOf(state: PanelReduceState, id: string): PanelSubagentIdentity | undefined;
|
|
119
124
|
export declare function panelIsResident(state: PanelReduceState, taskId: string): boolean;
|
|
120
125
|
export declare function panelAnchorOf(state: PanelReduceState, taskId: string): string | undefined;
|
|
121
126
|
export declare function panelPresenceSize(state: PanelReduceState, sessionKey: string): number;
|
package/dist/panelReduce.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { rowIdTail } from './workflow.js';
|
|
2
2
|
import { isSdkFleetTaskTerminal, isSdkFleetTaskTerminalNotSuccess } from './terminalStatuses.js';
|
|
3
|
-
import { carryCycle, cycleEmpty, cycleKeysChanged, cycleOf, cycleOrder, mergeCycle, } from './cycleOrder.js';
|
|
3
|
+
import { carryCycle, cycleEmpty, cycleKeysChanged, cycleOf, cycleOrder, cycleSeqValue, mergeCycle, } from './cycleOrder.js';
|
|
4
4
|
export function isStaleEngineAgentPanelEnd(end, current) {
|
|
5
5
|
return cycleOrder(end, current) === 'before';
|
|
6
6
|
}
|
|
@@ -575,10 +575,26 @@ function fullUsage(key, row) {
|
|
|
575
575
|
return undefined;
|
|
576
576
|
return usageDelta(key, { ...(row.totalTokens !== undefined ? { totalTokens: row.totalTokens } : {}), ...(row.toolUses !== undefined ? { toolUses: row.toolUses } : {}), ...(fin !== undefined ? { final: fin } : {}) });
|
|
577
577
|
}
|
|
578
|
+
function ownDataOf(o, key) {
|
|
579
|
+
if (typeof o !== 'object' || o === null)
|
|
580
|
+
return undefined;
|
|
581
|
+
try {
|
|
582
|
+
const d = Object.getOwnPropertyDescriptor(o, key);
|
|
583
|
+
return d !== undefined && Object.hasOwn(d, 'value') ? d.value : undefined;
|
|
584
|
+
}
|
|
585
|
+
catch {
|
|
586
|
+
return undefined;
|
|
587
|
+
}
|
|
588
|
+
}
|
|
589
|
+
function publisherFinality(f) {
|
|
590
|
+
return { ...(ownDataOf(f, 'totalTokens') === true ? { totalTokens: true } : {}), ...(ownDataOf(f, 'toolUses') === true ? { toolUses: true } : {}) };
|
|
591
|
+
}
|
|
578
592
|
function fleetCarrier(ev) {
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
593
|
+
return { totalTokens: ev.totalTokens, toolUses: ev.toolUses, final: publisherFinality(ownDataOf(ev, 'final')) };
|
|
594
|
+
}
|
|
595
|
+
function tickCycleOf(ev) {
|
|
596
|
+
const c = cycleSeqValue(ownDataOf(ev, 'cycleSeq'));
|
|
597
|
+
return c === undefined ? undefined : { cycleSeq: c };
|
|
582
598
|
}
|
|
583
599
|
function finalityOf(tokens, toolUses) {
|
|
584
600
|
if (tokens === undefined && toolUses === undefined)
|
|
@@ -638,17 +654,20 @@ function announce(d, rid) {
|
|
|
638
654
|
if (row.phase === 'ended')
|
|
639
655
|
mintTerminal(d, key, row.isError === true, row.report, 'end');
|
|
640
656
|
}
|
|
641
|
-
function foldTick(d, rid, ev, cardBound) {
|
|
657
|
+
function foldTick(d, rid, ev, cardBound, final) {
|
|
642
658
|
const r = d.rec(rid);
|
|
643
659
|
if (r === undefined)
|
|
644
660
|
return;
|
|
645
661
|
const row = r.row;
|
|
646
662
|
const gate = cardBound ? { gateBound: true } : {};
|
|
647
663
|
const wireId = ev.wireTaskId ?? ev.taskId;
|
|
648
|
-
const
|
|
664
|
+
const tickCycle = tickCycleOf(ev);
|
|
665
|
+
const attributable = hasCycleSeq(r.cycle)
|
|
666
|
+
? tickCycle !== undefined && cycleOrder(tickCycle, r.cycle) === 'same'
|
|
667
|
+
: r.currentRun === undefined || r.currentRun === wireId;
|
|
649
668
|
if (!attributable)
|
|
650
669
|
d.counts.unattributedTicks++;
|
|
651
|
-
const carrier = attributable ? { totalTokens: ev.totalTokens, toolUses: ev.toolUses } : {};
|
|
670
|
+
const carrier = attributable ? { totalTokens: ev.totalTokens, toolUses: ev.toolUses, final } : {};
|
|
652
671
|
if (row === undefined || !row.announced) {
|
|
653
672
|
const base = row !== undefined
|
|
654
673
|
? { ...row, ...gate, tickSeen: true, fields: { ...row.fields, ...tickFields(ev) } }
|
|
@@ -789,28 +808,37 @@ function foldAbsence(d, rid, a) {
|
|
|
789
808
|
d.deltas.push({ op: 'upsert', canonicalId: keyOf(r), fields: { absence } });
|
|
790
809
|
d.put(rid, { row: { ...row, fields: { ...row.fields, absence } } });
|
|
791
810
|
}
|
|
792
|
-
function
|
|
793
|
-
const
|
|
794
|
-
|
|
795
|
-
|
|
811
|
+
function tickFactBase(ev) {
|
|
812
|
+
const out = {};
|
|
813
|
+
for (const k of Reflect.ownKeys(ev)) {
|
|
814
|
+
if (typeof k !== 'string' || k === 'cardBound' || k === 'final' || k === 'cycleSeq')
|
|
815
|
+
continue;
|
|
816
|
+
if (!Object.prototype.propertyIsEnumerable.call(ev, k))
|
|
817
|
+
continue;
|
|
818
|
+
out[k] = Reflect.get(ev, k);
|
|
819
|
+
}
|
|
820
|
+
return out;
|
|
796
821
|
}
|
|
797
822
|
function emitTick(d, ev) {
|
|
798
823
|
const found = d.find(ev.taskId);
|
|
799
824
|
const fr = found !== undefined ? d.rec(found) : undefined;
|
|
800
825
|
if (fr !== undefined && formerGeneration(fr, ev.taskId))
|
|
801
826
|
return;
|
|
827
|
+
const tickCycle = tickCycleOf(ev);
|
|
828
|
+
if (fr !== undefined && tickCycle !== undefined && cycleOrder(tickCycle, genOf(fr)) === 'before')
|
|
829
|
+
return;
|
|
802
830
|
const rid = found ?? d.create({ id: ev.taskId });
|
|
803
831
|
d.records.touch(rid);
|
|
804
832
|
const r = d.rec(rid);
|
|
805
833
|
if (r === undefined)
|
|
806
834
|
return;
|
|
807
835
|
const key = keyOf(r);
|
|
808
|
-
const plain =
|
|
836
|
+
const plain = { ...tickFactBase(ev), ...(tickCycle !== undefined ? { cycleSeq: tickCycle.cycleSeq } : {}) };
|
|
809
837
|
const fact = key === ev.taskId
|
|
810
838
|
? { ...plain, taskIdOrigin: 'wire' }
|
|
811
839
|
: { ...plain, taskId: key, wireTaskId: ev.taskId, taskIdOrigin: key === r.tail ? 'fleet-row' : 'wire' };
|
|
812
840
|
d.facts.push({ ch: 'event', ev: fact });
|
|
813
|
-
foldTick(d, rid, fact, ev.cardBound === true);
|
|
841
|
+
foldTick(d, rid, fact, ev.cardBound === true, publisherFinality(ownDataOf(ev, 'final')));
|
|
814
842
|
}
|
|
815
843
|
function flushHeld(d, wireTaskId) {
|
|
816
844
|
const held = d.pending.get(wireTaskId);
|
|
@@ -1278,6 +1306,10 @@ export function panelResolveTaskId(state, wireTaskId) {
|
|
|
1278
1306
|
return { taskId: wireTaskId, origin: 'wire' };
|
|
1279
1307
|
return { taskId: r.tail, origin: 'fleet-row', ...cycleOf(bindingOf(r, wireTaskId)?.gen) };
|
|
1280
1308
|
}
|
|
1309
|
+
export function panelSubagentOf(state, id) {
|
|
1310
|
+
const r = recordOfId(state, id);
|
|
1311
|
+
return r === undefined ? undefined : { key: keyOf(r), ids: idsOf(r) };
|
|
1312
|
+
}
|
|
1281
1313
|
export function panelIsResident(state, taskId) {
|
|
1282
1314
|
return recordOfId(state, taskId)?.resident === true;
|
|
1283
1315
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type PanelDelta, type PanelFact, type PanelFrame, type PanelReduceState } from './panelReduce.js';
|
|
2
2
|
export declare function panelStateNow(): PanelReduceState;
|
|
3
|
+
export declare function panelSubagentIdsNow(id: string): readonly string[] | undefined;
|
|
3
4
|
export declare function stepEnginePanel(frame: PanelFrame): void;
|
|
4
5
|
export declare function replaceEnginePanelState(fn: (s: PanelReduceState) => PanelReduceState): void;
|
|
5
6
|
export declare function clearEnginePanelIdentity(): void;
|
package/dist/panelStateHolder.js
CHANGED
|
@@ -1,9 +1,17 @@
|
|
|
1
|
-
import { createPanelReduceState, panelClearAnchors, panelClearIdentity, panelClearRows, panelRowSnapshot, stepPanelFrame, } from './panelReduce.js';
|
|
1
|
+
import { createPanelReduceState, panelClearAnchors, panelClearIdentity, panelClearRows, panelRowSnapshot, panelSubagentOf, stepPanelFrame, } from './panelReduce.js';
|
|
2
|
+
import { bindSubagentIdentityReader } from './subagentContentStore.js';
|
|
2
3
|
let state = createPanelReduceState();
|
|
3
4
|
export function panelStateNow() {
|
|
4
5
|
return state;
|
|
5
6
|
}
|
|
7
|
+
export function panelSubagentIdsNow(id) {
|
|
8
|
+
return panelSubagentOf(state, id)?.ids;
|
|
9
|
+
}
|
|
10
|
+
function bindIdentityReader() {
|
|
11
|
+
bindSubagentIdentityReader(panelSubagentIdsNow);
|
|
12
|
+
}
|
|
6
13
|
export function stepEnginePanel(frame) {
|
|
14
|
+
bindIdentityReader();
|
|
7
15
|
const r = stepPanelFrame(state, frame);
|
|
8
16
|
state = r.state;
|
|
9
17
|
if (rowListener !== null)
|
|
@@ -18,6 +26,7 @@ export function stepEnginePanel(frame) {
|
|
|
18
26
|
}
|
|
19
27
|
}
|
|
20
28
|
export function replaceEnginePanelState(fn) {
|
|
29
|
+
bindIdentityReader();
|
|
21
30
|
state = fn(state);
|
|
22
31
|
}
|
|
23
32
|
export function clearEnginePanelIdentity() {
|
package/dist/peerFrames.d.ts
CHANGED
|
@@ -28,7 +28,7 @@ export type CrossSessionNoticeFrame = {
|
|
|
28
28
|
text: string;
|
|
29
29
|
};
|
|
30
30
|
export type PeerFrameProjection = AgentMessageFrame | CrossSessionMessageFrame | CrossSessionNoticeFrame;
|
|
31
|
-
export declare function classifyPeerNotification(
|
|
31
|
+
export declare function classifyPeerNotification(raw: Record<string, unknown>): PeerFrameProjection | null;
|
|
32
32
|
export declare function renderPeerFrameTranscriptText(p: PeerFrameProjection): string;
|
|
33
33
|
export declare function parsePeerFrameText(text: string): AgentMessageFrame | CrossSessionMessageFrame | null;
|
|
34
34
|
export declare function peerFrameDisplayName(p: AgentMessageFrame | CrossSessionMessageFrame): string;
|
package/dist/peerFrames.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { applyDisplayFace, PEER_NAME_FACE } from './displayUntrusted.js';
|
|
2
|
+
import { ownSnapshotRecord } from './ownKey.js';
|
|
2
3
|
import { CORE_ENGINE_AUTHORITY_ENVELOPE_TAGS, CORE_PERMISSION_MODE_CLASSES } from './generated/engineFactTables.js';
|
|
3
4
|
const WIRE_KEY_FROM = 'from';
|
|
4
5
|
const WIRE_KEY_BODY = 'body';
|
|
@@ -32,7 +33,7 @@ function dataProp(o, key) {
|
|
|
32
33
|
catch {
|
|
33
34
|
return undefined;
|
|
34
35
|
}
|
|
35
|
-
if (d === undefined || !('value'
|
|
36
|
+
if (d === undefined || !Object.hasOwn(d, 'value'))
|
|
36
37
|
return undefined;
|
|
37
38
|
return d.value;
|
|
38
39
|
}
|
|
@@ -59,7 +60,10 @@ function provenanceAgrees(n, lane, carrierFromRaw) {
|
|
|
59
60
|
const seq = finiteNumber(dataProp(n, WIRE_KEY_SEQ));
|
|
60
61
|
return seq !== undefined && finiteNumber(dataProp(prov, WIRE_KEY_SEQ)) === seq;
|
|
61
62
|
}
|
|
62
|
-
export function classifyPeerNotification(
|
|
63
|
+
export function classifyPeerNotification(raw) {
|
|
64
|
+
const n = ownSnapshotRecord(raw);
|
|
65
|
+
if (n === undefined)
|
|
66
|
+
return null;
|
|
63
67
|
const seq = finiteNumber(dataProp(n, WIRE_KEY_SEQ));
|
|
64
68
|
const agentMessage = dataProp(n, WIRE_KEY_AGENT_MESSAGE);
|
|
65
69
|
if (agentMessage !== undefined) {
|
|
@@ -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 projectPeerLaneCapability(caps) {
|
|
@@ -22,7 +22,7 @@ const reader = createEngineCapReader({
|
|
|
22
22
|
name: 'peerLane',
|
|
23
23
|
project: projectPeerLaneCapability,
|
|
24
24
|
});
|
|
25
|
-
export function observedPeerLane(baseUrl =
|
|
25
|
+
export function observedPeerLane(baseUrl = engineWireTargetBaseUrl()) {
|
|
26
26
|
return reader.observed(baseUrl);
|
|
27
27
|
}
|
|
28
28
|
export function peerLaneAvailable(reading) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { engineWireTargetBaseUrl } from './engineWireTarget.js';
|
|
2
2
|
import { createEngineCapReader } from './engineCapReader.js';
|
|
3
|
-
import { ownDataField, readOwnDataValue } from './ownKey.js';
|
|
3
|
+
import { appendOwnElement, ownDataField, readOwnDataValue } from './ownKey.js';
|
|
4
4
|
function readModesStrict(v) {
|
|
5
5
|
try {
|
|
6
6
|
if (!Array.isArray(v))
|
|
@@ -13,7 +13,7 @@ function readModesStrict(v) {
|
|
|
13
13
|
const item = ownDataField(v, String(i));
|
|
14
14
|
if (typeof item !== 'string' || item.length === 0)
|
|
15
15
|
return undefined;
|
|
16
|
-
modes
|
|
16
|
+
appendOwnElement(modes, item);
|
|
17
17
|
}
|
|
18
18
|
return modes;
|
|
19
19
|
}
|
|
@@ -39,7 +39,7 @@ const reader = createEngineCapReader({
|
|
|
39
39
|
name: 'permissionModes',
|
|
40
40
|
project: projectPermissionModesCapability,
|
|
41
41
|
});
|
|
42
|
-
export function observedPermissionModes(baseUrl =
|
|
42
|
+
export function observedPermissionModes(baseUrl = engineWireTargetBaseUrl()) {
|
|
43
43
|
return reader.observed(baseUrl);
|
|
44
44
|
}
|
|
45
45
|
export function permissionModeAdmitted(reading, mode) {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { UiLanguage } from './env/uiLanguage.js';
|
|
1
2
|
export declare const PERMISSION_RULE_ISSUE_CODES: readonly string[];
|
|
2
3
|
export declare const RETIRED_PERMISSION_RULE_ISSUE_CODES: readonly string[];
|
|
3
|
-
export declare function permissionRuleIssueDetail(code: unknown, message: unknown, rule?: string): string;
|
|
4
|
+
export declare function permissionRuleIssueDetail(code: unknown, message: unknown, rule?: string, lang?: UiLanguage): string;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { capForDisplay, escapeDisplayControlChars } from './fleetTaskDesc.js';
|
|
2
|
+
import { msg, renderMessage } from './i18n/translate.js';
|
|
2
3
|
export const PERMISSION_RULE_ISSUE_CODES = Object.freeze([
|
|
3
4
|
'invalid.empty_tool',
|
|
4
5
|
'invalid.paren',
|
|
@@ -13,6 +14,7 @@ export const PERMISSION_RULE_ISSUE_CODES = Object.freeze([
|
|
|
13
14
|
'unsupported.param_unknown',
|
|
14
15
|
'unsupported.param_non_scalar',
|
|
15
16
|
'unsupported.tool_unknown',
|
|
17
|
+
'invalid.name_ambiguous',
|
|
16
18
|
'unsupported.path_base',
|
|
17
19
|
'unsupported.mcp_paren',
|
|
18
20
|
'unsupported.covering_paren',
|
|
@@ -20,25 +22,26 @@ export const PERMISSION_RULE_ISSUE_CODES = Object.freeze([
|
|
|
20
22
|
export const RETIRED_PERMISSION_RULE_ISSUE_CODES = Object.freeze(['unsupported.unknown_param']);
|
|
21
23
|
const ISSUE_MESSAGE_MAX = 200;
|
|
22
24
|
const ISSUE_SENTENCES = Object.freeze({
|
|
23
|
-
'invalid.empty_tool': '
|
|
24
|
-
'invalid.paren': '
|
|
25
|
-
'invalid.tool_name':
|
|
26
|
-
'invalid.param_split': '
|
|
27
|
-
'invalid.primary_field':
|
|
28
|
-
'invalid.cap_exceeded': '
|
|
29
|
-
'invalid.behavior': '
|
|
30
|
-
'invalid.command_rule': '
|
|
31
|
-
'invalid.entry_type': '
|
|
32
|
-
'
|
|
33
|
-
'unsupported.
|
|
34
|
-
'unsupported.
|
|
35
|
-
'unsupported.
|
|
36
|
-
'unsupported.
|
|
37
|
-
'unsupported.
|
|
38
|
-
'unsupported.
|
|
25
|
+
'invalid.empty_tool': 'rules.issue.emptyTool',
|
|
26
|
+
'invalid.paren': 'rules.issue.paren',
|
|
27
|
+
'invalid.tool_name': 'rules.issue.toolName',
|
|
28
|
+
'invalid.param_split': 'rules.issue.paramSplit',
|
|
29
|
+
'invalid.primary_field': 'rules.issue.primaryField',
|
|
30
|
+
'invalid.cap_exceeded': 'rules.issue.capExceeded',
|
|
31
|
+
'invalid.behavior': 'rules.issue.behavior',
|
|
32
|
+
'invalid.command_rule': 'rules.issue.commandRule',
|
|
33
|
+
'invalid.entry_type': 'rules.issue.entryType',
|
|
34
|
+
'invalid.name_ambiguous': 'rules.issue.nameAmbiguous',
|
|
35
|
+
'unsupported.allow': 'rules.issue.allowRule',
|
|
36
|
+
'unsupported.param_unknown': 'rules.issue.paramUnknown',
|
|
37
|
+
'unsupported.param_non_scalar': 'rules.issue.paramNonScalar',
|
|
38
|
+
'unsupported.tool_unknown': 'rules.issue.toolUnknown',
|
|
39
|
+
'unsupported.path_base': 'rules.issue.pathBase',
|
|
40
|
+
'unsupported.mcp_paren': 'rules.issue.mcpParen',
|
|
41
|
+
'unsupported.covering_paren': 'rules.issue.coveringParen',
|
|
39
42
|
});
|
|
40
|
-
const PARAM_SPLIT_WITH_COLON = '
|
|
41
|
-
const PARAM_SPLIT_NO_COLON = '
|
|
43
|
+
const PARAM_SPLIT_WITH_COLON = 'rules.issue.paramSplitWithColon';
|
|
44
|
+
const PARAM_SPLIT_NO_COLON = 'rules.issue.paramSplitNoColon';
|
|
42
45
|
function colonInsideParens(rule) {
|
|
43
46
|
if (typeof rule !== 'string')
|
|
44
47
|
return undefined;
|
|
@@ -53,7 +56,7 @@ function colonInsideParens(rule) {
|
|
|
53
56
|
}
|
|
54
57
|
return undefined;
|
|
55
58
|
}
|
|
56
|
-
export function permissionRuleIssueDetail(code, message, rule) {
|
|
59
|
+
export function permissionRuleIssueDetail(code, message, rule, lang) {
|
|
57
60
|
const colon = code === 'invalid.param_split' ? colonInsideParens(rule) : undefined;
|
|
58
61
|
const known = colon !== undefined
|
|
59
62
|
? colon ? PARAM_SPLIT_WITH_COLON : PARAM_SPLIT_NO_COLON
|
|
@@ -63,7 +66,7 @@ export function permissionRuleIssueDetail(code, message, rule) {
|
|
|
63
66
|
: '';
|
|
64
67
|
const codeWord = typeof code === 'string' && code.length > 0 ? escapeDisplayControlChars(code) : '(no code)';
|
|
65
68
|
const head = known !== undefined
|
|
66
|
-
? known
|
|
67
|
-
:
|
|
69
|
+
? renderMessage(msg(known), lang)
|
|
70
|
+
: renderMessage(msg('rules.issue.newerCode', { code: codeWord }), lang);
|
|
68
71
|
return text.length > 0 ? `${head} — ${text}` : head;
|
|
69
72
|
}
|
|
@@ -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';
|
|
@@ -23,7 +23,7 @@ const reader = createEngineCapReader({
|
|
|
23
23
|
name: 'permissionRulesWrite',
|
|
24
24
|
project: projectPermissionRulesWriteCapability,
|
|
25
25
|
});
|
|
26
|
-
export function observedPermissionRulesWrite(baseUrl =
|
|
26
|
+
export function observedPermissionRulesWrite(baseUrl = engineWireTargetBaseUrl()) {
|
|
27
27
|
return reader.observed(baseUrl);
|
|
28
28
|
}
|
|
29
29
|
export function permissionRulesWriteAvailable(reading) {
|
|
@@ -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
|
import { hasCoreValuePort } from './coreValuePorts.js';
|
|
@@ -36,7 +36,7 @@ const reader = createEngineCapReader({
|
|
|
36
36
|
name: ALLOW_GRANT_CAP_PATH.join('.'),
|
|
37
37
|
project: projectPermissionsAllowGrantCapability,
|
|
38
38
|
});
|
|
39
|
-
export function observedPermissionsAllowGrant(baseUrl =
|
|
39
|
+
export function observedPermissionsAllowGrant(baseUrl = engineWireTargetBaseUrl()) {
|
|
40
40
|
return reader.observed(baseUrl);
|
|
41
41
|
}
|
|
42
42
|
export function permissionsAllowGrantAvailable(reading) {
|