@linnlabs/linnkit 0.34.0 → 0.35.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +9 -0
- package/dist/cli.cjs +1 -0
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +1 -0
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +9 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +9 -4
- package/dist/index.js.map +1 -1
- package/dist/quickstart.cjs +1 -0
- package/dist/quickstart.cjs.map +1 -1
- package/dist/quickstart.js +1 -0
- package/dist/quickstart.js.map +1 -1
- package/dist/runtime-kernel/child-runs/childRunInvoker.d.cts +5 -0
- package/dist/runtime-kernel/child-runs/childRunInvoker.d.ts +5 -0
- package/dist/runtime-kernel/run-supervisor/definitions/runSupervisorContracts.d.cts +1 -0
- package/dist/runtime-kernel/run-supervisor/definitions/runSupervisorContracts.d.ts +1 -0
- package/dist/runtime-kernel.cjs +9 -4
- package/dist/runtime-kernel.cjs.map +1 -1
- package/dist/runtime-kernel.js +9 -4
- package/dist/runtime-kernel.js.map +1 -1
- package/dist/testkit.cjs +9 -4
- package/dist/testkit.cjs.map +1 -1
- package/dist/testkit.js +9 -4
- package/dist/testkit.js.map +1 -1
- package/docs/integration/child-runs.md +8 -0
- package/package.json +1 -1
|
@@ -55,6 +55,11 @@ interface ChildRunInvokeConfig {
|
|
|
55
55
|
seedHistoryEvents?: RuntimeEvent[];
|
|
56
56
|
maxSteps?: number;
|
|
57
57
|
modelId?: string;
|
|
58
|
+
/** Host 在 child admission 前冻结并持久保存;框架只补原 user-input fact identity。 */
|
|
59
|
+
initialInput?: {
|
|
60
|
+
readonly turnId: string;
|
|
61
|
+
readonly request: AgentInvocationRequest;
|
|
62
|
+
};
|
|
58
63
|
/** 由 Host 提供同一 child run 的持久断点与事务 writer;不再使用内存临时图。 */
|
|
59
64
|
persistence?: {
|
|
60
65
|
readonly checkpointer: Checkpointer;
|
|
@@ -55,6 +55,11 @@ interface ChildRunInvokeConfig {
|
|
|
55
55
|
seedHistoryEvents?: RuntimeEvent[];
|
|
56
56
|
maxSteps?: number;
|
|
57
57
|
modelId?: string;
|
|
58
|
+
/** Host 在 child admission 前冻结并持久保存;框架只补原 user-input fact identity。 */
|
|
59
|
+
initialInput?: {
|
|
60
|
+
readonly turnId: string;
|
|
61
|
+
readonly request: AgentInvocationRequest;
|
|
62
|
+
};
|
|
58
63
|
/** 由 Host 提供同一 child run 的持久断点与事务 writer;不再使用内存临时图。 */
|
|
59
64
|
persistence?: {
|
|
60
65
|
readonly checkpointer: Checkpointer;
|
|
@@ -141,6 +141,7 @@ interface RunSupervisor<TRequest extends RunRequestSnapshot = RunRequestSnapshot
|
|
|
141
141
|
readonly expectedExecutionId?: ExecutionId;
|
|
142
142
|
readonly eventBus: EventBus;
|
|
143
143
|
readonly executionId: ExecutionId;
|
|
144
|
+
readonly parentSignal?: AbortSignal;
|
|
144
145
|
}): Promise<RunHandle<TRequest>>;
|
|
145
146
|
claimResume(runId: RunId, interaction: RunResumeInteraction, eventBus: EventBus, parentSignal?: AbortSignal): Promise<RunResumeClaim<TRequest>>;
|
|
146
147
|
runTree(rootRunId: RunId): Promise<never>;
|
|
@@ -141,6 +141,7 @@ interface RunSupervisor<TRequest extends RunRequestSnapshot = RunRequestSnapshot
|
|
|
141
141
|
readonly expectedExecutionId?: ExecutionId;
|
|
142
142
|
readonly eventBus: EventBus;
|
|
143
143
|
readonly executionId: ExecutionId;
|
|
144
|
+
readonly parentSignal?: AbortSignal;
|
|
144
145
|
}): Promise<RunHandle<TRequest>>;
|
|
145
146
|
claimResume(runId: RunId, interaction: RunResumeInteraction, eventBus: EventBus, parentSignal?: AbortSignal): Promise<RunResumeClaim<TRequest>>;
|
|
146
147
|
runTree(rootRunId: RunId): Promise<never>;
|
package/dist/runtime-kernel.cjs
CHANGED
|
@@ -12007,10 +12007,10 @@ var ChildRunInvoker = class {
|
|
|
12007
12007
|
runtimeEventSink,
|
|
12008
12008
|
runtimeEventCommitPort,
|
|
12009
12009
|
seedHistoryEvents,
|
|
12010
|
-
maxSteps = 8,
|
|
12011
12010
|
modelId,
|
|
12012
12011
|
abortSignal
|
|
12013
12012
|
} = config;
|
|
12013
|
+
const maxSteps = config.initialInput?.request.maxSteps ?? config.maxSteps ?? 8;
|
|
12014
12014
|
const childRunId = runId ?? generateRunId();
|
|
12015
12015
|
const internalCheckpointKey = childRunId;
|
|
12016
12016
|
const resolvedParentRunId = parentRunId ?? parentToolContext.runId;
|
|
@@ -12055,7 +12055,8 @@ var ChildRunInvoker = class {
|
|
|
12055
12055
|
if (config.persistence?.expectedRevision !== void 0) {
|
|
12056
12056
|
return this.continueChild(config, childRunId, runtimeConversationId);
|
|
12057
12057
|
}
|
|
12058
|
-
const turnId = generateTurnId();
|
|
12058
|
+
const turnId = config.initialInput?.turnId ?? generateTurnId();
|
|
12059
|
+
if (config.initialInput && (!turnId.trim() || config.initialInput.request.query !== userMessage || config.initialInput.request.promptKey !== agentConfig.promptKey || !config.initialInput.request.model_id)) throw new Error("Child initial input does not match the admitted invocation");
|
|
12059
12060
|
logger17.info(`\u542F\u52A8 child-run: ${agentConfig.id}`, {
|
|
12060
12061
|
conversationId: runtimeConversationId,
|
|
12061
12062
|
checkpointKey: internalCheckpointKey,
|
|
@@ -12072,11 +12073,14 @@ var ChildRunInvoker = class {
|
|
|
12072
12073
|
});
|
|
12073
12074
|
const admittedChildUserInput = runtimeEventSink(childUserInput, "ChildRunInvoker.user_input");
|
|
12074
12075
|
const childModelId = resolveChildRunModelId({
|
|
12075
|
-
explicitModelId: modelId,
|
|
12076
|
+
explicitModelId: config.initialInput?.request.model_id ?? modelId,
|
|
12076
12077
|
agentConfig,
|
|
12077
12078
|
resolveDefaultModelId: () => this.modelResolver.resolveModelId()
|
|
12078
12079
|
});
|
|
12079
|
-
const request = {
|
|
12080
|
+
const request = config.initialInput ? {
|
|
12081
|
+
...config.initialInput.request,
|
|
12082
|
+
currentUserEventId: admittedChildUserInput.id
|
|
12083
|
+
} : {
|
|
12080
12084
|
query: userMessage,
|
|
12081
12085
|
currentUserEventId: admittedChildUserInput.id,
|
|
12082
12086
|
promptKey: agentConfig.promptKey,
|
|
@@ -13987,6 +13991,7 @@ var DefaultRunSupervisor = class {
|
|
|
13987
13991
|
metadata: { ...record.metadata, executionId: input.executionId }
|
|
13988
13992
|
});
|
|
13989
13993
|
const controller = new AbortController();
|
|
13994
|
+
forwardParentAbortSignal(controller, input.parentSignal);
|
|
13990
13995
|
handle.replaceExecutionAbortController(controller, input.executionId);
|
|
13991
13996
|
handle.attachTransportEventBus(input.eventBus);
|
|
13992
13997
|
this.controllers.set(input.runId, controller);
|