@zhushanwen/subagent-engine-sdk 0.9.0 → 0.10.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/dist/{chunk-EF2F5YOM.js → chunk-CNCFMPEH.js} +1 -1
- package/dist/{chunk-6QE3OODO.js → chunk-HSNDUHFH.js} +1 -1
- package/dist/{chunk-VDKR7MLG.js → chunk-JZN76I3S.js} +31 -1
- package/dist/{chunk-DIIYVO4O.js → chunk-LM7P7OTA.js} +2 -1
- package/dist/{chunk-KADRNFG2.js → chunk-NTOLHLCL.js} +1 -1
- package/dist/{chunk-CT3FEBDO.js → chunk-QOFFM5YW.js} +7 -1
- package/dist/{contract-types-DqOD58r-.d.cts → contract-types-jSa1g28F.d.cts} +37 -2
- package/dist/{contract-types-DqOD58r-.d.ts → contract-types-jSa1g28F.d.ts} +37 -2
- package/dist/error-codes-DnFru4L4.d.ts +150 -0
- package/dist/error-codes-f-UO4a8D.d.cts +150 -0
- package/dist/index.cjs +45 -2
- package/dist/index.d.cts +5 -4
- package/dist/index.d.ts +5 -4
- package/dist/index.js +19 -7
- package/dist/journal-io.d.cts +1 -1
- package/dist/journal-io.d.ts +1 -1
- package/dist/journal-replay.d.cts +1 -1
- package/dist/journal-replay.d.ts +1 -1
- package/dist/kill-chain.cjs +26 -0
- package/dist/kill-chain.d.cts +1 -1
- package/dist/kill-chain.d.ts +1 -1
- package/dist/kill-chain.js +2 -2
- package/dist/{error-codes-CiDwaODz.d.ts → methods-BLxg4ZFr.d.cts} +46 -120
- package/dist/{error-codes-C3oVToMr.d.cts → methods-C2zvZqhP.d.ts} +46 -120
- package/dist/node-executor.cjs +26 -0
- package/dist/node-executor.js +2 -2
- package/dist/port-contract.d.cts +11 -1
- package/dist/port-contract.d.ts +11 -1
- package/dist/protocol/index.cjs +38 -2
- package/dist/protocol/index.d.cts +20 -5
- package/dist/protocol/index.d.ts +20 -5
- package/dist/protocol/index.js +12 -2
- package/dist/server/index.cjs +26 -0
- package/dist/server/index.d.cts +4 -3
- package/dist/server/index.d.ts +4 -3
- package/dist/server/index.js +1 -1
- package/dist/spawn.cjs +28 -0
- package/dist/spawn.js +3 -3
- package/dist/zcode-db-paths.cjs +9 -2
- package/dist/zcode-db-paths.d.cts +11 -1
- package/dist/zcode-db-paths.d.ts +11 -1
- package/dist/zcode-db-paths.js +5 -3
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -6612,6 +6612,10 @@ __export(src_exports, {
|
|
|
6612
6612
|
REVERSE_CHANNEL_TIMEOUT_CLASS: () => REVERSE_CHANNEL_TIMEOUT_CLASS,
|
|
6613
6613
|
REVERSE_REQUEST_TIMEOUT_MS: () => REVERSE_REQUEST_TIMEOUT_MS,
|
|
6614
6614
|
SCHEMA_EMULATION_TAIL_CHARS: () => SCHEMA_EMULATION_TAIL_CHARS,
|
|
6615
|
+
SET_MODEL_ERROR_CODES: () => SET_MODEL_ERROR_CODES,
|
|
6616
|
+
SET_MODEL_NOT_ACTIVE_CODE: () => SET_MODEL_NOT_ACTIVE_CODE,
|
|
6617
|
+
SET_MODEL_REQUEST_TIMEOUT_MS: () => SET_MODEL_REQUEST_TIMEOUT_MS,
|
|
6618
|
+
SET_MODEL_STAGE_TIMEOUT_MS: () => SET_MODEL_STAGE_TIMEOUT_MS,
|
|
6615
6619
|
SHARED_POOL_KEY: () => SHARED_POOL_KEY,
|
|
6616
6620
|
STDERR_TAIL_CHARS: () => STDERR_TAIL_CHARS,
|
|
6617
6621
|
STDOUT_TAIL_ECHO_CHARS: () => STDOUT_TAIL_ECHO_CHARS,
|
|
@@ -6620,6 +6624,7 @@ __export(src_exports, {
|
|
|
6620
6624
|
TAIJI_DATA_DIR_ENV: () => TAIJI_DATA_DIR_ENV,
|
|
6621
6625
|
ZCODE_HOST_DB_SUFFIX: () => ZCODE_HOST_DB_SUFFIX,
|
|
6622
6626
|
ZCODE_ISOLATED_DB_SEGMENTS: () => ZCODE_ISOLATED_DB_SEGMENTS,
|
|
6627
|
+
ZCODE_PI_SYNCED_PROVIDER_CONFIG_SEGMENTS: () => ZCODE_PI_SYNCED_PROVIDER_CONFIG_SEGMENTS,
|
|
6623
6628
|
abortWithFallback: () => abortWithFallback,
|
|
6624
6629
|
aggregateUsage: () => aggregateUsage,
|
|
6625
6630
|
armEngineSelfDestruct: () => armEngineSelfDestruct,
|
|
@@ -6637,6 +6642,7 @@ __export(src_exports, {
|
|
|
6637
6642
|
createUiChannelRegistry: () => createUiChannelRegistry,
|
|
6638
6643
|
engineConversationUnsupportedError: () => engineConversationUnsupportedError,
|
|
6639
6644
|
engineProtocolMismatchError: () => engineProtocolMismatchError,
|
|
6645
|
+
engineSetModelUnsupportedError: () => engineSetModelUnsupportedError,
|
|
6640
6646
|
engineTimeoutDetail: () => engineTimeoutDetail,
|
|
6641
6647
|
errorResponseFrameSchema: () => errorResponseFrameSchema,
|
|
6642
6648
|
eventsToSessionView: () => eventsToSessionView,
|
|
@@ -6703,6 +6709,8 @@ function isProtocolVersionCompatible(version) {
|
|
|
6703
6709
|
var REVERSE_REQUEST_TIMEOUT_MS = 1e4;
|
|
6704
6710
|
var HANDSHAKE_TIMEOUT_MS = 1e4;
|
|
6705
6711
|
var CANCEL_SETTLE_GRACE_MS = 3e3;
|
|
6712
|
+
var SET_MODEL_STAGE_TIMEOUT_MS = 3e3;
|
|
6713
|
+
var SET_MODEL_REQUEST_TIMEOUT_MS = 1e4;
|
|
6706
6714
|
var STDERR_TAIL_CHARS = 400;
|
|
6707
6715
|
|
|
6708
6716
|
// src/protocol/frames.ts
|
|
@@ -6737,7 +6745,8 @@ var PROTOCOL_METHODS = [
|
|
|
6737
6745
|
"listModels",
|
|
6738
6746
|
"validateModel",
|
|
6739
6747
|
"dispose",
|
|
6740
|
-
"ping"
|
|
6748
|
+
"ping",
|
|
6749
|
+
"setModel"
|
|
6741
6750
|
];
|
|
6742
6751
|
|
|
6743
6752
|
// src/protocol/reverse-channels.ts
|
|
@@ -6759,6 +6768,19 @@ var REVERSE_CHANNEL_TIMEOUT_CLASS = {
|
|
|
6759
6768
|
};
|
|
6760
6769
|
|
|
6761
6770
|
// src/protocol/error-codes.ts
|
|
6771
|
+
var SET_MODEL_ERROR_CODES = [
|
|
6772
|
+
/** 目标模型不在当前进程快照(子进程模型快照冻结于 spawn 时刻——模型本身有效,
|
|
6773
|
+
* 下一轮 spawn 现取目录即可用;宿主按「写覆盖意图」处置,设计 §7.2 快照型失败行)。 */
|
|
6774
|
+
"engine_model_not_in_snapshot",
|
|
6775
|
+
/** 凭据校验失败(子进程 set_model checkAuth 抛错——宿主预检通过后 registry 态漂移
|
|
6776
|
+
* 的权威兜底;宿主按校验型失败处置,设计 §7.5 凭据行)。 */
|
|
6777
|
+
"engine_credential_missing",
|
|
6778
|
+
/** 命令已发出(set_model 可能已执行)但读应答 / get_state 回读无回执、生效值未知
|
|
6779
|
+
* (非进程退出情形——退出归无活进程路径;宿主按「写覆盖意图 + 错误应答」处置,
|
|
6780
|
+
* 设计 §7.5 回读失败行)。 */
|
|
6781
|
+
"engine_state_readback_failed"
|
|
6782
|
+
];
|
|
6783
|
+
var SET_MODEL_NOT_ACTIVE_CODE = "engine_run_not_active";
|
|
6762
6784
|
var ENGINE_PROTOCOL_ERROR_CODES = [
|
|
6763
6785
|
"engine_not_found",
|
|
6764
6786
|
"engine_protocol_mismatch",
|
|
@@ -6768,7 +6790,9 @@ var ENGINE_PROTOCOL_ERROR_CODES = [
|
|
|
6768
6790
|
"engine_model_mismatch",
|
|
6769
6791
|
"engine_handshake_timeout",
|
|
6770
6792
|
"engine_crashed",
|
|
6771
|
-
"engine_probe_failed"
|
|
6793
|
+
"engine_probe_failed",
|
|
6794
|
+
...SET_MODEL_ERROR_CODES,
|
|
6795
|
+
SET_MODEL_NOT_ACTIVE_CODE
|
|
6772
6796
|
];
|
|
6773
6797
|
function isEngineProtocolErrorCode(value) {
|
|
6774
6798
|
return typeof value === "string" && ENGINE_PROTOCOL_ERROR_CODES.includes(value);
|
|
@@ -6818,6 +6842,14 @@ function assertChatConversationSupported(engineId, capabilities) {
|
|
|
6818
6842
|
throw engineConversationUnsupportedError(engineId);
|
|
6819
6843
|
}
|
|
6820
6844
|
}
|
|
6845
|
+
function engineSetModelUnsupportedError(engineId, declared) {
|
|
6846
|
+
return new EngineSdkError(
|
|
6847
|
+
"engine_capability_unsupported",
|
|
6848
|
+
`engine '${engineId}' does not support hot model switching (capabilities.setModel = ${declared ?? "unsupported (undeclared)"}); the host pre-check (design \xA77.2 step 2) must not dispatch setModel to it`,
|
|
6849
|
+
`Route the switch to an engine that declares capabilities.setModel = 'native', or record the override for the next run instead. If this engine actually supports hot switching, fix the manifest capabilities declaration.`,
|
|
6850
|
+
{ engineId, capability: "setModel", declared: declared ?? "unsupported" }
|
|
6851
|
+
);
|
|
6852
|
+
}
|
|
6821
6853
|
var DETAIL_ECHO_MAX_CHARS = 200;
|
|
6822
6854
|
var STDOUT_TAIL_ECHO_CHARS = 2e3;
|
|
6823
6855
|
function truncate(text, max) {
|
|
@@ -8237,6 +8269,11 @@ function cleanupSiblingStderrLogs(logPath, env, prefix, now) {
|
|
|
8237
8269
|
// src/zcode-db-paths.ts
|
|
8238
8270
|
var ZCODE_HOST_DB_SUFFIX = [".zcode", "cli", "db", "db.sqlite"];
|
|
8239
8271
|
var ZCODE_ISOLATED_DB_SEGMENTS = ["engines", "zcode", "session-db", "db.sqlite"];
|
|
8272
|
+
var ZCODE_PI_SYNCED_PROVIDER_CONFIG_SEGMENTS = [
|
|
8273
|
+
"engines",
|
|
8274
|
+
"zcode",
|
|
8275
|
+
"pi-synced-provider-config.json"
|
|
8276
|
+
];
|
|
8240
8277
|
|
|
8241
8278
|
// src/relay-env.ts
|
|
8242
8279
|
var RELAY_ENV_SOCKET = "TAIJI_SUBAGENT_RELAY_SOCKET";
|
|
@@ -8431,6 +8468,10 @@ function runEngineCliEntry(opts) {
|
|
|
8431
8468
|
REVERSE_CHANNEL_TIMEOUT_CLASS,
|
|
8432
8469
|
REVERSE_REQUEST_TIMEOUT_MS,
|
|
8433
8470
|
SCHEMA_EMULATION_TAIL_CHARS,
|
|
8471
|
+
SET_MODEL_ERROR_CODES,
|
|
8472
|
+
SET_MODEL_NOT_ACTIVE_CODE,
|
|
8473
|
+
SET_MODEL_REQUEST_TIMEOUT_MS,
|
|
8474
|
+
SET_MODEL_STAGE_TIMEOUT_MS,
|
|
8434
8475
|
SHARED_POOL_KEY,
|
|
8435
8476
|
STDERR_TAIL_CHARS,
|
|
8436
8477
|
STDOUT_TAIL_ECHO_CHARS,
|
|
@@ -8439,6 +8480,7 @@ function runEngineCliEntry(opts) {
|
|
|
8439
8480
|
TAIJI_DATA_DIR_ENV,
|
|
8440
8481
|
ZCODE_HOST_DB_SUFFIX,
|
|
8441
8482
|
ZCODE_ISOLATED_DB_SEGMENTS,
|
|
8483
|
+
ZCODE_PI_SYNCED_PROVIDER_CONFIG_SEGMENTS,
|
|
8442
8484
|
abortWithFallback,
|
|
8443
8485
|
aggregateUsage,
|
|
8444
8486
|
armEngineSelfDestruct,
|
|
@@ -8456,6 +8498,7 @@ function runEngineCliEntry(opts) {
|
|
|
8456
8498
|
createUiChannelRegistry,
|
|
8457
8499
|
engineConversationUnsupportedError,
|
|
8458
8500
|
engineProtocolMismatchError,
|
|
8501
|
+
engineSetModelUnsupportedError,
|
|
8459
8502
|
engineTimeoutDetail,
|
|
8460
8503
|
errorResponseFrameSchema,
|
|
8461
8504
|
eventsToSessionView,
|
package/dist/index.d.cts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
export { CANCEL_SETTLE_GRACE_MS, ENGINE_PROTOCOL_SCHEMAS, ENGINE_PROTOCOL_VERSION, FORBIDDEN_CREDENTIAL_KEY_FRAGMENTS, HANDSHAKE_TIMEOUT_MS, HostAskUserParams, HostAskUserResult, HostChildSpawnedParams, HostChildStateChangedParams, HostHandleReadyParams, HostLogParams, HostStreamDeltaParams, REVERSE_CHANNELS, REVERSE_CHANNEL_TIMEOUT_CLASS, REVERSE_REQUEST_TIMEOUT_MS, ReverseChannel, ReverseRequestTimeoutClass, STDERR_TAIL_CHARS, SUPPORTED_PROTOCOL_RANGE, errorResponseFrameSchema, isProtocolVersionCompatible, notificationFrameSchema, protocolErrorSchema, requestFrameSchema, reverseRequestFrameSchema, runSessionParamsSchema, successResponseFrameSchema } from './protocol/index.cjs';
|
|
2
|
-
export {
|
|
3
|
-
export {
|
|
1
|
+
export { CANCEL_SETTLE_GRACE_MS, ENGINE_PROTOCOL_SCHEMAS, ENGINE_PROTOCOL_VERSION, FORBIDDEN_CREDENTIAL_KEY_FRAGMENTS, HANDSHAKE_TIMEOUT_MS, HostAskUserParams, HostAskUserResult, HostChildSpawnedParams, HostChildStateChangedParams, HostHandleReadyParams, HostLogParams, HostStreamDeltaParams, REVERSE_CHANNELS, REVERSE_CHANNEL_TIMEOUT_CLASS, REVERSE_REQUEST_TIMEOUT_MS, ReverseChannel, ReverseRequestTimeoutClass, SET_MODEL_REQUEST_TIMEOUT_MS, SET_MODEL_STAGE_TIMEOUT_MS, STDERR_TAIL_CHARS, SUPPORTED_PROTOCOL_RANGE, errorResponseFrameSchema, isProtocolVersionCompatible, notificationFrameSchema, protocolErrorSchema, requestFrameSchema, reverseRequestFrameSchema, runSessionParamsSchema, successResponseFrameSchema } from './protocol/index.cjs';
|
|
2
|
+
export { a as ENGINE_ERROR_CODE_PREFIX, b as ENGINE_PROTOCOL_ERROR_CODES, c as ENGINE_TIMEOUT_RECOVERY, d as EngineProtocolErrorCode, E as EngineSdkError, e as ErrorResponseFrame, f as EventNotificationParams, N as NotificationFrame, P as ProtocolError, R as RequestFrame, g as ResponseFrame, h as ReverseRequestFrame, i as ReverseResponseResult, S as SET_MODEL_ERROR_CODES, j as SET_MODEL_NOT_ACTIVE_CODE, k as STDOUT_TAIL_ECHO_CHARS, l as SetModelErrorCode, m as SuccessResponseFrame, n as assertChatConversationSupported, o as engineConversationUnsupportedError, p as engineProtocolMismatchError, q as engineSetModelUnsupportedError, r as engineTimeoutDetail, s as isEngineErrorPassthroughCode, t as isEngineProtocolErrorCode, u as isNotificationFrame, v as isRequestFrame, w as isResponseFrame, x as isReverseRequestFrame, y as schemaEmulationFailedDetail } from './error-codes-f-UO4a8D.cjs';
|
|
3
|
+
export { C as CancelParams, c as CancelResult, D as DisposeParams, d as DisposeResult, b as InitializeParams, I as InitializeResult, L as ListModelsParams, e as ListModelsResult, P as PROTOCOL_METHODS, f as PingParams, g as PingResult, h as ProbeParams, i as ProtocolMethod, j as ProtocolParamsMap, k as ProtocolResultMap, l as ReadParams, R as RunContextParams, m as RunParams, n as RunResult, o as RunResumeParams, S as SetModelParams, a as SetModelResult, V as ValidateModelParams, p as ValidateModelResult } from './methods-BLxg4ZFr.cjs';
|
|
4
|
+
export { g as AGENT_EVENT_TYPE_NAMES, b as AgentCallOpts, A as AgentEvent, h as AgentEventTypeName, i as AgentFailureKind, c as AgentOutcome, j as AgentOutcomeUsage, k as AgentUsage, a as AgentUsageTotal, l as AssertMutuallyAssignable, d as EngineCapabilities, E as EngineHandleData, m as EngineProcessModel, I as InternalToolCall, f as ModelCatalogEntry, M as ModelRef, P as ProbeReport, R as ReplayedTurn, e as ResumeAnchor, S as SessionView, n as ToolCall, o as ToolCallEntry, p as ToolCallResult, T as Turn, W as WorktreeHandle } from './contract-types-jSa1g28F.cjs';
|
|
4
5
|
export { SCHEMA_EMULATION_TAIL_CHARS, StructuredOutputResult, buildSchemaEmulationSegment, extractAndValidateStructuredOutput } from './schema-emulation.cjs';
|
|
5
6
|
export { ExecutionNestingContext, ExecutionNestingState, NESTED_SPAWN_ENV, NestedSpawnRejectedError, SpawnEnv, assertNotNestedSpawn, buildNestedSpawnEnv } from './nesting-guard.cjs';
|
|
6
7
|
export { CoreLogger, LogLevel, LoggerSink, configureLoggerSink, getLogger, resetLoggerSinkForTests } from './logger.cjs';
|
|
@@ -14,7 +15,7 @@ export { BuildOutboundChildEnvOptions, ENGINE_ENV_DENY_LIST, ENGINE_ENV_L0_INFRA
|
|
|
14
15
|
export { DEFAULT_ENGINE_HOST_REQUEST_TIMEOUT_MS, ENGINE_ABORT_KILL_GRACE_MS, ENGINE_HOST_REQUEST_TIMEOUT_ENV, EngineChildEnv, EngineSelfDestructOptions, ReverseRequestClock, SpawnEngineChildOptions, armEngineSelfDestruct, pumpNdjsonLines, spawnEngineChild } from './spawn.cjs';
|
|
15
16
|
export { ENGINE_NODE_ENV, EngineNodeHostKind, EngineNodeLaunch, EngineNodeLaunchOptions, hostKindOf, probeNodeExecutor, resetEngineNodeProbeCache, resolveEngineNodeLaunch } from './node-executor.cjs';
|
|
16
17
|
export { CleanupResult, DEFAULT_STDERR_KEEP_DAYS, DEFAULT_STDERR_MAX_BYTES, StderrRotationParams, cleanupSiblingStderrLogs, cleanupStaleStderrLogs, isPidAlive, rotateStderrLogIfNeeded, stderrLogPathFor, stderrLogPidOf, stderrRotationParams } from './logs/stderr-rotation.cjs';
|
|
17
|
-
export { ZCODE_HOST_DB_SUFFIX, ZCODE_ISOLATED_DB_SEGMENTS } from './zcode-db-paths.cjs';
|
|
18
|
+
export { ZCODE_HOST_DB_SUFFIX, ZCODE_ISOLATED_DB_SEGMENTS, ZCODE_PI_SYNCED_PROVIDER_CONFIG_SEGMENTS } from './zcode-db-paths.cjs';
|
|
18
19
|
export { RELAY_ENV_NODE, RELAY_ENV_RECORD_ID, RELAY_ENV_SCRIPT, RELAY_ENV_SESSION_ID, RELAY_ENV_SOCKET, RELAY_EXIT_CODES, RELAY_PROTOCOL_VERSION, isRelayActive, readRelayForwardEnv } from './relay-env.cjs';
|
|
19
20
|
export { toErrorMessage } from './error-message.cjs';
|
|
20
21
|
export { BestEffortLevel, bestEffort } from './best-effort.cjs';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
export { CANCEL_SETTLE_GRACE_MS, ENGINE_PROTOCOL_SCHEMAS, ENGINE_PROTOCOL_VERSION, FORBIDDEN_CREDENTIAL_KEY_FRAGMENTS, HANDSHAKE_TIMEOUT_MS, HostAskUserParams, HostAskUserResult, HostChildSpawnedParams, HostChildStateChangedParams, HostHandleReadyParams, HostLogParams, HostStreamDeltaParams, REVERSE_CHANNELS, REVERSE_CHANNEL_TIMEOUT_CLASS, REVERSE_REQUEST_TIMEOUT_MS, ReverseChannel, ReverseRequestTimeoutClass, STDERR_TAIL_CHARS, SUPPORTED_PROTOCOL_RANGE, errorResponseFrameSchema, isProtocolVersionCompatible, notificationFrameSchema, protocolErrorSchema, requestFrameSchema, reverseRequestFrameSchema, runSessionParamsSchema, successResponseFrameSchema } from './protocol/index.js';
|
|
2
|
-
export {
|
|
3
|
-
export {
|
|
1
|
+
export { CANCEL_SETTLE_GRACE_MS, ENGINE_PROTOCOL_SCHEMAS, ENGINE_PROTOCOL_VERSION, FORBIDDEN_CREDENTIAL_KEY_FRAGMENTS, HANDSHAKE_TIMEOUT_MS, HostAskUserParams, HostAskUserResult, HostChildSpawnedParams, HostChildStateChangedParams, HostHandleReadyParams, HostLogParams, HostStreamDeltaParams, REVERSE_CHANNELS, REVERSE_CHANNEL_TIMEOUT_CLASS, REVERSE_REQUEST_TIMEOUT_MS, ReverseChannel, ReverseRequestTimeoutClass, SET_MODEL_REQUEST_TIMEOUT_MS, SET_MODEL_STAGE_TIMEOUT_MS, STDERR_TAIL_CHARS, SUPPORTED_PROTOCOL_RANGE, errorResponseFrameSchema, isProtocolVersionCompatible, notificationFrameSchema, protocolErrorSchema, requestFrameSchema, reverseRequestFrameSchema, runSessionParamsSchema, successResponseFrameSchema } from './protocol/index.js';
|
|
2
|
+
export { a as ENGINE_ERROR_CODE_PREFIX, b as ENGINE_PROTOCOL_ERROR_CODES, c as ENGINE_TIMEOUT_RECOVERY, d as EngineProtocolErrorCode, E as EngineSdkError, e as ErrorResponseFrame, f as EventNotificationParams, N as NotificationFrame, P as ProtocolError, R as RequestFrame, g as ResponseFrame, h as ReverseRequestFrame, i as ReverseResponseResult, S as SET_MODEL_ERROR_CODES, j as SET_MODEL_NOT_ACTIVE_CODE, k as STDOUT_TAIL_ECHO_CHARS, l as SetModelErrorCode, m as SuccessResponseFrame, n as assertChatConversationSupported, o as engineConversationUnsupportedError, p as engineProtocolMismatchError, q as engineSetModelUnsupportedError, r as engineTimeoutDetail, s as isEngineErrorPassthroughCode, t as isEngineProtocolErrorCode, u as isNotificationFrame, v as isRequestFrame, w as isResponseFrame, x as isReverseRequestFrame, y as schemaEmulationFailedDetail } from './error-codes-DnFru4L4.js';
|
|
3
|
+
export { C as CancelParams, c as CancelResult, D as DisposeParams, d as DisposeResult, b as InitializeParams, I as InitializeResult, L as ListModelsParams, e as ListModelsResult, P as PROTOCOL_METHODS, f as PingParams, g as PingResult, h as ProbeParams, i as ProtocolMethod, j as ProtocolParamsMap, k as ProtocolResultMap, l as ReadParams, R as RunContextParams, m as RunParams, n as RunResult, o as RunResumeParams, S as SetModelParams, a as SetModelResult, V as ValidateModelParams, p as ValidateModelResult } from './methods-C2zvZqhP.js';
|
|
4
|
+
export { g as AGENT_EVENT_TYPE_NAMES, b as AgentCallOpts, A as AgentEvent, h as AgentEventTypeName, i as AgentFailureKind, c as AgentOutcome, j as AgentOutcomeUsage, k as AgentUsage, a as AgentUsageTotal, l as AssertMutuallyAssignable, d as EngineCapabilities, E as EngineHandleData, m as EngineProcessModel, I as InternalToolCall, f as ModelCatalogEntry, M as ModelRef, P as ProbeReport, R as ReplayedTurn, e as ResumeAnchor, S as SessionView, n as ToolCall, o as ToolCallEntry, p as ToolCallResult, T as Turn, W as WorktreeHandle } from './contract-types-jSa1g28F.js';
|
|
4
5
|
export { SCHEMA_EMULATION_TAIL_CHARS, StructuredOutputResult, buildSchemaEmulationSegment, extractAndValidateStructuredOutput } from './schema-emulation.js';
|
|
5
6
|
export { ExecutionNestingContext, ExecutionNestingState, NESTED_SPAWN_ENV, NestedSpawnRejectedError, SpawnEnv, assertNotNestedSpawn, buildNestedSpawnEnv } from './nesting-guard.js';
|
|
6
7
|
export { CoreLogger, LogLevel, LoggerSink, configureLoggerSink, getLogger, resetLoggerSinkForTests } from './logger.js';
|
|
@@ -14,7 +15,7 @@ export { BuildOutboundChildEnvOptions, ENGINE_ENV_DENY_LIST, ENGINE_ENV_L0_INFRA
|
|
|
14
15
|
export { DEFAULT_ENGINE_HOST_REQUEST_TIMEOUT_MS, ENGINE_ABORT_KILL_GRACE_MS, ENGINE_HOST_REQUEST_TIMEOUT_ENV, EngineChildEnv, EngineSelfDestructOptions, ReverseRequestClock, SpawnEngineChildOptions, armEngineSelfDestruct, pumpNdjsonLines, spawnEngineChild } from './spawn.js';
|
|
15
16
|
export { ENGINE_NODE_ENV, EngineNodeHostKind, EngineNodeLaunch, EngineNodeLaunchOptions, hostKindOf, probeNodeExecutor, resetEngineNodeProbeCache, resolveEngineNodeLaunch } from './node-executor.js';
|
|
16
17
|
export { CleanupResult, DEFAULT_STDERR_KEEP_DAYS, DEFAULT_STDERR_MAX_BYTES, StderrRotationParams, cleanupSiblingStderrLogs, cleanupStaleStderrLogs, isPidAlive, rotateStderrLogIfNeeded, stderrLogPathFor, stderrLogPidOf, stderrRotationParams } from './logs/stderr-rotation.js';
|
|
17
|
-
export { ZCODE_HOST_DB_SUFFIX, ZCODE_ISOLATED_DB_SEGMENTS } from './zcode-db-paths.js';
|
|
18
|
+
export { ZCODE_HOST_DB_SUFFIX, ZCODE_ISOLATED_DB_SEGMENTS, ZCODE_PI_SYNCED_PROVIDER_CONFIG_SEGMENTS } from './zcode-db-paths.js';
|
|
18
19
|
export { RELAY_ENV_NODE, RELAY_ENV_RECORD_ID, RELAY_ENV_SCRIPT, RELAY_ENV_SESSION_ID, RELAY_ENV_SOCKET, RELAY_EXIT_CODES, RELAY_PROTOCOL_VERSION, isRelayActive, readRelayForwardEnv } from './relay-env.js';
|
|
19
20
|
export { toErrorMessage } from './error-message.js';
|
|
20
21
|
export { BestEffortLevel, bestEffort } from './best-effort.js';
|
package/dist/index.js
CHANGED
|
@@ -24,8 +24,9 @@ import {
|
|
|
24
24
|
} from "./chunk-VE3NVT7K.js";
|
|
25
25
|
import {
|
|
26
26
|
ZCODE_HOST_DB_SUFFIX,
|
|
27
|
-
ZCODE_ISOLATED_DB_SEGMENTS
|
|
28
|
-
|
|
27
|
+
ZCODE_ISOLATED_DB_SEGMENTS,
|
|
28
|
+
ZCODE_PI_SYNCED_PROVIDER_CONFIG_SEGMENTS
|
|
29
|
+
} from "./chunk-QOFFM5YW.js";
|
|
29
30
|
import {
|
|
30
31
|
TAIJI_DATA_DIR_ENV,
|
|
31
32
|
resetDataDirWarnForTests,
|
|
@@ -59,14 +60,14 @@ import {
|
|
|
59
60
|
armEngineSelfDestruct,
|
|
60
61
|
pumpNdjsonLines,
|
|
61
62
|
spawnEngineChild
|
|
62
|
-
} from "./chunk-
|
|
63
|
+
} from "./chunk-HSNDUHFH.js";
|
|
63
64
|
import {
|
|
64
65
|
ENGINE_NODE_ENV,
|
|
65
66
|
hostKindOf,
|
|
66
67
|
probeNodeExecutor,
|
|
67
68
|
resetEngineNodeProbeCache,
|
|
68
69
|
resolveEngineNodeLaunch
|
|
69
|
-
} from "./chunk-
|
|
70
|
+
} from "./chunk-NTOLHLCL.js";
|
|
70
71
|
import {
|
|
71
72
|
DEFAULT_STDERR_KEEP_DAYS,
|
|
72
73
|
DEFAULT_STDERR_MAX_BYTES,
|
|
@@ -92,7 +93,7 @@ import {
|
|
|
92
93
|
reverseRequestFrameSchema,
|
|
93
94
|
runSessionParamsSchema,
|
|
94
95
|
successResponseFrameSchema
|
|
95
|
-
} from "./chunk-
|
|
96
|
+
} from "./chunk-LM7P7OTA.js";
|
|
96
97
|
import {
|
|
97
98
|
isNotificationFrame,
|
|
98
99
|
isRequestFrame,
|
|
@@ -121,7 +122,7 @@ import {
|
|
|
121
122
|
probePidAlive,
|
|
122
123
|
safeKill,
|
|
123
124
|
synthesizeTimeoutOutcome
|
|
124
|
-
} from "./chunk-
|
|
125
|
+
} from "./chunk-CNCFMPEH.js";
|
|
125
126
|
import {
|
|
126
127
|
toErrorMessage
|
|
127
128
|
} from "./chunk-PYO3YR7W.js";
|
|
@@ -134,18 +135,23 @@ import {
|
|
|
134
135
|
EngineSdkError,
|
|
135
136
|
HANDSHAKE_TIMEOUT_MS,
|
|
136
137
|
REVERSE_REQUEST_TIMEOUT_MS,
|
|
138
|
+
SET_MODEL_ERROR_CODES,
|
|
139
|
+
SET_MODEL_NOT_ACTIVE_CODE,
|
|
140
|
+
SET_MODEL_REQUEST_TIMEOUT_MS,
|
|
141
|
+
SET_MODEL_STAGE_TIMEOUT_MS,
|
|
137
142
|
STDERR_TAIL_CHARS,
|
|
138
143
|
STDOUT_TAIL_ECHO_CHARS,
|
|
139
144
|
SUPPORTED_PROTOCOL_RANGE,
|
|
140
145
|
assertChatConversationSupported,
|
|
141
146
|
engineConversationUnsupportedError,
|
|
142
147
|
engineProtocolMismatchError,
|
|
148
|
+
engineSetModelUnsupportedError,
|
|
143
149
|
engineTimeoutDetail,
|
|
144
150
|
isEngineErrorPassthroughCode,
|
|
145
151
|
isEngineProtocolErrorCode,
|
|
146
152
|
isProtocolVersionCompatible,
|
|
147
153
|
schemaEmulationFailedDetail
|
|
148
|
-
} from "./chunk-
|
|
154
|
+
} from "./chunk-JZN76I3S.js";
|
|
149
155
|
import {
|
|
150
156
|
configureLoggerSink,
|
|
151
157
|
getLogger,
|
|
@@ -257,6 +263,10 @@ export {
|
|
|
257
263
|
REVERSE_CHANNEL_TIMEOUT_CLASS,
|
|
258
264
|
REVERSE_REQUEST_TIMEOUT_MS,
|
|
259
265
|
SCHEMA_EMULATION_TAIL_CHARS,
|
|
266
|
+
SET_MODEL_ERROR_CODES,
|
|
267
|
+
SET_MODEL_NOT_ACTIVE_CODE,
|
|
268
|
+
SET_MODEL_REQUEST_TIMEOUT_MS,
|
|
269
|
+
SET_MODEL_STAGE_TIMEOUT_MS,
|
|
260
270
|
SHARED_POOL_KEY,
|
|
261
271
|
STDERR_TAIL_CHARS,
|
|
262
272
|
STDOUT_TAIL_ECHO_CHARS,
|
|
@@ -265,6 +275,7 @@ export {
|
|
|
265
275
|
TAIJI_DATA_DIR_ENV,
|
|
266
276
|
ZCODE_HOST_DB_SUFFIX,
|
|
267
277
|
ZCODE_ISOLATED_DB_SEGMENTS,
|
|
278
|
+
ZCODE_PI_SYNCED_PROVIDER_CONFIG_SEGMENTS,
|
|
268
279
|
abortWithFallback,
|
|
269
280
|
aggregateUsage,
|
|
270
281
|
armEngineSelfDestruct,
|
|
@@ -282,6 +293,7 @@ export {
|
|
|
282
293
|
createUiChannelRegistry,
|
|
283
294
|
engineConversationUnsupportedError,
|
|
284
295
|
engineProtocolMismatchError,
|
|
296
|
+
engineSetModelUnsupportedError,
|
|
285
297
|
engineTimeoutDetail,
|
|
286
298
|
errorResponseFrameSchema,
|
|
287
299
|
eventsToSessionView,
|
package/dist/journal-io.d.cts
CHANGED
package/dist/journal-io.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { T as Turn, a as AgentUsageTotal, A as AgentEvent, S as SessionView, E as EngineHandleData, R as ReplayedTurn } from './contract-types-
|
|
1
|
+
import { T as Turn, a as AgentUsageTotal, A as AgentEvent, S as SessionView, E as EngineHandleData, R as ReplayedTurn } from './contract-types-jSa1g28F.cjs';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* reducer 的 record 视图(core ExecutionRecord 的结构子集:reducer 只触碰这四个字段)。
|
package/dist/journal-replay.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { T as Turn, a as AgentUsageTotal, A as AgentEvent, S as SessionView, E as EngineHandleData, R as ReplayedTurn } from './contract-types-
|
|
1
|
+
import { T as Turn, a as AgentUsageTotal, A as AgentEvent, S as SessionView, E as EngineHandleData, R as ReplayedTurn } from './contract-types-jSa1g28F.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* reducer 的 record 视图(core ExecutionRecord 的结构子集:reducer 只触碰这四个字段)。
|
package/dist/kill-chain.cjs
CHANGED
|
@@ -101,6 +101,32 @@ function toErrorMessage(e) {
|
|
|
101
101
|
}
|
|
102
102
|
|
|
103
103
|
// src/protocol/error-codes.ts
|
|
104
|
+
var SET_MODEL_ERROR_CODES = [
|
|
105
|
+
/** 目标模型不在当前进程快照(子进程模型快照冻结于 spawn 时刻——模型本身有效,
|
|
106
|
+
* 下一轮 spawn 现取目录即可用;宿主按「写覆盖意图」处置,设计 §7.2 快照型失败行)。 */
|
|
107
|
+
"engine_model_not_in_snapshot",
|
|
108
|
+
/** 凭据校验失败(子进程 set_model checkAuth 抛错——宿主预检通过后 registry 态漂移
|
|
109
|
+
* 的权威兜底;宿主按校验型失败处置,设计 §7.5 凭据行)。 */
|
|
110
|
+
"engine_credential_missing",
|
|
111
|
+
/** 命令已发出(set_model 可能已执行)但读应答 / get_state 回读无回执、生效值未知
|
|
112
|
+
* (非进程退出情形——退出归无活进程路径;宿主按「写覆盖意图 + 错误应答」处置,
|
|
113
|
+
* 设计 §7.5 回读失败行)。 */
|
|
114
|
+
"engine_state_readback_failed"
|
|
115
|
+
];
|
|
116
|
+
var SET_MODEL_NOT_ACTIVE_CODE = "engine_run_not_active";
|
|
117
|
+
var ENGINE_PROTOCOL_ERROR_CODES = [
|
|
118
|
+
"engine_not_found",
|
|
119
|
+
"engine_protocol_mismatch",
|
|
120
|
+
"engine_capability_unsupported",
|
|
121
|
+
"engine_capability_mismatch",
|
|
122
|
+
"engine_model_unknown",
|
|
123
|
+
"engine_model_mismatch",
|
|
124
|
+
"engine_handshake_timeout",
|
|
125
|
+
"engine_crashed",
|
|
126
|
+
"engine_probe_failed",
|
|
127
|
+
...SET_MODEL_ERROR_CODES,
|
|
128
|
+
SET_MODEL_NOT_ACTIVE_CODE
|
|
129
|
+
];
|
|
104
130
|
var STDOUT_TAIL_ECHO_CHARS = 2e3;
|
|
105
131
|
function truncate(text, max) {
|
|
106
132
|
return text.length <= max ? text : `${text.slice(0, max)}...`;
|
package/dist/kill-chain.d.cts
CHANGED
package/dist/kill-chain.d.ts
CHANGED
package/dist/kill-chain.js
CHANGED
|
@@ -8,9 +8,9 @@ import {
|
|
|
8
8
|
probePidAlive,
|
|
9
9
|
safeKill,
|
|
10
10
|
synthesizeTimeoutOutcome
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-CNCFMPEH.js";
|
|
12
12
|
import "./chunk-PYO3YR7W.js";
|
|
13
|
-
import "./chunk-
|
|
13
|
+
import "./chunk-JZN76I3S.js";
|
|
14
14
|
import "./chunk-NXNNXGTY.js";
|
|
15
15
|
import "./chunk-JSBRDJBE.js";
|
|
16
16
|
export {
|
|
@@ -1,76 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
/** 协议错误对象(error 帧载荷与反向请求错误应答共用形态)。 */
|
|
4
|
-
interface ProtocolError {
|
|
5
|
-
/** 错误码(error-codes.ts 词表 + 其余 engine_* 引擎自报透传)。 */
|
|
6
|
-
code: string;
|
|
7
|
-
/** 人类可读详情。 */
|
|
8
|
-
message: string;
|
|
9
|
-
/** 恢复指引:指向具体下一步(命令 / 配置路径 / 升级动作),非安慰性文案。 */
|
|
10
|
-
recovery: string;
|
|
11
|
-
/** 结构化附参(如 engine_protocol_mismatch 的双方版本)。 */
|
|
12
|
-
data?: Record<string, unknown>;
|
|
13
|
-
}
|
|
14
|
-
interface RequestFrame {
|
|
15
|
-
id: number;
|
|
16
|
-
method: string;
|
|
17
|
-
params: unknown;
|
|
18
|
-
}
|
|
19
|
-
interface SuccessResponseFrame {
|
|
20
|
-
id: number | string;
|
|
21
|
-
result: unknown;
|
|
22
|
-
}
|
|
23
|
-
interface ErrorResponseFrame {
|
|
24
|
-
id: number | string;
|
|
25
|
-
error: ProtocolError;
|
|
26
|
-
}
|
|
27
|
-
type ResponseFrame = SuccessResponseFrame | ErrorResponseFrame;
|
|
28
|
-
/** event 通知载荷:runId 关联在途 run;seq 单调递增(基线①结构等价断言对象)。 */
|
|
29
|
-
interface EventNotificationParams {
|
|
30
|
-
runId: string;
|
|
31
|
-
seq: number;
|
|
32
|
-
event: AgentEvent;
|
|
33
|
-
}
|
|
34
|
-
interface NotificationFrame {
|
|
35
|
-
method: "event";
|
|
36
|
-
params: EventNotificationParams;
|
|
37
|
-
}
|
|
38
|
-
interface ReverseRequestFrame {
|
|
39
|
-
id: string;
|
|
40
|
-
method: string;
|
|
41
|
-
params: unknown;
|
|
42
|
-
}
|
|
43
|
-
/** 反向请求的应答(core → 引擎,沿 ResponseFrame 通道回传;id = 反向请求 id 原样)。 */
|
|
44
|
-
type ReverseResponseResult =
|
|
45
|
-
/** 数据面类:处理确认。 */
|
|
46
|
-
{
|
|
47
|
-
ok: true;
|
|
48
|
-
}
|
|
49
|
-
/** 人机交互类(askUser)两阶段第一阶段:已受理,结果异步到达(R9-2)。 */
|
|
50
|
-
| {
|
|
51
|
-
ack: true;
|
|
52
|
-
}
|
|
53
|
-
/** 未实现或宿主未知的通道(宽容语义③:由 askUser 语境泛化到全通道——宿主对未知 host/* 通道回 unsupported,引擎自行降级)。 */
|
|
54
|
-
| {
|
|
55
|
-
unsupported: true;
|
|
56
|
-
};
|
|
57
|
-
/** ① 请求:有数字 id + method + params,且无 result/error(与②应答区分)。 */
|
|
58
|
-
declare function isRequestFrame(frame: unknown): frame is RequestFrame;
|
|
59
|
-
/** ② 应答:有 id(number|string)且 result/error 二选一。 */
|
|
60
|
-
declare function isResponseFrame(frame: unknown): frame is ResponseFrame;
|
|
61
|
-
/** ③ 通知:无 id,method === "event",params 含 runId/seq/event。 */
|
|
62
|
-
declare function isNotificationFrame(frame: unknown): frame is NotificationFrame;
|
|
63
|
-
/** ④ 反向请求:有字符串 id + host/* method + params(与①的区别 = id 形态与 method 前缀)。 */
|
|
64
|
-
declare function isReverseRequestFrame(frame: unknown): frame is ReverseRequestFrame;
|
|
1
|
+
import { M as ModelRef, d as EngineCapabilities, f as ModelCatalogEntry, b as AgentCallOpts, e as ResumeAnchor, E as EngineHandleData, P as ProbeReport, c as AgentOutcome, S as SessionView } from './contract-types-jSa1g28F.cjs';
|
|
65
2
|
|
|
66
3
|
/**
|
|
67
|
-
* 正向方法名联合(恰好
|
|
4
|
+
* 正向方法名联合(恰好 10 个;PROTOCOL_METHODS 常量数组与之同源互证)。
|
|
68
5
|
* [H1] `interact` 成员已随 chat-run 统一退役(docs/architecture/subagent-chat-run-unification.md
|
|
69
6
|
* §3.3 D5:续聊轮统一为「新 run + resume 锚点」,U5 删除)。
|
|
7
|
+
* [subagent-model-switch] `setModel` 为执行中模型热切换方法(capabilities.setModel
|
|
8
|
+
* 位门控;消费点 = 宿主发送前预检,位不支持不发调用)。
|
|
70
9
|
*/
|
|
71
|
-
type ProtocolMethod = "initialize" | "probe" | "run" | "cancel" | "read" | "listModels" | "validateModel" | "dispose" | "ping";
|
|
10
|
+
type ProtocolMethod = "initialize" | "probe" | "run" | "cancel" | "read" | "listModels" | "validateModel" | "dispose" | "ping" | "setModel";
|
|
72
11
|
/** 方法名全集(运行时顺序化枚举;与 ProtocolMethod 的同源关系由测试断言)。 */
|
|
73
|
-
declare const PROTOCOL_METHODS: readonly ["initialize", "probe", "run", "cancel", "read", "listModels", "validateModel", "dispose", "ping"];
|
|
12
|
+
declare const PROTOCOL_METHODS: readonly ["initialize", "probe", "run", "cancel", "read", "listModels", "validateModel", "dispose", "ping", "setModel"];
|
|
74
13
|
/**
|
|
75
14
|
* run 上下文(RunContext 字段映射的协议承载,设计 §3.3 RunContext 映射表)。
|
|
76
15
|
*/
|
|
@@ -231,6 +170,43 @@ interface PingParams {
|
|
|
231
170
|
interface PingResult {
|
|
232
171
|
pong: true;
|
|
233
172
|
}
|
|
173
|
+
/**
|
|
174
|
+
* [subagent-model-switch §7.3] setModel 参数——RunParams 同级的 run 定向方法
|
|
175
|
+
* (params 以 runId 寻址活跃子进程,对照 cancel)。
|
|
176
|
+
*
|
|
177
|
+
* 语义(引擎侧实装义务,权威 = 设计 §7.3):定位活跃子进程 → 转发 pi 原生
|
|
178
|
+
* `set_model` → 读应答 → get_state 回读生效值 → 应答。请求 model 是**目标意图**
|
|
179
|
+
* (pi 部分模型族会静默替换成同族模型),生效值以应答 effectiveModel 为准。
|
|
180
|
+
* 失败经 error 帧,分型值域 = SET_MODEL_ERROR_CODES 三型
|
|
181
|
+
* (engine_model_not_in_snapshot / engine_credential_missing / engine_state_readback_failed);
|
|
182
|
+
* 目标 run 无活跃子进程(定位时 / 命令写入 / 读应答 / 回读四个竞态窗口内退出——
|
|
183
|
+
* 同一处置)按「无活进程」形态应答 = error 帧 `SET_MODEL_NOT_ACTIVE_CODE`
|
|
184
|
+
* (engine_run_not_active,宿主转纯记账路径,§7.5 子进程已退出行)。
|
|
185
|
+
*
|
|
186
|
+
* 无 thinkingLevel 参数(D5 裁决 M1-1):热切档位由 pi set_model 按新模型档位表
|
|
187
|
+
* 联动重设管辖(生效值以应答 effectiveThinkingLevel 为准);用户显式档位经覆盖
|
|
188
|
+
* 记账在下一轮 spawn 由解析链裁决(§6.2 跨轮档位以解析链为准)。未来引擎真支持
|
|
189
|
+
* 档位热切时走 additive 演进(新增可选参数)。
|
|
190
|
+
*
|
|
191
|
+
* 消费链:U2 宿主编排经 EnginePort 调用(capabilities.setModel='native' 预检通过后);
|
|
192
|
+
* U3 pi 引擎实装;U5 run 级聚合逐成员转发复用同一方法。
|
|
193
|
+
*/
|
|
194
|
+
interface SetModelParams {
|
|
195
|
+
/** 目标 run 的 id(RunParams.runId 同源——引擎以它定位活跃子进程)。 */
|
|
196
|
+
runId: string;
|
|
197
|
+
/** 目标模型 ref(provider + modelId;宿主编排层负责与 canonical ref 目录互校)。 */
|
|
198
|
+
model: ModelRef;
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* [subagent-model-switch §7.3] setModel 应答——**回读生效值**(get_state 同源读回,
|
|
202
|
+
* 非命令应答转述;同族替换时 effectiveModel ≠ 请求 model)。
|
|
203
|
+
*/
|
|
204
|
+
interface SetModelResult {
|
|
205
|
+
/** 生效模型 ref(pi 子进程活状态读回)。 */
|
|
206
|
+
effectiveModel: ModelRef;
|
|
207
|
+
/** 生效 thinking 档位(pi set_model 联动重设后的实际档位)。 */
|
|
208
|
+
effectiveThinkingLevel: string;
|
|
209
|
+
}
|
|
234
210
|
/** 方法 → params 类型映射。 */
|
|
235
211
|
interface ProtocolParamsMap {
|
|
236
212
|
initialize: InitializeParams;
|
|
@@ -242,6 +218,7 @@ interface ProtocolParamsMap {
|
|
|
242
218
|
validateModel: ValidateModelParams;
|
|
243
219
|
dispose: DisposeParams;
|
|
244
220
|
ping: PingParams;
|
|
221
|
+
setModel: SetModelParams;
|
|
245
222
|
}
|
|
246
223
|
/** 方法 → result 类型映射。 */
|
|
247
224
|
interface ProtocolResultMap {
|
|
@@ -254,58 +231,7 @@ interface ProtocolResultMap {
|
|
|
254
231
|
validateModel: ValidateModelResult;
|
|
255
232
|
dispose: DisposeResult;
|
|
256
233
|
ping: PingResult;
|
|
234
|
+
setModel: SetModelResult;
|
|
257
235
|
}
|
|
258
236
|
|
|
259
|
-
|
|
260
|
-
declare const ENGINE_PROTOCOL_ERROR_CODES: readonly ["engine_not_found", "engine_protocol_mismatch", "engine_capability_unsupported", "engine_capability_mismatch", "engine_model_unknown", "engine_model_mismatch", "engine_handshake_timeout", "engine_crashed", "engine_probe_failed"];
|
|
261
|
-
type EngineProtocolErrorCode = (typeof ENGINE_PROTOCOL_ERROR_CODES)[number];
|
|
262
|
-
/** unknown → 协议错误码收窄(外部输入携带错误码时的运行时 guard;其余 engine_* 走透传)。 */
|
|
263
|
-
declare function isEngineProtocolErrorCode(value: unknown): value is EngineProtocolErrorCode;
|
|
264
|
-
/** 其余引擎自报错误码的前缀契约(透传面;core 不解释文案)。 */
|
|
265
|
-
declare const ENGINE_ERROR_CODE_PREFIX = "engine_";
|
|
266
|
-
declare function isEngineErrorPassthroughCode(value: string): boolean;
|
|
267
|
-
|
|
268
|
-
/**
|
|
269
|
-
* 结构化引擎错误(message 恒为 `<code>: <detail>` 前缀格式——AgentOutcome.error 与
|
|
270
|
-
* 协议 error 帧共用的错误码前缀约定);recovery 指向恢复动作。
|
|
271
|
-
* toStructured() 产出即协议 ProtocolError 形态(error 帧载荷直用)。
|
|
272
|
-
*/
|
|
273
|
-
declare class EngineSdkError extends Error {
|
|
274
|
-
readonly code: string;
|
|
275
|
-
readonly recovery: string;
|
|
276
|
-
readonly data?: Record<string, unknown>;
|
|
277
|
-
constructor(code: string, detail: string, recovery: string, data?: Record<string, unknown>);
|
|
278
|
-
/** 协议 error 帧载荷投影。 */
|
|
279
|
-
toStructured(): ProtocolError;
|
|
280
|
-
}
|
|
281
|
-
declare function engineProtocolMismatchError(engineVersion: number): EngineSdkError;
|
|
282
|
-
/**
|
|
283
|
-
* 引擎 conversation 位拒绝的具名错误([modeless 波2] 语义:无 resume 续聊通道的
|
|
284
|
-
* 引擎,message 续聊资格被拒——manifest conversation 能力轴消费;[modeless 波5
|
|
285
|
-
* 收尾] core capability-gate 的显式参数分支随派发参数删除退役,本构造器消费方 =
|
|
286
|
-
* 引擎侧 resume gate(assertChatConversationSupported)与 message 资格门)。
|
|
287
|
-
* 文案契约:错误码 engine_capability_unsupported + 「换引擎续聊 / 修 manifest /
|
|
288
|
-
* 升级引擎包」恢复指引,两侧一致防漂移。
|
|
289
|
-
*/
|
|
290
|
-
declare function engineConversationUnsupportedError(engineId: string): EngineSdkError;
|
|
291
|
-
/**
|
|
292
|
-
* resume 会话形态(run.params.resume——唯一会话形态键)派发前的同步 gate:
|
|
293
|
-
* manifest conversation 位 unsupported 即抛 engineConversationUnsupportedError
|
|
294
|
-
* ——进程/record 创建前同步拒(A6 方向防御:manifest/实装漂移时引擎侧自拒,
|
|
295
|
-
* 与 core capability-gate 同一能力位,防两侧判据漂移)。[modeless 波2] 协议
|
|
296
|
-
* task 的 conversation 键已删,本 gate 只对 resume 形态键生效。
|
|
297
|
-
*/
|
|
298
|
-
declare function assertChatConversationSupported(engineId: string, capabilities: Pick<EngineCapabilities, "conversation">): void;
|
|
299
|
-
/** stdout 尾部回显上限(engine_timeout / engine_run_failed 的错误规格载体系数)。 */
|
|
300
|
-
declare const STDOUT_TAIL_ECHO_CHARS = 2000;
|
|
301
|
-
/** engine_timeout 的恢复指引(kill-chain 超时杀链收尾文案)。 */
|
|
302
|
-
declare const ENGINE_TIMEOUT_RECOVERY: string;
|
|
303
|
-
/**
|
|
304
|
-
* engine_timeout 的 outcome.error 文案:含 stdout 尾部 2000 字 + 恢复指引
|
|
305
|
-
* (kill-chain synthesizeTimeoutOutcome 消费;与 core errors.ts engineTimeoutDetail 逐字等价)。
|
|
306
|
-
*/
|
|
307
|
-
declare function engineTimeoutDetail(stdoutTail: string): string;
|
|
308
|
-
/** schema_emulation_failed 的终报文案(宿主编排层「重试一次仍失败」后消费)。 */
|
|
309
|
-
declare function schemaEmulationFailedDetail(error: string, tail: string): string;
|
|
310
|
-
|
|
311
|
-
export { type ValidateModelResult as A, assertChatConversationSupported as B, type CancelParams as C, type DisposeParams as D, EngineSdkError as E, engineConversationUnsupportedError as F, engineProtocolMismatchError as G, engineTimeoutDetail as H, type InitializeResult as I, isEngineErrorPassthroughCode as J, isEngineProtocolErrorCode as K, type ListModelsParams as L, isNotificationFrame as M, type NotificationFrame as N, isRequestFrame as O, PROTOCOL_METHODS as P, isResponseFrame as Q, type RunContextParams as R, STDOUT_TAIL_ECHO_CHARS as S, isReverseRequestFrame as T, schemaEmulationFailedDetail as U, type ValidateModelParams as V, type InitializeParams as a, type CancelResult as b, type DisposeResult as c, ENGINE_ERROR_CODE_PREFIX as d, ENGINE_PROTOCOL_ERROR_CODES as e, ENGINE_TIMEOUT_RECOVERY as f, type EngineProtocolErrorCode as g, type ErrorResponseFrame as h, type EventNotificationParams as i, type ListModelsResult as j, type PingParams as k, type PingResult as l, type ProbeParams as m, type ProtocolError as n, type ProtocolMethod as o, type ProtocolParamsMap as p, type ProtocolResultMap as q, type ReadParams as r, type RequestFrame as s, type ResponseFrame as t, type ReverseRequestFrame as u, type ReverseResponseResult as v, type RunParams as w, type RunResult as x, type RunResumeParams as y, type SuccessResponseFrame as z };
|
|
237
|
+
export { type CancelParams as C, type DisposeParams as D, type InitializeResult as I, type ListModelsParams as L, PROTOCOL_METHODS as P, type RunContextParams as R, type SetModelParams as S, type ValidateModelParams as V, type SetModelResult as a, type InitializeParams as b, type CancelResult as c, type DisposeResult as d, type ListModelsResult as e, type PingParams as f, type PingResult as g, type ProbeParams as h, type ProtocolMethod as i, type ProtocolParamsMap as j, type ProtocolResultMap as k, type ReadParams as l, type RunParams as m, type RunResult as n, type RunResumeParams as o, type ValidateModelResult as p };
|