@sema-agent/client-core 0.100.0 → 0.101.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 +395 -0
- package/README.md +164 -117
- package/dist/adapt/arms.js +51 -16
- package/dist/adapt/textStream.js +7 -4
- package/dist/adapt/toolCards.js +9 -8
- package/dist/adapt.js +7 -1
- package/dist/adapter/activeRunSelfHeal.d.ts +24 -2
- package/dist/adapter/activeRunSelfHeal.js +108 -6
- package/dist/adapter/downstream/eventToSdkMessage.js +33 -12
- package/dist/adapter/downstream/terminalToSdkResult.d.ts +60 -1
- package/dist/adapter/downstream/terminalToSdkResult.js +209 -39
- package/dist/adapter/runStream.d.ts +4 -4
- package/dist/adapter/runStream.js +158 -43
- package/dist/agentsWireCaps.d.ts +2 -7
- package/dist/agentsWireCaps.js +1 -2
- package/dist/approvalDecidedByCapability.js +2 -2
- package/dist/approvalFrameFamilies.d.ts +33 -0
- package/dist/approvalFrameFamilies.js +120 -0
- package/dist/approvalsStreamLiveCapability.js +2 -2
- package/dist/attachmentsWireCaps.js +41 -13
- package/dist/callerCwdCapability.js +2 -2
- package/dist/centerWiringCapability.js +2 -2
- package/dist/clockReading.d.ts +2 -0
- package/dist/clockReading.js +4 -0
- package/dist/cloudConfigWireCaps.d.ts +19 -5
- package/dist/cloudConfigWireCaps.js +193 -56
- package/dist/coreValuePorts.d.ts +12 -2
- package/dist/coreValuePorts.js +9 -0
- package/dist/decideFailureNote.js +5 -3
- package/dist/decideReceipt.js +2 -2
- package/dist/deviceExecutorManagementCapability.js +2 -2
- package/dist/deviceFlowPolling.js +1 -1
- package/dist/disableSkillsWire.d.ts +1 -1
- package/dist/disableSkillsWire.js +4 -3
- package/dist/displayUntrusted.d.ts +1 -0
- package/dist/displayUntrusted.js +65 -8
- package/dist/engineCapReader.js +1 -1
- package/dist/engineConfigDrift.js +1 -1
- package/dist/engineErrorCodes.d.ts +14 -5
- package/dist/engineErrorCodes.js +27 -6
- package/dist/engineGenerationConvergence.d.ts +39 -0
- package/dist/engineGenerationConvergence.js +95 -0
- package/dist/engineGenerationPort.d.ts +61 -0
- package/dist/engineGenerationPort.js +144 -0
- package/dist/engineHealthFacts.d.ts +23 -0
- package/dist/engineHealthFacts.js +92 -0
- package/dist/engineIdentity.d.ts +4 -0
- package/dist/engineIdentity.js +11 -0
- package/dist/engineNoticeCodes.d.ts +2 -5
- package/dist/engineRowRef.js +3 -0
- package/dist/engineSessionMessages.js +2 -2
- package/dist/engineToolDirectory.js +2 -2
- package/dist/engineWireFor.d.ts +99 -0
- package/dist/engineWireFor.js +248 -6
- package/dist/engineWireTarget.d.ts +1 -0
- package/dist/engineWireTarget.js +8 -0
- package/dist/env/uiLanguage.js +1 -1
- package/dist/errorSupplementRoles.d.ts +3 -0
- package/dist/errorSupplementRoles.js +37 -0
- package/dist/executionLaneCapability.js +2 -2
- package/dist/fileHistoryCaptureCapability.js +3 -3
- package/dist/finalVerifyWire.d.ts +6 -3
- package/dist/finalVerifyWire.js +6 -23
- package/dist/flagInput.d.ts +4 -0
- package/dist/flagInput.js +24 -0
- package/dist/fleet/fleetLedger.js +5 -2
- package/dist/fleet/fleetProjection.d.ts +1 -0
- package/dist/fleet/fleetProjection.js +15 -2
- package/dist/gateVocabulary.js +3 -0
- package/dist/generated/engineFactTables.d.ts +7 -3
- package/dist/generated/engineFactTables.js +52 -0
- package/dist/generated/engineNoticeTables.js +12 -0
- package/dist/generated/settingsSchemaActiveTiers.d.ts +1 -0
- package/dist/generated/settingsSchemaActiveTiers.js +14 -0
- package/dist/generated/settingsSchemaCallerTextEcho.d.ts +1 -0
- package/dist/generated/settingsSchemaCallerTextEcho.js +8 -0
- package/dist/generated/settingsSchemaControlAndBidi.d.ts +1 -0
- package/dist/generated/settingsSchemaControlAndBidi.js +8 -0
- package/dist/generated/settingsSchemaDefaultModel.d.ts +11 -0
- package/dist/generated/settingsSchemaDefaultModel.js +25 -0
- package/dist/generated/settingsSchemaFns.d.ts +54 -0
- package/dist/generated/settingsSchemaFns.js +26 -1
- package/dist/generated/settingsSchemaMcpRequestEntry.d.ts +1 -1
- package/dist/generated/settingsSchemaMcpRequestEntry.js +1 -7
- package/dist/generated/settingsSchemaSafetyMergeSpec.d.ts +1 -0
- package/dist/generated/settingsSchemaSafetyMergeSpec.js +95 -0
- package/dist/generated/settingsSchemaSettingsSources.d.ts +1 -0
- package/dist/generated/settingsSchemaSettingsSources.js +58 -0
- package/dist/generated/settingsSchemaTables.d.ts +2 -0
- package/dist/generated/settingsSchemaTables.js +13 -0
- package/dist/generated/settingsSchemaUrlPattern.d.ts +1 -0
- package/dist/generated/settingsSchemaUrlPattern.js +183 -0
- package/dist/headlessPermissionModeWire.d.ts +18 -2
- package/dist/headlessPermissionModeWire.js +30 -19
- package/dist/hitl/allowRuleShadow.js +7 -5
- package/dist/hitl/approvalCardReading.d.ts +3 -0
- package/dist/hitl/approvalCardReading.js +17 -0
- package/dist/hitl/approvalCompleteParked.js +1 -1
- package/dist/hitl/approvalDelivery.d.ts +87 -0
- package/dist/hitl/approvalDelivery.js +193 -0
- package/dist/hitl/approvalResolution.d.ts +11 -0
- package/dist/hitl/approvalResolution.js +50 -11
- package/dist/hitl/askClassPair.d.ts +6 -0
- package/dist/hitl/askClassPair.js +30 -3
- package/dist/hitl/askParkAutoReopenBlock.d.ts +30 -0
- package/dist/hitl/askParkAutoReopenBlock.js +117 -0
- package/dist/hitl/askParkRowRouting.js +4 -1
- package/dist/hitl/attributionLadder.d.ts +42 -3
- package/dist/hitl/attributionLadder.js +79 -8
- package/dist/hitl/automaticAnswerVerdict.d.ts +6 -1
- package/dist/hitl/automaticAnswerVerdict.js +46 -11
- package/dist/hitl/crashConverged.js +2 -2
- package/dist/hitl/decisionConflict.d.ts +6 -2
- package/dist/hitl/decisionConflict.js +24 -9
- package/dist/hitl/decisionRefusal.d.ts +20 -10
- package/dist/hitl/decisionRefusal.js +99 -54
- package/dist/hitl/decisionSend.d.ts +3 -0
- package/dist/hitl/decisionSend.js +87 -103
- package/dist/hitl/frameRouter.d.ts +1 -0
- package/dist/hitl/frameRouter.js +9 -2
- package/dist/hitl/hitlBridge.d.ts +18 -6
- package/dist/hitl/hitlBridge.js +41 -37
- package/dist/hitl/livePendingAsk.js +4 -3
- package/dist/hitl/noAllowCause.js +1 -1
- package/dist/hitl/parkResolver.js +3 -2
- package/dist/hitl/persistedRulesWire.js +1 -0
- package/dist/hitl/planReviewWire.d.ts +4 -0
- package/dist/hitl/planReviewWire.js +59 -30
- package/dist/hitl/resumeRunningCard.d.ts +3 -2
- package/dist/hitl/resumeRunningCard.js +17 -11
- package/dist/hitl/sessionPolicyDeliverable.d.ts +5 -2
- package/dist/hitl/sessionPolicyDeliverable.js +62 -29
- package/dist/hitl/sessionPolicyWire.d.ts +13 -3
- package/dist/hitl/sessionPolicyWire.js +81 -16
- package/dist/hitl/standingRows.js +1 -1
- package/dist/hitl/toolApprovalWire.d.ts +9 -10
- package/dist/hitl/toolApprovalWire.js +72 -54
- package/dist/hookMatcherVerdict.d.ts +2 -0
- package/dist/hookMatcherVerdict.js +12 -0
- package/dist/hooksCompactTransition.d.ts +19 -0
- package/dist/hooksCompactTransition.js +41 -0
- package/dist/hooksWireCaps.d.ts +1 -1
- package/dist/hooksWireCaps.js +202 -203
- package/dist/host.d.ts +1 -14
- package/dist/host.js +0 -8
- package/dist/hostCallbackGuard.d.ts +1 -0
- package/dist/hostCallbackGuard.js +1 -1
- package/dist/hostSettingsSource.d.ts +172 -0
- package/dist/hostSettingsSource.js +675 -0
- package/dist/hostTurnSettings.d.ts +73 -17
- package/dist/hostTurnSettings.js +594 -97
- package/dist/httpHookPolicy.d.ts +37 -0
- package/dist/httpHookPolicy.js +176 -0
- package/dist/humanTurn.d.ts +2 -1
- package/dist/humanTurn.js +37 -7
- package/dist/humanTurnRead.js +4 -3
- package/dist/humanTurnSentences.d.ts +10 -0
- package/dist/humanTurnSentences.js +74 -0
- package/dist/i18n/messages.en.d.ts +184 -2
- package/dist/i18n/messages.en.js +187 -5
- package/dist/i18n/messages.zh.js +197 -5
- package/dist/i18n/translate.js +3 -3
- package/dist/index.d.ts +69 -15
- package/dist/index.js +45 -13
- package/dist/inheritEnvCapability.d.ts +3 -1
- package/dist/inheritEnvCapability.js +31 -17
- package/dist/inheritEnvWire.d.ts +2 -1
- package/dist/inheritEnvWire.js +11 -5
- package/dist/interactiveToolsWire.d.ts +4 -2
- package/dist/interactiveToolsWire.js +5 -5
- package/dist/jsonFaithful.d.ts +20 -0
- package/dist/jsonFaithful.js +152 -0
- package/dist/limitsWire.d.ts +7 -2
- package/dist/limitsWire.js +19 -13
- package/dist/liveInitToolFace.d.ts +6 -1
- package/dist/liveInitToolFace.js +5 -3
- package/dist/liveModelCatalog.d.ts +22 -0
- package/dist/liveModelCatalog.js +132 -18
- package/dist/mcpPanel.js +1 -1
- package/dist/mcpProbeCapability.js +2 -2
- package/dist/mcpStatusSupersetKeys.d.ts +24 -0
- package/dist/mcpStatusSupersetKeys.js +45 -0
- package/dist/mcpToolToggles.js +2 -1
- package/dist/mcpWireCaps.d.ts +39 -1
- package/dist/mcpWireCaps.js +254 -50
- package/dist/memoryComplianceCapability.js +2 -2
- package/dist/memoryOriginCapability.js +2 -2
- package/dist/model/catalogDefault.d.ts +24 -0
- package/dist/model/catalogDefault.js +4 -0
- package/dist/model/liveCatalogShape.js +5 -4
- package/dist/model/modelsPolicy.js +4 -3
- package/dist/model/onboardJudgement.d.ts +1 -0
- package/dist/model/onboardJudgement.js +1 -1
- package/dist/model/subagentModelWord.js +2 -2
- package/dist/modelCapabilityProbe.js +6 -6
- package/dist/modelIdentityResolvability.d.ts +10 -1
- package/dist/modelIdentityResolvability.js +62 -39
- package/dist/modsKernelIdentity.d.ts +10 -0
- package/dist/modsKernelIdentity.js +103 -0
- package/dist/modsKernelTransit.d.ts +8 -0
- package/dist/modsKernelTransit.js +6 -0
- package/dist/notifications.d.ts +30 -12
- package/dist/notifications.js +241 -53
- package/dist/outputStyleSeatCapability.js +2 -2
- package/dist/ownKey.d.ts +11 -0
- package/dist/ownKey.js +164 -3
- package/dist/panelReduce.js +1 -1
- package/dist/peerFrames.d.ts +1 -1
- package/dist/peerFrames.js +6 -2
- package/dist/peerLaneCapability.js +2 -2
- package/dist/permissionModesCapability.js +4 -4
- package/dist/permissionRuleIssue.js +2 -0
- package/dist/permissionRulesWriteCapability.js +2 -2
- package/dist/permissionsAllowGrantCapability.js +2 -2
- package/dist/permissionsDeclaration.d.ts +43 -4
- package/dist/permissionsDeclaration.js +102 -35
- package/dist/pluginHooksWire.d.ts +20 -4
- package/dist/pluginHooksWire.js +92 -53
- package/dist/prepareRefusal.d.ts +3 -2
- package/dist/prepareRefusal.js +27 -9
- package/dist/printInitToolFace.js +2 -2
- package/dist/printModelStatus.js +1 -1
- package/dist/projectMemory.d.ts +32 -0
- package/dist/projectMemory.js +70 -0
- package/dist/promptBlockedCopy.d.ts +2 -1
- package/dist/promptBlockedCopy.js +2 -1
- package/dist/promptDelivery.d.ts +23 -3
- package/dist/promptDelivery.js +169 -30
- package/dist/providerRejection.d.ts +19 -1
- package/dist/providerRejection.js +75 -4
- package/dist/queuedDelivery.d.ts +48 -0
- package/dist/queuedDelivery.js +233 -0
- package/dist/reattachWindow.d.ts +94 -0
- package/dist/reattachWindow.js +127 -0
- package/dist/request/printNotification.d.ts +1 -1
- package/dist/request/printNotification.js +5 -1
- package/dist/request/submissionIdentity.d.ts +37 -0
- package/dist/request/submissionIdentity.js +65 -0
- package/dist/request/taskRequest.d.ts +12 -4
- package/dist/request/taskRequest.js +221 -152
- package/dist/resultFrameKeys.d.ts +1 -0
- package/dist/resultFrameKeys.js +4 -1
- package/dist/retryStatus.d.ts +8 -0
- package/dist/retryStatus.js +57 -9
- package/dist/rewindArchiveCapability.js +2 -2
- package/dist/rewindEngineAction.d.ts +2 -0
- package/dist/rewindEngineAction.js +23 -1
- package/dist/rowKind.d.ts +36 -0
- package/dist/rowKind.js +97 -0
- package/dist/ruleCompileVerdict.d.ts +18 -0
- package/dist/ruleCompileVerdict.js +67 -2
- package/dist/ruleReadings.d.ts +58 -0
- package/dist/ruleReadings.js +132 -0
- package/dist/ruleRefusalSentence.d.ts +4 -0
- package/dist/ruleRefusalSentence.js +9 -3
- package/dist/runCancelContext.d.ts +0 -1
- package/dist/runCancelContext.js +1 -2
- package/dist/runTerminal.d.ts +5 -0
- package/dist/runTerminal.js +52 -17
- package/dist/sandboxWire.d.ts +1 -1
- package/dist/sandboxWire.js +4 -6
- package/dist/scenarioRefusal.js +1 -1
- package/dist/scenarioSkills.d.ts +20 -0
- package/dist/scenarioSkills.js +72 -0
- package/dist/scenarioWire.d.ts +5 -2
- package/dist/scenarioWire.js +9 -9
- package/dist/sealedKeyCapability.js +2 -2
- package/dist/seam.d.ts +2 -0
- package/dist/seam.js +2 -2
- package/dist/seatContract.d.ts +46 -1
- package/dist/seatContract.js +49 -19
- package/dist/selfOrchestrationDenial.js +1 -1
- package/dist/sessionPolicyCapability.js +2 -2
- package/dist/sessionRulesChildrenReadLive.d.ts +6 -0
- package/dist/sessionRulesChildrenReadLive.js +5 -0
- package/dist/sessionRulesNamespaceFormsCapability.d.ts +12 -0
- package/dist/sessionRulesNamespaceFormsCapability.js +29 -0
- package/dist/sessionSyncFileHistoryCapability.js +2 -2
- package/dist/settingsCredentialKeyPaths.js +60 -5
- package/dist/settingsHooksSalvage.d.ts +1 -0
- package/dist/settingsHooksSalvage.js +7 -1
- package/dist/settingsLayerAdmission.d.ts +4 -0
- package/dist/settingsLayerAdmission.js +16 -0
- package/dist/skillToolListsCapability.js +6 -5
- package/dist/skillsWireCaps.d.ts +14 -0
- package/dist/skillsWireCaps.js +47 -16
- package/dist/slashCommandGate.d.ts +24 -0
- package/dist/slashCommandGate.js +74 -0
- package/dist/slashCommandTable.d.ts +14 -0
- package/dist/slashCommandTable.js +99 -0
- package/dist/sqlEngineCapability.js +2 -2
- package/dist/steerPriorityCapability.js +2 -2
- package/dist/storePostureCapability.js +2 -2
- package/dist/subagent/agentStateDetail.js +1 -1
- package/dist/subagent/engineDelegatedPrompt.d.ts +9 -0
- package/dist/subagent/engineDelegatedPrompt.js +38 -7
- package/dist/subagent/engineRowStopGate.js +2 -2
- package/dist/subagent/engineSubagentResume.js +3 -3
- package/dist/subagent/engineTaskHandleWire.d.ts +1 -0
- package/dist/subagent/engineTaskHandleWire.js +10 -0
- package/dist/submitFailure.d.ts +8 -0
- package/dist/submitFailure.js +17 -0
- package/dist/supportFloor.d.ts +1 -0
- package/dist/supportFloor.js +7 -0
- package/dist/terminationIntent.d.ts +55 -0
- package/dist/terminationIntent.js +352 -0
- package/dist/toolHistoryMismatch.d.ts +8 -0
- package/dist/toolHistoryMismatch.js +37 -6
- package/dist/toolResult.d.ts +13 -3
- package/dist/toolResult.js +158 -9
- package/dist/toolResultContent.d.ts +13 -0
- package/dist/toolResultContent.js +82 -7
- package/dist/toolRoster.d.ts +18 -0
- package/dist/toolRoster.js +64 -0
- package/dist/turnFailurePresentation.js +27 -90
- package/dist/usageLimitAutoResume.d.ts +74 -0
- package/dist/usageLimitAutoResume.js +227 -0
- package/dist/userAttachmentEnvelope.js +1 -1
- package/dist/userAttachmentSeat.js +5 -5
- package/dist/userInvokedSkillsCapability.js +2 -2
- package/dist/webSearchBackendCapability.js +2 -2
- package/dist/wireErrorTriage.js +99 -50
- package/dist/wireFailureShape.d.ts +25 -1
- package/dist/wireFailureShape.js +92 -5
- package/dist/wireRefusalCopy.d.ts +24 -1
- package/dist/wireRefusalCopy.js +253 -32
- package/dist/wiringFleetDoctor.d.ts +3 -0
- package/dist/wiringFleetDoctor.js +21 -0
- package/dist/workflow.d.ts +2 -1
- package/dist/workflow.js +38 -1
- package/dist/workflowClient.d.ts +2 -7
- package/dist/workflowsJournalCapability.js +2 -2
- package/dist/writeProtectionCapability.js +2 -2
- package/docs/INTEGRATION-CLIENTS.md +607 -181
- package/package.json +14 -3
package/dist/wireRefusalCopy.js
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
import { PROTOCOL_ERROR_NAME, THROWN_SLOT_UNREADABLE, protocolErrorNameOf, readErrorNumber, readErrorRecord, readErrorStrictStringList, readErrorString, readErrorStringList, readRefusalField, readThrownSlot, readThrownStatusSlot } from './wireFailureShape.js';
|
|
2
|
-
import { readOwnDataValue, readOwnNonEmptyString } from './ownKey.js';
|
|
3
|
-
import { ACTIVE_RUN_BUSY_ERROR_CODE, FLEET_LEASE_UNAVAILABLE, REQUEST_AUTONOMY_LANE_REFUSED, REQUEST_FIELD_CONFLICT, RESUME_OUTCOME_INVALID,
|
|
1
|
+
import { PROTOCOL_ERROR_NAME, REFUSAL_PROBLEMS_READ_MAX, THROWN_SLOT_UNREADABLE, effectiveWireCodeReading, isSlotCarrier, protocolErrorNameOf, readErrorNumber, readErrorRecord, readErrorStrictStringList, readErrorString, readErrorStringList, readRefusalField, readThrownSlot, readThrownStatusSlot } from './wireFailureShape.js';
|
|
2
|
+
import { appendOwnElement, guardedRead, readOwnDataValue, readOwnNonEmptyString } from './ownKey.js';
|
|
3
|
+
import { ACTIVE_RUN_BUSY_ERROR_CODE, FLEET_LEASE_UNAVAILABLE, REQUEST_AUTONOMY_LANE_REFUSED, REQUEST_FIELD_CONFLICT, RESUME_OUTCOME_INVALID, USAGE_WINDOW_EXHAUSTED, USER_ATTACHMENT_INVALID_ERROR_CODE, USER_INVOKED_SKILL_UNKNOWN_ERROR_CODE } from './engineErrorCodes.js';
|
|
4
4
|
import { capForDisplay } from './fleetTaskDesc.js';
|
|
5
5
|
import { effectiveWireErrorCode } from './wireErrorTriage.js';
|
|
6
6
|
import { CORE_TOOL_DECLARATION_CODES } from './generated/engineFactTables.js';
|
|
7
7
|
import { prepareRefusalNoteOf } from './prepareRefusal.js';
|
|
8
|
+
import { PERMISSION_RULE_ISSUE_CODES, permissionRuleIssueDetail } from './permissionRuleIssue.js';
|
|
9
|
+
import { ruleRefusalListText } from './ruleRefusalSentence.js';
|
|
8
10
|
import { msg, renderMessage } from './i18n/translate.js';
|
|
9
11
|
export const CONFLICT_APPROVAL_SETTLED = 'conflict.approval_settled';
|
|
10
12
|
export const CONFLICT_RUN_NOT_RUNNING = 'conflict.run_not_running';
|
|
@@ -84,6 +86,82 @@ export function usageWindowExhaustedContent(detail, lang) {
|
|
|
84
86
|
? `${head} · ${renderMessage(msg('notice.wireRefusal.sendAgainAbout', { wait: humanWait(detail.retryAfterSec) }), lang)}`
|
|
85
87
|
: `${head} · ${renderMessage(msg('notice.wireRefusal.usageWindow.unknownWait'), lang)}`;
|
|
86
88
|
}
|
|
89
|
+
export function quotaExhaustedFromError(err) {
|
|
90
|
+
if (readThrownSlot(err, 'status', 'data') !== 429 || readThrownSlot(err, 'errorCode', 'data') !== 'quota_exhausted')
|
|
91
|
+
return null;
|
|
92
|
+
const detail = readThrownSlot(err, 'detail', 'data');
|
|
93
|
+
const slot = (key) => (typeof detail === 'object' && detail !== null ? readThrownSlot(detail, key, 'data') : undefined);
|
|
94
|
+
const windowType = slot('windowType');
|
|
95
|
+
const remaining = slot('remaining');
|
|
96
|
+
const resetAt = slot('resetAt');
|
|
97
|
+
const isEstimate = slot('isEstimate');
|
|
98
|
+
const pool = slot('pool');
|
|
99
|
+
const retryAfterSec = slot('retryAfterSec');
|
|
100
|
+
return {
|
|
101
|
+
...(windowType === 'fiveHour' || windowType === 'weekly' || windowType === 'budget' ? { windowType } : {}),
|
|
102
|
+
...(typeof remaining === 'number' && Number.isFinite(remaining) ? { remaining } : {}),
|
|
103
|
+
...(typeof resetAt === 'string' || resetAt === null ? { resetAt } : {}),
|
|
104
|
+
...(typeof isEstimate === 'boolean' ? { isEstimate } : {}),
|
|
105
|
+
...(typeof pool === 'string' && pool.length > 0 ? { pool } : {}),
|
|
106
|
+
...(typeof retryAfterSec === 'number' && Number.isFinite(retryAfterSec) ? { retryAfterSec } : {}),
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
const QUOTA_MONTH_KEYS = [
|
|
110
|
+
'notice.failure.month.jan',
|
|
111
|
+
'notice.failure.month.feb',
|
|
112
|
+
'notice.failure.month.mar',
|
|
113
|
+
'notice.failure.month.apr',
|
|
114
|
+
'notice.failure.month.may',
|
|
115
|
+
'notice.failure.month.jun',
|
|
116
|
+
'notice.failure.month.jul',
|
|
117
|
+
'notice.failure.month.aug',
|
|
118
|
+
'notice.failure.month.sep',
|
|
119
|
+
'notice.failure.month.oct',
|
|
120
|
+
'notice.failure.month.nov',
|
|
121
|
+
'notice.failure.month.dec',
|
|
122
|
+
];
|
|
123
|
+
export function quotaResetInstantText(resetAtIso, nowMs, lang) {
|
|
124
|
+
const t = Date.parse(resetAtIso);
|
|
125
|
+
if (!Number.isFinite(t))
|
|
126
|
+
return undefined;
|
|
127
|
+
const d = new Date(t);
|
|
128
|
+
const now = new Date(nowMs);
|
|
129
|
+
const hm = `${String(d.getHours()).padStart(2, '0')}:${String(d.getMinutes()).padStart(2, '0')}`;
|
|
130
|
+
const sameDay = d.getFullYear() === now.getFullYear() && d.getMonth() === now.getMonth() && d.getDate() === now.getDate();
|
|
131
|
+
if (sameDay)
|
|
132
|
+
return hm;
|
|
133
|
+
const monthKey = QUOTA_MONTH_KEYS[d.getMonth()];
|
|
134
|
+
return renderMessage(msg('notice.failure.quota.instantOtherDay', { month: monthKey === undefined ? '' : msg(monthKey), day: d.getDate(), time: hm }), lang);
|
|
135
|
+
}
|
|
136
|
+
export function quotaExhaustedContent(detail, nowMs, lang) {
|
|
137
|
+
const part = (key, params) => renderMessage(msg(key, params), lang);
|
|
138
|
+
const parts = [];
|
|
139
|
+
if (detail.windowType === 'fiveHour')
|
|
140
|
+
parts.push(part('notice.failure.quota.fiveHour'));
|
|
141
|
+
else if (detail.windowType === 'weekly')
|
|
142
|
+
parts.push(part('notice.failure.quota.weekly'));
|
|
143
|
+
else if (detail.windowType === 'budget') {
|
|
144
|
+
if (detail.pool === 'personal')
|
|
145
|
+
parts.push(part('notice.failure.quota.budgetPersonal'));
|
|
146
|
+
else if (detail.pool)
|
|
147
|
+
parts.push(part('notice.failure.quota.budgetPool', { pool: detail.pool }));
|
|
148
|
+
else
|
|
149
|
+
parts.push(part('notice.failure.quota.budget'));
|
|
150
|
+
}
|
|
151
|
+
else
|
|
152
|
+
parts.push(part('notice.failure.quota.usage'));
|
|
153
|
+
if (typeof detail.remaining === 'number' && Number.isFinite(detail.remaining)) {
|
|
154
|
+
parts.push(detail.windowType === 'budget'
|
|
155
|
+
? part('notice.failure.quota.remainingBudget', { amount: `$${(detail.remaining / 1_000_000).toFixed(2)}` })
|
|
156
|
+
: part('notice.failure.quota.remainingTokens', { count: detail.remaining.toLocaleString('en-US') }));
|
|
157
|
+
}
|
|
158
|
+
const resetText = typeof detail.resetAt === 'string' ? quotaResetInstantText(detail.resetAt, nowMs, lang) : undefined;
|
|
159
|
+
if (resetText)
|
|
160
|
+
parts.push(detail.isEstimate === false ? part('notice.failure.quota.resetAt', { time: resetText }) : part('notice.failure.quota.resetAround', { time: resetText }));
|
|
161
|
+
parts.push(part('notice.failure.quota.refresh'));
|
|
162
|
+
parts.push(part('notice.failure.quota.noBypass'));
|
|
163
|
+
return parts.join(part('notice.failure.quota.join'));
|
|
164
|
+
}
|
|
87
165
|
const positiveFinite = (v) => typeof v === 'number' && Number.isFinite(v) && v > 0;
|
|
88
166
|
export function fleetLeaseUnavailableFromError(err) {
|
|
89
167
|
if (err === null || typeof err !== 'object')
|
|
@@ -142,7 +220,7 @@ const RETIRED_DECISION_KEY = 'settledBy';
|
|
|
142
220
|
const APPROVAL_NON_BINDING_FIELDS = new Set(['hostDecision', 'approver']);
|
|
143
221
|
export function denyAttributionRefusalFromError(err, sentAttributionKey) {
|
|
144
222
|
try {
|
|
145
|
-
if (err
|
|
223
|
+
if (!isSlotCarrier(err))
|
|
146
224
|
return null;
|
|
147
225
|
const o = err;
|
|
148
226
|
const rawStatus = readThrownStatusSlot(o);
|
|
@@ -255,44 +333,20 @@ const BUCKET_OF_FIELD = Object.freeze({
|
|
|
255
333
|
});
|
|
256
334
|
const nonNegInt = (v) => (typeof v === 'number' && Number.isSafeInteger(v) && v >= 0 ? v : undefined);
|
|
257
335
|
const posInt = (v) => (typeof v === 'number' && Number.isSafeInteger(v) && v >= 1 ? v : undefined);
|
|
258
|
-
export function settingsPermissionBucketRefusalFromError(err) {
|
|
259
|
-
const r = fieldLimitRefusalFromError(err);
|
|
260
|
-
if (r === null)
|
|
261
|
-
return null;
|
|
262
|
-
const bucket = Object.hasOwn(BUCKET_OF_FIELD, r.field) ? BUCKET_OF_FIELD[r.field] : undefined;
|
|
263
|
-
if (bucket === undefined || (r.reason !== 'over_cap' && r.reason !== 'bad_entry'))
|
|
264
|
-
return null;
|
|
265
|
-
if (r.reason === 'over_cap') {
|
|
266
|
-
return Object.freeze({
|
|
267
|
-
bucket,
|
|
268
|
-
reason: r.reason,
|
|
269
|
-
...(r.count !== undefined ? { count: r.count } : {}),
|
|
270
|
-
...(r.cap !== undefined ? { cap: r.cap } : {}),
|
|
271
|
-
...(r.folded === true ? { folded: true } : {}),
|
|
272
|
-
});
|
|
273
|
-
}
|
|
274
|
-
return Object.freeze({ bucket, reason: r.reason, ...(r.index !== undefined ? { index: r.index } : {}), ...(r.folded === true ? { folded: true } : {}) });
|
|
275
|
-
}
|
|
276
336
|
export function fieldLimitRefusalFromError(err) {
|
|
277
337
|
try {
|
|
278
338
|
if (typeof err !== 'object' || err === null)
|
|
279
339
|
return null;
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
let outer;
|
|
283
|
-
try {
|
|
284
|
-
outer = err.errorCode;
|
|
285
|
-
}
|
|
286
|
-
catch {
|
|
340
|
+
const coded = effectiveWireCodeReading(err);
|
|
341
|
+
if (coded.code !== FIELD_INVALID)
|
|
287
342
|
return null;
|
|
288
|
-
}
|
|
289
343
|
const field = readErrorString(err, 'field');
|
|
290
344
|
if (field === undefined || field.length === 0)
|
|
291
345
|
return null;
|
|
292
346
|
const reason = readErrorString(err, 'reason');
|
|
347
|
+
const folded = coded.folded;
|
|
293
348
|
if (reason !== 'over_cap' && reason !== 'too_long' && reason !== 'bad_entry')
|
|
294
349
|
return null;
|
|
295
|
-
const folded = outer === RESUME_POLICY_FOLD_CODE;
|
|
296
350
|
if (reason === 'bad_entry') {
|
|
297
351
|
const index = nonNegInt(readErrorNumber(err, 'index'));
|
|
298
352
|
return Object.freeze({ field, reason, ...(index !== undefined ? { index } : {}), ...(folded ? { folded: true } : {}) });
|
|
@@ -311,6 +365,48 @@ export function fieldLimitRefusalFromError(err) {
|
|
|
311
365
|
return null;
|
|
312
366
|
}
|
|
313
367
|
}
|
|
368
|
+
function hooksCoordinateOf(path) {
|
|
369
|
+
const lead = path !== undefined && path[0] === 'hooks';
|
|
370
|
+
let out = lead ? 'settings' : HOOK_MATCHER_REFUSAL_FIELD;
|
|
371
|
+
for (const seg of path ?? [])
|
|
372
|
+
out += typeof seg === 'number' ? `[${seg}]` : `.${seg}`;
|
|
373
|
+
return out;
|
|
374
|
+
}
|
|
375
|
+
export function fieldLimitRefusalOfSettingsHooks(refusal) {
|
|
376
|
+
try {
|
|
377
|
+
if (typeof refusal !== 'object' || refusal === null)
|
|
378
|
+
return null;
|
|
379
|
+
const reason = readOwnDataValue(refusal, 'reason');
|
|
380
|
+
if (reason !== 'over_cap' && reason !== 'too_long')
|
|
381
|
+
return null;
|
|
382
|
+
const rawPath = readOwnDataValue(refusal, 'path');
|
|
383
|
+
let path;
|
|
384
|
+
if (Array.isArray(rawPath)) {
|
|
385
|
+
const out = [];
|
|
386
|
+
for (let i = 0; i < rawPath.length; i++) {
|
|
387
|
+
const seg = Object.hasOwn(rawPath, i) ? rawPath[i] : undefined;
|
|
388
|
+
if (typeof seg === 'string' || (typeof seg === 'number' && Number.isSafeInteger(seg) && seg >= 0))
|
|
389
|
+
out.push(seg);
|
|
390
|
+
else {
|
|
391
|
+
out.length = 0;
|
|
392
|
+
break;
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
path = out.length > 0 ? out : undefined;
|
|
396
|
+
}
|
|
397
|
+
const count = nonNegInt(readOwnDataValue(refusal, 'count'));
|
|
398
|
+
const cap = posInt(readOwnDataValue(refusal, 'cap'));
|
|
399
|
+
return Object.freeze({
|
|
400
|
+
field: hooksCoordinateOf(path),
|
|
401
|
+
reason,
|
|
402
|
+
...(count !== undefined ? { count } : {}),
|
|
403
|
+
...(cap !== undefined ? { cap } : {}),
|
|
404
|
+
});
|
|
405
|
+
}
|
|
406
|
+
catch {
|
|
407
|
+
return null;
|
|
408
|
+
}
|
|
409
|
+
}
|
|
314
410
|
const FIELD_LIMIT_REFUSAL_UNKNOWN = 'The engine refused this request: a list in it has too many entries, or a text in it is too long · Nothing was trimmed or dropped — shorten it, then send the request again';
|
|
315
411
|
const FIELD_LIMIT_FIELD_MAX = 120;
|
|
316
412
|
export function fieldLimitRefusalContent(detail, lang) {
|
|
@@ -721,6 +817,124 @@ export function autonomyLaneRefusalFromError(err) {
|
|
|
721
817
|
export function autonomyLaneRefusalContent(lang) {
|
|
722
818
|
return renderMessage(msg('notice.wireRefusal.autonomyLane'), lang);
|
|
723
819
|
}
|
|
820
|
+
const REQUEST_UNPROCESSABLE = 'request.unprocessable';
|
|
821
|
+
const UNSUPPORTED_RULE_PROBLEMS_MAX = REFUSAL_PROBLEMS_READ_MAX;
|
|
822
|
+
const nonEmptyString = (v) => (typeof v === 'string' && v !== '' ? v : undefined);
|
|
823
|
+
function unsupportedRuleProblemAt(list, i) {
|
|
824
|
+
try {
|
|
825
|
+
const item = readOwnDataValue(list, String(i));
|
|
826
|
+
if (typeof item !== 'object' || item === null)
|
|
827
|
+
return undefined;
|
|
828
|
+
const reason = readOwnDataValue(item, 'reason');
|
|
829
|
+
if (typeof reason !== 'string' || !reason.startsWith('unsupported.') || !PERMISSION_RULE_ISSUE_CODES.includes(reason))
|
|
830
|
+
return undefined;
|
|
831
|
+
const field = guardedRead(() => nonEmptyString(readOwnDataValue(item, 'field')));
|
|
832
|
+
const entry = guardedRead(() => nonEmptyString(readOwnDataValue(item, 'entry')));
|
|
833
|
+
return Object.freeze({ code: reason, ...(field !== undefined ? { field } : {}), ...(entry !== undefined ? { entry } : {}) });
|
|
834
|
+
}
|
|
835
|
+
catch {
|
|
836
|
+
return undefined;
|
|
837
|
+
}
|
|
838
|
+
}
|
|
839
|
+
export function unsupportedRuleRefusalFromError(err) {
|
|
840
|
+
try {
|
|
841
|
+
if (typeof err !== 'object' || err === null)
|
|
842
|
+
return null;
|
|
843
|
+
const effective = effectiveWireCodeReading(err);
|
|
844
|
+
if (effective.code !== REQUEST_UNPROCESSABLE)
|
|
845
|
+
return null;
|
|
846
|
+
const detail = readErrorRecord(err, 'detail');
|
|
847
|
+
if (detail === undefined)
|
|
848
|
+
return null;
|
|
849
|
+
let list;
|
|
850
|
+
let length = 0;
|
|
851
|
+
try {
|
|
852
|
+
const raw = readOwnDataValue(detail, 'problems');
|
|
853
|
+
if (Array.isArray(raw)) {
|
|
854
|
+
list = raw;
|
|
855
|
+
const n = raw.length;
|
|
856
|
+
length = typeof n === 'number' && Number.isSafeInteger(n) && n > 0 ? Math.min(n, UNSUPPORTED_RULE_PROBLEMS_MAX) : 0;
|
|
857
|
+
}
|
|
858
|
+
}
|
|
859
|
+
catch {
|
|
860
|
+
list = undefined;
|
|
861
|
+
}
|
|
862
|
+
if (list === undefined)
|
|
863
|
+
return null;
|
|
864
|
+
const problems = [];
|
|
865
|
+
for (let i = 0; i < length; i += 1) {
|
|
866
|
+
const p = unsupportedRuleProblemAt(list, i);
|
|
867
|
+
if (p !== undefined)
|
|
868
|
+
problems.push(p);
|
|
869
|
+
}
|
|
870
|
+
const first = problems[0];
|
|
871
|
+
if (first === undefined)
|
|
872
|
+
return null;
|
|
873
|
+
const folded = effective.folded;
|
|
874
|
+
return Object.freeze({ code: first.code, problems: Object.freeze(problems), ...(folded ? { folded: true } : {}) });
|
|
875
|
+
}
|
|
876
|
+
catch {
|
|
877
|
+
return null;
|
|
878
|
+
}
|
|
879
|
+
}
|
|
880
|
+
function unsupportedRuleSentenceItems(detail, lang) {
|
|
881
|
+
const items = [];
|
|
882
|
+
const seen = new Set();
|
|
883
|
+
try {
|
|
884
|
+
const list = readOwnDataValue(detail, 'problems');
|
|
885
|
+
if (Array.isArray(list)) {
|
|
886
|
+
const len = readOwnDataValue(list, 'length');
|
|
887
|
+
const n = typeof len === 'number' && Number.isSafeInteger(len) && len > 0 ? Math.min(len, UNSUPPORTED_RULE_PROBLEMS_MAX) : 0;
|
|
888
|
+
for (let i = 0; i < n; i += 1) {
|
|
889
|
+
try {
|
|
890
|
+
const p = readOwnDataValue(list, String(i));
|
|
891
|
+
if (typeof p !== 'object' || p === null)
|
|
892
|
+
continue;
|
|
893
|
+
const code = readOwnDataValue(p, 'code');
|
|
894
|
+
if (typeof code !== 'string' || !code.startsWith('unsupported.'))
|
|
895
|
+
continue;
|
|
896
|
+
const entry = nonEmptyString(readOwnDataValue(p, 'entry'));
|
|
897
|
+
const key = `${entry ?? ''}\u0000${code}`;
|
|
898
|
+
if (seen.has(key))
|
|
899
|
+
continue;
|
|
900
|
+
seen.add(key);
|
|
901
|
+
appendOwnElement(items, { ...(entry !== undefined ? { rule: entry } : {}), reason: permissionRuleIssueDetail(code, undefined, undefined, lang) });
|
|
902
|
+
}
|
|
903
|
+
catch {
|
|
904
|
+
continue;
|
|
905
|
+
}
|
|
906
|
+
}
|
|
907
|
+
}
|
|
908
|
+
}
|
|
909
|
+
catch {
|
|
910
|
+
items.length = 0;
|
|
911
|
+
}
|
|
912
|
+
if (items.length > 0)
|
|
913
|
+
return items;
|
|
914
|
+
let code;
|
|
915
|
+
try {
|
|
916
|
+
code = readOwnDataValue(detail, 'code');
|
|
917
|
+
}
|
|
918
|
+
catch {
|
|
919
|
+
code = undefined;
|
|
920
|
+
}
|
|
921
|
+
return [{ reason: permissionRuleIssueDetail(code, undefined, undefined, lang) }];
|
|
922
|
+
}
|
|
923
|
+
export function unsupportedRuleRefusalContent(detail, lang) {
|
|
924
|
+
const subject = typeof detail === 'object' && detail !== null ? detail : { code: '' };
|
|
925
|
+
const items = unsupportedRuleSentenceItems(subject, lang);
|
|
926
|
+
let folded = false;
|
|
927
|
+
try {
|
|
928
|
+
folded = readOwnDataValue(subject, 'folded') === true;
|
|
929
|
+
}
|
|
930
|
+
catch {
|
|
931
|
+
folded = false;
|
|
932
|
+
}
|
|
933
|
+
const many = items.length > 1;
|
|
934
|
+
const list = ruleRefusalListText(items, lang);
|
|
935
|
+
const key = folded ? (many ? 'notice.wireRefusal.unsupportedRule.stored.other' : 'notice.wireRefusal.unsupportedRule.stored') : many ? 'notice.wireRefusal.unsupportedRule.other' : 'notice.wireRefusal.unsupportedRule';
|
|
936
|
+
return renderMessage(msg(key, many ? { detail: list, count: items.length } : { detail: list }), lang);
|
|
937
|
+
}
|
|
724
938
|
export function userAttachmentRefusalFromError(err) {
|
|
725
939
|
try {
|
|
726
940
|
if (typeof err !== 'object' || err === null)
|
|
@@ -766,7 +980,14 @@ export function userAttachmentRefusalFromError(err) {
|
|
|
766
980
|
}
|
|
767
981
|
}
|
|
768
982
|
export function userAttachmentRefusalContent(detail) {
|
|
769
|
-
|
|
983
|
+
let index;
|
|
984
|
+
try {
|
|
985
|
+
index = detail === undefined || detail === null ? undefined : detail.index;
|
|
986
|
+
}
|
|
987
|
+
catch {
|
|
988
|
+
index = undefined;
|
|
989
|
+
}
|
|
990
|
+
return prepareRefusalNoteOf(USER_ATTACHMENT_INVALID_ERROR_CODE, typeof index === 'number' ? { index } : undefined);
|
|
770
991
|
}
|
|
771
992
|
export function userInvokedSkillRefusalFromError(err) {
|
|
772
993
|
return effectiveWireErrorCode(err) === USER_INVOKED_SKILL_UNKNOWN_ERROR_CODE ? { code: USER_INVOKED_SKILL_UNKNOWN_ERROR_CODE, retryable: false } : null;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { WiringManifestFleetView } from './adapter/downstream/wiringManifestView.js';
|
|
2
|
+
import type { UiLanguage } from './env/uiLanguage.js';
|
|
3
|
+
export declare function wiringFleetDoctorDetail(view: WiringManifestFleetView | null | undefined, lang?: UiLanguage): string | null;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { capForDisplay } from './fleetTaskDesc.js';
|
|
2
|
+
import { msg, renderMessage } from './i18n/translate.js';
|
|
3
|
+
import { readOwnDataValue } from './ownKey.js';
|
|
4
|
+
const UNKNOWN_TIER_ECHO_MAX = 64;
|
|
5
|
+
export function wiringFleetDoctorDetail(view, lang) {
|
|
6
|
+
try {
|
|
7
|
+
if (typeof view !== 'object' || view === null || Array.isArray(view))
|
|
8
|
+
return null;
|
|
9
|
+
const tier = readOwnDataValue(view, 'subagentTranscripts');
|
|
10
|
+
if (typeof tier !== 'string' || tier.length === 0)
|
|
11
|
+
return null;
|
|
12
|
+
if (tier === 'full')
|
|
13
|
+
return renderMessage(msg('doctor.wiring.fleetTranscripts.full'), lang);
|
|
14
|
+
if (tier === 'rows' || tier === 'none')
|
|
15
|
+
return renderMessage(msg('doctor.wiring.fleetTranscripts.noPromise', { tier }), lang);
|
|
16
|
+
return renderMessage(msg('doctor.wiring.fleetTranscripts.unknownTier', { tier: capForDisplay(tier, UNKNOWN_TIER_ECHO_MAX) }), lang);
|
|
17
|
+
}
|
|
18
|
+
catch {
|
|
19
|
+
return null;
|
|
20
|
+
}
|
|
21
|
+
}
|
package/dist/workflow.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { UiLanguage } from './env/uiLanguage.js';
|
|
1
2
|
export declare function rowIdTail(id: string): string;
|
|
2
3
|
export declare function isWorkflowAgentTaskId(taskId: string): boolean;
|
|
3
4
|
export declare function recordWorkflowAgentTaskId(taskId: string): void;
|
|
@@ -8,4 +9,4 @@ export declare function parseWorkflowPollEnvelope(body: string): {
|
|
|
8
9
|
status: string;
|
|
9
10
|
name?: string;
|
|
10
11
|
} | null;
|
|
11
|
-
export declare function projectWorkflowTaskOutput(jsonSrc: string): string;
|
|
12
|
+
export declare function projectWorkflowTaskOutput(jsonSrc: string, lang?: UiLanguage): string;
|
package/dist/workflow.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { displayUntrusted } from './displayUntrusted.js';
|
|
2
|
+
import { msg, renderMessage } from './i18n/translate.js';
|
|
1
3
|
export function rowIdTail(id) {
|
|
2
4
|
return id.split(/\s+/).pop() ?? id;
|
|
3
5
|
}
|
|
@@ -38,13 +40,48 @@ export function parseWorkflowPollEnvelope(body) {
|
|
|
38
40
|
return null;
|
|
39
41
|
}
|
|
40
42
|
}
|
|
41
|
-
|
|
43
|
+
const RESUME_REASON_MAX = 120;
|
|
44
|
+
const RESUME_PART_JOIN = ' · ';
|
|
45
|
+
function resumeCount(v) {
|
|
46
|
+
return typeof v === 'number' && Number.isSafeInteger(v) && v >= 0 ? v : undefined;
|
|
47
|
+
}
|
|
48
|
+
function workflowResumeLine(resume, lang) {
|
|
49
|
+
if (typeof resume !== 'object' || resume === null || Array.isArray(resume))
|
|
50
|
+
return undefined;
|
|
51
|
+
const own = (key) => (Object.hasOwn(resume, key) ? resume[key] : undefined);
|
|
52
|
+
const replayed = resumeCount(own('replayed'));
|
|
53
|
+
const journaledRaw = resumeCount(own('journal_entries'));
|
|
54
|
+
const journaled = replayed !== undefined && journaledRaw !== undefined && replayed > journaledRaw ? undefined : journaledRaw;
|
|
55
|
+
const parts = [];
|
|
56
|
+
if (replayed !== undefined) {
|
|
57
|
+
parts.push(renderMessage(replayed === 0 && journaled === 0
|
|
58
|
+
? msg('session.workflowResume.noJournal')
|
|
59
|
+
: journaled !== undefined
|
|
60
|
+
? msg('session.workflowResume.counts', { replayed, journaled })
|
|
61
|
+
: msg('session.workflowResume.countsOnly', { replayed }), lang));
|
|
62
|
+
}
|
|
63
|
+
const ordinal = resumeCount(own('replay_stopped_at'));
|
|
64
|
+
const reasonRaw = own('replay_stopped_reason');
|
|
65
|
+
const reasonShown = typeof reasonRaw === 'string' ? displayUntrusted(reasonRaw, { max: RESUME_REASON_MAX }) : '';
|
|
66
|
+
const reason = reasonShown.trim() === '' ? undefined : reasonShown;
|
|
67
|
+
if (ordinal !== undefined && reason !== undefined)
|
|
68
|
+
parts.push(renderMessage(msg('session.workflowResume.stopAt', { ordinal, reason }), lang));
|
|
69
|
+
else if (ordinal !== undefined)
|
|
70
|
+
parts.push(renderMessage(msg('session.workflowResume.stopAtNoReason', { ordinal }), lang));
|
|
71
|
+
else if (reason !== undefined)
|
|
72
|
+
parts.push(renderMessage(msg('session.workflowResume.stop', { reason }), lang));
|
|
73
|
+
return parts.length === 0 ? undefined : renderMessage(msg('session.workflowResume.line', { detail: parts.join(RESUME_PART_JOIN) }), lang);
|
|
74
|
+
}
|
|
75
|
+
export function projectWorkflowTaskOutput(jsonSrc, lang) {
|
|
42
76
|
try {
|
|
43
77
|
const j = JSON.parse(jsonSrc);
|
|
44
78
|
const parts = [];
|
|
45
79
|
if (j.agents && typeof j.agents.done === 'number' && typeof j.agents.total === 'number') {
|
|
46
80
|
parts.push(`agents: ${j.agents.done}/${j.agents.total} done${typeof j.agents.failed === 'number' && j.agents.failed > 0 ? ` (${j.agents.failed} failed)` : ''}`);
|
|
47
81
|
}
|
|
82
|
+
const resumeLine = workflowResumeLine(j.resume, lang);
|
|
83
|
+
if (resumeLine !== undefined)
|
|
84
|
+
parts.push(resumeLine);
|
|
48
85
|
if (Array.isArray(j.agent_runs)) {
|
|
49
86
|
for (const r of j.agent_runs) {
|
|
50
87
|
if (!r || typeof r !== 'object')
|
package/dist/workflowClient.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { WorkflowRun, WorkflowStreamEvent } from '@sema-agent/sdk';
|
|
1
|
+
import type { WorkflowRun, WorkflowRunPark, WorkflowStreamEvent } from '@sema-agent/sdk';
|
|
2
2
|
import { type WireAuthTokenSource } from './engineWireSdk.js';
|
|
3
3
|
import type { WorkflowRunState, WorkflowToolCall } from './workflowMonitor.js';
|
|
4
4
|
export interface LiveWorkflowController {
|
|
@@ -49,12 +49,7 @@ export interface LiveWorkflowConfig {
|
|
|
49
49
|
fetchImpl?: typeof fetch;
|
|
50
50
|
}
|
|
51
51
|
export declare function projectWorkflowRun(run: WorkflowRun): WorkflowRunState;
|
|
52
|
-
export
|
|
53
|
-
callKey: string;
|
|
54
|
-
sessionId: string;
|
|
55
|
-
originRunId: string;
|
|
56
|
-
originUnconfirmed?: true;
|
|
57
|
-
}
|
|
52
|
+
export type WorkflowParkRowView = WorkflowRunPark;
|
|
58
53
|
export declare function readWorkflowParks(run: unknown): readonly WorkflowParkRowView[] | undefined;
|
|
59
54
|
export declare function readWorkflowResumeAdmissionIncomplete(run: unknown): boolean;
|
|
60
55
|
export interface WorkflowActivityAgentView {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { engineWireTargetBaseUrl } from './engineWireTarget.js';
|
|
2
2
|
import { createEngineCapReader, unreadableReadingDetail } from './engineCapReader.js';
|
|
3
3
|
import { msg, renderMessage } from './i18n/translate.js';
|
|
4
4
|
import { ownDataField } from './ownKey.js';
|
|
@@ -21,7 +21,7 @@ const reader = createEngineCapReader({
|
|
|
21
21
|
name: 'workflowsJournal',
|
|
22
22
|
project: projectWorkflowsJournalCapability,
|
|
23
23
|
});
|
|
24
|
-
export function observedWorkflowsJournal(baseUrl =
|
|
24
|
+
export function observedWorkflowsJournal(baseUrl = engineWireTargetBaseUrl()) {
|
|
25
25
|
return reader.observed(baseUrl);
|
|
26
26
|
}
|
|
27
27
|
export function workflowsJournalAvailable(reading) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { capForDisplay } from './fleetTaskDesc.js';
|
|
2
|
-
import {
|
|
2
|
+
import { engineWireTargetBaseUrl } from './engineWireTarget.js';
|
|
3
3
|
import { createEngineCapReader, unreadableReadingDetail } from './engineCapReader.js';
|
|
4
4
|
import { ownDataField } from './ownKey.js';
|
|
5
5
|
export function projectWriteProtectionCapability(caps) {
|
|
@@ -66,7 +66,7 @@ const reader = createEngineCapReader({
|
|
|
66
66
|
name: 'writeProtection',
|
|
67
67
|
project: projectWriteProtectionCapability,
|
|
68
68
|
});
|
|
69
|
-
export function observedWriteProtection(baseUrl =
|
|
69
|
+
export function observedWriteProtection(baseUrl = engineWireTargetBaseUrl()) {
|
|
70
70
|
return reader.observed(baseUrl);
|
|
71
71
|
}
|
|
72
72
|
const WP_DETAIL_MAX = 40;
|