@sema-agent/client-core 0.105.0 → 0.107.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 +301 -0
- package/README.md +40 -21
- package/dist/adapt/arms.js +10 -1
- package/dist/adapter/activeRunSelfHeal.d.ts +21 -2
- package/dist/adapter/activeRunSelfHeal.js +129 -28
- 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 +29 -0
- package/dist/checkpointRowVerdict.js +98 -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/displayUntrusted.d.ts +5 -3
- package/dist/displayUntrusted.js +50 -41
- 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 +38 -3
- package/dist/engineNoticeCodes.js +167 -11
- package/dist/engineRowRef.js +1 -1
- package/dist/errorSupplementRoles.js +4 -1
- package/dist/eventLeg.d.ts +2 -2
- package/dist/eventLeg.js +2 -1
- package/dist/executionLaneCapability.js +3 -2
- package/dist/executionLaneWords.d.ts +1 -0
- package/dist/executionLaneWords.js +3 -0
- 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 +28 -7
- 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/approvalResolution.d.ts +5 -1
- package/dist/hitl/approvalResolution.js +18 -1
- package/dist/hitl/approvalsFeed.d.ts +5 -4
- package/dist/hitl/approvalsFeed.js +39 -6
- package/dist/hitl/askParkRowRouting.d.ts +4 -3
- package/dist/hitl/askParkRowRouting.js +27 -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 +3 -0
- package/dist/hitl/decisionSend.js +32 -6
- package/dist/hitl/frameRouter.js +4 -5
- package/dist/hitl/hitlBridge.d.ts +6 -2
- package/dist/hitl/hitlBridge.js +53 -7
- package/dist/hitl/livePendingAsk.d.ts +5 -0
- package/dist/hitl/livePendingAsk.js +10 -3
- package/dist/hitl/parkOwnership.js +4 -5
- package/dist/hitl/parkResolver.js +9 -5
- package/dist/hitl/parkRowBirthWait.d.ts +7 -0
- package/dist/hitl/parkRowBirthWait.js +1 -1
- package/dist/hitl/parkRowDelegation.d.ts +6 -0
- package/dist/hitl/parkRowDelegation.js +33 -0
- package/dist/hitl/persistedRulesWire.d.ts +15 -3
- package/dist/hitl/persistedRulesWire.js +102 -20
- 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 +105 -38
- package/dist/hitl/sessionAllowRoute.d.ts +7 -0
- package/dist/hitl/sessionAllowRoute.js +49 -0
- package/dist/hitl/sessionPolicyWire.d.ts +1 -7
- package/dist/hitl/sessionPolicyWire.js +3 -43
- package/dist/hitl/standingRows.js +10 -10
- 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 +100 -44
- 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 +41 -12
- package/dist/i18n/messages.en.js +42 -13
- package/dist/i18n/messages.zh.js +45 -13
- package/dist/index.d.ts +22 -2
- package/dist/index.js +12 -2
- package/dist/injectionLaneNotice.js +2 -1
- 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/noticePresentation.js +2 -0
- 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/sdkWireTransit.d.ts +1 -1
- package/dist/seam.d.ts +14 -7
- package/dist/seam.js +12 -0
- package/dist/seatContract.d.ts +58 -7
- package/dist/seatContract.js +135 -4
- 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.d.ts +6 -1
- package/dist/wireRefusalCopy.js +9 -7
- package/docs/INTEGRATION-CLIENTS.md +1393 -18
- package/package.json +5 -5
package/dist/adapt/arms.js
CHANGED
|
@@ -15,7 +15,7 @@ import { readToolHistoryMismatchKey } from '../toolHistoryMismatch.js';
|
|
|
15
15
|
import { isMintedRowCcError, readProviderRejectionResendKey } from '../providerRejection.js';
|
|
16
16
|
import { rowKindOf } from '../rowKind.js';
|
|
17
17
|
import { terminalCodedDetailOf } from '../runTerminal.js';
|
|
18
|
-
import { contextUsageReadingOf, guardedRead, humanInputAttachmentsOf, ownSnapshotRecord, ownSnapshotWhenTyped, readOwnDataValue, promptManifestIdentityOfFrame, promptManifestSectionViewOf, readFrameStringKey, readFrameTrueMark, workflowCompletionExtrasOf } from '../ownKey.js';
|
|
18
|
+
import { contextUsageReadingOf, guardedRead, humanInputAttachmentsOf, ownSnapshotRecord, ownSnapshotWhenTyped, readOwnDataNonEmptyString, readOwnDataValue, promptManifestIdentityOfFrame, promptManifestSectionViewOf, readFrameStringKey, readFrameTrueMark, workflowCompletionExtrasOf } from '../ownKey.js';
|
|
19
19
|
import { CORE_USER_ATTACHMENT_LABEL_MAX } from '../generated/engineFactTables.js';
|
|
20
20
|
import { ESCAPE_FACE, paintAndCap, washCredentials } from '../displayUntrusted.js';
|
|
21
21
|
import { resolveEnginePanelTaskId } from '../engineAgentPanelStore.js';
|
|
@@ -388,6 +388,13 @@ const approvalFrameArm = (kind) => function* (m) {
|
|
|
388
388
|
return;
|
|
389
389
|
yield chrome({ kind, laneProof: mainLane(), frame, schemaVersion });
|
|
390
390
|
};
|
|
391
|
+
const sessionTitledArm = function* (m) {
|
|
392
|
+
const sessionId = guardedRead(() => readOwnDataNonEmptyString(m, 'sessionId'));
|
|
393
|
+
const title = guardedRead(() => readOwnDataNonEmptyString(m, 'title'));
|
|
394
|
+
if (sessionId === undefined || title === undefined)
|
|
395
|
+
return;
|
|
396
|
+
yield chrome({ kind: 'session_titled', laneProof: mainLane(), sessionId, title });
|
|
397
|
+
};
|
|
391
398
|
const toolDisclosureArm = function* (m) {
|
|
392
399
|
if (isSubFlowSegmentEnd(m))
|
|
393
400
|
return;
|
|
@@ -1099,6 +1106,8 @@ export const ARMS = new Map([
|
|
|
1099
1106
|
['wiring_manifest', wiringManifestArm],
|
|
1100
1107
|
['approval_request', approvalFrameArm('approval_request')],
|
|
1101
1108
|
['approval_revoke', approvalFrameArm('approval_revoke')],
|
|
1109
|
+
['approval_complete', approvalFrameArm('approval_complete')],
|
|
1110
|
+
['session_titled', sessionTitledArm],
|
|
1102
1111
|
['prompt_suggestions', promptSuggestionsArm],
|
|
1103
1112
|
['retry_status', retryStatusArm],
|
|
1104
1113
|
]);
|
|
@@ -3,9 +3,10 @@ import type { ActiveRunBusySignal } from './runStream.js';
|
|
|
3
3
|
import type { RejectedSubmissionOrigin } from '../request/submissionIdentity.js';
|
|
4
4
|
import type { PlanReviewReopenTrigger } from '../hitl/planReviewWire.js';
|
|
5
5
|
import { type AskParkAutoReopenBlock } from '../hitl/askParkAutoReopenBlock.js';
|
|
6
|
+
import { type CheckpointRowVerdictReading } from '../checkpointRowVerdict.js';
|
|
6
7
|
import { atMostOnceFailureClass } from '../atMostOnce.js';
|
|
7
8
|
export declare const PLAN_REVIEW_GATE_KIND = "plan_review";
|
|
8
|
-
export type DurableDecideLeg = 'approval' | 'plan_review' | 'other_gate' | 'unreadable'
|
|
9
|
+
export type DurableDecideLeg = 'approval' | 'plan_review' | 'other_gate' | 'unreadable';
|
|
9
10
|
export declare function durableDecideLegOf(row: {
|
|
10
11
|
readonly gateKind?: string | null;
|
|
11
12
|
} | null | undefined): DurableDecideLeg;
|
|
@@ -44,6 +45,9 @@ export type ReopenCardVerdict = {
|
|
|
44
45
|
_sema_errorCode?: string;
|
|
45
46
|
_sema_reopenRefusal?: PlanReviewReopenRefusal;
|
|
46
47
|
_sema_policyBlocked?: AskParkAutoReopenBlock;
|
|
48
|
+
_sema_rowVerdict?: Exclude<CheckpointRowVerdictReading, {
|
|
49
|
+
readonly kind: 'ok';
|
|
50
|
+
}>;
|
|
47
51
|
} | {
|
|
48
52
|
reopened: true;
|
|
49
53
|
firstSight: boolean;
|
|
@@ -87,6 +91,7 @@ export interface ActiveRunSelfHealDeps {
|
|
|
87
91
|
signal?: AbortSignal;
|
|
88
92
|
cancelReleaseWaitMs?: number;
|
|
89
93
|
submissionOrigin?: RejectedSubmissionOrigin;
|
|
94
|
+
injectedCarriers?: readonly object[];
|
|
90
95
|
sessionId?: string;
|
|
91
96
|
wasRecentlyTerminatedByUs?: (taskId: string) => boolean;
|
|
92
97
|
interruptedSettle?: InterruptedSettleWindow;
|
|
@@ -146,6 +151,9 @@ export type SelfHealOutcome = {
|
|
|
146
151
|
noPresentationSurface?: true;
|
|
147
152
|
errorCode?: string;
|
|
148
153
|
policyBlocked?: AskParkAutoReopenBlock;
|
|
154
|
+
rowVerdict?: Exclude<CheckpointRowVerdictReading, {
|
|
155
|
+
readonly kind: 'ok';
|
|
156
|
+
}>;
|
|
149
157
|
} | {
|
|
150
158
|
kind: 'ask-decided-without-card';
|
|
151
159
|
taskId: string;
|
|
@@ -161,6 +169,7 @@ export type SelfHealOutcome = {
|
|
|
161
169
|
delivery: string | null;
|
|
162
170
|
status: string | null;
|
|
163
171
|
reopened: ReopenCardVerdict | null;
|
|
172
|
+
messageId?: string;
|
|
164
173
|
} | {
|
|
165
174
|
kind: 'running-steer-failed';
|
|
166
175
|
taskId: string;
|
|
@@ -171,6 +180,12 @@ export type SelfHealOutcome = {
|
|
|
171
180
|
} | {
|
|
172
181
|
kind: 'running-attach';
|
|
173
182
|
taskId: string;
|
|
183
|
+
} | {
|
|
184
|
+
kind: 'injected-redundant';
|
|
185
|
+
taskId: string;
|
|
186
|
+
} | {
|
|
187
|
+
kind: 'injected-deferred';
|
|
188
|
+
taskId: string;
|
|
174
189
|
} | {
|
|
175
190
|
kind: 'running-cancelled';
|
|
176
191
|
taskId: string;
|
|
@@ -215,7 +230,7 @@ export type SelfHealOutcome = {
|
|
|
215
230
|
alreadyOffered?: true;
|
|
216
231
|
};
|
|
217
232
|
export type { RejectedSubmissionOrigin };
|
|
218
|
-
export type SelfHealSubmissionDisposition = 'held-for-decision' | 'resending' | 'handed-off' | 'not-delivered';
|
|
233
|
+
export type SelfHealSubmissionDisposition = 'held-for-decision' | 'resending' | 'handed-off' | 'not-delivered' | 'superseded' | 'deferred';
|
|
219
234
|
export declare function selfHealSubmissionDisposition(outcome: SelfHealOutcome): SelfHealSubmissionDisposition;
|
|
220
235
|
export type SteerFollowIntent = {
|
|
221
236
|
kind: 'tail';
|
|
@@ -226,11 +241,15 @@ export type SteerFollowIntent = {
|
|
|
226
241
|
} | {
|
|
227
242
|
kind: 'after-wake';
|
|
228
243
|
taskId: string;
|
|
244
|
+
} | {
|
|
245
|
+
kind: 'follow-resumed';
|
|
246
|
+
taskId: string;
|
|
229
247
|
};
|
|
230
248
|
export declare function steerFollowIntent(outcome: SelfHealOutcome | null | undefined): SteerFollowIntent | null;
|
|
231
249
|
export interface SelfHealFollowDeclaration {
|
|
232
250
|
following?: boolean;
|
|
233
251
|
}
|
|
252
|
+
export declare function injectedResubmitAfter(outcome: SelfHealOutcome | null | undefined, runStatus: string | null | undefined): boolean;
|
|
234
253
|
export declare function readCancelRequested(body: unknown): boolean | undefined;
|
|
235
254
|
export { atMostOnceFailureClass };
|
|
236
255
|
export declare function clearRunningChoiceOffer(taskId: string, sessionId?: string): void;
|
|
@@ -6,6 +6,8 @@ import { DEFAULT_SESSION_KEY } from '../sessionSlot.js';
|
|
|
6
6
|
import { ASK_PARK_AUTO_REOPEN_BLOCKS, askParkAutoReopenBlockedContent } from '../hitl/askParkAutoReopenBlock.js';
|
|
7
7
|
import { corruptStoredRowContent, corruptStoredRowWhere, effectiveWireErrorCode } from '../wireErrorTriage.js';
|
|
8
8
|
import { readThrownStatusSlot } from '../wireFailureShape.js';
|
|
9
|
+
import { checkpointRowBarOf, checkpointRowBarSentence } from '../checkpointRowVerdict.js';
|
|
10
|
+
import { guardedRead, readOwnDataNonEmptyString, readOwnDataValue } from '../ownKey.js';
|
|
9
11
|
import { steerBodyOf, UNOBSERVED_STEER_PRIORITY } from '../controlRouter.js';
|
|
10
12
|
import { atMostOnceFailureClass } from '../atMostOnce.js';
|
|
11
13
|
import { readSteerReceipt } from '../steerReceipt.js';
|
|
@@ -28,7 +30,7 @@ function gateKindReadingOf(row) {
|
|
|
28
30
|
return { leg: 'unreadable', kind: null };
|
|
29
31
|
}
|
|
30
32
|
if (typeof kind !== 'string' || kind === '')
|
|
31
|
-
return { leg: '
|
|
33
|
+
return { leg: 'unreadable', kind: null };
|
|
32
34
|
if (APPROVAL_LEG_GATE_KINDS.includes(kind))
|
|
33
35
|
return { leg: 'approval', kind };
|
|
34
36
|
if (PLAN_LEG_GATE_KINDS.includes(kind))
|
|
@@ -42,7 +44,7 @@ export function durableDecideLegOf(row) {
|
|
|
42
44
|
}
|
|
43
45
|
export function askParkForeignGateKind(row) {
|
|
44
46
|
const r = gateKindReadingOf(row);
|
|
45
|
-
return r.leg === 'approval'
|
|
47
|
+
return r.leg === 'approval' ? null : (r.kind ?? '(unreadable)');
|
|
46
48
|
}
|
|
47
49
|
export const PLAN_REVIEW_STATES = Object.freeze(['needs_review']);
|
|
48
50
|
export const ASK_PARK_STATES = Object.freeze(['suspended']);
|
|
@@ -70,12 +72,20 @@ export function selfHealSubmissionDisposition(outcome) {
|
|
|
70
72
|
return 'not-delivered';
|
|
71
73
|
case 'running-attach':
|
|
72
74
|
return 'not-delivered';
|
|
75
|
+
case 'injected-redundant':
|
|
76
|
+
return 'superseded';
|
|
77
|
+
case 'injected-deferred':
|
|
78
|
+
return 'deferred';
|
|
73
79
|
default:
|
|
74
80
|
return 'not-delivered';
|
|
75
81
|
}
|
|
76
82
|
}
|
|
77
83
|
export function steerFollowIntent(outcome) {
|
|
78
|
-
if (typeof outcome !== 'object' || outcome === null
|
|
84
|
+
if (typeof outcome !== 'object' || outcome === null)
|
|
85
|
+
return null;
|
|
86
|
+
if (outcome.kind === 'injected-redundant')
|
|
87
|
+
return { kind: 'follow-resumed', taskId: outcome.taskId };
|
|
88
|
+
if (outcome.kind !== 'running-steered')
|
|
79
89
|
return null;
|
|
80
90
|
const taskId = outcome.taskId;
|
|
81
91
|
if (outcome.delivery === 'queued')
|
|
@@ -84,6 +94,64 @@ export function steerFollowIntent(outcome) {
|
|
|
84
94
|
return { kind: 'after-wake', taskId };
|
|
85
95
|
return { kind: 'tail', taskId };
|
|
86
96
|
}
|
|
97
|
+
const injectedResubmitReleased = new WeakSet();
|
|
98
|
+
export function injectedResubmitAfter(outcome, runStatus) {
|
|
99
|
+
try {
|
|
100
|
+
if (typeof outcome !== 'object' || outcome === null || outcome.kind !== 'injected-deferred')
|
|
101
|
+
return false;
|
|
102
|
+
if (!isSdkRunTerminal(runStatus) && !isSdkRunParked(runStatus))
|
|
103
|
+
return false;
|
|
104
|
+
if (injectedResubmitReleased.has(outcome))
|
|
105
|
+
return false;
|
|
106
|
+
injectedResubmitReleased.add(outcome);
|
|
107
|
+
return true;
|
|
108
|
+
}
|
|
109
|
+
catch {
|
|
110
|
+
return false;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
const PLAN_REVIEW_CARRIER_KEY = '_sema_planReviewOutcome';
|
|
114
|
+
function planReviewCarrierOf(item) {
|
|
115
|
+
const meta = guardedRead(() => (typeof item === 'object' && item !== null && !Array.isArray(item) ? readOwnDataValue(item, PLAN_REVIEW_CARRIER_KEY) : undefined));
|
|
116
|
+
if (guardedRead(() => typeof meta === 'object' && meta !== null && !Array.isArray(meta)) !== true)
|
|
117
|
+
return null;
|
|
118
|
+
return { run: guardedRead(() => readOwnDataNonEmptyString(meta, 'taskId')) };
|
|
119
|
+
}
|
|
120
|
+
function injectedCarrierVerdict(items, busyTaskId) {
|
|
121
|
+
const length = guardedRead(() => (Array.isArray(items) ? readOwnDataValue(items, 'length') : undefined));
|
|
122
|
+
if (typeof length !== 'number' || !Number.isSafeInteger(length) || length <= 0)
|
|
123
|
+
return null;
|
|
124
|
+
const keys = guardedRead(() => Object.keys(items));
|
|
125
|
+
if (!Array.isArray(keys))
|
|
126
|
+
return null;
|
|
127
|
+
let present = 0;
|
|
128
|
+
let carriers = 0;
|
|
129
|
+
let allNameBusyRun = true;
|
|
130
|
+
for (let k = 0; k < keys.length; k++) {
|
|
131
|
+
const key = keys[k];
|
|
132
|
+
const index = Number(key);
|
|
133
|
+
if (typeof key !== 'string' || !Number.isSafeInteger(index) || index < 0 || index >= length || String(index) !== key)
|
|
134
|
+
continue;
|
|
135
|
+
present++;
|
|
136
|
+
const carrier = planReviewCarrierOf(guardedRead(() => readOwnDataValue(items, key)));
|
|
137
|
+
if (carrier === null) {
|
|
138
|
+
allNameBusyRun = false;
|
|
139
|
+
continue;
|
|
140
|
+
}
|
|
141
|
+
carriers++;
|
|
142
|
+
if (carrier.run === undefined || carrier.run !== busyTaskId)
|
|
143
|
+
allNameBusyRun = false;
|
|
144
|
+
}
|
|
145
|
+
if (carriers === 0)
|
|
146
|
+
return null;
|
|
147
|
+
return allNameBusyRun && present === length ? 'redundant' : 'deferred';
|
|
148
|
+
}
|
|
149
|
+
function injectedCarrierVerdictOf(deps, busyTaskId) {
|
|
150
|
+
return deps?.submissionOrigin === 'injected' ? injectedCarrierVerdict(guardedRead(() => deps?.injectedCarriers), busyTaskId) : null;
|
|
151
|
+
}
|
|
152
|
+
function runSettledOutcome(carrierVerdict, settled) {
|
|
153
|
+
return carrierVerdict === 'redundant' ? { kind: 'injected-redundant', taskId: settled.taskId } : settled;
|
|
154
|
+
}
|
|
87
155
|
function sessionOpts(deps) {
|
|
88
156
|
const sessionId = deps?.sessionId;
|
|
89
157
|
return typeof sessionId === 'string' && sessionId.length > 0 ? { session: sessionId } : {};
|
|
@@ -146,6 +214,7 @@ const REOPEN_VERDICT_KEYS = [
|
|
|
146
214
|
'_sema_errorCode',
|
|
147
215
|
'_sema_reopenRefusal',
|
|
148
216
|
'_sema_policyBlocked',
|
|
217
|
+
'_sema_rowVerdict',
|
|
149
218
|
];
|
|
150
219
|
function snapshotReopenVerdict(raw) {
|
|
151
220
|
if (raw === null || raw === undefined)
|
|
@@ -259,6 +328,16 @@ function reopenPolicyBlockedOf(verdict) {
|
|
|
259
328
|
return undefined;
|
|
260
329
|
}
|
|
261
330
|
}
|
|
331
|
+
function reopenRowVerdictOf(verdict) {
|
|
332
|
+
try {
|
|
333
|
+
if (verdict.reopened !== false)
|
|
334
|
+
return undefined;
|
|
335
|
+
return checkpointRowBarOf({ rowVerdict: verdict._sema_rowVerdict });
|
|
336
|
+
}
|
|
337
|
+
catch {
|
|
338
|
+
return undefined;
|
|
339
|
+
}
|
|
340
|
+
}
|
|
262
341
|
function reopenRefusalOf(verdict) {
|
|
263
342
|
try {
|
|
264
343
|
if (verdict.reopened !== false)
|
|
@@ -522,14 +601,15 @@ export async function attemptActiveRunSelfHeal(signal, runs, deps) {
|
|
|
522
601
|
detail: 'the engine did not name the run that holds this session',
|
|
523
602
|
};
|
|
524
603
|
}
|
|
604
|
+
const carrierVerdict = injectedCarrierVerdictOf(deps, taskId);
|
|
525
605
|
const gateKind = signal.pendingGate?.kind ?? null;
|
|
526
|
-
const gateLeg =
|
|
606
|
+
const gateLeg = durableDecideLegOf({ gateKind });
|
|
527
607
|
const pendingCp = signal.pendingGate?.checkpointId;
|
|
528
608
|
const sameTaskCp = pendingCp !== undefined && registeredPlanReviewCardFacts(DEFAULT_SESSION_KEY, taskId, pendingCp) !== undefined ? pendingCp : undefined;
|
|
529
609
|
if (gateLeg === 'plan_review')
|
|
530
610
|
return planReviewArm(taskId, signal, deps, sameTaskCp);
|
|
531
611
|
if (gateLeg === 'approval')
|
|
532
|
-
return askParkArm(taskId, signal, runs, deps);
|
|
612
|
+
return askParkArm(taskId, signal, runs, carrierVerdict, deps);
|
|
533
613
|
let status = signal.activeTaskStatus;
|
|
534
614
|
const statusFresh = status === null;
|
|
535
615
|
if (status === null) {
|
|
@@ -549,16 +629,16 @@ export async function attemptActiveRunSelfHeal(signal, runs, deps) {
|
|
|
549
629
|
return { kind: 'state-unknown', taskId, detail: 'the engine reported no status for that run' };
|
|
550
630
|
}
|
|
551
631
|
if (isSdkRunTerminal(status))
|
|
552
|
-
return { kind: 'running-settled', taskId, status };
|
|
632
|
+
return runSettledOutcome(carrierVerdict, { kind: 'running-settled', taskId, status });
|
|
553
633
|
const triageGate = signal.pendingGate && !statusFresh ? { pendingGateKind: signal.pendingGate.kind ?? null } : {};
|
|
554
634
|
if (gateKind !== null)
|
|
555
635
|
return { kind: 'not-parked', taskId, status, ...triageGate };
|
|
556
636
|
if (PLAN_REVIEW_STATES.includes(status))
|
|
557
637
|
return planReviewArm(taskId, signal, deps);
|
|
558
638
|
if (ASK_PARK_STATES.includes(status))
|
|
559
|
-
return askParkArm(taskId, signal, runs, deps);
|
|
639
|
+
return askParkArm(taskId, signal, runs, carrierVerdict, deps);
|
|
560
640
|
if (RUNNING_STATES.includes(status)) {
|
|
561
|
-
return runningChoiceArm(taskId, status, signal, signal.activeTaskStatus !== null, runs, deps);
|
|
641
|
+
return runningChoiceArm(taskId, status, signal, signal.activeTaskStatus !== null, runs, carrierVerdict, deps);
|
|
562
642
|
}
|
|
563
643
|
return { kind: 'not-parked', taskId, status, ...triageGate };
|
|
564
644
|
}
|
|
@@ -607,7 +687,7 @@ async function planReviewArm(taskId, signal, deps, checkpointId) {
|
|
|
607
687
|
...(reopenRefusal !== undefined ? { reopenRefusal } : {}),
|
|
608
688
|
};
|
|
609
689
|
}
|
|
610
|
-
async function askParkArm(taskId, signal, runs, deps) {
|
|
690
|
+
async function askParkArm(taskId, signal, runs, carrierVerdict, deps) {
|
|
611
691
|
const verdict = await askVerdict(taskId, deps);
|
|
612
692
|
if (reopenDelivered(verdict))
|
|
613
693
|
return { kind: 'ask-reopened', taskId, firstSight: verdict.firstSight === true };
|
|
@@ -631,17 +711,18 @@ async function askParkArm(taskId, signal, runs, deps) {
|
|
|
631
711
|
};
|
|
632
712
|
}
|
|
633
713
|
if (release.lastStatus !== null && RUNNING_STATES.includes(release.lastStatus)) {
|
|
634
|
-
return runningChoiceArm(taskId, release.lastStatus, signal, false, runs, deps);
|
|
714
|
+
return runningChoiceArm(taskId, release.lastStatus, signal, false, runs, carrierVerdict, deps);
|
|
635
715
|
}
|
|
636
716
|
return { kind: 'ask-decided-release-unknown', taskId, lastStatus: release.lastStatus };
|
|
637
717
|
}
|
|
638
718
|
const inFlight = reopenRefusedForDecisionInFlight(verdict);
|
|
639
719
|
if (verdict.reopened === false && verdict.decidedWithoutCard !== true && verdict.pendingRowGone === true && !inFlight) {
|
|
640
|
-
return staleParkArm(taskId, signal, runs, deps);
|
|
720
|
+
return staleParkArm(taskId, signal, runs, carrierVerdict, deps);
|
|
641
721
|
}
|
|
642
722
|
const noView = reopenRefusedForNoPresentationSurface(verdict);
|
|
643
723
|
const policyBlocked = inFlight || noView ? undefined : reopenPolicyBlockedOf(verdict);
|
|
644
|
-
const
|
|
724
|
+
const rowVerdict = inFlight ? undefined : reopenRowVerdictOf(verdict);
|
|
725
|
+
const errorCode = inFlight || noView || reopenRefusedForUserDismissal(verdict) || policyBlocked !== undefined || rowVerdict !== undefined ? undefined : reopenErrorCodeOf(verdict);
|
|
645
726
|
return {
|
|
646
727
|
kind: 'ask-reopen-failed',
|
|
647
728
|
taskId,
|
|
@@ -651,6 +732,7 @@ async function askParkArm(taskId, signal, runs, deps) {
|
|
|
651
732
|
...(noView ? { noPresentationSurface: true } : {}),
|
|
652
733
|
...(errorCode !== undefined ? { errorCode } : {}),
|
|
653
734
|
...(policyBlocked !== undefined ? { policyBlocked } : {}),
|
|
735
|
+
...(rowVerdict !== undefined ? { rowVerdict } : {}),
|
|
654
736
|
};
|
|
655
737
|
}
|
|
656
738
|
async function probeRunStatusOnce(taskId, durable, durableGet, deps) {
|
|
@@ -677,7 +759,7 @@ async function probeRunStatusOnce(taskId, durable, durableGet, deps) {
|
|
|
677
759
|
status = readStatusGuarded(record);
|
|
678
760
|
return errorCode !== undefined ? { status, ghost, errorCode } : { status, ghost };
|
|
679
761
|
}
|
|
680
|
-
async function staleParkArm(taskId, busy, runs, deps) {
|
|
762
|
+
async function staleParkArm(taskId, busy, runs, carrierVerdict, deps) {
|
|
681
763
|
const reopenFailed = {
|
|
682
764
|
kind: 'ask-reopen-failed',
|
|
683
765
|
taskId,
|
|
@@ -705,11 +787,11 @@ async function staleParkArm(taskId, busy, runs, deps) {
|
|
|
705
787
|
if (fresh === null)
|
|
706
788
|
return withFailureCode(reopenFailed, first.errorCode);
|
|
707
789
|
if (RUNNING_STATES.includes(fresh))
|
|
708
|
-
return runningChoiceArm(taskId, fresh, busy, false, runs, deps);
|
|
790
|
+
return runningChoiceArm(taskId, fresh, busy, false, runs, carrierVerdict, deps);
|
|
709
791
|
if (PLAN_REVIEW_STATES.includes(fresh))
|
|
710
792
|
return planReviewArm(taskId, busy, deps);
|
|
711
793
|
if (isSdkRunTerminal(fresh))
|
|
712
|
-
return { kind: 'ask-run-settled', taskId, status: fresh };
|
|
794
|
+
return runSettledOutcome(carrierVerdict, { kind: 'ask-run-settled', taskId, status: fresh });
|
|
713
795
|
if (!ASK_PARK_STATES.includes(fresh))
|
|
714
796
|
return reopenFailed;
|
|
715
797
|
const offer = deps?.offerStaleParkChoice;
|
|
@@ -748,7 +830,7 @@ async function staleParkArm(taskId, busy, runs, deps) {
|
|
|
748
830
|
return withFailureCode(reopenFailedAfterCard, afterCard.errorCode);
|
|
749
831
|
if (!ASK_PARK_STATES.includes(afterCard.status)) {
|
|
750
832
|
if (isSdkRunTerminal(afterCard.status))
|
|
751
|
-
return { kind: 'ask-run-settled', taskId, status: afterCard.status };
|
|
833
|
+
return runSettledOutcome(carrierVerdict, { kind: 'ask-run-settled', taskId, status: afterCard.status });
|
|
752
834
|
if (RUNNING_STATES.includes(afterCard.status))
|
|
753
835
|
return { kind: 'not-parked', taskId, status: afterCard.status };
|
|
754
836
|
return !CLAIM_HELD_STATES.includes(afterCard.status) ? reopenFailed : reopenFailedAfterCard;
|
|
@@ -810,7 +892,7 @@ async function cancelAndConfirmRelease(taskId, durable, durableGet, deps) {
|
|
|
810
892
|
(verdict.lastStatus !== null && CLAIM_HELD_STATES.includes(verdict.lastStatus)),
|
|
811
893
|
};
|
|
812
894
|
}
|
|
813
|
-
async function runningChoiceArm(taskId, status, busy, statusFromWire, runs, deps) {
|
|
895
|
+
async function runningChoiceArm(taskId, status, busy, statusFromWire, runs, carrierVerdict, deps) {
|
|
814
896
|
const notParked = { kind: 'not-parked', taskId, status };
|
|
815
897
|
const offer = deps?.offerRunningChoice;
|
|
816
898
|
const injected = deps?.submissionOrigin === 'injected';
|
|
@@ -820,9 +902,9 @@ async function runningChoiceArm(taskId, status, busy, statusFromWire, runs, deps
|
|
|
820
902
|
const canSteer = typeof runs?.steer === 'function' && text.length > 0;
|
|
821
903
|
const canCancel = typeof runs?.cancel === 'function' && typeof runs?.get === 'function';
|
|
822
904
|
const canAttach = runningAttachOffered(deps?.canAttachRunning);
|
|
823
|
-
if (!canSteer && !canCancel && !canAttach)
|
|
905
|
+
if (!canSteer && !canCancel && !canAttach && carrierVerdict === null)
|
|
824
906
|
return notParked;
|
|
825
|
-
if (injected && !canSteer)
|
|
907
|
+
if (injected && !canSteer && carrierVerdict === null)
|
|
826
908
|
return notParked;
|
|
827
909
|
const probeCallerAborted = () => deps?.signal?.aborted === true;
|
|
828
910
|
if (statusFromWire && typeof runs?.get === 'function' && !probeCallerAborted()) {
|
|
@@ -833,7 +915,7 @@ async function runningChoiceArm(taskId, status, busy, statusFromWire, runs, deps
|
|
|
833
915
|
if (probeCallerAborted())
|
|
834
916
|
return notParked;
|
|
835
917
|
if (fresh !== null) {
|
|
836
|
-
const routed = await routeFreshNonRunning(fresh, taskId, busy, runs, deps);
|
|
918
|
+
const routed = await routeFreshNonRunning(fresh, taskId, busy, runs, deps, carrierVerdict);
|
|
837
919
|
if (routed !== undefined)
|
|
838
920
|
return routed;
|
|
839
921
|
}
|
|
@@ -847,6 +929,10 @@ async function runningChoiceArm(taskId, status, busy, statusFromWire, runs, deps
|
|
|
847
929
|
if (injected) {
|
|
848
930
|
if (probeCallerAborted())
|
|
849
931
|
return notParked;
|
|
932
|
+
if (carrierVerdict === 'redundant')
|
|
933
|
+
return { kind: 'injected-redundant', taskId };
|
|
934
|
+
if (carrierVerdict === 'deferred')
|
|
935
|
+
return { kind: 'injected-deferred', taskId };
|
|
850
936
|
choice = 'steer';
|
|
851
937
|
}
|
|
852
938
|
else if (typeof offer === 'function') {
|
|
@@ -870,16 +956,17 @@ async function runningChoiceArm(taskId, status, busy, statusFromWire, runs, deps
|
|
|
870
956
|
if (choice === 'steer' && canSteer && runs?.steer !== undefined) {
|
|
871
957
|
try {
|
|
872
958
|
const receipt = await runs.steer(taskId, steerBodyOf({ text }, UNOBSERVED_STEER_PRIORITY), sessionOpts(deps));
|
|
873
|
-
const { delivery, status: receiptStatus } = readSteerReceipt(receipt);
|
|
959
|
+
const { delivery, status: receiptStatus, messageId } = readSteerReceipt(receipt);
|
|
960
|
+
const handedId = messageId !== undefined ? { messageId } : {};
|
|
874
961
|
if (delivery === 'queued') {
|
|
875
962
|
const verdict = receiptStatus !== null && PLAN_REVIEW_STATES.includes(receiptStatus)
|
|
876
963
|
? await planVerdict(taskId, deps)
|
|
877
964
|
: receiptStatus !== null && ASK_PARK_STATES.includes(receiptStatus)
|
|
878
965
|
? await askVerdict(taskId, deps)
|
|
879
966
|
: null;
|
|
880
|
-
return { kind: 'running-steered', taskId, delivery, status: receiptStatus, reopened: verdict };
|
|
967
|
+
return { kind: 'running-steered', taskId, delivery, status: receiptStatus, reopened: verdict, ...handedId };
|
|
881
968
|
}
|
|
882
|
-
return { kind: 'running-steered', taskId, delivery, status: receiptStatus, reopened: null };
|
|
969
|
+
return { kind: 'running-steered', taskId, delivery, status: receiptStatus, reopened: null, ...handedId };
|
|
883
970
|
}
|
|
884
971
|
catch (e) {
|
|
885
972
|
const delivery = atMostOnceFailureClass(e);
|
|
@@ -908,7 +995,7 @@ async function runningChoiceArm(taskId, status, busy, statusFromWire, runs, deps
|
|
|
908
995
|
return { kind: 'running-not-found', taskId };
|
|
909
996
|
if (probeCallerAborted() || preFire.status === null)
|
|
910
997
|
return notParked;
|
|
911
|
-
const rerouted = await routeFreshNonRunning(preFire.status, taskId, busy, runs, deps);
|
|
998
|
+
const rerouted = await routeFreshNonRunning(preFire.status, taskId, busy, runs, deps, carrierVerdict);
|
|
912
999
|
if (rerouted !== undefined)
|
|
913
1000
|
return rerouted;
|
|
914
1001
|
const verdict = await cancelAndConfirmRelease(taskId, runs, runs.get, deps);
|
|
@@ -930,15 +1017,15 @@ async function runningChoiceArm(taskId, status, busy, statusFromWire, runs, deps
|
|
|
930
1017
|
return { kind: 'running-attach', taskId };
|
|
931
1018
|
return notParked;
|
|
932
1019
|
}
|
|
933
|
-
async function routeFreshNonRunning(fresh, taskId, busy, runs, deps) {
|
|
1020
|
+
async function routeFreshNonRunning(fresh, taskId, busy, runs, deps, carrierVerdict) {
|
|
934
1021
|
if (RUNNING_STATES.includes(fresh))
|
|
935
1022
|
return undefined;
|
|
936
1023
|
if (PLAN_REVIEW_STATES.includes(fresh))
|
|
937
1024
|
return planReviewArm(taskId, busy, deps);
|
|
938
1025
|
if (ASK_PARK_STATES.includes(fresh))
|
|
939
|
-
return askParkArm(taskId, busy, runs, deps);
|
|
1026
|
+
return askParkArm(taskId, busy, runs, carrierVerdict, deps);
|
|
940
1027
|
if (isSdkRunTerminal(fresh))
|
|
941
|
-
return { kind: 'running-settled', taskId, status: fresh };
|
|
1028
|
+
return runSettledOutcome(carrierVerdict, { kind: 'running-settled', taskId, status: fresh });
|
|
942
1029
|
return { kind: 'not-parked', taskId, status: fresh };
|
|
943
1030
|
}
|
|
944
1031
|
export const INTERACTIVE_WAY_OUT = EN_MESSAGES['session.selfHeal.wayOut.interactive'];
|
|
@@ -998,7 +1085,7 @@ export function activeRunSelfHealRow(outcome, signal, copy, origin, follow, lang
|
|
|
998
1085
|
if (typeof override === 'string')
|
|
999
1086
|
return override;
|
|
1000
1087
|
const following = follow?.following === true && steerFollowIntent(outcome)?.kind === 'tail';
|
|
1001
|
-
if (origin === 'injected')
|
|
1088
|
+
if (origin === 'injected' || outcome.kind === 'injected-redundant' || outcome.kind === 'injected-deferred')
|
|
1002
1089
|
return injectedSubmissionRow(outcome, following, lang);
|
|
1003
1090
|
const engineDecide = copy?.engineDecidePath !== false;
|
|
1004
1091
|
const keep = (outcome.kind === 'plan-review-reopen-failed' || outcome.kind === 'ask-reopen-failed') &&
|
|
@@ -1071,6 +1158,10 @@ function injectedSubmissionRow(outcome, following = false, lang) {
|
|
|
1071
1158
|
return following
|
|
1072
1159
|
? say(lang, 'session.selfHeal.injected.handedOffFollowing', { lead, id })
|
|
1073
1160
|
: say(lang, 'session.selfHeal.injected.handedOffWatch', { lead, id });
|
|
1161
|
+
case 'superseded':
|
|
1162
|
+
return say(lang, 'session.selfHeal.injected.redundant', { lead, id });
|
|
1163
|
+
case 'deferred':
|
|
1164
|
+
return say(lang, 'session.selfHeal.injected.deferred', { lead, id });
|
|
1074
1165
|
case 'not-delivered': {
|
|
1075
1166
|
const noView = (outcome.kind === 'ask-reopen-failed' || outcome.kind === 'plan-review-reopen-failed') && outcome.noPresentationSurface === true
|
|
1076
1167
|
? msg('session.selfHeal.noCardView.inParens')
|
|
@@ -1120,6 +1211,13 @@ function activeRunSelfHealBaseRow(outcome, wayOut, following = false, keepSessio
|
|
|
1120
1211
|
case 'ask-reopen-failed': {
|
|
1121
1212
|
if (outcome.decisionInFlight === true)
|
|
1122
1213
|
return decisionInFlightRow('ask', outcome.taskId, lang);
|
|
1214
|
+
if (outcome.rowVerdict !== undefined) {
|
|
1215
|
+
return say(lang, 'session.selfHeal.row.askReopenFailed.rowUnresumable', {
|
|
1216
|
+
taskId: outcome.taskId,
|
|
1217
|
+
sentence: checkpointRowBarSentence(outcome.rowVerdict),
|
|
1218
|
+
unbound: msg('approval.decide.unboundWayOut'),
|
|
1219
|
+
});
|
|
1220
|
+
}
|
|
1123
1221
|
if (outcome.policyBlocked !== undefined)
|
|
1124
1222
|
return askParkAutoReopenBlockedContent(outcome.policyBlocked, outcome.taskId, 'interactive', lang);
|
|
1125
1223
|
const viaEngine = engineDecide && outcome.decidePath ? msg('session.selfHeal.viaEngine', { decidePath: outcome.decidePath }) : '';
|
|
@@ -1182,6 +1280,9 @@ function activeRunSelfHealBaseRow(outcome, wayOut, following = false, keepSessio
|
|
|
1182
1280
|
return outcome.delivery === 'rejected'
|
|
1183
1281
|
? say(lang, 'session.selfHeal.row.steerFailed.rejected', { taskId: outcome.taskId, detail: outcome.detail })
|
|
1184
1282
|
: say(lang, 'session.selfHeal.row.steerFailed.unknown', { taskId: outcome.taskId, detail: outcome.detail });
|
|
1283
|
+
case 'injected-redundant':
|
|
1284
|
+
case 'injected-deferred':
|
|
1285
|
+
return injectedSubmissionRow(outcome, following, lang);
|
|
1185
1286
|
case 'running-attach':
|
|
1186
1287
|
return say(lang, 'session.selfHeal.row.attach', { disclosure: resumeAttachReplayDisclosure(outcome.taskId) });
|
|
1187
1288
|
case 'running-cancelled':
|
|
@@ -60,11 +60,6 @@ export interface WiringManifestAutoConsolidationView {
|
|
|
60
60
|
export interface WiringManifestReadDenyView {
|
|
61
61
|
builtinTiers: readonly string[];
|
|
62
62
|
}
|
|
63
|
-
export interface WiringManifestHookEntryView {
|
|
64
|
-
family: string;
|
|
65
|
-
owner: string;
|
|
66
|
-
observational?: true;
|
|
67
|
-
}
|
|
68
63
|
export interface WiringManifestLspSeamView {
|
|
69
64
|
mounted: boolean;
|
|
70
65
|
lane?: string;
|
|
@@ -42,7 +42,9 @@ export const INTERNAL_SDK_ARM_TYPES = frozenSet([
|
|
|
42
42
|
'wiring_manifest',
|
|
43
43
|
'approval_request',
|
|
44
44
|
'approval_revoke',
|
|
45
|
+
'approval_complete',
|
|
45
46
|
'message_committed',
|
|
47
|
+
'session_titled',
|
|
46
48
|
]);
|
|
47
49
|
function assistantArm(ctx, content, eventId, parentToolCallId, recovered) {
|
|
48
50
|
const id = typeof eventId === 'string' && eventId.length > 0 ? eventId : undefined;
|
|
@@ -113,7 +115,14 @@ function projectEvent(ev, ctx) {
|
|
|
113
115
|
return compactionStartedProjection(ev, ctx);
|
|
114
116
|
if (isBeyondFloorArm(ev)) {
|
|
115
117
|
const word = ev.type;
|
|
116
|
-
|
|
118
|
+
if (word === 'cross_boundary_taint')
|
|
119
|
+
return nothing('not_in_slice');
|
|
120
|
+
if (word === 'session_titled')
|
|
121
|
+
return sessionTitledProjection(ev, ctx);
|
|
122
|
+
const body = approvalFrameBody(ev);
|
|
123
|
+
if (body === undefined)
|
|
124
|
+
return dropped('malformed', 'approval_complete');
|
|
125
|
+
return projected(internalArmExit(stamp(ctx, armBody({ type: 'approval_complete', ...body }))));
|
|
117
126
|
}
|
|
118
127
|
switch (ev.type) {
|
|
119
128
|
case 'task_started':
|
|
@@ -632,7 +641,6 @@ function wiringManifestSupersetBody(ev) {
|
|
|
632
641
|
const autoMode = projectAutoModeSection(ev.autoMode);
|
|
633
642
|
const mcp = projectMcpSection(ev.mcp);
|
|
634
643
|
const tools = projectToolRoster(ev);
|
|
635
|
-
const hooks = projectHooksSection(ev.hooks);
|
|
636
644
|
const lsp = projectLspSection(ev.lsp);
|
|
637
645
|
const writeProtection = projectWriteProtectionSection(ev.writeProtection);
|
|
638
646
|
const autoConsolidation = projectAutoConsolidationSection(ev.autoConsolidation);
|
|
@@ -642,14 +650,13 @@ function wiringManifestSupersetBody(ev) {
|
|
|
642
650
|
const instructions = readInstructionsSegment(ev, 'instructions');
|
|
643
651
|
const fleet = readFleetSegment(ev, 'fleet');
|
|
644
652
|
const mods = projectModsSection(ev);
|
|
645
|
-
if (modelGate === undefined && autoMode === undefined && mcp === undefined && tools === undefined &&
|
|
653
|
+
if (modelGate === undefined && autoMode === undefined && mcp === undefined && tools === undefined && lsp === undefined && writeProtection === undefined && autoConsolidation === undefined && readDeny === undefined && hands === undefined && fileHistory === undefined && instructions === undefined && fleet === undefined && mods === undefined)
|
|
646
654
|
return undefined;
|
|
647
655
|
return {
|
|
648
656
|
...(modelGate !== undefined ? { _sema_modelGate: modelGate } : {}),
|
|
649
657
|
...(autoMode !== undefined ? { _sema_autoMode: autoMode } : {}),
|
|
650
658
|
...(mcp !== undefined ? { _sema_mcp: mcp } : {}),
|
|
651
659
|
...(tools !== undefined ? { _sema_tools: tools } : {}),
|
|
652
|
-
...(hooks !== undefined ? { _sema_hooks: hooks } : {}),
|
|
653
660
|
...(lsp !== undefined ? { _sema_lsp: lsp } : {}),
|
|
654
661
|
...(writeProtection !== undefined ? { _sema_writeProtection: writeProtection } : {}),
|
|
655
662
|
...(autoConsolidation !== undefined ? { _sema_autoConsolidation: autoConsolidation } : {}),
|
|
@@ -710,20 +717,6 @@ function projectModsSection(holder) {
|
|
|
710
717
|
return undefined;
|
|
711
718
|
}
|
|
712
719
|
}
|
|
713
|
-
function projectHooksSection(raw) {
|
|
714
|
-
if (!Array.isArray(raw))
|
|
715
|
-
return undefined;
|
|
716
|
-
const rows = [];
|
|
717
|
-
for (const r of raw) {
|
|
718
|
-
if (typeof r !== 'object' || r === null || Array.isArray(r))
|
|
719
|
-
continue;
|
|
720
|
-
const o = r;
|
|
721
|
-
if (typeof o.family !== 'string' || o.family.length === 0 || typeof o.owner !== 'string' || o.owner.length === 0)
|
|
722
|
-
continue;
|
|
723
|
-
rows.push({ family: o.family, owner: o.owner, ...(o.observational === true ? { observational: true } : {}) });
|
|
724
|
-
}
|
|
725
|
-
return rows.length > 0 ? rows : undefined;
|
|
726
|
-
}
|
|
727
720
|
function projectLspSection(raw) {
|
|
728
721
|
if (typeof raw !== 'object' || raw === null || Array.isArray(raw))
|
|
729
722
|
return undefined;
|
|
@@ -809,6 +802,13 @@ function compactionOutcomeProjection(frame, ctx) {
|
|
|
809
802
|
...identity,
|
|
810
803
|
}))));
|
|
811
804
|
}
|
|
805
|
+
function sessionTitledProjection(frame, ctx) {
|
|
806
|
+
const sessionId = guardedRead(() => readOwnDataNonEmptyString(frame, 'sessionId'));
|
|
807
|
+
const title = guardedRead(() => readOwnDataNonEmptyString(frame, 'title'));
|
|
808
|
+
if (sessionId === undefined || title === undefined)
|
|
809
|
+
return dropped('malformed', 'session_titled');
|
|
810
|
+
return projected(internalArmExit(stamp(ctx, armBody({ type: 'session_titled', sessionId, title }))));
|
|
811
|
+
}
|
|
812
812
|
function compactionStartedProjection(frame, ctx) {
|
|
813
813
|
const ev = frame;
|
|
814
814
|
const { identity, bad } = identityOrMalformed(ev, 'compaction_started');
|
|
@@ -917,7 +917,8 @@ function engineNoticeProjection(ev, ctx) {
|
|
|
917
917
|
...(seq !== undefined ? { eventSeq: seq } : {}),
|
|
918
918
|
})));
|
|
919
919
|
}
|
|
920
|
-
function approvalFrameBody(
|
|
920
|
+
function approvalFrameBody(frame) {
|
|
921
|
+
const ev = frame;
|
|
921
922
|
const schemaVersion = typeof ev.schemaVersion === 'number' && Number.isFinite(ev.schemaVersion)
|
|
922
923
|
? ev.schemaVersion
|
|
923
924
|
: undefined;
|
|
@@ -702,12 +702,11 @@ export function doneToSdkResult(ev, ctx, observed) {
|
|
|
702
702
|
}
|
|
703
703
|
function doneToSdkResultBody(ev, ctx, observed) {
|
|
704
704
|
const view = doneResultView(ev.result);
|
|
705
|
-
const rRaw = view.
|
|
705
|
+
const rRaw = view.body;
|
|
706
706
|
const rec = typeof rRaw === 'object' && rRaw !== null ? rRaw : {};
|
|
707
707
|
const r = rec;
|
|
708
708
|
const stats = r.stats;
|
|
709
|
-
const
|
|
710
|
-
const echoedSid = typeof nestedSid === 'string' && nestedSid.length > 0 ? nestedSid : view.row?.sessionId;
|
|
709
|
+
const echoedSid = r.sessionId;
|
|
711
710
|
if (typeof echoedSid === 'string' && echoedSid.length > 0)
|
|
712
711
|
ctx.sessionId = echoedSid;
|
|
713
712
|
const terminal = readRunTerminal(ev.result);
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import type { WiringManifestModelGate, WiringManifestAutoMode, WiringManifestMcpEntryView,
|
|
1
|
+
import type { WiringManifestModelGate, WiringManifestAutoMode, WiringManifestMcpEntryView, WiringManifestLspSeamView, WiringManifestWriteProtectionView, WiringManifestAutoConsolidationView, WiringManifestReadDenyView, WiringManifestModView } from './eventToSdkMessage.js';
|
|
2
2
|
import type { ToolRosterView, WiringManifestHandsView } from '../../toolRoster.js';
|
|
3
3
|
export type WiringManifestSections = {
|
|
4
4
|
_sema_modelGate?: WiringManifestModelGate;
|
|
5
5
|
_sema_autoMode?: WiringManifestAutoMode;
|
|
6
6
|
_sema_mcp?: WiringManifestMcpEntryView[];
|
|
7
7
|
_sema_tools?: ToolRosterView;
|
|
8
|
-
_sema_hooks?: WiringManifestHookEntryView[];
|
|
9
8
|
_sema_lsp?: WiringManifestLspSeamView;
|
|
10
9
|
_sema_writeProtection?: WiringManifestWriteProtectionView;
|
|
11
10
|
_sema_autoConsolidation?: WiringManifestAutoConsolidationView;
|
|
@@ -27,7 +26,6 @@ export interface WiringManifestView {
|
|
|
27
26
|
autoMode?: WiringManifestAutoMode;
|
|
28
27
|
mcp?: readonly WiringManifestMcpEntryView[];
|
|
29
28
|
tools?: ToolRosterView;
|
|
30
|
-
hooks?: readonly WiringManifestHookEntryView[];
|
|
31
29
|
lsp?: WiringManifestLspSeamView;
|
|
32
30
|
writeProtection?: WiringManifestWriteProtectionView;
|
|
33
31
|
autoConsolidation?: WiringManifestAutoConsolidationView;
|
|
@@ -51,7 +51,6 @@ export function wiringManifestViewOf(s) {
|
|
|
51
51
|
...(isObj(s._sema_autoMode) ? { autoMode: s._sema_autoMode } : {}),
|
|
52
52
|
...(Array.isArray(s._sema_mcp) ? { mcp: s._sema_mcp } : {}),
|
|
53
53
|
...(isObj(s._sema_tools) ? { tools: s._sema_tools } : {}),
|
|
54
|
-
...(Array.isArray(s._sema_hooks) ? { hooks: s._sema_hooks } : {}),
|
|
55
54
|
...(isObj(s._sema_lsp) ? { lsp: s._sema_lsp } : {}),
|
|
56
55
|
...(isObj(s._sema_writeProtection) ? { writeProtection: s._sema_writeProtection } : {}),
|
|
57
56
|
...(isObj(s._sema_autoConsolidation) ? { autoConsolidation: s._sema_autoConsolidation } : {}),
|