@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
package/dist/notifications.d.ts
CHANGED
|
@@ -32,6 +32,12 @@ export interface TranscriptNotificationSeeds {
|
|
|
32
32
|
seeded: number;
|
|
33
33
|
}
|
|
34
34
|
export declare function parseTranscriptNotificationSeeds(messages: ReadonlyArray<unknown>): TranscriptNotificationSeeds;
|
|
35
|
+
export interface TaskNotificationXmlRead {
|
|
36
|
+
readonly taskId?: string;
|
|
37
|
+
readonly status?: string;
|
|
38
|
+
readonly external: boolean;
|
|
39
|
+
}
|
|
40
|
+
export declare function readTaskNotificationXml(xml: string): TaskNotificationXmlRead | undefined;
|
|
35
41
|
export interface QueuedCommandLike {
|
|
36
42
|
mode?: unknown;
|
|
37
43
|
agentId?: unknown;
|
package/dist/notifications.js
CHANGED
|
@@ -91,12 +91,6 @@ export function taskNotificationDedupKeyFromWire(n) {
|
|
|
91
91
|
});
|
|
92
92
|
}
|
|
93
93
|
export function parseTranscriptNotificationSeeds(messages) {
|
|
94
|
-
const unescape = (s) => s
|
|
95
|
-
.replace(/</g, '<')
|
|
96
|
-
.replace(/>/g, '>')
|
|
97
|
-
.replace(/"/g, '"')
|
|
98
|
-
.replace(/'/g, "'")
|
|
99
|
-
.replace(/&/g, '&');
|
|
100
94
|
const renderedKeys = [];
|
|
101
95
|
const notifiedKeys = [];
|
|
102
96
|
let seeded = 0;
|
|
@@ -116,24 +110,13 @@ export function parseTranscriptNotificationSeeds(messages) {
|
|
|
116
110
|
}
|
|
117
111
|
}
|
|
118
112
|
for (const text of texts) {
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
for (const bm of text.matchAll(blockRe)) {
|
|
123
|
-
const attrs = bm[1] ?? '';
|
|
124
|
-
const body = bm[2] ?? '';
|
|
125
|
-
const idM = body.match(new RegExp(`<${TASK_ID_TAG}>([\\s\\S]*?)</${TASK_ID_TAG}>`));
|
|
126
|
-
const stM = body.match(new RegExp(`<${STATUS_TAG}>([\\s\\S]*?)</${STATUS_TAG}>`));
|
|
127
|
-
if (!idM || !stM)
|
|
128
|
-
continue;
|
|
129
|
-
const taskId = unescape(idM[1] ?? '');
|
|
130
|
-
const status = unescape(stM[1] ?? '');
|
|
131
|
-
if (taskId.length === 0 || status.length === 0)
|
|
113
|
+
for (const block of scanTaskNotificationBlocks(text)) {
|
|
114
|
+
const read = readTaskNotificationBlock(block);
|
|
115
|
+
if (read.taskId === undefined || read.status === undefined)
|
|
132
116
|
continue;
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
notifiedKeys.push(taskId);
|
|
117
|
+
renderedKeys.push(`${read.external ? 'external:' : ''}${read.taskId}:${read.status}`);
|
|
118
|
+
if (!read.external && isCoreTaskNotificationTerminal(read.status)) {
|
|
119
|
+
notifiedKeys.push(read.taskId);
|
|
137
120
|
}
|
|
138
121
|
seeded++;
|
|
139
122
|
}
|
|
@@ -141,6 +124,71 @@ export function parseTranscriptNotificationSeeds(messages) {
|
|
|
141
124
|
}
|
|
142
125
|
return { renderedKeys, notifiedKeys, seeded };
|
|
143
126
|
}
|
|
127
|
+
export function readTaskNotificationXml(xml) {
|
|
128
|
+
if (typeof xml !== 'string')
|
|
129
|
+
return undefined;
|
|
130
|
+
for (const block of scanTaskNotificationBlocks(xml))
|
|
131
|
+
return readTaskNotificationBlock(block);
|
|
132
|
+
return undefined;
|
|
133
|
+
}
|
|
134
|
+
function unescapeNotificationXml(s) {
|
|
135
|
+
return s
|
|
136
|
+
.replace(/</g, '<')
|
|
137
|
+
.replace(/>/g, '>')
|
|
138
|
+
.replace(/"/g, '"')
|
|
139
|
+
.replace(/'/g, "'")
|
|
140
|
+
.replace(/&/g, '&');
|
|
141
|
+
}
|
|
142
|
+
function* scanTaskNotificationBlocks(text) {
|
|
143
|
+
const open = `<${TASK_NOTIFICATION_TAG}`;
|
|
144
|
+
const close = `</${TASK_NOTIFICATION_TAG}>`;
|
|
145
|
+
let from = 0;
|
|
146
|
+
for (;;) {
|
|
147
|
+
const i = text.indexOf(open, from);
|
|
148
|
+
if (i < 0)
|
|
149
|
+
return;
|
|
150
|
+
const after = i + open.length;
|
|
151
|
+
const c = text.charAt(after);
|
|
152
|
+
let gt;
|
|
153
|
+
if (c === '>') {
|
|
154
|
+
gt = after;
|
|
155
|
+
}
|
|
156
|
+
else if (c !== '' && /\s/.test(c)) {
|
|
157
|
+
gt = text.indexOf('>', after + 1);
|
|
158
|
+
if (gt < 0)
|
|
159
|
+
return;
|
|
160
|
+
}
|
|
161
|
+
else {
|
|
162
|
+
from = i + 1;
|
|
163
|
+
continue;
|
|
164
|
+
}
|
|
165
|
+
const end = text.indexOf(close, gt + 1);
|
|
166
|
+
if (end < 0)
|
|
167
|
+
return;
|
|
168
|
+
yield { attrs: c === '>' ? '' : text.slice(after, gt), body: text.slice(gt + 1, end) };
|
|
169
|
+
from = end + close.length;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
function firstTagBodyOf(body, tag) {
|
|
173
|
+
const open = `<${tag}>`;
|
|
174
|
+
const i = body.indexOf(open);
|
|
175
|
+
if (i < 0)
|
|
176
|
+
return undefined;
|
|
177
|
+
const start = i + open.length;
|
|
178
|
+
const end = body.indexOf(`</${tag}>`, start);
|
|
179
|
+
return end < 0 ? undefined : body.slice(start, end);
|
|
180
|
+
}
|
|
181
|
+
function readTaskNotificationBlock(block) {
|
|
182
|
+
const idRaw = firstTagBodyOf(block.body, TASK_ID_TAG);
|
|
183
|
+
const statusRaw = firstTagBodyOf(block.body, STATUS_TAG);
|
|
184
|
+
const taskId = idRaw === undefined ? '' : unescapeNotificationXml(idRaw);
|
|
185
|
+
const status = statusRaw === undefined ? '' : unescapeNotificationXml(statusRaw);
|
|
186
|
+
return {
|
|
187
|
+
...(taskId.length > 0 ? { taskId } : {}),
|
|
188
|
+
...(status.length > 0 ? { status } : {}),
|
|
189
|
+
external: /\btype="external"/.test(block.attrs),
|
|
190
|
+
};
|
|
191
|
+
}
|
|
144
192
|
const TASK_NOTIFICATION_TAG = 'task-notification';
|
|
145
193
|
const TASK_ID_TAG = 'task-id';
|
|
146
194
|
const STATUS_TAG = 'status';
|
|
@@ -9,8 +9,5 @@ export type OutputStyleSeatReading = {
|
|
|
9
9
|
value: true;
|
|
10
10
|
};
|
|
11
11
|
export declare function projectOutputStyleSeatCapability(caps: unknown): OutputStyleSeatReading | undefined;
|
|
12
|
-
export declare function noteEngineCapsForOutputStyleSeat(baseUrl: string, caps: unknown, opts?: {
|
|
13
|
-
generation?: number;
|
|
14
|
-
}): void;
|
|
15
12
|
export declare function observedOutputStyleSeat(baseUrl?: string | undefined): OutputStyleSeatReading;
|
|
16
13
|
export declare function outputStyleSeatAdmitted(reading: OutputStyleSeatReading | undefined): boolean;
|
|
@@ -18,9 +18,6 @@ const reader = createEngineCapReader({
|
|
|
18
18
|
name: 'outputStyleSeat',
|
|
19
19
|
project: projectOutputStyleSeatCapability,
|
|
20
20
|
});
|
|
21
|
-
export function noteEngineCapsForOutputStyleSeat(baseUrl, caps, opts) {
|
|
22
|
-
reader.note(baseUrl, caps, opts);
|
|
23
|
-
}
|
|
24
21
|
export function observedOutputStyleSeat(baseUrl = engineWireTarget()?.baseUrl) {
|
|
25
22
|
return reader.observed(baseUrl);
|
|
26
23
|
}
|
package/dist/ownKey.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ export declare function putOwnKey<T>(table: Record<string, T>, key: string, valu
|
|
|
2
2
|
export declare function readOwnNonEmptyString(v: object | null | undefined, key: string): string | undefined;
|
|
3
3
|
export declare function readAskOrigin(carrier: object | null | undefined): string | undefined;
|
|
4
4
|
export declare function readOwnDataNonEmptyString(v: object | null | undefined, key: string): string | undefined;
|
|
5
|
+
export declare function readOwnDataFiniteNumber(v: object | null | undefined, key: string): number | undefined;
|
|
5
6
|
export declare function readOwnDataValue<T>(v: object | null | undefined, key: string): T | undefined;
|
|
6
7
|
export declare function guardedRead<T>(read: () => T | undefined): T | undefined;
|
|
7
8
|
export declare function ownDataField(v: object, key: string): unknown;
|
|
@@ -9,5 +10,26 @@ export declare function ownSendableField(v: object, key: string): unknown;
|
|
|
9
10
|
export declare function ownDataRefusalKeyOf(e: unknown): string | undefined;
|
|
10
11
|
export declare function readFrameStringKey(frame: unknown, key: string): string | undefined;
|
|
11
12
|
export declare function readFrameTrueMark(frame: object | null | undefined, key: string): boolean;
|
|
13
|
+
export type FrameTrueMarkReading = 'marked' | 'absent' | 'unreadable';
|
|
14
|
+
export declare function readFrameTrueMarkReading(frame: object | null | undefined, key: string): FrameTrueMarkReading;
|
|
15
|
+
export interface ContextUsageSectionRow {
|
|
16
|
+
id: string;
|
|
17
|
+
tokens: number;
|
|
18
|
+
kind?: string;
|
|
19
|
+
}
|
|
20
|
+
export interface ContextUsageReading {
|
|
21
|
+
usedTokens?: number;
|
|
22
|
+
windowTokens?: number;
|
|
23
|
+
compactAtTokens?: number;
|
|
24
|
+
sections?: readonly ContextUsageSectionRow[];
|
|
25
|
+
}
|
|
26
|
+
export declare function contextUsageReadingOf(payload: {} | null | undefined): ContextUsageReading | undefined;
|
|
27
|
+
export interface HumanInputAttachmentView {
|
|
28
|
+
ordinal: number;
|
|
29
|
+
kind?: string;
|
|
30
|
+
outcome: string;
|
|
31
|
+
label?: string;
|
|
32
|
+
}
|
|
33
|
+
export declare function humanInputAttachmentsOf(frame: {} | null | undefined): HumanInputAttachmentView[] | undefined;
|
|
12
34
|
export declare function markMcpSectionDroppedNamedRows(rows: object, dropped: ReadonlyMap<string, number>): void;
|
|
13
35
|
export declare function mcpSectionDroppedNamedRowsOf(rows: object | null | undefined, name: string): number;
|
package/dist/ownKey.js
CHANGED
|
@@ -19,6 +19,15 @@ export function readOwnDataNonEmptyString(v, key) {
|
|
|
19
19
|
const raw = d.value;
|
|
20
20
|
return typeof raw === 'string' && raw !== '' ? raw : undefined;
|
|
21
21
|
}
|
|
22
|
+
export function readOwnDataFiniteNumber(v, key) {
|
|
23
|
+
if (typeof v !== 'object' || v === null)
|
|
24
|
+
return undefined;
|
|
25
|
+
const d = Object.getOwnPropertyDescriptor(v, key);
|
|
26
|
+
if (d === undefined || !Object.hasOwn(d, 'value'))
|
|
27
|
+
return undefined;
|
|
28
|
+
const raw = d.value;
|
|
29
|
+
return typeof raw === 'number' && Number.isFinite(raw) ? raw : undefined;
|
|
30
|
+
}
|
|
22
31
|
export function readOwnDataValue(v, key) {
|
|
23
32
|
if (typeof v !== 'object' || v === null)
|
|
24
33
|
return undefined;
|
|
@@ -65,13 +74,95 @@ export function readFrameStringKey(frame, key) {
|
|
|
65
74
|
}
|
|
66
75
|
}
|
|
67
76
|
export function readFrameTrueMark(frame, key) {
|
|
77
|
+
return readFrameTrueMarkReading(frame, key) === 'marked';
|
|
78
|
+
}
|
|
79
|
+
export function readFrameTrueMarkReading(frame, key) {
|
|
68
80
|
try {
|
|
69
81
|
if (frame === null || frame === undefined || typeof frame !== 'object' || Array.isArray(frame))
|
|
70
|
-
return
|
|
71
|
-
return ownDataField(frame, key) === true;
|
|
82
|
+
return 'absent';
|
|
83
|
+
return ownDataField(frame, key) === true ? 'marked' : 'absent';
|
|
72
84
|
}
|
|
73
85
|
catch {
|
|
74
|
-
return
|
|
86
|
+
return 'unreadable';
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
const CONTEXT_USAGE_SECTION_ROWS_MAX = 1024;
|
|
90
|
+
function contextUsageSectionRowOf(raw, i) {
|
|
91
|
+
const row = readOwnDataValue(raw, String(i));
|
|
92
|
+
if (typeof row !== 'object' || row === null || Array.isArray(row))
|
|
93
|
+
return undefined;
|
|
94
|
+
const id = readOwnDataNonEmptyString(row, 'id');
|
|
95
|
+
const tokens = readOwnDataFiniteNumber(row, 'tokens');
|
|
96
|
+
if (id === undefined || tokens === undefined)
|
|
97
|
+
return undefined;
|
|
98
|
+
const kind = readOwnDataNonEmptyString(row, 'kind');
|
|
99
|
+
return { id, tokens, ...(kind !== undefined ? { kind } : {}) };
|
|
100
|
+
}
|
|
101
|
+
function contextUsageSectionRowsOf(raw) {
|
|
102
|
+
if (!Array.isArray(raw))
|
|
103
|
+
return undefined;
|
|
104
|
+
const n = Math.min(raw.length, CONTEXT_USAGE_SECTION_ROWS_MAX);
|
|
105
|
+
const rows = [];
|
|
106
|
+
for (let i = 0; i < n; i++) {
|
|
107
|
+
const row = guardedRead(() => contextUsageSectionRowOf(raw, i));
|
|
108
|
+
if (row !== undefined)
|
|
109
|
+
rows.push(row);
|
|
110
|
+
}
|
|
111
|
+
return rows.length > 0 ? rows : undefined;
|
|
112
|
+
}
|
|
113
|
+
export function contextUsageReadingOf(payload) {
|
|
114
|
+
try {
|
|
115
|
+
if (typeof payload !== 'object' || payload === null || Array.isArray(payload))
|
|
116
|
+
return undefined;
|
|
117
|
+
const usedTokens = guardedRead(() => readOwnDataFiniteNumber(payload, 'usedTokens'));
|
|
118
|
+
const windowTokens = guardedRead(() => readOwnDataFiniteNumber(payload, 'windowTokens'));
|
|
119
|
+
const compactAtTokens = guardedRead(() => readOwnDataFiniteNumber(payload, 'compactAtTokens'));
|
|
120
|
+
const sections = guardedRead(() => contextUsageSectionRowsOf(readOwnDataValue(payload, 'sections')));
|
|
121
|
+
if (usedTokens === undefined && windowTokens === undefined && compactAtTokens === undefined && sections === undefined)
|
|
122
|
+
return undefined;
|
|
123
|
+
return {
|
|
124
|
+
...(usedTokens !== undefined ? { usedTokens } : {}),
|
|
125
|
+
...(windowTokens !== undefined ? { windowTokens } : {}),
|
|
126
|
+
...(compactAtTokens !== undefined ? { compactAtTokens } : {}),
|
|
127
|
+
...(sections !== undefined ? { sections } : {}),
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
catch {
|
|
131
|
+
return undefined;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
const HUMAN_INPUT_ATTACHMENT_ROWS_MAX = 256;
|
|
135
|
+
export function humanInputAttachmentsOf(frame) {
|
|
136
|
+
try {
|
|
137
|
+
if (typeof frame !== 'object' || frame === null || Array.isArray(frame))
|
|
138
|
+
return undefined;
|
|
139
|
+
const raw = guardedRead(() => readOwnDataValue(frame, 'attachments'));
|
|
140
|
+
if (!Array.isArray(raw))
|
|
141
|
+
return undefined;
|
|
142
|
+
const n = guardedRead(() => readOwnDataFiniteNumber(raw, 'length'));
|
|
143
|
+
if (n === undefined)
|
|
144
|
+
return undefined;
|
|
145
|
+
const rows = [];
|
|
146
|
+
for (let i = 0; i < Math.min(n, HUMAN_INPUT_ATTACHMENT_ROWS_MAX); i++) {
|
|
147
|
+
const row = guardedRead(() => {
|
|
148
|
+
const r = readOwnDataValue(raw, String(i));
|
|
149
|
+
if (typeof r !== 'object' || r === null || Array.isArray(r))
|
|
150
|
+
return undefined;
|
|
151
|
+
const ordinal = readOwnDataValue(r, 'ordinal');
|
|
152
|
+
const outcome = readOwnDataNonEmptyString(r, 'outcome');
|
|
153
|
+
if (typeof ordinal !== 'number' || !Number.isSafeInteger(ordinal) || ordinal < 1 || outcome === undefined)
|
|
154
|
+
return undefined;
|
|
155
|
+
const kind = readOwnDataNonEmptyString(r, 'kind');
|
|
156
|
+
const label = readOwnDataNonEmptyString(r, 'label');
|
|
157
|
+
return { ordinal, ...(kind !== undefined ? { kind } : {}), outcome, ...(label !== undefined ? { label } : {}) };
|
|
158
|
+
});
|
|
159
|
+
if (row !== undefined)
|
|
160
|
+
rows.push(row);
|
|
161
|
+
}
|
|
162
|
+
return rows.length > 0 ? rows : undefined;
|
|
163
|
+
}
|
|
164
|
+
catch {
|
|
165
|
+
return undefined;
|
|
75
166
|
}
|
|
76
167
|
}
|
|
77
168
|
const DROPPED_NAMED_ROWS = Symbol.for('@sema-agent/client-core/mcpSectionDroppedNamedRows');
|
package/dist/panelReduce.d.ts
CHANGED
|
@@ -31,6 +31,11 @@ export type PanelFrame = EngineAgentPanelEvent | {
|
|
|
31
31
|
kind: 'anchor';
|
|
32
32
|
taskId: string;
|
|
33
33
|
transcriptId: string;
|
|
34
|
+
} | {
|
|
35
|
+
kind: 'start';
|
|
36
|
+
taskId: string;
|
|
37
|
+
startedAt?: number;
|
|
38
|
+
workflowRunId?: string;
|
|
34
39
|
};
|
|
35
40
|
export interface PanelRowFields {
|
|
36
41
|
name?: string;
|
|
@@ -64,6 +69,10 @@ export type PanelDelta = {
|
|
|
64
69
|
canonicalId: string;
|
|
65
70
|
totalTokens?: number;
|
|
66
71
|
toolUses?: number;
|
|
72
|
+
final?: {
|
|
73
|
+
readonly totalTokens?: true;
|
|
74
|
+
readonly toolUses?: true;
|
|
75
|
+
};
|
|
67
76
|
} | {
|
|
68
77
|
op: 'terminal';
|
|
69
78
|
canonicalId: string;
|
|
@@ -73,25 +82,27 @@ export type PanelDelta = {
|
|
|
73
82
|
} | {
|
|
74
83
|
op: 'remove';
|
|
75
84
|
canonicalId: string;
|
|
85
|
+
supersededBy?: string;
|
|
76
86
|
};
|
|
77
87
|
export declare const PANEL_DELTA_OPS: readonly ["upsert", "usage_delta", "terminal", "remove"];
|
|
78
88
|
export interface PanelReduceState {
|
|
79
89
|
readonly __panelReduceState: true;
|
|
80
90
|
}
|
|
81
|
-
export declare const PANEL_REDUCE_STATE_KEYS: readonly ["__panelReduceState", "records", "
|
|
91
|
+
export declare const PANEL_REDUCE_STATE_KEYS: readonly ["__panelReduceState", "records", "index", "cards", "pending", "sessions", "overflowed", "counts"];
|
|
82
92
|
export declare function createPanelReduceState(): PanelReduceState;
|
|
93
|
+
export type PanelFact = {
|
|
94
|
+
readonly ch: 'event';
|
|
95
|
+
readonly ev: EngineAgentPanelEvent;
|
|
96
|
+
} | {
|
|
97
|
+
readonly ch: 'absence';
|
|
98
|
+
readonly absence: EngineAgentPanelAbsence;
|
|
99
|
+
};
|
|
83
100
|
export interface PanelStep {
|
|
84
101
|
readonly state: PanelReduceState;
|
|
85
102
|
readonly deltas: PanelDelta[];
|
|
86
|
-
readonly facts:
|
|
87
|
-
readonly ch: 'event';
|
|
88
|
-
readonly ev: EngineAgentPanelEvent;
|
|
89
|
-
} | {
|
|
90
|
-
readonly ch: 'absence';
|
|
91
|
-
readonly absence: EngineAgentPanelAbsence;
|
|
92
|
-
}>;
|
|
103
|
+
readonly facts: PanelFact[];
|
|
93
104
|
}
|
|
94
|
-
export declare function panelEndFact(taskId: string, isError: boolean, extra?: Pick<EndArm, 'report' | 'cycleSeq' | 'startedAt'>): EndArm;
|
|
105
|
+
export declare function panelEndFact(taskId: string, isError: boolean, extra?: Pick<EndArm, 'report' | 'cycleSeq' | 'startedAt' | 'sessionId'>): EndArm;
|
|
95
106
|
export interface EnginePanelTaskIdentity {
|
|
96
107
|
readonly taskId: string;
|
|
97
108
|
readonly origin: 'fleet-row' | 'wire';
|
|
@@ -104,7 +115,7 @@ export declare function reducePanelFrame(state: PanelReduceState, frame: PanelFr
|
|
|
104
115
|
deltas: PanelDelta[];
|
|
105
116
|
};
|
|
106
117
|
export declare function panelRowSnapshot(state: PanelReduceState): PanelDelta[];
|
|
107
|
-
export declare function panelResolveTaskId(state: PanelReduceState, wireTaskId: string
|
|
118
|
+
export declare function panelResolveTaskId(state: PanelReduceState, wireTaskId: string): EnginePanelTaskIdentity;
|
|
108
119
|
export declare function panelIsResident(state: PanelReduceState, taskId: string): boolean;
|
|
109
120
|
export declare function panelAnchorOf(state: PanelReduceState, taskId: string): string | undefined;
|
|
110
121
|
export declare function panelPresenceSize(state: PanelReduceState, sessionKey: string): number;
|