@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
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { readErrorNumber, readErrorString } from './wireFailureShape.js';
|
|
2
2
|
import { readOwnDataNonEmptyString } from './ownKey.js';
|
|
3
|
-
import { RESUME_CONTEXT_UNAVAILABLE, RESUME_PLACEMENT_MISMATCH, RESUME_PREFLIGHT_REJECTED, RESUME_POLICY_FOLD_CODE, PARKED_RESUME_STARTUP_FAILED, isStatusDerivedCoarseCode, RESUME_SESSION_NOT_FOUND, REQUEST_FIELD_CONFLICT, CHECKPOINT_UNSUPPORTED_VERSION, refusalSaysStillPending, } from './engineErrorCodes.js';
|
|
3
|
+
import { RESUME_CONTEXT_UNAVAILABLE, RESUME_PLACEMENT_MISMATCH, RESUME_PREFLIGHT_REJECTED, RESUME_POLICY_FOLD_CODE, PARKED_RESUME_STARTUP_FAILED, isStatusDerivedCoarseCode, RESUME_SESSION_NOT_FOUND, REQUEST_FIELD_CONFLICT, CHECKPOINT_UNSUPPORTED_VERSION, CHECKPOINT_WALLTIME_AXIS_RETIRED, CHECKPOINT_CONFIG_REFUSED, refusalSaysStillPending, refusalRetriableReading, } from './engineErrorCodes.js';
|
|
4
4
|
import { capForDisplay } from './fleetTaskDesc.js';
|
|
5
|
+
import { engineVersionTier } from './supportFloor.js';
|
|
5
6
|
import { resumeRetryLaterFromError } from './wireErrorTriage.js';
|
|
6
7
|
export const RESUME_REFUSAL_CODES = Object.freeze([
|
|
7
8
|
RESUME_PLACEMENT_MISMATCH,
|
|
@@ -87,10 +88,9 @@ export function resumePolicyBlockContent(detail) {
|
|
|
87
88
|
].join(' · ');
|
|
88
89
|
}
|
|
89
90
|
export { resumeReopenFromError, resumeReopenContent } from './hitl/suspendedReopen.js';
|
|
90
|
-
const RESUME_SESSION_NOT_FOUND_TAIL = `(${RESUME_SESSION_NOT_FOUND})`;
|
|
91
91
|
const REQUIRE_EXISTING_BY_STATUS = new Map([
|
|
92
|
-
[404, Object.freeze({ form: 'session_not_found', code: RESUME_SESSION_NOT_FOUND
|
|
93
|
-
[422, Object.freeze({ form: 'session_id_missing', code: REQUEST_FIELD_CONFLICT
|
|
92
|
+
[404, Object.freeze({ form: 'session_not_found', code: RESUME_SESSION_NOT_FOUND })],
|
|
93
|
+
[422, Object.freeze({ form: 'session_id_missing', code: REQUEST_FIELD_CONFLICT })],
|
|
94
94
|
]);
|
|
95
95
|
export function requireExistingSessionRefusalFromError(err) {
|
|
96
96
|
if (typeof err !== 'object' || err === null)
|
|
@@ -101,15 +101,7 @@ export function requireExistingSessionRefusalFromError(err) {
|
|
|
101
101
|
const byStatus = typeof status === 'number' ? REQUIRE_EXISTING_BY_STATUS.get(status) : undefined;
|
|
102
102
|
if (byStatus === undefined)
|
|
103
103
|
return null;
|
|
104
|
-
|
|
105
|
-
if (code === byStatus.code)
|
|
106
|
-
return Object.freeze({ code: RESUME_SESSION_NOT_FOUND, form: byStatus.form });
|
|
107
|
-
if (code !== byStatus.coarse)
|
|
108
|
-
return null;
|
|
109
|
-
const message = o['message'];
|
|
110
|
-
return typeof message === 'string' && message.endsWith(RESUME_SESSION_NOT_FOUND_TAIL)
|
|
111
|
-
? Object.freeze({ code: RESUME_SESSION_NOT_FOUND, form: byStatus.form })
|
|
112
|
-
: null;
|
|
104
|
+
return o['errorCode'] === byStatus.code ? Object.freeze({ code: RESUME_SESSION_NOT_FOUND, form: byStatus.form }) : null;
|
|
113
105
|
}
|
|
114
106
|
catch {
|
|
115
107
|
return null;
|
|
@@ -221,7 +213,15 @@ export function checkpointUnsupportedVersionFromError(err) {
|
|
|
221
213
|
}
|
|
222
214
|
if (code !== CHECKPOINT_UNSUPPORTED_VERSION || !refusalSaysStillPending(err))
|
|
223
215
|
return null;
|
|
224
|
-
|
|
216
|
+
const writerVersion = readErrorString(err, 'writerVersion');
|
|
217
|
+
const readerVersion = readErrorString(err, 'readerVersion');
|
|
218
|
+
const versions = writerVersion !== undefined && writerVersion !== '' && readerVersion !== undefined && readerVersion !== '' ? { writerVersion, readerVersion } : {};
|
|
219
|
+
return { code: CHECKPOINT_UNSUPPORTED_VERSION, retriable: true, ...versions };
|
|
220
|
+
}
|
|
221
|
+
function writerEngineIsNewer(writer, reader) {
|
|
222
|
+
if (engineVersionTier(writer) === 'unknown' || engineVersionTier(reader) !== 'engine')
|
|
223
|
+
return false;
|
|
224
|
+
return engineVersionTier(reader, writer) === 'legacy';
|
|
225
225
|
}
|
|
226
226
|
function checkpointUnsupportedHasRun(kind) {
|
|
227
227
|
switch (kind) {
|
|
@@ -240,7 +240,23 @@ const CHECKPOINT_UNSUPPORTED_WHAT = 'This server cannot continue this parked wor
|
|
|
240
240
|
const CHECKPOINT_UNSUPPORTED_STILL_WAITING = 'Nothing was decided or resumed and the parked work is still waiting, but sending the same request again will not by itself continue it';
|
|
241
241
|
const CHECKPOINT_UNSUPPORTED_DRAIN = " — whoever operates this deployment can find such parked work before an upgrade with the server's pre-upgrade drain check";
|
|
242
242
|
export function checkpointUnsupportedVersionContent(detail, ctx) {
|
|
243
|
-
|
|
243
|
+
let writer;
|
|
244
|
+
let reader;
|
|
245
|
+
try {
|
|
246
|
+
writer = detail.writerVersion;
|
|
247
|
+
reader = detail.readerVersion;
|
|
248
|
+
}
|
|
249
|
+
catch {
|
|
250
|
+
writer = undefined;
|
|
251
|
+
reader = undefined;
|
|
252
|
+
}
|
|
253
|
+
if (writerEngineIsNewer(writer, reader)) {
|
|
254
|
+
return [
|
|
255
|
+
`This parked work was stored by a newer engine version (${String(writer)}) than this engine (${String(reader)})`,
|
|
256
|
+
CHECKPOINT_UNSUPPORTED_STILL_WAITING,
|
|
257
|
+
`Continue it on an engine at version ${String(writer)} or newer`,
|
|
258
|
+
].join(' · ');
|
|
259
|
+
}
|
|
244
260
|
let kind;
|
|
245
261
|
let runId;
|
|
246
262
|
try {
|
|
@@ -266,3 +282,98 @@ export function checkpointUnsupportedVersionContent(detail, ctx) {
|
|
|
266
282
|
}
|
|
267
283
|
return [CHECKPOINT_UNSUPPORTED_WHAT, CHECKPOINT_UNSUPPORTED_STILL_WAITING, outlet + CHECKPOINT_UNSUPPORTED_DRAIN].join(' · ');
|
|
268
284
|
}
|
|
285
|
+
const REFUSED_PARK_CODES = new Set([CHECKPOINT_UNSUPPORTED_VERSION, CHECKPOINT_WALLTIME_AXIS_RETIRED, CHECKPOINT_CONFIG_REFUSED]);
|
|
286
|
+
const REFUSED_PARK_FIELD_TOKEN = /^[A-Za-z][A-Za-z0-9_]{0,63}$/;
|
|
287
|
+
export function refusedParkFromError(failure) {
|
|
288
|
+
if (typeof failure !== 'object' || failure === null)
|
|
289
|
+
return null;
|
|
290
|
+
let code;
|
|
291
|
+
let status;
|
|
292
|
+
try {
|
|
293
|
+
code = failure.errorCode;
|
|
294
|
+
status = failure.status;
|
|
295
|
+
}
|
|
296
|
+
catch {
|
|
297
|
+
return null;
|
|
298
|
+
}
|
|
299
|
+
if (typeof code !== 'string' || !REFUSED_PARK_CODES.has(code))
|
|
300
|
+
return null;
|
|
301
|
+
if (status !== undefined && status !== 409)
|
|
302
|
+
return null;
|
|
303
|
+
const reading = refusalRetriableReading(failure);
|
|
304
|
+
const stillPending = reading === true ? true : status === 409 && reading === false ? false : undefined;
|
|
305
|
+
const rawField = code === CHECKPOINT_CONFIG_REFUSED ? readErrorString(failure, 'field') : undefined;
|
|
306
|
+
const field = rawField !== undefined && REFUSED_PARK_FIELD_TOKEN.test(rawField) ? rawField : undefined;
|
|
307
|
+
return Object.freeze({
|
|
308
|
+
code: code,
|
|
309
|
+
...(field !== undefined ? { field } : {}),
|
|
310
|
+
...(stillPending !== undefined ? { stillPending } : {}),
|
|
311
|
+
});
|
|
312
|
+
}
|
|
313
|
+
function refusedParkShownRunId(runId) {
|
|
314
|
+
return typeof runId === 'string' && /^[A-Za-z0-9._:-]{1,128}$/.test(runId) ? runId : undefined;
|
|
315
|
+
}
|
|
316
|
+
function refusedParkWhy(code, field) {
|
|
317
|
+
switch (code) {
|
|
318
|
+
case CHECKPOINT_WALLTIME_AXIS_RETIRED:
|
|
319
|
+
return 'its run carries a wall-clock time allowance, which this engine version no longer enforces';
|
|
320
|
+
case CHECKPOINT_CONFIG_REFUSED:
|
|
321
|
+
return field === 'inheritedGate'
|
|
322
|
+
? 'the permission-mode setting it was parked with can no longer be read'
|
|
323
|
+
: 'the engine refuses the task configuration it was parked with';
|
|
324
|
+
default:
|
|
325
|
+
return 'it was parked under conditions this engine version does not support (for example, by an earlier engine version)';
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
export function refusedParkContent(input) {
|
|
329
|
+
let what;
|
|
330
|
+
let lane;
|
|
331
|
+
let runId;
|
|
332
|
+
let rawCode;
|
|
333
|
+
let field;
|
|
334
|
+
let stillPending;
|
|
335
|
+
try {
|
|
336
|
+
what = input.what;
|
|
337
|
+
lane = input.lane;
|
|
338
|
+
runId = input.runId;
|
|
339
|
+
}
|
|
340
|
+
catch {
|
|
341
|
+
what = lane = runId = undefined;
|
|
342
|
+
}
|
|
343
|
+
try {
|
|
344
|
+
const facts = input.facts;
|
|
345
|
+
rawCode = facts.code;
|
|
346
|
+
field = facts.field;
|
|
347
|
+
stillPending = facts.stillPending;
|
|
348
|
+
}
|
|
349
|
+
catch {
|
|
350
|
+
rawCode = field = stillPending = undefined;
|
|
351
|
+
}
|
|
352
|
+
const code = rawCode === CHECKPOINT_WALLTIME_AXIS_RETIRED || rawCode === CHECKPOINT_CONFIG_REFUSED ? rawCode : CHECKPOINT_UNSUPPORTED_VERSION;
|
|
353
|
+
const shownWhat = typeof what === 'string' && what !== '' ? capForDisplay(what, 40) : 'parked step';
|
|
354
|
+
const why = refusedParkWhy(code, typeof field === 'string' ? field : undefined);
|
|
355
|
+
const shownRun = refusedParkShownRunId(runId);
|
|
356
|
+
const head = `This ${shownWhat} cannot be resumed by this engine version: ${why}. The same refusal comes back every time, so ` +
|
|
357
|
+
`answering it again will not help (nothing was decided and nothing was resumed).`;
|
|
358
|
+
const configMayReturn = code === CHECKPOINT_CONFIG_REFUSED && field !== 'inheritedGate' ? ' If that configuration is restored, the same answer can go through again.' : '';
|
|
359
|
+
if (lane === 'print') {
|
|
360
|
+
if (stillPending === false) {
|
|
361
|
+
return `${head} The engine ended that run (${code}); submit the work again as a new task.`;
|
|
362
|
+
}
|
|
363
|
+
const cancel = `POST /v1/runs/${shownRun ?? '<run id>'}/cancel`;
|
|
364
|
+
return `${head}${configMayReturn} The parked run still holds this session (${code}): cancel it (${cancel}), then submit the work again as a new task.`;
|
|
365
|
+
}
|
|
366
|
+
if (stillPending === false) {
|
|
367
|
+
return `${head} The engine ended that parked run, so this conversation is free: send the work again as a new message.`;
|
|
368
|
+
}
|
|
369
|
+
return `${head}${configMayReturn} The parked run keeps this conversation busy until it is cancelled.`;
|
|
370
|
+
}
|
|
371
|
+
export function refusedParkBlockedContent(taskId, lane = 'interactive') {
|
|
372
|
+
const runId = refusedParkShownRunId(taskId);
|
|
373
|
+
const head = `sema will not put the card for run ${runId ?? '<unknown>'} back on screen by itself: this engine version refuses to resume it.`;
|
|
374
|
+
if (lane === 'print') {
|
|
375
|
+
return `${head} Cancel the run (POST /v1/runs/${runId ?? '<run id>'}/cancel) and submit the work again as a new task.`;
|
|
376
|
+
}
|
|
377
|
+
return (`${head} To free this conversation, send a message to bring the card back and answer it — sema then offers to cancel ` +
|
|
378
|
+
`that run, after which you can send the work again as a new message.`);
|
|
379
|
+
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { RewindMode } from './rewindWireCaps.js';
|
|
1
2
|
export type RewindArchiveBit = 'on' | 'off' | 'not_reported' | 'malformed';
|
|
2
3
|
export type RewindArchiveReading = {
|
|
3
4
|
kind: 'unobserved';
|
|
@@ -18,7 +19,7 @@ export declare function observedRewindArchive(baseUrl?: string | undefined): Rew
|
|
|
18
19
|
export declare function rewindCodeArchiveAvailability(reading: RewindArchiveReading, mode: RewindArchiveMode): RewindCodeArchive;
|
|
19
20
|
export declare function rewindArchiveDoctorDetail(reading: RewindArchiveReading, mode: RewindArchiveMode): string;
|
|
20
21
|
export declare function rewindConversationAvailability(reading: RewindArchiveReading): RewindCodeArchive;
|
|
22
|
+
export declare function engineRewindRefusedNow(option: RewindMode, reading?: RewindArchiveReading): boolean;
|
|
21
23
|
export declare function rewindConversationDoctorDetail(reading: RewindArchiveReading): string;
|
|
22
24
|
export declare function rewindRestoreFilesEpochDetail(reading: RewindArchiveReading): string;
|
|
23
|
-
export declare function forgetRewindArchiveReading(baseUrl: string | undefined): void;
|
|
24
25
|
export declare function __resetRewindArchiveReadingsForTests(): 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 { _wireConversationRewindJudge } from './toolHistoryMismatch.js';
|
|
4
5
|
const CAPS_KEYS = {
|
|
5
6
|
conversationAnchor: 'resumeAt',
|
|
@@ -10,9 +11,7 @@ const CAPS_KEYS = {
|
|
|
10
11
|
const _capsKeyPin = true;
|
|
11
12
|
void _capsKeyPin;
|
|
12
13
|
function bitOf(caps, key) {
|
|
13
|
-
|
|
14
|
-
return 'not_reported';
|
|
15
|
-
const v = caps[key];
|
|
14
|
+
const v = ownDataField(caps, key);
|
|
16
15
|
if (v === undefined)
|
|
17
16
|
return 'not_reported';
|
|
18
17
|
if (v === true)
|
|
@@ -43,12 +42,12 @@ const reader = createEngineCapReader({
|
|
|
43
42
|
makeUnobserved: () => ({ kind: 'unobserved' }),
|
|
44
43
|
});
|
|
45
44
|
export function noteEngineCapsForRewindArchive(baseUrl, caps, opts) {
|
|
46
|
-
_wireConversationRewindJudge(conversationRewindJudge);
|
|
47
45
|
reader.note(baseUrl, caps, opts);
|
|
48
46
|
}
|
|
49
47
|
function conversationRewindJudge(engineBaseUrl) {
|
|
50
48
|
return rewindConversationAvailability(observedRewindArchive(engineBaseUrl));
|
|
51
49
|
}
|
|
50
|
+
_wireConversationRewindJudge(conversationRewindJudge);
|
|
52
51
|
export function observedRewindArchive(baseUrl = engineWireTarget()?.baseUrl) {
|
|
53
52
|
return reader.observed(baseUrl);
|
|
54
53
|
}
|
|
@@ -96,6 +95,18 @@ export function rewindConversationAvailability(reading) {
|
|
|
96
95
|
return 'unavailable';
|
|
97
96
|
return 'unknown';
|
|
98
97
|
}
|
|
98
|
+
export function engineRewindRefusedNow(option, reading = observedRewindArchive()) {
|
|
99
|
+
switch (option) {
|
|
100
|
+
case 'both':
|
|
101
|
+
return rewindCodeArchiveAvailability(reading, 'both') === 'unavailable';
|
|
102
|
+
case 'code':
|
|
103
|
+
return rewindCodeArchiveAvailability(reading, 'code') === 'unavailable';
|
|
104
|
+
case 'conversation':
|
|
105
|
+
return rewindConversationAvailability(reading) === 'unavailable';
|
|
106
|
+
default:
|
|
107
|
+
return false;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
99
110
|
export function rewindConversationDoctorDetail(reading) {
|
|
100
111
|
const lane = 'rewind to a message';
|
|
101
112
|
if (reading.kind !== 'present') {
|
|
@@ -127,9 +138,6 @@ export function rewindRestoreFilesEpochDetail(reading) {
|
|
|
127
138
|
return 'the restore-files epoch bit is reported in an unreadable shape, so a rewind with code restore built from this reading leaves the key out and moves the conversation only';
|
|
128
139
|
}
|
|
129
140
|
}
|
|
130
|
-
export function forgetRewindArchiveReading(baseUrl) {
|
|
131
|
-
reader.forget(baseUrl);
|
|
132
|
-
}
|
|
133
141
|
export function __resetRewindArchiveReadingsForTests() {
|
|
134
142
|
reader.__resetForTests();
|
|
135
143
|
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { type RewindArchiveReading } from './rewindArchiveCapability.js';
|
|
2
|
+
import { type RewindMode, type SeamRewindSpec } from './rewindWireCaps.js';
|
|
3
|
+
export type RewindRestoreOption = RewindMode | 'summarize' | 'summarize_up_to' | 'nevermind';
|
|
4
|
+
export type RewindTargetPosition = 'root' | 'after-root' | 'unknown';
|
|
5
|
+
export interface RewindTargetResolution {
|
|
6
|
+
readonly position: RewindTargetPosition;
|
|
7
|
+
readonly targetEntryId?: string;
|
|
8
|
+
readonly anchorUnresolved?: true;
|
|
9
|
+
}
|
|
10
|
+
export type RewindEngineNoneReason = 'not-an-engine-rewind' | 'no-engine-turn-to-rewind' | 'unresolved';
|
|
11
|
+
export type RewindEngineAction = {
|
|
12
|
+
readonly kind: 'none';
|
|
13
|
+
readonly reason: RewindEngineNoneReason;
|
|
14
|
+
} | {
|
|
15
|
+
readonly kind: 'arm';
|
|
16
|
+
readonly spec: SeamRewindSpec;
|
|
17
|
+
} | {
|
|
18
|
+
readonly kind: 'reopen';
|
|
19
|
+
};
|
|
20
|
+
export declare function decideRewindEngineAction(option: RewindRestoreOption, resolved: RewindTargetResolution, reading?: RewindArchiveReading): RewindEngineAction;
|
|
21
|
+
export declare function previewEngineRewind(option: RewindRestoreOption, resolved: RewindTargetResolution, reading?: RewindArchiveReading): RewindEngineAction['kind'];
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { observedRewindArchive } from './rewindArchiveCapability.js';
|
|
2
|
+
import { REWIND_MODES, rewindSpecForMode } from './rewindWireCaps.js';
|
|
3
|
+
import { readOwnDataNonEmptyString, readOwnDataValue } from './ownKey.js';
|
|
4
|
+
function modeOfOption(option) {
|
|
5
|
+
return REWIND_MODES.includes(option) ? option : undefined;
|
|
6
|
+
}
|
|
7
|
+
function carriesResumeAt(mode) {
|
|
8
|
+
return rewindSpecForMode(mode, 'x').resumeAt !== undefined;
|
|
9
|
+
}
|
|
10
|
+
function positionOf(resolved) {
|
|
11
|
+
const p = readOwnDataValue(resolved, 'position');
|
|
12
|
+
return p === 'root' || p === 'after-root' ? p : 'unknown';
|
|
13
|
+
}
|
|
14
|
+
export function decideRewindEngineAction(option, resolved, reading = observedRewindArchive()) {
|
|
15
|
+
const mode = modeOfOption(option);
|
|
16
|
+
if (mode === undefined)
|
|
17
|
+
return { kind: 'none', reason: 'not-an-engine-rewind' };
|
|
18
|
+
const position = positionOf(resolved);
|
|
19
|
+
const targetEntryId = readOwnDataNonEmptyString(resolved, 'targetEntryId');
|
|
20
|
+
if (!carriesResumeAt(mode)) {
|
|
21
|
+
if (targetEntryId !== undefined)
|
|
22
|
+
return { kind: 'arm', spec: rewindSpecForMode(mode, targetEntryId, reading) };
|
|
23
|
+
const unresolved = position === 'unknown' || readOwnDataValue(resolved, 'anchorUnresolved') === true;
|
|
24
|
+
return { kind: 'none', reason: unresolved ? 'unresolved' : 'no-engine-turn-to-rewind' };
|
|
25
|
+
}
|
|
26
|
+
if (position === 'root')
|
|
27
|
+
return { kind: 'reopen' };
|
|
28
|
+
if (position === 'unknown')
|
|
29
|
+
return { kind: 'none', reason: 'unresolved' };
|
|
30
|
+
return targetEntryId !== undefined
|
|
31
|
+
? { kind: 'arm', spec: rewindSpecForMode(mode, targetEntryId, reading) }
|
|
32
|
+
: { kind: 'none', reason: 'no-engine-turn-to-rewind' };
|
|
33
|
+
}
|
|
34
|
+
export function previewEngineRewind(option, resolved, reading = observedRewindArchive()) {
|
|
35
|
+
return decideRewindEngineAction(option, resolved, reading).kind;
|
|
36
|
+
}
|
package/dist/rewindWireCaps.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ export interface SeamRewindSpec {
|
|
|
5
5
|
restoreFiles?: boolean;
|
|
6
6
|
rewindFilesTo?: string;
|
|
7
7
|
}
|
|
8
|
-
export
|
|
8
|
+
export declare const REWIND_MODES: readonly ["both", "conversation", "code"];
|
|
9
|
+
export type RewindMode = (typeof REWIND_MODES)[number];
|
|
9
10
|
export declare function rewindSpecForMode(mode: RewindMode, targetEntryId: string, reading?: RewindArchiveReading): SeamRewindSpec;
|
|
10
11
|
export declare function projectRewind(pending: SeamRewindSpec | undefined): SeamRewindSpec;
|
package/dist/rewindWireCaps.js
CHANGED
package/dist/runTerminal.d.ts
CHANGED
|
@@ -60,14 +60,3 @@ export declare function runTerminalGateKind(read: RunTerminalRead | null): strin
|
|
|
60
60
|
export declare function runTerminalGateToolName(read: RunTerminalRead | null): string | undefined;
|
|
61
61
|
export declare function runTerminalCode(read: RunTerminalRead | null): string | undefined;
|
|
62
62
|
export declare function isReviewPark(read: RunTerminalRead | null): boolean;
|
|
63
|
-
export declare const TERMINAL_CAUSE_KINDS: readonly ["completed", "failed", "blocked", "paused"];
|
|
64
|
-
export type TerminalCauseKind = (typeof TERMINAL_CAUSE_KINDS)[number];
|
|
65
|
-
export declare function isTerminalCauseKind(kind: unknown): kind is TerminalCauseKind;
|
|
66
|
-
export declare const RUN_TERMINAL_NOT_SUCCESS_STATUSES: readonly ["failed", "killed", "blocked"];
|
|
67
|
-
export type RunTerminalNotSuccessStatus = (typeof RUN_TERMINAL_NOT_SUCCESS_STATUSES)[number];
|
|
68
|
-
export declare function isTerminalNotSuccess(status: unknown): status is RunTerminalNotSuccessStatus;
|
|
69
|
-
export declare const RUN_TERMINAL_STATUSES: readonly ["completed", "failed", "killed", "blocked"];
|
|
70
|
-
export type RunTerminalStatus = (typeof RUN_TERMINAL_STATUSES)[number];
|
|
71
|
-
export declare function isTerminalStatus(status: unknown): status is RunTerminalStatus;
|
|
72
|
-
export declare const TASK_NOTIFICATION_TERMINAL_STATUSES: readonly string[];
|
|
73
|
-
export declare function isTaskNotificationTerminalStatus(status: string | undefined): boolean;
|
package/dist/runTerminal.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { CORE_PROMPT_BLOCK_CAUSES
|
|
1
|
+
import { CORE_PROMPT_BLOCK_CAUSES } from './generated/engineFactTables.js';
|
|
2
|
+
import { isSdkRunParked } from './terminalStatuses.js';
|
|
2
3
|
export const PROMPT_BLOCK_CAUSES = CORE_PROMPT_BLOCK_CAUSES;
|
|
3
4
|
const PROMPT_BLOCKED_BY_HOOK_DETAIL_KIND = 'prompt_blocked_by_hook';
|
|
4
5
|
function str(v) {
|
|
@@ -69,7 +70,6 @@ function blockedDetailOf(cause) {
|
|
|
69
70
|
return undefined;
|
|
70
71
|
}
|
|
71
72
|
}
|
|
72
|
-
const FLAT_PAUSED_STATUSES = ['suspended', 'needs_review'];
|
|
73
73
|
export function readRunTerminal(result) {
|
|
74
74
|
if (typeof result !== 'object' || result === null || Array.isArray(result))
|
|
75
75
|
return null;
|
|
@@ -83,7 +83,7 @@ export function readRunTerminal(result) {
|
|
|
83
83
|
if (kind === undefined)
|
|
84
84
|
return { kind: 'unknown', plane: 'cause' };
|
|
85
85
|
const parkWord = str(r.status);
|
|
86
|
-
if (
|
|
86
|
+
if (isSdkRunParked(parkWord)) {
|
|
87
87
|
return { kind: 'paused', plane: 'cause', flatStatus: parkWord, ...(kind === 'paused' ? (pauseOf(c) ?? {}) : {}) };
|
|
88
88
|
}
|
|
89
89
|
switch (kind) {
|
|
@@ -138,7 +138,7 @@ export function readRunTerminal(result) {
|
|
|
138
138
|
...(code !== undefined ? { code } : {}),
|
|
139
139
|
};
|
|
140
140
|
}
|
|
141
|
-
if (
|
|
141
|
+
if (isSdkRunParked(status)) {
|
|
142
142
|
const gate = gateOf(r.checkpointGate);
|
|
143
143
|
const checkpointId = str(r.checkpointId);
|
|
144
144
|
const restoreMode = str(r.workspaceRestoreMode);
|
|
@@ -183,26 +183,3 @@ export function isReviewPark(read) {
|
|
|
183
183
|
return true;
|
|
184
184
|
return read !== null && read.kind === 'paused' && read.flatStatus === FLAT_REVIEW_STATUS;
|
|
185
185
|
}
|
|
186
|
-
export const TERMINAL_CAUSE_KINDS = CORE_TERMINAL_CAUSE_KINDS;
|
|
187
|
-
export function isTerminalCauseKind(kind) {
|
|
188
|
-
return typeof kind === 'string' && TERMINAL_CAUSE_KINDS.includes(kind);
|
|
189
|
-
}
|
|
190
|
-
export const RUN_TERMINAL_NOT_SUCCESS_STATUSES = Object.freeze([
|
|
191
|
-
'failed',
|
|
192
|
-
'killed',
|
|
193
|
-
'blocked',
|
|
194
|
-
]);
|
|
195
|
-
export function isTerminalNotSuccess(status) {
|
|
196
|
-
return typeof status === 'string' && RUN_TERMINAL_NOT_SUCCESS_STATUSES.includes(status);
|
|
197
|
-
}
|
|
198
|
-
export const RUN_TERMINAL_STATUSES = Object.freeze([
|
|
199
|
-
'completed',
|
|
200
|
-
...RUN_TERMINAL_NOT_SUCCESS_STATUSES,
|
|
201
|
-
]);
|
|
202
|
-
export function isTerminalStatus(status) {
|
|
203
|
-
return typeof status === 'string' && RUN_TERMINAL_STATUSES.includes(status);
|
|
204
|
-
}
|
|
205
|
-
export const TASK_NOTIFICATION_TERMINAL_STATUSES = Object.freeze(['completed', 'failed', 'killed', 'cancelled']);
|
|
206
|
-
export function isTaskNotificationTerminalStatus(status) {
|
|
207
|
-
return status !== undefined && TASK_NOTIFICATION_TERMINAL_STATUSES.includes(status);
|
|
208
|
-
}
|
|
@@ -3,5 +3,6 @@ export { getMeConfig, getScopeConfigDraft, getEffective } from '@sema-agent/sdk/
|
|
|
3
3
|
export { probeRegistryHealth, postFeedback } from '@sema-agent/sdk/registry';
|
|
4
4
|
export { REGISTRY_AUTH_PATHS, skillContentAddress } from '@sema-agent/sdk/registry';
|
|
5
5
|
export { requestDeviceCode, pollUntilApproved, refreshTokens, listScopes, switchScope } from '@sema-agent/sdk/registry';
|
|
6
|
+
export { classifyRegistryConflict } from '@sema-agent/sdk/registry';
|
|
6
7
|
export { RegistryApiError, OAuthFlowError } from '@sema-agent/sdk/registry';
|
|
7
|
-
export type { RegistryTokens, TokenProvider, } from '@sema-agent/sdk/registry';
|
|
8
|
+
export type { RegistryConflictClass, RegistryTokens, TokenProvider, } from '@sema-agent/sdk/registry';
|
|
@@ -3,4 +3,5 @@ export { getMeConfig, getScopeConfigDraft, getEffective } from '@sema-agent/sdk/
|
|
|
3
3
|
export { probeRegistryHealth, postFeedback } from '@sema-agent/sdk/registry';
|
|
4
4
|
export { REGISTRY_AUTH_PATHS, skillContentAddress } from '@sema-agent/sdk/registry';
|
|
5
5
|
export { requestDeviceCode, pollUntilApproved, refreshTokens, listScopes, switchScope } from '@sema-agent/sdk/registry';
|
|
6
|
+
export { classifyRegistryConflict } from '@sema-agent/sdk/registry';
|
|
6
7
|
export { RegistryApiError, OAuthFlowError } from '@sema-agent/sdk/registry';
|
|
@@ -13,5 +13,4 @@ export declare function noteEngineCapsForSealedKey(baseUrl: string, caps: unknow
|
|
|
13
13
|
generation?: number;
|
|
14
14
|
}): void;
|
|
15
15
|
export declare function observedSealedKey(baseUrl?: string | undefined): SealedKeyReading;
|
|
16
|
-
export declare function forgetSealedKeyReading(baseUrl: string | undefined): void;
|
|
17
16
|
export declare function __resetSealedKeyReadingsForTests(): void;
|
|
@@ -1,18 +1,15 @@
|
|
|
1
1
|
import { engineWireTarget } from './engineWireTarget.js';
|
|
2
2
|
import { createEngineCapReader } from './engineCapReader.js';
|
|
3
|
+
import { ownDataField } from './ownKey.js';
|
|
3
4
|
function ownNonEmpty(seg, key) {
|
|
4
|
-
|
|
5
|
-
return undefined;
|
|
6
|
-
const v = seg[key];
|
|
5
|
+
const v = ownDataField(seg, key);
|
|
7
6
|
return typeof v === 'string' && v.length > 0 ? v : undefined;
|
|
8
7
|
}
|
|
9
8
|
export function projectSealedKeyCapability(caps) {
|
|
10
9
|
try {
|
|
11
10
|
if (caps === null || typeof caps !== 'object' || Array.isArray(caps))
|
|
12
11
|
return undefined;
|
|
13
|
-
|
|
14
|
-
return { kind: 'not_reported' };
|
|
15
|
-
const seg = caps.sealedKey;
|
|
12
|
+
const seg = ownDataField(caps, 'sealedKey');
|
|
16
13
|
if (seg === undefined)
|
|
17
14
|
return { kind: 'not_reported' };
|
|
18
15
|
if (seg === null || typeof seg !== 'object' || Array.isArray(seg))
|
|
@@ -39,9 +36,6 @@ export function noteEngineCapsForSealedKey(baseUrl, caps, opts) {
|
|
|
39
36
|
export function observedSealedKey(baseUrl = engineWireTarget()?.baseUrl) {
|
|
40
37
|
return reader.observed(baseUrl);
|
|
41
38
|
}
|
|
42
|
-
export function forgetSealedKeyReading(baseUrl) {
|
|
43
|
-
reader.forget(baseUrl);
|
|
44
|
-
}
|
|
45
39
|
export function __resetSealedKeyReadingsForTests() {
|
|
46
40
|
reader.__resetForTests();
|
|
47
41
|
}
|
package/dist/seatContract.d.ts
CHANGED
|
@@ -5,6 +5,8 @@ import type { QuestionAnswer } from "./liveQuestionStore.js";
|
|
|
5
5
|
import type { ToolApprovalDelegation } from "./hitl/toolApprovalWire.js";
|
|
6
6
|
import type { ApprovalMandateWord } from "./gateVocabulary.js";
|
|
7
7
|
import type { ModelApiWord } from "./model/providerPresets.js";
|
|
8
|
+
import type { LiveModelCatalog } from "./liveModelCatalog.js";
|
|
9
|
+
import { type RewindMode } from "./rewindWireCaps.js";
|
|
8
10
|
export interface SeatValidationFailure {
|
|
9
11
|
reason: string;
|
|
10
12
|
field?: string;
|
|
@@ -97,13 +99,15 @@ export interface LocalSessionEvent {
|
|
|
97
99
|
hasPreClearSession?: boolean;
|
|
98
100
|
requestId?: string;
|
|
99
101
|
outcome?: string;
|
|
102
|
+
parked?: true;
|
|
100
103
|
chrome?: SeatChromeEnvelope;
|
|
101
104
|
}
|
|
102
105
|
export declare const HITL_RESOLUTION_OUTCOMES: readonly string[];
|
|
103
|
-
export declare const SEAT_CAPABILITY_NAMES: readonly ["pickFolder"];
|
|
106
|
+
export declare const SEAT_CAPABILITY_NAMES: readonly ["pickFolder", "rewind"];
|
|
104
107
|
export type SeatCapabilityName = (typeof SEAT_CAPABILITY_NAMES)[number];
|
|
105
108
|
export interface SeatCapabilitiesState {
|
|
106
109
|
pickFolder?: boolean;
|
|
110
|
+
rewind?: boolean;
|
|
107
111
|
}
|
|
108
112
|
export type SeatCapabilityReading = {
|
|
109
113
|
readonly kind: "reported";
|
|
@@ -130,6 +134,28 @@ export interface SeatTurnSettings {
|
|
|
130
134
|
ultracode?: boolean;
|
|
131
135
|
}
|
|
132
136
|
export declare const SEAT_TURN_SETTINGS_KEYS: readonly ["ultracode"];
|
|
137
|
+
export declare const SEAT_TURN_SETTINGS_ORIGINS: Readonly<{
|
|
138
|
+
ultracode: Readonly<{
|
|
139
|
+
carriedBy: "renderer";
|
|
140
|
+
}>;
|
|
141
|
+
webSearch: Readonly<{
|
|
142
|
+
hostSupplied: "联网检索的每请求配置来自宿主的设置源(可能带检索服务的凭据与私网地址);渲染端没有设置文件,也不该持有凭据";
|
|
143
|
+
}>;
|
|
144
|
+
hooks: Readonly<{
|
|
145
|
+
hostSupplied: "hooks 表来自宿主的设置文件(宿主经设置端口与 hooksForWire 投影);渲染端没有设置文件、也不执行本机 hook";
|
|
146
|
+
}>;
|
|
147
|
+
resolved: Readonly<{
|
|
148
|
+
hostSupplied: "设置解析器的生效快照(hooks / env / model / 已解析权限)由宿主跑解析器得出;渲染端没有设置源可解析";
|
|
149
|
+
}>;
|
|
150
|
+
outputStyle: Readonly<{
|
|
151
|
+
hostSupplied: "输出风格正文由宿主的兜底层随请求带(风格文件在宿主);渲染端只选名字,不持正文";
|
|
152
|
+
}>;
|
|
153
|
+
}>;
|
|
154
|
+
export interface SeatRewindIntent {
|
|
155
|
+
mode: RewindMode;
|
|
156
|
+
targetMessageUuid: string;
|
|
157
|
+
}
|
|
158
|
+
export declare const SEAT_REWIND_INTENT_KEYS: readonly ["mode", "targetMessageUuid"];
|
|
133
159
|
export interface SendMessageRequest {
|
|
134
160
|
sessionId: string;
|
|
135
161
|
text: string;
|
|
@@ -145,6 +171,7 @@ export interface SendMessageRequest {
|
|
|
145
171
|
max?: number;
|
|
146
172
|
};
|
|
147
173
|
settings?: SeatTurnSettings;
|
|
174
|
+
rewind?: SeatRewindIntent;
|
|
148
175
|
scenario?: string;
|
|
149
176
|
}
|
|
150
177
|
export interface AttachmentUploadRequest {
|
|
@@ -163,17 +190,6 @@ export interface AttachmentUploadReceipt {
|
|
|
163
190
|
sha256: string;
|
|
164
191
|
sizeBytes: number;
|
|
165
192
|
}
|
|
166
|
-
export interface SeatModelInfo {
|
|
167
|
-
id: string;
|
|
168
|
-
name?: string;
|
|
169
|
-
provider?: string;
|
|
170
|
-
contextWindow?: number;
|
|
171
|
-
maxOutputTokens?: number;
|
|
172
|
-
}
|
|
173
|
-
export interface SeatModelCatalog {
|
|
174
|
-
models: SeatModelInfo[];
|
|
175
|
-
defaultId?: string;
|
|
176
|
-
}
|
|
177
193
|
export interface SendMessageAck {
|
|
178
194
|
sessionId: string;
|
|
179
195
|
userMessageUuid: string;
|
|
@@ -242,7 +258,7 @@ export interface LocalSessionsApi {
|
|
|
242
258
|
getTranscript(sessionId: string): Promise<GetTranscriptResult>;
|
|
243
259
|
searchSessions(query: string): Promise<SessionSearchEnvelope>;
|
|
244
260
|
uploadAttachment(req: AttachmentUploadRequest): Promise<AttachmentUploadReceipt>;
|
|
245
|
-
listModels(): Promise<
|
|
261
|
+
listModels(): Promise<LiveModelCatalog>;
|
|
246
262
|
applyModelConfig(req: ApplyModelConfigRequest): Promise<ApplyModelConfigResult>;
|
|
247
263
|
pickFolder(): Promise<string | null>;
|
|
248
264
|
onEvent(cb: (ev: LocalSessionEvent) => void): () => void;
|
|
@@ -276,16 +292,17 @@ export interface ApplyModelConfigResult {
|
|
|
276
292
|
reason?: string;
|
|
277
293
|
requiresRestart: boolean;
|
|
278
294
|
}
|
|
279
|
-
export declare function
|
|
295
|
+
export declare function checkSendMessageRequest(v: unknown): SeatValidation;
|
|
296
|
+
export declare function isSendMessageRequest(v: unknown): v is SendMessageRequest;
|
|
280
297
|
export declare function isSendMessageAck(v: unknown): v is SendMessageAck;
|
|
281
298
|
export declare const LOCAL_SESSIONS_SPEC: EipcServiceSpec;
|
|
282
299
|
export declare const SEAT_METHOD_NAMES: readonly ["start", "sendMessage", "interrupt", "stop", "respondToToolPermission", "cancelQueuedMessage", "reorderQueuedMessage", "promoteQueuedMessage", "setFocusedSession", "setModel", "getTranscript", "searchSessions", "uploadAttachment", "listModels", "applyModelConfig", "pickFolder", "onEvent", "onToolPermissionRequest"];
|
|
283
300
|
export declare const SEAT_STORE_PROPS: readonly ["sessionsStateStore", "focusedSessionStateStore", "settingsStateStore", "seatCapabilitiesStateStore"];
|
|
284
301
|
export declare const SEAT_EVENT_METHOD_NAMES: readonly ["onEvent", "onToolPermissionRequest"];
|
|
285
|
-
export declare const LOCAL_SESSION_EVENT_KEYS: readonly ["type", "sessionId", "message", "messages", "error", "errorCategory", "code", "request", "data", "sources", "permissionMode", "session", "userMessageUuid", "hasPreClearSession", "requestId", "outcome", "chrome"];
|
|
302
|
+
export declare const LOCAL_SESSION_EVENT_KEYS: readonly ["type", "sessionId", "message", "messages", "error", "errorCategory", "code", "request", "data", "sources", "permissionMode", "session", "userMessageUuid", "hasPreClearSession", "requestId", "outcome", "parked", "chrome"];
|
|
286
303
|
export declare const TOOL_PERMISSION_REQUEST_KEYS: readonly ["requestId", "sessionId", "toolName", "toolCallId", "input", "message", "toctouBinding", "createdAtMs", "governanceForced", "delegation", "mandated", "mandate", "origin", "ruleOffersAbsence", "askClass", "classes"];
|
|
287
304
|
export declare const LOCAL_SESSION_RECORD_KEYS: readonly ["sessionId", "engineSessionId", "model", "title", "cwd", "isRunning", "createdAt", "lastActivityAt", "queuedMessages", "parked"];
|
|
288
|
-
export declare const SEND_MESSAGE_REQUEST_KEYS: readonly ["sessionId", "text", "model", "userMessageUuid", "permissionMode", "attachmentIds", "reasoningEffort", "retainBackgroundProcesses", "forwardSubagentEvents", "retainSubagentSessions", "settings", "scenario"];
|
|
305
|
+
export declare const SEND_MESSAGE_REQUEST_KEYS: readonly ["sessionId", "text", "model", "userMessageUuid", "permissionMode", "attachmentIds", "reasoningEffort", "retainBackgroundProcesses", "forwardSubagentEvents", "retainSubagentSessions", "settings", "scenario", "rewind"];
|
|
289
306
|
export declare const SEAT_SEND_MESSAGE_KEY_ORIGINS: {
|
|
290
307
|
readonly sessionId: {
|
|
291
308
|
readonly seatOnly: "座位会话句柄(渲染端持有的本地 id);引擎会话 id 由座位记录的 `engineSessionId` 承载 —— 与引擎请求体上的同名位**同名不同义**,绝不直传";
|
|
@@ -323,19 +340,23 @@ export declare const SEAT_SEND_MESSAGE_KEY_ORIGINS: {
|
|
|
323
340
|
readonly scenario: {
|
|
324
341
|
readonly taskRequestKey: "scenario";
|
|
325
342
|
};
|
|
343
|
+
readonly rewind: {
|
|
344
|
+
readonly projectedBy: "rewindSpecForMode";
|
|
345
|
+
readonly taskRequestKeys: readonly ["resumeAt", "resumeAtMode", "restoreFiles", "rewindFilesTo"];
|
|
346
|
+
};
|
|
326
347
|
};
|
|
327
348
|
export declare const TOOL_PERMISSION_DECISION_KEYS: readonly ["sessionId", "requestId", "decision", "answer", "updatedInput", "remember"];
|
|
328
349
|
export declare const START_SESSION_OPTION_KEYS: readonly ["model", "title", "cwd", "excludeTools"];
|
|
329
350
|
export declare const SEAT_VALIDATOR_KEY_COVERAGE: {
|
|
330
351
|
readonly LocalSessionRecord: {
|
|
331
352
|
readonly guard: "isLocalSessionRecord";
|
|
332
|
-
readonly check: (
|
|
353
|
+
readonly check: (v: unknown) => SeatValidation;
|
|
333
354
|
readonly validated: readonly ["sessionId", "engineSessionId", "model", "title", "cwd", "isRunning", "createdAt", "lastActivityAt", "queuedMessages", "parked"];
|
|
334
355
|
readonly unchecked: readonly [];
|
|
335
356
|
};
|
|
336
357
|
readonly ToolPermissionRequest: {
|
|
337
358
|
readonly guard: "isToolPermissionRequest";
|
|
338
|
-
readonly check: (
|
|
359
|
+
readonly check: (v: unknown) => SeatValidation;
|
|
339
360
|
readonly validated: readonly ["requestId", "sessionId", "toolName", "toolCallId", "message", "toctouBinding", "createdAtMs"];
|
|
340
361
|
readonly unchecked: readonly [{
|
|
341
362
|
readonly key: "input";
|
|
@@ -369,7 +390,7 @@ export declare const SEAT_VALIDATOR_KEY_COVERAGE: {
|
|
|
369
390
|
readonly LocalSessionEvent: {
|
|
370
391
|
readonly guard: "isLocalSessionEvent";
|
|
371
392
|
readonly check: (v: unknown) => SeatValidation;
|
|
372
|
-
readonly validated: readonly ["type", "sessionId", "messages", "error", "errorCategory", "code", "request", "data", "sources", "permissionMode", "session", "userMessageUuid", "hasPreClearSession", "requestId", "outcome", "chrome"];
|
|
393
|
+
readonly validated: readonly ["type", "sessionId", "messages", "error", "errorCategory", "code", "request", "data", "sources", "permissionMode", "session", "userMessageUuid", "hasPreClearSession", "requestId", "outcome", "parked", "chrome"];
|
|
373
394
|
readonly unchecked: readonly [{
|
|
374
395
|
readonly key: "message";
|
|
375
396
|
readonly why: "transcript 面直通位(CC fQe 逐字姿态:SDKMessage 体不做 schema 校验)—— 校它 = 引擎加一种消息体的那天整条转录被门吃掉。";
|
|
@@ -381,10 +402,18 @@ export declare const SEAT_VALIDATOR_KEY_COVERAGE: {
|
|
|
381
402
|
readonly validated: readonly ["id", "name", "mime", "sha256", "sizeBytes"];
|
|
382
403
|
readonly unchecked: readonly [];
|
|
383
404
|
};
|
|
384
|
-
readonly
|
|
385
|
-
readonly guard: "isSeatModelCatalog";
|
|
405
|
+
readonly LiveModelCatalog: {
|
|
386
406
|
readonly check: (v: unknown) => SeatValidation;
|
|
387
|
-
readonly validated: readonly ["models", "
|
|
407
|
+
readonly validated: readonly ["models", "default", "defaultModel"];
|
|
408
|
+
readonly unchecked: readonly [{
|
|
409
|
+
readonly key: "droppedEntries";
|
|
410
|
+
readonly why: "诊断面(哪些目录条目没被引擎收下),三态读法归 droppedModelEntriesOf(含坏形 malformed);出站门为它拒掉整份目录 = 选单为一行诊断整个消失。";
|
|
411
|
+
}];
|
|
412
|
+
};
|
|
413
|
+
readonly SendMessageRequest: {
|
|
414
|
+
readonly guard: "isSendMessageRequest";
|
|
415
|
+
readonly check: typeof checkSendMessageRequest;
|
|
416
|
+
readonly validated: readonly ["sessionId", "text", "model", "userMessageUuid", "permissionMode", "attachmentIds", "reasoningEffort", "retainBackgroundProcesses", "forwardSubagentEvents", "retainSubagentSessions", "settings", "scenario", "rewind"];
|
|
388
417
|
readonly unchecked: readonly [];
|
|
389
418
|
};
|
|
390
419
|
readonly ApplyModelConfigResult: {
|
|
@@ -440,12 +469,12 @@ export declare const SEAT_VALIDATOR_KEY_COVERAGE: {
|
|
|
440
469
|
};
|
|
441
470
|
readonly SeatCapabilitiesState: {
|
|
442
471
|
readonly check: (v: unknown) => SeatValidation;
|
|
443
|
-
readonly validated: readonly ["pickFolder"];
|
|
472
|
+
readonly validated: readonly ["pickFolder", "rewind"];
|
|
444
473
|
readonly unchecked: readonly [];
|
|
445
474
|
};
|
|
446
|
-
readonly
|
|
475
|
+
readonly SeatRewindIntent: {
|
|
447
476
|
readonly check: (v: unknown) => SeatValidation;
|
|
448
|
-
readonly validated: readonly ["
|
|
477
|
+
readonly validated: readonly ["mode", "targetMessageUuid"];
|
|
449
478
|
readonly unchecked: readonly [];
|
|
450
479
|
};
|
|
451
480
|
readonly SessionSearchResult: {
|