@sema-agent/client-core 0.110.0 → 0.112.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 +244 -0
- package/README.md +59 -18
- package/dist/abortableSleep.d.ts +7 -0
- package/dist/abortableSleep.js +37 -0
- package/dist/adapt/arms.js +25 -4
- package/dist/adapt/toolCards.d.ts +3 -1
- package/dist/adapt/toolCards.js +4 -2
- package/dist/adapter/activeRunSelfHeal.d.ts +39 -0
- package/dist/adapter/activeRunSelfHeal.js +171 -3
- package/dist/adapter/downstream/eventToSdkMessage.js +10 -10
- package/dist/adapter/downstream/terminalToSdkResult.d.ts +2 -0
- package/dist/adapter/downstream/terminalToSdkResult.js +11 -0
- package/dist/adapter/runStream.d.ts +5 -0
- package/dist/adapter/runStream.js +15 -3
- package/dist/agentSession/engineSessionBackgroundStop.js +2 -2
- package/dist/attachmentRoute.d.ts +20 -0
- package/dist/attachmentRoute.js +39 -0
- package/dist/attachmentsWireCaps.js +1 -1
- package/dist/builtinOutputStyles.d.ts +12 -0
- package/dist/builtinOutputStyles.js +147 -0
- package/dist/checkpointRowVerdict.d.ts +3 -0
- package/dist/checkpointRowVerdict.js +14 -1
- package/dist/compactionStatus.d.ts +9 -0
- package/dist/compactionStatus.js +29 -5
- package/dist/consoleCaPin.d.ts +136 -0
- package/dist/consoleCaPin.js +827 -0
- package/dist/controlRouter.js +2 -1
- package/dist/coreValuePorts.d.ts +39 -1
- package/dist/coreValuePorts.js +10 -0
- package/dist/decideReceipt.d.ts +2 -1
- package/dist/deviceRebind.js +3 -3
- package/dist/displayUntrusted.d.ts +1 -0
- package/dist/displayUntrusted.js +6 -0
- package/dist/effectiveFacts.d.ts +9 -0
- package/dist/effectiveFacts.js +33 -0
- package/dist/engineAddress.d.ts +1 -0
- package/dist/engineAddress.js +4 -1
- package/dist/engineCredentialRelease.d.ts +54 -0
- package/dist/engineCredentialRelease.js +146 -0
- package/dist/engineErrorCodes.d.ts +1 -0
- package/dist/engineErrorCodes.js +1 -0
- package/dist/engineHealthProbeVerdict.d.ts +24 -0
- package/dist/engineHealthProbeVerdict.js +123 -0
- package/dist/engineNoticeCodes.js +5 -7
- package/dist/engineRepoint.d.ts +12 -5
- package/dist/engineRepoint.js +44 -19
- package/dist/engineRowRef.d.ts +3 -0
- package/dist/engineRowRef.js +11 -1
- package/dist/engineSwapCrossing.d.ts +57 -0
- package/dist/engineSwapCrossing.js +297 -0
- package/dist/engineUnavailable.d.ts +45 -0
- package/dist/engineUnavailable.js +496 -0
- package/dist/engineUrl.js +4 -2
- package/dist/eventLeg.js +3 -3
- package/dist/gateFailureCodes.js +2 -2
- package/dist/generated/sdkFactTables.d.ts +2 -1
- package/dist/generated/sdkFactTables.js +14 -0
- package/dist/generated/settingsSchemaFns.d.ts +1 -0
- package/dist/generated/settingsSchemaFns.js +3 -0
- package/dist/generated/settingsSchemaHooksClassifier.js +38 -9
- package/dist/generated/settingsSchemaTables.d.ts +56 -0
- package/dist/generated/settingsSchemaTables.js +19 -0
- package/dist/generated/settingsSchemaTypes.d.ts +23 -13
- package/dist/generated/settingsSchemaUrlShape.d.ts +1 -0
- package/dist/generated/settingsSchemaUrlShape.js +17 -0
- package/dist/hitl/approvalDelivery.d.ts +1 -0
- package/dist/hitl/approvalDelivery.js +1 -1
- package/dist/hitl/approvalResolution.d.ts +1 -1
- package/dist/hitl/approvalResolution.js +2 -1
- package/dist/hitl/askGateWire.js +5 -6
- package/dist/hitl/decisionRefusal.d.ts +6 -0
- package/dist/hitl/decisionRefusal.js +19 -10
- package/dist/hitl/decisionRefusalCarrier.d.ts +3 -0
- package/dist/hitl/decisionRefusalCarrier.js +348 -0
- package/dist/hitl/decisionSend.d.ts +7 -0
- package/dist/hitl/decisionSend.js +34 -12
- package/dist/hitl/editedApprovalAcceptance.js +1 -1
- package/dist/hitl/elicitationRefusal.d.ts +4 -0
- package/dist/hitl/elicitationRefusal.js +23 -0
- package/dist/hitl/frameRouter.d.ts +2 -2
- package/dist/hitl/frameRouter.js +8 -15
- package/dist/hitl/gateIdentity.d.ts +5 -0
- package/dist/hitl/gateIdentity.js +23 -0
- package/dist/hitl/hitlBridge.d.ts +6 -0
- package/dist/hitl/hitlBridge.js +10 -4
- package/dist/hitl/hitlHostSurface.d.ts +2 -1
- package/dist/hitl/hitlHostSurface.js +7 -2
- package/dist/hitl/localAllowRedemption.d.ts +70 -0
- package/dist/hitl/localAllowRedemption.js +276 -0
- package/dist/hitl/parkOwnership.js +2 -1
- package/dist/hitl/parkResolver.js +14 -4
- package/dist/hitl/persistedRulesWire.d.ts +16 -0
- package/dist/hitl/persistedRulesWire.js +70 -0
- package/dist/hitl/planReviewWire.d.ts +3 -0
- package/dist/hitl/planReviewWire.js +23 -6
- package/dist/hitl/policyDenyCause.d.ts +1 -1
- package/dist/hitl/policyDenyCause.js +1 -1
- package/dist/hitl/resumeRunningCard.d.ts +1 -0
- package/dist/hitl/resumeRunningCard.js +1 -0
- package/dist/hitl/screenCardCarriers.d.ts +15 -0
- package/dist/hitl/screenCardCarriers.js +41 -0
- package/dist/hitl/screenDecisionCards.d.ts +98 -0
- package/dist/hitl/screenDecisionCards.js +363 -0
- package/dist/hitl/sessionPolicyWire.js +2 -2
- package/dist/hitl/standingRows.d.ts +6 -2
- package/dist/hitl/standingRows.js +27 -2
- package/dist/hitl/toolApprovalWire.d.ts +30 -8
- package/dist/hitl/toolApprovalWire.js +264 -121
- package/dist/hooksReaderGenerations.js +1 -1
- package/dist/hooksWireCaps.js +3 -3
- package/dist/hostSettingNoticeArm.d.ts +3 -0
- package/dist/hostSettingNoticeArm.js +12 -0
- package/dist/hostTurnSettings.d.ts +3 -0
- package/dist/hostTurnSettings.js +38 -5
- package/dist/humanTurnRead.js +11 -1
- package/dist/i18n/messages.en.d.ts +292 -0
- package/dist/i18n/messages.en.js +298 -7
- package/dist/i18n/messages.zh.js +316 -6
- package/dist/i18n/translate.d.ts +3 -0
- package/dist/i18n/translate.js +78 -10
- package/dist/i18n/zh.d.ts +1 -0
- package/dist/i18n/zh.js +1 -0
- package/dist/index.d.ts +71 -20
- package/dist/index.js +44 -13
- package/dist/interactiveHalt.js +2 -1
- package/dist/interactiveInterrupt.js +20 -2
- package/dist/liveModelCatalog.d.ts +4 -0
- package/dist/liveModelCatalog.js +12 -3
- package/dist/localConfig/documents.d.ts +61 -0
- package/dist/localConfig/documents.js +51 -0
- package/dist/localConfig/kernel.d.ts +149 -0
- package/dist/localConfig/kernel.js +597 -0
- package/dist/localConfig/mcp/edit.d.ts +161 -0
- package/dist/localConfig/mcp/edit.js +846 -0
- package/dist/localConfig/mcp/servers.d.ts +165 -0
- package/dist/localConfig/mcp/servers.js +776 -0
- package/dist/localConfig/mcp/views.d.ts +170 -0
- package/dist/localConfig/mcp/views.js +429 -0
- package/dist/localConfig/modelPool.d.ts +262 -0
- package/dist/localConfig/modelPool.js +1489 -0
- package/dist/localConfig/modelPoolWords.d.ts +13 -0
- package/dist/localConfig/modelPoolWords.js +20 -0
- package/dist/localConfig/receiptShape.d.ts +7 -0
- package/dist/localConfig/receiptShape.js +135 -0
- package/dist/localConfig/settingsWrite.d.ts +127 -0
- package/dist/localConfig/settingsWrite.js +237 -0
- package/dist/localConfig/skills.d.ts +124 -0
- package/dist/localConfig/skills.js +397 -0
- package/dist/localConfig/skillsWords.d.ts +10 -0
- package/dist/localConfig/skillsWords.js +5 -0
- package/dist/localEngineSeatReading.d.ts +2 -2
- package/dist/localEngineSeatReading.js +5 -3
- package/dist/localEngineSpawn.d.ts +0 -7
- package/dist/localEngineSpawn.js +0 -92
- package/dist/localEngineStep.d.ts +2 -2
- package/dist/localEngineStep.js +2 -0
- package/dist/mcpProbeWire.js +2 -1
- package/dist/mcpReconnect.js +3 -3
- package/dist/mcpWireCaps.js +1 -1
- package/dist/memoryVerbsWire.js +3 -2
- package/dist/model/engineModelWords.d.ts +3 -0
- package/dist/model/engineModelWords.js +13 -0
- package/dist/model/onboardJudgement.d.ts +14 -4
- package/dist/model/onboardJudgement.js +91 -139
- package/dist/model/subagentModelWord.d.ts +21 -2
- package/dist/model/subagentModelWord.js +100 -29
- package/dist/modelCapabilityProbe.js +3 -40
- package/dist/modelConfigGapNotice.d.ts +20 -0
- package/dist/modelConfigGapNotice.js +102 -0
- package/dist/modsKernelIdentity.js +2 -47
- package/dist/notifications.d.ts +19 -0
- package/dist/notifications.js +114 -12
- package/dist/ownKey.d.ts +7 -0
- package/dist/ownKey.js +71 -8
- package/dist/pendingUserRow.d.ts +4 -0
- package/dist/pendingUserRow.js +16 -0
- package/dist/permissionsDeclaration.d.ts +3 -1
- package/dist/permissionsDeclaration.js +33 -9
- package/dist/planReviewCardFacts.d.ts +3 -0
- package/dist/planReviewCardFacts.js +52 -2
- package/dist/pluginHooksWire.d.ts +9 -1
- package/dist/pluginHooksWire.js +40 -6
- package/dist/printToolResultFrame.js +4 -2
- package/dist/promptBlockedCopy.js +12 -7
- package/dist/promptSuggestionBatch.d.ts +7 -0
- package/dist/promptSuggestionBatch.js +9 -0
- package/dist/promptSuggestionsTail.d.ts +39 -0
- package/dist/promptSuggestionsTail.js +116 -0
- package/dist/request/taskRequest.js +10 -6
- package/dist/requestCoordinate.d.ts +1 -0
- package/dist/requestCoordinate.js +13 -0
- package/dist/resumeRefusalCopy.d.ts +3 -1
- package/dist/resumeRefusalCopy.js +12 -4
- package/dist/rewindArchiveReading.js +4 -4
- package/dist/runCancelContext.d.ts +2 -1
- package/dist/runCancelContext.js +1 -0
- package/dist/runLedgerSnapshot.js +3 -3
- package/dist/runPermissionModeSwitch.js +3 -4
- package/dist/scenarioRefusal.js +11 -13
- package/dist/scenarioSkills.js +11 -6
- package/dist/seam.d.ts +16 -2
- package/dist/seam.js +10 -0
- package/dist/seatContract.d.ts +259 -9
- package/dist/seatContract.js +444 -15
- package/dist/sessionCostReading.d.ts +70 -0
- package/dist/sessionCostReading.js +150 -0
- package/dist/sessionHooksRoster.d.ts +4 -0
- package/dist/sessionHooksRoster.js +158 -0
- package/dist/sessionIdSegment.d.ts +1 -0
- package/dist/sessionIdSegment.js +4 -1
- package/dist/sessionMemoryErase.js +2 -1
- package/dist/sessionMemoryStatus.js +2 -2
- package/dist/sessionReadRedaction.d.ts +7 -0
- package/dist/sessionReadRedaction.js +26 -0
- package/dist/sessionSyncFileHistory.js +8 -9
- package/dist/settingsHooksSalvage.js +2 -1
- package/dist/sha256Bytes.d.ts +1 -0
- package/dist/sha256Bytes.js +46 -0
- package/dist/skillOverrideChain.d.ts +83 -0
- package/dist/skillOverrideChain.js +378 -0
- package/dist/skillsWireCaps.d.ts +3 -0
- package/dist/skillsWireCaps.js +16 -1
- package/dist/sseIdleTriage.js +2 -1
- package/dist/storeDurabilityWord.d.ts +15 -0
- package/dist/storeDurabilityWord.js +18 -0
- package/dist/storePostureCapability.d.ts +7 -3
- package/dist/storePostureCapability.js +69 -39
- package/dist/subagent/engineSubagentResume.js +2 -2
- package/dist/subagent/engineSubagentTail.js +2 -1
- package/dist/subagentContentStore.d.ts +11 -0
- package/dist/subagentContentStore.js +28 -2
- package/dist/toolResult.d.ts +1 -0
- package/dist/toolResult.js +2 -0
- package/dist/turnFailurePresentation.js +4 -10
- package/dist/userAttachmentEnvelope.d.ts +2 -1
- package/dist/userAttachmentEnvelope.js +10 -0
- package/dist/wireErrorTriage.js +2 -1
- package/dist/wireFailureShape.d.ts +4 -0
- package/dist/wireFailureShape.js +141 -19
- package/dist/wireRefusalCopy.d.ts +6 -5
- package/dist/wireRefusalCopy.js +49 -92
- package/docs/INTEGRATION-CLIENTS.md +2718 -17
- package/package.json +7 -3
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { UiLanguage } from './env/uiLanguage.js';
|
|
2
2
|
import type { ResumeStartupCause } from '@sema-agent/sdk';
|
|
3
3
|
import { RESUME_CONTEXT_UNAVAILABLE, CHECKPOINT_UNSUPPORTED_VERSION, CHECKPOINT_WALLTIME_AXIS_RETIRED, CHECKPOINT_CONFIG_REFUSED } from './engineErrorCodes.js';
|
|
4
|
+
import { type DecisionRefusalWayOut } from './checkpointRowVerdict.js';
|
|
4
5
|
export declare const RESUME_REFUSAL_CODES: readonly string[];
|
|
5
6
|
export interface ResumeRefusalDetail {
|
|
6
7
|
code: string;
|
|
@@ -50,7 +51,7 @@ export interface ParkedResumeStartupDetail {
|
|
|
50
51
|
export declare function parkedResumeStartupFromError(err: unknown, decision?: ParkedResumeStartupDecision): ParkedResumeStartupDetail | null;
|
|
51
52
|
export declare function parkedResumeStartupContent(detail: ParkedResumeStartupDetail, lang?: UiLanguage): string;
|
|
52
53
|
export interface CheckpointUnsupportedVersionDetail {
|
|
53
|
-
code:
|
|
54
|
+
code: typeof CHECKPOINT_UNSUPPORTED_VERSION;
|
|
54
55
|
retriable: true;
|
|
55
56
|
writerVersion?: string;
|
|
56
57
|
readerVersion?: string;
|
|
@@ -76,6 +77,7 @@ export interface RefusedParkContentInput {
|
|
|
76
77
|
readonly facts: RefusedParkFacts;
|
|
77
78
|
readonly lane: 'interactive' | 'print';
|
|
78
79
|
readonly runId?: string;
|
|
80
|
+
readonly wayOut?: DecisionRefusalWayOut | (string & {});
|
|
79
81
|
}
|
|
80
82
|
export declare function refusedParkContent(input: RefusedParkContentInput, lang?: UiLanguage): string;
|
|
81
83
|
export declare function refusedParkBlockedContent(taskId: string, lane?: 'interactive' | 'print', lang?: UiLanguage): string;
|
|
@@ -4,6 +4,7 @@ import { guardedRead, ownDataField, readOwnDataNonEmptyString, readOwnDataValue
|
|
|
4
4
|
import { CORE_RESUME_STARTUP_CAUSES } from './generated/engineFactTables.js';
|
|
5
5
|
import { RESUME_CONTEXT_UNAVAILABLE, RESUME_PLACEMENT_MISMATCH, RESUME_PREFLIGHT_REJECTED, RESUME_PRINCIPAL_MISMATCH, RESUME_COMPOSITION_MISMATCH, RESUME_PARENT_CONSTRAINT_MISSING, RESUME_PARENT_CONSTRAINT_MISMATCH, RESUME_CONSTRAINT_UNPROJECTABLE, 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, isRefusedParkCode, refusalSaysStillPending, refusalRetriableReading, } from './engineErrorCodes.js';
|
|
6
6
|
import { capForDisplay } from './fleetTaskDesc.js';
|
|
7
|
+
import { decisionRefusalWayOutContent } from './checkpointRowVerdict.js';
|
|
7
8
|
import { engineVersionTier } from './supportFloor.js';
|
|
8
9
|
import { resumeRetryLaterFromError } from './wireErrorTriage.js';
|
|
9
10
|
const REFUSAL_COPY_KEYS = Object.freeze({
|
|
@@ -286,7 +287,7 @@ export function refusedParkFromError(failure) {
|
|
|
286
287
|
function refusedParkShownRunId(runId) {
|
|
287
288
|
return typeof runId === 'string' && /^[A-Za-z0-9._:-]{1,128}$/.test(runId) ? runId : undefined;
|
|
288
289
|
}
|
|
289
|
-
function refusedParkWhy(code, field) {
|
|
290
|
+
function refusedParkWhy(code, field, newerEngine = false) {
|
|
290
291
|
switch (code) {
|
|
291
292
|
case CHECKPOINT_WALLTIME_AXIS_RETIRED:
|
|
292
293
|
return msg('resume.refusal.park.whyWalltime');
|
|
@@ -295,7 +296,7 @@ function refusedParkWhy(code, field) {
|
|
|
295
296
|
return msg('resume.refusal.park.whyDeps');
|
|
296
297
|
return msg(field === 'inheritedGate' ? 'resume.refusal.park.whyInheritedGate' : 'resume.refusal.park.whyConfigRefused');
|
|
297
298
|
default:
|
|
298
|
-
return msg('resume.refusal.park.whyUnsupported');
|
|
299
|
+
return msg(newerEngine ? 'resume.refusal.park.whyNewerEngine' : 'resume.refusal.park.whyUnsupported');
|
|
299
300
|
}
|
|
300
301
|
}
|
|
301
302
|
export function refusedParkContent(input, lang) {
|
|
@@ -306,13 +307,15 @@ export function refusedParkContent(input, lang) {
|
|
|
306
307
|
let field;
|
|
307
308
|
let stillPending;
|
|
308
309
|
let blockedBy;
|
|
310
|
+
let wayOut;
|
|
309
311
|
try {
|
|
310
312
|
what = input.what;
|
|
311
313
|
lane = input.lane;
|
|
312
314
|
runId = input.runId;
|
|
315
|
+
wayOut = input.wayOut;
|
|
313
316
|
}
|
|
314
317
|
catch {
|
|
315
|
-
what = lane = runId = undefined;
|
|
318
|
+
what = lane = runId = wayOut = undefined;
|
|
316
319
|
}
|
|
317
320
|
try {
|
|
318
321
|
const facts = input.facts;
|
|
@@ -326,7 +329,8 @@ export function refusedParkContent(input, lang) {
|
|
|
326
329
|
}
|
|
327
330
|
const code = rawCode === CHECKPOINT_WALLTIME_AXIS_RETIRED || rawCode === CHECKPOINT_CONFIG_REFUSED ? rawCode : CHECKPOINT_UNSUPPORTED_VERSION;
|
|
328
331
|
const shownWhat = typeof what === 'string' && what !== '' ? capForDisplay(what, 40) : msg('resume.refusal.park.whatDefault');
|
|
329
|
-
const
|
|
332
|
+
const newerWorker = wayOut === 'newer_worker' && stillPending !== false;
|
|
333
|
+
const why = refusedParkWhy(code, typeof field === 'string' ? field : undefined, newerWorker);
|
|
330
334
|
const shownRun = refusedParkShownRunId(runId);
|
|
331
335
|
const head = msg('resume.refusal.park.head', { what: shownWhat, why });
|
|
332
336
|
const configMayReturn = code === CHECKPOINT_CONFIG_REFUSED && field !== 'inheritedGate' ? msg(field === 'deps' ? 'resume.refusal.park.depsMayReturn' : 'resume.refusal.park.configMayReturn') : '';
|
|
@@ -335,10 +339,14 @@ export function refusedParkContent(input, lang) {
|
|
|
335
339
|
if (stillPending === false)
|
|
336
340
|
return renderMessage(msg('resume.refusal.park.printEnded', { head, code, blocked }), lang);
|
|
337
341
|
const cancel = `POST /v1/runs/${shownRun ?? '<run id>'}/cancel`;
|
|
342
|
+
if (newerWorker)
|
|
343
|
+
return renderMessage(msg('resume.refusal.park.printNewerWorker', { head, configMayReturn, code, wayOut: decisionRefusalWayOutContent('newer_worker', lang) ?? '', cancel, blocked }), lang);
|
|
338
344
|
return renderMessage(msg('resume.refusal.park.printHolds', { head, configMayReturn, code, cancel, blocked }), lang);
|
|
339
345
|
}
|
|
340
346
|
if (stillPending === false)
|
|
341
347
|
return renderMessage(msg('resume.refusal.park.interactiveEnded', { head }), lang);
|
|
348
|
+
if (newerWorker)
|
|
349
|
+
return renderMessage(msg('resume.refusal.park.interactiveNewerWorker', { head, configMayReturn, wayOut: decisionRefusalWayOutContent('newer_worker', lang) ?? '' }), lang);
|
|
342
350
|
return renderMessage(msg('resume.refusal.park.interactiveBusy', { head, configMayReturn }), lang);
|
|
343
351
|
}
|
|
344
352
|
export function refusedParkBlockedContent(taskId, lane = 'interactive', lang) {
|
|
@@ -2,9 +2,8 @@ import { createEngineCapReader } from './engineCapReader.js';
|
|
|
2
2
|
import { ownDataField } from './ownKey.js';
|
|
3
3
|
const CAPS_KEYS = {
|
|
4
4
|
conversationAnchor: 'resumeAt',
|
|
5
|
-
|
|
5
|
+
restoreFiles: 'restoreFiles',
|
|
6
6
|
codeOnly: 'rewindFilesTo',
|
|
7
|
-
restoreFilesEpoch: 'restoreFiles',
|
|
8
7
|
};
|
|
9
8
|
const _capsKeyPin = true;
|
|
10
9
|
void _capsKeyPin;
|
|
@@ -22,12 +21,13 @@ export function projectRewindArchiveCapability(caps) {
|
|
|
22
21
|
try {
|
|
23
22
|
if (caps === null || typeof caps !== 'object' || Array.isArray(caps))
|
|
24
23
|
return undefined;
|
|
24
|
+
const restoreFiles = bitOf(caps, CAPS_KEYS.restoreFiles);
|
|
25
25
|
return {
|
|
26
26
|
kind: 'present',
|
|
27
27
|
conversationAnchor: bitOf(caps, CAPS_KEYS.conversationAnchor),
|
|
28
|
-
forkRestore:
|
|
28
|
+
forkRestore: restoreFiles,
|
|
29
29
|
codeOnly: bitOf(caps, CAPS_KEYS.codeOnly),
|
|
30
|
-
restoreFilesEpoch:
|
|
30
|
+
restoreFilesEpoch: restoreFiles,
|
|
31
31
|
};
|
|
32
32
|
}
|
|
33
33
|
catch {
|
|
@@ -31,9 +31,10 @@ export type RunAbortCause = {
|
|
|
31
31
|
export declare const RUN_CANCELLED_CODE: "cancelled";
|
|
32
32
|
export declare function classifyRunAbortCause(record: unknown): RunAbortCause;
|
|
33
33
|
export type { AbortCause };
|
|
34
|
+
export type AbortCauseWord = AbortCause | 'stall_verdict';
|
|
34
35
|
export type AbortCauseReading = {
|
|
35
36
|
readonly kind: 'known';
|
|
36
|
-
readonly cause:
|
|
37
|
+
readonly cause: AbortCauseWord;
|
|
37
38
|
} | {
|
|
38
39
|
readonly kind: 'unrecognized';
|
|
39
40
|
readonly word: string;
|
package/dist/runCancelContext.js
CHANGED
|
@@ -100,6 +100,7 @@ const ABORT_CAUSE_SENTENCES = Object.freeze({
|
|
|
100
100
|
ask_park_grace_exhausted: 'Aborted: the connection dropped while a question or approval was pending, and the run could not be parked for later resumption in time ' +
|
|
101
101
|
'(cause ask_park_grace_exhausted) — not an engine error.',
|
|
102
102
|
cancel_verb: 'Cancelled: a cancel request to the engine stopped this run (cause cancel_verb) — not an engine error.',
|
|
103
|
+
stall_verdict: 'Aborted: the server had already marked this run as stalled (its heartbeat lapsed), so this leg stopped itself (cause stall_verdict) — not an engine error.',
|
|
103
104
|
});
|
|
104
105
|
const ABORT_CAUSE_UNRECOGNIZED_SENTENCE = 'Aborted by the engine for a reason this client does not recognize — not an engine error.';
|
|
105
106
|
function secondsText(ms) {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { createStreamDrainingLegs } from './streamDrainingLegs.js';
|
|
2
2
|
import { abortableSleep, settleWithinDeadline } from './abortableSleep.js';
|
|
3
3
|
import { readOwnDataValue } from './ownKey.js';
|
|
4
|
+
import { isStreamEndedWithoutTerminalError } from './sseIdleTriage.js';
|
|
4
5
|
const RUN_LEDGER_SNAPSHOT_BUDGET_MS = 8_000;
|
|
5
6
|
const UNNUMBERED_FRAME_CAP = 64;
|
|
6
7
|
const PARK_TRAILER_MAX = 4;
|
|
@@ -168,11 +169,10 @@ export async function readRunLedgerSnapshot(taskId, callId, deps, signal) {
|
|
|
168
169
|
}
|
|
169
170
|
catch (e) {
|
|
170
171
|
drainLegs.legEnded('threw');
|
|
171
|
-
|
|
172
|
-
if (!ac.signal.aborted && name === 'StreamEndedWithoutTerminalError')
|
|
172
|
+
if (!ac.signal.aborted && isStreamEndedWithoutTerminalError(e))
|
|
173
173
|
complete = true;
|
|
174
174
|
else
|
|
175
|
-
log(`[ledgerSnapshot] read-ended-unproven task=${taskId} name=${
|
|
175
|
+
log(`[ledgerSnapshot] read-ended-unproven task=${taskId} name=${errorNameOf(e)}`);
|
|
176
176
|
}
|
|
177
177
|
finally {
|
|
178
178
|
passAc.abort();
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { atMostOnceVerdictOf } from './atMostOnce.js';
|
|
2
2
|
import { readPermissionModeReceiptSegment } from './adapter/downstream/wiringManifestView.js';
|
|
3
3
|
import { displayUntrusted } from './displayUntrusted.js';
|
|
4
|
+
import { CORRUPT_ROW_ERROR_CODE, STEERING_NOT_RUNNING } from './engineErrorCodes.js';
|
|
4
5
|
import { SDK_PERMISSION_MODE_ADMISSION_FOLDS, SDK_PERMISSION_MODE_PERSIST_MISSES } from './generated/sdkFactTables.js';
|
|
5
6
|
import { msg, renderMessage } from './i18n/translate.js';
|
|
6
7
|
import { ownDataField, readOwnDataValue } from './ownKey.js';
|
|
@@ -8,8 +9,6 @@ import { permissionModeWriteAvailable } from './permissionModeWriteCapability.js
|
|
|
8
9
|
import { permissionModeTitle } from './permissionWireCaps.js';
|
|
9
10
|
import { isDisplayableWireCode } from './wireFailureShape.js';
|
|
10
11
|
export const PERMISSION_MODE_SWITCH_RESULT_KEYS = Object.freeze(['taskId', 'sessionId', 'status', 'permissionMode', 'admission', 'persisted', 'persistMiss']);
|
|
11
|
-
const NOT_RUNNING_CODE = 'steering.not_running';
|
|
12
|
-
const PRE_SWITCH_CORRUPT_CODE = 'corrupt';
|
|
13
12
|
function guardedSlot(o, key) {
|
|
14
13
|
if (o === null || (typeof o !== 'object' && typeof o !== 'function'))
|
|
15
14
|
return undefined;
|
|
@@ -79,11 +78,11 @@ function failureOutcomeOf(e) {
|
|
|
79
78
|
if (v.delivery === 'rejected' && v.status !== undefined) {
|
|
80
79
|
if (v.status === 404)
|
|
81
80
|
return Object.freeze({ kind: 'not-found' });
|
|
82
|
-
if (v.status === 409 && v.code ===
|
|
81
|
+
if (v.status === 409 && v.code === STEERING_NOT_RUNNING)
|
|
83
82
|
return Object.freeze({ kind: 'not-running' });
|
|
84
83
|
return Object.freeze({ kind: 'refused', status: v.status, ...(v.code !== undefined ? { errorCode: v.code } : {}) });
|
|
85
84
|
}
|
|
86
|
-
if (v.status === 500 && v.code ===
|
|
85
|
+
if (v.status === 500 && v.code === CORRUPT_ROW_ERROR_CODE)
|
|
87
86
|
return Object.freeze({ kind: 'refused', status: 500, errorCode: v.code });
|
|
88
87
|
return v.status !== undefined
|
|
89
88
|
? Object.freeze({ kind: 'unconfirmed', why: 'server-error', status: v.status })
|
package/dist/scenarioRefusal.js
CHANGED
|
@@ -1,23 +1,21 @@
|
|
|
1
1
|
import { capForDisplay } from './fleetTaskDesc.js';
|
|
2
2
|
import { readOwnDataValue } from './ownKey.js';
|
|
3
3
|
import { SCENARIO_ASSIGNMENT_UNKNOWN_ERROR_CODE } from './engineErrorCodes.js';
|
|
4
|
-
import {
|
|
4
|
+
import { liftLegacyRefusalFacts, readErrorString } from './wireFailureShape.js';
|
|
5
5
|
import { effectiveWireErrorCode } from './wireErrorTriage.js';
|
|
6
6
|
import { msg, renderMessage } from './i18n/translate.js';
|
|
7
7
|
const SCENARIO_REFUSAL_ERROR_MAX = 200;
|
|
8
|
-
function
|
|
9
|
-
if (detail === undefined)
|
|
10
|
-
return {};
|
|
8
|
+
function scenarioBits(read) {
|
|
11
9
|
let scenario;
|
|
12
10
|
let source;
|
|
13
11
|
try {
|
|
14
|
-
scenario =
|
|
12
|
+
scenario = read('scenario');
|
|
15
13
|
}
|
|
16
14
|
catch {
|
|
17
15
|
scenario = undefined;
|
|
18
16
|
}
|
|
19
17
|
try {
|
|
20
|
-
source =
|
|
18
|
+
source = read('source');
|
|
21
19
|
}
|
|
22
20
|
catch {
|
|
23
21
|
source = undefined;
|
|
@@ -42,20 +40,20 @@ export function scenarioRefusalOf(body) {
|
|
|
42
40
|
try {
|
|
43
41
|
if (!isPlainRecord(raw))
|
|
44
42
|
return Object.freeze({});
|
|
45
|
-
const
|
|
43
|
+
const ownOf = (o) => (key) => {
|
|
46
44
|
try {
|
|
47
|
-
return readOwnDataValue(
|
|
45
|
+
return readOwnDataValue(o, key);
|
|
48
46
|
}
|
|
49
47
|
catch {
|
|
50
48
|
return undefined;
|
|
51
49
|
}
|
|
52
50
|
};
|
|
53
|
-
const errorCode =
|
|
54
|
-
const error =
|
|
55
|
-
const
|
|
51
|
+
const errorCode = ownOf(raw)('errorCode');
|
|
52
|
+
const error = ownOf(raw)('error');
|
|
53
|
+
const facts = liftLegacyRefusalFacts(SCENARIO_ASSIGNMENT_UNKNOWN_ERROR_CODE, raw);
|
|
56
54
|
let bits = {};
|
|
57
55
|
try {
|
|
58
|
-
bits =
|
|
56
|
+
bits = scenarioBits(ownOf(facts));
|
|
59
57
|
}
|
|
60
58
|
catch {
|
|
61
59
|
bits = {};
|
|
@@ -80,7 +78,7 @@ export function scenarioRefusalFromError(err) {
|
|
|
80
78
|
return Object.freeze({
|
|
81
79
|
errorCode: SCENARIO_ASSIGNMENT_UNKNOWN_ERROR_CODE,
|
|
82
80
|
...(error !== undefined && error.length > 0 ? { error: capForDisplay(error, SCENARIO_REFUSAL_ERROR_MAX) } : {}),
|
|
83
|
-
...
|
|
81
|
+
...scenarioBits((key) => readErrorString(err, key)),
|
|
84
82
|
});
|
|
85
83
|
}
|
|
86
84
|
catch {
|
package/dist/scenarioSkills.js
CHANGED
|
@@ -49,24 +49,29 @@ export function scenarioSkillsOf(card) {
|
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
51
|
const SCENARIO_SKILLS_CAPABILITY_KEY = 'scenarioSkills';
|
|
52
|
+
const CAP_CONFIRMED = Object.freeze({ kind: 'confirmed' });
|
|
53
|
+
const CAP_ABSENT = Object.freeze({ kind: 'absent' });
|
|
54
|
+
const CAP_DECLINED = Object.freeze({ kind: 'declined' });
|
|
55
|
+
const CAP_UNREADABLE = Object.freeze({ kind: 'unreadable' });
|
|
56
|
+
const CAP_UNOBSERVED = Object.freeze({ kind: 'unobserved' });
|
|
52
57
|
export function observedScenarioSkillsCapability(baseUrl) {
|
|
53
58
|
try {
|
|
54
59
|
const base = baseUrl === undefined ? engineWireTargetBaseUrl() : baseUrl;
|
|
55
60
|
const slot = engineCapValue(typeof base === 'string' ? base : undefined, SCENARIO_SKILLS_CAPABILITY_KEY);
|
|
56
61
|
switch (slot.kind) {
|
|
57
62
|
case 'unobserved':
|
|
58
|
-
return
|
|
63
|
+
return CAP_UNOBSERVED;
|
|
59
64
|
case 'not_reported':
|
|
60
|
-
return
|
|
65
|
+
return CAP_ABSENT;
|
|
61
66
|
case 'unreadable':
|
|
62
|
-
return
|
|
67
|
+
return CAP_UNREADABLE;
|
|
63
68
|
case 'null':
|
|
64
|
-
return
|
|
69
|
+
return CAP_DECLINED;
|
|
65
70
|
case 'value':
|
|
66
|
-
return slot.value === true ?
|
|
71
|
+
return slot.value === true ? CAP_CONFIRMED : CAP_DECLINED;
|
|
67
72
|
}
|
|
68
73
|
}
|
|
69
74
|
catch {
|
|
70
|
-
return
|
|
75
|
+
return CAP_UNOBSERVED;
|
|
71
76
|
}
|
|
72
77
|
}
|
package/dist/seam.d.ts
CHANGED
|
@@ -10,7 +10,8 @@ import type { ToolKillCause } from './toolResult.js';
|
|
|
10
10
|
import type { HumanInputAttachmentView } from './ownKey.js';
|
|
11
11
|
import type { SubagentAliasScope } from './subagentContentStore.js';
|
|
12
12
|
import type { SessionBoxNoticeFacts } from './peerFrames.js';
|
|
13
|
-
import type {
|
|
13
|
+
import type { HostSettingNotice } from './hostTurnSettings.js';
|
|
14
|
+
import type { ResupplyTruncatedSource, TaskNotificationFields } from './notifications.js';
|
|
14
15
|
export interface AbortSignalLike {
|
|
15
16
|
readonly aborted: boolean;
|
|
16
17
|
}
|
|
@@ -167,7 +168,7 @@ export type ChromeEvent = {
|
|
|
167
168
|
} | ({
|
|
168
169
|
kind: 'run_cost_reconciled';
|
|
169
170
|
laneProof: LaneProof;
|
|
170
|
-
} & RunCostReconcile) | HumanInputChromeEvent | MessageCommittedChromeEvent | EngineNoticeChromeEvent | TextSegmentEndChromeEvent | ThinkingSegmentEndChromeEvent | ToolDisclosureChromeEvent | ToolProgressChromeEvent | ToolRosterDeltaChromeEvent | ContextUsageChromeEvent | CompactionOutcomeChromeEvent | CompactionStartedChromeEvent | SubagentStartedChromeEvent | PromptAssembledChromeEvent | MemorySavedChromeEvent | WiringManifestChromeEvent | ResultTextDivergedChromeEvent | ResultReplayedChromeEvent | ToolParkedChromeEvent | SubagentAliasChromeEvent | SessionBoxNoticeChromeEvent | ApprovalRequestChromeEvent | ApprovalRevokeChromeEvent | ApprovalCompleteChromeEvent | SessionTitledChromeEvent | {
|
|
171
|
+
} & RunCostReconcile) | HumanInputChromeEvent | MessageCommittedChromeEvent | EngineNoticeChromeEvent | TextSegmentEndChromeEvent | ThinkingSegmentEndChromeEvent | ToolDisclosureChromeEvent | ToolProgressChromeEvent | ToolRosterDeltaChromeEvent | ContextUsageChromeEvent | CompactionOutcomeChromeEvent | CompactionStartedChromeEvent | SubagentStartedChromeEvent | PromptAssembledChromeEvent | MemorySavedChromeEvent | WiringManifestChromeEvent | ResultTextDivergedChromeEvent | ResultReplayedChromeEvent | ToolParkedChromeEvent | SubagentAliasChromeEvent | SessionBoxNoticeChromeEvent | ResupplyTruncatedChromeEvent | HostSettingNoticeChromeEvent | ApprovalRequestChromeEvent | ApprovalRevokeChromeEvent | ApprovalCompleteChromeEvent | SessionTitledChromeEvent | {
|
|
171
172
|
kind: 'suspended_reopened';
|
|
172
173
|
laneProof: LaneProof;
|
|
173
174
|
reopen: Extract<SuspendedReopenReading, {
|
|
@@ -358,6 +359,19 @@ export interface SubagentAliasChromeEvent {
|
|
|
358
359
|
seq?: number;
|
|
359
360
|
}
|
|
360
361
|
export type SessionBoxNoticeChromeEvent = SessionBoxNoticeChromeEnvelope & SessionBoxNoticeFacts;
|
|
362
|
+
export interface ResupplyTruncatedChromeEvent {
|
|
363
|
+
kind: 'resupply_truncated';
|
|
364
|
+
laneProof: LaneProof;
|
|
365
|
+
source: ResupplyTruncatedSource;
|
|
366
|
+
taskId: string;
|
|
367
|
+
bytes: number;
|
|
368
|
+
droppedKeys: readonly string[];
|
|
369
|
+
text: string;
|
|
370
|
+
}
|
|
371
|
+
export type HostSettingNoticeChromeEvent = {
|
|
372
|
+
kind: 'host_setting_notice';
|
|
373
|
+
laneProof: LaneProof;
|
|
374
|
+
} & HostSettingNotice;
|
|
361
375
|
export interface SessionBoxNoticeChromeEnvelope {
|
|
362
376
|
kind: 'session_box_notice';
|
|
363
377
|
laneProof: LaneProof;
|
package/dist/seam.js
CHANGED
|
@@ -152,6 +152,16 @@ const CHROME_ARM_TABLE = {
|
|
|
152
152
|
'渲 `text`(数据面英文)或按界面语言调 `sessionBoxNoticeSentence(本臂, lang)`;🔴 同一条通告有两个载体(转录行 + 本臂),接本臂的宿主按 `rowUuid` 把那一行摘掉、只渲一个;' +
|
|
153
153
|
'`state` 是开集机读位,别回显、别按它猜句子;typed 正体缺席时本臂整个不发(不铸状态词)。',
|
|
154
154
|
},
|
|
155
|
+
resupply_truncated: {
|
|
156
|
+
required: false,
|
|
157
|
+
duty: '可选:停驻补投帧只带了最小形的披露 —— 渲 `text`(数据面英文)或按界面语言调 `resupplyTruncatedSentence(本臂, lang)`,放在这条通知的转录行旁(task_notification)或完成通告旁(workflow_complete)。' +
|
|
158
|
+
'`droppedKeys` / `bytes` 是机读位,别拼进句子;披露位缺席(全形帧 / 老服务端)或坏形时本臂整个不发,不要自己据「摘要很短」推断截断。',
|
|
159
|
+
},
|
|
160
|
+
host_setting_notice: {
|
|
161
|
+
required: false,
|
|
162
|
+
duty: '可选:宿主自供设置项的一句通告(`hostTurnSettings()` 产物 `notices` 的一句;载荷 = `HostSettingNotice` 原样)。按 `plane` 呈现:`turn` 本回合系统行 / `session` 每会话每句一次 / ' +
|
|
163
|
+
'`diagnostic` 不渲只记;🔴 非终态:不是失败卡、不改回合状态;`key` / `cause` 缺席 = 这一句不挂某一行,不是坏形。铸口只有 `hostSettingNoticeEventsOf`,别手拼。',
|
|
164
|
+
},
|
|
155
165
|
result_text_diverged: {
|
|
156
166
|
required: false,
|
|
157
167
|
duty: '可选:终帧正文与已上屏正文**互相都不是对方前缀**时的诚实披露。🔴 处置是把这一拍的转录行**改口**' +
|