@sema-agent/client-core 0.94.0 → 0.95.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 +341 -0
- package/README.md +70 -47
- package/dist/adapt/arms.js +5 -6
- package/dist/adapt/panelTasks.js +4 -10
- package/dist/adapt/toolCards.js +2 -2
- package/dist/adapt/wireShapes.js +3 -8
- package/dist/adapter/activeRunSelfHeal.d.ts +8 -3
- package/dist/adapter/activeRunSelfHeal.js +20 -12
- package/dist/adapter/downstream/eventToSdkMessage.js +24 -17
- package/dist/adapter/downstream/terminalToSdkResult.js +11 -3
- package/dist/adapter/runStream.js +2 -1
- 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 +2 -1
- package/dist/agentSession/engineSessionBackgroundStop.js +3 -2
- package/dist/agentsWireCaps.d.ts +2 -0
- 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 -1
- package/dist/callerCwdCapability.js +2 -7
- package/dist/centerWiringCapability.d.ts +1 -3
- package/dist/centerWiringCapability.js +18 -21
- package/dist/classifierStatus.js +4 -4
- package/dist/cloudConfigWireCaps.js +43 -21
- package/dist/compensations.js +1 -1
- package/dist/cycleOrder.d.ts +15 -0
- package/dist/cycleOrder.js +45 -0
- package/dist/decideFailureNote.js +4 -1
- package/dist/decideReceipt.d.ts +2 -1
- package/dist/decideReceipt.js +41 -13
- 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 +1 -0
- package/dist/displayUntrusted.js +313 -11
- 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 +7 -2
- package/dist/engineCapsCache.js +64 -26
- package/dist/engineCredentialRequirement.d.ts +9 -0
- package/dist/engineCredentialRequirement.js +23 -0
- package/dist/engineEnvSourcing.d.ts +53 -0
- package/dist/engineEnvSourcing.js +81 -0
- package/dist/engineErrorCodes.d.ts +14 -3
- package/dist/engineErrorCodes.js +31 -10
- package/dist/engineIdentity.js +2 -0
- package/dist/engineWireSdk.js +2 -2
- package/dist/executionLaneCapability.d.ts +2 -3
- package/dist/executionLaneCapability.js +18 -23
- package/dist/fileHistoryCaptureCapability.d.ts +0 -1
- package/dist/fileHistoryCaptureCapability.js +2 -6
- package/dist/fileHistoryLegNotice.d.ts +3 -2
- package/dist/fileHistoryLegNotice.js +51 -2
- package/dist/fleet/fleetLedger.d.ts +2 -0
- package/dist/fleet/fleetLedger.js +69 -52
- package/dist/fleet/fleetProjection.d.ts +0 -3
- package/dist/fleet/fleetProjection.js +9 -16
- 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/gateOutcome.js +30 -18
- package/dist/generated/sdkFactTables.d.ts +2 -0
- package/dist/generated/sdkFactTables.js +17 -0
- package/dist/generated/settingsSchemaFns.d.ts +10 -0
- package/dist/generated/settingsSchemaFns.js +22 -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 +5 -0
- package/dist/hitl/approvalEndingCause.js +61 -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/automaticAnswerVerdict.js +2 -2
- package/dist/hitl/crashConverged.js +2 -0
- package/dist/hitl/decisionConflict.d.ts +3 -0
- package/dist/hitl/decisionConflict.js +43 -0
- package/dist/hitl/decisionRefusal.d.ts +4 -0
- package/dist/hitl/decisionRefusal.js +26 -1
- package/dist/hitl/frameRouter.js +26 -43
- package/dist/hitl/gateLedger.d.ts +5 -0
- package/dist/hitl/gateLedger.js +21 -0
- package/dist/hitl/hitlBridge.d.ts +12 -1
- package/dist/hitl/hitlBridge.js +68 -53
- 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/parkExpiryJudgements.d.ts +19 -0
- package/dist/hitl/parkExpiryJudgements.js +46 -0
- package/dist/hitl/parkResolver.d.ts +3 -7
- package/dist/hitl/parkResolver.js +50 -26
- package/dist/hitl/persistedRulesWire.js +5 -1
- package/dist/hitl/planReviewWire.d.ts +2 -2
- package/dist/hitl/planReviewWire.js +56 -30
- package/dist/hitl/replayedApproval.d.ts +8 -0
- package/dist/hitl/replayedApproval.js +125 -10
- package/dist/hitl/resumeRunningCard.d.ts +2 -0
- package/dist/hitl/resumeRunningCard.js +15 -4
- package/dist/hitl/toolApprovalWire.d.ts +24 -4
- package/dist/hitl/toolApprovalWire.js +115 -38
- package/dist/hooksWireCaps.js +38 -6
- package/dist/host.d.ts +5 -0
- package/dist/host.js +3 -1
- package/dist/hostCallbackGuard.d.ts +1 -0
- package/dist/hostCallbackGuard.js +25 -0
- package/dist/index.d.ts +30 -11
- package/dist/index.js +20 -8
- 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 -1
- package/dist/mcpProbeCapability.js +2 -6
- package/dist/mcpReconnect.d.ts +1 -3
- package/dist/mcpReconnect.js +10 -5
- package/dist/memoryComplianceCapability.d.ts +0 -1
- package/dist/memoryComplianceCapability.js +2 -6
- package/dist/memoryOriginCapability.d.ts +0 -1
- package/dist/memoryOriginCapability.js +2 -6
- 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 +1 -1
- package/dist/modelIdentityResolvability.js +5 -12
- package/dist/modelSwitchFallback.d.ts +69 -0
- package/dist/modelSwitchFallback.js +206 -0
- package/dist/notifications.js +12 -11
- package/dist/outputStyleSeatCapability.d.ts +0 -1
- package/dist/outputStyleSeatCapability.js +2 -7
- package/dist/ownKey.d.ts +6 -0
- package/dist/ownKey.js +48 -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/peerLaneCapability.d.ts +0 -1
- package/dist/peerLaneCapability.js +2 -6
- package/dist/permissionModesCapability.d.ts +0 -1
- package/dist/permissionModesCapability.js +5 -10
- 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 +6 -0
- package/dist/permissionsDeclaration.js +45 -0
- package/dist/printToolResultFrame.js +2 -10
- package/dist/promptDelivery.js +0 -8
- package/dist/resumeRefusalCopy.d.ts +18 -1
- package/dist/resumeRefusalCopy.js +126 -15
- package/dist/rewindArchiveCapability.d.ts +2 -1
- package/dist/rewindArchiveCapability.js +15 -7
- 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/runTerminal.d.ts +0 -11
- package/dist/runTerminal.js +4 -27
- package/dist/sdkRegistryTransit.d.ts +2 -1
- package/dist/sdkRegistryTransit.js +1 -0
- package/dist/sealedKeyCapability.d.ts +0 -1
- package/dist/sealedKeyCapability.js +3 -9
- package/dist/seatContract.d.ts +54 -25
- package/dist/seatContract.js +394 -171
- 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 -1
- package/dist/sessionReadRedactionCapability.js +2 -7
- package/dist/sessionSyncFileHistoryCapability.d.ts +0 -1
- package/dist/sessionSyncFileHistoryCapability.js +2 -6
- package/dist/skillToolListsCapability.d.ts +0 -1
- package/dist/skillToolListsCapability.js +2 -6
- 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 -1
- package/dist/steerPriorityCapability.js +3 -9
- package/dist/storePostureCapability.d.ts +1 -1
- package/dist/storePostureCapability.js +16 -16
- 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/engineSubagentTail.d.ts +0 -1
- package/dist/subagent/engineSubagentTail.js +7 -32
- package/dist/subagentContentStore.js +3 -3
- package/dist/supportFloor.js +2 -5
- package/dist/terminalStatuses.d.ts +30 -0
- package/dist/terminalStatuses.js +67 -0
- package/dist/toolResult.d.ts +5 -0
- package/dist/toolResult.js +88 -36
- package/dist/types/engineState.d.ts +2 -1
- package/dist/usageAnalytics.d.ts +146 -0
- package/dist/usageAnalytics.js +311 -0
- package/dist/userInvokedSkillsCapability.d.ts +0 -1
- package/dist/userInvokedSkillsCapability.js +2 -6
- package/dist/webSearchBackendCapability.d.ts +0 -1
- package/dist/webSearchBackendCapability.js +3 -7
- package/dist/webSearchWireCaps.js +3 -11
- package/dist/wireFailureShape.d.ts +4 -0
- package/dist/wireFailureShape.js +42 -2
- 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 +1033 -26
- 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
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { EngineAgentPanelAbsence, EngineAgentPanelEvent } from './engineAgentPanelStore.js';
|
|
2
|
+
import { type PanelDelta, type PanelFrame, type PanelReduceState } from './panelReduce.js';
|
|
3
|
+
export declare function panelStateNow(): PanelReduceState;
|
|
4
|
+
export declare function stepEnginePanel(frame: PanelFrame): void;
|
|
5
|
+
export declare function replaceEnginePanelState(fn: (s: PanelReduceState) => PanelReduceState): void;
|
|
6
|
+
export declare function clearEnginePanelIdentity(): void;
|
|
7
|
+
export declare function clearEnginePanelAnchors(): void;
|
|
8
|
+
export declare function resetEnginePanelHolder(): void;
|
|
9
|
+
type Listener = (ev: EngineAgentPanelEvent) => void;
|
|
10
|
+
export declare function subscribeLegacyEvents(fn: Listener): () => void;
|
|
11
|
+
type AbsenceListener = (ev: EngineAgentPanelAbsence) => void;
|
|
12
|
+
export declare function subscribeAbsence(fn: AbsenceListener): () => void;
|
|
13
|
+
export declare function resetAbsenceChannel(): void;
|
|
14
|
+
type RowListener = (d: PanelDelta) => void;
|
|
15
|
+
export declare function subscribeRows(fn: RowListener): () => void;
|
|
16
|
+
export declare function clearEnginePanelRows(): void;
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
import { createPanelReduceState, isNewEngineAgentPanelCycle, panelClearAnchors, panelClearIdentity, panelClearRows, panelRowSnapshot, stepPanelFrame, } from './panelReduce.js';
|
|
2
|
+
let state = createPanelReduceState();
|
|
3
|
+
export function panelStateNow() {
|
|
4
|
+
return state;
|
|
5
|
+
}
|
|
6
|
+
export function stepEnginePanel(frame) {
|
|
7
|
+
const r = stepPanelFrame(state, frame);
|
|
8
|
+
state = r.state;
|
|
9
|
+
if (rowListener !== null)
|
|
10
|
+
rowQueue.push(...r.deltas);
|
|
11
|
+
for (const f of r.facts) {
|
|
12
|
+
if (f.ch === 'event')
|
|
13
|
+
deliverLegacyEvent(f.ev);
|
|
14
|
+
else
|
|
15
|
+
deliverAbsence(f.absence);
|
|
16
|
+
}
|
|
17
|
+
drainRows();
|
|
18
|
+
}
|
|
19
|
+
export function replaceEnginePanelState(fn) {
|
|
20
|
+
state = fn(state);
|
|
21
|
+
}
|
|
22
|
+
export function clearEnginePanelIdentity() {
|
|
23
|
+
state = panelClearIdentity(state);
|
|
24
|
+
}
|
|
25
|
+
export function clearEnginePanelAnchors() {
|
|
26
|
+
state = panelClearAnchors(state);
|
|
27
|
+
}
|
|
28
|
+
export function resetEnginePanelHolder() {
|
|
29
|
+
state = createPanelReduceState();
|
|
30
|
+
listener = null;
|
|
31
|
+
buffer.length = 0;
|
|
32
|
+
absenceListener = null;
|
|
33
|
+
absenceBuffer.clear();
|
|
34
|
+
rowListener = null;
|
|
35
|
+
rowQueue.length = 0;
|
|
36
|
+
}
|
|
37
|
+
const MAX_BUFFER = 200;
|
|
38
|
+
let listener = null;
|
|
39
|
+
const buffer = [];
|
|
40
|
+
function launchAnchorChanged(prev, next) {
|
|
41
|
+
if (prev.kind !== 'fleet-row' || next.kind !== 'fleet-row')
|
|
42
|
+
return false;
|
|
43
|
+
return isNewEngineAgentPanelCycle(prev, next);
|
|
44
|
+
}
|
|
45
|
+
function deliverLegacyEvent(ev) {
|
|
46
|
+
if (ev.kind !== 'sweep')
|
|
47
|
+
absenceBuffer.delete(ev.taskId);
|
|
48
|
+
if (listener) {
|
|
49
|
+
try {
|
|
50
|
+
listener(ev);
|
|
51
|
+
}
|
|
52
|
+
catch {
|
|
53
|
+
}
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
if (ev.kind === 'sweep' && buffer.length > 0 && buffer[buffer.length - 1]?.kind === 'sweep')
|
|
57
|
+
return;
|
|
58
|
+
const progress = ev.kind === 'tick' || ev.kind === 'fleet-row';
|
|
59
|
+
if (progress) {
|
|
60
|
+
const kind = ev.kind;
|
|
61
|
+
const taskId = ev.taskId;
|
|
62
|
+
let i = -1;
|
|
63
|
+
for (let at = buffer.length - 1; at >= 0; at--) {
|
|
64
|
+
const b = buffer[at];
|
|
65
|
+
if (b === undefined)
|
|
66
|
+
continue;
|
|
67
|
+
if (b.kind === 'sweep')
|
|
68
|
+
break;
|
|
69
|
+
if (b.kind === 'end') {
|
|
70
|
+
if (b.taskId === taskId)
|
|
71
|
+
break;
|
|
72
|
+
continue;
|
|
73
|
+
}
|
|
74
|
+
if (b.taskId !== taskId)
|
|
75
|
+
continue;
|
|
76
|
+
if (b.kind === kind && !launchAnchorChanged(b, ev))
|
|
77
|
+
i = at;
|
|
78
|
+
break;
|
|
79
|
+
}
|
|
80
|
+
if (i >= 0) {
|
|
81
|
+
const merged = { ...buffer[i], ...ev };
|
|
82
|
+
buffer.splice(i, 1);
|
|
83
|
+
buffer.push(merged);
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
if (buffer.length < MAX_BUFFER) {
|
|
88
|
+
buffer.push(ev);
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
const evictAt = buffer.findIndex(b => b.kind === 'tick' || b.kind === 'fleet-row');
|
|
92
|
+
if (evictAt >= 0) {
|
|
93
|
+
buffer.splice(evictAt, 1);
|
|
94
|
+
buffer.push(ev);
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
buffer.shift();
|
|
98
|
+
buffer.push(ev);
|
|
99
|
+
}
|
|
100
|
+
export function subscribeLegacyEvents(fn) {
|
|
101
|
+
listener = fn;
|
|
102
|
+
if (buffer.length > 0) {
|
|
103
|
+
const pending = buffer.splice(0, buffer.length);
|
|
104
|
+
for (const ev of pending) {
|
|
105
|
+
try {
|
|
106
|
+
fn(ev);
|
|
107
|
+
}
|
|
108
|
+
catch {
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
return () => {
|
|
113
|
+
if (listener === fn)
|
|
114
|
+
listener = null;
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
const MAX_ABSENCE_BUFFER = 200;
|
|
118
|
+
let absenceListener = null;
|
|
119
|
+
const absenceBuffer = new Map();
|
|
120
|
+
function deliverAbsence(ev) {
|
|
121
|
+
if (absenceListener) {
|
|
122
|
+
try {
|
|
123
|
+
absenceListener(ev);
|
|
124
|
+
}
|
|
125
|
+
catch {
|
|
126
|
+
}
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
129
|
+
absenceBuffer.delete(ev.taskId);
|
|
130
|
+
absenceBuffer.set(ev.taskId, ev);
|
|
131
|
+
if (absenceBuffer.size > MAX_ABSENCE_BUFFER) {
|
|
132
|
+
const oldest = absenceBuffer.keys().next().value;
|
|
133
|
+
if (oldest !== undefined)
|
|
134
|
+
absenceBuffer.delete(oldest);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
export function subscribeAbsence(fn) {
|
|
138
|
+
absenceListener = fn;
|
|
139
|
+
if (absenceBuffer.size > 0) {
|
|
140
|
+
const pending = [...absenceBuffer.values()];
|
|
141
|
+
absenceBuffer.clear();
|
|
142
|
+
for (const ev of pending) {
|
|
143
|
+
try {
|
|
144
|
+
fn(ev);
|
|
145
|
+
}
|
|
146
|
+
catch {
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
return () => {
|
|
151
|
+
if (absenceListener === fn)
|
|
152
|
+
absenceListener = null;
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
export function resetAbsenceChannel() {
|
|
156
|
+
absenceListener = null;
|
|
157
|
+
absenceBuffer.clear();
|
|
158
|
+
}
|
|
159
|
+
let rowListener = null;
|
|
160
|
+
const rowQueue = [];
|
|
161
|
+
let rowDraining = false;
|
|
162
|
+
function drainRows() {
|
|
163
|
+
if (rowListener === null) {
|
|
164
|
+
rowQueue.length = 0;
|
|
165
|
+
return;
|
|
166
|
+
}
|
|
167
|
+
if (rowDraining)
|
|
168
|
+
return;
|
|
169
|
+
rowDraining = true;
|
|
170
|
+
try {
|
|
171
|
+
while (rowQueue.length > 0) {
|
|
172
|
+
const d = rowQueue.shift();
|
|
173
|
+
const fn = rowListener;
|
|
174
|
+
if (fn === null) {
|
|
175
|
+
rowQueue.length = 0;
|
|
176
|
+
break;
|
|
177
|
+
}
|
|
178
|
+
try {
|
|
179
|
+
fn(d);
|
|
180
|
+
}
|
|
181
|
+
catch {
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
finally {
|
|
186
|
+
rowDraining = false;
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
export function subscribeRows(fn) {
|
|
190
|
+
rowListener = fn;
|
|
191
|
+
rowQueue.length = 0;
|
|
192
|
+
rowQueue.push(...panelRowSnapshot(state));
|
|
193
|
+
drainRows();
|
|
194
|
+
return () => {
|
|
195
|
+
if (rowListener === fn)
|
|
196
|
+
rowListener = null;
|
|
197
|
+
};
|
|
198
|
+
}
|
|
199
|
+
export function clearEnginePanelRows() {
|
|
200
|
+
state = panelClearRows(state);
|
|
201
|
+
}
|
|
@@ -14,5 +14,4 @@ export declare function noteEngineCapsForPeerLane(baseUrl: string, caps: unknown
|
|
|
14
14
|
export declare function observedPeerLane(baseUrl?: string | undefined): PeerLaneReading;
|
|
15
15
|
export declare function peerLaneAvailable(reading: PeerLaneReading): 'yes' | 'no' | 'unknown';
|
|
16
16
|
export declare function peerLaneDoctorDetail(reading: PeerLaneReading): string;
|
|
17
|
-
export declare function forgetPeerLaneReading(baseUrl: string | undefined): void;
|
|
18
17
|
export declare function __resetPeerLaneReadingsForTests(): void;
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import { engineWireTarget } from './engineWireTarget.js';
|
|
2
2
|
import { createEngineCapReader } from './engineCapReader.js';
|
|
3
|
+
import { ownDataField } from './ownKey.js';
|
|
3
4
|
export function projectPeerLaneCapability(caps) {
|
|
4
5
|
try {
|
|
5
6
|
if (caps === null || typeof caps !== 'object')
|
|
6
7
|
return undefined;
|
|
7
8
|
if (caps === null || typeof caps !== 'object' || Array.isArray(caps))
|
|
8
9
|
return undefined;
|
|
9
|
-
|
|
10
|
-
return { kind: 'not_reported' };
|
|
11
|
-
const v = caps.peerLane;
|
|
10
|
+
const v = ownDataField(caps, 'peerLane');
|
|
12
11
|
if (v === undefined)
|
|
13
12
|
return { kind: 'not_reported' };
|
|
14
13
|
if (typeof v !== 'boolean')
|
|
@@ -49,9 +48,6 @@ export function peerLaneDoctorDetail(reading) {
|
|
|
49
48
|
return 'cross-session lane on — this engine can discover and deliver across sessions for the same caller';
|
|
50
49
|
}
|
|
51
50
|
}
|
|
52
|
-
export function forgetPeerLaneReading(baseUrl) {
|
|
53
|
-
reader.forget(baseUrl);
|
|
54
|
-
}
|
|
55
51
|
export function __resetPeerLaneReadingsForTests() {
|
|
56
52
|
reader.__resetForTests();
|
|
57
53
|
}
|
|
@@ -12,5 +12,4 @@ export declare function noteEngineCapsForPermissionModes(baseUrl: string, caps:
|
|
|
12
12
|
}): void;
|
|
13
13
|
export declare function observedPermissionModes(baseUrl?: string | undefined): PermissionModesReading;
|
|
14
14
|
export declare function permissionModeAdmitted(reading: PermissionModesReading | undefined, mode: string): boolean;
|
|
15
|
-
export declare function forgetPermissionModesReading(baseUrl: string | undefined): void;
|
|
16
15
|
export declare function __resetPermissionModesReadingsForTests(): void;
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { engineWireTarget } from './engineWireTarget.js';
|
|
2
2
|
import { createEngineCapReader } from './engineCapReader.js';
|
|
3
|
-
import { readOwnDataValue } from './ownKey.js';
|
|
3
|
+
import { ownDataField, readOwnDataValue } from './ownKey.js';
|
|
4
4
|
function readModesStrict(v) {
|
|
5
5
|
try {
|
|
6
6
|
if (!Array.isArray(v))
|
|
7
7
|
return undefined;
|
|
8
|
-
const length = v
|
|
9
|
-
if (length === 0)
|
|
8
|
+
const length = ownDataField(v, 'length');
|
|
9
|
+
if (typeof length !== 'number' || length === 0)
|
|
10
10
|
return undefined;
|
|
11
11
|
const modes = [];
|
|
12
12
|
for (let i = 0; i < length; i++) {
|
|
13
|
-
const item =
|
|
13
|
+
const item = ownDataField(v, String(i));
|
|
14
14
|
if (typeof item !== 'string' || item.length === 0)
|
|
15
15
|
return undefined;
|
|
16
16
|
modes.push(item);
|
|
@@ -25,9 +25,7 @@ export function projectPermissionModesCapability(caps) {
|
|
|
25
25
|
try {
|
|
26
26
|
if (caps === null || typeof caps !== 'object' || Array.isArray(caps))
|
|
27
27
|
return undefined;
|
|
28
|
-
|
|
29
|
-
return { kind: 'not_reported' };
|
|
30
|
-
const v = caps.permissionModes;
|
|
28
|
+
const v = ownDataField(caps, 'permissionModes');
|
|
31
29
|
if (v === undefined)
|
|
32
30
|
return { kind: 'not_reported' };
|
|
33
31
|
const modes = readModesStrict(v);
|
|
@@ -63,9 +61,6 @@ export function permissionModeAdmitted(reading, mode) {
|
|
|
63
61
|
return false;
|
|
64
62
|
}
|
|
65
63
|
}
|
|
66
|
-
export function forgetPermissionModesReading(baseUrl) {
|
|
67
|
-
reader.forget(baseUrl);
|
|
68
|
-
}
|
|
69
64
|
export function __resetPermissionModesReadingsForTests() {
|
|
70
65
|
reader.__resetForTests();
|
|
71
66
|
}
|
|
@@ -14,5 +14,4 @@ export declare function noteEngineCapsForPermissionRulesWrite(baseUrl: string, c
|
|
|
14
14
|
export declare function observedPermissionRulesWrite(baseUrl?: string | undefined): PermissionRulesWriteReading;
|
|
15
15
|
export declare function permissionRulesWriteAvailable(reading: PermissionRulesWriteReading): boolean;
|
|
16
16
|
export declare function permissionRulesWriteDoctorDetail(reading: PermissionRulesWriteReading): string;
|
|
17
|
-
export declare function forgetPermissionRulesWriteReading(baseUrl: string | undefined): void;
|
|
18
17
|
export declare function __resetPermissionRulesWriteReadingsForTests(): void;
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import { engineWireTarget } from './engineWireTarget.js';
|
|
2
2
|
import { createEngineCapReader } from './engineCapReader.js';
|
|
3
|
+
import { ownDataField } from './ownKey.js';
|
|
3
4
|
export function projectPermissionRulesWriteCapability(caps) {
|
|
4
5
|
try {
|
|
5
6
|
if (caps === null || typeof caps !== 'object')
|
|
6
7
|
return undefined;
|
|
7
8
|
if (caps === null || typeof caps !== 'object' || Array.isArray(caps))
|
|
8
9
|
return undefined;
|
|
9
|
-
|
|
10
|
-
return { kind: 'not_reported' };
|
|
11
|
-
const v = caps.permissionRulesWrite;
|
|
10
|
+
const v = ownDataField(caps, 'permissionRulesWrite');
|
|
12
11
|
if (v === undefined)
|
|
13
12
|
return { kind: 'not_reported' };
|
|
14
13
|
if (typeof v !== 'boolean')
|
|
@@ -45,9 +44,6 @@ export function permissionRulesWriteDoctorDetail(reading) {
|
|
|
45
44
|
return 'permission-rule write entry reachable for this call — a per-call attempt still answers for itself whether the direction, text, and scope are accepted';
|
|
46
45
|
}
|
|
47
46
|
}
|
|
48
|
-
export function forgetPermissionRulesWriteReading(baseUrl) {
|
|
49
|
-
reader.forget(baseUrl);
|
|
50
|
-
}
|
|
51
47
|
export function __resetPermissionRulesWriteReadingsForTests() {
|
|
52
48
|
reader.__resetForTests();
|
|
53
49
|
}
|
|
@@ -16,5 +16,4 @@ export declare function permissionsAllowGrantAvailable(reading: PermissionsAllow
|
|
|
16
16
|
export declare function allowWireForm(reading: PermissionsAllowGrantReading): 'layer' | 'grant' | 'off';
|
|
17
17
|
export declare function allowRulesGate(reading: PermissionsAllowGrantReading, settingsRead: 'clean' | 'partial' | 'unreadable' | undefined): 'open' | 'capability_off' | 'settings_read_not_clean';
|
|
18
18
|
export declare function permissionsAllowGrantDoctorDetail(reading: PermissionsAllowGrantReading, settingsRead?: 'clean' | 'partial' | 'unreadable'): string;
|
|
19
|
-
export declare function forgetPermissionsAllowGrantReading(baseUrl: string | undefined): void;
|
|
20
19
|
export declare function __resetPermissionsAllowGrantReadingsForTests(): void;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { engineWireTarget } from './engineWireTarget.js';
|
|
2
2
|
import { createEngineCapReader } from './engineCapReader.js';
|
|
3
|
+
import { ownDataField } from './ownKey.js';
|
|
3
4
|
import { hasCoreValuePort } from './coreValuePorts.js';
|
|
4
5
|
const ALLOW_GRANT_CAP_PATH = ['settings', 'permissions', 'allowGrant'];
|
|
5
6
|
const ALLOW_LAYER_CAP_LEAF = 'allowLayer';
|
|
@@ -10,17 +11,13 @@ export function projectPermissionsAllowGrantCapability(caps) {
|
|
|
10
11
|
let node = caps;
|
|
11
12
|
for (let i = 0; i < ALLOW_GRANT_CAP_PATH.length; i++) {
|
|
12
13
|
const seg = ALLOW_GRANT_CAP_PATH[i];
|
|
13
|
-
|
|
14
|
-
return { kind: 'not_reported' };
|
|
15
|
-
const v = node[seg];
|
|
14
|
+
const v = ownDataField(node, seg);
|
|
16
15
|
if (v === undefined)
|
|
17
16
|
return { kind: 'not_reported' };
|
|
18
17
|
if (i === ALLOW_GRANT_CAP_PATH.length - 1) {
|
|
19
18
|
if (typeof v !== 'boolean')
|
|
20
19
|
return undefined;
|
|
21
|
-
|
|
22
|
-
return { kind: 'present', grants: v };
|
|
23
|
-
const layer = node[ALLOW_LAYER_CAP_LEAF];
|
|
20
|
+
const layer = ownDataField(node, ALLOW_LAYER_CAP_LEAF);
|
|
24
21
|
if (layer === undefined)
|
|
25
22
|
return { kind: 'present', grants: v };
|
|
26
23
|
return typeof layer === 'boolean' ? { kind: 'present', grants: v, layer } : undefined;
|
|
@@ -103,9 +100,6 @@ export function permissionsAllowGrantDoctorDetail(reading, settingsRead) {
|
|
|
103
100
|
}
|
|
104
101
|
return 'allow rules kept on this side — no usable capabilities reading is cached for this engine (none received, the last one was unreadable, or the last one was discarded when the engine connection was reset; this process cannot tell which), so allow rules are not sent and matching approvals are still answered here';
|
|
105
102
|
}
|
|
106
|
-
export function forgetPermissionsAllowGrantReading(baseUrl) {
|
|
107
|
-
reader.forget(baseUrl);
|
|
108
|
-
}
|
|
109
103
|
export function __resetPermissionsAllowGrantReadingsForTests() {
|
|
110
104
|
reader.__resetForTests();
|
|
111
105
|
}
|
|
@@ -60,4 +60,10 @@ export interface PermissionsClientOwnedStatement {
|
|
|
60
60
|
}
|
|
61
61
|
export declare function permissionsDeclaration(input: PermissionsDeclarationInput, caps: PermissionsAllowGrantReading): PermissionsDeclaration;
|
|
62
62
|
export declare function permissionsDeclarationReport(input: PermissionsDeclarationInput, caps: PermissionsAllowGrantReading): PermissionsDeclarationReport;
|
|
63
|
+
export interface PermissionsAllowKeptFacts {
|
|
64
|
+
readonly problemCount?: number;
|
|
65
|
+
readonly managedPolicyPending?: true;
|
|
66
|
+
readonly where?: string;
|
|
67
|
+
}
|
|
68
|
+
export declare function permissionsAllowKeptNotice(report: Pick<PermissionsDeclarationReport, 'kept'>, settingsRead: 'clean' | 'partial' | 'unreadable', facts?: PermissionsAllowKeptFacts): string | undefined;
|
|
63
69
|
export {};
|
|
@@ -2,6 +2,7 @@ import { compileAllowList, hasCoreValuePort, protocolOf, retiredToolNames, ruleT
|
|
|
2
2
|
import { clientOwnedServerPrefix, protocolSegmentOf } from './protocolSegment.js';
|
|
3
3
|
import { ruleCompileVerdict } from './ruleCompileVerdict.js';
|
|
4
4
|
import { allowRulesGate, allowWireForm } from './permissionsAllowGrantCapability.js';
|
|
5
|
+
import { THROWN_SLOT_UNREADABLE, readThrownSlot } from './wireFailureShape.js';
|
|
5
6
|
export const WIRE_RULE_TRUST_ORDER = Object.freeze([
|
|
6
7
|
'policySettings',
|
|
7
8
|
'cliArg',
|
|
@@ -396,3 +397,47 @@ export function permissionsDeclarationReport(input, caps) {
|
|
|
396
397
|
const { buckets, report } = assemble(input, caps);
|
|
397
398
|
return { ...(Object.keys(buckets).length > 0 ? { permissions: buckets } : {}), ...report };
|
|
398
399
|
}
|
|
400
|
+
const ALLOW_KEPT_ROWS_READ_MAX = 4096;
|
|
401
|
+
function allowHeldBySettingsReadCount(report) {
|
|
402
|
+
if (typeof report !== 'object' || report === null)
|
|
403
|
+
return 0;
|
|
404
|
+
const kept = readThrownSlot(report, 'kept');
|
|
405
|
+
if (typeof kept !== 'object' || kept === null)
|
|
406
|
+
return 0;
|
|
407
|
+
const length = readThrownSlot(kept, 'length');
|
|
408
|
+
if (typeof length !== 'number' || !Number.isInteger(length) || length <= 0)
|
|
409
|
+
return 0;
|
|
410
|
+
let n = 0;
|
|
411
|
+
for (let i = 0; i < Math.min(length, ALLOW_KEPT_ROWS_READ_MAX); i++) {
|
|
412
|
+
const row = readThrownSlot(kept, String(i));
|
|
413
|
+
if (typeof row === 'object' && row !== null && readThrownSlot(row, 'reason') === 'settings_read_not_clean')
|
|
414
|
+
n++;
|
|
415
|
+
}
|
|
416
|
+
return n;
|
|
417
|
+
}
|
|
418
|
+
export function permissionsAllowKeptNotice(report, settingsRead, facts) {
|
|
419
|
+
const held = allowHeldBySettingsReadCount(report);
|
|
420
|
+
if (held <= 0)
|
|
421
|
+
return undefined;
|
|
422
|
+
const readFact = (key) => {
|
|
423
|
+
if (typeof facts !== 'object' || facts === null)
|
|
424
|
+
return undefined;
|
|
425
|
+
const v = readThrownSlot(facts, key);
|
|
426
|
+
return v === THROWN_SLOT_UNREADABLE ? undefined : v;
|
|
427
|
+
};
|
|
428
|
+
const rawCount = readFact('problemCount');
|
|
429
|
+
const rawWhere = readFact('where');
|
|
430
|
+
const managedPending = readFact('managedPolicyPending') === true;
|
|
431
|
+
const count = typeof rawCount === 'number' && Number.isInteger(rawCount) && rawCount >= 1 ? rawCount : undefined;
|
|
432
|
+
const where = typeof rawWhere === 'string' && rawWhere.length >= 1 && rawWhere.length <= 200 && !/\p{Cc}/u.test(rawWhere) ? rawWhere : undefined;
|
|
433
|
+
const head = `${String(held)} permissions.allow rule${held === 1 ? ' was' : 's were'} not sent to the engine for this run because `;
|
|
434
|
+
if (settingsRead === 'partial' && managedPending && count === 1) {
|
|
435
|
+
return (`${head}the managed policy for your account has not been received yet (sema keeps fetching it; allow rules apply once it arrives). ` +
|
|
436
|
+
'Run again once it has been received (deny and ask rules, and rules given with --allowedTools, are still sent).');
|
|
437
|
+
}
|
|
438
|
+
const why = settingsRead === 'partial'
|
|
439
|
+
? `the settings read reported ${count === undefined ? 'problems' : `${String(count)} problem${count === 1 ? '' : 's'}`}${where === undefined ? '' : ` (${where})`}`
|
|
440
|
+
: 'the health of this settings read could not be checked';
|
|
441
|
+
return (`${head}${why}; an allow rule from a settings file is only sent from a settings read with no problems. Fix the reported settings, then run again ` +
|
|
442
|
+
'(deny and ask rules from this read, and rules given with --allowedTools, are still sent).');
|
|
443
|
+
}
|
|
@@ -2,20 +2,12 @@ import { isCcToolDenialKind } from './gateVocabulary.js';
|
|
|
2
2
|
export { flattenWireOutput as flattenToolOutput } from './adapt/wireShapes.js';
|
|
3
3
|
import { flattenWireOutput } from './adapt/wireShapes.js';
|
|
4
4
|
import { parseModelFacingBash } from './toolResult.js';
|
|
5
|
+
import { bashExitOf, bashExitReadingFailed } from './bashExitReading.js';
|
|
5
6
|
import { toolResultEnvelopeParts, toolResultOutcomeOf } from './adapt/toolCards.js';
|
|
6
7
|
function bashExitCodeFailed(toolName, text, structured) {
|
|
7
8
|
if (typeof toolName !== 'string' || toolName.toLowerCase() !== 'bash')
|
|
8
9
|
return false;
|
|
9
|
-
|
|
10
|
-
if (typeof st?.returnCodeInterpretation === 'string' && st.returnCodeInterpretation.length > 0)
|
|
11
|
-
return false;
|
|
12
|
-
const ec = st?.exitCode;
|
|
13
|
-
if (typeof ec === 'number')
|
|
14
|
-
return ec !== 0;
|
|
15
|
-
if (parseModelFacingBash(text)?.note !== undefined)
|
|
16
|
-
return false;
|
|
17
|
-
const m = /^exit code: (\d+)\b/.exec(text);
|
|
18
|
-
return m !== null && m[1] !== '0';
|
|
10
|
+
return bashExitReadingFailed(bashExitOf(structured, () => parseModelFacingBash(text)));
|
|
19
11
|
}
|
|
20
12
|
export function toolEndResultToUserFrame(arm) {
|
|
21
13
|
if (typeof arm.toolCallId !== 'string' || arm.toolCallId.length === 0)
|
package/dist/promptDelivery.js
CHANGED
|
@@ -132,14 +132,6 @@ export function frameProvesDelivery(event) {
|
|
|
132
132
|
const type = event.type;
|
|
133
133
|
if (typeof type !== 'string' || type.length === 0 || PRE_RUN_FRAME_TYPES.has(type))
|
|
134
134
|
return false;
|
|
135
|
-
if (type === 'done') {
|
|
136
|
-
const result = event.result;
|
|
137
|
-
if (typeof result === 'object' && result !== null && !Array.isArray(result) && result.status === undefined) {
|
|
138
|
-
const r = result;
|
|
139
|
-
if (activeRunBusySignal({ type: 'failed', errorCode: r.errorCode, activeTaskId: r.activeTaskId }) !== null)
|
|
140
|
-
return false;
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
135
|
return activeRunBusySignal(event) === null;
|
|
144
136
|
}
|
|
145
137
|
catch {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { RESUME_CONTEXT_UNAVAILABLE } from './engineErrorCodes.js';
|
|
1
|
+
import { RESUME_CONTEXT_UNAVAILABLE, CHECKPOINT_UNSUPPORTED_VERSION, CHECKPOINT_WALLTIME_AXIS_RETIRED, CHECKPOINT_CONFIG_REFUSED } from './engineErrorCodes.js';
|
|
2
2
|
export declare const RESUME_REFUSAL_CODES: readonly string[];
|
|
3
3
|
export interface ResumeRefusalDetail {
|
|
4
4
|
code: string;
|
|
@@ -50,6 +50,8 @@ export declare function parkedResumeStartupContent(detail: ParkedResumeStartupDe
|
|
|
50
50
|
export interface CheckpointUnsupportedVersionDetail {
|
|
51
51
|
code: 'checkpoint.unsupported_version';
|
|
52
52
|
retriable: true;
|
|
53
|
+
writerVersion?: string;
|
|
54
|
+
readerVersion?: string;
|
|
53
55
|
}
|
|
54
56
|
export declare function checkpointUnsupportedVersionFromError(err: unknown): CheckpointUnsupportedVersionDetail | null;
|
|
55
57
|
export type CheckpointUnsupportedParkKind = 'tool_approval' | 'plan_review' | 'resource_park' | 'wake' | 'workflow_host';
|
|
@@ -58,3 +60,18 @@ export interface CheckpointUnsupportedVersionContext {
|
|
|
58
60
|
readonly runId?: string;
|
|
59
61
|
}
|
|
60
62
|
export declare function checkpointUnsupportedVersionContent(detail: CheckpointUnsupportedVersionDetail, ctx?: CheckpointUnsupportedVersionContext): string;
|
|
63
|
+
export type RefusedParkCode = typeof CHECKPOINT_UNSUPPORTED_VERSION | typeof CHECKPOINT_WALLTIME_AXIS_RETIRED | typeof CHECKPOINT_CONFIG_REFUSED;
|
|
64
|
+
export interface RefusedParkFacts {
|
|
65
|
+
readonly code: RefusedParkCode;
|
|
66
|
+
readonly field?: string;
|
|
67
|
+
readonly stillPending?: boolean;
|
|
68
|
+
}
|
|
69
|
+
export declare function refusedParkFromError(failure: unknown): RefusedParkFacts | null;
|
|
70
|
+
export interface RefusedParkContentInput {
|
|
71
|
+
readonly what: string;
|
|
72
|
+
readonly facts: RefusedParkFacts;
|
|
73
|
+
readonly lane: 'interactive' | 'print';
|
|
74
|
+
readonly runId?: string;
|
|
75
|
+
}
|
|
76
|
+
export declare function refusedParkContent(input: RefusedParkContentInput): string;
|
|
77
|
+
export declare function refusedParkBlockedContent(taskId: string, lane?: 'interactive' | 'print'): string;
|