@sema-agent/client-core 0.94.0 → 0.96.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 +521 -0
- package/README.md +104 -57
- package/dist/adapt/arms.js +12 -7
- package/dist/adapt/panelTasks.js +4 -10
- package/dist/adapt/toolCards.d.ts +1 -0
- package/dist/adapt/toolCards.js +18 -5
- package/dist/adapt/wireShapes.js +5 -24
- package/dist/adapter/activeRunSelfHeal.d.ts +12 -3
- package/dist/adapter/activeRunSelfHeal.js +50 -16
- package/dist/adapter/downstream/eventToSdkMessage.js +33 -18
- package/dist/adapter/downstream/terminalToSdkResult.js +19 -12
- package/dist/adapter/runStream.js +30 -46
- package/dist/adapter/types.d.ts +7 -0
- package/dist/adapter/types.js +15 -0
- package/dist/agentSession/backgroundView.js +5 -1
- package/dist/agentSession/engineAgentRegistryRead.js +7 -5
- package/dist/agentSession/engineSessionBackgroundStop.js +25 -17
- package/dist/agentsWireCaps.d.ts +2 -0
- package/dist/agentsWireCaps.js +13 -2
- package/dist/approvalDecidedByCapability.d.ts +0 -1
- package/dist/approvalDecidedByCapability.js +2 -7
- package/dist/approvalsStreamLiveCapability.d.ts +0 -1
- package/dist/approvalsStreamLiveCapability.js +2 -6
- package/dist/atMostOnce.d.ts +8 -0
- package/dist/atMostOnce.js +36 -0
- package/dist/attachmentSeatCapability.d.ts +0 -1
- package/dist/attachmentSeatCapability.js +0 -3
- package/dist/attachmentsWireCaps.js +11 -6
- package/dist/bashExitReading.d.ts +10 -0
- package/dist/bashExitReading.js +12 -0
- package/dist/callerCwdCapability.d.ts +0 -5
- package/dist/callerCwdCapability.js +2 -13
- package/dist/centerWiringCapability.d.ts +1 -7
- package/dist/centerWiringCapability.js +18 -27
- package/dist/classifierStatus.js +4 -4
- package/dist/classifierVerdictWire.js +4 -16
- package/dist/clientSlice.js +1 -1
- package/dist/cloudConfigWireCaps.d.ts +3 -3
- package/dist/cloudConfigWireCaps.js +85 -43
- package/dist/compensations.js +1 -1
- package/dist/coreValuePorts.d.ts +11 -7
- package/dist/coreValuePorts.js +5 -8
- package/dist/credentialProvenance.d.ts +28 -0
- package/dist/credentialProvenance.js +76 -0
- package/dist/cycleOrder.d.ts +15 -0
- package/dist/cycleOrder.js +45 -0
- package/dist/decideFailureNote.js +7 -2
- package/dist/decideReceipt.d.ts +2 -1
- package/dist/decideReceipt.js +39 -14
- package/dist/declared/supportFloorDeclared.d.ts +1 -0
- package/dist/declared/supportFloorDeclared.js +5 -0
- package/dist/deviceExecutorManagementCapability.d.ts +0 -1
- package/dist/deviceExecutorManagementCapability.js +7 -16
- package/dist/deviceRebind.d.ts +88 -0
- package/dist/deviceRebind.js +242 -0
- package/dist/displayUntrusted.d.ts +8 -3
- package/dist/displayUntrusted.js +661 -63
- package/dist/engineAgentAbsence.d.ts +2 -2
- package/dist/engineAgentPanelStore.d.ts +8 -18
- package/dist/engineAgentPanelStore.js +19 -537
- package/dist/engineCapReader.d.ts +6 -6
- package/dist/engineCapReader.js +30 -43
- package/dist/engineCapsCache.d.ts +13 -2
- package/dist/engineCapsCache.js +276 -44
- package/dist/engineCredentialRequirement.d.ts +9 -0
- package/dist/engineCredentialRequirement.js +23 -0
- package/dist/engineDirectory.d.ts +79 -0
- package/dist/engineDirectory.js +186 -0
- package/dist/engineEnvSourcing.d.ts +53 -0
- package/dist/engineEnvSourcing.js +81 -0
- package/dist/engineErrorCodes.d.ts +28 -4
- package/dist/engineErrorCodes.js +68 -25
- package/dist/engineIdentity.js +2 -0
- package/dist/engineNoticeCodes.d.ts +17 -0
- package/dist/engineNoticeCodes.js +57 -3
- package/dist/engineWireSdk.js +2 -2
- package/dist/engineWordRenames.d.ts +8 -0
- package/dist/engineWordRenames.js +13 -0
- package/dist/executionLaneCapability.d.ts +2 -3
- package/dist/executionLaneCapability.js +18 -23
- package/dist/fileHistoryCaptureCapability.d.ts +14 -1
- package/dist/fileHistoryCaptureCapability.js +72 -6
- package/dist/fileHistoryLegNotice.d.ts +3 -2
- package/dist/fileHistoryLegNotice.js +51 -2
- package/dist/fleet/bgSubagentRow.d.ts +15 -0
- package/dist/fleet/bgSubagentRow.js +67 -0
- package/dist/fleet/fleetLedger.d.ts +3 -0
- package/dist/fleet/fleetLedger.js +153 -122
- package/dist/fleet/fleetProjection.d.ts +1 -3
- package/dist/fleet/fleetProjection.js +19 -19
- package/dist/fleetAgentPanelProjection.d.ts +4 -17
- package/dist/fleetAgentPanelProjection.js +7 -197
- package/dist/fleetAgentRowLike.d.ts +16 -0
- package/dist/fleetAgentRowLike.js +1 -0
- package/dist/fleetTaskDesc.js +4 -17
- package/dist/gateOutcome.d.ts +12 -1
- package/dist/gateOutcome.js +87 -18
- package/dist/gateVocabulary.d.ts +7 -2
- package/dist/gateVocabulary.js +5 -1
- package/dist/generated/engineAskFaceTables.js +1 -1
- package/dist/generated/engineFactTables.d.ts +5 -3
- package/dist/generated/engineFactTables.js +17 -4
- package/dist/generated/engineNoticeTables.js +12 -3
- package/dist/generated/sdkFactTables.d.ts +2 -0
- package/dist/generated/sdkFactTables.js +17 -0
- package/dist/generated/settingsSchemaFns.d.ts +13 -0
- package/dist/generated/settingsSchemaFns.js +75 -0
- package/dist/generated/toolNameTables.d.ts +1 -0
- package/dist/generated/toolNameTables.js +1 -0
- package/dist/headlessPermissionModeWire.d.ts +1 -1
- package/dist/headlessPermissionModeWire.js +1 -1
- package/dist/headlessReconnectWire.js +49 -20
- package/dist/hitl/allowRuleShadow.d.ts +1 -1
- package/dist/hitl/allowRuleShadow.js +49 -8
- package/dist/hitl/approvalCompleteParked.d.ts +1 -0
- package/dist/hitl/approvalCompleteParked.js +14 -0
- package/dist/hitl/approvalEndingCause.d.ts +7 -0
- package/dist/hitl/approvalEndingCause.js +71 -0
- package/dist/hitl/approvalHolds.d.ts +12 -2
- package/dist/hitl/approvalHolds.js +53 -2
- package/dist/hitl/approvalsFeed.js +23 -11
- package/dist/hitl/askGateWire.d.ts +2 -1
- package/dist/hitl/askGateWire.js +26 -1
- package/dist/hitl/askParkRowRouting.js +1 -1
- package/dist/hitl/automaticAnswerVerdict.d.ts +1 -1
- package/dist/hitl/automaticAnswerVerdict.js +15 -10
- package/dist/hitl/crashConverged.js +2 -0
- package/dist/hitl/decisionConflict.d.ts +3 -0
- package/dist/hitl/decisionConflict.js +41 -0
- package/dist/hitl/decisionRefusal.d.ts +12 -0
- package/dist/hitl/decisionRefusal.js +63 -4
- package/dist/hitl/frameRouter.d.ts +0 -1
- package/dist/hitl/frameRouter.js +32 -57
- package/dist/hitl/gateLedger.d.ts +5 -0
- package/dist/hitl/gateLedger.js +21 -0
- package/dist/hitl/hitlBridge.d.ts +17 -2
- package/dist/hitl/hitlBridge.js +91 -55
- package/dist/hitl/hitlHostSurface.js +3 -11
- package/dist/hitl/livePendingAsk.d.ts +16 -6
- package/dist/hitl/livePendingAsk.js +36 -4
- package/dist/hitl/localAllowRule.d.ts +1 -0
- package/dist/hitl/localAllowRule.js +2 -2
- package/dist/hitl/noAllowCause.d.ts +2 -1
- package/dist/hitl/noAllowCause.js +3 -2
- package/dist/hitl/parkExpiryJudgements.d.ts +19 -0
- package/dist/hitl/parkExpiryJudgements.js +46 -0
- package/dist/hitl/parkResolver.d.ts +4 -7
- package/dist/hitl/parkResolver.js +12 -34
- package/dist/hitl/parkRowBirthWait.d.ts +1 -0
- package/dist/hitl/parkRowBirthWait.js +2 -2
- package/dist/hitl/persistedRulesWire.js +5 -1
- package/dist/hitl/planReviewWire.d.ts +3 -2
- package/dist/hitl/planReviewWire.js +154 -50
- package/dist/hitl/replayedApproval.d.ts +9 -0
- package/dist/hitl/replayedApproval.js +139 -10
- package/dist/hitl/resumeRunningCard.d.ts +2 -0
- package/dist/hitl/resumeRunningCard.js +15 -4
- package/dist/hitl/sessionPolicyDeliverable.js +8 -6
- package/dist/hitl/standingRows.d.ts +18 -0
- package/dist/hitl/standingRows.js +127 -0
- package/dist/hitl/toolApprovalWire.d.ts +39 -7
- package/dist/hitl/toolApprovalWire.js +351 -61
- package/dist/hookMatcherVerdict.d.ts +1 -9
- package/dist/hookMatcherVerdict.js +21 -61
- package/dist/hooksWireCaps.js +40 -8
- package/dist/host.d.ts +5 -0
- package/dist/host.js +3 -1
- package/dist/hostCallbackGuard.d.ts +2 -0
- package/dist/hostCallbackGuard.js +31 -0
- package/dist/index.d.ts +48 -17
- package/dist/index.js +36 -15
- package/dist/interactiveInterrupt.d.ts +8 -0
- package/dist/interactiveInterrupt.js +54 -0
- package/dist/limitsWire.d.ts +5 -0
- package/dist/limitsWire.js +49 -3
- package/dist/liveModelCatalog.d.ts +95 -0
- package/dist/liveModelCatalog.js +297 -32
- package/dist/mcpEngineLeg.d.ts +25 -0
- package/dist/mcpEngineLeg.js +71 -15
- package/dist/mcpPanel.js +2 -1
- package/dist/mcpProbeCapability.d.ts +0 -5
- package/dist/mcpProbeCapability.js +2 -12
- package/dist/mcpReconnect.d.ts +1 -3
- package/dist/mcpReconnect.js +10 -5
- package/dist/memoryComplianceCapability.d.ts +0 -5
- package/dist/memoryComplianceCapability.js +2 -12
- package/dist/memoryOriginCapability.d.ts +0 -5
- package/dist/memoryOriginCapability.js +2 -12
- package/dist/memorySpecWire.js +2 -2
- package/dist/memoryVerbsWire.d.ts +1 -1
- package/dist/memoryVerbsWire.js +4 -0
- package/dist/model/liveCatalogShape.d.ts +14 -0
- package/dist/model/liveCatalogShape.js +71 -0
- package/dist/model/modelSupplyRules.d.ts +1 -0
- package/dist/model/modelSupplyRules.js +30 -9
- package/dist/model/modelsPolicy.d.ts +21 -0
- package/dist/model/modelsPolicy.js +90 -0
- package/dist/modelIdentityResolvability.d.ts +2 -2
- package/dist/modelIdentityResolvability.js +14 -12
- package/dist/modelSwitchFallback.d.ts +69 -0
- package/dist/modelSwitchFallback.js +206 -0
- package/dist/noticePresentation.d.ts +68 -0
- package/dist/noticePresentation.js +247 -0
- package/dist/notifications.js +12 -11
- package/dist/outputStyleSeatCapability.d.ts +0 -2
- package/dist/outputStyleSeatCapability.js +2 -10
- package/dist/ownKey.d.ts +8 -0
- package/dist/ownKey.js +66 -0
- package/dist/panelReduce.d.ts +114 -0
- package/dist/panelReduce.js +1135 -0
- package/dist/panelStateHolder.d.ts +17 -0
- package/dist/panelStateHolder.js +201 -0
- package/dist/peerFrames.js +13 -9
- package/dist/peerLaneCapability.d.ts +0 -1
- package/dist/peerLaneCapability.js +2 -6
- package/dist/permissionModesCapability.d.ts +0 -5
- package/dist/permissionModesCapability.js +5 -16
- package/dist/permissionRuleIssue.js +0 -3
- package/dist/permissionRulesWriteCapability.d.ts +0 -1
- package/dist/permissionRulesWriteCapability.js +2 -6
- package/dist/permissionsAllowGrantCapability.d.ts +0 -1
- package/dist/permissionsAllowGrantCapability.js +3 -9
- package/dist/permissionsDeclaration.d.ts +8 -0
- package/dist/permissionsDeclaration.js +101 -41
- package/dist/printPermissionOutcome.d.ts +12 -0
- package/dist/printPermissionOutcome.js +50 -0
- package/dist/printToolResultFrame.d.ts +1 -0
- package/dist/printToolResultFrame.js +5 -17
- package/dist/promptBlockedCopy.d.ts +5 -0
- package/dist/promptBlockedCopy.js +35 -0
- package/dist/promptDelivery.js +0 -8
- package/dist/protocolSegment.d.ts +9 -6
- package/dist/protocolSegment.js +31 -21
- package/dist/providerRejection.d.ts +4 -0
- package/dist/providerRejection.js +75 -14
- package/dist/replayBody.d.ts +12 -0
- package/dist/replayBody.js +25 -0
- package/dist/resumeRefusalCopy.d.ts +18 -1
- package/dist/resumeRefusalCopy.js +127 -32
- package/dist/retryStatus.d.ts +9 -1
- package/dist/retryStatus.js +9 -2
- package/dist/rewindArchiveCapability.d.ts +5 -14
- package/dist/rewindArchiveCapability.js +18 -61
- package/dist/rewindArchiveReading.d.ts +15 -0
- package/dist/rewindArchiveReading.js +56 -0
- package/dist/rewindEngineAction.d.ts +21 -0
- package/dist/rewindEngineAction.js +36 -0
- package/dist/rewindWireCaps.d.ts +2 -1
- package/dist/rewindWireCaps.js +1 -0
- package/dist/ruleCompileVerdict.d.ts +9 -1
- package/dist/ruleCompileVerdict.js +29 -4
- package/dist/runTerminal.d.ts +15 -12
- package/dist/runTerminal.js +60 -35
- package/dist/sandboxWire.js +13 -0
- package/dist/sdkRegistryTransit.d.ts +2 -1
- package/dist/sdkRegistryTransit.js +1 -0
- package/dist/sealedKeyCapability.d.ts +0 -5
- package/dist/sealedKeyCapability.js +3 -15
- package/dist/seam.js +4 -2
- package/dist/seatContract.d.ts +125 -34
- package/dist/seatContract.js +583 -179
- package/dist/sessionIdSegment.d.ts +1 -0
- package/dist/sessionIdSegment.js +11 -0
- package/dist/sessionMemoryErase.d.ts +1 -1
- package/dist/sessionMemoryErase.js +6 -1
- package/dist/sessionMemoryStatus.js +3 -2
- package/dist/sessionPolicyCapability.d.ts +0 -1
- package/dist/sessionPolicyCapability.js +2 -6
- package/dist/sessionReadRedactionCapability.d.ts +0 -5
- package/dist/sessionReadRedactionCapability.js +2 -13
- package/dist/sessionSyncFileHistory.d.ts +4 -0
- package/dist/sessionSyncFileHistory.js +66 -0
- package/dist/sessionSyncFileHistoryCapability.d.ts +0 -2
- package/dist/sessionSyncFileHistoryCapability.js +2 -9
- package/dist/skillToolListsCapability.d.ts +0 -2
- package/dist/skillToolListsCapability.js +2 -9
- package/dist/skillsWireCaps.d.ts +4 -0
- package/dist/skillsWireCaps.js +66 -1
- package/dist/sqlEngineCapability.d.ts +0 -1
- package/dist/sqlEngineCapability.js +9 -14
- package/dist/steerPriorityCapability.d.ts +0 -2
- package/dist/steerPriorityCapability.js +3 -12
- package/dist/storePostureCapability.d.ts +1 -5
- package/dist/storePostureCapability.js +16 -22
- package/dist/streamDrainingLegs.d.ts +6 -0
- package/dist/streamDrainingLegs.js +23 -0
- package/dist/subagent/engineCompactWire.js +13 -38
- package/dist/subagent/engineDelegatedPrompt.js +10 -6
- package/dist/subagent/engineSubagentOutput.d.ts +0 -1
- package/dist/subagent/engineSubagentOutput.js +5 -20
- package/dist/subagent/engineSubagentSteer.js +7 -5
- package/dist/subagent/engineSubagentTail.d.ts +0 -1
- package/dist/subagent/engineSubagentTail.js +7 -32
- package/dist/subagentContentStore.js +7 -18
- package/dist/supportFloor.d.ts +1 -0
- package/dist/supportFloor.js +15 -14
- package/dist/systemReminderTag.d.ts +1 -0
- package/dist/systemReminderTag.js +8 -0
- package/dist/terminalStatuses.d.ts +30 -0
- package/dist/terminalStatuses.js +67 -0
- package/dist/toolHistoryMismatch.d.ts +0 -3
- package/dist/toolHistoryMismatch.js +3 -7
- package/dist/toolResult.d.ts +6 -1
- package/dist/toolResult.js +90 -37
- package/dist/toolResultContent.d.ts +2 -0
- package/dist/toolResultContent.js +63 -0
- package/dist/types/engineState.d.ts +2 -1
- package/dist/usageAnalytics.d.ts +146 -0
- package/dist/usageAnalytics.js +335 -0
- package/dist/userInvokedSkillsCapability.d.ts +0 -2
- package/dist/userInvokedSkillsCapability.js +2 -9
- package/dist/webSearchBackendCapability.d.ts +0 -1
- package/dist/webSearchBackendCapability.js +3 -7
- package/dist/webSearchWireCaps.js +3 -11
- package/dist/wireErrorTriage.d.ts +2 -0
- package/dist/wireErrorTriage.js +34 -5
- package/dist/wireFailureShape.d.ts +23 -2
- package/dist/wireFailureShape.js +88 -43
- package/dist/wireRefusalCopy.js +2 -18
- package/dist/workflowClient.js +7 -11
- package/dist/workflowsJournalCapability.d.ts +0 -1
- package/dist/workflowsJournalCapability.js +2 -6
- package/dist/writeProtectionCapability.d.ts +0 -1
- package/dist/writeProtectionCapability.js +5 -10
- package/docs/INTEGRATION-CLIENTS.md +2279 -27
- package/package.json +5 -5
- package/dist/engineCapsGenerationGuard.d.ts +0 -4
- package/dist/engineCapsGenerationGuard.js +0 -19
- package/dist/panelRunningHistory.d.ts +0 -22
- package/dist/panelRunningHistory.js +0 -82
- package/dist/registryConflict.d.ts +0 -3
- package/dist/registryConflict.js +0 -44
|
@@ -1,212 +1,22 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { rowIdTail } from './workflow.js';
|
|
4
|
-
import { TERMINAL_FLEET_TASK_STATUSES } from './fleet/fleetProjection.js';
|
|
1
|
+
import { ABSENT_SETTLE_MS, panelPresenceSize } from './panelReduce.js';
|
|
2
|
+
import { panelStateNow, stepEnginePanel } from './panelStateHolder.js';
|
|
5
3
|
import { DEFAULT_SESSION_KEY } from './sessionSlot.js';
|
|
6
|
-
|
|
7
|
-
export const ABSENT_SETTLE_MS = 30_000;
|
|
8
|
-
const SETTLED_RETENTION_MS = ABSENT_SETTLE_MS * 4;
|
|
9
|
-
function currentToolKeyOf(ct) {
|
|
10
|
-
if (!ct || typeof ct.toolName !== 'string' || ct.toolName.length === 0)
|
|
11
|
-
return undefined;
|
|
12
|
-
return `${ct.toolName}\u0000${ct.target ?? ''}`;
|
|
13
|
-
}
|
|
14
|
-
const seen = new Map();
|
|
15
|
-
function seenFor(sessionKey) {
|
|
16
|
-
let m = seen.get(sessionKey);
|
|
17
|
-
if (!m) {
|
|
18
|
-
m = new Map();
|
|
19
|
-
seen.set(sessionKey, m);
|
|
20
|
-
}
|
|
21
|
-
return m;
|
|
22
|
-
}
|
|
4
|
+
export { ABSENT_SETTLE_MS };
|
|
23
5
|
export function resetFleetAgentPanelProjection() {
|
|
24
|
-
|
|
25
|
-
__resetPanelRunningHistoryForTests();
|
|
6
|
+
stepEnginePanel({ kind: 'fleet-rows-reset' });
|
|
26
7
|
}
|
|
27
8
|
export function resetFleetAgentPanelProjectionFor(sessionKey) {
|
|
28
|
-
|
|
9
|
+
stepEnginePanel({ kind: 'fleet-rows-reset', sessionKey });
|
|
29
10
|
}
|
|
30
11
|
export function fleetAgentProjectionSize() {
|
|
31
12
|
return fleetAgentProjectionSizeFor(DEFAULT_SESSION_KEY);
|
|
32
13
|
}
|
|
33
14
|
export function fleetAgentProjectionSizeFor(sessionKey) {
|
|
34
|
-
return
|
|
15
|
+
return panelPresenceSize(panelStateNow(), sessionKey);
|
|
35
16
|
}
|
|
36
17
|
export function projectFleetAgentRows(rows, nowMs = Date.now()) {
|
|
37
18
|
projectFleetAgentRowsFor(DEFAULT_SESSION_KEY, rows, nowMs);
|
|
38
19
|
}
|
|
39
20
|
export function projectFleetAgentRowsFor(sessionKey, rows, nowMs = Date.now()) {
|
|
40
|
-
|
|
41
|
-
const present = new Set();
|
|
42
|
-
for (const row of rows) {
|
|
43
|
-
if (!row?.id)
|
|
44
|
-
continue;
|
|
45
|
-
const taskId = rowIdTail(row.id);
|
|
46
|
-
if (!taskId)
|
|
47
|
-
continue;
|
|
48
|
-
present.add(taskId);
|
|
49
|
-
const status = row.status ?? 'running';
|
|
50
|
-
const wireTokens = typeof row.tokens === 'number' && Number.isInteger(row.tokens) && row.tokens >= 0 ? row.tokens : undefined;
|
|
51
|
-
const tokens = wireTokens;
|
|
52
|
-
const toolUses = typeof row.toolUses === 'number' ? row.toolUses : undefined;
|
|
53
|
-
const transcriptId = row.transcriptId || undefined;
|
|
54
|
-
const parentToolCallId = typeof row.parentToolCallId === 'string' && row.parentToolCallId.length > 0 ? row.parentToolCallId : undefined;
|
|
55
|
-
const startedAt = typeof row.startedAt === 'number' && Number.isFinite(row.startedAt) && row.startedAt > 0 ? row.startedAt : undefined;
|
|
56
|
-
const cycleSeq = typeof row.cycleSeq === 'number' && Number.isInteger(row.cycleSeq) && row.cycleSeq >= 1 ? row.cycleSeq : undefined;
|
|
57
|
-
const currentTool = currentToolKeyOf(row.currentTool) !== undefined ? row.currentTool : undefined;
|
|
58
|
-
const currentToolKey = currentToolKeyOf(row.currentTool);
|
|
59
|
-
const prev = seenMap.get(taskId);
|
|
60
|
-
const rowIdentity = { ...(cycleSeq !== undefined ? { cycleSeq } : {}), ...(startedAt !== undefined ? { startedAt } : {}) };
|
|
61
|
-
const prevIdentity = prev !== undefined
|
|
62
|
-
? { ...(prev.cycleSeq !== undefined ? { cycleSeq: prev.cycleSeq } : {}), ...(prev.startedAt !== undefined ? { startedAt: prev.startedAt } : {}) }
|
|
63
|
-
: undefined;
|
|
64
|
-
if (prev !== undefined && isStaleEngineAgentPanelEnd(rowIdentity, prevIdentity))
|
|
65
|
-
continue;
|
|
66
|
-
const rowNewerCycle = prev !== undefined && isStaleEngineAgentPanelEnd(prevIdentity, rowIdentity);
|
|
67
|
-
const sameCycle = prev !== undefined &&
|
|
68
|
-
!prev.settled &&
|
|
69
|
-
(startedAt === undefined || prev.startedAt === undefined || prev.startedAt === startedAt) &&
|
|
70
|
-
(cycleSeq === undefined || prev.cycleSeq === undefined || prev.cycleSeq === cycleSeq);
|
|
71
|
-
const knownTokens = tokens !== undefined ? tokens : sameCycle ? prev?.tokens : undefined;
|
|
72
|
-
const carryIdentity = prev !== undefined && !rowNewerCycle;
|
|
73
|
-
const knownStartedAt = startedAt !== undefined ? startedAt : carryIdentity ? prev.startedAt : undefined;
|
|
74
|
-
const knownCycleSeq = cycleSeq !== undefined ? cycleSeq : carryIdentity ? prev.cycleSeq : undefined;
|
|
75
|
-
if (TERMINAL_FLEET_TASK_STATUSES.has(status)) {
|
|
76
|
-
const newbornTerminal = prev === undefined && panelRowUnknownToConsumer(taskId);
|
|
77
|
-
const settledThisCycle = prev?.settled === true && !rowNewerCycle;
|
|
78
|
-
const endedRec = prev === undefined ? panelRowEndedIdentity(taskId) : undefined;
|
|
79
|
-
const frameCycle = { ...(cycleSeq !== undefined ? { cycleSeq } : {}), ...(startedAt !== undefined ? { startedAt } : {}) };
|
|
80
|
-
if (endedRec !== undefined && isStaleEngineAgentPanelEnd(frameCycle, endedRec))
|
|
81
|
-
continue;
|
|
82
|
-
const endedSameCycle = endedRec !== undefined && !isStaleEngineAgentPanelEnd(endedRec, frameCycle);
|
|
83
|
-
if (newbornTerminal) {
|
|
84
|
-
holdNewbornTerminalRow(taskId, {
|
|
85
|
-
kind: 'fleet-row',
|
|
86
|
-
taskId,
|
|
87
|
-
...(row.name ? { name: row.name } : {}),
|
|
88
|
-
...(row.description ? { description: row.description } : {}),
|
|
89
|
-
...(knownTokens !== undefined ? { totalTokens: knownTokens } : {}),
|
|
90
|
-
...(toolUses !== undefined ? { toolUses } : {}),
|
|
91
|
-
...(transcriptId !== undefined ? { transcriptId } : {}),
|
|
92
|
-
...(parentToolCallId !== undefined ? { parentToolCallId } : {}),
|
|
93
|
-
...(knownStartedAt !== undefined ? { startedAt: knownStartedAt } : {}),
|
|
94
|
-
...(knownCycleSeq !== undefined ? { cycleSeq: knownCycleSeq } : {}),
|
|
95
|
-
});
|
|
96
|
-
}
|
|
97
|
-
else if (!settledThisCycle) {
|
|
98
|
-
if (rowNewerCycle ||
|
|
99
|
-
(cycleSeq !== undefined && prev?.cycleSeq !== cycleSeq) ||
|
|
100
|
-
(tokens !== undefined && prev?.tokens !== tokens) ||
|
|
101
|
-
(toolUses !== undefined && prev?.toolUses !== toolUses) ||
|
|
102
|
-
(transcriptId !== undefined && prev?.transcriptId !== transcriptId) ||
|
|
103
|
-
(parentToolCallId !== undefined && prev?.parentToolCallId !== parentToolCallId) ||
|
|
104
|
-
(startedAt !== undefined && prev?.startedAt !== startedAt)) {
|
|
105
|
-
publishEngineAgentPanelEvent({
|
|
106
|
-
kind: 'fleet-row',
|
|
107
|
-
taskId,
|
|
108
|
-
...(row.name ? { name: row.name } : {}),
|
|
109
|
-
...(row.description ? { description: row.description } : {}),
|
|
110
|
-
...(knownTokens !== undefined ? { totalTokens: knownTokens } : {}),
|
|
111
|
-
...(toolUses !== undefined ? { toolUses } : {}),
|
|
112
|
-
...(transcriptId !== undefined ? { transcriptId } : {}),
|
|
113
|
-
...(parentToolCallId !== undefined ? { parentToolCallId } : {}),
|
|
114
|
-
...(knownStartedAt !== undefined ? { startedAt: knownStartedAt } : {}),
|
|
115
|
-
...(knownCycleSeq !== undefined ? { cycleSeq: knownCycleSeq } : {}),
|
|
116
|
-
});
|
|
117
|
-
}
|
|
118
|
-
if (!endedSameCycle)
|
|
119
|
-
publishEngineAgentPanelEvent({
|
|
120
|
-
kind: 'end',
|
|
121
|
-
taskId,
|
|
122
|
-
isError: isTerminalNotSuccess(status),
|
|
123
|
-
...(knownCycleSeq !== undefined ? { cycleSeq: knownCycleSeq } : {}),
|
|
124
|
-
...(knownStartedAt !== undefined ? { startedAt: knownStartedAt } : {}),
|
|
125
|
-
});
|
|
126
|
-
}
|
|
127
|
-
seenMap.set(taskId, {
|
|
128
|
-
status,
|
|
129
|
-
tokens: knownTokens,
|
|
130
|
-
toolUses: toolUses !== undefined ? toolUses : prev?.toolUses,
|
|
131
|
-
transcriptId: transcriptId !== undefined ? transcriptId : prev?.transcriptId,
|
|
132
|
-
parentToolCallId: parentToolCallId !== undefined ? parentToolCallId : prev?.parentToolCallId,
|
|
133
|
-
startedAt: knownStartedAt,
|
|
134
|
-
cycleSeq: knownCycleSeq,
|
|
135
|
-
currentToolKey: currentToolKey !== undefined ? currentToolKey : prev?.currentToolKey,
|
|
136
|
-
lastSeenAt: nowMs,
|
|
137
|
-
settled: true,
|
|
138
|
-
settledAtMs: prev?.settled ? prev.settledAtMs : nowMs,
|
|
139
|
-
absentReportedAtMs: undefined,
|
|
140
|
-
});
|
|
141
|
-
continue;
|
|
142
|
-
}
|
|
143
|
-
const cycleComparable = (cycleSeq !== undefined && prev?.cycleSeq !== undefined) || (startedAt !== undefined && prev?.startedAt !== undefined);
|
|
144
|
-
const staleSnapshotOverHeldRow = prev !== undefined && prev.settled === true && cycleComparable && !rowNewerCycle && peekHeldNewbornTerminalRow(taskId) !== undefined;
|
|
145
|
-
if (staleSnapshotOverHeldRow)
|
|
146
|
-
continue;
|
|
147
|
-
if (!prev ||
|
|
148
|
-
prev.settled ||
|
|
149
|
-
prev.absentReportedAtMs !== undefined ||
|
|
150
|
-
prev.status !== status ||
|
|
151
|
-
prev.tokens !== knownTokens ||
|
|
152
|
-
(toolUses !== undefined && prev.toolUses !== toolUses) ||
|
|
153
|
-
(transcriptId !== undefined && prev.transcriptId !== transcriptId) ||
|
|
154
|
-
(parentToolCallId !== undefined && prev.parentToolCallId !== parentToolCallId) ||
|
|
155
|
-
(startedAt !== undefined && prev.startedAt !== startedAt) ||
|
|
156
|
-
(cycleSeq !== undefined && prev.cycleSeq !== cycleSeq) ||
|
|
157
|
-
(currentToolKey !== undefined && prev.currentToolKey !== currentToolKey)) {
|
|
158
|
-
notePanelRowRunning(taskId);
|
|
159
|
-
dropHeldNewbornTerminalRow(taskId);
|
|
160
|
-
publishEngineAgentPanelEvent({
|
|
161
|
-
kind: 'fleet-row',
|
|
162
|
-
taskId,
|
|
163
|
-
...(row.name ? { name: row.name } : {}),
|
|
164
|
-
...(row.description ? { description: row.description } : {}),
|
|
165
|
-
...(knownTokens !== undefined ? { totalTokens: knownTokens } : {}),
|
|
166
|
-
...(toolUses !== undefined ? { toolUses } : {}),
|
|
167
|
-
...(transcriptId !== undefined ? { transcriptId } : {}),
|
|
168
|
-
...(parentToolCallId !== undefined ? { parentToolCallId } : {}),
|
|
169
|
-
...(knownStartedAt !== undefined ? { startedAt: knownStartedAt } : {}),
|
|
170
|
-
...(knownCycleSeq !== undefined ? { cycleSeq: knownCycleSeq } : {}),
|
|
171
|
-
...(currentTool !== undefined ? { currentTool } : {}),
|
|
172
|
-
});
|
|
173
|
-
}
|
|
174
|
-
seenMap.set(taskId, {
|
|
175
|
-
status,
|
|
176
|
-
tokens: knownTokens,
|
|
177
|
-
toolUses: toolUses !== undefined ? toolUses : prev?.toolUses,
|
|
178
|
-
transcriptId: transcriptId !== undefined ? transcriptId : prev?.transcriptId,
|
|
179
|
-
parentToolCallId: parentToolCallId !== undefined ? parentToolCallId : prev?.parentToolCallId,
|
|
180
|
-
startedAt: knownStartedAt,
|
|
181
|
-
cycleSeq: knownCycleSeq,
|
|
182
|
-
currentToolKey: currentToolKey !== undefined ? currentToolKey : prev?.currentToolKey,
|
|
183
|
-
lastSeenAt: nowMs,
|
|
184
|
-
settled: false,
|
|
185
|
-
settledAtMs: undefined,
|
|
186
|
-
absentReportedAtMs: undefined,
|
|
187
|
-
});
|
|
188
|
-
}
|
|
189
|
-
for (const [taskId, s] of seenMap) {
|
|
190
|
-
if (present.has(taskId) || s.settled || s.absentReportedAtMs !== undefined)
|
|
191
|
-
continue;
|
|
192
|
-
const absentForMs = nowMs - s.lastSeenAt;
|
|
193
|
-
if (absentForMs <= ABSENT_SETTLE_MS)
|
|
194
|
-
continue;
|
|
195
|
-
publishEngineAgentPanelAbsence({ taskId, lastSeenAtMs: s.lastSeenAt, absentForMs });
|
|
196
|
-
seenMap.set(taskId, { ...s, absentReportedAtMs: nowMs });
|
|
197
|
-
}
|
|
198
|
-
for (const [taskId, s] of seenMap) {
|
|
199
|
-
if (present.has(taskId))
|
|
200
|
-
continue;
|
|
201
|
-
if (s.settled) {
|
|
202
|
-
const settledAt = s.settledAtMs ?? s.lastSeenAt;
|
|
203
|
-
if (nowMs - settledAt > SETTLED_RETENTION_MS)
|
|
204
|
-
seenMap.delete(taskId);
|
|
205
|
-
}
|
|
206
|
-
else if (s.absentReportedAtMs !== undefined && nowMs - s.absentReportedAtMs > SETTLED_RETENTION_MS) {
|
|
207
|
-
seenMap.delete(taskId);
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
|
-
if (seenMap.size === 0)
|
|
211
|
-
seen.delete(sessionKey);
|
|
21
|
+
stepEnginePanel({ kind: 'fleet-rows', sessionKey, rows, nowMs });
|
|
212
22
|
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export interface FleetAgentRowLike {
|
|
2
|
+
id: string;
|
|
3
|
+
name?: string;
|
|
4
|
+
description?: string;
|
|
5
|
+
status?: string;
|
|
6
|
+
tokens?: number;
|
|
7
|
+
toolUses?: number;
|
|
8
|
+
transcriptId?: string;
|
|
9
|
+
currentTool?: {
|
|
10
|
+
toolName: string;
|
|
11
|
+
target?: string;
|
|
12
|
+
};
|
|
13
|
+
startedAt?: number;
|
|
14
|
+
cycleSeq?: number;
|
|
15
|
+
parentToolCallId?: string;
|
|
16
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/fleetTaskDesc.js
CHANGED
|
@@ -1,25 +1,12 @@
|
|
|
1
|
-
import { applyDisplayFace,
|
|
1
|
+
import { applyDisplayFace, ESCAPE_FACE, LABEL_FACE, paintAndCap } from './displayUntrusted.js';
|
|
2
2
|
export function escapeDisplayControlChars(s) {
|
|
3
|
-
return applyDisplayFace(s,
|
|
3
|
+
return applyDisplayFace(s, ESCAPE_FACE);
|
|
4
4
|
}
|
|
5
5
|
export function capForDisplay(raw, max) {
|
|
6
|
-
|
|
7
|
-
if (escaped.length <= max)
|
|
8
|
-
return escaped;
|
|
9
|
-
let cut = max;
|
|
10
|
-
const tokenStart = escaped.lastIndexOf('\\', cut - 1);
|
|
11
|
-
if (tokenStart >= 0 && tokenStart + 6 > cut && /^\\u[0-9A-F]{4}$/.test(escaped.slice(tokenStart, tokenStart + 6))) {
|
|
12
|
-
cut = tokenStart;
|
|
13
|
-
}
|
|
14
|
-
if (cut > 0) {
|
|
15
|
-
const code = escaped.charCodeAt(cut - 1);
|
|
16
|
-
if (code >= 0xd800 && code <= 0xdbff)
|
|
17
|
-
cut -= 1;
|
|
18
|
-
}
|
|
19
|
-
return cut > 0 ? escaped.slice(0, cut) : '';
|
|
6
|
+
return paintAndCap(raw, ESCAPE_FACE, typeof max === 'number' && max > 0 ? max : 0);
|
|
20
7
|
}
|
|
21
8
|
export function collapseLabel(s) {
|
|
22
|
-
return applyDisplayFace(s,
|
|
9
|
+
return applyDisplayFace(s, LABEL_FACE);
|
|
23
10
|
}
|
|
24
11
|
export function taskDescFromName(name, agentType, agentName) {
|
|
25
12
|
if (!name || !agentType)
|
package/dist/gateOutcome.d.ts
CHANGED
|
@@ -32,9 +32,20 @@ export interface GateModeReleaseView {
|
|
|
32
32
|
mandate?: string;
|
|
33
33
|
reason?: string;
|
|
34
34
|
}
|
|
35
|
-
export declare const GATE_MODE_RELEASE_REASON_WORDS: readonly ["rule_unreadable", "
|
|
35
|
+
export declare const GATE_MODE_RELEASE_REASON_WORDS: readonly ["rule_unreadable", "target_unresolved"];
|
|
36
36
|
export type GateModeReleaseReasonWord = (typeof CORE_MODE_RELEASE_REASONS)[number];
|
|
37
37
|
export declare function isGateModeReleaseReasonWord(v: unknown): v is GateModeReleaseReasonWord;
|
|
38
|
+
export declare function modeReleaseReasonSentence(reason: string | null | undefined): string | undefined;
|
|
39
|
+
export interface ReleaseDisclosureIdentity {
|
|
40
|
+
readonly toolCallId?: string;
|
|
41
|
+
readonly callKey?: string;
|
|
42
|
+
readonly epoch?: string | number;
|
|
43
|
+
}
|
|
44
|
+
export interface ReleaseDisclosureLedger {
|
|
45
|
+
readonly has: (identity: ReleaseDisclosureIdentity | null | undefined) => boolean;
|
|
46
|
+
readonly mark: (identity: ReleaseDisclosureIdentity | null | undefined) => void;
|
|
47
|
+
}
|
|
48
|
+
export declare function createReleaseDisclosureLedger(): ReleaseDisclosureLedger;
|
|
38
49
|
export interface SettlementWhoView {
|
|
39
50
|
party: string;
|
|
40
51
|
approver?: string;
|
package/dist/gateOutcome.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { ccToolDenialKindForSettledBy, isCcToolDenialKind, isGateDeniedByWord } from './gateVocabulary.js';
|
|
2
2
|
import { GATE_PARKED_ERROR_CODE } from './engineErrorCodes.js';
|
|
3
3
|
import { CORE_MODE_RELEASE_REASONS, CORE_SETTLEMENT_KINDS } from './generated/engineFactTables.js';
|
|
4
|
+
import { currentEngineWord } from './engineWordRenames.js';
|
|
5
|
+
import { readAskOrigin, readOwnDataNonEmptyString, readOwnDataValue } from './ownKey.js';
|
|
4
6
|
function str(v) {
|
|
5
7
|
return typeof v === 'string' && v.length > 0 ? v : undefined;
|
|
6
8
|
}
|
|
@@ -8,6 +10,62 @@ export const GATE_MODE_RELEASE_REASON_WORDS = CORE_MODE_RELEASE_REASONS;
|
|
|
8
10
|
export function isGateModeReleaseReasonWord(v) {
|
|
9
11
|
return typeof v === 'string' && CORE_MODE_RELEASE_REASONS.includes(v);
|
|
10
12
|
}
|
|
13
|
+
const MODE_RELEASE_SENTENCE_BY_REASON = Object.freeze({
|
|
14
|
+
rule_unreadable: 'The permission mode let this call run without asking, even though it could not be checked against your saved permission rules.',
|
|
15
|
+
target_unresolved: 'The permission mode let this call run without asking, even though it could not be determined where its write lands on disk, so whether it lands on a guarded location is unknown.',
|
|
16
|
+
});
|
|
17
|
+
const MODE_RELEASE_UNRECOGNISED_SENTENCE = 'The permission mode let this call run without asking, for a reason this client does not recognise.';
|
|
18
|
+
export function modeReleaseReasonSentence(reason) {
|
|
19
|
+
try {
|
|
20
|
+
if (typeof reason !== 'string' || reason === '')
|
|
21
|
+
return undefined;
|
|
22
|
+
const word = currentEngineWord(reason);
|
|
23
|
+
return Object.hasOwn(MODE_RELEASE_SENTENCE_BY_REASON, word)
|
|
24
|
+
? MODE_RELEASE_SENTENCE_BY_REASON[word]
|
|
25
|
+
: MODE_RELEASE_UNRECOGNISED_SENTENCE;
|
|
26
|
+
}
|
|
27
|
+
catch {
|
|
28
|
+
return undefined;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
const RELEASE_DISCLOSURE_LEDGER_MAX = 256;
|
|
32
|
+
function releaseDisclosureKeyOf(identity) {
|
|
33
|
+
try {
|
|
34
|
+
if (typeof identity !== 'object' || identity === null)
|
|
35
|
+
return undefined;
|
|
36
|
+
const callId = readOwnDataNonEmptyString(identity, 'toolCallId');
|
|
37
|
+
if (callId !== undefined) {
|
|
38
|
+
const epoch = readOwnDataValue(identity, 'epoch');
|
|
39
|
+
const scope = typeof epoch === 'string' ? epoch : typeof epoch === 'number' && Number.isFinite(epoch) ? String(epoch) : '';
|
|
40
|
+
return JSON.stringify(['call', scope, callId]);
|
|
41
|
+
}
|
|
42
|
+
const cardKey = readOwnDataNonEmptyString(identity, 'callKey');
|
|
43
|
+
return cardKey !== undefined ? JSON.stringify(['card', cardKey]) : undefined;
|
|
44
|
+
}
|
|
45
|
+
catch {
|
|
46
|
+
return undefined;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
export function createReleaseDisclosureLedger() {
|
|
50
|
+
const said = new Set();
|
|
51
|
+
return Object.freeze({
|
|
52
|
+
has(identity) {
|
|
53
|
+
const key = releaseDisclosureKeyOf(identity);
|
|
54
|
+
return key !== undefined && said.has(key);
|
|
55
|
+
},
|
|
56
|
+
mark(identity) {
|
|
57
|
+
const key = releaseDisclosureKeyOf(identity);
|
|
58
|
+
if (key === undefined || said.has(key))
|
|
59
|
+
return;
|
|
60
|
+
said.add(key);
|
|
61
|
+
if (said.size > RELEASE_DISCLOSURE_LEDGER_MAX) {
|
|
62
|
+
const oldest = said.values().next();
|
|
63
|
+
if (oldest.done !== true)
|
|
64
|
+
said.delete(oldest.value);
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
});
|
|
68
|
+
}
|
|
11
69
|
export const SETTLEMENT_KIND_WORDS = CORE_SETTLEMENT_KINDS;
|
|
12
70
|
function readWho(v) {
|
|
13
71
|
if (typeof v !== 'object' || v === null || Array.isArray(v))
|
|
@@ -32,7 +90,8 @@ function readSettlement(v) {
|
|
|
32
90
|
const who = readWho(s.who);
|
|
33
91
|
if (kind === undefined || who === undefined)
|
|
34
92
|
return undefined;
|
|
35
|
-
const
|
|
93
|
+
const whenRaw = s.when;
|
|
94
|
+
const when = typeof whenRaw === 'number' && Number.isFinite(whenRaw) ? whenRaw : undefined;
|
|
36
95
|
const note = str(s.note);
|
|
37
96
|
return {
|
|
38
97
|
kind,
|
|
@@ -62,7 +121,7 @@ function readModeRelease(raw) {
|
|
|
62
121
|
const classes = nonEmptyStringList(r.classes);
|
|
63
122
|
if (mode === undefined || askClass === undefined || classes === undefined)
|
|
64
123
|
return undefined;
|
|
65
|
-
const origin =
|
|
124
|
+
const origin = readAskOrigin(r);
|
|
66
125
|
const mandate = str(r.mandate);
|
|
67
126
|
const reason = str(r.reason);
|
|
68
127
|
return {
|
|
@@ -94,7 +153,7 @@ function readClassifierRound(raw) {
|
|
|
94
153
|
}
|
|
95
154
|
return view;
|
|
96
155
|
}
|
|
97
|
-
|
|
156
|
+
function readGateRecord(frame) {
|
|
98
157
|
if (typeof frame !== 'object' || frame === null || Array.isArray(frame))
|
|
99
158
|
return undefined;
|
|
100
159
|
const g = frame.gate;
|
|
@@ -107,7 +166,9 @@ export function gateOutcomeOf(frame) {
|
|
|
107
166
|
const dr = d;
|
|
108
167
|
const dk = str(dr.kind);
|
|
109
168
|
let disposition;
|
|
110
|
-
|
|
169
|
+
let causePresent = false;
|
|
170
|
+
const classifierRaw = dr.classifier;
|
|
171
|
+
const classifier = readClassifierRound(classifierRaw);
|
|
111
172
|
if (dk === 'allowed') {
|
|
112
173
|
const released = readModeRelease(dr.released);
|
|
113
174
|
disposition = {
|
|
@@ -120,7 +181,9 @@ export function gateOutcomeOf(frame) {
|
|
|
120
181
|
const deniedBy = str(dr.deniedBy);
|
|
121
182
|
if (deniedBy === undefined)
|
|
122
183
|
return undefined;
|
|
123
|
-
const
|
|
184
|
+
const causeRaw = dr.cause;
|
|
185
|
+
causePresent = causeRaw !== undefined;
|
|
186
|
+
const cause = str(causeRaw);
|
|
124
187
|
const mode = str(dr.mode);
|
|
125
188
|
const askClass = str(dr.askClass);
|
|
126
189
|
const classes = nonEmptyStringList(dr.classes);
|
|
@@ -137,14 +200,23 @@ export function gateOutcomeOf(frame) {
|
|
|
137
200
|
else {
|
|
138
201
|
return undefined;
|
|
139
202
|
}
|
|
140
|
-
const
|
|
141
|
-
const
|
|
203
|
+
const settlementRaw = raw.settlement;
|
|
204
|
+
const settlement = readSettlement(settlementRaw);
|
|
205
|
+
const origin = readAskOrigin(raw);
|
|
142
206
|
return {
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
207
|
+
view: {
|
|
208
|
+
disposition,
|
|
209
|
+
...(settlement !== undefined ? { settlement } : {}),
|
|
210
|
+
...(origin !== undefined ? { origin } : {}),
|
|
211
|
+
},
|
|
212
|
+
settlementPresent: settlementRaw !== undefined,
|
|
213
|
+
causePresent,
|
|
214
|
+
classifierPresent: classifierRaw !== undefined,
|
|
146
215
|
};
|
|
147
216
|
}
|
|
217
|
+
export function gateOutcomeOf(frame) {
|
|
218
|
+
return readGateRecord(frame)?.view;
|
|
219
|
+
}
|
|
148
220
|
export function isGateParkedToolEnd(frame) {
|
|
149
221
|
if (typeof frame !== 'object' || frame === null || Array.isArray(frame))
|
|
150
222
|
return false;
|
|
@@ -189,21 +261,19 @@ export function ccToolDenialKindForToolEnd(frame) {
|
|
|
189
261
|
return stamped;
|
|
190
262
|
if (frame._sema_denial_unclassified === true)
|
|
191
263
|
return undefined;
|
|
192
|
-
const
|
|
264
|
+
const record = readGateRecord(frame);
|
|
265
|
+
const outcome = record?.view;
|
|
193
266
|
const kind = outcome?.settlement?.kind;
|
|
194
267
|
if (kind === 'human_refused')
|
|
195
268
|
return ccToolDenialKindForSettledBy('human');
|
|
196
269
|
if (kind === 'policy_refused')
|
|
197
270
|
return ccToolDenialKindForSettledBy('policy');
|
|
198
|
-
|
|
199
|
-
const settlementAbsent = typeof rawGate === 'object' && rawGate !== null && rawGate.settlement === undefined;
|
|
200
|
-
if (outcome !== undefined && settlementAbsent && outcome.disposition.kind === 'denied') {
|
|
271
|
+
if (record !== undefined && outcome !== undefined && !record.settlementPresent && outcome.disposition.kind === 'denied') {
|
|
201
272
|
const by = outcome.disposition.deniedBy;
|
|
202
273
|
if (by === 'ask_resolution' || !isGateDeniedByWord(by))
|
|
203
274
|
return undefined;
|
|
204
275
|
if (DENIED_BY_MAY_CARRY_CAUSE.has(by)) {
|
|
205
|
-
|
|
206
|
-
if (rawKeyOf(rawDisposition, 'cause') !== undefined) {
|
|
276
|
+
if (record.causePresent) {
|
|
207
277
|
const cause = outcome.disposition.cause;
|
|
208
278
|
if (cause === 'unavailable')
|
|
209
279
|
return 'automode-unavailable';
|
|
@@ -213,14 +283,13 @@ export function ccToolDenialKindForToolEnd(frame) {
|
|
|
213
283
|
}
|
|
214
284
|
if (by === 'classifier')
|
|
215
285
|
return 'automode-blocked';
|
|
216
|
-
if (
|
|
286
|
+
if (record.classifierPresent)
|
|
217
287
|
return undefined;
|
|
218
288
|
}
|
|
219
289
|
return ccToolDenialKindForSettledBy('policy');
|
|
220
290
|
}
|
|
221
291
|
return undefined;
|
|
222
292
|
}
|
|
223
|
-
const rawKeyOf = (holder, key) => typeof holder === 'object' && holder !== null ? holder[key] : undefined;
|
|
224
293
|
const DENIED_BY_MAY_CARRY_CAUSE = new Set(['classifier', 'policy']);
|
|
225
294
|
const _gateOutcomeShapePin = (w) => w;
|
|
226
295
|
void _gateOutcomeShapePin;
|
package/dist/gateVocabulary.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { CORE_DENIED_BY_VALUES } from './generated/engineFactTables.js';
|
|
2
|
-
import type
|
|
1
|
+
import { CORE_DENIED_BY_VALUES, CORE_PERSISTED_RULE_MANDATES } from './generated/engineFactTables.js';
|
|
2
|
+
import { PRIOR_ENGINE_WORD_RENAMES, type PriorEngineWord } from './engineWordRenames.js';
|
|
3
3
|
export declare const CC_TOOL_DENIAL_KINDS: readonly ["user-rejected", "permission-rule", "automode-blocked", "automode-unavailable", "automode-parsing-error", "interrupted", "cancelled"];
|
|
4
4
|
export type CcToolDenialKind = (typeof CC_TOOL_DENIAL_KINDS)[number];
|
|
5
5
|
export declare function isCcToolDenialKind(v: unknown): v is CcToolDenialKind;
|
|
@@ -11,6 +11,11 @@ export declare function isGateDeniedByWord(v: unknown): v is GateDeniedByWord;
|
|
|
11
11
|
export declare function gateDeniedByDetail(deniedBy: unknown): string;
|
|
12
12
|
export declare function askOriginDetail(origin: unknown): string;
|
|
13
13
|
export declare function mandatedApprovalDetail(): string;
|
|
14
|
+
type RetiredMandateWord = {
|
|
15
|
+
[K in PriorEngineWord]: (typeof PRIOR_ENGINE_WORD_RENAMES)[K] extends (typeof CORE_PERSISTED_RULE_MANDATES)[number] ? K : never;
|
|
16
|
+
}[PriorEngineWord];
|
|
17
|
+
export declare const APPROVAL_MANDATE_WORDS: readonly ((typeof CORE_PERSISTED_RULE_MANDATES)[number] | RetiredMandateWord)[];
|
|
14
18
|
export type ApprovalMandateWord = (typeof APPROVAL_MANDATE_WORDS)[number];
|
|
15
19
|
export declare function isApprovalMandateWord(v: unknown): v is ApprovalMandateWord;
|
|
16
20
|
export declare function approvalMandateDetail(word: ApprovalMandateWord): string;
|
|
21
|
+
export {};
|
package/dist/gateVocabulary.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { CORE_DENIED_BY_VALUES } from './generated/engineFactTables.js';
|
|
1
|
+
import { CORE_DENIED_BY_VALUES, CORE_PERSISTED_RULE_MANDATES } from './generated/engineFactTables.js';
|
|
2
|
+
import { PRIOR_ENGINE_WORD_RENAMES } from './engineWordRenames.js';
|
|
2
3
|
export const CC_TOOL_DENIAL_KINDS = Object.freeze([
|
|
3
4
|
'user-rejected',
|
|
4
5
|
'permission-rule',
|
|
@@ -71,6 +72,8 @@ export function askOriginDetail(origin) {
|
|
|
71
72
|
export function mandatedApprovalDetail() {
|
|
72
73
|
return 'no saved allow rule and no remembered answer can retire this question; each call is settled on its own — by you here or by an automatic check the deployment runs — and an answer covers only that call';
|
|
73
74
|
}
|
|
75
|
+
const RETIRED_MANDATE_WORDS = Object.freeze(Object.keys(PRIOR_ENGINE_WORD_RENAMES).filter((k) => CORE_PERSISTED_RULE_MANDATES.includes(PRIOR_ENGINE_WORD_RENAMES[k])));
|
|
76
|
+
export const APPROVAL_MANDATE_WORDS = Object.freeze([...CORE_PERSISTED_RULE_MANDATES, ...RETIRED_MANDATE_WORDS]);
|
|
74
77
|
const _mandateWordsPin = true;
|
|
75
78
|
void _mandateWordsPin;
|
|
76
79
|
export function isApprovalMandateWord(v) {
|
|
@@ -82,6 +85,7 @@ const APPROVAL_MANDATE_SENTENCES = Object.freeze({
|
|
|
82
85
|
probe_mandate: 'the check run on this call marked it as needing its own confirmation (the built-in shell check does so for a read outside the directories allowed for this session)',
|
|
83
86
|
probe_unanswered: 'the check run on this call did not answer (it timed out or failed; this client cannot tell which), so whether the call stays inside the directories allowed for this session is unknown',
|
|
84
87
|
write_protection: "this change lands on a protected location (the agent's own configuration), which is confirmed one change at a time",
|
|
88
|
+
target_unresolved: 'where this change lands on disk could not be determined (a link on the way could not be examined, or the target could not be resolved), so whether it lands on a guarded location is unknown',
|
|
85
89
|
write_protection_unresolved: 'the protected-location check could not tell where this change lands, so whether it touches a protected location is unknown',
|
|
86
90
|
});
|
|
87
91
|
const APPROVAL_MANDATE_SET = new Set(Object.keys(APPROVAL_MANDATE_SENTENCES));
|
|
@@ -7,6 +7,6 @@ export const CORE_SHELL_FACE_TOOL_NAMES = Object.freeze([
|
|
|
7
7
|
"Monitor",
|
|
8
8
|
]);
|
|
9
9
|
export const CORE_RELEASABLE_ASK_CLASSES_BY_FACE = Object.freeze({
|
|
10
|
-
"shell": Object.freeze(["transcript_write", "rule_unreadable", "
|
|
10
|
+
"shell": Object.freeze(["transcript_write", "rule_unreadable", "target_unresolved", "probe", "write_protection", "tool_marks_mcp", "tool_marks_a2a", "artifact_shared_read", "mode", "unstated", "ordinary"]),
|
|
11
11
|
"other": Object.freeze(["transcript_write", "rule_unreadable", "probe", "write_protection", "tool_marks_mcp", "tool_marks_a2a", "artifact_shared_read", "mode", "unstated", "ordinary"]),
|
|
12
12
|
});
|
|
@@ -8,7 +8,7 @@ export declare const CORE_DENIED_BY_VALUES: readonly ["policy", "hook", "org", "
|
|
|
8
8
|
export declare const CORE_PERMISSION_MODE_FOLD_REASONS: readonly string[];
|
|
9
9
|
export declare const CORE_ENGINE_CARD_TYPES: readonly string[];
|
|
10
10
|
export declare const CORE_TOOL_DECLARATION_CODES: readonly string[];
|
|
11
|
-
export declare const CORE_MODE_RELEASE_REASONS: readonly ["rule_unreadable", "
|
|
11
|
+
export declare const CORE_MODE_RELEASE_REASONS: readonly ["rule_unreadable", "target_unresolved"];
|
|
12
12
|
export declare const CORE_HOOK_TOOL_ALIASES: Readonly<Record<string, string>>;
|
|
13
13
|
export declare const CORE_ASK_EVIDENCE_ABSENCE_VALUES: readonly ["not_wired", "not_adjudicated", "unavailable", "no_match", "not_reported"];
|
|
14
14
|
export declare const CORE_SYSTEM_INJECTION_PRIORITIES: readonly ["now", "next", "later"];
|
|
@@ -21,9 +21,9 @@ export interface CoreModeArbitrationRow {
|
|
|
21
21
|
readonly ruleMayClear: boolean;
|
|
22
22
|
readonly hookAskFloor: boolean;
|
|
23
23
|
}
|
|
24
|
-
export declare const CORE_MODE_ARBITRATION: Readonly<Record<"content_question" | "hook" | "ancestor" | "dangerous_delete" | "unverifiable_delete" | "transcript_write" | "org_rule" | "governance_unavailable" | "rule_unreadable" | "ask_rule" | "denial_limit_fallback" | "classifier_no_ruling" | "requires_user_interaction" | "operator_forced" | "shell_floor" | "
|
|
24
|
+
export declare const CORE_MODE_ARBITRATION: Readonly<Record<"content_question" | "hook" | "ancestor" | "dangerous_delete" | "unverifiable_delete" | "unverifiable_shell_text" | "transcript_write" | "org_rule" | "governance_unavailable" | "rule_unreadable" | "ask_rule" | "denial_limit_fallback" | "classifier_no_ruling" | "requires_user_interaction" | "operator_forced" | "shell_floor" | "target_unresolved" | "probe" | "write_protection" | "tool_marks_mcp" | "tool_marks_a2a" | "policy_rra" | "artifact_shared_read" | "mode" | "unstated" | "ordinary", CoreModeArbitrationRow>>;
|
|
25
25
|
export declare const CORE_SKILL_GRANT_ORIGINS: readonly ["model", "user", "inherited"];
|
|
26
|
-
export declare const CORE_ALLOW_ENTRY_INERT_REASONS: readonly ["wildcard_all", "namespace_wildcard", "
|
|
26
|
+
export declare const CORE_ALLOW_ENTRY_INERT_REASONS: readonly ["wildcard_all", "namespace_wildcard", "content_unsupported", "grammar", "tool_name", "near_miss"];
|
|
27
27
|
export declare const CORE_ALLOW_RULE_MEMBERS: readonly ["hook", "deployment", "persisted", "skill", "request"];
|
|
28
28
|
export declare const CORE_RULE_TOOL_NAME_VERDICTS: readonly ["current", "retired", "unprefixed_namespace", "unmintable_segment"];
|
|
29
29
|
export declare const CORE_SETTLEMENT_KINDS: readonly ["human_allowed", "human_refused", "approval_window_expired", "denial_limit_window_expired", "park_sla_expired", "no_approver", "approver_unavailable", "approver_error", "approver_contract", "presentation_failed", "blanket_allow_refused", "policy_allowed", "policy_refused", "task_aborted"];
|
|
@@ -32,6 +32,7 @@ export declare const CORE_AUTO_MODE_UNAVAILABLE_CAUSES: readonly ["error", "time
|
|
|
32
32
|
export declare const CORE_DEFAULT_TIER_ORDER: readonly ["ultra", "max", "pro", "flash", "lite"];
|
|
33
33
|
export declare const CORE_CC_MODEL_TIER_ALIASES: Readonly<Record<"fable" | "mythos" | "opus" | "sonnet" | "haiku", (typeof CORE_DEFAULT_TIER_ORDER)[number]>>;
|
|
34
34
|
export declare const CORE_DURABLE_AGENT_HANDLE_RE: RegExp;
|
|
35
|
+
export declare const CORE_TASK_HANDLE_PREFIXES: Readonly<Record<"background_bash" | "workflow" | "background_agent" | "monitor", string>>;
|
|
35
36
|
export declare const CORE_PERMISSION_MODE_CLASSES: readonly ["bypass", "prompting"];
|
|
36
37
|
export declare const CORE_MCP_LIVENESS_STATES: readonly ["reachable", "unreachable", "unknown"];
|
|
37
38
|
export declare const CORE_RULE_BEHAVIORS: readonly ["deny", "ask", "allow"];
|
|
@@ -40,3 +41,4 @@ export declare const CORE_MAX_PENDING_STEER_CHARS: number;
|
|
|
40
41
|
export declare const CORE_PROMPT_BLOCK_CAUSES: readonly ["block", "crashed", "timeout", "cancelled"];
|
|
41
42
|
export declare const CORE_PERMISSION_MODES: readonly ["default", "acceptEdits", "plan", "auto", "bypassPermissions", "dontAsk"];
|
|
42
43
|
export declare const CORE_APPROVAL_REACH: readonly ["none"];
|
|
44
|
+
export declare const CORE_PERSISTED_RULE_MANDATES: readonly ["operator_always", "tool_marks", "probe_mandate", "probe_unanswered", "write_protection", "target_unresolved"];
|
|
@@ -113,7 +113,7 @@ export const CORE_TOOL_DECLARATION_CODES = Object.freeze([
|
|
|
113
113
|
]);
|
|
114
114
|
export const CORE_MODE_RELEASE_REASONS = Object.freeze([
|
|
115
115
|
"rule_unreadable",
|
|
116
|
-
"
|
|
116
|
+
"target_unresolved",
|
|
117
117
|
]);
|
|
118
118
|
export const CORE_HOOK_TOOL_ALIASES = Object.freeze(Object.assign(Object.create(null), Object.fromEntries([
|
|
119
119
|
["ListPeers", "ListAgents"],
|
|
@@ -147,6 +147,7 @@ export const CORE_MODE_ARBITRATION = Object.freeze({
|
|
|
147
147
|
"ancestor": Object.freeze({ bypassImmune: true, classifierEligible: false, sandboxAdmission: false, ruleMayClear: false, hookAskFloor: false }),
|
|
148
148
|
"dangerous_delete": Object.freeze({ bypassImmune: true, classifierEligible: false, sandboxAdmission: false, ruleMayClear: false, hookAskFloor: true }),
|
|
149
149
|
"unverifiable_delete": Object.freeze({ bypassImmune: true, classifierEligible: true, sandboxAdmission: false, ruleMayClear: false, hookAskFloor: true }),
|
|
150
|
+
"unverifiable_shell_text": Object.freeze({ bypassImmune: true, classifierEligible: false, sandboxAdmission: false, ruleMayClear: false, hookAskFloor: true }),
|
|
150
151
|
"transcript_write": Object.freeze({ bypassImmune: false, classifierEligible: true, sandboxAdmission: false, ruleMayClear: false, hookAskFloor: true }),
|
|
151
152
|
"org_rule": Object.freeze({ bypassImmune: true, classifierEligible: false, sandboxAdmission: false, ruleMayClear: false, hookAskFloor: false }),
|
|
152
153
|
"governance_unavailable": Object.freeze({ bypassImmune: true, classifierEligible: false, sandboxAdmission: false, ruleMayClear: false, hookAskFloor: false }),
|
|
@@ -157,7 +158,7 @@ export const CORE_MODE_ARBITRATION = Object.freeze({
|
|
|
157
158
|
"requires_user_interaction": Object.freeze({ bypassImmune: true, classifierEligible: false, sandboxAdmission: false, ruleMayClear: false, hookAskFloor: true }),
|
|
158
159
|
"operator_forced": Object.freeze({ bypassImmune: true, classifierEligible: true, sandboxAdmission: true, ruleMayClear: false, hookAskFloor: false }),
|
|
159
160
|
"shell_floor": Object.freeze({ bypassImmune: true, classifierEligible: true, sandboxAdmission: true, ruleMayClear: false, hookAskFloor: false }),
|
|
160
|
-
"
|
|
161
|
+
"target_unresolved": Object.freeze({ bypassImmune: true, classifierEligible: false, sandboxAdmission: true, ruleMayClear: false, hookAskFloor: true }),
|
|
161
162
|
"probe": Object.freeze({ bypassImmune: false, classifierEligible: true, sandboxAdmission: false, ruleMayClear: false, hookAskFloor: false }),
|
|
162
163
|
"write_protection": Object.freeze({ bypassImmune: false, classifierEligible: true, sandboxAdmission: true, ruleMayClear: false, hookAskFloor: true }),
|
|
163
164
|
"tool_marks_mcp": Object.freeze({ bypassImmune: false, classifierEligible: true, sandboxAdmission: true, ruleMayClear: false, hookAskFloor: false }),
|
|
@@ -176,8 +177,6 @@ export const CORE_SKILL_GRANT_ORIGINS = Object.freeze([
|
|
|
176
177
|
export const CORE_ALLOW_ENTRY_INERT_REASONS = Object.freeze([
|
|
177
178
|
"wildcard_all",
|
|
178
179
|
"namespace_wildcard",
|
|
179
|
-
"path_pattern",
|
|
180
|
-
"domain",
|
|
181
180
|
"content_unsupported",
|
|
182
181
|
"grammar",
|
|
183
182
|
"tool_name",
|
|
@@ -235,6 +234,12 @@ export const CORE_CC_MODEL_TIER_ALIASES = Object.freeze({
|
|
|
235
234
|
"haiku": "lite",
|
|
236
235
|
});
|
|
237
236
|
export const CORE_DURABLE_AGENT_HANDLE_RE = Object.freeze(/^a[0-9a-f]{6,32}$/);
|
|
237
|
+
export const CORE_TASK_HANDLE_PREFIXES = Object.freeze({
|
|
238
|
+
"background_bash": "b",
|
|
239
|
+
"workflow": "w",
|
|
240
|
+
"background_agent": "a",
|
|
241
|
+
"monitor": "m",
|
|
242
|
+
});
|
|
238
243
|
export const CORE_PERMISSION_MODE_CLASSES = Object.freeze([
|
|
239
244
|
"bypass",
|
|
240
245
|
"prompting",
|
|
@@ -268,3 +273,11 @@ export const CORE_PERMISSION_MODES = Object.freeze([
|
|
|
268
273
|
export const CORE_APPROVAL_REACH = Object.freeze([
|
|
269
274
|
"none",
|
|
270
275
|
]);
|
|
276
|
+
export const CORE_PERSISTED_RULE_MANDATES = Object.freeze([
|
|
277
|
+
"operator_always",
|
|
278
|
+
"tool_marks",
|
|
279
|
+
"probe_mandate",
|
|
280
|
+
"probe_unanswered",
|
|
281
|
+
"write_protection",
|
|
282
|
+
"target_unresolved",
|
|
283
|
+
]);
|