@zhushanwen/subagent-engine-sdk 0.2.0 → 0.3.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-A75XDJIC.js → chunk-AIG5LSGK.js} +3 -0
- package/dist/{chunk-ZXEAW25V.js → chunk-BBVZK5DL.js} +1 -4
- package/dist/chunk-EUSM6ZX4.js +10 -0
- package/dist/{chunk-LEOBWKRM.js → chunk-FJT23P7T.js} +1 -1
- package/dist/{chunk-N3RL6OVM.js → chunk-J4G2MXDS.js} +3 -1
- package/dist/{chunk-ZOFFJNJD.js → chunk-LKPVN3N6.js} +1 -1
- package/dist/{chunk-RULLX6C6.js → chunk-LQR73V67.js} +2 -0
- package/dist/{chunk-YFSN3D5N.js → chunk-TGDMOLZU.js} +25 -17
- package/dist/{chunk-PPEPBVCC.js → chunk-WS4WAZVR.js} +1 -1
- package/dist/cli-entry.cjs +3 -1
- package/dist/cli-entry.js +1 -1
- package/dist/{contract-types-sSlgppBC.d.cts → contract-types-ByIFoLrY.d.cts} +18 -34
- package/dist/{contract-types-sSlgppBC.d.ts → contract-types-ByIFoLrY.d.ts} +18 -34
- package/dist/env.cjs +1 -4
- package/dist/env.d.cts +4 -1
- package/dist/env.d.ts +4 -1
- package/dist/env.js +1 -1
- package/dist/{error-codes-Dhss2Kmk.d.ts → error-codes-BUx92qYi.d.ts} +5 -4
- package/dist/{error-codes-DHco5-i_.d.cts → error-codes-DCiilt_8.d.cts} +5 -4
- package/dist/index.cjs +45 -23
- package/dist/index.d.cts +5 -5
- package/dist/index.d.ts +5 -5
- package/dist/index.js +16 -11
- package/dist/journal-io.d.cts +1 -1
- package/dist/journal-io.d.ts +1 -1
- package/dist/journal-replay.cjs +3 -0
- package/dist/journal-replay.d.cts +1 -1
- package/dist/journal-replay.d.ts +1 -1
- package/dist/journal-replay.js +1 -1
- package/dist/kill-chain.d.cts +2 -2
- package/dist/kill-chain.d.ts +2 -2
- package/dist/kill-chain.js +2 -2
- package/dist/node-executor.js +2 -2
- package/dist/port-contract.cjs +3 -0
- package/dist/port-contract.d.cts +41 -8
- package/dist/port-contract.d.ts +41 -8
- package/dist/port-contract.js +3 -1
- package/dist/protocol/index.cjs +26 -18
- package/dist/protocol/index.d.cts +95 -96
- package/dist/protocol/index.d.ts +95 -96
- package/dist/protocol/index.js +4 -4
- package/dist/ui-types.cjs +16 -0
- package/dist/ui-types.d.cts +13 -6
- package/dist/ui-types.d.ts +13 -6
- package/dist/ui-types.js +7 -1
- package/package.json +1 -1
- package/src/cli-entry.ts +6 -1
- package/src/data-dir.ts +3 -2
- package/src/env.ts +4 -4
- package/src/journal-replay.ts +4 -0
- package/src/port-contract.ts +40 -8
- package/src/protocol/contract-types.ts +20 -23
- package/src/protocol/engine-protocol.ts +19 -9
- package/src/protocol/error-codes.ts +7 -6
- package/src/protocol/methods.ts +38 -28
- package/src/protocol/reverse-channels.ts +15 -103
- package/src/protocol/schema.ts +36 -0
- package/src/ui-types.ts +22 -5
- package/dist/chunk-2DIMPZCQ.js +0 -0
package/dist/index.cjs
CHANGED
|
@@ -6612,6 +6612,7 @@ __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
|
+
SHARED_POOL_KEY: () => SHARED_POOL_KEY,
|
|
6615
6616
|
STDERR_TAIL_CHARS: () => STDERR_TAIL_CHARS,
|
|
6616
6617
|
STDOUT_TAIL_ECHO_CHARS: () => STDOUT_TAIL_ECHO_CHARS,
|
|
6617
6618
|
SUPPORTED_PROTOCOL_RANGE: () => SUPPORTED_PROTOCOL_RANGE,
|
|
@@ -6641,7 +6642,6 @@ __export(src_exports, {
|
|
|
6641
6642
|
hostKindOf: () => hostKindOf,
|
|
6642
6643
|
isEngineErrorPassthroughCode: () => isEngineErrorPassthroughCode,
|
|
6643
6644
|
isEngineProtocolErrorCode: () => isEngineProtocolErrorCode,
|
|
6644
|
-
isHostRoundLifecycleParams: () => isHostRoundLifecycleParams,
|
|
6645
6645
|
isHostStreamDeltaParams: () => isHostStreamDeltaParams,
|
|
6646
6646
|
isNotificationFrame: () => isNotificationFrame,
|
|
6647
6647
|
isPidAlive: () => isPidAlive,
|
|
@@ -6650,6 +6650,7 @@ __export(src_exports, {
|
|
|
6650
6650
|
isRequestFrame: () => isRequestFrame,
|
|
6651
6651
|
isResponseFrame: () => isResponseFrame,
|
|
6652
6652
|
isReverseRequestFrame: () => isReverseRequestFrame,
|
|
6653
|
+
isUiResponse: () => isUiResponse,
|
|
6653
6654
|
killChain: () => killChain,
|
|
6654
6655
|
notificationFrameSchema: () => notificationFrameSchema,
|
|
6655
6656
|
parseChannel: () => parseChannel,
|
|
@@ -6672,6 +6673,7 @@ __export(src_exports, {
|
|
|
6672
6673
|
reverseRequestFrameSchema: () => reverseRequestFrameSchema,
|
|
6673
6674
|
rotateStderrLogIfNeeded: () => rotateStderrLogIfNeeded,
|
|
6674
6675
|
runEngineCliEntry: () => runEngineCliEntry,
|
|
6676
|
+
runSessionParamsSchema: () => runSessionParamsSchema,
|
|
6675
6677
|
sanitizeSeg: () => sanitizeSeg,
|
|
6676
6678
|
schemaEmulationFailedDetail: () => schemaEmulationFailedDetail,
|
|
6677
6679
|
sessionIdFromHandle: () => sessionIdFromHandle,
|
|
@@ -6737,7 +6739,6 @@ var PROTOCOL_METHODS = [
|
|
|
6737
6739
|
"probe",
|
|
6738
6740
|
"run",
|
|
6739
6741
|
"cancel",
|
|
6740
|
-
"interact",
|
|
6741
6742
|
"read",
|
|
6742
6743
|
"listModels",
|
|
6743
6744
|
"validateModel",
|
|
@@ -6754,8 +6755,7 @@ var REVERSE_CHANNELS = [
|
|
|
6754
6755
|
"host/poolResolved",
|
|
6755
6756
|
"host/handleReady",
|
|
6756
6757
|
"host/childSpawned",
|
|
6757
|
-
"host/childStateChanged"
|
|
6758
|
-
"host/roundLifecycle"
|
|
6758
|
+
"host/childStateChanged"
|
|
6759
6759
|
];
|
|
6760
6760
|
var REVERSE_CHANNEL_TIMEOUT_CLASS = {
|
|
6761
6761
|
"host/log": "data-plane",
|
|
@@ -6764,7 +6764,6 @@ var REVERSE_CHANNEL_TIMEOUT_CLASS = {
|
|
|
6764
6764
|
"host/handleReady": "data-plane",
|
|
6765
6765
|
"host/childSpawned": "data-plane",
|
|
6766
6766
|
"host/childStateChanged": "data-plane",
|
|
6767
|
-
"host/roundLifecycle": "data-plane",
|
|
6768
6767
|
"host/askUser": "interaction",
|
|
6769
6768
|
"host/permission": "interaction"
|
|
6770
6769
|
};
|
|
@@ -6776,17 +6775,6 @@ function isHostStreamDeltaParams(value) {
|
|
|
6776
6775
|
if (hasRunId === hasRecordId) return false;
|
|
6777
6776
|
return typeof v.delta === "string";
|
|
6778
6777
|
}
|
|
6779
|
-
function isHostRoundLifecycleParams(value) {
|
|
6780
|
-
if (typeof value !== "object" || value === null) return false;
|
|
6781
|
-
const v = value;
|
|
6782
|
-
const hasRunId = typeof v.runId === "string";
|
|
6783
|
-
const hasRecordId = typeof v.recordId === "string";
|
|
6784
|
-
if (hasRunId === hasRecordId) return false;
|
|
6785
|
-
if (v.phase === "settled" || v.phase === "idle") return true;
|
|
6786
|
-
if (v.phase !== "failed") return false;
|
|
6787
|
-
const err = v.error;
|
|
6788
|
-
return typeof err === "object" && err !== null && typeof err.code === "string" && typeof err.message === "string";
|
|
6789
|
-
}
|
|
6790
6778
|
|
|
6791
6779
|
// src/protocol/error-codes.ts
|
|
6792
6780
|
var ENGINE_PROTOCOL_ERROR_CODES = [
|
|
@@ -6838,7 +6826,7 @@ function engineProtocolMismatchError(engineVersion) {
|
|
|
6838
6826
|
function engineConversationUnsupportedError(engineId) {
|
|
6839
6827
|
return new EngineSdkError(
|
|
6840
6828
|
"engine_capability_unsupported",
|
|
6841
|
-
`engine '${engineId}' \u4E0D\u652F\u6301
|
|
6829
|
+
`engine '${engineId}' \u4E0D\u652F\u6301 resume \u7EED\u804A\uFF08capabilities.conversation = 'unsupported'\uFF0Cmanifest \u65E0 conversation gate \u4F4D\uFF09`,
|
|
6842
6830
|
`\u53BB\u6389 conversation \u53C2\u6570\uFF08\u4E00\u6B21\u6027\u4EFB\u52A1\u9ED8\u8BA4\u5F62\u6001\uFF09\uFF0C\u6216\u4FEE manifest capabilities / \u5347\u7EA7\u5F15\u64CE\u5305\uFF08\u82E5\u5F15\u64CE\u5B9E\u9645\u652F\u6301\u8BE5\u80FD\u529B\uFF09`,
|
|
6843
6831
|
{ engineId, capability: "conversation", declared: "unsupported" }
|
|
6844
6832
|
);
|
|
@@ -6939,6 +6927,7 @@ var notificationFrameSchema = {
|
|
|
6939
6927
|
"turn_end",
|
|
6940
6928
|
"message_end",
|
|
6941
6929
|
"compaction",
|
|
6930
|
+
"activity",
|
|
6942
6931
|
"error"
|
|
6943
6932
|
]
|
|
6944
6933
|
}
|
|
@@ -6977,6 +6966,27 @@ var FORBIDDEN_CREDENTIAL_KEY_FRAGMENTS = [
|
|
|
6977
6966
|
"secret"
|
|
6978
6967
|
];
|
|
6979
6968
|
var REVERSE_CHANNEL_NAMES = REVERSE_CHANNELS;
|
|
6969
|
+
var runSessionParamsSchema = {
|
|
6970
|
+
$schema: "http://json-schema.org/draft-07/schema#",
|
|
6971
|
+
title: "EngineRunSessionParams",
|
|
6972
|
+
type: "object",
|
|
6973
|
+
additionalProperties: false,
|
|
6974
|
+
required: ["recordId"],
|
|
6975
|
+
properties: {
|
|
6976
|
+
recordId: { type: "string" },
|
|
6977
|
+
resume: {
|
|
6978
|
+
type: "object",
|
|
6979
|
+
additionalProperties: false,
|
|
6980
|
+
required: ["sessionRef", "poolKey"],
|
|
6981
|
+
properties: {
|
|
6982
|
+
// ResumeAnchor.sessionRef = Record<string, string>(引擎定位键值对)
|
|
6983
|
+
sessionRef: { type: "object", additionalProperties: { type: "string" } },
|
|
6984
|
+
poolKey: { type: "string" },
|
|
6985
|
+
journalPath: { type: "string" }
|
|
6986
|
+
}
|
|
6987
|
+
}
|
|
6988
|
+
}
|
|
6989
|
+
};
|
|
6980
6990
|
|
|
6981
6991
|
// src/schema-emulation.ts
|
|
6982
6992
|
var import_ajv = __toESM(require_ajv(), 1);
|
|
@@ -7477,6 +7487,9 @@ function updateFromEvent(record, event) {
|
|
|
7477
7487
|
// ── compaction:不产生数据(不变)──
|
|
7478
7488
|
case "compaction":
|
|
7479
7489
|
return;
|
|
7490
|
+
// ── activity:纯活性信号,reducer no-op(协议语义见 contract-types)──
|
|
7491
|
+
case "activity":
|
|
7492
|
+
return;
|
|
7480
7493
|
default: {
|
|
7481
7494
|
const _exhaustive = event;
|
|
7482
7495
|
return _exhaustive;
|
|
@@ -7587,6 +7600,13 @@ function resolveJournalPath(dataDir, engineId, poolKey, taskId) {
|
|
|
7587
7600
|
return (0, import_node_path.join)(resolvePoolDir(dataDir, engineId, poolKey), `journal-${sanitizeSeg(taskId)}.jsonl`);
|
|
7588
7601
|
}
|
|
7589
7602
|
|
|
7603
|
+
// src/ui-types.ts
|
|
7604
|
+
function isUiResponse(value) {
|
|
7605
|
+
if (typeof value !== "object" || value === null) return false;
|
|
7606
|
+
const v = value;
|
|
7607
|
+
return typeof v.value === "string" || typeof v.confirmed === "boolean" || v.cancelled === true || v.ack === true;
|
|
7608
|
+
}
|
|
7609
|
+
|
|
7590
7610
|
// src/ui-channels.ts
|
|
7591
7611
|
var NUL = "\0";
|
|
7592
7612
|
function normalizeChannelName(markerLiteral) {
|
|
@@ -7690,10 +7710,7 @@ var ENGINE_ENV_DENY_LIST = [
|
|
|
7690
7710
|
"XYZ_RUNTIME_TOKEN",
|
|
7691
7711
|
"XYZ_AGENT_API_KEY",
|
|
7692
7712
|
"XYZ_SUBAGENT_RELAY_SESSION_ID",
|
|
7693
|
-
"XYZ_SUBAGENT_RELAY_RECORD_ID"
|
|
7694
|
-
"XYZ_SUBAGENT_RELAY_STDIN",
|
|
7695
|
-
"XYZ_SUBAGENT_RELAY_STDOUT",
|
|
7696
|
-
"XYZ_SUBAGENT_RELAY_STDERR"
|
|
7713
|
+
"XYZ_SUBAGENT_RELAY_RECORD_ID"
|
|
7697
7714
|
];
|
|
7698
7715
|
var ENGINE_ENV_L0_INFRA_KEYS = [
|
|
7699
7716
|
"XYZ_AGENT_DATA_DIR",
|
|
@@ -8222,6 +8239,7 @@ function parseLine(trimmed) {
|
|
|
8222
8239
|
}
|
|
8223
8240
|
|
|
8224
8241
|
// src/port-contract.ts
|
|
8242
|
+
var SHARED_POOL_KEY = "shared";
|
|
8225
8243
|
function parseCtxModel(ref) {
|
|
8226
8244
|
if (ref === void 0 || ref.trim() === "") return void 0;
|
|
8227
8245
|
const slash = ref.indexOf("/");
|
|
@@ -8237,8 +8255,10 @@ function runEngineCliEntry(opts) {
|
|
|
8237
8255
|
const server = opts.server;
|
|
8238
8256
|
configureLoggerSink({
|
|
8239
8257
|
log(level, component, message, data) {
|
|
8240
|
-
|
|
8258
|
+
if (level !== "debug") {
|
|
8259
|
+
process.stderr.write(`[${level}] [${component}] ${message}${data !== void 0 ? ` ${JSON.stringify(data)}` : ""}
|
|
8241
8260
|
`);
|
|
8261
|
+
}
|
|
8242
8262
|
void server.reverseRequest("host/log", { level, component, message }).catch(() => void 0);
|
|
8243
8263
|
}
|
|
8244
8264
|
});
|
|
@@ -8300,6 +8320,7 @@ function runEngineCliEntry(opts) {
|
|
|
8300
8320
|
REVERSE_CHANNEL_TIMEOUT_CLASS,
|
|
8301
8321
|
REVERSE_REQUEST_TIMEOUT_MS,
|
|
8302
8322
|
SCHEMA_EMULATION_TAIL_CHARS,
|
|
8323
|
+
SHARED_POOL_KEY,
|
|
8303
8324
|
STDERR_TAIL_CHARS,
|
|
8304
8325
|
STDOUT_TAIL_ECHO_CHARS,
|
|
8305
8326
|
SUPPORTED_PROTOCOL_RANGE,
|
|
@@ -8329,7 +8350,6 @@ function runEngineCliEntry(opts) {
|
|
|
8329
8350
|
hostKindOf,
|
|
8330
8351
|
isEngineErrorPassthroughCode,
|
|
8331
8352
|
isEngineProtocolErrorCode,
|
|
8332
|
-
isHostRoundLifecycleParams,
|
|
8333
8353
|
isHostStreamDeltaParams,
|
|
8334
8354
|
isNotificationFrame,
|
|
8335
8355
|
isPidAlive,
|
|
@@ -8338,6 +8358,7 @@ function runEngineCliEntry(opts) {
|
|
|
8338
8358
|
isRequestFrame,
|
|
8339
8359
|
isResponseFrame,
|
|
8340
8360
|
isReverseRequestFrame,
|
|
8361
|
+
isUiResponse,
|
|
8341
8362
|
killChain,
|
|
8342
8363
|
notificationFrameSchema,
|
|
8343
8364
|
parseChannel,
|
|
@@ -8360,6 +8381,7 @@ function runEngineCliEntry(opts) {
|
|
|
8360
8381
|
reverseRequestFrameSchema,
|
|
8361
8382
|
rotateStderrLogIfNeeded,
|
|
8362
8383
|
runEngineCliEntry,
|
|
8384
|
+
runSessionParamsSchema,
|
|
8363
8385
|
sanitizeSeg,
|
|
8364
8386
|
schemaEmulationFailedDetail,
|
|
8365
8387
|
sessionIdFromHandle,
|
package/dist/index.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { CANCEL_SETTLE_GRACE_MS, CRASH_REBUILD_BACKOFF_MS, CRASH_REBUILD_MAX_ATTEMPTS, CancelParams, CancelResult, DisposeParams, DisposeResult, ENGINE_EVENT_COALESCE_DEFAULT, ENGINE_EVENT_COALESCE_ENV, ENGINE_PROTOCOL_SCHEMAS, ENGINE_PROTOCOL_VERSION, FORBIDDEN_CREDENTIAL_KEY_FRAGMENTS, HANDSHAKE_TIMEOUT_MS, HostAskUserParams, HostAskUserResult, HostChildSpawnedParams, HostChildStateChangedParams, HostHandleReadyParams, HostLogParams, HostPermissionParams, HostPermissionResult, HostPoolResolvedParams,
|
|
2
|
-
export { A as AnyFrame, E as ENGINE_ERROR_CODE_PREFIX, a as ENGINE_PROTOCOL_ERROR_CODES, b as ENGINE_TIMEOUT_RECOVERY, c as EngineProtocolErrorCode, d 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 STDOUT_TAIL_ECHO_CHARS, j as SuccessResponseFrame, k as assertChatConversationSupported, l as engineConversationUnsupportedError, m as engineProtocolMismatchError, n as engineTimeoutDetail, o as isEngineErrorPassthroughCode, p as isEngineProtocolErrorCode, q as isNotificationFrame, r as isRequestFrame, s as isResponseFrame, t as isReverseRequestFrame, u as schemaEmulationFailedDetail } from './error-codes-
|
|
3
|
-
export { A as AgentCallOpts, a as AgentEvent, b as AgentFailureKind, c as AgentOutcome, d as AgentOutcomeUsage, e as AgentUsage, f as AgentUsageTotal, g as AssertMutuallyAssignable, E as EngineCapabilities, h as EngineHandleData, I as
|
|
1
|
+
export { CANCEL_SETTLE_GRACE_MS, CRASH_REBUILD_BACKOFF_MS, CRASH_REBUILD_MAX_ATTEMPTS, CancelParams, CancelResult, DisposeParams, DisposeResult, ENGINE_EVENT_COALESCE_DEFAULT, ENGINE_EVENT_COALESCE_ENV, ENGINE_PROTOCOL_SCHEMAS, ENGINE_PROTOCOL_VERSION, FORBIDDEN_CREDENTIAL_KEY_FRAGMENTS, HANDSHAKE_TIMEOUT_MS, HostAskUserParams, HostAskUserResult, HostChildSpawnedParams, HostChildStateChangedParams, HostHandleReadyParams, HostLogParams, HostPermissionParams, HostPermissionResult, HostPoolResolvedParams, HostStreamDeltaParams, InitializeParams, InitializeResult, ListModelsParams, ListModelsResult, PROTOCOL_METHODS, PingParams, PingResult, ProbeParams, ProtocolMethod, ProtocolParamsMap, ProtocolResultMap, REVERSE_CHANNELS, REVERSE_CHANNEL_NAMES, REVERSE_CHANNEL_TIMEOUT_CLASS, REVERSE_REQUEST_TIMEOUT_MS, ReadParams, ReverseChannel, ReverseChannelParamsMap, ReverseChannelResultMap, ReverseRequestTimeoutClass, RunContextParams, RunParams, RunResult, RunResumeParams, STDERR_TAIL_CHARS, SUPPORTED_PROTOCOL_RANGE, ValidateModelParams, ValidateModelResult, errorResponseFrameSchema, isHostStreamDeltaParams, isProtocolVersionCompatible, notificationFrameSchema, protocolErrorSchema, requestFrameSchema, reverseRequestFrameSchema, runSessionParamsSchema, successResponseFrameSchema } from './protocol/index.cjs';
|
|
2
|
+
export { A as AnyFrame, E as ENGINE_ERROR_CODE_PREFIX, a as ENGINE_PROTOCOL_ERROR_CODES, b as ENGINE_TIMEOUT_RECOVERY, c as EngineProtocolErrorCode, d 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 STDOUT_TAIL_ECHO_CHARS, j as SuccessResponseFrame, k as assertChatConversationSupported, l as engineConversationUnsupportedError, m as engineProtocolMismatchError, n as engineTimeoutDetail, o as isEngineErrorPassthroughCode, p as isEngineProtocolErrorCode, q as isNotificationFrame, r as isRequestFrame, s as isResponseFrame, t as isReverseRequestFrame, u as schemaEmulationFailedDetail } from './error-codes-DCiilt_8.cjs';
|
|
3
|
+
export { A as AgentCallOpts, a as AgentEvent, b as AgentFailureKind, c as AgentOutcome, d as AgentOutcomeUsage, e as AgentUsage, f as AgentUsageTotal, g as AssertMutuallyAssignable, E as EngineCapabilities, h as EngineHandleData, I as InternalToolCall, M as ModelCatalogEntry, P as ProbeReport, R as ReplayedTurn, i as ResumeAnchor, S as SessionView, T as ToolCall, j as ToolCallEntry, k as ToolCallResult, l as Turn, W as WorktreeHandle } from './contract-types-ByIFoLrY.cjs';
|
|
4
4
|
export { SCHEMA_EMULATION_TAIL_CHARS, StructuredOutputResult, buildSchemaEmulationSegment, extractAndValidateStructuredOutput } from './schema-emulation.cjs';
|
|
5
5
|
export { ExecutionNestingContext, ExecutionNestingState, NESTED_SPAWN_ENV, NestedSpawnRejectedError, SpawnEnv, assertNotNestedSpawn, buildNestedSpawnEnv } from './nesting-guard.cjs';
|
|
6
6
|
export { CoreLogger, LogLevel, LoggerSink, configureLoggerSink, getLogger, resetLoggerSinkForTests } from './logger.cjs';
|
|
@@ -8,7 +8,7 @@ export { DEFAULT_KILL_GRACE_MS, DEFAULT_NATIVE_INTERRUPT_GRACE_MS, HOST_TIMEOUT_
|
|
|
8
8
|
export { ReplayRecordView, aggregateUsage, createReplayRecord, eventsToSessionView, sessionIdFromHandle, toReplayedTurn, updateFromEvent } from './journal-replay.cjs';
|
|
9
9
|
export { XYZ_DATA_DIR_ENV, resetDataDirWarnForTests, resolveEngineDataDir } from './data-dir.cjs';
|
|
10
10
|
export { resolveEngineDir, resolveEnginesRoot, resolveJournalPath, resolvePoolDir, sanitizeSeg } from './paths.cjs';
|
|
11
|
-
export { UiMethod, UiRequest, UiRequestHandler, UiResponse } from './ui-types.cjs';
|
|
11
|
+
export { UiMethod, UiRequest, UiRequestHandler, UiResponse, isUiResponse } from './ui-types.cjs';
|
|
12
12
|
export { ChannelHandler, ExtensionUiRequestLike, ParsedChannel, UiChannelRegistry, createUiChannelRegistry, parseChannel } from './ui-channels.cjs';
|
|
13
13
|
export { BuildOutboundChildEnvOptions, ENGINE_ENV_DENY_LIST, ENGINE_ENV_L0_INFRA_KEYS, ENGINE_ENV_PREFIXES, EngineChildEnvOptions, EngineRelayEnv, buildEngineChildEnv, buildOutboundChildEnv } from './env.cjs';
|
|
14
14
|
export { DEFAULT_ENGINE_HOST_REQUEST_TIMEOUT_MS, ENGINE_HOST_REQUEST_TIMEOUT_ENV, EngineChildEnv, EngineSelfDestructOptions, ReverseRequestClock, SpawnEngineChildOptions, armEngineSelfDestruct, pumpNdjsonLines, spawnEngineChild } from './spawn.cjs';
|
|
@@ -18,6 +18,6 @@ export { RELAY_ENV_NODE, RELAY_ENV_RECORD_ID, RELAY_ENV_SCRIPT, RELAY_ENV_SESSIO
|
|
|
18
18
|
export { toErrorMessage } from './error-message.cjs';
|
|
19
19
|
export { BestEffortLevel, bestEffort } from './best-effort.cjs';
|
|
20
20
|
export { replayJournal } from './journal-io.cjs';
|
|
21
|
-
export { EngineAgentCallOpts, EngineCtxModel, EngineHandle, EnginePort, EngineRunResult, EngineStream, RunContext, parseCtxModel } from './port-contract.cjs';
|
|
21
|
+
export { EngineAgentCallOpts, EngineCtxModel, EngineHandle, EnginePort, EngineRunResult, EngineStream, RunContext, SHARED_POOL_KEY, parseCtxModel } from './port-contract.cjs';
|
|
22
22
|
export { CliProtocolServerSink, RunEngineCliEntryOptions, runEngineCliEntry } from './cli-entry.cjs';
|
|
23
23
|
import 'node:child_process';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { CANCEL_SETTLE_GRACE_MS, CRASH_REBUILD_BACKOFF_MS, CRASH_REBUILD_MAX_ATTEMPTS, CancelParams, CancelResult, DisposeParams, DisposeResult, ENGINE_EVENT_COALESCE_DEFAULT, ENGINE_EVENT_COALESCE_ENV, ENGINE_PROTOCOL_SCHEMAS, ENGINE_PROTOCOL_VERSION, FORBIDDEN_CREDENTIAL_KEY_FRAGMENTS, HANDSHAKE_TIMEOUT_MS, HostAskUserParams, HostAskUserResult, HostChildSpawnedParams, HostChildStateChangedParams, HostHandleReadyParams, HostLogParams, HostPermissionParams, HostPermissionResult, HostPoolResolvedParams,
|
|
2
|
-
export { A as AnyFrame, E as ENGINE_ERROR_CODE_PREFIX, a as ENGINE_PROTOCOL_ERROR_CODES, b as ENGINE_TIMEOUT_RECOVERY, c as EngineProtocolErrorCode, d 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 STDOUT_TAIL_ECHO_CHARS, j as SuccessResponseFrame, k as assertChatConversationSupported, l as engineConversationUnsupportedError, m as engineProtocolMismatchError, n as engineTimeoutDetail, o as isEngineErrorPassthroughCode, p as isEngineProtocolErrorCode, q as isNotificationFrame, r as isRequestFrame, s as isResponseFrame, t as isReverseRequestFrame, u as schemaEmulationFailedDetail } from './error-codes-
|
|
3
|
-
export { A as AgentCallOpts, a as AgentEvent, b as AgentFailureKind, c as AgentOutcome, d as AgentOutcomeUsage, e as AgentUsage, f as AgentUsageTotal, g as AssertMutuallyAssignable, E as EngineCapabilities, h as EngineHandleData, I as
|
|
1
|
+
export { CANCEL_SETTLE_GRACE_MS, CRASH_REBUILD_BACKOFF_MS, CRASH_REBUILD_MAX_ATTEMPTS, CancelParams, CancelResult, DisposeParams, DisposeResult, ENGINE_EVENT_COALESCE_DEFAULT, ENGINE_EVENT_COALESCE_ENV, ENGINE_PROTOCOL_SCHEMAS, ENGINE_PROTOCOL_VERSION, FORBIDDEN_CREDENTIAL_KEY_FRAGMENTS, HANDSHAKE_TIMEOUT_MS, HostAskUserParams, HostAskUserResult, HostChildSpawnedParams, HostChildStateChangedParams, HostHandleReadyParams, HostLogParams, HostPermissionParams, HostPermissionResult, HostPoolResolvedParams, HostStreamDeltaParams, InitializeParams, InitializeResult, ListModelsParams, ListModelsResult, PROTOCOL_METHODS, PingParams, PingResult, ProbeParams, ProtocolMethod, ProtocolParamsMap, ProtocolResultMap, REVERSE_CHANNELS, REVERSE_CHANNEL_NAMES, REVERSE_CHANNEL_TIMEOUT_CLASS, REVERSE_REQUEST_TIMEOUT_MS, ReadParams, ReverseChannel, ReverseChannelParamsMap, ReverseChannelResultMap, ReverseRequestTimeoutClass, RunContextParams, RunParams, RunResult, RunResumeParams, STDERR_TAIL_CHARS, SUPPORTED_PROTOCOL_RANGE, ValidateModelParams, ValidateModelResult, errorResponseFrameSchema, isHostStreamDeltaParams, isProtocolVersionCompatible, notificationFrameSchema, protocolErrorSchema, requestFrameSchema, reverseRequestFrameSchema, runSessionParamsSchema, successResponseFrameSchema } from './protocol/index.js';
|
|
2
|
+
export { A as AnyFrame, E as ENGINE_ERROR_CODE_PREFIX, a as ENGINE_PROTOCOL_ERROR_CODES, b as ENGINE_TIMEOUT_RECOVERY, c as EngineProtocolErrorCode, d 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 STDOUT_TAIL_ECHO_CHARS, j as SuccessResponseFrame, k as assertChatConversationSupported, l as engineConversationUnsupportedError, m as engineProtocolMismatchError, n as engineTimeoutDetail, o as isEngineErrorPassthroughCode, p as isEngineProtocolErrorCode, q as isNotificationFrame, r as isRequestFrame, s as isResponseFrame, t as isReverseRequestFrame, u as schemaEmulationFailedDetail } from './error-codes-BUx92qYi.js';
|
|
3
|
+
export { A as AgentCallOpts, a as AgentEvent, b as AgentFailureKind, c as AgentOutcome, d as AgentOutcomeUsage, e as AgentUsage, f as AgentUsageTotal, g as AssertMutuallyAssignable, E as EngineCapabilities, h as EngineHandleData, I as InternalToolCall, M as ModelCatalogEntry, P as ProbeReport, R as ReplayedTurn, i as ResumeAnchor, S as SessionView, T as ToolCall, j as ToolCallEntry, k as ToolCallResult, l as Turn, W as WorktreeHandle } from './contract-types-ByIFoLrY.js';
|
|
4
4
|
export { SCHEMA_EMULATION_TAIL_CHARS, StructuredOutputResult, buildSchemaEmulationSegment, extractAndValidateStructuredOutput } from './schema-emulation.js';
|
|
5
5
|
export { ExecutionNestingContext, ExecutionNestingState, NESTED_SPAWN_ENV, NestedSpawnRejectedError, SpawnEnv, assertNotNestedSpawn, buildNestedSpawnEnv } from './nesting-guard.js';
|
|
6
6
|
export { CoreLogger, LogLevel, LoggerSink, configureLoggerSink, getLogger, resetLoggerSinkForTests } from './logger.js';
|
|
@@ -8,7 +8,7 @@ export { DEFAULT_KILL_GRACE_MS, DEFAULT_NATIVE_INTERRUPT_GRACE_MS, HOST_TIMEOUT_
|
|
|
8
8
|
export { ReplayRecordView, aggregateUsage, createReplayRecord, eventsToSessionView, sessionIdFromHandle, toReplayedTurn, updateFromEvent } from './journal-replay.js';
|
|
9
9
|
export { XYZ_DATA_DIR_ENV, resetDataDirWarnForTests, resolveEngineDataDir } from './data-dir.js';
|
|
10
10
|
export { resolveEngineDir, resolveEnginesRoot, resolveJournalPath, resolvePoolDir, sanitizeSeg } from './paths.js';
|
|
11
|
-
export { UiMethod, UiRequest, UiRequestHandler, UiResponse } from './ui-types.js';
|
|
11
|
+
export { UiMethod, UiRequest, UiRequestHandler, UiResponse, isUiResponse } from './ui-types.js';
|
|
12
12
|
export { ChannelHandler, ExtensionUiRequestLike, ParsedChannel, UiChannelRegistry, createUiChannelRegistry, parseChannel } from './ui-channels.js';
|
|
13
13
|
export { BuildOutboundChildEnvOptions, ENGINE_ENV_DENY_LIST, ENGINE_ENV_L0_INFRA_KEYS, ENGINE_ENV_PREFIXES, EngineChildEnvOptions, EngineRelayEnv, buildEngineChildEnv, buildOutboundChildEnv } from './env.js';
|
|
14
14
|
export { DEFAULT_ENGINE_HOST_REQUEST_TIMEOUT_MS, ENGINE_HOST_REQUEST_TIMEOUT_ENV, EngineChildEnv, EngineSelfDestructOptions, ReverseRequestClock, SpawnEngineChildOptions, armEngineSelfDestruct, pumpNdjsonLines, spawnEngineChild } from './spawn.js';
|
|
@@ -18,6 +18,6 @@ export { RELAY_ENV_NODE, RELAY_ENV_RECORD_ID, RELAY_ENV_SCRIPT, RELAY_ENV_SESSIO
|
|
|
18
18
|
export { toErrorMessage } from './error-message.js';
|
|
19
19
|
export { BestEffortLevel, bestEffort } from './best-effort.js';
|
|
20
20
|
export { replayJournal } from './journal-io.js';
|
|
21
|
-
export { EngineAgentCallOpts, EngineCtxModel, EngineHandle, EnginePort, EngineRunResult, EngineStream, RunContext, parseCtxModel } from './port-contract.js';
|
|
21
|
+
export { EngineAgentCallOpts, EngineCtxModel, EngineHandle, EnginePort, EngineRunResult, EngineStream, RunContext, SHARED_POOL_KEY, parseCtxModel } from './port-contract.js';
|
|
22
22
|
export { CliProtocolServerSink, RunEngineCliEntryOptions, runEngineCliEntry } from './cli-entry.js';
|
|
23
23
|
import 'node:child_process';
|
package/dist/index.js
CHANGED
|
@@ -5,11 +5,12 @@ import {
|
|
|
5
5
|
replayJournal
|
|
6
6
|
} from "./chunk-RDH3ZOV6.js";
|
|
7
7
|
import {
|
|
8
|
+
SHARED_POOL_KEY,
|
|
8
9
|
parseCtxModel
|
|
9
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-LQR73V67.js";
|
|
10
11
|
import {
|
|
11
12
|
runEngineCliEntry
|
|
12
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-J4G2MXDS.js";
|
|
13
14
|
import {
|
|
14
15
|
resolveEngineDir,
|
|
15
16
|
resolveEnginesRoot,
|
|
@@ -17,7 +18,9 @@ import {
|
|
|
17
18
|
resolvePoolDir,
|
|
18
19
|
sanitizeSeg
|
|
19
20
|
} from "./chunk-OPMY4G4M.js";
|
|
20
|
-
import
|
|
21
|
+
import {
|
|
22
|
+
isUiResponse
|
|
23
|
+
} from "./chunk-EUSM6ZX4.js";
|
|
21
24
|
import {
|
|
22
25
|
createUiChannelRegistry,
|
|
23
26
|
parseChannel
|
|
@@ -28,7 +31,7 @@ import {
|
|
|
28
31
|
ENGINE_ENV_PREFIXES,
|
|
29
32
|
buildEngineChildEnv,
|
|
30
33
|
buildOutboundChildEnv
|
|
31
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-BBVZK5DL.js";
|
|
32
35
|
import {
|
|
33
36
|
DEFAULT_ENGINE_HOST_REQUEST_TIMEOUT_MS,
|
|
34
37
|
ENGINE_HOST_REQUEST_TIMEOUT_ENV,
|
|
@@ -42,7 +45,7 @@ import {
|
|
|
42
45
|
probeNodeExecutor,
|
|
43
46
|
resetEngineNodeProbeCache,
|
|
44
47
|
resolveEngineNodeLaunch
|
|
45
|
-
} from "./chunk-
|
|
48
|
+
} from "./chunk-LKPVN3N6.js";
|
|
46
49
|
import {
|
|
47
50
|
DEFAULT_STDERR_KEEP_DAYS,
|
|
48
51
|
DEFAULT_STDERR_MAX_BYTES,
|
|
@@ -73,7 +76,6 @@ import {
|
|
|
73
76
|
REVERSE_CHANNEL_NAMES,
|
|
74
77
|
REVERSE_CHANNEL_TIMEOUT_CLASS,
|
|
75
78
|
errorResponseFrameSchema,
|
|
76
|
-
isHostRoundLifecycleParams,
|
|
77
79
|
isHostStreamDeltaParams,
|
|
78
80
|
isNotificationFrame,
|
|
79
81
|
isRequestFrame,
|
|
@@ -83,8 +85,9 @@ import {
|
|
|
83
85
|
protocolErrorSchema,
|
|
84
86
|
requestFrameSchema,
|
|
85
87
|
reverseRequestFrameSchema,
|
|
88
|
+
runSessionParamsSchema,
|
|
86
89
|
successResponseFrameSchema
|
|
87
|
-
} from "./chunk-
|
|
90
|
+
} from "./chunk-TGDMOLZU.js";
|
|
88
91
|
import {
|
|
89
92
|
SCHEMA_EMULATION_TAIL_CHARS,
|
|
90
93
|
buildSchemaEmulationSegment,
|
|
@@ -104,7 +107,7 @@ import {
|
|
|
104
107
|
abortWithFallback,
|
|
105
108
|
killChain,
|
|
106
109
|
synthesizeTimeoutOutcome
|
|
107
|
-
} from "./chunk-
|
|
110
|
+
} from "./chunk-FJT23P7T.js";
|
|
108
111
|
import {
|
|
109
112
|
toErrorMessage
|
|
110
113
|
} from "./chunk-PYO3YR7W.js";
|
|
@@ -132,7 +135,7 @@ import {
|
|
|
132
135
|
isEngineProtocolErrorCode,
|
|
133
136
|
isProtocolVersionCompatible,
|
|
134
137
|
schemaEmulationFailedDetail
|
|
135
|
-
} from "./chunk-
|
|
138
|
+
} from "./chunk-WS4WAZVR.js";
|
|
136
139
|
import {
|
|
137
140
|
aggregateUsage,
|
|
138
141
|
createReplayRecord,
|
|
@@ -140,7 +143,7 @@ import {
|
|
|
140
143
|
sessionIdFromHandle,
|
|
141
144
|
toReplayedTurn,
|
|
142
145
|
updateFromEvent
|
|
143
|
-
} from "./chunk-
|
|
146
|
+
} from "./chunk-AIG5LSGK.js";
|
|
144
147
|
import {
|
|
145
148
|
XYZ_DATA_DIR_ENV,
|
|
146
149
|
resetDataDirWarnForTests,
|
|
@@ -193,6 +196,7 @@ export {
|
|
|
193
196
|
REVERSE_CHANNEL_TIMEOUT_CLASS,
|
|
194
197
|
REVERSE_REQUEST_TIMEOUT_MS,
|
|
195
198
|
SCHEMA_EMULATION_TAIL_CHARS,
|
|
199
|
+
SHARED_POOL_KEY,
|
|
196
200
|
STDERR_TAIL_CHARS,
|
|
197
201
|
STDOUT_TAIL_ECHO_CHARS,
|
|
198
202
|
SUPPORTED_PROTOCOL_RANGE,
|
|
@@ -222,7 +226,6 @@ export {
|
|
|
222
226
|
hostKindOf,
|
|
223
227
|
isEngineErrorPassthroughCode,
|
|
224
228
|
isEngineProtocolErrorCode,
|
|
225
|
-
isHostRoundLifecycleParams,
|
|
226
229
|
isHostStreamDeltaParams,
|
|
227
230
|
isNotificationFrame,
|
|
228
231
|
isPidAlive,
|
|
@@ -231,6 +234,7 @@ export {
|
|
|
231
234
|
isRequestFrame,
|
|
232
235
|
isResponseFrame,
|
|
233
236
|
isReverseRequestFrame,
|
|
237
|
+
isUiResponse,
|
|
234
238
|
killChain,
|
|
235
239
|
notificationFrameSchema,
|
|
236
240
|
parseChannel,
|
|
@@ -253,6 +257,7 @@ export {
|
|
|
253
257
|
reverseRequestFrameSchema,
|
|
254
258
|
rotateStderrLogIfNeeded,
|
|
255
259
|
runEngineCliEntry,
|
|
260
|
+
runSessionParamsSchema,
|
|
256
261
|
sanitizeSeg,
|
|
257
262
|
schemaEmulationFailedDetail,
|
|
258
263
|
sessionIdFromHandle,
|
package/dist/journal-io.d.cts
CHANGED
package/dist/journal-io.d.ts
CHANGED
package/dist/journal-replay.cjs
CHANGED
|
@@ -193,6 +193,9 @@ function updateFromEvent(record, event) {
|
|
|
193
193
|
// ── compaction:不产生数据(不变)──
|
|
194
194
|
case "compaction":
|
|
195
195
|
return;
|
|
196
|
+
// ── activity:纯活性信号,reducer no-op(协议语义见 contract-types)──
|
|
197
|
+
case "activity":
|
|
198
|
+
return;
|
|
196
199
|
default: {
|
|
197
200
|
const _exhaustive = event;
|
|
198
201
|
return _exhaustive;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { l as Turn, f as AgentUsageTotal, a as AgentEvent, S as SessionView, h as EngineHandleData, R as ReplayedTurn } from './contract-types-ByIFoLrY.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 {
|
|
1
|
+
import { l as Turn, f as AgentUsageTotal, a as AgentEvent, S as SessionView, h as EngineHandleData, R as ReplayedTurn } from './contract-types-ByIFoLrY.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* reducer 的 record 视图(core ExecutionRecord 的结构子集:reducer 只触碰这四个字段)。
|
package/dist/journal-replay.js
CHANGED
package/dist/kill-chain.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { S as STDOUT_TAIL_ECHO_CHARS } from './error-codes-
|
|
2
|
-
import { A as AgentCallOpts, c as AgentOutcome } from './contract-types-
|
|
1
|
+
export { S as STDOUT_TAIL_ECHO_CHARS } from './error-codes-DCiilt_8.cjs';
|
|
2
|
+
import { A as AgentCallOpts, c as AgentOutcome } from './contract-types-ByIFoLrY.cjs';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* 可杀子进程的结构形状(Node ChildProcess 的结构子集)。
|
package/dist/kill-chain.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { S as STDOUT_TAIL_ECHO_CHARS } from './error-codes-
|
|
2
|
-
import { A as AgentCallOpts, c as AgentOutcome } from './contract-types-
|
|
1
|
+
export { S as STDOUT_TAIL_ECHO_CHARS } from './error-codes-BUx92qYi.js';
|
|
2
|
+
import { A as AgentCallOpts, c as AgentOutcome } from './contract-types-ByIFoLrY.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* 可杀子进程的结构形状(Node ChildProcess 的结构子集)。
|
package/dist/kill-chain.js
CHANGED
|
@@ -5,11 +5,11 @@ import {
|
|
|
5
5
|
abortWithFallback,
|
|
6
6
|
killChain,
|
|
7
7
|
synthesizeTimeoutOutcome
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-FJT23P7T.js";
|
|
9
9
|
import "./chunk-PYO3YR7W.js";
|
|
10
10
|
import {
|
|
11
11
|
STDOUT_TAIL_ECHO_CHARS
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-WS4WAZVR.js";
|
|
13
13
|
import "./chunk-75QEMUGV.js";
|
|
14
14
|
import "./chunk-JSBRDJBE.js";
|
|
15
15
|
export {
|
package/dist/node-executor.js
CHANGED
|
@@ -4,8 +4,8 @@ import {
|
|
|
4
4
|
probeNodeExecutor,
|
|
5
5
|
resetEngineNodeProbeCache,
|
|
6
6
|
resolveEngineNodeLaunch
|
|
7
|
-
} from "./chunk-
|
|
8
|
-
import "./chunk-
|
|
7
|
+
} from "./chunk-LKPVN3N6.js";
|
|
8
|
+
import "./chunk-WS4WAZVR.js";
|
|
9
9
|
import "./chunk-JSBRDJBE.js";
|
|
10
10
|
export {
|
|
11
11
|
ENGINE_NODE_ENV,
|
package/dist/port-contract.cjs
CHANGED
|
@@ -20,9 +20,11 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
20
20
|
// src/port-contract.ts
|
|
21
21
|
var port_contract_exports = {};
|
|
22
22
|
__export(port_contract_exports, {
|
|
23
|
+
SHARED_POOL_KEY: () => SHARED_POOL_KEY,
|
|
23
24
|
parseCtxModel: () => parseCtxModel
|
|
24
25
|
});
|
|
25
26
|
module.exports = __toCommonJS(port_contract_exports);
|
|
27
|
+
var SHARED_POOL_KEY = "shared";
|
|
26
28
|
function parseCtxModel(ref) {
|
|
27
29
|
if (ref === void 0 || ref.trim() === "") return void 0;
|
|
28
30
|
const slash = ref.indexOf("/");
|
|
@@ -31,5 +33,6 @@ function parseCtxModel(ref) {
|
|
|
31
33
|
}
|
|
32
34
|
// Annotate the CommonJS export names for ESM import in node:
|
|
33
35
|
0 && (module.exports = {
|
|
36
|
+
SHARED_POOL_KEY,
|
|
34
37
|
parseCtxModel
|
|
35
38
|
});
|
package/dist/port-contract.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as AgentCallOpts, h as EngineHandleData, E as EngineCapabilities, P as ProbeReport, a as AgentEvent,
|
|
1
|
+
import { A as AgentCallOpts, h as EngineHandleData, E as EngineCapabilities, P as ProbeReport, a as AgentEvent, i as ResumeAnchor, c as AgentOutcome, S as SessionView } from './contract-types-ByIFoLrY.cjs';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* 引擎进程内全量任务声明 = SDK AgentCallOpts 引擎面子集 + 协议 ctx 还原字段(model/
|
|
@@ -26,7 +26,16 @@ interface EngineCtxModel {
|
|
|
26
26
|
interface EngineStream {
|
|
27
27
|
onDelta(delta: string): void;
|
|
28
28
|
}
|
|
29
|
-
/**
|
|
29
|
+
/**
|
|
30
|
+
* 无隔离池引擎的恒定池 key(pi / zcode 共用;值锚定):两引擎进程内全局一份运行态
|
|
31
|
+
* (pi = PI_CODING_AGENT_DIR 全局一份,zcode = 共享宿主 HOME + journal 固定分组),
|
|
32
|
+
* poolKey 恒本值。core(PI_POOL_KEY / JOURNAL_INITIAL_POOL_KEY)与两引擎包
|
|
33
|
+
* (PI_POOL_KEY / ZCODE_SHARED_POOL_KEY)的等值异名常量一律 = 本常量——**值逐字
|
|
34
|
+
* 不变**(存量 journal 落盘路径与记录含该值分段,改名不改值)。zcode 池化引擎在
|
|
35
|
+
* prepare 期经 ctx.onPoolResolved retarget 到实际池 key,与本占位值不冲突。
|
|
36
|
+
*/
|
|
37
|
+
declare const SHARED_POOL_KEY = "shared";
|
|
38
|
+
/** run 的运行期上下文(core RunContext 结构等价镜像;resume? = 会话形态参数,缺省一次性任务)。 */
|
|
30
39
|
interface RunContext {
|
|
31
40
|
taskId: string;
|
|
32
41
|
poolKey: string;
|
|
@@ -39,6 +48,18 @@ interface RunContext {
|
|
|
39
48
|
from: string;
|
|
40
49
|
reason: string;
|
|
41
50
|
};
|
|
51
|
+
/**
|
|
52
|
+
* [F6] 根 session id(协议 run.params.ctx.sessionRootId 的进程内还原)——pi 引擎
|
|
53
|
+
* relay 归属键 SESSION_ID 的权威来源。additive 可选:宿主缺省不传。
|
|
54
|
+
*/
|
|
55
|
+
sessionRootId?: string;
|
|
56
|
+
/**
|
|
57
|
+
* [Option C 协议化] 权威 subagent session 目录(协议 run.params.ctx.sessionDir 的
|
|
58
|
+
* 进程内还原)——pi 引擎组装 `--session-dir` 的唯一权威值(宿主
|
|
59
|
+
* getSubagentSessionDir 推导,引擎不自推导)。additive 可选:缺省走引擎内
|
|
60
|
+
* [LEGACY] fallback(独立运行/测试形态)。
|
|
61
|
+
*/
|
|
62
|
+
sessionDir?: string;
|
|
42
63
|
onPoolResolved?: (poolKey: string) => void;
|
|
43
64
|
onHandleReady?: (partial: Pick<EngineHandleData, "sessionRef" | "poolKey">) => void;
|
|
44
65
|
/** 一次性子进程 pid 上报(host/childSpawned 载荷形态;ChildProcess 句柄不跨协议面)。 */
|
|
@@ -47,11 +68,24 @@ interface RunContext {
|
|
|
47
68
|
killed: boolean;
|
|
48
69
|
}) => void;
|
|
49
70
|
/**
|
|
50
|
-
*
|
|
51
|
-
*
|
|
52
|
-
|
|
71
|
+
* 子进程退出态上报(host/childStateChanged 载荷形态;SR-4 接线:宿主镜像据此取消
|
|
72
|
+
* 该 pid 的挂起 dialog)。引擎侧只在 exited 相位上报——running 由 onChildSpawned 覆盖。
|
|
73
|
+
*/
|
|
74
|
+
onChildStateChanged?: (p: {
|
|
75
|
+
pid: number;
|
|
76
|
+
recordId: string;
|
|
77
|
+
state: "running" | "exited";
|
|
78
|
+
killed: boolean;
|
|
79
|
+
exitCode?: number;
|
|
80
|
+
signal?: string;
|
|
81
|
+
}) => void;
|
|
82
|
+
/**
|
|
83
|
+
* [H1 U6 终态] resume 续聊参数(协议 run.params.resume 的进程内还原;唯一会话形态
|
|
84
|
+
* 键——原 v1.x `chat` 字段已随键切换退役)。recordId = 轮次关联键与镜像帧锚定键;
|
|
85
|
+
* resume 锚点存在 = 冷续(--session 续写原文件),不存在 = 首轮新建。缺省 =
|
|
86
|
+
* 一次性任务形态。
|
|
53
87
|
*/
|
|
54
|
-
|
|
88
|
+
resume?: {
|
|
55
89
|
recordId: string;
|
|
56
90
|
resume?: ResumeAnchor;
|
|
57
91
|
};
|
|
@@ -71,7 +105,6 @@ interface EnginePort {
|
|
|
71
105
|
force?: boolean;
|
|
72
106
|
}): Promise<ProbeReport>;
|
|
73
107
|
run(task: EngineAgentCallOpts, ctx: RunContext): Promise<EngineRunResult>;
|
|
74
|
-
interact(handle: EngineHandle, action: InteractAction): Promise<InteractResult>;
|
|
75
108
|
read(handle: EngineHandle): Promise<SessionView>;
|
|
76
109
|
listModels?(): Array<{
|
|
77
110
|
id: string;
|
|
@@ -85,4 +118,4 @@ interface EnginePort {
|
|
|
85
118
|
/** ctx.ctxModel("provider/id" canonical 词形)→ EngineCtxModel。 */
|
|
86
119
|
declare function parseCtxModel(ref: string | undefined): EngineCtxModel | undefined;
|
|
87
120
|
|
|
88
|
-
export { type EngineAgentCallOpts, type EngineCtxModel, type EngineHandle, type EnginePort, type EngineRunResult, type EngineStream, type RunContext, parseCtxModel };
|
|
121
|
+
export { type EngineAgentCallOpts, type EngineCtxModel, type EngineHandle, type EnginePort, type EngineRunResult, type EngineStream, type RunContext, SHARED_POOL_KEY, parseCtxModel };
|