@sema-agent/client-core 0.105.0 → 0.106.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 +220 -0
- package/README.md +26 -11
- package/dist/adapt/arms.js +10 -1
- package/dist/adapter/activeRunSelfHeal.d.ts +13 -2
- package/dist/adapter/activeRunSelfHeal.js +80 -7
- package/dist/adapter/downstream/eventToSdkMessage.d.ts +0 -5
- package/dist/adapter/downstream/eventToSdkMessage.js +20 -19
- package/dist/adapter/downstream/terminalToSdkResult.js +2 -3
- package/dist/adapter/downstream/wiringManifestView.d.ts +1 -3
- package/dist/adapter/downstream/wiringManifestView.js +0 -1
- package/dist/adapter/runStream.js +3 -4
- package/dist/approvalReachWire.d.ts +1 -0
- package/dist/approvalReachWire.js +4 -1
- package/dist/approvalSeat.d.ts +21 -0
- package/dist/approvalSeat.js +73 -0
- package/dist/assistantInbox.d.ts +2 -0
- package/dist/assistantInbox.js +3 -0
- package/dist/checkpointRowVerdict.d.ts +23 -0
- package/dist/checkpointRowVerdict.js +89 -0
- package/dist/coreValuePorts.d.ts +12 -1
- package/dist/coreValuePorts.js +10 -0
- package/dist/decideFailureNote.js +3 -1
- package/dist/decideReceipt.d.ts +9 -0
- package/dist/decideReceipt.js +29 -1
- package/dist/declared/supportFloorDeclared.js +2 -2
- package/dist/deviceRebind.d.ts +7 -0
- package/dist/deviceRebind.js +39 -5
- package/dist/engineAddress.d.ts +3 -0
- package/dist/engineAddress.js +25 -0
- package/dist/engineDirectory.js +9 -17
- package/dist/engineErrorCodes.d.ts +8 -0
- package/dist/engineErrorCodes.js +8 -0
- package/dist/engineNoticeCodes.d.ts +26 -3
- package/dist/engineNoticeCodes.js +52 -7
- package/dist/engineRowRef.js +1 -1
- package/dist/errorSupplementRoles.js +2 -0
- package/dist/eventLeg.d.ts +2 -2
- package/dist/eventLeg.js +2 -1
- package/dist/fleet/fleetProjection.js +26 -5
- package/dist/generated/engineFactTables.d.ts +2 -1
- package/dist/generated/engineFactTables.js +3 -1
- package/dist/generated/engineNoticeTables.js +19 -4
- package/dist/generated/sdkFactTables.d.ts +3 -0
- package/dist/generated/sdkFactTables.js +15 -0
- package/dist/generated/settingsSchemaFns.d.ts +11 -0
- package/dist/generated/settingsSchemaFns.js +2 -1
- package/dist/generated/settingsSchemaSafetyMergeSpec.js +1 -1
- package/dist/generated/settingsSchemaSettingsSources.d.ts +1 -1
- package/dist/generated/settingsSchemaSettingsSources.js +22 -2
- package/dist/hitl/approvalLiveFace.d.ts +17 -0
- package/dist/hitl/approvalLiveFace.js +35 -0
- package/dist/hitl/approvalQueueRow.d.ts +21 -0
- package/dist/hitl/approvalQueueRow.js +69 -0
- package/dist/hitl/approvalsFeed.d.ts +5 -4
- package/dist/hitl/approvalsFeed.js +38 -6
- package/dist/hitl/askParkRowRouting.d.ts +4 -3
- package/dist/hitl/askParkRowRouting.js +15 -3
- package/dist/hitl/automaticAnswerVerdict.js +13 -10
- package/dist/hitl/crashConverged.d.ts +5 -1
- package/dist/hitl/decisionConflict.js +2 -1
- package/dist/hitl/decisionRefusal.js +1 -1
- package/dist/hitl/decisionSend.d.ts +1 -0
- package/dist/hitl/decisionSend.js +14 -2
- package/dist/hitl/frameRouter.js +4 -5
- package/dist/hitl/hitlBridge.d.ts +1 -1
- package/dist/hitl/hitlBridge.js +26 -5
- package/dist/hitl/livePendingAsk.d.ts +5 -0
- package/dist/hitl/livePendingAsk.js +6 -1
- package/dist/hitl/planReviewCard.d.ts +2 -0
- package/dist/hitl/planReviewCard.js +21 -0
- package/dist/hitl/planReviewWire.d.ts +2 -2
- package/dist/hitl/planReviewWire.js +101 -36
- package/dist/hitl/sessionAllowRoute.d.ts +2 -0
- package/dist/hitl/sessionAllowRoute.js +7 -0
- package/dist/hitl/sessionPolicyWire.d.ts +1 -7
- package/dist/hitl/sessionPolicyWire.js +3 -43
- package/dist/hitl/subagentSource.d.ts +1 -0
- package/dist/hitl/subagentSource.js +13 -0
- package/dist/hitl/toolApprovalWire.d.ts +3 -2
- package/dist/hitl/toolApprovalWire.js +79 -37
- package/dist/hostSettingsSource.d.ts +4 -1
- package/dist/hostSettingsSource.js +11 -6
- package/dist/hostTurnSettings.d.ts +4 -5
- package/dist/hostTurnSettings.js +80 -19
- package/dist/i18n/messages.en.d.ts +35 -12
- package/dist/i18n/messages.en.js +36 -13
- package/dist/i18n/messages.zh.js +38 -13
- package/dist/index.d.ts +21 -2
- package/dist/index.js +11 -2
- package/dist/liveInitToolFace.js +0 -1
- package/dist/liveModelCatalog.d.ts +15 -0
- package/dist/liveModelCatalog.js +40 -0
- package/dist/mcpWireCaps.js +1 -1
- package/dist/modelCapabilityProbe.js +66 -33
- package/dist/ownKey.d.ts +0 -1
- package/dist/ownKey.js +0 -2
- package/dist/permissionsDeclaration.d.ts +2 -2
- package/dist/permissionsDeclaration.js +12 -14
- package/dist/projectSeed.d.ts +39 -0
- package/dist/projectSeed.js +80 -0
- package/dist/promptDelivery.js +1 -1
- package/dist/replayBody.d.ts +7 -6
- package/dist/replayBody.js +62 -7
- package/dist/request/taskRequest.js +3 -4
- package/dist/ruleCompileVerdict.d.ts +0 -2
- package/dist/ruleCompileVerdict.js +0 -31
- package/dist/ruleRefusalSentence.js +0 -3
- package/dist/runReattachPolicy.d.ts +3 -0
- package/dist/runReattachPolicy.js +15 -2
- package/dist/runTerminal.js +30 -8
- package/dist/sandboxWire.d.ts +0 -3
- package/dist/sandboxWire.js +0 -9
- package/dist/seam.d.ts +14 -7
- package/dist/seam.js +12 -0
- package/dist/seatContract.d.ts +57 -7
- package/dist/seatContract.js +132 -3
- package/dist/serverSupportRange.d.ts +18 -0
- package/dist/serverSupportRange.js +25 -0
- package/dist/sessionEngine.d.ts +156 -0
- package/dist/sessionEngine.js +464 -0
- package/dist/sessionMap.d.ts +11 -1
- package/dist/sessionMap.js +35 -9
- package/dist/sessionMemorySync.d.ts +31 -0
- package/dist/sessionMemorySync.js +95 -0
- package/dist/sessionRowTag.d.ts +4 -0
- package/dist/sessionRowTag.js +18 -0
- package/dist/settingsLayerAdmission.d.ts +1 -0
- package/dist/settingsLayerAdmission.js +4 -1
- package/dist/toolResult.js +1 -1
- package/dist/wireRefusalCopy.js +2 -6
- package/docs/INTEGRATION-CLIENTS.md +1022 -16
- package/package.json +5 -5
package/dist/coreValuePorts.d.ts
CHANGED
|
@@ -151,8 +151,17 @@ export interface CoreValuePorts {
|
|
|
151
151
|
readToolFaces(declared: {} | null | undefined): McpToolFacesReadView;
|
|
152
152
|
ruleNameCovers: (ruleName: string, toolName: string) => boolean;
|
|
153
153
|
IMPORTED_SETTINGS_LAYERS: readonly ['userSettings', 'projectSettings', 'localSettings'];
|
|
154
|
+
runParkedOf(run: WorkflowRunParkedInputView): boolean;
|
|
155
|
+
parkedAgentsOf(agents: ReadonlyArray<WorkflowAgentStatusView>): WorkflowAgentStatusView[];
|
|
154
156
|
}
|
|
155
|
-
export
|
|
157
|
+
export interface WorkflowAgentStatusView {
|
|
158
|
+
readonly status: string;
|
|
159
|
+
}
|
|
160
|
+
export interface WorkflowRunParkedInputView {
|
|
161
|
+
readonly status: string;
|
|
162
|
+
readonly agents: ReadonlyArray<WorkflowAgentStatusView>;
|
|
163
|
+
}
|
|
164
|
+
export declare const CORE_VALUE_PORT_NAMES: readonly ["resolveAutonomousLoopPrompt", "loosenReasons", "combinePolicies", "createAllowDenyPolicy", "MCP_NAMESPACE", "protocolOf", "ruleToolGrammarOf", "validatePermissionRules", "mintNamespacePrefix", "compileAllowList", "routeKeyOf", "joinRequestUrl", "resolveRouteCredential", "adjudicateModelRoute", "routePairingStatus", "judgeRuleToolName", "readRuleEntry", "readMcpToolAxes", "ANTHROPIC_DEFAULT_BASE_URL", "readToolFaces", "ruleNameCovers", "IMPORTED_SETTINGS_LAYERS", "runParkedOf", "parkedAgentsOf"];
|
|
156
165
|
export type CoreValuePortName = (typeof CORE_VALUE_PORT_NAMES)[number];
|
|
157
166
|
export declare function installCoreValuePorts(ports: Partial<CoreValuePorts> | null): () => void;
|
|
158
167
|
export declare function hasCoreValuePorts(): boolean;
|
|
@@ -184,3 +193,5 @@ export declare function anthropicDefaultBaseUrl(): string | undefined;
|
|
|
184
193
|
export declare function readToolFaces(declared: {} | null | undefined): McpToolFacesReadView | undefined;
|
|
185
194
|
export declare function ruleNameCovers(ruleName: string, toolName: string): boolean | undefined;
|
|
186
195
|
export declare function importedSettingsLayers(): CoreValuePorts['IMPORTED_SETTINGS_LAYERS'] | undefined;
|
|
196
|
+
export declare function runParkedOf(run: WorkflowRunParkedInputView): boolean | undefined;
|
|
197
|
+
export declare function parkedAgentsOf(agents: ReadonlyArray<WorkflowAgentStatusView>): WorkflowAgentStatusView[] | undefined;
|
package/dist/coreValuePorts.js
CHANGED
|
@@ -21,6 +21,8 @@ export const CORE_VALUE_PORT_NAMES = Object.freeze([
|
|
|
21
21
|
'readToolFaces',
|
|
22
22
|
'ruleNameCovers',
|
|
23
23
|
'IMPORTED_SETTINGS_LAYERS',
|
|
24
|
+
'runParkedOf',
|
|
25
|
+
'parkedAgentsOf',
|
|
24
26
|
]);
|
|
25
27
|
let installed = null;
|
|
26
28
|
export function installCoreValuePorts(ports) {
|
|
@@ -127,3 +129,11 @@ export function ruleNameCovers(ruleName, toolName) {
|
|
|
127
129
|
export function importedSettingsLayers() {
|
|
128
130
|
return port('IMPORTED_SETTINGS_LAYERS');
|
|
129
131
|
}
|
|
132
|
+
export function runParkedOf(run) {
|
|
133
|
+
const fn = port('runParkedOf');
|
|
134
|
+
return fn === undefined ? undefined : fn(run);
|
|
135
|
+
}
|
|
136
|
+
export function parkedAgentsOf(agents) {
|
|
137
|
+
const fn = port('parkedAgentsOf');
|
|
138
|
+
return fn === undefined ? undefined : fn(agents);
|
|
139
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { corruptStoredRowContent, corruptStoredRowWhere, scenarioDenyFromError, scenarioNotAllowedContent } from './wireErrorTriage.js';
|
|
2
2
|
import { checkpointUnsupportedVersionContent, checkpointUnsupportedVersionFromError, parkedResumeStartupContent, parkedResumeStartupFromError, resumePolicyBlockContent, resumePolicyBlockFromError, } from './resumeRefusalCopy.js';
|
|
3
|
-
import { askGoneContent, askGoneFromError, decideParkMovedContent, decideParkMovedFromError } from './decideReceipt.js';
|
|
3
|
+
import { askGoneContent, askGoneFromError, decideParkMovedContent, decideParkMovedFromError, decideRequiresBindingContent, decideRequiresBindingFromError } from './decideReceipt.js';
|
|
4
4
|
import { fieldLimitRefusalContent, fieldLimitRefusalFromError } from './wireRefusalCopy.js';
|
|
5
5
|
import { DECISION_ANSWER_INVALID_CONTENT, decisionConflictOf, decisionGrantChangedContent } from './hitl/decisionConflict.js';
|
|
6
6
|
export function decideFailureNote(err, decision) {
|
|
@@ -12,6 +12,7 @@ export function decideFailureNote(err, decision) {
|
|
|
12
12
|
const scenario = scenarioDenyFromError(err);
|
|
13
13
|
const unsupported = checkpointUnsupportedVersionFromError(err);
|
|
14
14
|
const gone = askGoneFromError(err);
|
|
15
|
+
const missingBinding = decideRequiresBindingFromError(err);
|
|
15
16
|
const conflict = decisionConflictOf(err);
|
|
16
17
|
const answerInvalid = conflict === 'answer_invalid';
|
|
17
18
|
return ((where === undefined ? '' : ` — ${corruptStoredRowContent(where)}`) +
|
|
@@ -22,6 +23,7 @@ export function decideFailureNote(err, decision) {
|
|
|
22
23
|
(moved === null ? '' : ` — ${decideParkMovedContent(moved)}`) +
|
|
23
24
|
(unsupported === null ? '' : ` — ${checkpointUnsupportedVersionContent(unsupported)}`) +
|
|
24
25
|
(gone === null ? '' : ` — ${askGoneContent(gone)}`) +
|
|
26
|
+
(missingBinding === null ? '' : ` — ${decideRequiresBindingContent(missingBinding)}`) +
|
|
25
27
|
(answerInvalid ? ` — ${DECISION_ANSWER_INVALID_CONTENT}` : '') +
|
|
26
28
|
(conflict === 'grant_changed' ? ` — ${decisionGrantChangedContent()}` : ''));
|
|
27
29
|
}
|
package/dist/decideReceipt.d.ts
CHANGED
|
@@ -2,6 +2,8 @@ import { type GateOutcomeView } from './gateOutcome.js';
|
|
|
2
2
|
import { type ResumeReopenDetail } from './hitl/suspendedReopen.js';
|
|
3
3
|
import { type CrashConvergedRowReading } from './hitl/crashConverged.js';
|
|
4
4
|
import type { AskRowEndingCause } from '@sema-agent/sdk';
|
|
5
|
+
import { SDK_DECIDE_BINDING_KEYS } from './generated/sdkFactTables.js';
|
|
6
|
+
import { type UiLanguage } from './env/uiLanguage.js';
|
|
5
7
|
export interface DecideReceiptView {
|
|
6
8
|
status?: string;
|
|
7
9
|
taskId?: string;
|
|
@@ -31,6 +33,13 @@ export interface DecideParkMovedDetail {
|
|
|
31
33
|
}
|
|
32
34
|
export declare function decideParkMovedFromError(e: unknown): DecideParkMovedDetail | null;
|
|
33
35
|
export declare function decideParkMovedContent(detail: Pick<DecideParkMovedDetail, 'code'>): string;
|
|
36
|
+
export type DecideBindingKey = (typeof SDK_DECIDE_BINDING_KEYS)[number];
|
|
37
|
+
export interface DecideRequiresBindingDetail {
|
|
38
|
+
readonly code: string;
|
|
39
|
+
readonly missingKeys?: readonly DecideBindingKey[];
|
|
40
|
+
}
|
|
41
|
+
export declare function decideRequiresBindingFromError(e: {} | null | undefined): DecideRequiresBindingDetail | null;
|
|
42
|
+
export declare function decideRequiresBindingContent(_detail?: DecideRequiresBindingDetail, lang?: UiLanguage | (string & {})): string;
|
|
34
43
|
export interface AskGoneDetail {
|
|
35
44
|
code: 'gone.ask';
|
|
36
45
|
state?: 'VOID' | 'DENIED';
|
package/dist/decideReceipt.js
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import { gateOutcomeOf } from './gateOutcome.js';
|
|
2
2
|
import { readOwnDataValue } from './ownKey.js';
|
|
3
3
|
import { resumeReopenFromError } from './hitl/suspendedReopen.js';
|
|
4
|
-
import { ASK_GONE, DECIDE_CLAIM_LOST, CONFLICT_NOT_RESUMABLE, GATE_NOT_TOOL_APPROVAL, DECIDE_GATE_MOVED, DECIDE_NOT_PARKED, DECIDE_WORKFLOW_HOST_UNKNOWN, DECIDE_WORKFLOW_LANE_CODES, DECIDE_WORKFLOW_PARK_FORKED, DECIDE_WORKFLOW_PARKS_UNREADABLE, DECIDE_WORKFLOW_REMEMBER_UNSUPPORTED, isDecideParkMovedCode, } from './engineErrorCodes.js';
|
|
4
|
+
import { ASK_GONE, DECIDE_CLAIM_LOST, CONFLICT_NOT_RESUMABLE, GATE_NOT_TOOL_APPROVAL, DECIDE_GATE_MOVED, DECIDE_NOT_PARKED, DECIDE_REQUIRES_BINDING, DECIDE_WORKFLOW_HOST_UNKNOWN, DECIDE_WORKFLOW_LANE_CODES, DECIDE_WORKFLOW_PARK_FORKED, DECIDE_WORKFLOW_PARKS_UNREADABLE, DECIDE_WORKFLOW_REMEMBER_UNSUPPORTED, isDecideParkMovedCode, } from './engineErrorCodes.js';
|
|
5
5
|
import { effectiveWireErrorCode } from './wireErrorTriage.js';
|
|
6
6
|
import { isSlotCarrier, readErrorString, readErrorStrictStringList, readThrownExtra } from './wireFailureShape.js';
|
|
7
7
|
import { isCrashConvergedCause } from './hitl/crashConverged.js';
|
|
8
8
|
import { askRowEndingCauseFor } from './hitl/approvalEndingCause.js';
|
|
9
|
+
import { SDK_DECIDE_BINDING_KEYS } from './generated/sdkFactTables.js';
|
|
10
|
+
import { isUiLanguage } from './env/uiLanguage.js';
|
|
11
|
+
import { msg, renderMessage } from './i18n/translate.js';
|
|
9
12
|
const STATUS_RESUMING = 'resuming';
|
|
10
13
|
function str(v) {
|
|
11
14
|
return typeof v === 'string' && v.length > 0 ? v : undefined;
|
|
@@ -136,6 +139,31 @@ export function decideParkMovedContent(detail) {
|
|
|
136
139
|
const extra = code === DECIDE_CLAIM_LOST ? '; if this approval is still listed, wait a little before deciding it again' : '';
|
|
137
140
|
return `${what} · This decision was not applied — fetch the pending approvals again and decide from what is pending now${extra}`;
|
|
138
141
|
}
|
|
142
|
+
const isDecideBindingKey = (v) => SDK_DECIDE_BINDING_KEYS.includes(v);
|
|
143
|
+
export function decideRequiresBindingFromError(e) {
|
|
144
|
+
try {
|
|
145
|
+
if (effectiveWireErrorCode(e) !== DECIDE_REQUIRES_BINDING)
|
|
146
|
+
return null;
|
|
147
|
+
const raw = readErrorStrictStringList(e, 'missingKeys');
|
|
148
|
+
const keys = [];
|
|
149
|
+
if (raw !== undefined) {
|
|
150
|
+
for (const k of raw) {
|
|
151
|
+
if (!isDecideBindingKey(k) || keys.includes(k)) {
|
|
152
|
+
keys.length = 0;
|
|
153
|
+
break;
|
|
154
|
+
}
|
|
155
|
+
keys.push(k);
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
return Object.freeze({ code: DECIDE_REQUIRES_BINDING, ...(keys.length > 0 ? { missingKeys: Object.freeze(keys) } : {}) });
|
|
159
|
+
}
|
|
160
|
+
catch {
|
|
161
|
+
return null;
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
export function decideRequiresBindingContent(_detail, lang) {
|
|
165
|
+
return renderMessage(msg('approval.decide.requiresBinding'), isUiLanguage(lang) ? lang : undefined);
|
|
166
|
+
}
|
|
139
167
|
function askGoneRawCause(e) {
|
|
140
168
|
let top;
|
|
141
169
|
try {
|
package/dist/deviceRebind.d.ts
CHANGED
|
@@ -95,6 +95,13 @@ export declare function listDevices(devices: DeviceListVerb | null | undefined,
|
|
|
95
95
|
export declare function readSessionBinding(sessions: SessionExecutionPlacementVerb | null | undefined, rootSessionId: string, opts?: {
|
|
96
96
|
readonly signal?: AbortSignal | undefined;
|
|
97
97
|
}): Promise<DeviceSessionBindingOutcome>;
|
|
98
|
+
export interface SessionPlacementView {
|
|
99
|
+
readonly sessionId: string;
|
|
100
|
+
readonly executionLane?: string;
|
|
101
|
+
readonly onDevice: boolean;
|
|
102
|
+
readonly rev?: number;
|
|
103
|
+
}
|
|
104
|
+
export declare function foldSessionPlacement(held: SessionPlacementView | undefined, sessionId: string, body: {} | null | undefined): SessionPlacementView | undefined;
|
|
98
105
|
export declare function rebindSession(devices: DeviceRebindVerb | null | undefined, req: DeviceRebindInput, opts?: {
|
|
99
106
|
readonly signal?: AbortSignal | undefined;
|
|
100
107
|
}): Promise<DeviceRebindOutcome>;
|
package/dist/deviceRebind.js
CHANGED
|
@@ -140,6 +140,17 @@ function placementReadFailureOf(e) {
|
|
|
140
140
|
return v.status !== undefined ? refusedOf(v.status, v.code, e) : transportOf(v);
|
|
141
141
|
}
|
|
142
142
|
const isPlacementRole = (v) => typeof v === 'string' && EXECUTION_PLACEMENT_ROLES.includes(v);
|
|
143
|
+
function placementBodyOf(body) {
|
|
144
|
+
const role = own(body, 'role');
|
|
145
|
+
if (!isPlacementRole(role))
|
|
146
|
+
return { role: undefined, lane: undefined, device: null };
|
|
147
|
+
if (role !== 'writer')
|
|
148
|
+
return { role, lane: undefined, device: null };
|
|
149
|
+
const lane = own(body, 'lane');
|
|
150
|
+
if (typeof lane !== 'string' || lane === '')
|
|
151
|
+
return { role, lane: undefined, device: null };
|
|
152
|
+
return { role, lane, device: lane === EXECUTION_PLACEMENT_DEVICE_LANE ? bindingOf(own(body, 'device')) : null };
|
|
153
|
+
}
|
|
143
154
|
export async function readSessionBinding(sessions, rootSessionId, opts) {
|
|
144
155
|
if (typeof rootSessionId !== 'string' || rootSessionId === '') {
|
|
145
156
|
return { kind: 'refused', status: 0, errorCode: 'request.id_invalid', message: 'the session id to read the execution placement of must be a non-empty string — nothing was sent' };
|
|
@@ -154,24 +165,47 @@ export async function readSessionBinding(sessions, rootSessionId, opts) {
|
|
|
154
165
|
catch (e) {
|
|
155
166
|
return placementReadFailureOf(e);
|
|
156
167
|
}
|
|
157
|
-
const role =
|
|
158
|
-
if (
|
|
168
|
+
const { role, lane, device: bound } = placementBodyOf(body);
|
|
169
|
+
if (role === undefined) {
|
|
159
170
|
return { kind: 'unreadable', why: 'the execution placement it returned names no role this client knows (absent / writer / mirror / forking) — refusing to read it as "not bound"' };
|
|
160
171
|
}
|
|
161
172
|
if (role !== 'writer')
|
|
162
173
|
return { kind: 'unbound', role };
|
|
163
|
-
|
|
164
|
-
if (typeof lane !== 'string' || lane === '') {
|
|
174
|
+
if (lane === undefined) {
|
|
165
175
|
return { kind: 'unreadable', why: "the writer's execution lane in the execution placement is missing or not a word — refusing to guess whether a device is bound" };
|
|
166
176
|
}
|
|
167
177
|
if (lane !== EXECUTION_PLACEMENT_DEVICE_LANE)
|
|
168
178
|
return { kind: 'unbound', role };
|
|
169
|
-
const bound = bindingOf(own(body, 'device'));
|
|
170
179
|
if (bound === null) {
|
|
171
180
|
return { kind: 'unreadable', why: 'the session is written on the device lane but the execution placement names no readable device (deviceId + rev) — the device is unknown, not unbound' };
|
|
172
181
|
}
|
|
173
182
|
return { kind: 'ok', rootSessionId, boundDevice: bound };
|
|
174
183
|
}
|
|
184
|
+
export function foldSessionPlacement(held, sessionId, body) {
|
|
185
|
+
try {
|
|
186
|
+
if (typeof sessionId !== 'string' || sessionId === '')
|
|
187
|
+
return held;
|
|
188
|
+
const heldOk = held !== null && typeof held === 'object';
|
|
189
|
+
if (heldOk && own(held, 'sessionId') !== sessionId)
|
|
190
|
+
return held;
|
|
191
|
+
const { role, lane, device } = placementBodyOf(body);
|
|
192
|
+
if (role === undefined)
|
|
193
|
+
return held;
|
|
194
|
+
const heldRev = heldOk ? nonNegInt(own(held, 'rev')) : undefined;
|
|
195
|
+
const rev = device?.rev;
|
|
196
|
+
if (heldRev !== undefined && (rev === undefined || rev < heldRev))
|
|
197
|
+
return held;
|
|
198
|
+
return Object.freeze({
|
|
199
|
+
sessionId,
|
|
200
|
+
...(lane !== undefined ? { executionLane: lane } : {}),
|
|
201
|
+
onDevice: device !== null,
|
|
202
|
+
...(rev !== undefined ? { rev } : {}),
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
catch {
|
|
206
|
+
return held;
|
|
207
|
+
}
|
|
208
|
+
}
|
|
175
209
|
function rebindFailureOf(e) {
|
|
176
210
|
const v = atMostOnceVerdictOf(e);
|
|
177
211
|
const { status, code } = v;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export function tupleOriginUrlOf(raw) {
|
|
2
|
+
try {
|
|
3
|
+
const u = new URL(raw);
|
|
4
|
+
return /^(?:https?|wss?|ftp):$/.test(u.protocol) ? u : undefined;
|
|
5
|
+
}
|
|
6
|
+
catch {
|
|
7
|
+
return undefined;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
export function carriesNoCredentialSlots(u) {
|
|
11
|
+
return u.username === '' && u.password === '' && u.search === '' && u.hash === '';
|
|
12
|
+
}
|
|
13
|
+
export function isCenterRelativePath(path) {
|
|
14
|
+
if (path.length === 0 || path.charCodeAt(0) !== 0x2f)
|
|
15
|
+
return false;
|
|
16
|
+
const second = path.charCodeAt(1);
|
|
17
|
+
if (second === 0x2f || second === 0x5c)
|
|
18
|
+
return false;
|
|
19
|
+
if (/[\s\u0000-\u001f\u007f-\u009f\\?#]/u.test(path))
|
|
20
|
+
return false;
|
|
21
|
+
return path.split('/').every((segment) => {
|
|
22
|
+
const decoded = segment.replace(/%2e/gi, '.');
|
|
23
|
+
return decoded !== '.' && decoded !== '..';
|
|
24
|
+
});
|
|
25
|
+
}
|
package/dist/engineDirectory.js
CHANGED
|
@@ -1,21 +1,9 @@
|
|
|
1
1
|
import { guardedRead, readOwnDataNonEmptyString, readOwnDataValue } from './ownKey.js';
|
|
2
|
+
import { isCenterRelativePath } from './engineAddress.js';
|
|
2
3
|
const KIND_WORDS = ['managed'];
|
|
3
4
|
const POSTURE_WORDS = ['single', 'multi'];
|
|
4
5
|
const RULE_WORDS = ['only-one', 'none', 'ambiguous'];
|
|
5
6
|
const UNREADABLE = Object.freeze({ kind: 'unreadable' });
|
|
6
|
-
function isCenterRelativePath(path) {
|
|
7
|
-
if (path.length === 0 || path.charCodeAt(0) !== 0x2f)
|
|
8
|
-
return false;
|
|
9
|
-
const second = path.charCodeAt(1);
|
|
10
|
-
if (second === 0x2f || second === 0x5c)
|
|
11
|
-
return false;
|
|
12
|
-
if (/[\s\u0000-\u001f\u007f-\u009f\\?#]/u.test(path))
|
|
13
|
-
return false;
|
|
14
|
-
return path.split('/').every((segment) => {
|
|
15
|
-
const decoded = segment.replace(/%2e/gi, '.');
|
|
16
|
-
return decoded !== '.' && decoded !== '..';
|
|
17
|
-
});
|
|
18
|
-
}
|
|
19
7
|
function isObj(v) {
|
|
20
8
|
return typeof v === 'object' && v !== null && !Array.isArray(v);
|
|
21
9
|
}
|
|
@@ -123,6 +111,9 @@ export function projectMeEngine(body) {
|
|
|
123
111
|
return undefined;
|
|
124
112
|
}
|
|
125
113
|
}
|
|
114
|
+
function sameNameCount(set, name) {
|
|
115
|
+
return set.rows.filter((row) => row.name === name).length + set.unreadableNames.filter((n) => n === name).length;
|
|
116
|
+
}
|
|
126
117
|
export function decideMeEngine(reading) {
|
|
127
118
|
try {
|
|
128
119
|
if (reading === undefined)
|
|
@@ -139,7 +130,9 @@ export function decideMeEngine(reading) {
|
|
|
139
130
|
if (candidates === undefined)
|
|
140
131
|
return unresolved('candidates');
|
|
141
132
|
const picked = target.row;
|
|
142
|
-
if (!candidates.rows.some((row) => row.name === picked.name && row.viaCenter === picked.viaCenter))
|
|
133
|
+
if (!candidates.rows.some((row) => row.name === picked.name && row.viaCenter === picked.viaCenter && row.scope === picked.scope))
|
|
134
|
+
return unresolved('conflict');
|
|
135
|
+
if (sameNameCount(candidates, picked.name) > 1)
|
|
143
136
|
return unresolved('conflict');
|
|
144
137
|
if (rule.kind === 'listed' && (candidates.rows.length !== 1 || candidates.unreadableRows !== 0))
|
|
145
138
|
return unresolved('conflict');
|
|
@@ -171,12 +164,11 @@ export function engineOverrideOf(set, requested) {
|
|
|
171
164
|
if (set === undefined)
|
|
172
165
|
return { kind: 'unreadable' };
|
|
173
166
|
const hits = set.rows.filter((row) => row.name === requested);
|
|
174
|
-
|
|
175
|
-
if (hits.length + hidden > 1)
|
|
167
|
+
if (sameNameCount(set, requested) > 1)
|
|
176
168
|
return { kind: 'duplicate', name: requested };
|
|
177
169
|
if (hits.length === 1)
|
|
178
170
|
return { kind: 'select', engine: hits[0] };
|
|
179
|
-
if (
|
|
171
|
+
if (set.unreadableNames.some((name) => name === requested))
|
|
180
172
|
return { kind: 'row-unreadable', name: requested };
|
|
181
173
|
return { kind: 'not-listed', candidates: set };
|
|
182
174
|
}
|
|
@@ -8,6 +8,7 @@ export declare const LIMITS_MAX_WALLTIME_EXCEEDED = "limits.max_walltime_exceede
|
|
|
8
8
|
export declare function isLimitsExceededCode(code: string | undefined): boolean;
|
|
9
9
|
export declare const USAGE_WINDOW_EXHAUSTED = "usage.window_exhausted";
|
|
10
10
|
export declare const ENV_LIFETIME_EXPIRED = "env.lifetime_expired";
|
|
11
|
+
export declare const ENV_HOME_UNCONFIRMED = "env.home_unconfirmed";
|
|
11
12
|
export declare const FLEET_LEASE_UNAVAILABLE = "fleet.lease_unavailable";
|
|
12
13
|
export declare const CONFIG_LIMIT_INVALID = "config.limit_invalid";
|
|
13
14
|
export declare const CONFIG_LIMIT_UNKNOWN_KEY = "config.limit_unknown_key";
|
|
@@ -42,6 +43,12 @@ export declare const CAPABILITY_IMAGE_INDEX_REQUIRED = "capability.image_index_r
|
|
|
42
43
|
export declare const CAPABILITY_K8S_LANE_REQUIRED = "capability.k8s_lane_required";
|
|
43
44
|
export declare const NOT_FOUND_IMAGE = "not_found.image";
|
|
44
45
|
export declare const REQUEST_PRECONDITION_UNMET = "request.precondition_unmet";
|
|
46
|
+
export declare const ATTACHMENT_BUNDLE_INVALID = "attachment.bundle_invalid";
|
|
47
|
+
export declare const ATTACHMENT_BUNDLE_LANE_NOT_ISOLATED = "attachment.bundle_lane_not_isolated";
|
|
48
|
+
export declare const ATTACHMENT_BUNDLE_SEED_FIXED = "attachment.bundle_seed_fixed";
|
|
49
|
+
export declare const ATTACHMENT_BOUND_ELSEWHERE = "attachment.bound_elsewhere";
|
|
50
|
+
export declare const CONFLICT_SESSION_MEMORY_UNOBSERVED = "conflict.session_memory_unobserved";
|
|
51
|
+
export declare const CONFLICT_SESSION_ARCHIVE_STAMPED = "conflict.session_archive_stamped";
|
|
45
52
|
export declare const GATE_PARKED_ERROR_CODE = "gate.parked";
|
|
46
53
|
export declare const ACTIVE_RUN_BUSY_ERROR_CODE = "conflict.session_active_run";
|
|
47
54
|
export declare const CONFLICT_IDEMPOTENCY_PAYLOAD_MISMATCH = "conflict.idempotency_payload_mismatch";
|
|
@@ -114,6 +121,7 @@ export declare function isDecideParkMovedCode(code: string | null | undefined):
|
|
|
114
121
|
export declare const DECIDE_ROW_UNREVIVABLE = "decide.row_unrevivable";
|
|
115
122
|
export declare function isDecideRowUnrevivableCode(code: string | null | undefined): boolean;
|
|
116
123
|
export declare const APPROVAL_STALE = "approval_stale";
|
|
124
|
+
export declare const DECIDE_REQUIRES_BINDING = "decide_requires_binding";
|
|
117
125
|
export declare const APPROVAL_BINDING_MISMATCH = "approval_binding_mismatch";
|
|
118
126
|
export declare const CHECKPOINT_INVALID_OUTCOME = "checkpoint.invalid_outcome";
|
|
119
127
|
export declare const RESUME_OUTCOME_INVALID = "resume_outcome_invalid";
|
package/dist/engineErrorCodes.js
CHANGED
|
@@ -11,6 +11,7 @@ export function isLimitsExceededCode(code) {
|
|
|
11
11
|
}
|
|
12
12
|
export const USAGE_WINDOW_EXHAUSTED = 'usage.window_exhausted';
|
|
13
13
|
export const ENV_LIFETIME_EXPIRED = 'env.lifetime_expired';
|
|
14
|
+
export const ENV_HOME_UNCONFIRMED = 'env.home_unconfirmed';
|
|
14
15
|
export const FLEET_LEASE_UNAVAILABLE = 'fleet.lease_unavailable';
|
|
15
16
|
export const CONFIG_LIMIT_INVALID = 'config.limit_invalid';
|
|
16
17
|
export const CONFIG_LIMIT_UNKNOWN_KEY = 'config.limit_unknown_key';
|
|
@@ -66,6 +67,12 @@ export const CAPABILITY_IMAGE_INDEX_REQUIRED = 'capability.image_index_required'
|
|
|
66
67
|
export const CAPABILITY_K8S_LANE_REQUIRED = 'capability.k8s_lane_required';
|
|
67
68
|
export const NOT_FOUND_IMAGE = 'not_found.image';
|
|
68
69
|
export const REQUEST_PRECONDITION_UNMET = 'request.precondition_unmet';
|
|
70
|
+
export const ATTACHMENT_BUNDLE_INVALID = 'attachment.bundle_invalid';
|
|
71
|
+
export const ATTACHMENT_BUNDLE_LANE_NOT_ISOLATED = 'attachment.bundle_lane_not_isolated';
|
|
72
|
+
export const ATTACHMENT_BUNDLE_SEED_FIXED = 'attachment.bundle_seed_fixed';
|
|
73
|
+
export const ATTACHMENT_BOUND_ELSEWHERE = 'attachment.bound_elsewhere';
|
|
74
|
+
export const CONFLICT_SESSION_MEMORY_UNOBSERVED = 'conflict.session_memory_unobserved';
|
|
75
|
+
export const CONFLICT_SESSION_ARCHIVE_STAMPED = 'conflict.session_archive_stamped';
|
|
69
76
|
export const GATE_PARKED_ERROR_CODE = 'gate.parked';
|
|
70
77
|
export const ACTIVE_RUN_BUSY_ERROR_CODE = 'conflict.session_active_run';
|
|
71
78
|
export const CONFLICT_IDEMPOTENCY_PAYLOAD_MISMATCH = 'conflict.idempotency_payload_mismatch';
|
|
@@ -214,6 +221,7 @@ export function isDecideRowUnrevivableCode(code) {
|
|
|
214
221
|
return typeof code === 'string' && code === DECIDE_ROW_UNREVIVABLE;
|
|
215
222
|
}
|
|
216
223
|
export const APPROVAL_STALE = 'approval_stale';
|
|
224
|
+
export const DECIDE_REQUIRES_BINDING = 'decide_requires_binding';
|
|
217
225
|
export const APPROVAL_BINDING_MISMATCH = 'approval_binding_mismatch';
|
|
218
226
|
export const CHECKPOINT_INVALID_OUTCOME = 'checkpoint.invalid_outcome';
|
|
219
227
|
export const RESUME_OUTCOME_INVALID = 'resume_outcome_invalid';
|
|
@@ -223,12 +223,14 @@ export interface StreamEndIgnoredFactsView {
|
|
|
223
223
|
runId: string;
|
|
224
224
|
}
|
|
225
225
|
export declare function readStreamEndIgnored(notice: unknown): StreamEndIgnoredFactsView | undefined;
|
|
226
|
-
export interface
|
|
226
|
+
export interface ContextMediaRemovedFactsView {
|
|
227
|
+
reason: string;
|
|
227
228
|
images: number;
|
|
229
|
+
documents: number;
|
|
228
230
|
sessionId: string;
|
|
229
231
|
runId: string;
|
|
230
232
|
}
|
|
231
|
-
export declare function
|
|
233
|
+
export declare function readContextMediaRemoved(notice: {} | null | undefined): ContextMediaRemovedFactsView | undefined;
|
|
232
234
|
export interface McpAuthorizationRequiredFactsView {
|
|
233
235
|
server: string;
|
|
234
236
|
reason: string;
|
|
@@ -237,6 +239,26 @@ export interface McpAuthorizationRequiredFactsView {
|
|
|
237
239
|
runId: string;
|
|
238
240
|
}
|
|
239
241
|
export declare function readMcpAuthorizationRequired(notice: {} | null | undefined): McpAuthorizationRequiredFactsView | undefined;
|
|
242
|
+
interface SessionLineageRerootedCommon {
|
|
243
|
+
recordsDropped: NoticeCountReading;
|
|
244
|
+
recordsTotal: NoticeCountReading;
|
|
245
|
+
entriesOnPath: NoticeCountReading;
|
|
246
|
+
sessionId: string;
|
|
247
|
+
runId: string;
|
|
248
|
+
}
|
|
249
|
+
interface SessionLineageRerootedWhole extends SessionLineageRerootedCommon {
|
|
250
|
+
break: false;
|
|
251
|
+
leaf: string | null;
|
|
252
|
+
}
|
|
253
|
+
interface SessionLineageRerootedBroken extends SessionLineageRerootedCommon {
|
|
254
|
+
break: true;
|
|
255
|
+
leaf: string;
|
|
256
|
+
missingParentId: string;
|
|
257
|
+
rootedAt: string;
|
|
258
|
+
entriesCut: NoticeCountReading;
|
|
259
|
+
}
|
|
260
|
+
export type SessionLineageRerootedFactsView = SessionLineageRerootedWhole | SessionLineageRerootedBroken;
|
|
261
|
+
export declare function readSessionLineageRerooted(notice: {} | null | undefined): SessionLineageRerootedFactsView | undefined;
|
|
240
262
|
export declare const ENGINE_NOTICE_FACT_READERS: Readonly<{
|
|
241
263
|
readonly 'mcp.injection_dropped': typeof readMcpInjectionDrop;
|
|
242
264
|
readonly 'delegation.ask_unresolvable': typeof readAskUnresolvable;
|
|
@@ -261,8 +283,9 @@ export declare const ENGINE_NOTICE_FACT_READERS: Readonly<{
|
|
|
261
283
|
readonly 'task.turn_interrupted': typeof readTurnInterrupted;
|
|
262
284
|
readonly 'route.finish_reason_unknown': typeof readFinishReasonUnknown;
|
|
263
285
|
readonly 'route.stream_end_ignored': typeof readStreamEndIgnored;
|
|
264
|
-
readonly 'context.image_removed': typeof readContextImageRemoved;
|
|
265
286
|
readonly 'mcp.authorization_required': typeof readMcpAuthorizationRequired;
|
|
287
|
+
readonly 'context.media_removed': typeof readContextMediaRemoved;
|
|
288
|
+
readonly 'session.lineage_rerooted': typeof readSessionLineageRerooted;
|
|
266
289
|
}>;
|
|
267
290
|
type FactReaderTable = typeof ENGINE_NOTICE_FACT_READERS;
|
|
268
291
|
export type EngineNoticeFactsCode = keyof FactReaderTable;
|
|
@@ -897,25 +897,28 @@ function readStreamEndIgnoredOf(notice) {
|
|
|
897
897
|
return undefined;
|
|
898
898
|
return { statement, word, frames, sessionId, runId };
|
|
899
899
|
}
|
|
900
|
-
export function
|
|
901
|
-
return guardedRead(notice,
|
|
900
|
+
export function readContextMediaRemoved(notice) {
|
|
901
|
+
return guardedRead(notice, readContextMediaRemovedOf);
|
|
902
902
|
}
|
|
903
|
-
function
|
|
903
|
+
function readContextMediaRemovedOf(notice) {
|
|
904
904
|
if (typeof notice !== 'object' || notice === null || Array.isArray(notice))
|
|
905
905
|
return undefined;
|
|
906
906
|
const n = notice;
|
|
907
|
-
if (ownSeat(n, 'code') !== 'context.
|
|
907
|
+
if (ownSeat(n, 'code') !== 'context.media_removed')
|
|
908
908
|
return undefined;
|
|
909
909
|
const d = ownSeat(n, 'detail');
|
|
910
910
|
if (typeof d !== 'object' || d === null || Array.isArray(d))
|
|
911
911
|
return undefined;
|
|
912
912
|
const o = d;
|
|
913
|
+
const reason = nonEmpty(ownSeat(o, 'reason'));
|
|
913
914
|
const images = ownSeat(o, 'images');
|
|
915
|
+
const documents = ownSeat(o, 'documents');
|
|
914
916
|
const sessionId = nonEmpty(ownSeat(o, 'sessionId'));
|
|
915
917
|
const runId = nonEmpty(ownSeat(o, 'runId'));
|
|
916
|
-
|
|
918
|
+
const count = (v) => typeof v === 'number' && Number.isSafeInteger(v) && v >= 0;
|
|
919
|
+
if (reason === undefined || !count(images) || !count(documents) || images + documents < 1 || sessionId === undefined || runId === undefined)
|
|
917
920
|
return undefined;
|
|
918
|
-
return { images, sessionId, runId };
|
|
921
|
+
return { reason, images, documents, sessionId, runId };
|
|
919
922
|
}
|
|
920
923
|
export function readMcpAuthorizationRequired(notice) {
|
|
921
924
|
return guardedRead(notice, readMcpAuthorizationRequiredOf);
|
|
@@ -939,6 +942,47 @@ function readMcpAuthorizationRequiredOf(notice) {
|
|
|
939
942
|
const authorizeUrl = nonEmpty(optionalOwnSeat(o, 'authorizeUrl'));
|
|
940
943
|
return { server, reason, ...(authorizeUrl !== undefined ? { authorizeUrl } : {}), sessionId, runId };
|
|
941
944
|
}
|
|
945
|
+
export function readSessionLineageRerooted(notice) {
|
|
946
|
+
return guardedRead(notice, readSessionLineageRerootedOf);
|
|
947
|
+
}
|
|
948
|
+
function readSessionLineageRerootedOf(notice) {
|
|
949
|
+
if (typeof notice !== 'object' || notice === null || Array.isArray(notice))
|
|
950
|
+
return undefined;
|
|
951
|
+
const n = notice;
|
|
952
|
+
if (ownSeat(n, 'code') !== 'session.lineage_rerooted')
|
|
953
|
+
return undefined;
|
|
954
|
+
const d = ownSeat(n, 'detail');
|
|
955
|
+
if (typeof d !== 'object' || d === null || Array.isArray(d))
|
|
956
|
+
return undefined;
|
|
957
|
+
const o = d;
|
|
958
|
+
const brk = ownSeat(o, 'break');
|
|
959
|
+
if (brk !== true && brk !== false)
|
|
960
|
+
return undefined;
|
|
961
|
+
const sessionId = nonEmpty(ownSeat(o, 'sessionId'));
|
|
962
|
+
const runId = nonEmpty(ownSeat(o, 'runId'));
|
|
963
|
+
if (sessionId === undefined || runId === undefined)
|
|
964
|
+
return undefined;
|
|
965
|
+
const leafRaw = ownSeat(o, 'leaf');
|
|
966
|
+
const common = {
|
|
967
|
+
recordsDropped: countReading(optionalOwnSeat(o, 'recordsDropped')),
|
|
968
|
+
recordsTotal: countReading(optionalOwnSeat(o, 'recordsTotal')),
|
|
969
|
+
entriesOnPath: countReading(optionalOwnSeat(o, 'entriesOnPath')),
|
|
970
|
+
sessionId,
|
|
971
|
+
runId,
|
|
972
|
+
};
|
|
973
|
+
if (brk === false) {
|
|
974
|
+
const leaf = leafRaw === null ? null : nonEmpty(leafRaw);
|
|
975
|
+
if (leaf === undefined)
|
|
976
|
+
return undefined;
|
|
977
|
+
return { break: false, leaf, ...common };
|
|
978
|
+
}
|
|
979
|
+
const leaf = nonEmpty(leafRaw);
|
|
980
|
+
const missingParentId = nonEmpty(ownSeat(o, 'missingParentId'));
|
|
981
|
+
const rootedAt = nonEmpty(ownSeat(o, 'rootedAt'));
|
|
982
|
+
if (leaf === undefined || missingParentId === undefined || rootedAt === undefined)
|
|
983
|
+
return undefined;
|
|
984
|
+
return { break: true, leaf, missingParentId, rootedAt, entriesCut: countReading(optionalOwnSeat(o, 'entriesCut')), ...common };
|
|
985
|
+
}
|
|
942
986
|
export const ENGINE_NOTICE_FACT_READERS = Object.freeze({
|
|
943
987
|
'mcp.injection_dropped': readMcpInjectionDrop,
|
|
944
988
|
'delegation.ask_unresolvable': readAskUnresolvable,
|
|
@@ -963,8 +1007,9 @@ export const ENGINE_NOTICE_FACT_READERS = Object.freeze({
|
|
|
963
1007
|
'task.turn_interrupted': readTurnInterrupted,
|
|
964
1008
|
'route.finish_reason_unknown': readFinishReasonUnknown,
|
|
965
1009
|
'route.stream_end_ignored': readStreamEndIgnored,
|
|
966
|
-
'context.image_removed': readContextImageRemoved,
|
|
967
1010
|
'mcp.authorization_required': readMcpAuthorizationRequired,
|
|
1011
|
+
'context.media_removed': readContextMediaRemoved,
|
|
1012
|
+
'session.lineage_rerooted': readSessionLineageRerooted,
|
|
968
1013
|
});
|
|
969
1014
|
const _factReaderTablePin = true;
|
|
970
1015
|
void _factReaderTablePin;
|
package/dist/engineRowRef.js
CHANGED
|
@@ -74,7 +74,7 @@ export function mintEngineRowRef(eventId, bound) {
|
|
|
74
74
|
export function terminalRunIdOf(ev) {
|
|
75
75
|
if (ev.type !== 'done')
|
|
76
76
|
return undefined;
|
|
77
|
-
const v =
|
|
77
|
+
const v = doneResultView(ev.result).body?.runId;
|
|
78
78
|
return typeof v === 'string' && v.length > 0 ? v : undefined;
|
|
79
79
|
}
|
|
80
80
|
export const TRANSCRIPT_ROW_SIDECAR_KEYS = Object.freeze([
|
|
@@ -4,6 +4,7 @@ import { resumeRefusalContent, resumeContextUnavailableContent, requireExistingS
|
|
|
4
4
|
import { resumeReopenContent } from './hitl/suspendedReopen.js';
|
|
5
5
|
import { idempotencyPayloadMismatchContent } from './engineErrorCodes.js';
|
|
6
6
|
import { inheritEnvRefusalContent } from './inheritEnvWire.js';
|
|
7
|
+
import { projectSeedRefusalContent } from './projectSeed.js';
|
|
7
8
|
import { usageWindowExhaustedContent, fleetLeaseUnavailableContent, settingsPermissionBucketRefusalContent, fieldLimitRefusalContent, autonomyLaneRefusalContent, unsupportedRuleRefusalContent, admissionWallRefusalContent, hostPostureRefusalContent, toolDeclarationRefusalContent, } from './wireRefusalCopy.js';
|
|
8
9
|
const ROLE_BY_READER = new Map([
|
|
9
10
|
[corruptSessionContent, 'replacement'],
|
|
@@ -20,6 +21,7 @@ const ROLE_BY_READER = new Map([
|
|
|
20
21
|
[autonomyLaneRefusalContent, 'replacement'],
|
|
21
22
|
[idempotencyPayloadMismatchContent, 'replacement'],
|
|
22
23
|
[unsupportedRuleRefusalContent, 'replacement'],
|
|
24
|
+
[projectSeedRefusalContent, 'replacement'],
|
|
23
25
|
[admissionWallRefusalContent, 'supplement'],
|
|
24
26
|
[hostPostureRefusalContent, 'supplement'],
|
|
25
27
|
[toolDeclarationRefusalContent, 'supplement'],
|
package/dist/eventLeg.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import type { AgentEvent } from '@sema-agent/sdk';
|
|
|
2
2
|
import type { EngineBoundRun } from './engineRowRef.js';
|
|
3
3
|
import { type AskGateWireDeps } from './hitl/askGateWire.js';
|
|
4
4
|
import { type ActiveRunBusySignal } from './adapter/runStream.js';
|
|
5
|
-
import type { ApprovalRequestChromeEvent, ApprovalRevokeChromeEvent } from './seam.js';
|
|
5
|
+
import type { ApprovalCompleteChromeEvent, ApprovalRequestChromeEvent, ApprovalRevokeChromeEvent } from './seam.js';
|
|
6
6
|
export declare const EVENT_LEG_KINDS: readonly ["live", "durable", "continuation"];
|
|
7
7
|
export type EventLegKind = (typeof EVENT_LEG_KINDS)[number];
|
|
8
8
|
export type EventLegStage = 'bindRun' | 'stampOwner' | 'hitlFrames' | 'askBridge' | 'idleTriage';
|
|
@@ -71,7 +71,7 @@ export interface ApprovalFrameContext {
|
|
|
71
71
|
readonly receivedAtMs: number;
|
|
72
72
|
readonly streamEnded: AbortSignal;
|
|
73
73
|
}
|
|
74
|
-
export declare function approvalFrameContextOf(arm: ApprovalRequestChromeEvent | ApprovalRevokeChromeEvent): ApprovalFrameContext | undefined;
|
|
74
|
+
export declare function approvalFrameContextOf(arm: ApprovalRequestChromeEvent | ApprovalCompleteChromeEvent | ApprovalRevokeChromeEvent): ApprovalFrameContext | undefined;
|
|
75
75
|
export interface EventLegPorts {
|
|
76
76
|
readonly run?: EventLegRunPorts;
|
|
77
77
|
readonly owner?: EventLegOwnerPorts;
|
package/dist/eventLeg.js
CHANGED
|
@@ -3,6 +3,7 @@ import { bridgeAskUserQuestionGates } from './hitl/askGateWire.js';
|
|
|
3
3
|
import { diagnoseSseIdleTear } from './sseIdleTriage.js';
|
|
4
4
|
import { recordSubagentOwnerFromProgress } from './subagentContentStore.js';
|
|
5
5
|
import { activeRunBusySignal } from './adapter/runStream.js';
|
|
6
|
+
import { frameProvesDelivery } from './promptDelivery.js';
|
|
6
7
|
import { faultText, invokeHostCallbackIsolated } from './hostCallbackGuard.js';
|
|
7
8
|
import { hostLog } from './host.js';
|
|
8
9
|
import { guardedRead, readOwnDataNonEmptyString, readOwnDataValue } from './ownKey.js';
|
|
@@ -180,7 +181,7 @@ export function composeEventLeg(source, leg, ports) {
|
|
|
180
181
|
if (taskId === undefined && streamKind === 'live')
|
|
181
182
|
taskId = readHeaderRunId();
|
|
182
183
|
const refusal = streamKind === 'live' && !runEvidence && inDomain('bindRun', ev.type) ? refusalOf(ev, taskId) : undefined;
|
|
183
|
-
if (
|
|
184
|
+
if (frameProvesDelivery(ev))
|
|
184
185
|
runEvidence = true;
|
|
185
186
|
if (refusal !== undefined) {
|
|
186
187
|
if (runPorts !== undefined && typeof runPorts.onRefused === 'function' && isCurrentNow())
|