@linnlabs/linnkit 0.34.0 → 0.35.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.
Files changed (49) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/cli.cjs +11 -2
  3. package/dist/cli.cjs.map +1 -1
  4. package/dist/cli.js +11 -2
  5. package/dist/cli.js.map +1 -1
  6. package/dist/contracts/agentSpec.d.cts +30 -30
  7. package/dist/contracts/agentSpec.d.ts +30 -30
  8. package/dist/contracts/audit.d.cts +32 -32
  9. package/dist/contracts/audit.d.ts +32 -32
  10. package/dist/contracts/contextPolicy.d.cts +36 -36
  11. package/dist/contracts/contextPolicy.d.ts +36 -36
  12. package/dist/contracts/events.d.cts +1113 -1113
  13. package/dist/contracts/events.d.ts +1113 -1113
  14. package/dist/contracts/execution.d.cts +8 -8
  15. package/dist/contracts/execution.d.ts +8 -8
  16. package/dist/contracts/messages.d.cts +1178 -1178
  17. package/dist/contracts/messages.d.ts +1178 -1178
  18. package/dist/contracts/provider-continuation.d.cts +28 -28
  19. package/dist/contracts/provider-continuation.d.ts +28 -28
  20. package/dist/contracts/sse.d.cts +897 -897
  21. package/dist/contracts/sse.d.ts +897 -897
  22. package/dist/contracts/sub-run-trace-payload.d.cts +26 -26
  23. package/dist/contracts/sub-run-trace-payload.d.ts +26 -26
  24. package/dist/contracts/token-accounting.d.cts +38 -38
  25. package/dist/contracts/token-accounting.d.ts +38 -38
  26. package/dist/index.cjs +19 -6
  27. package/dist/index.cjs.map +1 -1
  28. package/dist/index.js +19 -6
  29. package/dist/index.js.map +1 -1
  30. package/dist/quickstart.cjs +11 -2
  31. package/dist/quickstart.cjs.map +1 -1
  32. package/dist/quickstart.js +11 -2
  33. package/dist/quickstart.js.map +1 -1
  34. package/dist/runtime-kernel/child-runs/childRunInvoker.d.cts +5 -0
  35. package/dist/runtime-kernel/child-runs/childRunInvoker.d.ts +5 -0
  36. package/dist/runtime-kernel/events/agentEvents.d.cts +172 -172
  37. package/dist/runtime-kernel/events/agentEvents.d.ts +172 -172
  38. package/dist/runtime-kernel/run-supervisor/definitions/runSupervisorContracts.d.cts +1 -0
  39. package/dist/runtime-kernel/run-supervisor/definitions/runSupervisorContracts.d.ts +1 -0
  40. package/dist/runtime-kernel.cjs +19 -6
  41. package/dist/runtime-kernel.cjs.map +1 -1
  42. package/dist/runtime-kernel.js +19 -6
  43. package/dist/runtime-kernel.js.map +1 -1
  44. package/dist/testkit.cjs +19 -6
  45. package/dist/testkit.cjs.map +1 -1
  46. package/dist/testkit.js +19 -6
  47. package/dist/testkit.js.map +1 -1
  48. package/docs/integration/child-runs.md +8 -0
  49. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -3980,13 +3980,21 @@ var GraphExecutor = class {
3980
3980
  if (existing) {
3981
3981
  throw new Error(`Graph checkpoint already exists: ${checkpointKey}`);
3982
3982
  }
3983
- this.ephemeralLocals.set(checkpointKey, { ...local });
3983
+ const initialLocal = this.executionCheckpointPort ? {
3984
+ ...local,
3985
+ executorLocal: {
3986
+ ...isRecord4(local.executorLocal) ? local.executorLocal : {},
3987
+ stepCount: 0,
3988
+ maxSteps: options.maxSteps ?? this.config.maxSteps
3989
+ }
3990
+ } : local;
3991
+ this.ephemeralLocals.set(checkpointKey, { ...initialLocal });
3984
3992
  await this.commitCheckpoint(checkpointKey, {
3985
3993
  nodeId,
3986
3994
  ...this.executionCheckpointPort ? { executionStatus: "ready" } : {},
3987
3995
  revision: 1,
3988
3996
  schemaVersion: ENGINE_STATE_SCHEMA_VERSION,
3989
- local: sanitizeCheckpointLocal(local)
3997
+ local: sanitizeCheckpointLocal(initialLocal)
3990
3998
  });
3991
3999
  return this.runUntilYieldQueued(
3992
4000
  checkpointKey,
@@ -13012,10 +13020,10 @@ var ChildRunInvoker = class {
13012
13020
  runtimeEventSink,
13013
13021
  runtimeEventCommitPort,
13014
13022
  seedHistoryEvents,
13015
- maxSteps = 8,
13016
13023
  modelId,
13017
13024
  abortSignal
13018
13025
  } = config;
13026
+ const maxSteps = config.initialInput?.request.maxSteps ?? config.maxSteps ?? 8;
13019
13027
  const childRunId = runId ?? generateRunId();
13020
13028
  const internalCheckpointKey = childRunId;
13021
13029
  const resolvedParentRunId = parentRunId ?? parentToolContext.runId;
@@ -13060,7 +13068,8 @@ var ChildRunInvoker = class {
13060
13068
  if (config.persistence?.expectedRevision !== void 0) {
13061
13069
  return this.continueChild(config, childRunId, runtimeConversationId);
13062
13070
  }
13063
- const turnId = generateTurnId();
13071
+ const turnId = config.initialInput?.turnId ?? generateTurnId();
13072
+ 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");
13064
13073
  logger17.info(`\u542F\u52A8 child-run: ${agentConfig.id}`, {
13065
13074
  conversationId: runtimeConversationId,
13066
13075
  checkpointKey: internalCheckpointKey,
@@ -13077,11 +13086,14 @@ var ChildRunInvoker = class {
13077
13086
  });
13078
13087
  const admittedChildUserInput = runtimeEventSink(childUserInput, "ChildRunInvoker.user_input");
13079
13088
  const childModelId = resolveChildRunModelId({
13080
- explicitModelId: modelId,
13089
+ explicitModelId: config.initialInput?.request.model_id ?? modelId,
13081
13090
  agentConfig,
13082
13091
  resolveDefaultModelId: () => this.modelResolver.resolveModelId()
13083
13092
  });
13084
- const request = {
13093
+ const request = config.initialInput ? {
13094
+ ...config.initialInput.request,
13095
+ currentUserEventId: admittedChildUserInput.id
13096
+ } : {
13085
13097
  query: userMessage,
13086
13098
  currentUserEventId: admittedChildUserInput.id,
13087
13099
  promptKey: agentConfig.promptKey,
@@ -14992,6 +15004,7 @@ var DefaultRunSupervisor = class {
14992
15004
  metadata: { ...record.metadata, executionId: input.executionId }
14993
15005
  });
14994
15006
  const controller = new AbortController();
15007
+ forwardParentAbortSignal(controller, input.parentSignal);
14995
15008
  handle.replaceExecutionAbortController(controller, input.executionId);
14996
15009
  handle.attachTransportEventBus(input.eventBus);
14997
15010
  this.controllers.set(input.runId, controller);