@sema-agent/client-core 0.93.1 → 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 +554 -0
- package/README.md +89 -55
- package/dist/adapt/arms.js +13 -11
- 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 +13 -6
- 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 +5 -3
- package/dist/agentsWireCaps.d.ts +17 -0
- package/dist/agentsWireCaps.js +111 -1
- package/dist/approvalDecidedByCapability.d.ts +0 -1
- package/dist/approvalDecidedByCapability.js +2 -7
- package/dist/approvalReachWire.d.ts +18 -0
- package/dist/approvalReachWire.js +58 -0
- package/dist/approvalsStreamLiveCapability.d.ts +0 -1
- package/dist/approvalsStreamLiveCapability.js +15 -14
- 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 +15 -0
- package/dist/callerCwdCapability.js +42 -0
- 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/controlRouter.js +3 -10
- package/dist/coreValuePorts.d.ts +64 -1
- package/dist/coreValuePorts.js +30 -0
- 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/detachWire.d.ts +1 -4
- package/dist/detachWire.js +1 -1
- package/dist/deviceExecutorManagementCapability.d.ts +0 -1
- package/dist/deviceExecutorManagementCapability.js +36 -40
- package/dist/deviceFlowPolling.d.ts +5 -0
- package/dist/deviceFlowPolling.js +28 -0
- package/dist/deviceRebind.d.ts +88 -0
- package/dist/deviceRebind.js +242 -0
- package/dist/displayUntrusted.d.ts +1 -0
- package/dist/displayUntrusted.js +963 -30
- 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 +19 -4
- package/dist/engineErrorCodes.js +39 -21
- package/dist/engineIdentity.js +2 -0
- package/dist/engineNoticeCodes.d.ts +22 -2
- package/dist/engineNoticeCodes.js +73 -6
- package/dist/engineRefusedToolName.d.ts +1 -0
- package/dist/engineRefusedToolName.js +8 -0
- package/dist/engineWireSdk.js +2 -2
- package/dist/executionLaneCapability.d.ts +2 -3
- package/dist/executionLaneCapability.js +28 -28
- package/dist/fileHistoryCaptureCapability.d.ts +0 -1
- package/dist/fileHistoryCaptureCapability.js +13 -12
- package/dist/fileHistoryLegNotice.d.ts +14 -2
- package/dist/fileHistoryLegNotice.js +101 -15
- package/dist/fleet/fleetLedger.d.ts +2 -0
- package/dist/fleet/fleetLedger.js +74 -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.d.ts +2 -1
- package/dist/gateOutcome.js +33 -18
- package/dist/gateVocabulary.js +1 -1
- package/dist/generated/engineAskFaceTables.d.ts +3 -0
- package/dist/generated/engineAskFaceTables.js +12 -0
- package/dist/generated/engineFactTables.d.ts +4 -2
- package/dist/generated/engineFactTables.js +13 -0
- package/dist/generated/engineNoticeTables.d.ts +5 -0
- package/dist/generated/engineNoticeTables.js +7 -0
- package/dist/generated/sdkFactTables.d.ts +5 -0
- package/dist/generated/sdkFactTables.js +34 -0
- package/dist/generated/settingsSchemaFns.d.ts +10 -0
- package/dist/generated/settingsSchemaFns.js +22 -0
- package/dist/generated/settingsSchemaTables.d.ts +3 -0
- package/dist/generated/settingsSchemaTables.js +3 -0
- package/dist/headlessPermissionModeWire.d.ts +2 -2
- package/dist/headlessPermissionModeWire.js +11 -21
- 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 +46 -0
- package/dist/hitl/approvalHolds.js +140 -0
- package/dist/hitl/approvalOutcomeNote.js +2 -1
- package/dist/hitl/approvalResolution.js +9 -1
- package/dist/hitl/approvalsFeed.js +23 -6
- package/dist/hitl/askGateWire.d.ts +2 -1
- package/dist/hitl/askGateWire.js +29 -1
- package/dist/hitl/automaticAnswerVerdict.d.ts +8 -2
- package/dist/hitl/automaticAnswerVerdict.js +71 -23
- 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 +23 -0
- package/dist/hitl/decisionRefusal.js +88 -0
- package/dist/hitl/frameRouter.d.ts +10 -0
- package/dist/hitl/frameRouter.js +71 -32
- package/dist/hitl/gateLedger.d.ts +8 -0
- package/dist/hitl/gateLedger.js +38 -0
- package/dist/hitl/hitlBridge.d.ts +14 -3
- package/dist/hitl/hitlBridge.js +75 -62
- package/dist/hitl/hitlHostSurface.d.ts +3 -0
- package/dist/hitl/hitlHostSurface.js +17 -15
- package/dist/hitl/livePendingAsk.d.ts +16 -6
- package/dist/hitl/livePendingAsk.js +36 -4
- package/dist/hitl/localAllowRule.js +2 -1
- package/dist/hitl/noAllowCause.d.ts +9 -0
- package/dist/hitl/noAllowCause.js +26 -0
- 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 +55 -28
- package/dist/hitl/parkRowBirthWait.js +2 -1
- package/dist/hitl/persistedRulesWire.d.ts +6 -1
- package/dist/hitl/persistedRulesWire.js +16 -4
- package/dist/hitl/planReviewWire.d.ts +2 -3
- package/dist/hitl/planReviewWire.js +86 -39
- 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/sessionPolicyDeliverable.d.ts +1 -1
- package/dist/hitl/sessionPolicyDeliverable.js +3 -8
- package/dist/hitl/sessionPolicyWire.js +1 -1
- package/dist/hitl/toolApprovalWire.d.ts +50 -5
- package/dist/hitl/toolApprovalWire.js +368 -56
- 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/humanTurnRead.d.ts +15 -1
- package/dist/humanTurnRead.js +28 -2
- package/dist/index.d.ts +45 -14
- package/dist/index.js +33 -12
- package/dist/interactiveInterrupt.d.ts +8 -0
- package/dist/interactiveInterrupt.js +54 -0
- package/dist/limitsWire.d.ts +5 -1
- package/dist/limitsWire.js +51 -13
- package/dist/liveModelCatalog.d.ts +109 -0
- package/dist/liveModelCatalog.js +344 -18
- 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 +13 -12
- package/dist/mcpReconnect.d.ts +1 -3
- package/dist/mcpReconnect.js +20 -10
- package/dist/memoryComplianceCapability.d.ts +0 -1
- package/dist/memoryComplianceCapability.js +14 -13
- package/dist/memoryOriginCapability.d.ts +0 -1
- package/dist/memoryOriginCapability.js +14 -13
- 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 +4 -2
- package/dist/modelIdentityResolvability.js +25 -5
- package/dist/modelSwitchFallback.d.ts +69 -0
- package/dist/modelSwitchFallback.js +206 -0
- package/dist/notifications.js +12 -11
- package/dist/outputStyleSeatCapability.d.ts +15 -0
- package/dist/outputStyleSeatCapability.js +42 -0
- package/dist/ownKey.d.ts +7 -0
- package/dist/ownKey.js +58 -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 +15 -14
- package/dist/permissionModesCapability.d.ts +0 -1
- package/dist/permissionModesCapability.js +5 -10
- package/dist/permissionRuleIssue.js +1 -1
- package/dist/permissionRulesWriteCapability.d.ts +0 -1
- package/dist/permissionRulesWriteCapability.js +15 -14
- package/dist/permissionsAllowGrantCapability.d.ts +2 -1
- package/dist/permissionsAllowGrantCapability.js +35 -19
- package/dist/permissionsDeclaration.d.ts +16 -1
- package/dist/permissionsDeclaration.js +142 -15
- package/dist/printToolResultFrame.js +2 -10
- package/dist/promptDelivery.js +0 -8
- package/dist/protocolSegment.d.ts +1 -0
- package/dist/protocolSegment.js +13 -1
- package/dist/request/taskRequest.d.ts +11 -3
- package/dist/request/taskRequest.js +13 -1
- package/dist/resultFrameKeys.d.ts +4 -0
- package/dist/resultFrameKeys.js +13 -0
- package/dist/resumeRefusalCopy.d.ts +18 -1
- package/dist/resumeRefusalCopy.js +132 -31
- package/dist/retryStatus.js +6 -4
- package/dist/rewindArchiveCapability.d.ts +2 -1
- package/dist/rewindArchiveCapability.js +28 -15
- 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/{hitl/rosterMountedNames.d.ts → rosterMountedNames.d.ts} +1 -1
- package/dist/runCancelContext.js +2 -1
- 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 +19 -20
- package/dist/seatContract.d.ts +85 -28
- package/dist/seatContract.js +512 -148
- 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 +14 -13
- package/dist/sessionReadRedactionCapability.d.ts +15 -0
- package/dist/sessionReadRedactionCapability.js +42 -0
- package/dist/sessionSyncFileHistoryCapability.d.ts +0 -1
- package/dist/sessionSyncFileHistoryCapability.js +13 -12
- package/dist/skillToolListsCapability.d.ts +0 -1
- package/dist/skillToolListsCapability.js +13 -12
- package/dist/skillsWireCaps.d.ts +4 -0
- package/dist/skillsWireCaps.js +66 -1
- package/dist/sqlEngineCapability.d.ts +0 -1
- package/dist/sqlEngineCapability.js +21 -21
- package/dist/steerPriorityCapability.d.ts +0 -1
- package/dist/steerPriorityCapability.js +18 -19
- 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/agentStateDetail.d.ts +1 -0
- package/dist/subagent/agentStateDetail.js +41 -0
- package/dist/subagent/engineCompactWire.d.ts +15 -0
- package/dist/subagent/engineCompactWire.js +82 -45
- 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/taskRequestWords.d.ts +2 -4
- package/dist/taskRequestWords.js +3 -2
- 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/userAttachmentEnvelope.d.ts +22 -1
- package/dist/userAttachmentEnvelope.js +90 -2
- package/dist/userInvokedSkillsCapability.d.ts +0 -1
- package/dist/userInvokedSkillsCapability.js +13 -12
- package/dist/webSearchBackendCapability.d.ts +0 -1
- package/dist/webSearchBackendCapability.js +20 -19
- package/dist/webSearchWireCaps.js +3 -11
- package/dist/wireErrorTriage.d.ts +11 -0
- package/dist/wireErrorTriage.js +35 -0
- package/dist/wireFailureShape.d.ts +10 -0
- package/dist/wireFailureShape.js +72 -5
- package/dist/wireRefusalCopy.d.ts +6 -1
- package/dist/wireRefusalCopy.js +23 -25
- package/dist/wiringInstructionsAttribution.d.ts +10 -0
- package/dist/wiringInstructionsAttribution.js +67 -0
- package/dist/workflowClient.js +19 -2
- package/dist/workflowsJournalCapability.d.ts +0 -1
- package/dist/workflowsJournalCapability.js +13 -12
- package/dist/writeProtectionCapability.d.ts +0 -1
- package/dist/writeProtectionCapability.js +26 -26
- package/docs/INTEGRATION-CLIENTS.md +1733 -52
- package/package.json +5 -5
- package/dist/askSurvivesStandingAnswer.d.ts +0 -13
- package/dist/askSurvivesStandingAnswer.js +0 -53
- package/dist/engineCapsGenerationGuard.d.ts +0 -4
- package/dist/engineCapsGenerationGuard.js +0 -19
- package/dist/hitl/askSurvivesPosture.d.ts +0 -20
- package/dist/hitl/askSurvivesPosture.js +0 -48
- 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/dist/{hitl/rosterMountedNames.js → rosterMountedNames.js} +0 -0
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,13 +0,0 @@
|
|
|
1
|
-
import { type AutomaticAnswerRoad, type AutomaticAnswerUnknownWhy } from './hitl/automaticAnswerVerdict.js';
|
|
2
|
-
export declare const MODE_ARBITRATION: Readonly<Record<"hook" | "write_protection" | "mode" | "rule_unreadable" | "content_question" | "ancestor" | "unverifiable_delete" | "transcript_write" | "org_rule" | "governance_unavailable" | "ask_rule" | "denial_limit_fallback" | "classifier_no_ruling" | "requires_user_interaction" | "operator_forced" | "shell_floor" | "write_protection_unresolved" | "probe" | "tool_marks_mcp" | "tool_marks_a2a" | "policy_rra" | "artifact_shared_read" | "unstated" | "ordinary", import("./generated/engineFactTables.js").CoreModeArbitrationRow>>;
|
|
3
|
-
export type StandingAnswerVerdict = {
|
|
4
|
-
readonly kind: 'must_ask';
|
|
5
|
-
readonly by: string;
|
|
6
|
-
readonly road?: AutomaticAnswerRoad;
|
|
7
|
-
} | {
|
|
8
|
-
readonly kind: 'may_answer';
|
|
9
|
-
} | {
|
|
10
|
-
readonly kind: 'unknown';
|
|
11
|
-
readonly why?: AutomaticAnswerUnknownWhy;
|
|
12
|
-
};
|
|
13
|
-
export declare function askSurvivesStandingAnswer(card: object | null | undefined): StandingAnswerVerdict;
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import { CORE_MODE_ARBITRATION } from './generated/engineFactTables.js';
|
|
2
|
-
import { automaticAnswerVerdict } from './hitl/automaticAnswerVerdict.js';
|
|
3
|
-
export const MODE_ARBITRATION = CORE_MODE_ARBITRATION;
|
|
4
|
-
const MUST_ASK_MANDATED = Object.freeze({ kind: 'must_ask', by: 'mandated' });
|
|
5
|
-
const MAY_ANSWER = Object.freeze({ kind: 'may_answer' });
|
|
6
|
-
const UNKNOWN = Object.freeze({ kind: 'unknown' });
|
|
7
|
-
export function askSurvivesStandingAnswer(card) {
|
|
8
|
-
const old = legacyStandingAnswerVerdict(card);
|
|
9
|
-
const neu = automaticAnswerVerdict(card, 'standing_rule');
|
|
10
|
-
if (old.kind === 'must_ask' || neu.kind === 'must_ask') {
|
|
11
|
-
const by = old.kind === 'must_ask' ? old.by : neu.kind === 'must_ask' ? (neu.askClass ?? neu.road) : 'mandated';
|
|
12
|
-
const road = neu.kind === 'must_ask' ? neu.road : by === 'mandated' ? 'mandated' : 'ask_class';
|
|
13
|
-
return Object.freeze({ kind: 'must_ask', by, road });
|
|
14
|
-
}
|
|
15
|
-
if (old.kind === 'unknown' || neu.kind === 'unknown')
|
|
16
|
-
return neu.kind === 'unknown' ? Object.freeze({ kind: 'unknown', why: neu.why }) : UNKNOWN;
|
|
17
|
-
return MAY_ANSWER;
|
|
18
|
-
}
|
|
19
|
-
function legacyStandingAnswerVerdict(card) {
|
|
20
|
-
try {
|
|
21
|
-
if (card === null || card === undefined || typeof card !== 'object')
|
|
22
|
-
return UNKNOWN;
|
|
23
|
-
if (Object.hasOwn(card, 'mandated') && card.mandated === true)
|
|
24
|
-
return MUST_ASK_MANDATED;
|
|
25
|
-
const classes = Object.hasOwn(card, 'classes') ? card.classes : undefined;
|
|
26
|
-
if (!Array.isArray(classes))
|
|
27
|
-
return UNKNOWN;
|
|
28
|
-
const length = classes.length;
|
|
29
|
-
if (typeof length !== 'number' || !Number.isSafeInteger(length) || length <= 0)
|
|
30
|
-
return UNKNOWN;
|
|
31
|
-
const names = [];
|
|
32
|
-
for (let i = 0; i < length; i += 1) {
|
|
33
|
-
if (!Object.hasOwn(classes, i))
|
|
34
|
-
return UNKNOWN;
|
|
35
|
-
const c = classes[i];
|
|
36
|
-
if (typeof c !== 'string')
|
|
37
|
-
return UNKNOWN;
|
|
38
|
-
names.push(c);
|
|
39
|
-
}
|
|
40
|
-
if (classes.length !== length)
|
|
41
|
-
return UNKNOWN;
|
|
42
|
-
for (const name of names) {
|
|
43
|
-
if (!Object.hasOwn(MODE_ARBITRATION, name))
|
|
44
|
-
return UNKNOWN;
|
|
45
|
-
if (MODE_ARBITRATION[name]?.ruleMayClear !== true)
|
|
46
|
-
return Object.freeze({ kind: 'must_ask', by: name });
|
|
47
|
-
}
|
|
48
|
-
return MAY_ANSWER;
|
|
49
|
-
}
|
|
50
|
-
catch {
|
|
51
|
-
return UNKNOWN;
|
|
52
|
-
}
|
|
53
|
-
}
|
|
@@ -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,20 +0,0 @@
|
|
|
1
|
-
import { type AutomaticAnswerRoad, type AutomaticAnswerUnknownWhy } from './automaticAnswerVerdict.js';
|
|
2
|
-
export interface AskPostureFacts {
|
|
3
|
-
readonly settingsAskRuleMatched?: boolean;
|
|
4
|
-
}
|
|
5
|
-
export type AskPostureSurvivalRoad = 'origin' | 'settings_ask_rule';
|
|
6
|
-
export type AskPostureVerdict = {
|
|
7
|
-
readonly kind: 'must_ask';
|
|
8
|
-
readonly by: AskPostureSurvivalRoad;
|
|
9
|
-
readonly road?: AutomaticAnswerRoad;
|
|
10
|
-
readonly askClass?: string;
|
|
11
|
-
} | {
|
|
12
|
-
readonly kind: 'posture_may_answer';
|
|
13
|
-
readonly releaseReason?: string;
|
|
14
|
-
} | {
|
|
15
|
-
readonly kind: 'unknown';
|
|
16
|
-
readonly why?: AutomaticAnswerUnknownWhy;
|
|
17
|
-
};
|
|
18
|
-
export declare function askSurvivesPosture(req: {
|
|
19
|
-
readonly origin?: string;
|
|
20
|
-
} | null | undefined, facts?: AskPostureFacts | null): AskPostureVerdict;
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { readOwnNonEmptyString } from '../ownKey.js';
|
|
2
|
-
import { automaticAnswerVerdict } from './automaticAnswerVerdict.js';
|
|
3
|
-
const ORIGIN_SURVIVES_POSTURE = Object.freeze({
|
|
4
|
-
content_question: true,
|
|
5
|
-
ancestor_marked: false,
|
|
6
|
-
org_unavailable: true,
|
|
7
|
-
org_rule: true,
|
|
8
|
-
rule_store_unavailable: true,
|
|
9
|
-
hook: true,
|
|
10
|
-
ask_rule: true,
|
|
11
|
-
denial_limit_fallback: true,
|
|
12
|
-
shell_gate_tighten: false,
|
|
13
|
-
safety_tighten: false,
|
|
14
|
-
policy: false,
|
|
15
|
-
});
|
|
16
|
-
const MUST_ASK_BY_ORIGIN = Object.freeze({ kind: 'must_ask', by: 'origin' });
|
|
17
|
-
const MUST_ASK_BY_SETTINGS = Object.freeze({ kind: 'must_ask', by: 'settings_ask_rule' });
|
|
18
|
-
const POSTURE_MAY_ANSWER = Object.freeze({ kind: 'posture_may_answer' });
|
|
19
|
-
const UNKNOWN = Object.freeze({ kind: 'unknown' });
|
|
20
|
-
export function askSurvivesPosture(req, facts) {
|
|
21
|
-
const old = legacyPostureVerdict(req, facts);
|
|
22
|
-
const neu = automaticAnswerVerdict(req, 'mode_posture', facts ?? undefined);
|
|
23
|
-
if (old.kind === 'must_ask' || neu.kind === 'must_ask') {
|
|
24
|
-
const by = old.kind === 'must_ask' ? old.by : neu.kind === 'must_ask' && neu.road === 'settings_ask_rule' ? 'settings_ask_rule' : 'origin';
|
|
25
|
-
const road = neu.kind === 'must_ask' ? neu.road : by === 'settings_ask_rule' ? 'settings_ask_rule' : 'origin';
|
|
26
|
-
const askClass = neu.kind === 'must_ask' ? neu.askClass : undefined;
|
|
27
|
-
return Object.freeze({ kind: 'must_ask', by, road, ...(askClass !== undefined ? { askClass } : {}) });
|
|
28
|
-
}
|
|
29
|
-
if (old.kind === 'unknown' || neu.kind === 'unknown') {
|
|
30
|
-
return neu.kind === 'unknown' ? Object.freeze({ kind: 'unknown', why: neu.why }) : UNKNOWN;
|
|
31
|
-
}
|
|
32
|
-
return neu.kind === 'may_answer' && neu.releaseReason !== undefined
|
|
33
|
-
? Object.freeze({ kind: 'posture_may_answer', releaseReason: neu.releaseReason })
|
|
34
|
-
: POSTURE_MAY_ANSWER;
|
|
35
|
-
}
|
|
36
|
-
function legacyPostureVerdict(req, facts) {
|
|
37
|
-
const origin = readOwnNonEmptyString(req, 'origin');
|
|
38
|
-
const rawMatched = typeof facts === 'object' && facts !== null ? facts.settingsAskRuleMatched : undefined;
|
|
39
|
-
const matched = typeof rawMatched === 'boolean' ? rawMatched : undefined;
|
|
40
|
-
const known = origin !== undefined && Object.hasOwn(ORIGIN_SURVIVES_POSTURE, origin);
|
|
41
|
-
if (known && ORIGIN_SURVIVES_POSTURE[origin] === true)
|
|
42
|
-
return MUST_ASK_BY_ORIGIN;
|
|
43
|
-
if (matched === true)
|
|
44
|
-
return MUST_ASK_BY_SETTINGS;
|
|
45
|
-
if (matched === false && (origin === undefined || known))
|
|
46
|
-
return POSTURE_MAY_ANSWER;
|
|
47
|
-
return UNKNOWN;
|
|
48
|
-
}
|
|
@@ -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
|
-
}
|
|
File without changes
|