@sema-agent/client-core 0.84.1 → 0.85.1
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 +206 -0
- package/README.md +20 -13
- package/dist/adapt/arms.js +1 -1
- package/dist/adapt.d.ts +1 -1
- package/dist/adapt.js +1 -1
- package/dist/adapter/activeRunSelfHeal.d.ts +3 -0
- package/dist/adapter/activeRunSelfHeal.js +149 -17
- package/dist/adapter/downstream/terminalToSdkResult.js +9 -5
- package/dist/adapter/runStream.js +6 -2
- package/dist/agentSession/engineSessionBackgroundStop.d.ts +50 -0
- package/dist/agentSession/engineSessionBackgroundStop.js +291 -0
- package/dist/agentsWireCaps.d.ts +2 -1
- package/dist/cloudConfigWireCaps.js +2 -1
- package/dist/corruptSession.d.ts +3 -0
- package/dist/corruptSession.js +29 -0
- package/dist/corruptSessionCopy.d.ts +1 -0
- package/dist/corruptSessionCopy.js +4 -0
- package/dist/decideFailureNote.js +4 -1
- package/dist/decideReceipt.d.ts +6 -0
- package/dist/decideReceipt.js +30 -1
- package/dist/effortWire.d.ts +2 -1
- package/dist/effortWire.js +2 -4
- package/dist/engineErrorCodes.d.ts +9 -0
- package/dist/engineErrorCodes.js +29 -0
- package/dist/engineNoticeCodes.d.ts +9 -0
- package/dist/engineNoticeCodes.js +44 -156
- package/dist/engineWireFor.d.ts +43 -0
- package/dist/engineWireFor.js +399 -0
- package/dist/engineWireSdk.d.ts +4 -0
- package/dist/fileHistoryCaptureCapability.d.ts +4 -1
- package/dist/fileHistoryCaptureCapability.js +43 -9
- package/dist/gateVocabulary.d.ts +1 -2
- package/dist/gateVocabulary.js +1 -22
- package/dist/generated/engineNoticeTables.d.ts +3 -0
- package/dist/generated/engineNoticeTables.js +156 -0
- package/dist/generated/toolNameTables.d.ts +2 -0
- package/dist/generated/toolNameTables.js +43 -0
- package/dist/headlessPermissionModeWire.js +2 -4
- package/dist/hitl/armedGateRegistry.d.ts +1 -0
- package/dist/hitl/armedGateRegistry.js +1 -1
- package/dist/hitl/frameRouter.js +4 -2
- package/dist/hitl/parkResolver.js +3 -1
- package/dist/hitl/planReviewWire.d.ts +11 -0
- package/dist/hitl/planReviewWire.js +191 -72
- package/dist/hitl/rosterMountedNames.d.ts +2 -0
- package/dist/hitl/rosterMountedNames.js +38 -0
- package/dist/hitl/sessionPolicyDeliverable.d.ts +6 -2
- package/dist/hitl/sessionPolicyDeliverable.js +25 -45
- package/dist/hitl/sessionPolicyWire.js +1 -38
- package/dist/hitl/toolApprovalWire.d.ts +4 -2
- package/dist/hitl/toolApprovalWire.js +4 -2
- package/dist/host.d.ts +1 -1
- package/dist/host.js +11 -2
- package/dist/index.d.ts +10 -4
- package/dist/index.js +7 -3
- package/dist/permissionWireCaps.d.ts +2 -1
- package/dist/permissionWireCaps.js +2 -7
- package/dist/request/taskRequest.d.ts +4 -0
- package/dist/request/taskRequest.js +30 -1
- package/dist/resumeRefusalCopy.js +4 -2
- package/dist/runTerminal.js +4 -0
- package/dist/sandboxWire.js +1 -1
- package/dist/sealedKeyCapability.d.ts +17 -0
- package/dist/sealedKeyCapability.js +42 -0
- package/dist/seatContract.d.ts +2 -1
- package/dist/seatContract.js +5 -21
- package/dist/subagent/engineCompactWire.d.ts +13 -2
- package/dist/subagent/engineCompactWire.js +48 -37
- package/dist/subagent/engineDelegatedPrompt.d.ts +9 -1
- package/dist/subagent/engineDelegatedPrompt.js +16 -16
- package/dist/subagent/engineRowStopGate.d.ts +2 -2
- package/dist/subagent/engineRowStopGate.js +4 -4
- package/dist/subagent/engineSubagentOutput.d.ts +8 -0
- package/dist/subagent/engineSubagentOutput.js +37 -18
- package/dist/subagent/engineSubagentResume.d.ts +11 -2
- package/dist/subagent/engineSubagentResume.js +28 -14
- package/dist/subagent/engineSubagentSteer.d.ts +10 -1
- package/dist/subagent/engineSubagentSteer.js +16 -11
- package/dist/subagent/engineSubagentTail.d.ts +10 -1
- package/dist/subagent/engineSubagentTail.js +35 -17
- package/dist/subagent/engineTaskHandleWire.d.ts +13 -0
- package/dist/subagent/engineTaskHandleWire.js +41 -20
- package/dist/subagent/subagentOwnerAbsence.js +2 -5
- package/dist/taskRequestWords.d.ts +5 -0
- package/dist/taskRequestWords.js +4 -0
- package/dist/wireErrorTriage.d.ts +1 -0
- package/dist/wireErrorTriage.js +3 -1
- package/dist/wireRefusalCopy.d.ts +10 -0
- package/dist/wireRefusalCopy.js +62 -2
- package/docs/INTEGRATION-CLIENTS.md +867 -22
- package/package.json +1 -1
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { wireFailureShapeOf } from '../wireFailureShape.js';
|
|
2
2
|
import { hostLog } from '../host.js';
|
|
3
3
|
import { isEngineRefusedToolName } from './sessionPolicyDeliverable.js';
|
|
4
|
+
import { rosterMountedNames } from './rosterMountedNames.js';
|
|
4
5
|
const RULE_FIELD_PRESENCE = {
|
|
5
6
|
toolAllow: true,
|
|
6
7
|
toolDeny: true,
|
|
@@ -307,44 +308,6 @@ export function sessionPolicyTightenNotice(outcome) {
|
|
|
307
308
|
}
|
|
308
309
|
}
|
|
309
310
|
}
|
|
310
|
-
function rosterMountedNames(roster) {
|
|
311
|
-
if (roster === undefined || roster === null)
|
|
312
|
-
return 'absent';
|
|
313
|
-
try {
|
|
314
|
-
if (typeof roster !== 'object' || Array.isArray(roster))
|
|
315
|
-
return 'unreadable';
|
|
316
|
-
const entries = roster.entries;
|
|
317
|
-
if (!Array.isArray(entries))
|
|
318
|
-
return 'unreadable';
|
|
319
|
-
const names = new Set();
|
|
320
|
-
const n = entries.length;
|
|
321
|
-
for (let i = 0; i < n; i++) {
|
|
322
|
-
if (!Object.hasOwn(entries, i))
|
|
323
|
-
return 'unreadable';
|
|
324
|
-
const row = entries[i];
|
|
325
|
-
if (typeof row !== 'object' || row === null)
|
|
326
|
-
return 'unreadable';
|
|
327
|
-
const name = row.name;
|
|
328
|
-
if (typeof name !== 'string' || name.length === 0)
|
|
329
|
-
return 'unreadable';
|
|
330
|
-
names.add(name);
|
|
331
|
-
const aliases = row.aliases;
|
|
332
|
-
if (aliases === undefined)
|
|
333
|
-
continue;
|
|
334
|
-
if (!Array.isArray(aliases))
|
|
335
|
-
return 'unreadable';
|
|
336
|
-
for (const a of aliases) {
|
|
337
|
-
if (typeof a !== 'string')
|
|
338
|
-
return 'unreadable';
|
|
339
|
-
names.add(a);
|
|
340
|
-
}
|
|
341
|
-
}
|
|
342
|
-
return names;
|
|
343
|
-
}
|
|
344
|
-
catch {
|
|
345
|
-
return 'unreadable';
|
|
346
|
-
}
|
|
347
|
-
}
|
|
348
311
|
function withoutRefusedEntries(prior, mounted) {
|
|
349
312
|
const REFUSABLE_NAME_FIELDS = ['toolDeny', 'toolAllow'];
|
|
350
313
|
const isRefusable = (f) => REFUSABLE_NAME_FIELDS.includes(f);
|
|
@@ -4,7 +4,7 @@ import { type ApprovalMandateWord } from '../gateVocabulary.js';
|
|
|
4
4
|
import type { ToolPermissionRequest } from '../seatContract.js';
|
|
5
5
|
import { type DenyAttributionRefusalDetail } from '../wireRefusalCopy.js';
|
|
6
6
|
import { type DecideReceiptView } from '../decideReceipt.js';
|
|
7
|
-
import { RULE_OFFER_MATCHES, RULE_OFFER_BATCH_MEMBER_KINDS, RULE_OFFER_UNCOVERED_REASONS, RULE_OFFERS_ABSENCE_REASONS
|
|
7
|
+
import { RULE_OFFER_MATCHES, RULE_OFFER_BATCH_MEMBER_KINDS, RULE_OFFER_UNCOVERED_REASONS, RULE_OFFERS_ABSENCE_REASONS } from '@sema-agent/sdk';
|
|
8
8
|
import type { RuleSuggestion, ToolApprovalRespondAck, PersistedRuleAnchor as SdkPersistedRuleAnchor, RuleOfferMatch as SdkRuleOfferMatch, RuleOfferBatchMember as SdkRuleOfferBatchMember, RuleOfferUncoveredDetail as SdkRuleOfferUncoveredDetail, RuleOfferUncoveredReason as SdkRuleOfferUncoveredReason, AskOrigin as SdkAskOrigin, RuleOffersAbsence as SdkRuleOffersAbsence, DenialLimitKind as SdkDenialLimitKind, DenialLimitFallback as SdkDenialLimitFallback } from '@sema-agent/sdk';
|
|
9
9
|
export declare function isFsApprovalGate(gate: {
|
|
10
10
|
kind?: unknown;
|
|
@@ -58,7 +58,9 @@ export type AskOrigin = SdkAskOrigin;
|
|
|
58
58
|
export type RuleOffersAbsence = SdkRuleOffersAbsence;
|
|
59
59
|
export type DenialLimitKind = SdkDenialLimitKind;
|
|
60
60
|
export type DenialLimitFallback = SdkDenialLimitFallback;
|
|
61
|
-
export { RULE_OFFERS_ABSENCE_REASONS
|
|
61
|
+
export { RULE_OFFERS_ABSENCE_REASONS };
|
|
62
|
+
export declare const ASK_ORIGIN_WORDS: readonly string[];
|
|
63
|
+
export declare const APPROVAL_MANDATE_WORDS: readonly ["operator_always", "tool_marks", "probe_mandate", "probe_unanswered", "write_protection", "write_protection_unresolved"];
|
|
62
64
|
export type WireRuleOffer = {
|
|
63
65
|
kind: 'single';
|
|
64
66
|
rule: string;
|
|
@@ -11,7 +11,7 @@ import { isApprovalMandateWord } from '../gateVocabulary.js';
|
|
|
11
11
|
import { denyAttributionRefusalFromError } from '../wireRefusalCopy.js';
|
|
12
12
|
import { decideFailureNote } from '../decideFailureNote.js';
|
|
13
13
|
import { readDecideReceipt } from '../decideReceipt.js';
|
|
14
|
-
import { RULE_OFFER_MATCHES, RULE_OFFER_BATCH_MEMBER_KINDS, RULE_OFFER_UNCOVERED_REASONS, RULE_OFFERS_ABSENCE_REASONS,
|
|
14
|
+
import { RULE_OFFER_MATCHES, RULE_OFFER_BATCH_MEMBER_KINDS, RULE_OFFER_UNCOVERED_REASONS, RULE_OFFERS_ABSENCE_REASONS, ASK_ORIGINS, PERSISTED_RULE_MANDATES, } from '@sema-agent/sdk';
|
|
15
15
|
export function isFsApprovalGate(gate) {
|
|
16
16
|
if (!gate)
|
|
17
17
|
return false;
|
|
@@ -52,7 +52,9 @@ export function structurallyEqual(a, b) {
|
|
|
52
52
|
return ka.every(k => structurallyEqual(a[k], b[k]));
|
|
53
53
|
}
|
|
54
54
|
export { RULE_OFFER_MATCHES, RULE_OFFER_BATCH_MEMBER_KINDS, RULE_OFFER_UNCOVERED_REASONS };
|
|
55
|
-
export { RULE_OFFERS_ABSENCE_REASONS
|
|
55
|
+
export { RULE_OFFERS_ABSENCE_REASONS };
|
|
56
|
+
export const ASK_ORIGIN_WORDS = ASK_ORIGINS;
|
|
57
|
+
export const APPROVAL_MANDATE_WORDS = PERSISTED_RULE_MANDATES;
|
|
56
58
|
export const APPROVAL_DENY_SETTLED_BY_WORDS = Object.freeze(['human', 'policy']);
|
|
57
59
|
export function readApprovalDenySettledBy(decision) {
|
|
58
60
|
if (decision === null || typeof decision !== 'object')
|
package/dist/host.d.ts
CHANGED
|
@@ -56,7 +56,7 @@ export interface HostPorts {
|
|
|
56
56
|
}
|
|
57
57
|
export declare function installHost(ports: HostPorts): () => void;
|
|
58
58
|
export declare function installHostFor(sessionKey: string, ports: Omit<HostPorts, 'queue'>): () => void;
|
|
59
|
-
export declare function hostLog(level: AdapterLogLevel, msg: string, data?: unknown):
|
|
59
|
+
export declare function hostLog(level: AdapterLogLevel, msg: string, data?: unknown): boolean;
|
|
60
60
|
export declare function hostProbe(channel: string, line: string): void;
|
|
61
61
|
export declare function hostSettings(): SettingsPort | undefined;
|
|
62
62
|
export declare function hostSettingsFor(sessionKey: string): SettingsPort | undefined;
|
package/dist/host.js
CHANGED
|
@@ -46,11 +46,20 @@ export function installHostFor(sessionKey, ports) {
|
|
|
46
46
|
slot.state = prev;
|
|
47
47
|
};
|
|
48
48
|
}
|
|
49
|
+
function callDiagnosticPort(call) {
|
|
50
|
+
try {
|
|
51
|
+
call();
|
|
52
|
+
return true;
|
|
53
|
+
}
|
|
54
|
+
catch {
|
|
55
|
+
return false;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
49
58
|
export function hostLog(level, msg, data) {
|
|
50
|
-
hostSlot(DEFAULT_SESSION_KEY).state.log?.(level, msg, data);
|
|
59
|
+
return callDiagnosticPort(() => hostSlot(DEFAULT_SESSION_KEY).state.log?.(level, msg, data));
|
|
51
60
|
}
|
|
52
61
|
export function hostProbe(channel, line) {
|
|
53
|
-
hostSlot(DEFAULT_SESSION_KEY).state.probe?.(channel, line);
|
|
62
|
+
callDiagnosticPort(() => hostSlot(DEFAULT_SESSION_KEY).state.probe?.(channel, line));
|
|
54
63
|
}
|
|
55
64
|
export function hostSettings() {
|
|
56
65
|
return hostSettingsFor(DEFAULT_SESSION_KEY);
|
package/dist/index.d.ts
CHANGED
|
@@ -22,7 +22,8 @@ export { _resetLiveQuestionStore, hasLocalQuestionResponder, hasQuestionOverlay,
|
|
|
22
22
|
export type { AskQuestion, AskQuestionOption, QuestionAnswer, QuestionFrame, } from './liveQuestionStore.js';
|
|
23
23
|
export * from './engineInlineTaskStats.js';
|
|
24
24
|
export * from './printToolResultFrame.js';
|
|
25
|
-
export
|
|
25
|
+
export { __resetEngineCapsCacheForTests, engineCapState, engineCapString, engineCapsGeneration, engineCapsSettled, engineCapTrue, engineCapValue, invalidateEngineCaps, kickEngineCapsProbe, } from './engineCapsCache.js';
|
|
26
|
+
export type { EngineCapState, EngineCapValueState, } from './engineCapsCache.js';
|
|
26
27
|
export * from './sqlEngineCapability.js';
|
|
27
28
|
export * from './writeProtectionCapability.js';
|
|
28
29
|
export * from './webSearchBackendCapability.js';
|
|
@@ -71,7 +72,7 @@ export * from './engineWireSdk.js';
|
|
|
71
72
|
export * from './classifierVerdictWire.js';
|
|
72
73
|
export { stripSystemReminderBlocks, unwrapSystemReminder } from './systemReminderTag.js';
|
|
73
74
|
export { findSystemReminderOpenTag, type SystemReminderOpenTagSpan } from './systemReminderTag.js';
|
|
74
|
-
export { ACTIVE_RUN_BUSY_ERROR_CODE, asModelFallbackReason, CAPABILITY_SELF_ORCHESTRATION_REQUIRED, CONFIG_DELEGATION_ENTRY_CAPS, CONFIG_LEGACY_TOOL_NAME, CONFIG_LIMIT_INVALID, CONFIG_LIMIT_UNKNOWN_KEY, CONFIG_MEMORY_PROJECT_KEY_SPELLING, CONFIG_MEMORY_WRITE_SCOPE_MISMATCH, CONFIG_REFUSAL_CODES, CONFIG_STRATEGY_FIND_LIMIT_INVALID, CONFIG_STRATEGY_MAX_SIZE_INVALID, DECIDE_WORKFLOW_HOST_UNKNOWN, DECIDE_WORKFLOW_LANE_CODES, DECIDE_WORKFLOW_REMEMBER_UNSUPPORTED, DELEGATION_CAP_CODES, DELEGATION_CONCURRENCY_CAP, DELEGATION_SESSION_CAP, delegationCapDispositionOf, DRAINING_ERROR_CODE, ENGINE_STOP_REASONS, engineStopReasonToCc, ENV_LIFETIME_EXPIRED, GATE_PARKED_ERROR_CODE, isConfigRefusalCode, isDelegationCapCode, isInterruptedToolEndCode, isLimitsExceededCode, isRewindFamilyCode, isWorkflowParkRefusalCode, LIMITS_MAX_COST_EXCEEDED, LIMITS_MAX_TOKENS_EXCEEDED, LIMITS_MAX_TURNS_EXCEEDED, LIMITS_MAX_WALLTIME_EXCEEDED, MCP_SERVER_REVOKED, MODEL_FALLBACK_INHERIT_NO_TIER_BINDING, OUTPUT_INVALID, PARKED_RESUME_STARTUP_FAILED, RESUME_AT_ERROR_CODE_PREFIX, RESUME_CONTEXT_UNAVAILABLE, RESUME_ENV_FAILED, RESUME_PLACEMENT_MISMATCH, RESUME_POLICY_FOLD_CODE, RESUME_PREFLIGHT_REJECTED, RESUME_REOPEN_CODES, RESUME_RETRY_LATER_CODES, RESUME_TOOL_CONTRACT_MISMATCH, RESUME_TOOL_UNAVAILABLE, RESUME_USAGE_WINDOW_EXHAUSTED, REWIND_ERROR_CODE_PREFIXES, SCENARIO_NOT_ALLOWED_ERROR_CODE, STOP_CONFLICT_CODES, STREAM_MAX_DURATION, TOOL_END_INTERRUPTED_NEVER_STARTED, TOOL_END_INTERRUPTED_OUTCOME_UNKNOWN, USAGE_WINDOW_EXHAUSTED, WORKFLOW_PARK_REFUSAL_CODES, } from './engineErrorCodes.js';
|
|
75
|
+
export { ACTIVE_RUN_BUSY_ERROR_CODE, asModelFallbackReason, CAPABILITY_SELF_ORCHESTRATION_REQUIRED, CONFIG_DELEGATION_ENTRY_CAPS, CONFIG_LEGACY_TOOL_NAME, CONFIG_LIMIT_INVALID, CONFIG_LIMIT_UNKNOWN_KEY, CONFIG_MEMORY_PROJECT_KEY_SPELLING, CONFIG_MEMORY_WRITE_SCOPE_MISMATCH, CONFIG_REFUSAL_CODES, CONFIG_STRATEGY_FIND_LIMIT_INVALID, CONFIG_STRATEGY_MAX_SIZE_INVALID, CORRUPT_SESSION_ERROR_CODE, DECIDE_CLAIM_LOST, DECIDE_GATE_MOVED, DECIDE_NOT_PARKED, DECIDE_PARK_MOVED_CODES, DECIDE_WORKFLOW_HOST_UNKNOWN, DECIDE_WORKFLOW_LANE_CODES, DECIDE_WORKFLOW_REMEMBER_UNSUPPORTED, DELEGATION_CAP_CODES, DELEGATION_CONCURRENCY_CAP, DELEGATION_SESSION_CAP, delegationCapDispositionOf, DRAINING_ERROR_CODE, ENGINE_STOP_REASONS, engineStopReasonToCc, ENV_LIFETIME_EXPIRED, GATE_PARKED_ERROR_CODE, isConfigRefusalCode, isCorruptSessionCode, isDecideParkMovedCode, isDelegationCapCode, isInterruptedToolEndCode, isLimitsExceededCode, isRewindFamilyCode, isStatusDerivedCoarseCode, isWorkflowParkRefusalCode, LIMITS_MAX_COST_EXCEEDED, LIMITS_MAX_TOKENS_EXCEEDED, LIMITS_MAX_TURNS_EXCEEDED, LIMITS_MAX_WALLTIME_EXCEEDED, MCP_SERVER_REVOKED, MODEL_FALLBACK_INHERIT_NO_TIER_BINDING, OUTPUT_INVALID, PARKED_RESUME_STARTUP_FAILED, RESUME_AT_ERROR_CODE_PREFIX, RESUME_CONTEXT_UNAVAILABLE, RESUME_ENV_FAILED, RESUME_PLACEMENT_MISMATCH, RESUME_POLICY_FOLD_CODE, RESUME_PREFLIGHT_REJECTED, RESUME_REOPEN_CODES, RESUME_RETRY_LATER_CODES, RESUME_TOOL_CONTRACT_MISMATCH, RESUME_TOOL_UNAVAILABLE, RESUME_USAGE_WINDOW_EXHAUSTED, REWIND_ERROR_CODE_PREFIXES, SCENARIO_NOT_ALLOWED_ERROR_CODE, STATUS_DERIVED_COARSE_CODES, STOP_CONFLICT_CODES, STREAM_MAX_DURATION, TOOL_END_INTERRUPTED_NEVER_STARTED, TOOL_END_INTERRUPTED_OUTCOME_UNKNOWN, USAGE_WINDOW_EXHAUSTED, WORKFLOW_PARK_REFUSAL_CODES, } from './engineErrorCodes.js';
|
|
75
76
|
export type { DelegationCapDisposition, ModelFallbackReason, } from './engineErrorCodes.js';
|
|
76
77
|
export * from './agentsWireCaps.js';
|
|
77
78
|
export * from './attachmentsWireCaps.js';
|
|
@@ -88,6 +89,7 @@ export * from './oneShotWireCaps.js';
|
|
|
88
89
|
export * from './rewindWireCaps.js';
|
|
89
90
|
export * from './rewindArchiveCapability.js';
|
|
90
91
|
export * from './fileHistoryCaptureCapability.js';
|
|
92
|
+
export * from './sealedKeyCapability.js';
|
|
91
93
|
export * from './registryQuotaUsage.js';
|
|
92
94
|
export * from './selfOrchestrationWireCaps.js';
|
|
93
95
|
export * from './skillsWireCaps.js';
|
|
@@ -129,7 +131,7 @@ export * from './subagent/engineRowStopGate.js';
|
|
|
129
131
|
export * from './subagent/engineSubagentOutput.js';
|
|
130
132
|
export * from './subagent/engineSubagentSteer.js';
|
|
131
133
|
export { __resetRetainWithoutWakeWarningForTests, auditRetainWithoutWake, classifySubagentResumeFailure, resolveOwnerRunId, resolveSubagentContinueTarget, resolveSubagentResumeContext, resumeSettledSubagent, SUBAGENT_RESUME_CAP, subagentResumeAvailable, } from './subagent/engineSubagentResume.js';
|
|
132
|
-
export type { RetainWithoutWakeInput, RetainWithoutWakeVerdict, SubagentOwnerContext, SubagentResumeContext, SubagentResumeFacade, SubagentResumeFailureKind, SubagentResumeFailureVerdict, SubagentResumeOutcome, } from './subagent/engineSubagentResume.js';
|
|
134
|
+
export type { RetainWithoutWakeInput, RetainWithoutWakeVerdict, SubagentOwnerContext, SubagentResumeContext, SubagentResumeFacade, SubagentResumeFailureKind, SubagentResumeFailureVerdict, SubagentResumeOutcome, SubagentResumeWire, SubagentResumeWireClient, } from './subagent/engineSubagentResume.js';
|
|
133
135
|
export * from './subagent/engineTaskHandleWire.js';
|
|
134
136
|
export * from './subagent/engineCompactWire.js';
|
|
135
137
|
export * from './subagent/engineSubagentTail.js';
|
|
@@ -139,6 +141,8 @@ export { engineWireTarget, engineWireTargetFor, installEngineWireTarget, install
|
|
|
139
141
|
export type { EngineWireTarget, } from './engineWireTarget.js';
|
|
140
142
|
export * from './principalWire.js';
|
|
141
143
|
export * from './wireErrorTriage.js';
|
|
144
|
+
export * from './corruptSession.js';
|
|
145
|
+
export * from './corruptSessionCopy.js';
|
|
142
146
|
export * from './resumeRefusalCopy.js';
|
|
143
147
|
export * from './wireRefusalCopy.js';
|
|
144
148
|
export * from './decideReceipt.js';
|
|
@@ -165,7 +169,7 @@ export * from './coreValuePorts.js';
|
|
|
165
169
|
export * from './hitl/askGateWire.js';
|
|
166
170
|
export * from './hitl/planReviewWire.js';
|
|
167
171
|
export { PLAN_REVIEW_QUESTION_ID_PREFIX, REOPEN_ID_TAIL, approvalCallKey, askGateQuestionId, planReviewQuestionId, liveFrameCallKey, armedKeyFromQuestionId, } from './hitl/gateIdentity.js';
|
|
168
|
-
export { _resetArmedGateRegistryForTest, _setGateArmedWaitMsForTest, clearArmedGate, gateArmedWaitMs, notePlanReviewAnswered, onGateArmed, planReviewArmedKey, registerArmedGate, registerArmedGateFor, registerArmedGateFromQuestionId, waitForGateArmed, wasGateArmed, wasGateArmedFor, } from './hitl/armedGateRegistry.js';
|
|
172
|
+
export { _resetArmedGateRegistryForTest, _setGateArmedWaitMsForTest, clearArmedGate, gateArmedWaitMs, notePlanReviewAnswered, onGateArmed, planReviewArmedKey, registerArmedGate, registerArmedGateFor, registerArmedGateFromQuestionId, registerArmedGateFromQuestionIdFor, waitForGateArmed, wasGateArmed, wasGateArmedFor, } from './hitl/armedGateRegistry.js';
|
|
169
173
|
export * from './hitl/parkOwnership.js';
|
|
170
174
|
export * from './hitl/parkRowBirthWait.js';
|
|
171
175
|
export * from './hitl/approvalDecisionNoteAudit.js';
|
|
@@ -187,6 +191,8 @@ export * from './agentSession/contract.js';
|
|
|
187
191
|
export * from './agentSession/backgroundView.js';
|
|
188
192
|
export { readEngineAgentRegistry, isEngineAgentRegistryListingSuperseded } from './agentSession/engineAgentRegistryRead.js';
|
|
189
193
|
export type { EngineAgentRegistryClient } from './agentSession/engineAgentRegistryRead.js';
|
|
194
|
+
export { stopEngineSessionBackground, engineSessionBackgroundReceiptReadingOf, ENGINE_SESSION_BACKGROUND_RECEIPT_STATES, } from './agentSession/engineSessionBackgroundStop.js';
|
|
195
|
+
export type { EngineSessionBackgroundStopClient, EngineSessionBackgroundStopWire, EngineSessionBackgroundStopOptions, EngineSessionBackgroundReceipt, EngineSessionBackgroundStopUnavailableWhy, EngineSessionBackgroundStopRefusedWhy, EngineSessionBackgroundStopResult, EngineSessionBackgroundReceiptState, EngineSessionBackgroundReceiptReading, } from './agentSession/engineSessionBackgroundStop.js';
|
|
190
196
|
export * from './model/catalog.js';
|
|
191
197
|
export * from './model/catalogLoader.js';
|
|
192
198
|
export * from './model/providerAuth.js';
|
package/dist/index.js
CHANGED
|
@@ -18,7 +18,7 @@ export * from './fleetAgentPanelProjection.js';
|
|
|
18
18
|
export { _resetLiveQuestionStore, hasLocalQuestionResponder, hasQuestionOverlay, hasQuestionOverlayFor, onQuestionFrame, onQuestionFrameFor, publishQuestionFrame, publishQuestionFrameFor, registerLocalQuestionResponder, respondToQuestion, setQuestionRespond, } from './liveQuestionStore.js';
|
|
19
19
|
export * from './engineInlineTaskStats.js';
|
|
20
20
|
export * from './printToolResultFrame.js';
|
|
21
|
-
export
|
|
21
|
+
export { __resetEngineCapsCacheForTests, engineCapState, engineCapString, engineCapsGeneration, engineCapsSettled, engineCapTrue, engineCapValue, invalidateEngineCaps, kickEngineCapsProbe, } from './engineCapsCache.js';
|
|
22
22
|
export * from './sqlEngineCapability.js';
|
|
23
23
|
export * from './writeProtectionCapability.js';
|
|
24
24
|
export * from './webSearchBackendCapability.js';
|
|
@@ -65,7 +65,7 @@ export * from './engineWireSdk.js';
|
|
|
65
65
|
export * from './classifierVerdictWire.js';
|
|
66
66
|
export { stripSystemReminderBlocks, unwrapSystemReminder } from './systemReminderTag.js';
|
|
67
67
|
export { findSystemReminderOpenTag } from './systemReminderTag.js';
|
|
68
|
-
export { ACTIVE_RUN_BUSY_ERROR_CODE, asModelFallbackReason, CAPABILITY_SELF_ORCHESTRATION_REQUIRED, CONFIG_DELEGATION_ENTRY_CAPS, CONFIG_LEGACY_TOOL_NAME, CONFIG_LIMIT_INVALID, CONFIG_LIMIT_UNKNOWN_KEY, CONFIG_MEMORY_PROJECT_KEY_SPELLING, CONFIG_MEMORY_WRITE_SCOPE_MISMATCH, CONFIG_REFUSAL_CODES, CONFIG_STRATEGY_FIND_LIMIT_INVALID, CONFIG_STRATEGY_MAX_SIZE_INVALID, DECIDE_WORKFLOW_HOST_UNKNOWN, DECIDE_WORKFLOW_LANE_CODES, DECIDE_WORKFLOW_REMEMBER_UNSUPPORTED, DELEGATION_CAP_CODES, DELEGATION_CONCURRENCY_CAP, DELEGATION_SESSION_CAP, delegationCapDispositionOf, DRAINING_ERROR_CODE, ENGINE_STOP_REASONS, engineStopReasonToCc, ENV_LIFETIME_EXPIRED, GATE_PARKED_ERROR_CODE, isConfigRefusalCode, isDelegationCapCode, isInterruptedToolEndCode, isLimitsExceededCode, isRewindFamilyCode, isWorkflowParkRefusalCode, LIMITS_MAX_COST_EXCEEDED, LIMITS_MAX_TOKENS_EXCEEDED, LIMITS_MAX_TURNS_EXCEEDED, LIMITS_MAX_WALLTIME_EXCEEDED, MCP_SERVER_REVOKED, MODEL_FALLBACK_INHERIT_NO_TIER_BINDING, OUTPUT_INVALID, PARKED_RESUME_STARTUP_FAILED, RESUME_AT_ERROR_CODE_PREFIX, RESUME_CONTEXT_UNAVAILABLE, RESUME_ENV_FAILED, RESUME_PLACEMENT_MISMATCH, RESUME_POLICY_FOLD_CODE, RESUME_PREFLIGHT_REJECTED, RESUME_REOPEN_CODES, RESUME_RETRY_LATER_CODES, RESUME_TOOL_CONTRACT_MISMATCH, RESUME_TOOL_UNAVAILABLE, RESUME_USAGE_WINDOW_EXHAUSTED, REWIND_ERROR_CODE_PREFIXES, SCENARIO_NOT_ALLOWED_ERROR_CODE, STOP_CONFLICT_CODES, STREAM_MAX_DURATION, TOOL_END_INTERRUPTED_NEVER_STARTED, TOOL_END_INTERRUPTED_OUTCOME_UNKNOWN, USAGE_WINDOW_EXHAUSTED, WORKFLOW_PARK_REFUSAL_CODES, } from './engineErrorCodes.js';
|
|
68
|
+
export { ACTIVE_RUN_BUSY_ERROR_CODE, asModelFallbackReason, CAPABILITY_SELF_ORCHESTRATION_REQUIRED, CONFIG_DELEGATION_ENTRY_CAPS, CONFIG_LEGACY_TOOL_NAME, CONFIG_LIMIT_INVALID, CONFIG_LIMIT_UNKNOWN_KEY, CONFIG_MEMORY_PROJECT_KEY_SPELLING, CONFIG_MEMORY_WRITE_SCOPE_MISMATCH, CONFIG_REFUSAL_CODES, CONFIG_STRATEGY_FIND_LIMIT_INVALID, CONFIG_STRATEGY_MAX_SIZE_INVALID, CORRUPT_SESSION_ERROR_CODE, DECIDE_CLAIM_LOST, DECIDE_GATE_MOVED, DECIDE_NOT_PARKED, DECIDE_PARK_MOVED_CODES, DECIDE_WORKFLOW_HOST_UNKNOWN, DECIDE_WORKFLOW_LANE_CODES, DECIDE_WORKFLOW_REMEMBER_UNSUPPORTED, DELEGATION_CAP_CODES, DELEGATION_CONCURRENCY_CAP, DELEGATION_SESSION_CAP, delegationCapDispositionOf, DRAINING_ERROR_CODE, ENGINE_STOP_REASONS, engineStopReasonToCc, ENV_LIFETIME_EXPIRED, GATE_PARKED_ERROR_CODE, isConfigRefusalCode, isCorruptSessionCode, isDecideParkMovedCode, isDelegationCapCode, isInterruptedToolEndCode, isLimitsExceededCode, isRewindFamilyCode, isStatusDerivedCoarseCode, isWorkflowParkRefusalCode, LIMITS_MAX_COST_EXCEEDED, LIMITS_MAX_TOKENS_EXCEEDED, LIMITS_MAX_TURNS_EXCEEDED, LIMITS_MAX_WALLTIME_EXCEEDED, MCP_SERVER_REVOKED, MODEL_FALLBACK_INHERIT_NO_TIER_BINDING, OUTPUT_INVALID, PARKED_RESUME_STARTUP_FAILED, RESUME_AT_ERROR_CODE_PREFIX, RESUME_CONTEXT_UNAVAILABLE, RESUME_ENV_FAILED, RESUME_PLACEMENT_MISMATCH, RESUME_POLICY_FOLD_CODE, RESUME_PREFLIGHT_REJECTED, RESUME_REOPEN_CODES, RESUME_RETRY_LATER_CODES, RESUME_TOOL_CONTRACT_MISMATCH, RESUME_TOOL_UNAVAILABLE, RESUME_USAGE_WINDOW_EXHAUSTED, REWIND_ERROR_CODE_PREFIXES, SCENARIO_NOT_ALLOWED_ERROR_CODE, STATUS_DERIVED_COARSE_CODES, STOP_CONFLICT_CODES, STREAM_MAX_DURATION, TOOL_END_INTERRUPTED_NEVER_STARTED, TOOL_END_INTERRUPTED_OUTCOME_UNKNOWN, USAGE_WINDOW_EXHAUSTED, WORKFLOW_PARK_REFUSAL_CODES, } from './engineErrorCodes.js';
|
|
69
69
|
export * from './agentsWireCaps.js';
|
|
70
70
|
export * from './attachmentsWireCaps.js';
|
|
71
71
|
export * from './clientContextWireCaps.js';
|
|
@@ -81,6 +81,7 @@ export * from './oneShotWireCaps.js';
|
|
|
81
81
|
export * from './rewindWireCaps.js';
|
|
82
82
|
export * from './rewindArchiveCapability.js';
|
|
83
83
|
export * from './fileHistoryCaptureCapability.js';
|
|
84
|
+
export * from './sealedKeyCapability.js';
|
|
84
85
|
export * from './registryQuotaUsage.js';
|
|
85
86
|
export * from './selfOrchestrationWireCaps.js';
|
|
86
87
|
export * from './skillsWireCaps.js';
|
|
@@ -128,6 +129,8 @@ export * from './engineSessionParam.js';
|
|
|
128
129
|
export { engineWireTarget, engineWireTargetFor, installEngineWireTarget, installEngineWireTargetFor, } from './engineWireTarget.js';
|
|
129
130
|
export * from './principalWire.js';
|
|
130
131
|
export * from './wireErrorTriage.js';
|
|
132
|
+
export * from './corruptSession.js';
|
|
133
|
+
export * from './corruptSessionCopy.js';
|
|
131
134
|
export * from './resumeRefusalCopy.js';
|
|
132
135
|
export * from './wireRefusalCopy.js';
|
|
133
136
|
export * from './decideReceipt.js';
|
|
@@ -152,7 +155,7 @@ export * from './coreValuePorts.js';
|
|
|
152
155
|
export * from './hitl/askGateWire.js';
|
|
153
156
|
export * from './hitl/planReviewWire.js';
|
|
154
157
|
export { PLAN_REVIEW_QUESTION_ID_PREFIX, REOPEN_ID_TAIL, approvalCallKey, askGateQuestionId, planReviewQuestionId, liveFrameCallKey, armedKeyFromQuestionId, } from './hitl/gateIdentity.js';
|
|
155
|
-
export { _resetArmedGateRegistryForTest, _setGateArmedWaitMsForTest, clearArmedGate, gateArmedWaitMs, notePlanReviewAnswered, onGateArmed, planReviewArmedKey, registerArmedGate, registerArmedGateFor, registerArmedGateFromQuestionId, waitForGateArmed, wasGateArmed, wasGateArmedFor, } from './hitl/armedGateRegistry.js';
|
|
158
|
+
export { _resetArmedGateRegistryForTest, _setGateArmedWaitMsForTest, clearArmedGate, gateArmedWaitMs, notePlanReviewAnswered, onGateArmed, planReviewArmedKey, registerArmedGate, registerArmedGateFor, registerArmedGateFromQuestionId, registerArmedGateFromQuestionIdFor, waitForGateArmed, wasGateArmed, wasGateArmedFor, } from './hitl/armedGateRegistry.js';
|
|
156
159
|
export * from './hitl/parkOwnership.js';
|
|
157
160
|
export * from './hitl/parkRowBirthWait.js';
|
|
158
161
|
export * from './hitl/approvalDecisionNoteAudit.js';
|
|
@@ -173,6 +176,7 @@ export * from './seatContract.js';
|
|
|
173
176
|
export * from './agentSession/contract.js';
|
|
174
177
|
export * from './agentSession/backgroundView.js';
|
|
175
178
|
export { readEngineAgentRegistry, isEngineAgentRegistryListingSuperseded } from './agentSession/engineAgentRegistryRead.js';
|
|
179
|
+
export { stopEngineSessionBackground, engineSessionBackgroundReceiptReadingOf, ENGINE_SESSION_BACKGROUND_RECEIPT_STATES, } from './agentSession/engineSessionBackgroundStop.js';
|
|
176
180
|
export * from './model/catalog.js';
|
|
177
181
|
export * from './model/catalogLoader.js';
|
|
178
182
|
export * from './model/providerAuth.js';
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
import { type TaskRequestPermissionMode } from './taskRequestWords.js';
|
|
2
|
+
export type PermissionMode = TaskRequestPermissionMode;
|
|
2
3
|
export interface PermissionModeField {
|
|
3
4
|
permissionMode?: PermissionMode;
|
|
4
5
|
}
|
|
@@ -1,10 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
'plan',
|
|
4
|
-
'acceptEdits',
|
|
5
|
-
'bypassPermissions',
|
|
6
|
-
'auto',
|
|
7
|
-
]);
|
|
1
|
+
import { PERMISSION_MODE_WORDS } from './taskRequestWords.js';
|
|
2
|
+
const KNOWN = new Set(PERMISSION_MODE_WORDS);
|
|
8
3
|
export function permissionModeField(mode, opts) {
|
|
9
4
|
if (typeof mode === 'string' && mode !== 'default' && KNOWN.has(mode)) {
|
|
10
5
|
return { permissionMode: mode };
|
|
@@ -49,6 +49,7 @@ export interface TaskRequestInput {
|
|
|
49
49
|
memoryCapture?: 'off';
|
|
50
50
|
memory?: 'off';
|
|
51
51
|
approverPosture?: NonNullable<TaskRequest['approverPosture']>;
|
|
52
|
+
fileHistory?: 'disabled';
|
|
52
53
|
rewind?: Record<string, unknown>;
|
|
53
54
|
repo?: string;
|
|
54
55
|
council?: boolean;
|
|
@@ -70,6 +71,8 @@ export interface TaskRequestOmission {
|
|
|
70
71
|
readonly cause: TaskRequestOmissionCause;
|
|
71
72
|
}
|
|
72
73
|
export declare function taskRequestOmissionCauseDetail(cause: unknown): string;
|
|
74
|
+
export declare const TASK_REQUEST_OMISSION_CAUSE_NOTICES: Readonly<Record<TaskRequestOmissionCause, string>>;
|
|
75
|
+
export declare function taskRequestOmissionCauseNotice(cause: unknown): string;
|
|
73
76
|
export interface TaskRequestAssembly {
|
|
74
77
|
readonly request: TaskRequestLike;
|
|
75
78
|
readonly omitted: readonly TaskRequestOmission[];
|
|
@@ -102,6 +105,7 @@ export declare const APPROVER_POSTURE_BYPASS: "bypass";
|
|
|
102
105
|
export declare function approverPostureDeclarationField(declared: boolean): {
|
|
103
106
|
approverPosture: 'bypass';
|
|
104
107
|
} | Record<string, never>;
|
|
108
|
+
export declare const FILE_HISTORY_DISABLED: "disabled";
|
|
105
109
|
export declare function memoryOffDeclared(input: {
|
|
106
110
|
flag?: unknown;
|
|
107
111
|
settingsMemory?: unknown;
|
|
@@ -23,6 +23,7 @@ export const REQUEST_FIELD_MATRIX = [
|
|
|
23
23
|
{ field: 'memoryCapture', lanes: ['interactive', 'print', 'utility'], live: true, why: '本会话永远不进长期记忆的**声明形**(server §12.4 body 键,单成员闭集 "off");每条车道都是提交面 ⇒ 都能声明。与 memoryWrite:false 不是一个轴(那是「本 run 只读平面」)。⚠️ parked 续跑腿结构性拿不到声明(决策/续跑端点从持久 body 重建 spec),那是引擎侧事实,不是本层的漏', whyUtilityLane: '有座:side-channel 提交是壳自己的一次性问答,**绝不该**进用户的长期记忆 —— 这一位正是那句声明,且它是收紧方向,带上去只会更严' },
|
|
24
24
|
{ field: 'memory', lanes: ['interactive', 'print', 'utility'], live: true, why: '这一次运行不挂记忆面的**请求级**开关(server §12.7 body 键,单成员闭集 "off");每条车道都是提交面 ⇒ 都能声明。与 memoryCapture(采集面)不是一个轴、可并存;与 memoryWrite:false(只读平面)也不是一个轴', whyUtilityLane: '有座:side-channel 提交不需要挂记忆面(不挂记忆段 / 索引 / 三只记忆工具),省 token 且零记忆写入;与 memoryCapture 不是一个轴,两条都带' },
|
|
25
25
|
{ field: 'approverPosture', lanes: ['interactive', 'print'], live: true, why: '宿主对这个 run 的**审批姿态声明**(「这个 run 的审批卡由我自己自动答」;单成员闭集 `"bypass"`)。🔴 它不授权任何东西、也不是一只门:引擎只把这句声明**渲**给模型(它自己的标记块,首个回合),没有任何裁决腿读它 —— 与 `permissionMode` 的 `bypassPermissions`(选门的形状)**不是一回事**,两键在请求体上各自原样过境、**互不派生**:宿主完全可以一边留着缺省权限模式、一边自己自动答这个 run 的审批卡。🔴 **声明它的唯一条件是「宿主确实自己自动答这个 run 的审批卡」,不许据此推导或改动 `permissionMode`** —— 拿这一位当理由去把门放宽,是把一句只渲给模型看的话读成了授权。宿主并不自动答卡却声明了它 ⇒ 那是对模型说了一句与实际不符的话,修法是**别声明**,不是去动门。加座的理由是**一个事实一处铸点**:同样一句话,要么由引擎在它自己的标记块里说,要么由壳把提醒形文本拼进本 turn 的输入 —— 后者在模型眼里是一段**没有引擎标记**的提醒形副本,按标记声明它该当**数据**处理并报出来。所以壳从此停拼,交这一位。两条用户车道都是提交面 ⇒ 都能声明。坏词由引擎响亮拒(单成员闭集,打错字不许被折成缺席),本层同律在构造期就拒(见 `refuseBadApproverPosture`)。⚠️ 上游的**提交体**与**引擎规格**两层都真读这一键,而装着的 sdk 型面尚未镜像它 ⇒ 本层的字面按提交体的形声明,不从 sdk 取型', whyUtilityLane: '无座:审批姿态是**用户**对他自己那条会话的声明,而 side-channel 是壳自己的提交 —— 把用户的 bypass 姿态带进一条他没参与的提交,等于替他重申一句他没说过的话;况且零工具面根本产不出审批卡' },
|
|
26
|
+
{ field: 'fileHistory', lanes: ['interactive', 'print'], live: true, why: '「这一次运行别捕获文件历史」的**请求级声明**(server 7.104.0 提交体键,单成员闭集 "disabled";`POST /v1/tasks` · `/v1/tasks/stream` · `/v1/runs` 同收,子代继承)。两条用户车道都是提交面、都跑在用户的文件上 ⇒ 都能声明;「本会话不捕获」= 每个提交都带(续跑腿重放同一个体)。🔴 只在能力读数 `on-optional` 时发(老 server 对表外键 400),值由片段口 `fileHistoryDeclarationField` 唯一铸出。与 rewind 还原键同交 ⇒ 上游 400 `request.field_conflict`', whyUtilityLane: '无座:side-channel 强制零工具面(`excludeAllTools`),不会改任何文件 ⇒ 没有可捕获的东西;带上它只会在不认识这一键的老 server 上给这条提交多一种 400' },
|
|
26
27
|
{ field: 'finalVerification', lanes: ['print'], live: true, why: 'P1-1 终验:无人值守车道才需要引擎自证;交互 REPL 由人当场看结果。#106 裁 B(让位+告知)后交互面默认关', whyUtilityLane: '无座:终验让引擎再跑一轮自证,而 side-channel 要的是一次小提交的即时答案;「无人值守才需要引擎自证」这条理由在本车道上让位给「小预算优先」' },
|
|
27
28
|
{ field: 'limits', lanes: ['print', 'utility'], live: true, why: 'P2-3-b:`-p` 的预算护栏(--max-* flag 族),交互 REPL 由人随时 Esc', whyUtilityLane: '有座:side-channel 必须带预算护栏(墙钟 / 输出 token / 轮数)—— 它同样没有人看着,而且没有后续回合可以中断' },
|
|
28
29
|
{ field: 'interactiveTools', lanes: ['print', 'utility'], live: true, why: '[909]B 件3:无人值守 stamp false,从 roster 源头灭掉 AskUserQuestion/plan 门。交互车道 stamp false 等于自废武功', whyUtilityLane: '有座:side-channel 绝不该弹交互问答 / plan 门(没有人在看这条提交)。它与 excludeAllTools 是**两条独立**的收紧声明、在这条车道上**并存**(本车道强制带卸载声明,见 `refuseUtilityWithoutToolUnload`;这一位是它旁边那条「连问都别问」的声明,不是它的降级替身)' },
|
|
@@ -74,6 +75,18 @@ export function taskRequestOmissionCauseDetail(cause) {
|
|
|
74
75
|
const word = typeof cause === 'string' && cause.length > 0 ? cause : '(none)';
|
|
75
76
|
return `a cause this build does not know (${word}) — this build does not know this cause: receipt causes come from this build's own frozen vocabulary, so a word outside it was not produced here; check whatever supplied it`;
|
|
76
77
|
}
|
|
78
|
+
export const TASK_REQUEST_OMISSION_CAUSE_NOTICES = Object.freeze({
|
|
79
|
+
upstream_absent: 'Not sent with this request: this version has no way to send this setting in any request, so giving it or leaving it out makes no difference to what is sent.',
|
|
80
|
+
other_channel: 'Not sent from here: that part of the request belongs to a separate step, so what goes out for it, if anything, is decided there rather than by the value given here.',
|
|
81
|
+
off_lane: 'Not sent with this request: this kind of request does not carry this setting, so giving it or leaving it out makes no difference to what this request sends.',
|
|
82
|
+
not_live: 'Not sent with this request: the request was marked as not going to a live engine (for example an offline or test run), and this setting is only sent on requests that go to one.',
|
|
83
|
+
});
|
|
84
|
+
const TASK_REQUEST_OMISSION_UNKNOWN_CAUSE_NOTICE = 'Not sent with this request, for a reason this version does not recognize.';
|
|
85
|
+
export function taskRequestOmissionCauseNotice(cause) {
|
|
86
|
+
return typeof cause === 'string' && Object.hasOwn(TASK_REQUEST_OMISSION_CAUSE_NOTICES, cause)
|
|
87
|
+
? TASK_REQUEST_OMISSION_CAUSE_NOTICES[cause]
|
|
88
|
+
: TASK_REQUEST_OMISSION_UNKNOWN_CAUSE_NOTICE;
|
|
89
|
+
}
|
|
77
90
|
const row = (field) => ({ via: 'matrix', field });
|
|
78
91
|
const INPUT_KEY_ROUTES = {
|
|
79
92
|
objective: { via: 'always' },
|
|
@@ -125,6 +138,7 @@ const INPUT_KEY_ROUTES = {
|
|
|
125
138
|
memoryCapture: row('memoryCapture'),
|
|
126
139
|
memory: row('memory'),
|
|
127
140
|
approverPosture: row('approverPosture'),
|
|
141
|
+
fileHistory: row('fileHistory'),
|
|
128
142
|
rewind: row('resumeAt/resumeAtMode/restoreFiles/rewindFilesTo'),
|
|
129
143
|
repo: row('repo'),
|
|
130
144
|
council: row('council'),
|
|
@@ -197,6 +211,7 @@ const VALUE_LEVEL_IN_PLAY = Object.freeze({
|
|
|
197
211
|
memoryCapture: (v) => v === 'off',
|
|
198
212
|
memory: (v) => v === 'off',
|
|
199
213
|
approverPosture: (v) => v === APPROVER_POSTURE_BYPASS,
|
|
214
|
+
fileHistory: (v) => v === FILE_HISTORY_DISABLED,
|
|
200
215
|
rewind: (v) => typeof v === 'object' && v !== null && rewindSubKeys().some((k) => hasOwn(v, k) && present(v[k])),
|
|
201
216
|
});
|
|
202
217
|
const inPlay = (key, v) => present(v) && (VALUE_LEVEL_IN_PLAY[key]?.(v) ?? true);
|
|
@@ -377,6 +392,7 @@ void true;
|
|
|
377
392
|
export function approverPostureDeclarationField(declared) {
|
|
378
393
|
return declared ? { approverPosture: APPROVER_POSTURE_BYPASS } : {};
|
|
379
394
|
}
|
|
395
|
+
export const FILE_HISTORY_DISABLED = 'disabled';
|
|
380
396
|
export function memoryOffDeclared(input) {
|
|
381
397
|
if (typeof input !== 'object' || input === null)
|
|
382
398
|
return false;
|
|
@@ -426,6 +442,15 @@ const refuseBadApproverPosture = (v) => {
|
|
|
426
442
|
'**响亮拒**,刻意不把打错的词折回缺席。本层若静默删键,这一次提交的模型不会被告知姿态,而声明人不会知道。' +
|
|
427
443
|
'错误文本只报形状,不回显值。');
|
|
428
444
|
};
|
|
445
|
+
const refuseBadFileHistory = (v) => {
|
|
446
|
+
if (v === undefined || v === null)
|
|
447
|
+
return;
|
|
448
|
+
if (v === FILE_HISTORY_DISABLED)
|
|
449
|
+
return;
|
|
450
|
+
throw new TypeError('buildTaskRequest: fileHistory 只接受字面量 `\'disabled\'` 或缺席(undefined/null)—— ' +
|
|
451
|
+
`收到 ${coarseShape(v)}。这一位是「这一次运行别捕获文件历史」的收紧声明,上游是**单成员闭集**(没有第二个词)且对坏值` +
|
|
452
|
+
'**响亮拒**。本层若静默删键,这一次运行照常捕获而声明人不会知道。错误文本只报形状,不回显值。');
|
|
453
|
+
};
|
|
429
454
|
const refuseBadMaxTokens = (v) => {
|
|
430
455
|
if (v === undefined || v === null)
|
|
431
456
|
return;
|
|
@@ -495,7 +520,7 @@ export function parseMaxCostUsd(text) {
|
|
|
495
520
|
return { ok: false, why: 'not_positive' };
|
|
496
521
|
return { ok: true, value };
|
|
497
522
|
}
|
|
498
|
-
const ACCESSOR_READ_ORDER = ['live', 'memoryCapture', 'memory', 'settings', 'maxCostUsd', 'excludeAllTools', 'approverPosture', 'maxTokens', 'outputRetries'];
|
|
523
|
+
const ACCESSOR_READ_ORDER = ['live', 'memoryCapture', 'memory', 'settings', 'maxCostUsd', 'excludeAllTools', 'approverPosture', 'maxTokens', 'outputRetries', 'fileHistory'];
|
|
499
524
|
function dataFirstSnapshot(input, afterData) {
|
|
500
525
|
let descs;
|
|
501
526
|
try {
|
|
@@ -563,6 +588,7 @@ export function assembleTaskRequest(input, lane) {
|
|
|
563
588
|
const approverPostureIn = src.approverPosture;
|
|
564
589
|
const maxTokensIn = src.maxTokens;
|
|
565
590
|
const outputRetriesIn = src.outputRetries;
|
|
591
|
+
const fileHistoryIn = src.fileHistory;
|
|
566
592
|
const INPUT_KEYS = Object.keys(INPUT_KEY_ROUTES);
|
|
567
593
|
const i = snapshotByName(src, INPUT_KEYS, {
|
|
568
594
|
live,
|
|
@@ -573,6 +599,7 @@ export function assembleTaskRequest(input, lane) {
|
|
|
573
599
|
excludeAllTools: excludeAllToolsIn,
|
|
574
600
|
approverPosture: approverPostureIn,
|
|
575
601
|
outputRetries: outputRetriesIn,
|
|
602
|
+
fileHistory: fileHistoryIn,
|
|
576
603
|
settings: settingsIn,
|
|
577
604
|
});
|
|
578
605
|
const SETTINGS_KEYS = Object.keys(SETTINGS_KEY_ROUTES);
|
|
@@ -584,6 +611,7 @@ export function assembleTaskRequest(input, lane) {
|
|
|
584
611
|
refuseBadApproverPosture(approverPostureIn);
|
|
585
612
|
refuseBadMaxTokens(maxTokensIn);
|
|
586
613
|
refuseBadOutputRetries(outputRetriesIn);
|
|
614
|
+
refuseBadFileHistory(fileHistoryIn);
|
|
587
615
|
const rewindRoute = INPUT_KEY_ROUTES.rewind;
|
|
588
616
|
const RETIRED_REWIND_FILES_KEY = 'rewindFiles';
|
|
589
617
|
const REWIND_KEYS = rewindRoute.via === 'matrix' ? rewindRoute.field.split('/') : [];
|
|
@@ -733,6 +761,7 @@ export function assembleTaskRequest(input, lane) {
|
|
|
733
761
|
...(on('memoryCapture') ? { memoryCapture: 'off' } : {}),
|
|
734
762
|
...(on('memory') ? { memory: 'off' } : {}),
|
|
735
763
|
...(on('approverPosture') ? { approverPosture: APPROVER_POSTURE_BYPASS } : {}),
|
|
764
|
+
...(on('fileHistory') ? { fileHistory: FILE_HISTORY_DISABLED } : {}),
|
|
736
765
|
...(Object.keys(settingsOut).length > 0 ? { settings: settingsOut } : {}),
|
|
737
766
|
};
|
|
738
767
|
return Object.freeze({ request: out, omitted: Object.freeze([...omitted, ...lateOmitted]) });
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { readErrorNumber, readErrorString } from './wireFailureShape.js';
|
|
2
|
-
import { RESUME_CONTEXT_UNAVAILABLE, RESUME_PLACEMENT_MISMATCH, RESUME_PREFLIGHT_REJECTED, RESUME_REOPEN_CODES, RESUME_ENV_FAILED, RESUME_TOOL_UNAVAILABLE, RESUME_POLICY_FOLD_CODE, PARKED_RESUME_STARTUP_FAILED, } from './engineErrorCodes.js';
|
|
2
|
+
import { RESUME_CONTEXT_UNAVAILABLE, RESUME_PLACEMENT_MISMATCH, RESUME_PREFLIGHT_REJECTED, RESUME_REOPEN_CODES, RESUME_ENV_FAILED, RESUME_TOOL_UNAVAILABLE, RESUME_POLICY_FOLD_CODE, PARKED_RESUME_STARTUP_FAILED, isStatusDerivedCoarseCode, } from './engineErrorCodes.js';
|
|
3
3
|
import { capForDisplay } from './fleetTaskDesc.js';
|
|
4
4
|
import { resumeRetryLaterFromError } from './wireErrorTriage.js';
|
|
5
5
|
export const RESUME_REFUSAL_CODES = Object.freeze([
|
|
@@ -73,7 +73,9 @@ export function resumePolicyBlockFromError(err) {
|
|
|
73
73
|
export function resumePolicyBlockContent(detail) {
|
|
74
74
|
const b = detail.blockedBy;
|
|
75
75
|
const reason = b.kind === 'named'
|
|
76
|
-
?
|
|
76
|
+
? isStatusDerivedCoarseCode(b.code)
|
|
77
|
+
? `The refusal did not name a more specific check (it carried only the generic code for its HTTP status: ${b.code})`
|
|
78
|
+
: `The check that refused it: ${capForDisplay(b.code, 80)}`
|
|
77
79
|
: b.kind === 'absent'
|
|
78
80
|
? 'The refusal did not name a more specific check'
|
|
79
81
|
: 'The refusal carried a more specific reason that could not be read';
|
package/dist/runTerminal.js
CHANGED
|
@@ -32,6 +32,10 @@ export function readRunTerminal(result) {
|
|
|
32
32
|
const kind = str(c.kind);
|
|
33
33
|
if (kind === undefined)
|
|
34
34
|
return { kind: 'unknown', plane: 'cause' };
|
|
35
|
+
const parkWord = str(r.status);
|
|
36
|
+
if (parkWord !== undefined && FLAT_PAUSED_STATUSES.includes(parkWord)) {
|
|
37
|
+
return { kind: 'paused', plane: 'cause', flatStatus: parkWord, ...(kind === 'paused' ? (pauseOf(c) ?? {}) : {}) };
|
|
38
|
+
}
|
|
35
39
|
switch (kind) {
|
|
36
40
|
case 'completed':
|
|
37
41
|
return { kind: 'completed', plane: 'cause' };
|
package/dist/sandboxWire.js
CHANGED
|
@@ -55,7 +55,7 @@ export function sandboxDegradeHint(err) {
|
|
|
55
55
|
'Re-run without --sandbox (worker default image), or point the shell at a k8s-lane worker (sema cloud engine connect <url>).');
|
|
56
56
|
}
|
|
57
57
|
if (e.status === 400 && msg.includes(SANDBOX_NO_IMAGE_INDEX_400_ANCHOR)) {
|
|
58
|
-
return ('This worker has no sandbox image index configured (sema-
|
|
58
|
+
return ('This worker has no sandbox image index configured (the sema-web-admin config center is not attached), so per-task profiles cannot resolve.\n' +
|
|
59
59
|
'Re-run without --sandbox, or use a worker with the image index enabled.');
|
|
60
60
|
}
|
|
61
61
|
if (e.status === 404 && msg.includes(SANDBOX_NO_PUBLISHED_IMAGE_404_ANCHOR)) {
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export type SealedKeyReading = {
|
|
2
|
+
kind: 'unobserved';
|
|
3
|
+
} | {
|
|
4
|
+
kind: 'not_reported';
|
|
5
|
+
} | {
|
|
6
|
+
kind: 'present';
|
|
7
|
+
alg: string;
|
|
8
|
+
publicKeyId: string;
|
|
9
|
+
publicKey: string;
|
|
10
|
+
};
|
|
11
|
+
export declare function projectSealedKeyCapability(caps: unknown): SealedKeyReading | undefined;
|
|
12
|
+
export declare function noteEngineCapsForSealedKey(baseUrl: string, caps: unknown, opts?: {
|
|
13
|
+
generation?: number;
|
|
14
|
+
}): void;
|
|
15
|
+
export declare function observedSealedKey(baseUrl?: string | undefined): SealedKeyReading;
|
|
16
|
+
export declare function forgetSealedKeyReading(baseUrl: string | undefined): void;
|
|
17
|
+
export declare function __resetSealedKeyReadingsForTests(): void;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { engineWireTarget } from './engineWireTarget.js';
|
|
2
|
+
import { createEngineCapReader } from './engineCapReader.js';
|
|
3
|
+
function ownNonEmpty(seg, key) {
|
|
4
|
+
if (!Object.hasOwn(seg, key))
|
|
5
|
+
return undefined;
|
|
6
|
+
const v = seg[key];
|
|
7
|
+
return typeof v === 'string' && v.length > 0 ? v : undefined;
|
|
8
|
+
}
|
|
9
|
+
export function projectSealedKeyCapability(caps) {
|
|
10
|
+
if (caps === null || typeof caps !== 'object' || Array.isArray(caps))
|
|
11
|
+
return undefined;
|
|
12
|
+
if (!Object.hasOwn(caps, 'sealedKey'))
|
|
13
|
+
return { kind: 'not_reported' };
|
|
14
|
+
const seg = caps.sealedKey;
|
|
15
|
+
if (seg === undefined)
|
|
16
|
+
return { kind: 'not_reported' };
|
|
17
|
+
if (seg === null || typeof seg !== 'object' || Array.isArray(seg))
|
|
18
|
+
return undefined;
|
|
19
|
+
const alg = ownNonEmpty(seg, 'alg');
|
|
20
|
+
const publicKeyId = ownNonEmpty(seg, 'publicKeyId');
|
|
21
|
+
const publicKey = ownNonEmpty(seg, 'publicKey');
|
|
22
|
+
if (alg === undefined || publicKeyId === undefined || publicKey === undefined)
|
|
23
|
+
return undefined;
|
|
24
|
+
return { kind: 'present', alg, publicKeyId, publicKey };
|
|
25
|
+
}
|
|
26
|
+
const reader = createEngineCapReader({
|
|
27
|
+
name: 'sealedKey',
|
|
28
|
+
project: projectSealedKeyCapability,
|
|
29
|
+
makeUnobserved: () => ({ kind: 'unobserved' }),
|
|
30
|
+
});
|
|
31
|
+
export function noteEngineCapsForSealedKey(baseUrl, caps, opts) {
|
|
32
|
+
reader.note(baseUrl, caps, opts);
|
|
33
|
+
}
|
|
34
|
+
export function observedSealedKey(baseUrl = engineWireTarget()?.baseUrl) {
|
|
35
|
+
return reader.observed(baseUrl);
|
|
36
|
+
}
|
|
37
|
+
export function forgetSealedKeyReading(baseUrl) {
|
|
38
|
+
reader.forget(baseUrl);
|
|
39
|
+
}
|
|
40
|
+
export function __resetSealedKeyReadingsForTests() {
|
|
41
|
+
reader.__resetForTests();
|
|
42
|
+
}
|
package/dist/seatContract.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { ReasoningEffort } from "./effortWire.js";
|
|
2
|
+
import type { PermissionMode } from "./permissionWireCaps.js";
|
|
2
3
|
import type { LaneProof } from "./seam.js";
|
|
3
4
|
import type { QuestionAnswer } from "./liveQuestionStore.js";
|
|
4
5
|
import type { ToolApprovalDelegation } from "./hitl/toolApprovalWire.js";
|
|
@@ -101,7 +102,7 @@ export interface StartSessionOptions {
|
|
|
101
102
|
cwd?: string;
|
|
102
103
|
excludeTools?: string[];
|
|
103
104
|
}
|
|
104
|
-
export type PermissionModeIntent =
|
|
105
|
+
export type PermissionModeIntent = PermissionMode;
|
|
105
106
|
export declare const PERMISSION_MODE_INTENTS: readonly PermissionModeIntent[];
|
|
106
107
|
export declare const ATTACHMENT_IDS_PER_TASK_CAP = 16;
|
|
107
108
|
export declare const SEAT_REASONING_EFFORTS: readonly ReasoningEffort[];
|
package/dist/seatContract.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { PERMISSION_MODE_WORDS, REASONING_EFFORT_WORDS } from "./taskRequestWords.js";
|
|
1
2
|
const bad = (reason, field) => field === undefined ? { reason } : { reason, field };
|
|
2
3
|
const nested = (prefix, verdict) => {
|
|
3
4
|
const path = verdict.field === undefined
|
|
@@ -71,25 +72,9 @@ export const HITL_RESOLUTION_OUTCOMES = [
|
|
|
71
72
|
"decline",
|
|
72
73
|
"cancel",
|
|
73
74
|
];
|
|
74
|
-
const
|
|
75
|
-
"default",
|
|
76
|
-
"plan",
|
|
77
|
-
"acceptEdits",
|
|
78
|
-
"bypassPermissions",
|
|
79
|
-
"auto",
|
|
80
|
-
];
|
|
81
|
-
export const PERMISSION_MODE_INTENTS = PERMISSION_MODE_INTENT_TUPLE;
|
|
75
|
+
export const PERMISSION_MODE_INTENTS = [...PERMISSION_MODE_WORDS];
|
|
82
76
|
export const ATTACHMENT_IDS_PER_TASK_CAP = 16;
|
|
83
|
-
const
|
|
84
|
-
"off",
|
|
85
|
-
"minimal",
|
|
86
|
-
"low",
|
|
87
|
-
"medium",
|
|
88
|
-
"high",
|
|
89
|
-
"xhigh",
|
|
90
|
-
"max",
|
|
91
|
-
];
|
|
92
|
-
export const SEAT_REASONING_EFFORTS = SEAT_REASONING_EFFORT_TUPLE;
|
|
77
|
+
export const SEAT_REASONING_EFFORTS = [...REASONING_EFFORT_WORDS];
|
|
93
78
|
export const SEAT_TURN_SETTINGS_KEYS = ["ultracode"];
|
|
94
79
|
export const ATTACHMENT_UPLOAD_REQUEST_KEYS = ["name", "mimeType", "bytes"];
|
|
95
80
|
export const SESSION_SEARCH_RESULT_KEYS = ["sessionId", "title", "matches"];
|
|
@@ -224,8 +209,8 @@ const checkLocalSessionEvent = (v) => {
|
|
|
224
209
|
}
|
|
225
210
|
if (!isAbsent(v.permissionMode)) {
|
|
226
211
|
const mode = v.permissionMode;
|
|
227
|
-
if (typeof mode !== "string" || !inTuple(
|
|
228
|
-
return bad(`permissionMode must be one of ${
|
|
212
|
+
if (typeof mode !== "string" || !inTuple(PERMISSION_MODE_INTENTS, mode)) {
|
|
213
|
+
return bad(`permissionMode must be one of ${PERMISSION_MODE_INTENTS.join("|")}`, "permissionMode");
|
|
229
214
|
}
|
|
230
215
|
}
|
|
231
216
|
if (!isAbsent(v.session)) {
|
|
@@ -718,7 +703,6 @@ const _seatContractPins = [
|
|
|
718
703
|
true, true,
|
|
719
704
|
true, true,
|
|
720
705
|
true, true, true, true,
|
|
721
|
-
true, true, true, true,
|
|
722
706
|
true, true,
|
|
723
707
|
true, true,
|
|
724
708
|
true, true,
|
|
@@ -1,5 +1,16 @@
|
|
|
1
|
+
import type { AgentClient } from '@sema-agent/sdk';
|
|
2
|
+
import type { EngineWireInjection } from '../engineWireSdk.js';
|
|
3
|
+
export type EngineCompactWireClient = {
|
|
4
|
+
capabilities: AgentClient['capabilities'];
|
|
5
|
+
runs: Pick<AgentClient['runs'], 'compact'>;
|
|
6
|
+
};
|
|
7
|
+
export type EngineCompactWire = EngineWireInjection<EngineCompactWireClient>;
|
|
1
8
|
export declare function isEngineCompactPending(sessionKey?: string): boolean;
|
|
2
9
|
export declare function resetManualCompactCapability(): void;
|
|
3
10
|
export declare function __resetEngineCompactArmForTests(): void;
|
|
4
|
-
export declare function requestEngineCompact(sessionKey?: string
|
|
5
|
-
|
|
11
|
+
export declare function requestEngineCompact(sessionKey?: string, opts?: {
|
|
12
|
+
wire?: EngineCompactWire;
|
|
13
|
+
}): 'fired' | 'armed' | 'offline' | 'unsupported';
|
|
14
|
+
export declare function onEngineTaskBound(taskId: string, sessionKey?: string, opts?: {
|
|
15
|
+
wire?: EngineCompactWire;
|
|
16
|
+
}): void;
|