@zhushanwen/subagent-core 0.7.1 → 0.8.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/dist/{chunk-VURUAGMM.js → chunk-OL5BK4VN.js} +237 -40
- package/dist/{engine-discovery-scan-ocpM8FmI.d.cts → engine-discovery-scan-BXLA8y-z.d.cts} +17 -1
- package/dist/{engine-discovery-scan-ocpM8FmI.d.ts → engine-discovery-scan-BXLA8y-z.d.ts} +17 -1
- package/dist/execution/engine/engine-discovery-scan.cjs +150 -40
- package/dist/execution/engine/engine-discovery-scan.d.cts +1 -1
- package/dist/execution/engine/engine-discovery-scan.d.ts +1 -1
- package/dist/execution/engine/engine-discovery-scan.js +1 -1
- package/dist/index.cjs +278 -225
- package/dist/index.d.cts +24 -4
- package/dist/index.d.ts +24 -4
- package/dist/index.js +188 -304
- package/dist.bundle/index.cjs +279 -226
- package/package.json +3 -3
- package/src/__tests__/record-store-last-line.test.ts +12 -0
- package/src/core/logger.ts +1 -1
- package/src/execution/__tests__/inflight-production-wiring.test.ts +223 -0
- package/src/execution/__tests__/nested-visibility.test.ts +13 -1
- package/src/execution/engine/__tests__/conformance/registry-fork-filter.test.ts +55 -53
- package/src/execution/engine/__tests__/inflight-snapshot.test.ts +180 -0
- package/src/execution/engine/client/engine-client.ts +30 -1
- package/src/execution/engine/host/host-bridge.ts +7 -0
- package/src/execution/engine/host/spawned-children.ts +1 -1
- package/src/execution/engine/inflight-snapshot.ts +92 -0
- package/src/execution/engine/port.ts +18 -0
- package/src/execution/path-encoding.ts +6 -0
- package/src/execution/subagent-service.ts +25 -0
- package/src/execution/worktree-registry.ts +11 -7
- package/src/index.ts +11 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { E as EnginePort, D as DiscoverEnginesOptions, a as ExecutionRecord, C as ClosedReason, b as ExecutionOutcome, A as AgentEventLogEntry, c as ExecutionStatus, P as ProjectedOutcome, R as RecordSnapshot, S as SubagentRecord, d as ExecuteOptions, e as SubagentStream, f as AgentResult, g as AgentResult$1, h as SubagentsGlobalConfig, M as ModelRegistryLike, i as ModelInfo, j as AgentConfig, k as ResolvedModel, l as StreamSink, m as ExecutionHandle, n as ExecutionMode, o as PatchResult, p as AgentCallOpts, q as ExecutionTraceNode, T as TracePatch, r as RunStatus, s as DoneReason, W as WorkerLogEntry, t as DisplayItem, u as CancelResponse, v as CloseResponse, F as ForkFromResponse, L as ListResponse, w as MessageResponse, B as BgResponse, x as ExternalState, y as SubagentListItem, z as DiscoveryRoot } from './engine-discovery-scan-
|
|
2
|
-
export { G as CLOSED_REASONS, H as CoreLogger, I as DEFAULT_AGENT_NAME, J as DEFAULT_DATA_ROOT, K as DEFAULT_ENGINE_ID, N as DirtyWorktreeError, O as EngineHandle, Q as EngineRunResult, U as ForkDepthExceededError, V as HostServices, X as LogLevel, Y as ResurrectDeniedError, Z as RunContext, _ as SLUG_MAX_LENGTH, $ as SubagentToolResult, a0 as configureCore, a1 as getHostServices, a2 as getLogger, a3 as normalizeEngineId } from './engine-discovery-scan-
|
|
1
|
+
import { E as EnginePort, D as DiscoverEnginesOptions, a as ExecutionRecord, C as ClosedReason, b as ExecutionOutcome, A as AgentEventLogEntry, c as ExecutionStatus, P as ProjectedOutcome, R as RecordSnapshot, S as SubagentRecord, d as ExecuteOptions, e as SubagentStream, f as AgentResult, g as AgentResult$1, h as SubagentsGlobalConfig, M as ModelRegistryLike, i as ModelInfo, j as AgentConfig, k as ResolvedModel, l as StreamSink, m as ExecutionHandle, n as ExecutionMode, o as PatchResult, p as AgentCallOpts, q as ExecutionTraceNode, T as TracePatch, r as RunStatus, s as DoneReason, W as WorkerLogEntry, t as DisplayItem, u as CancelResponse, v as CloseResponse, F as ForkFromResponse, L as ListResponse, w as MessageResponse, B as BgResponse, x as ExternalState, y as SubagentListItem, z as DiscoveryRoot } from './engine-discovery-scan-BXLA8y-z.cjs';
|
|
2
|
+
export { G as CLOSED_REASONS, H as CoreLogger, I as DEFAULT_AGENT_NAME, J as DEFAULT_DATA_ROOT, K as DEFAULT_ENGINE_ID, N as DirtyWorktreeError, O as EngineHandle, Q as EngineRunResult, U as ForkDepthExceededError, V as HostServices, X as LogLevel, Y as ResurrectDeniedError, Z as RunContext, _ as SLUG_MAX_LENGTH, $ as SubagentToolResult, a0 as configureCore, a1 as getHostServices, a2 as getLogger, a3 as normalizeEngineId } from './engine-discovery-scan-BXLA8y-z.cjs';
|
|
3
3
|
import { ProbeReport, SessionView, ToolCall, UiRequest, UiRequestHandler, UiResponse, AgentEvent, UiChannelRegistry, WorktreeHandle, AgentOutcomeUsage } from '@zhushanwen/subagent-engine-sdk';
|
|
4
4
|
export { AgentEvent, AgentOutcome, ChannelHandler, EngineCapabilities, EngineHandleData, InteractAction, InteractResult, ProbeReport, ReplayedTurn, SessionView, ToolCallEntry, UiChannelRegistry } from '@zhushanwen/subagent-engine-sdk';
|
|
5
5
|
import { Worker } from 'node:worker_threads';
|
|
@@ -249,6 +249,26 @@ declare function registerZcodeEngine(engineDataDir?: () => string): void;
|
|
|
249
249
|
*/
|
|
250
250
|
declare function createZcodeEngine(deps: D8CompatZcodeEngineDeps): EnginePort;
|
|
251
251
|
|
|
252
|
+
/** 在途快照(与 EnginePort.inFlightSnapshot? 返回形状一致——runtime 侧统一消费形状)。 */
|
|
253
|
+
interface InFlightSnapshot {
|
|
254
|
+
/** 当前非 idle 句柄数(绝对计数,非增量)。 */
|
|
255
|
+
inFlight: number;
|
|
256
|
+
}
|
|
257
|
+
/** 壳层注册的监听回调(同步、fire-and-forget;core 不 await 不重试)。 */
|
|
258
|
+
type InFlightListener = (snapshot: InFlightSnapshot) => void;
|
|
259
|
+
/** 壳层注册监听(extension factory 装配点调用;传 null 注销)。 */
|
|
260
|
+
declare function setInFlightListener(next: InFlightListener | null): void;
|
|
261
|
+
/**
|
|
262
|
+
* 当前在途快照(纯读,无副作用):遍历活句柄记账(spawnedChildren 的 recordId 键集),
|
|
263
|
+
* 按双谓词过滤——活句柄(child 存在且未 killed)且无 armed idle timer。
|
|
264
|
+
*
|
|
265
|
+
* SSOT 复用:谓词取 lifecycle-predicates/lifecycle-manager 既有导出,与 notify-host
|
|
266
|
+
* hasRunningBackground 完全同源,不复制判定逻辑。活句柄记账里天然覆盖 pi 引擎进程内
|
|
267
|
+
* 与 relay 形态 child 两种宿主(relay spawn 经同一 runSpawn/spawnedChildren 记账——
|
|
268
|
+
* D5「extension 是两形态派生的共同属主」)。
|
|
269
|
+
*/
|
|
270
|
+
declare function getInFlightSnapshot(): InFlightSnapshot;
|
|
271
|
+
|
|
252
272
|
/** maxTurns → spawn watchdog 毫秒估算(floor 语义:maxTurns 小时取下限)。 */
|
|
253
273
|
declare function maxTurnsToWatchdogMs(maxTurns: number): number;
|
|
254
274
|
|
|
@@ -5791,6 +5811,6 @@ declare function boundedPrettySerialize(value: unknown, budget: number): string;
|
|
|
5791
5811
|
* docs/design/subagent-core-sink-design.md(sink 下沉收口扩面,2026-08-31);
|
|
5792
5812
|
* 宿主接入示例见包 README(§3.4 core_host_not_configured 恢复指引的落点)。
|
|
5793
5813
|
*/
|
|
5794
|
-
declare const CORE_PACKAGE_VERSION = "0.
|
|
5814
|
+
declare const CORE_PACKAGE_VERSION = "0.8.0";
|
|
5795
5815
|
|
|
5796
|
-
export { AGENT_REF_EXT, AgentCall, AgentCallOpts, type AgentEntry, AgentEventLogEntry, type AgentProfile, AgentRegistry, AgentResult, type AgentRunner, type ArgKeySet, type ArgMetaOptions, type ArgMetaWarning, type AtomicTmpRef, type AtomicWriteFileOptions, type AtomicWriteOptions, BG_MESSAGE, BgResponse, Budget, CORE_PACKAGE_VERSION, type CachedWorkflowMeta, type CancelHandlerInput, type CancelHandlerResult, CancelResponse, type ChangeListener, type CleanupStaleTmpOptions, type CleanupStaleTmpResult, type CleanupWorktreeOptions, type CloseHandlerInput, type CloseHandlerResult, CloseResponse, ClosedReason, type CollectWorktreePatchOptions, type ConcurrencyPool, type CreateConcurrencyPoolOptions, type D8CompatZcodeEngineDeps, DEFAULT_LIST_LIMIT, DEFAULT_PROVIDER_ID, DEFAULT_SAVE_MIN_INTERVAL_MS, DEFAULT_STATE_MAX_RUNS, DEFAULT_WORKFLOW_SAVED_DIR, DEFAULT_WORKFLOW_TMP_DIR, DialogGlobalQueue, type DiscoveredResource, DiscoveryRoot, DisplayItem, DoneReason, EnginePort, type EngineRouteOptions, type EngineRouteResult, type EngineRouting, type EngineRoutingInput, type EngineRoutingSource, ExecutionMode, ExecutionOutcome, ExecutionRecord, ExecutionStatus, ExecutionTraceNode, ExternalState, FORK_FROM_DEFAULT_PROMPT, FileRunStore, type FinalizeRunOptions, type ForkFromHandlerInput, type ForkFromHandlerResult, ForkFromResponse, type GenerateWorkflowScriptOptions, type GenerateWorkflowScriptResult, GitRunError, type GlobalConfigReadResult, IDENTITY_CUSTOM_TYPE, INDEX_FILENAME, type InvalidAgentRefMessageOptions, type LauncherDeps, type LifecycleDeps, type LintFinding, type LintResult, type ListFormatOptions, type ListHandlerInput, type ListHandlerResult, ListResponse, type ListWorktreePorcelainOptions, MAX_LIST_LIMIT, MAX_RETAINED_DONE_RUNS, MAX_TIMER_DELAY_MS, type MessageHandlerInput, type MessageHandlerResult, MessageResponse, ModelConfigService, type ModelConfigServiceInit, type ModelEntry, ModelInfo, type ModelListFormatOptions, type ModelReasoningInfo, NOTIFY_CONTRACT, type NormalizeWorkflowRefOptions, type NormalizedArgs, type NormalizedWorkflowRef, type NotifyDomainPorts, type NotifyLedgerHost, type PatchBaselineAnchor, type PruneStateDeps, type QueuePolicy, RecordStore, type RecordStorePi, type RecoverCrashedRunsHooks, type RecoverCrashedRunsResult, type ResourceKind, type ResourceSource, type RunSnapshot, type RunSpec, type RunState, RunStatus, type RunStore, SAFE_ID_RE, SNAPSHOT_VERSION, SUBAGENT_RECORD_CUSTOM_TYPE, type ScanConfig, type StartHandlerInput, type StartHandlerResult, type StatusFilter, type SubagentIdentityData, SubagentListItem, SubagentRecord, type SubagentRecordEntryData, SubagentService, type SubagentServiceInit, SubagentStream, SubprocessAgentRunner, THINKING_ORDER, Trace, WORKFLOW_REF_EXT, WORKFLOW_REF_RESERVED_NAMES, type WorkerHandlers, type WorkerHost, WorkerHostImpl, WorkerLogEntry, type WorkflowDirOptions, type WorkflowEntry, type WorkflowMeta, type WorkflowRefInvalidReason, WorkflowRun, type WorkflowRunMeta, type WorkflowRunResult, type WorkflowRunSummary, type WorkflowScanConfig, WorkflowScript, type WorkflowScriptRegistry, WorkflowScriptRegistryImpl, type WorkflowSource, WorktreeManager, type WorktreePatchResult, ZCODE_FALLBACK_DEFAULT_MODEL, type ZcodeEngineDeps, abortRun, argKeysFromMeta, assertSafeId, atomicTmpPathFor, bestEffort, bindNotifyLedgerHost, boundedPrettySerialize, buildEngineModelsPromptAppend, buildSubagentEngineSection, cancelHandler, cleanupStaleTmpFiles, cleanupWorktree, clearSkillPathCache, closeHandler, closeOutInFlightCalls, collectWorktreePatch, computeElapsedSeconds, configureNotifyDomain, countAllToolCalls, createConcurrencyPool, createSubagentService, createUiRequestHandlerForMode, createZcodeEngine, deleteWorkflow, deriveOutcome, discoverAgents, discoverResources, discoverWorkflows, displayAgentName, endedMessageGuard, escapeXml, evictDoneRunsBeyondCap, executeNestedWorkflow, finalizeRun, findFlattenedArgKeys, findWorkspaceRoot, forkFromHandler, formatAgentList, formatModelList, formatWorkflowList, fromRunSnapshot, generateWorkflowScript, getAllToolCalls, getBoundNotifyLedger, getCachedFileContent, getCachedParsed, getModelConfigService, getOrCreateChannelRegistry, getSubagentService, getWorkflow, getWorkflowByPath, gitRun, hasApiKey, invalidAgentRefMessage, invalidateCache, isProcessAlive, isResumable, isSafeId, isScriptRunning, isTreeDirty, killAllSpawnedChildren, killRecordChildWithEscalation, lintScript, listHandler, listStaleTmpFiles, listWorktreePorcelain, loadWorkflowScriptByPath, loadWorkflows, makeSerializeFailedResult, mapExternalState, maxTurnsToWatchdogMs, maybeCleanupExpiredSessionFiles, messageHandler, normalizeArgsByMeta, normalizeRef, normalizeWorkflowRef, notifyGateAllowsDelivery, parseAgentProfile, parseAtomicTmpPath, parseEngineHandle, parseResourceMeta, parseResourceMetaDetailed, postBudgetUpdate, projectLiveProgress, projectOutcome, pruneStateFilesBeyondCap, readGlobalConfig, readSubagentHistoryMessages, recordToListItem, recoverCrashedRuns, registerNativeSessionReader, registerZcodeEngine, renderXmlSection, resetRebuildFailureInjectionForTest, routeEngine, runAndWait, runSummary, runWorkflow, saveWorkflow, scheduleTimeBudget, setEngineDiscoveryRescanOptions, setModelConfigService, setSubagentService, sortByCodepoint, splitZcodeModelRef, startHandler, summarizeDescription, syncEnginesFile, terminateRunningRuns, toRunSnapshot, toSubagentRecordEntry, wrapForkFromPrompt, writeAtomicFile, writeAtomicFileSync };
|
|
5816
|
+
export { AGENT_REF_EXT, AgentCall, AgentCallOpts, type AgentEntry, AgentEventLogEntry, type AgentProfile, AgentRegistry, AgentResult, type AgentRunner, type ArgKeySet, type ArgMetaOptions, type ArgMetaWarning, type AtomicTmpRef, type AtomicWriteFileOptions, type AtomicWriteOptions, BG_MESSAGE, BgResponse, Budget, CORE_PACKAGE_VERSION, type CachedWorkflowMeta, type CancelHandlerInput, type CancelHandlerResult, CancelResponse, type ChangeListener, type CleanupStaleTmpOptions, type CleanupStaleTmpResult, type CleanupWorktreeOptions, type CloseHandlerInput, type CloseHandlerResult, CloseResponse, ClosedReason, type CollectWorktreePatchOptions, type ConcurrencyPool, type CreateConcurrencyPoolOptions, type D8CompatZcodeEngineDeps, DEFAULT_LIST_LIMIT, DEFAULT_PROVIDER_ID, DEFAULT_SAVE_MIN_INTERVAL_MS, DEFAULT_STATE_MAX_RUNS, DEFAULT_WORKFLOW_SAVED_DIR, DEFAULT_WORKFLOW_TMP_DIR, DialogGlobalQueue, type DiscoveredResource, DiscoveryRoot, DisplayItem, DoneReason, EnginePort, type EngineRouteOptions, type EngineRouteResult, type EngineRouting, type EngineRoutingInput, type EngineRoutingSource, ExecutionMode, ExecutionOutcome, ExecutionRecord, ExecutionStatus, ExecutionTraceNode, ExternalState, FORK_FROM_DEFAULT_PROMPT, FileRunStore, type FinalizeRunOptions, type ForkFromHandlerInput, type ForkFromHandlerResult, ForkFromResponse, type GenerateWorkflowScriptOptions, type GenerateWorkflowScriptResult, GitRunError, type GlobalConfigReadResult, IDENTITY_CUSTOM_TYPE, INDEX_FILENAME, type InFlightListener, type InFlightSnapshot, type InvalidAgentRefMessageOptions, type LauncherDeps, type LifecycleDeps, type LintFinding, type LintResult, type ListFormatOptions, type ListHandlerInput, type ListHandlerResult, ListResponse, type ListWorktreePorcelainOptions, MAX_LIST_LIMIT, MAX_RETAINED_DONE_RUNS, MAX_TIMER_DELAY_MS, type MessageHandlerInput, type MessageHandlerResult, MessageResponse, ModelConfigService, type ModelConfigServiceInit, type ModelEntry, ModelInfo, type ModelListFormatOptions, type ModelReasoningInfo, NOTIFY_CONTRACT, type NormalizeWorkflowRefOptions, type NormalizedArgs, type NormalizedWorkflowRef, type NotifyDomainPorts, type NotifyLedgerHost, type PatchBaselineAnchor, type PruneStateDeps, type QueuePolicy, RecordStore, type RecordStorePi, type RecoverCrashedRunsHooks, type RecoverCrashedRunsResult, type ResourceKind, type ResourceSource, type RunSnapshot, type RunSpec, type RunState, RunStatus, type RunStore, SAFE_ID_RE, SNAPSHOT_VERSION, SUBAGENT_RECORD_CUSTOM_TYPE, type ScanConfig, type StartHandlerInput, type StartHandlerResult, type StatusFilter, type SubagentIdentityData, SubagentListItem, SubagentRecord, type SubagentRecordEntryData, SubagentService, type SubagentServiceInit, SubagentStream, SubprocessAgentRunner, THINKING_ORDER, Trace, WORKFLOW_REF_EXT, WORKFLOW_REF_RESERVED_NAMES, type WorkerHandlers, type WorkerHost, WorkerHostImpl, WorkerLogEntry, type WorkflowDirOptions, type WorkflowEntry, type WorkflowMeta, type WorkflowRefInvalidReason, WorkflowRun, type WorkflowRunMeta, type WorkflowRunResult, type WorkflowRunSummary, type WorkflowScanConfig, WorkflowScript, type WorkflowScriptRegistry, WorkflowScriptRegistryImpl, type WorkflowSource, WorktreeManager, type WorktreePatchResult, ZCODE_FALLBACK_DEFAULT_MODEL, type ZcodeEngineDeps, abortRun, argKeysFromMeta, assertSafeId, atomicTmpPathFor, bestEffort, bindNotifyLedgerHost, boundedPrettySerialize, buildEngineModelsPromptAppend, buildSubagentEngineSection, cancelHandler, cleanupStaleTmpFiles, cleanupWorktree, clearSkillPathCache, closeHandler, closeOutInFlightCalls, collectWorktreePatch, computeElapsedSeconds, configureNotifyDomain, countAllToolCalls, createConcurrencyPool, createSubagentService, createUiRequestHandlerForMode, createZcodeEngine, deleteWorkflow, deriveOutcome, discoverAgents, discoverResources, discoverWorkflows, displayAgentName, endedMessageGuard, escapeXml, evictDoneRunsBeyondCap, executeNestedWorkflow, finalizeRun, findFlattenedArgKeys, findWorkspaceRoot, forkFromHandler, formatAgentList, formatModelList, formatWorkflowList, fromRunSnapshot, generateWorkflowScript, getAllToolCalls, getBoundNotifyLedger, getCachedFileContent, getCachedParsed, getInFlightSnapshot, getModelConfigService, getOrCreateChannelRegistry, getSubagentService, getWorkflow, getWorkflowByPath, gitRun, hasApiKey, invalidAgentRefMessage, invalidateCache, isProcessAlive, isResumable, isSafeId, isScriptRunning, isTreeDirty, killAllSpawnedChildren, killRecordChildWithEscalation, lintScript, listHandler, listStaleTmpFiles, listWorktreePorcelain, loadWorkflowScriptByPath, loadWorkflows, makeSerializeFailedResult, mapExternalState, maxTurnsToWatchdogMs, maybeCleanupExpiredSessionFiles, messageHandler, normalizeArgsByMeta, normalizeRef, normalizeWorkflowRef, notifyGateAllowsDelivery, parseAgentProfile, parseAtomicTmpPath, parseEngineHandle, parseResourceMeta, parseResourceMetaDetailed, postBudgetUpdate, projectLiveProgress, projectOutcome, pruneStateFilesBeyondCap, readGlobalConfig, readSubagentHistoryMessages, recordToListItem, recoverCrashedRuns, registerNativeSessionReader, registerZcodeEngine, renderXmlSection, resetRebuildFailureInjectionForTest, routeEngine, runAndWait, runSummary, runWorkflow, saveWorkflow, scheduleTimeBudget, setEngineDiscoveryRescanOptions, setInFlightListener, setModelConfigService, setSubagentService, sortByCodepoint, splitZcodeModelRef, startHandler, summarizeDescription, syncEnginesFile, terminateRunningRuns, toRunSnapshot, toSubagentRecordEntry, wrapForkFromPrompt, writeAtomicFile, writeAtomicFileSync };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { E as EnginePort, D as DiscoverEnginesOptions, a as ExecutionRecord, C as ClosedReason, b as ExecutionOutcome, A as AgentEventLogEntry, c as ExecutionStatus, P as ProjectedOutcome, R as RecordSnapshot, S as SubagentRecord, d as ExecuteOptions, e as SubagentStream, f as AgentResult, g as AgentResult$1, h as SubagentsGlobalConfig, M as ModelRegistryLike, i as ModelInfo, j as AgentConfig, k as ResolvedModel, l as StreamSink, m as ExecutionHandle, n as ExecutionMode, o as PatchResult, p as AgentCallOpts, q as ExecutionTraceNode, T as TracePatch, r as RunStatus, s as DoneReason, W as WorkerLogEntry, t as DisplayItem, u as CancelResponse, v as CloseResponse, F as ForkFromResponse, L as ListResponse, w as MessageResponse, B as BgResponse, x as ExternalState, y as SubagentListItem, z as DiscoveryRoot } from './engine-discovery-scan-
|
|
2
|
-
export { G as CLOSED_REASONS, H as CoreLogger, I as DEFAULT_AGENT_NAME, J as DEFAULT_DATA_ROOT, K as DEFAULT_ENGINE_ID, N as DirtyWorktreeError, O as EngineHandle, Q as EngineRunResult, U as ForkDepthExceededError, V as HostServices, X as LogLevel, Y as ResurrectDeniedError, Z as RunContext, _ as SLUG_MAX_LENGTH, $ as SubagentToolResult, a0 as configureCore, a1 as getHostServices, a2 as getLogger, a3 as normalizeEngineId } from './engine-discovery-scan-
|
|
1
|
+
import { E as EnginePort, D as DiscoverEnginesOptions, a as ExecutionRecord, C as ClosedReason, b as ExecutionOutcome, A as AgentEventLogEntry, c as ExecutionStatus, P as ProjectedOutcome, R as RecordSnapshot, S as SubagentRecord, d as ExecuteOptions, e as SubagentStream, f as AgentResult, g as AgentResult$1, h as SubagentsGlobalConfig, M as ModelRegistryLike, i as ModelInfo, j as AgentConfig, k as ResolvedModel, l as StreamSink, m as ExecutionHandle, n as ExecutionMode, o as PatchResult, p as AgentCallOpts, q as ExecutionTraceNode, T as TracePatch, r as RunStatus, s as DoneReason, W as WorkerLogEntry, t as DisplayItem, u as CancelResponse, v as CloseResponse, F as ForkFromResponse, L as ListResponse, w as MessageResponse, B as BgResponse, x as ExternalState, y as SubagentListItem, z as DiscoveryRoot } from './engine-discovery-scan-BXLA8y-z.js';
|
|
2
|
+
export { G as CLOSED_REASONS, H as CoreLogger, I as DEFAULT_AGENT_NAME, J as DEFAULT_DATA_ROOT, K as DEFAULT_ENGINE_ID, N as DirtyWorktreeError, O as EngineHandle, Q as EngineRunResult, U as ForkDepthExceededError, V as HostServices, X as LogLevel, Y as ResurrectDeniedError, Z as RunContext, _ as SLUG_MAX_LENGTH, $ as SubagentToolResult, a0 as configureCore, a1 as getHostServices, a2 as getLogger, a3 as normalizeEngineId } from './engine-discovery-scan-BXLA8y-z.js';
|
|
3
3
|
import { ProbeReport, SessionView, ToolCall, UiRequest, UiRequestHandler, UiResponse, AgentEvent, UiChannelRegistry, WorktreeHandle, AgentOutcomeUsage } from '@zhushanwen/subagent-engine-sdk';
|
|
4
4
|
export { AgentEvent, AgentOutcome, ChannelHandler, EngineCapabilities, EngineHandleData, InteractAction, InteractResult, ProbeReport, ReplayedTurn, SessionView, ToolCallEntry, UiChannelRegistry } from '@zhushanwen/subagent-engine-sdk';
|
|
5
5
|
import { Worker } from 'node:worker_threads';
|
|
@@ -249,6 +249,26 @@ declare function registerZcodeEngine(engineDataDir?: () => string): void;
|
|
|
249
249
|
*/
|
|
250
250
|
declare function createZcodeEngine(deps: D8CompatZcodeEngineDeps): EnginePort;
|
|
251
251
|
|
|
252
|
+
/** 在途快照(与 EnginePort.inFlightSnapshot? 返回形状一致——runtime 侧统一消费形状)。 */
|
|
253
|
+
interface InFlightSnapshot {
|
|
254
|
+
/** 当前非 idle 句柄数(绝对计数,非增量)。 */
|
|
255
|
+
inFlight: number;
|
|
256
|
+
}
|
|
257
|
+
/** 壳层注册的监听回调(同步、fire-and-forget;core 不 await 不重试)。 */
|
|
258
|
+
type InFlightListener = (snapshot: InFlightSnapshot) => void;
|
|
259
|
+
/** 壳层注册监听(extension factory 装配点调用;传 null 注销)。 */
|
|
260
|
+
declare function setInFlightListener(next: InFlightListener | null): void;
|
|
261
|
+
/**
|
|
262
|
+
* 当前在途快照(纯读,无副作用):遍历活句柄记账(spawnedChildren 的 recordId 键集),
|
|
263
|
+
* 按双谓词过滤——活句柄(child 存在且未 killed)且无 armed idle timer。
|
|
264
|
+
*
|
|
265
|
+
* SSOT 复用:谓词取 lifecycle-predicates/lifecycle-manager 既有导出,与 notify-host
|
|
266
|
+
* hasRunningBackground 完全同源,不复制判定逻辑。活句柄记账里天然覆盖 pi 引擎进程内
|
|
267
|
+
* 与 relay 形态 child 两种宿主(relay spawn 经同一 runSpawn/spawnedChildren 记账——
|
|
268
|
+
* D5「extension 是两形态派生的共同属主」)。
|
|
269
|
+
*/
|
|
270
|
+
declare function getInFlightSnapshot(): InFlightSnapshot;
|
|
271
|
+
|
|
252
272
|
/** maxTurns → spawn watchdog 毫秒估算(floor 语义:maxTurns 小时取下限)。 */
|
|
253
273
|
declare function maxTurnsToWatchdogMs(maxTurns: number): number;
|
|
254
274
|
|
|
@@ -5791,6 +5811,6 @@ declare function boundedPrettySerialize(value: unknown, budget: number): string;
|
|
|
5791
5811
|
* docs/design/subagent-core-sink-design.md(sink 下沉收口扩面,2026-08-31);
|
|
5792
5812
|
* 宿主接入示例见包 README(§3.4 core_host_not_configured 恢复指引的落点)。
|
|
5793
5813
|
*/
|
|
5794
|
-
declare const CORE_PACKAGE_VERSION = "0.
|
|
5814
|
+
declare const CORE_PACKAGE_VERSION = "0.8.0";
|
|
5795
5815
|
|
|
5796
|
-
export { AGENT_REF_EXT, AgentCall, AgentCallOpts, type AgentEntry, AgentEventLogEntry, type AgentProfile, AgentRegistry, AgentResult, type AgentRunner, type ArgKeySet, type ArgMetaOptions, type ArgMetaWarning, type AtomicTmpRef, type AtomicWriteFileOptions, type AtomicWriteOptions, BG_MESSAGE, BgResponse, Budget, CORE_PACKAGE_VERSION, type CachedWorkflowMeta, type CancelHandlerInput, type CancelHandlerResult, CancelResponse, type ChangeListener, type CleanupStaleTmpOptions, type CleanupStaleTmpResult, type CleanupWorktreeOptions, type CloseHandlerInput, type CloseHandlerResult, CloseResponse, ClosedReason, type CollectWorktreePatchOptions, type ConcurrencyPool, type CreateConcurrencyPoolOptions, type D8CompatZcodeEngineDeps, DEFAULT_LIST_LIMIT, DEFAULT_PROVIDER_ID, DEFAULT_SAVE_MIN_INTERVAL_MS, DEFAULT_STATE_MAX_RUNS, DEFAULT_WORKFLOW_SAVED_DIR, DEFAULT_WORKFLOW_TMP_DIR, DialogGlobalQueue, type DiscoveredResource, DiscoveryRoot, DisplayItem, DoneReason, EnginePort, type EngineRouteOptions, type EngineRouteResult, type EngineRouting, type EngineRoutingInput, type EngineRoutingSource, ExecutionMode, ExecutionOutcome, ExecutionRecord, ExecutionStatus, ExecutionTraceNode, ExternalState, FORK_FROM_DEFAULT_PROMPT, FileRunStore, type FinalizeRunOptions, type ForkFromHandlerInput, type ForkFromHandlerResult, ForkFromResponse, type GenerateWorkflowScriptOptions, type GenerateWorkflowScriptResult, GitRunError, type GlobalConfigReadResult, IDENTITY_CUSTOM_TYPE, INDEX_FILENAME, type InvalidAgentRefMessageOptions, type LauncherDeps, type LifecycleDeps, type LintFinding, type LintResult, type ListFormatOptions, type ListHandlerInput, type ListHandlerResult, ListResponse, type ListWorktreePorcelainOptions, MAX_LIST_LIMIT, MAX_RETAINED_DONE_RUNS, MAX_TIMER_DELAY_MS, type MessageHandlerInput, type MessageHandlerResult, MessageResponse, ModelConfigService, type ModelConfigServiceInit, type ModelEntry, ModelInfo, type ModelListFormatOptions, type ModelReasoningInfo, NOTIFY_CONTRACT, type NormalizeWorkflowRefOptions, type NormalizedArgs, type NormalizedWorkflowRef, type NotifyDomainPorts, type NotifyLedgerHost, type PatchBaselineAnchor, type PruneStateDeps, type QueuePolicy, RecordStore, type RecordStorePi, type RecoverCrashedRunsHooks, type RecoverCrashedRunsResult, type ResourceKind, type ResourceSource, type RunSnapshot, type RunSpec, type RunState, RunStatus, type RunStore, SAFE_ID_RE, SNAPSHOT_VERSION, SUBAGENT_RECORD_CUSTOM_TYPE, type ScanConfig, type StartHandlerInput, type StartHandlerResult, type StatusFilter, type SubagentIdentityData, SubagentListItem, SubagentRecord, type SubagentRecordEntryData, SubagentService, type SubagentServiceInit, SubagentStream, SubprocessAgentRunner, THINKING_ORDER, Trace, WORKFLOW_REF_EXT, WORKFLOW_REF_RESERVED_NAMES, type WorkerHandlers, type WorkerHost, WorkerHostImpl, WorkerLogEntry, type WorkflowDirOptions, type WorkflowEntry, type WorkflowMeta, type WorkflowRefInvalidReason, WorkflowRun, type WorkflowRunMeta, type WorkflowRunResult, type WorkflowRunSummary, type WorkflowScanConfig, WorkflowScript, type WorkflowScriptRegistry, WorkflowScriptRegistryImpl, type WorkflowSource, WorktreeManager, type WorktreePatchResult, ZCODE_FALLBACK_DEFAULT_MODEL, type ZcodeEngineDeps, abortRun, argKeysFromMeta, assertSafeId, atomicTmpPathFor, bestEffort, bindNotifyLedgerHost, boundedPrettySerialize, buildEngineModelsPromptAppend, buildSubagentEngineSection, cancelHandler, cleanupStaleTmpFiles, cleanupWorktree, clearSkillPathCache, closeHandler, closeOutInFlightCalls, collectWorktreePatch, computeElapsedSeconds, configureNotifyDomain, countAllToolCalls, createConcurrencyPool, createSubagentService, createUiRequestHandlerForMode, createZcodeEngine, deleteWorkflow, deriveOutcome, discoverAgents, discoverResources, discoverWorkflows, displayAgentName, endedMessageGuard, escapeXml, evictDoneRunsBeyondCap, executeNestedWorkflow, finalizeRun, findFlattenedArgKeys, findWorkspaceRoot, forkFromHandler, formatAgentList, formatModelList, formatWorkflowList, fromRunSnapshot, generateWorkflowScript, getAllToolCalls, getBoundNotifyLedger, getCachedFileContent, getCachedParsed, getModelConfigService, getOrCreateChannelRegistry, getSubagentService, getWorkflow, getWorkflowByPath, gitRun, hasApiKey, invalidAgentRefMessage, invalidateCache, isProcessAlive, isResumable, isSafeId, isScriptRunning, isTreeDirty, killAllSpawnedChildren, killRecordChildWithEscalation, lintScript, listHandler, listStaleTmpFiles, listWorktreePorcelain, loadWorkflowScriptByPath, loadWorkflows, makeSerializeFailedResult, mapExternalState, maxTurnsToWatchdogMs, maybeCleanupExpiredSessionFiles, messageHandler, normalizeArgsByMeta, normalizeRef, normalizeWorkflowRef, notifyGateAllowsDelivery, parseAgentProfile, parseAtomicTmpPath, parseEngineHandle, parseResourceMeta, parseResourceMetaDetailed, postBudgetUpdate, projectLiveProgress, projectOutcome, pruneStateFilesBeyondCap, readGlobalConfig, readSubagentHistoryMessages, recordToListItem, recoverCrashedRuns, registerNativeSessionReader, registerZcodeEngine, renderXmlSection, resetRebuildFailureInjectionForTest, routeEngine, runAndWait, runSummary, runWorkflow, saveWorkflow, scheduleTimeBudget, setEngineDiscoveryRescanOptions, setModelConfigService, setSubagentService, sortByCodepoint, splitZcodeModelRef, startHandler, summarizeDescription, syncEnginesFile, terminateRunningRuns, toRunSnapshot, toSubagentRecordEntry, wrapForkFromPrompt, writeAtomicFile, writeAtomicFileSync };
|
|
5816
|
+
export { AGENT_REF_EXT, AgentCall, AgentCallOpts, type AgentEntry, AgentEventLogEntry, type AgentProfile, AgentRegistry, AgentResult, type AgentRunner, type ArgKeySet, type ArgMetaOptions, type ArgMetaWarning, type AtomicTmpRef, type AtomicWriteFileOptions, type AtomicWriteOptions, BG_MESSAGE, BgResponse, Budget, CORE_PACKAGE_VERSION, type CachedWorkflowMeta, type CancelHandlerInput, type CancelHandlerResult, CancelResponse, type ChangeListener, type CleanupStaleTmpOptions, type CleanupStaleTmpResult, type CleanupWorktreeOptions, type CloseHandlerInput, type CloseHandlerResult, CloseResponse, ClosedReason, type CollectWorktreePatchOptions, type ConcurrencyPool, type CreateConcurrencyPoolOptions, type D8CompatZcodeEngineDeps, DEFAULT_LIST_LIMIT, DEFAULT_PROVIDER_ID, DEFAULT_SAVE_MIN_INTERVAL_MS, DEFAULT_STATE_MAX_RUNS, DEFAULT_WORKFLOW_SAVED_DIR, DEFAULT_WORKFLOW_TMP_DIR, DialogGlobalQueue, type DiscoveredResource, DiscoveryRoot, DisplayItem, DoneReason, EnginePort, type EngineRouteOptions, type EngineRouteResult, type EngineRouting, type EngineRoutingInput, type EngineRoutingSource, ExecutionMode, ExecutionOutcome, ExecutionRecord, ExecutionStatus, ExecutionTraceNode, ExternalState, FORK_FROM_DEFAULT_PROMPT, FileRunStore, type FinalizeRunOptions, type ForkFromHandlerInput, type ForkFromHandlerResult, ForkFromResponse, type GenerateWorkflowScriptOptions, type GenerateWorkflowScriptResult, GitRunError, type GlobalConfigReadResult, IDENTITY_CUSTOM_TYPE, INDEX_FILENAME, type InFlightListener, type InFlightSnapshot, type InvalidAgentRefMessageOptions, type LauncherDeps, type LifecycleDeps, type LintFinding, type LintResult, type ListFormatOptions, type ListHandlerInput, type ListHandlerResult, ListResponse, type ListWorktreePorcelainOptions, MAX_LIST_LIMIT, MAX_RETAINED_DONE_RUNS, MAX_TIMER_DELAY_MS, type MessageHandlerInput, type MessageHandlerResult, MessageResponse, ModelConfigService, type ModelConfigServiceInit, type ModelEntry, ModelInfo, type ModelListFormatOptions, type ModelReasoningInfo, NOTIFY_CONTRACT, type NormalizeWorkflowRefOptions, type NormalizedArgs, type NormalizedWorkflowRef, type NotifyDomainPorts, type NotifyLedgerHost, type PatchBaselineAnchor, type PruneStateDeps, type QueuePolicy, RecordStore, type RecordStorePi, type RecoverCrashedRunsHooks, type RecoverCrashedRunsResult, type ResourceKind, type ResourceSource, type RunSnapshot, type RunSpec, type RunState, RunStatus, type RunStore, SAFE_ID_RE, SNAPSHOT_VERSION, SUBAGENT_RECORD_CUSTOM_TYPE, type ScanConfig, type StartHandlerInput, type StartHandlerResult, type StatusFilter, type SubagentIdentityData, SubagentListItem, SubagentRecord, type SubagentRecordEntryData, SubagentService, type SubagentServiceInit, SubagentStream, SubprocessAgentRunner, THINKING_ORDER, Trace, WORKFLOW_REF_EXT, WORKFLOW_REF_RESERVED_NAMES, type WorkerHandlers, type WorkerHost, WorkerHostImpl, WorkerLogEntry, type WorkflowDirOptions, type WorkflowEntry, type WorkflowMeta, type WorkflowRefInvalidReason, WorkflowRun, type WorkflowRunMeta, type WorkflowRunResult, type WorkflowRunSummary, type WorkflowScanConfig, WorkflowScript, type WorkflowScriptRegistry, WorkflowScriptRegistryImpl, type WorkflowSource, WorktreeManager, type WorktreePatchResult, ZCODE_FALLBACK_DEFAULT_MODEL, type ZcodeEngineDeps, abortRun, argKeysFromMeta, assertSafeId, atomicTmpPathFor, bestEffort, bindNotifyLedgerHost, boundedPrettySerialize, buildEngineModelsPromptAppend, buildSubagentEngineSection, cancelHandler, cleanupStaleTmpFiles, cleanupWorktree, clearSkillPathCache, closeHandler, closeOutInFlightCalls, collectWorktreePatch, computeElapsedSeconds, configureNotifyDomain, countAllToolCalls, createConcurrencyPool, createSubagentService, createUiRequestHandlerForMode, createZcodeEngine, deleteWorkflow, deriveOutcome, discoverAgents, discoverResources, discoverWorkflows, displayAgentName, endedMessageGuard, escapeXml, evictDoneRunsBeyondCap, executeNestedWorkflow, finalizeRun, findFlattenedArgKeys, findWorkspaceRoot, forkFromHandler, formatAgentList, formatModelList, formatWorkflowList, fromRunSnapshot, generateWorkflowScript, getAllToolCalls, getBoundNotifyLedger, getCachedFileContent, getCachedParsed, getInFlightSnapshot, getModelConfigService, getOrCreateChannelRegistry, getSubagentService, getWorkflow, getWorkflowByPath, gitRun, hasApiKey, invalidAgentRefMessage, invalidateCache, isProcessAlive, isResumable, isSafeId, isScriptRunning, isTreeDirty, killAllSpawnedChildren, killRecordChildWithEscalation, lintScript, listHandler, listStaleTmpFiles, listWorktreePorcelain, loadWorkflowScriptByPath, loadWorkflows, makeSerializeFailedResult, mapExternalState, maxTurnsToWatchdogMs, maybeCleanupExpiredSessionFiles, messageHandler, normalizeArgsByMeta, normalizeRef, normalizeWorkflowRef, notifyGateAllowsDelivery, parseAgentProfile, parseAtomicTmpPath, parseEngineHandle, parseResourceMeta, parseResourceMetaDetailed, postBudgetUpdate, projectLiveProgress, projectOutcome, pruneStateFilesBeyondCap, readGlobalConfig, readSubagentHistoryMessages, recordToListItem, recoverCrashedRuns, registerNativeSessionReader, registerZcodeEngine, renderXmlSection, resetRebuildFailureInjectionForTest, routeEngine, runAndWait, runSummary, runWorkflow, saveWorkflow, scheduleTimeBudget, setEngineDiscoveryRescanOptions, setInFlightListener, setModelConfigService, setSubagentService, sortByCodepoint, splitZcodeModelRef, startHandler, summarizeDescription, syncEnginesFile, terminateRunningRuns, toRunSnapshot, toSubagentRecordEntry, wrapForkFromPrompt, writeAtomicFile, writeAtomicFileSync };
|