@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
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sema-agent/client-core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.95.0",
|
|
4
4
|
"description": "Client-side session runtime shared by every sema human client (TUI / web / desktop): sema wire frames (AgentEvent) -> CC session vocabulary (SDKMessage) with dual-plane output (transcript/chrome), deterministic transcript ids, lane discipline as a type, and the notification/dedup ledgers. Every CC-skin shape is collected here so the wire itself stays neutral. Renamed from @sema-agent/wire-cc-adapter (0.1.x).",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -35,13 +35,13 @@
|
|
|
35
35
|
},
|
|
36
36
|
"peerDependencies": {
|
|
37
37
|
"@sema-agent/agent-types": ">=0.3.0",
|
|
38
|
-
"@sema-agent/sdk": ">=
|
|
38
|
+
"@sema-agent/sdk": ">=19.0.0"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
41
|
"@sema-agent/agent-types": "^0.3.0",
|
|
42
|
-
"@sema-agent/core": "~7.
|
|
43
|
-
"@sema-agent/sdk": "^
|
|
44
|
-
"@sema-agent/settings-schema": "^
|
|
42
|
+
"@sema-agent/core": "~7.48.0",
|
|
43
|
+
"@sema-agent/sdk": "^19.0.0",
|
|
44
|
+
"@sema-agent/settings-schema": "^11.2.0",
|
|
45
45
|
"esbuild": "^0.27.4",
|
|
46
46
|
"typescript": "^6.0.2"
|
|
47
47
|
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { engineCapsGeneration } from './engineCapsCache.js';
|
|
2
|
-
export function snapshotCapsGeneration(opts) {
|
|
3
|
-
try {
|
|
4
|
-
return opts?.generation;
|
|
5
|
-
}
|
|
6
|
-
catch {
|
|
7
|
-
return null;
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
export function capsGenerationStillCurrent(baseUrl, gen) {
|
|
11
|
-
if (gen === undefined)
|
|
12
|
-
return true;
|
|
13
|
-
try {
|
|
14
|
-
return gen === engineCapsGeneration(baseUrl);
|
|
15
|
-
}
|
|
16
|
-
catch {
|
|
17
|
-
return false;
|
|
18
|
-
}
|
|
19
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
export declare function notePanelRowRunning(taskId: string): void;
|
|
2
|
-
export declare function retirePanelRowRunning(taskId: string): void;
|
|
3
|
-
interface PanelRowEndedIdentity {
|
|
4
|
-
cycleSeq?: number;
|
|
5
|
-
startedAt?: number;
|
|
6
|
-
}
|
|
7
|
-
export declare function notePanelRowEnded(taskId: string, cycle: PanelRowEndedIdentity, older: boolean): void;
|
|
8
|
-
export declare function panelRowEndedIdentity(taskId: string): PanelRowEndedIdentity | undefined;
|
|
9
|
-
export declare function panelRowUnknownToConsumer(taskId: string): boolean;
|
|
10
|
-
export declare function holdNewbornTerminalRow(taskId: string, ev: object): void;
|
|
11
|
-
export declare function peekHeldNewbornTerminalRow<T extends object>(taskId: string): T | undefined;
|
|
12
|
-
export declare function takeHeldNewbornTerminalRow<T extends object>(taskId: string): T | undefined;
|
|
13
|
-
export declare function dropHeldNewbornTerminalRow(taskId: string): void;
|
|
14
|
-
interface HeldNewbornTerminalRef {
|
|
15
|
-
readonly taskId: string;
|
|
16
|
-
readonly transcriptId?: string;
|
|
17
|
-
readonly parentToolCallId?: string;
|
|
18
|
-
}
|
|
19
|
-
export declare function heldNewbornTerminalRefs(): HeldNewbornTerminalRef[];
|
|
20
|
-
export declare function __resetPanelRunningHistoryForTests(): void;
|
|
21
|
-
export declare function __panelRunningHistorySize(): number;
|
|
22
|
-
export {};
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
const MAX_IDS = 4096;
|
|
2
|
-
const ids = new Set();
|
|
3
|
-
let overflowed = false;
|
|
4
|
-
export function notePanelRowRunning(taskId) {
|
|
5
|
-
if (ids.has(taskId))
|
|
6
|
-
return;
|
|
7
|
-
ids.add(taskId);
|
|
8
|
-
if (ids.size > MAX_IDS) {
|
|
9
|
-
overflowed = true;
|
|
10
|
-
const oldest = ids.values().next().value;
|
|
11
|
-
if (oldest !== undefined)
|
|
12
|
-
ids.delete(oldest);
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
export function retirePanelRowRunning(taskId) {
|
|
16
|
-
ids.delete(taskId);
|
|
17
|
-
}
|
|
18
|
-
const MAX_ENDED = 4096;
|
|
19
|
-
const endedIds = new Map();
|
|
20
|
-
export function notePanelRowEnded(taskId, cycle, older) {
|
|
21
|
-
const existing = endedIds.get(taskId);
|
|
22
|
-
if (existing !== undefined && older)
|
|
23
|
-
return;
|
|
24
|
-
endedIds.delete(taskId);
|
|
25
|
-
endedIds.set(taskId, { ...(existing ?? {}), ...(cycle.cycleSeq !== undefined ? { cycleSeq: cycle.cycleSeq } : {}), ...(cycle.startedAt !== undefined ? { startedAt: cycle.startedAt } : {}) });
|
|
26
|
-
if (endedIds.size > MAX_ENDED) {
|
|
27
|
-
const oldest = endedIds.keys().next().value;
|
|
28
|
-
if (oldest !== undefined)
|
|
29
|
-
endedIds.delete(oldest);
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
export function panelRowEndedIdentity(taskId) {
|
|
33
|
-
return endedIds.get(taskId);
|
|
34
|
-
}
|
|
35
|
-
export function panelRowUnknownToConsumer(taskId) {
|
|
36
|
-
return !overflowed && !ids.has(taskId) && !endedIds.has(taskId);
|
|
37
|
-
}
|
|
38
|
-
const MAX_HELD = 4096;
|
|
39
|
-
const heldNewborn = new Map();
|
|
40
|
-
export function holdNewbornTerminalRow(taskId, ev) {
|
|
41
|
-
heldNewborn.delete(taskId);
|
|
42
|
-
heldNewborn.set(taskId, ev);
|
|
43
|
-
if (heldNewborn.size > MAX_HELD) {
|
|
44
|
-
const oldest = heldNewborn.keys().next().value;
|
|
45
|
-
if (oldest !== undefined)
|
|
46
|
-
heldNewborn.delete(oldest);
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
export function peekHeldNewbornTerminalRow(taskId) {
|
|
50
|
-
return heldNewborn.get(taskId);
|
|
51
|
-
}
|
|
52
|
-
export function takeHeldNewbornTerminalRow(taskId) {
|
|
53
|
-
const ev = heldNewborn.get(taskId);
|
|
54
|
-
if (ev === undefined)
|
|
55
|
-
return undefined;
|
|
56
|
-
heldNewborn.delete(taskId);
|
|
57
|
-
return ev;
|
|
58
|
-
}
|
|
59
|
-
export function dropHeldNewbornTerminalRow(taskId) {
|
|
60
|
-
heldNewborn.delete(taskId);
|
|
61
|
-
}
|
|
62
|
-
export function heldNewbornTerminalRefs() {
|
|
63
|
-
const out = [];
|
|
64
|
-
for (const [taskId, ev] of heldNewborn) {
|
|
65
|
-
const row = ev;
|
|
66
|
-
out.push({
|
|
67
|
-
taskId,
|
|
68
|
-
...(typeof row.transcriptId === 'string' && row.transcriptId.length > 0 ? { transcriptId: row.transcriptId } : {}),
|
|
69
|
-
...(typeof row.parentToolCallId === 'string' && row.parentToolCallId.length > 0 ? { parentToolCallId: row.parentToolCallId } : {}),
|
|
70
|
-
});
|
|
71
|
-
}
|
|
72
|
-
return out;
|
|
73
|
-
}
|
|
74
|
-
export function __resetPanelRunningHistoryForTests() {
|
|
75
|
-
ids.clear();
|
|
76
|
-
overflowed = false;
|
|
77
|
-
endedIds.clear();
|
|
78
|
-
heldNewborn.clear();
|
|
79
|
-
}
|
|
80
|
-
export function __panelRunningHistorySize() {
|
|
81
|
-
return ids.size;
|
|
82
|
-
}
|
package/dist/registryConflict.js
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
const SCOPE_GONE_CODE = 'scope_gone';
|
|
2
|
-
const nonBlank = (v) => {
|
|
3
|
-
const s = typeof v === 'string' ? v.trim() : '';
|
|
4
|
-
return s === '' ? undefined : s;
|
|
5
|
-
};
|
|
6
|
-
export function classifyRegistryConflict(status, body) {
|
|
7
|
-
if (status !== 409)
|
|
8
|
-
return 'none';
|
|
9
|
-
try {
|
|
10
|
-
const b = (typeof body === 'object' && body !== null ? body : {});
|
|
11
|
-
const error = b.error;
|
|
12
|
-
const objectForm = typeof error === 'object' && error !== null ? error.code : undefined;
|
|
13
|
-
const code = nonBlank(b.errorCode) ?? nonBlank(objectForm) ?? (typeof error === 'string' ? error : undefined);
|
|
14
|
-
return code === SCOPE_GONE_CODE ? 'gone' : 'conflict';
|
|
15
|
-
}
|
|
16
|
-
catch {
|
|
17
|
-
return 'gone';
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
const SCOPE_GONE_ERROR_NAMES = Object.freeze(['ScopeGoneError', 'ControlScopeGoneError']);
|
|
21
|
-
export function isScopeGoneError(err) {
|
|
22
|
-
if ((typeof err !== 'object' && typeof err !== 'function') || err === null)
|
|
23
|
-
return false;
|
|
24
|
-
let status;
|
|
25
|
-
try {
|
|
26
|
-
status = err.status;
|
|
27
|
-
}
|
|
28
|
-
catch {
|
|
29
|
-
return false;
|
|
30
|
-
}
|
|
31
|
-
if (status !== 409)
|
|
32
|
-
return false;
|
|
33
|
-
try {
|
|
34
|
-
const o = err;
|
|
35
|
-
const body = o.body;
|
|
36
|
-
if (body !== undefined && body !== null && classifyRegistryConflict(409, body) === 'gone')
|
|
37
|
-
return true;
|
|
38
|
-
const name = o.name;
|
|
39
|
-
return typeof name === 'string' && SCOPE_GONE_ERROR_NAMES.includes(name);
|
|
40
|
-
}
|
|
41
|
-
catch {
|
|
42
|
-
return true;
|
|
43
|
-
}
|
|
44
|
-
}
|