@nebutra/agent-runtime 0.2.0 → 0.2.2

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 (137) hide show
  1. package/LICENSE +21 -676
  2. package/README.md +2 -0
  3. package/dist/adapters/dispatcher-sse.js +1 -0
  4. package/dist/adapters/index.d.ts +24 -5
  5. package/dist/adapters/index.js +28 -0
  6. package/dist/adapters/index.js.map +1 -1
  7. package/dist/adapters/mcp-catalog.js +1 -0
  8. package/dist/adapters/prisma-rollout.js +1 -0
  9. package/dist/chunk-424PT5DM.js +23 -0
  10. package/dist/chunk-424PT5DM.js.map +1 -0
  11. package/dist/{chunk-NN7DATXA.js → chunk-4Y25ZTKI.js} +3 -3
  12. package/dist/chunk-4Y25ZTKI.js.map +1 -0
  13. package/dist/{chunk-BJBBR3QA.js → chunk-D4YAPLOW.js} +4 -4
  14. package/dist/chunk-D4YAPLOW.js.map +1 -0
  15. package/dist/{chunk-ZMYX5VBU.js → chunk-GQZKYWFT.js} +23 -7
  16. package/dist/chunk-GQZKYWFT.js.map +1 -0
  17. package/dist/chunk-KCNN4QUQ.js +255 -0
  18. package/dist/chunk-KCNN4QUQ.js.map +1 -0
  19. package/dist/{chunk-PGGWSUTM.js → chunk-NI4EDT4T.js} +2 -2
  20. package/dist/chunk-NI4EDT4T.js.map +1 -0
  21. package/dist/chunk-Q62VKHIT.js +178 -0
  22. package/dist/chunk-Q62VKHIT.js.map +1 -0
  23. package/dist/{chunk-MUF7ZZTO.js → chunk-R5HOSQUW.js} +2 -1
  24. package/dist/{chunk-MUF7ZZTO.js.map → chunk-R5HOSQUW.js.map} +1 -1
  25. package/dist/{chunk-5N4644PB.js → chunk-SD2ZJ7XG.js} +4 -4
  26. package/dist/cli.d.ts +2 -0
  27. package/dist/cli.js +52 -0
  28. package/dist/cli.js.map +1 -0
  29. package/dist/commands.js +1 -0
  30. package/dist/definitions.js +1 -0
  31. package/dist/dispatcher.js +1 -0
  32. package/dist/durable-turn.js +3 -2
  33. package/dist/hook-pipeline.js +1 -0
  34. package/dist/index.d.ts +8 -85
  35. package/dist/index.js +249 -134
  36. package/dist/index.js.map +1 -1
  37. package/dist/loop.d.ts +2 -2
  38. package/dist/loop.js +3 -2
  39. package/dist/mcp-bridge.d.ts +3 -3
  40. package/dist/mcp-bridge.js +3 -2
  41. package/dist/model.js +1 -0
  42. package/dist/orchestration.d.ts +84 -0
  43. package/dist/orchestration.js +16 -0
  44. package/dist/orchestration.js.map +1 -0
  45. package/dist/policy.js +1 -0
  46. package/dist/protocol.js +1 -0
  47. package/dist/pulsar.d.ts +78 -0
  48. package/dist/pulsar.js +17 -0
  49. package/dist/pulsar.js.map +1 -0
  50. package/dist/rollout-store-persistent.js +1 -0
  51. package/dist/rollout.js +1 -0
  52. package/dist/sandbox.js +2 -1
  53. package/dist/skills.js +2 -1
  54. package/dist/subagents.js +1 -0
  55. package/dist/tools.d.ts +4 -3
  56. package/dist/tools.js +5 -3
  57. package/package.json +84 -27
  58. package/.turbo/turbo-build.log +0 -115
  59. package/.turbo/turbo-test.log +0 -44
  60. package/.turbo/turbo-typecheck.log +0 -4
  61. package/CHANGELOG.md +0 -253
  62. package/dist/chunk-BJBBR3QA.js.map +0 -1
  63. package/dist/chunk-NN7DATXA.js.map +0 -1
  64. package/dist/chunk-PGGWSUTM.js.map +0 -1
  65. package/dist/chunk-ZMYX5VBU.js.map +0 -1
  66. package/src/adapters/dispatcher-sse.test.ts +0 -218
  67. package/src/adapters/dispatcher-sse.ts +0 -222
  68. package/src/adapters/index.ts +0 -18
  69. package/src/adapters/mcp-catalog.test.ts +0 -213
  70. package/src/adapters/mcp-catalog.ts +0 -188
  71. package/src/adapters/prisma-rollout.test.ts +0 -153
  72. package/src/adapters/prisma-rollout.ts +0 -104
  73. package/src/agent-runtime.test.ts +0 -176
  74. package/src/artifact-stream.test.ts +0 -330
  75. package/src/artifact-stream.ts +0 -453
  76. package/src/channel-gateway.test.ts +0 -432
  77. package/src/channel-gateway.ts +0 -357
  78. package/src/code-review.test.ts +0 -501
  79. package/src/code-review.ts +0 -495
  80. package/src/command-suggestions.test.ts +0 -251
  81. package/src/command-suggestions.ts +0 -338
  82. package/src/commands.test.ts +0 -184
  83. package/src/commands.ts +0 -140
  84. package/src/commit-message.test.ts +0 -249
  85. package/src/commit-message.ts +0 -180
  86. package/src/context-compaction.test.ts +0 -522
  87. package/src/context-compaction.ts +0 -434
  88. package/src/definitions.test.ts +0 -78
  89. package/src/definitions.ts +0 -190
  90. package/src/deployment-status.test.ts +0 -215
  91. package/src/deployment-status.ts +0 -227
  92. package/src/design-context.test.ts +0 -195
  93. package/src/design-context.ts +0 -198
  94. package/src/dispatcher.test.ts +0 -234
  95. package/src/dispatcher.ts +0 -189
  96. package/src/durable-turn.test.ts +0 -209
  97. package/src/durable-turn.ts +0 -135
  98. package/src/edit-planner.test.ts +0 -204
  99. package/src/edit-planner.ts +0 -325
  100. package/src/fuzzy-match.test.ts +0 -311
  101. package/src/fuzzy-match.ts +0 -444
  102. package/src/hook-pipeline.test.ts +0 -279
  103. package/src/hook-pipeline.ts +0 -373
  104. package/src/inbound-admission.test.ts +0 -394
  105. package/src/inbound-admission.ts +0 -246
  106. package/src/index.ts +0 -47
  107. package/src/loop.test.ts +0 -161
  108. package/src/loop.ts +0 -211
  109. package/src/mcp-bridge.test.ts +0 -165
  110. package/src/mcp-bridge.ts +0 -76
  111. package/src/memory-provider.test.ts +0 -232
  112. package/src/memory-provider.ts +0 -257
  113. package/src/model.ts +0 -168
  114. package/src/permission-ruleset.test.ts +0 -301
  115. package/src/permission-ruleset.ts +0 -200
  116. package/src/policy.ts +0 -151
  117. package/src/project-repo.test.ts +0 -232
  118. package/src/project-repo.ts +0 -311
  119. package/src/protocol.ts +0 -159
  120. package/src/rollout-store-persistent.test.ts +0 -217
  121. package/src/rollout-store-persistent.ts +0 -166
  122. package/src/rollout.ts +0 -150
  123. package/src/sandbox.ts +0 -113
  124. package/src/session-share.test.ts +0 -360
  125. package/src/session-share.ts +0 -310
  126. package/src/skill-distillation.test.ts +0 -177
  127. package/src/skill-distillation.ts +0 -369
  128. package/src/skills.test.ts +0 -277
  129. package/src/skills.ts +0 -255
  130. package/src/subagents.test.ts +0 -290
  131. package/src/subagents.ts +0 -332
  132. package/src/tools.ts +0 -126
  133. package/src/workbench.test.ts +0 -0
  134. package/src/workbench.ts +0 -0
  135. package/tsconfig.json +0 -12
  136. package/tsup.config.ts +0 -33
  137. /package/dist/{chunk-5N4644PB.js.map → chunk-SD2ZJ7XG.js.map} +0 -0
package/dist/loop.d.ts CHANGED
@@ -2,7 +2,7 @@ import { TurnConfig, TurnUsage, ThreadEvent } from './model.js';
2
2
  import { ReviewDecision, RuleDecision, ApprovalPolicy } from './policy.js';
3
3
  import { ServerRequest } from './protocol.js';
4
4
  import { RolloutStore } from './rollout.js';
5
- import { ToolRegistry } from './tools.js';
5
+ import { RuntimeToolRegistry } from './tools.js';
6
6
  import 'zod';
7
7
 
8
8
  /**
@@ -60,7 +60,7 @@ interface RunTurnDeps {
60
60
  readonly config: TurnConfig;
61
61
  readonly approvalPolicy: ApprovalPolicy;
62
62
  readonly model: ModelInvoker;
63
- readonly tools: ToolRegistry;
63
+ readonly tools: RuntimeToolRegistry;
64
64
  readonly store: RolloutStore;
65
65
  readonly approvalGate: ApprovalGate;
66
66
  /** Defaults to: everything requires a prompt (safe). */
package/dist/loop.js CHANGED
@@ -1,8 +1,9 @@
1
1
  import {
2
2
  runTurn
3
- } from "./chunk-BJBBR3QA.js";
4
- import "./chunk-CGRCUKGT.js";
3
+ } from "./chunk-D4YAPLOW.js";
5
4
  import "./chunk-37BBB2P2.js";
5
+ import "./chunk-CGRCUKGT.js";
6
+ import "./chunk-424PT5DM.js";
6
7
  export {
7
8
  runTurn
8
9
  };
@@ -1,4 +1,4 @@
1
- import { ToolDefinition, ToolRegistry, McpClientLike } from './tools.js';
1
+ import { ToolDefinition, RuntimeToolRegistry, McpClientLike } from './tools.js';
2
2
  import 'zod';
3
3
 
4
4
  /**
@@ -36,11 +36,11 @@ interface ActivateMcpToolsResult {
36
36
  }
37
37
  /**
38
38
  * List the tenant/plan-visible MCP tools, adapt each via {@link adaptMcpTool},
39
- * and register them into the {@link ToolRegistry}. A tool whose name is already
39
+ * and register them into the {@link RuntimeToolRegistry}. A tool whose name is already
40
40
  * registered is skipped (reported, never thrown). Empty/blank tenantId fails
41
41
  * closed before any catalog call.
42
42
  */
43
- declare function activateMcpTools(registry: ToolRegistry, catalog: McpServerCatalogPort, client: McpClientLike, ctx: {
43
+ declare function activateMcpTools(registry: RuntimeToolRegistry, catalog: McpServerCatalogPort, client: McpClientLike, ctx: {
44
44
  tenantId: string;
45
45
  plan?: string;
46
46
  }): Promise<ActivateMcpToolsResult>;
@@ -1,7 +1,8 @@
1
1
  import {
2
2
  activateMcpTools
3
- } from "./chunk-PGGWSUTM.js";
4
- import "./chunk-NN7DATXA.js";
3
+ } from "./chunk-NI4EDT4T.js";
4
+ import "./chunk-4Y25ZTKI.js";
5
+ import "./chunk-424PT5DM.js";
5
6
  export {
6
7
  activateMcpTools
7
8
  };
package/dist/model.js CHANGED
@@ -2,6 +2,7 @@ import {
2
2
  isTurnTerminal,
3
3
  mergeTurnConfig
4
4
  } from "./chunk-6EGG2OZC.js";
5
+ import "./chunk-424PT5DM.js";
5
6
  export {
6
7
  isTurnTerminal,
7
8
  mergeTurnConfig
@@ -0,0 +1,84 @@
1
+ import { TurnUsage } from './model.js';
2
+
3
+ interface BudgetCap {
4
+ readonly durationMs: number;
5
+ readonly costUsd: number;
6
+ readonly tokenLimit: number;
7
+ }
8
+ /** Thinking/reasoning effort for a node (maps to provider reasoning controls). */
9
+ type ReasoningEffort = "low" | "medium" | "high" | "xhigh";
10
+ /** Output modality a node produces. Mirrors @nebutra/ai-providers ModelModality. */
11
+ type ModelModality = "text" | "image" | "video" | "audio" | "embedding";
12
+ /**
13
+ * Per-node model selection — the full model meta-info a node can declare. ALL
14
+ * fields optional; an unset field inherits the run-level default
15
+ * (WorkflowDefinition.defaultModel / runTurn config). The executor resolves
16
+ * these HINTS against @nebutra/ai-providers/catalog (listModelsByModality /
17
+ * resolveFrontierModel) to a concrete model — so a node can either PIN one
18
+ * (`id`) or DESCRIBE what it needs ("the latest fast text model with vision").
19
+ */
20
+ interface NodeModelSpec {
21
+ /** Explicit pin: preset alias (`flagship`/`reasoning`/`fast`) or `provider/model` id. */
22
+ readonly id?: string;
23
+ /** Thinking effort: `low` → cheap/quick, `xhigh` → deepest reasoning. */
24
+ readonly reasoningEffort?: ReasoningEffort;
25
+ /** Output modality — selects a model of this modality when `id` is unset. */
26
+ readonly modality?: ModelModality;
27
+ /** Capabilities the selected model MUST have (e.g. a node needing image input). */
28
+ readonly capabilities?: {
29
+ readonly vision?: boolean;
30
+ readonly toolCall?: boolean;
31
+ readonly reasoning?: boolean;
32
+ };
33
+ }
34
+ interface Brief {
35
+ readonly id: string;
36
+ readonly objective: string;
37
+ readonly outputFormat: Record<string, unknown>;
38
+ readonly allowedTools: readonly string[];
39
+ readonly contextRefs: readonly string[];
40
+ readonly boundaries: readonly string[];
41
+ readonly budget: BudgetCap;
42
+ readonly dependsOn?: readonly string[];
43
+ /** Per-node model meta-info (id/preset · thinking effort · modality · capabilities). */
44
+ readonly model?: NodeModelSpec;
45
+ }
46
+ type DispatchStrategy = "auto" | "sequential" | "fanout";
47
+ interface DispatchPlan {
48
+ readonly strategy: Exclude<DispatchStrategy, "auto">;
49
+ readonly order: readonly Brief[];
50
+ }
51
+ interface DispatchPlanOptions {
52
+ readonly strategy?: DispatchStrategy;
53
+ }
54
+ interface SubagentResult {
55
+ readonly briefId: string;
56
+ readonly output: unknown;
57
+ readonly usage: TurnUsage;
58
+ readonly durationMs: number;
59
+ }
60
+ interface SubagentCostReport {
61
+ readonly totalInputTokens: number;
62
+ readonly totalOutputTokens: number;
63
+ readonly totalReasoningTokens: number;
64
+ readonly maxDurationMs: number;
65
+ readonly subagents: number;
66
+ }
67
+ /**
68
+ * Dependency-resolved execution WAVES — the agent node-topology scheduler. Each
69
+ * wave is the set of briefs whose dependencies are satisfied by earlier waves;
70
+ * waves run in order, briefs within a wave run in parallel. Input order is
71
+ * preserved within a wave.
72
+ */
73
+ declare function planWaves(briefs: readonly Brief[]): readonly (readonly Brief[])[];
74
+ declare function planSubagentDispatch(briefs: readonly Brief[], options?: DispatchPlanOptions): DispatchPlan;
75
+ declare function fanOutSubagents(briefs: readonly Brief[], run: (brief: Brief) => Promise<SubagentResult>): Promise<readonly SubagentResult[]>;
76
+ /**
77
+ * Execute briefs as a dependency graph: each wave runs in parallel, waves run
78
+ * sequentially. The node-topology execution path — `fanOutSubagents` is the
79
+ * degenerate single-wave (all-independent) case of this.
80
+ */
81
+ declare function runAgentWaves(briefs: readonly Brief[], run: (brief: Brief) => Promise<SubagentResult>): Promise<readonly SubagentResult[]>;
82
+ declare function costReport(results: readonly SubagentResult[]): SubagentCostReport;
83
+
84
+ export { type Brief, type BudgetCap, type DispatchPlan, type DispatchPlanOptions, type DispatchStrategy, type ModelModality, type NodeModelSpec, type ReasoningEffort, type SubagentCostReport, type SubagentResult, costReport, fanOutSubagents, planSubagentDispatch, planWaves, runAgentWaves };
@@ -0,0 +1,16 @@
1
+ import {
2
+ costReport,
3
+ fanOutSubagents,
4
+ planSubagentDispatch,
5
+ planWaves,
6
+ runAgentWaves
7
+ } from "./chunk-Q62VKHIT.js";
8
+ import "./chunk-424PT5DM.js";
9
+ export {
10
+ costReport,
11
+ fanOutSubagents,
12
+ planSubagentDispatch,
13
+ planWaves,
14
+ runAgentWaves
15
+ };
16
+ //# sourceMappingURL=orchestration.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
package/dist/policy.js CHANGED
@@ -9,6 +9,7 @@ import {
9
9
  resolveRuleDecision,
10
10
  writableRootSchema
11
11
  } from "./chunk-CGRCUKGT.js";
12
+ import "./chunk-424PT5DM.js";
12
13
  export {
13
14
  DEFAULT_APPROVAL_POLICY,
14
15
  DEFAULT_CAPABILITY_POLICY,
package/dist/protocol.js CHANGED
@@ -5,6 +5,7 @@ import {
5
5
  resolveScope,
6
6
  scopeKey
7
7
  } from "./chunk-FUG5DT2C.js";
8
+ import "./chunk-424PT5DM.js";
8
9
  export {
9
10
  METHOD_REGISTRY,
10
11
  NOTIFICATIONS,
@@ -0,0 +1,78 @@
1
+ import { ModelInvoker, ApprovalGate } from './loop.js';
2
+ import { TurnConfig, ThreadEvent } from './model.js';
3
+ import { ApprovalPolicy } from './policy.js';
4
+ import { RolloutStore } from './rollout.js';
5
+ import { RuntimeToolRegistry } from './tools.js';
6
+ import './protocol.js';
7
+ import 'zod';
8
+
9
+ type EventLogKind = "llm_call" | "tool_call" | "sub_agent_call" | "content_write";
10
+ interface PulsarEventInput {
11
+ readonly traceId: string;
12
+ readonly kind: EventLogKind;
13
+ readonly affected: readonly string[];
14
+ readonly parent: string | null;
15
+ readonly snapshot?: Record<string, string>;
16
+ }
17
+ interface PulsarBranchRecord {
18
+ readonly name: string;
19
+ readonly from: string;
20
+ readonly at: string;
21
+ }
22
+ interface PulsarEventLogPort {
23
+ commit(event: PulsarEventInput): Promise<string>;
24
+ branchFrom(id: string, name: string): Promise<PulsarBranchRecord>;
25
+ }
26
+ interface StartThreadOptions {
27
+ readonly threadId?: string;
28
+ readonly maxSteps?: number;
29
+ }
30
+ interface PulsarDeps {
31
+ readonly tenantId: string;
32
+ readonly config: TurnConfig;
33
+ readonly model: ModelInvoker;
34
+ readonly tools: RuntimeToolRegistry;
35
+ readonly store: RolloutStore;
36
+ readonly approvalGate: ApprovalGate;
37
+ readonly approvalPolicy: ApprovalPolicy;
38
+ readonly eventLog?: PulsarEventLogPort;
39
+ }
40
+ declare class PulsarThread {
41
+ #private;
42
+ readonly id: string;
43
+ readonly playId: string;
44
+ readonly tenantId: string;
45
+ constructor(input: {
46
+ readonly id: string;
47
+ readonly playId: string;
48
+ readonly tenantId: string;
49
+ readonly deps: PulsarDeps;
50
+ readonly mode: "start" | "resume";
51
+ readonly userInput: string;
52
+ readonly maxSteps?: number;
53
+ });
54
+ subscribe(): AsyncGenerator<ThreadEvent>;
55
+ }
56
+ declare class PulsarBuilder {
57
+ #private;
58
+ withTenant(tenantId: string): this;
59
+ withConfig(config: TurnConfig): this;
60
+ withModel(model: ModelInvoker): this;
61
+ withTools(tools: RuntimeToolRegistry): this;
62
+ withRolloutStore(store: RolloutStore): this;
63
+ withApprovalGate(approvalGate: ApprovalGate): this;
64
+ withApprovalPolicy(policy: ApprovalPolicy): this;
65
+ withEventLog(eventLog: PulsarEventLogPort): this;
66
+ build(): Pulsar;
67
+ }
68
+ declare class Pulsar {
69
+ #private;
70
+ static readonly itemCommitIds: Map<string, string>;
71
+ constructor(deps: PulsarDeps);
72
+ static builder(): PulsarBuilder;
73
+ startPlay(playId: string, input: string, options?: StartThreadOptions): Promise<PulsarThread>;
74
+ resume(threadId: string): Promise<PulsarThread>;
75
+ branchFromItem(threadId: string, itemId: string, name: string): Promise<PulsarBranchRecord>;
76
+ }
77
+
78
+ export { Pulsar, type PulsarBranchRecord, PulsarBuilder, type PulsarDeps, type PulsarEventInput, type PulsarEventLogPort, PulsarThread, type StartThreadOptions };
package/dist/pulsar.js ADDED
@@ -0,0 +1,17 @@
1
+ import {
2
+ Pulsar,
3
+ PulsarBuilder,
4
+ PulsarThread
5
+ } from "./chunk-KCNN4QUQ.js";
6
+ import "./chunk-D4YAPLOW.js";
7
+ import "./chunk-37BBB2P2.js";
8
+ import "./chunk-4Y25ZTKI.js";
9
+ import "./chunk-6EGG2OZC.js";
10
+ import "./chunk-CGRCUKGT.js";
11
+ import "./chunk-424PT5DM.js";
12
+ export {
13
+ Pulsar,
14
+ PulsarBuilder,
15
+ PulsarThread
16
+ };
17
+ //# sourceMappingURL=pulsar.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -2,6 +2,7 @@ import {
2
2
  PersistentRolloutStore,
3
3
  RoundTripError
4
4
  } from "./chunk-2DA6Q6TN.js";
5
+ import "./chunk-424PT5DM.js";
5
6
  export {
6
7
  PersistentRolloutStore,
7
8
  RoundTripError
package/dist/rollout.js CHANGED
@@ -5,6 +5,7 @@ import {
5
5
  replay,
6
6
  sanitizeForPersist
7
7
  } from "./chunk-37BBB2P2.js";
8
+ import "./chunk-424PT5DM.js";
8
9
  export {
9
10
  InMemoryRolloutStore,
10
11
  PERSISTED_OUTPUT_MAX_BYTES,
package/dist/sandbox.js CHANGED
@@ -4,7 +4,8 @@ import {
4
4
  SandboxDelegationError,
5
5
  assertSafePosture,
6
6
  createHttpSandbox
7
- } from "./chunk-MUF7ZZTO.js";
7
+ } from "./chunk-R5HOSQUW.js";
8
+ import "./chunk-424PT5DM.js";
8
9
  export {
9
10
  NoExecutorConfiguredError,
10
11
  REFUSING_SANDBOX,
package/dist/skills.js CHANGED
@@ -1,8 +1,9 @@
1
1
  import {
2
2
  buildSkillListing,
3
3
  expandSkill
4
- } from "./chunk-ZMYX5VBU.js";
4
+ } from "./chunk-GQZKYWFT.js";
5
5
  import "./chunk-7BUOF367.js";
6
+ import "./chunk-424PT5DM.js";
6
7
  export {
7
8
  buildSkillListing,
8
9
  expandSkill
package/dist/subagents.js CHANGED
@@ -8,6 +8,7 @@ import {
8
8
  resolveSubagentTools,
9
9
  settleDeferred
10
10
  } from "./chunk-5YS7WAPS.js";
11
+ import "./chunk-424PT5DM.js";
11
12
  export {
12
13
  TASK_KINDS,
13
14
  TASK_STATUSES,
package/dist/tools.d.ts CHANGED
@@ -46,16 +46,17 @@ interface ToolHooks {
46
46
  readonly postToolUse?: (name: string, output: unknown, ctx: ToolDispatchContext) => Promise<void>;
47
47
  }
48
48
  /**
49
- * registry -> router -> orchestrator pipeline. MCP tools register via
49
+ * runtime registry -> router -> orchestrator pipeline. MCP tools register via
50
50
  * {@link adaptMcpTool} and are dispatched identically to native tools.
51
51
  */
52
- declare class ToolRegistry {
52
+ declare class RuntimeToolRegistry {
53
53
  #private;
54
54
  constructor(hooks?: ToolHooks);
55
55
  register<I, O>(definition: ToolDefinition<I, O>, handler: ToolHandler<I, O>, origin?: ToolOrigin): void;
56
56
  list(): readonly RegisteredTool[];
57
57
  dispatch(name: string, rawInput: unknown, ctx: ToolDispatchContext): Promise<unknown>;
58
58
  }
59
+
59
60
  /** Minimal shape of an MCP client (satisfied by `@nebutra/mcp`'s `mcpClient`). */
60
61
  interface McpClientLike {
61
62
  executeTool(name: string, args: unknown, ctx: {
@@ -74,4 +75,4 @@ declare function adaptMcpTool(server: string, definition: ToolDefinition, client
74
75
  origin: ToolOrigin;
75
76
  };
76
77
 
77
- export { type McpClientLike, type RegisteredTool, type ToolDefinition, type ToolDispatchContext, type ToolHandler, type ToolHooks, type ToolOrigin, ToolRegistry, adaptMcpTool };
78
+ export { type McpClientLike, type RegisteredTool, RuntimeToolRegistry, type ToolDefinition, type ToolDispatchContext, type ToolHandler, type ToolHooks, type ToolOrigin, RuntimeToolRegistry as ToolRegistry, adaptMcpTool };
package/dist/tools.js CHANGED
@@ -1,9 +1,11 @@
1
1
  import {
2
- ToolRegistry,
2
+ RuntimeToolRegistry,
3
3
  adaptMcpTool
4
- } from "./chunk-NN7DATXA.js";
4
+ } from "./chunk-4Y25ZTKI.js";
5
+ import "./chunk-424PT5DM.js";
5
6
  export {
6
- ToolRegistry,
7
+ RuntimeToolRegistry,
8
+ RuntimeToolRegistry as ToolRegistry,
7
9
  adaptMcpTool
8
10
  };
9
11
  //# sourceMappingURL=tools.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nebutra/agent-runtime",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
4
4
  "private": false,
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -14,44 +14,98 @@
14
14
  "gaps": [
15
15
  "Track-B kernel sidecar transport not yet wired",
16
16
  "Durable-turn queue binding is interface-only",
17
- "Rollout store backed by in-memory reference impl only"
17
+ "Rollout store backed by in-memory reference impl only",
18
+ "Pulsar facade is runnable but still delegates model execution through injected ports"
18
19
  ],
19
20
  "featureId": "agent-runtime",
20
21
  "category": "ai",
22
+ "surface": "agent-runtime",
21
23
  "summary": "Multi-tenant agent-runtime grammar: thread/turn/item model, approval+capability policy, tool/MCP abstraction, event-sourced rollout, external-sandbox delegation seam"
22
24
  },
23
- "main": "./src/index.ts",
24
- "types": "./src/index.ts",
25
+ "main": "./dist/index.js",
26
+ "types": "./dist/index.d.ts",
25
27
  "exports": {
26
- ".": "./src/index.ts",
27
- "./model": "./src/model.ts",
28
- "./protocol": "./src/protocol.ts",
29
- "./policy": "./src/policy.ts",
30
- "./tools": "./src/tools.ts",
31
- "./rollout": "./src/rollout.ts",
32
- "./sandbox": "./src/sandbox.ts",
33
- "./adapters": "./src/adapters/index.ts",
34
- "./adapters/mcp-catalog": "./src/adapters/mcp-catalog.ts",
35
- "./adapters/dispatcher-sse": "./src/adapters/dispatcher-sse.ts",
36
- "./adapters/prisma-rollout": "./src/adapters/prisma-rollout.ts"
28
+ ".": {
29
+ "types": "./dist/index.d.ts",
30
+ "import": "./dist/index.js",
31
+ "default": "./dist/index.js"
32
+ },
33
+ "./model": {
34
+ "types": "./dist/model.d.ts",
35
+ "import": "./dist/model.js",
36
+ "default": "./dist/model.js"
37
+ },
38
+ "./protocol": {
39
+ "types": "./dist/protocol.d.ts",
40
+ "import": "./dist/protocol.js",
41
+ "default": "./dist/protocol.js"
42
+ },
43
+ "./pulsar": {
44
+ "types": "./dist/pulsar.d.ts",
45
+ "import": "./dist/pulsar.js",
46
+ "default": "./dist/pulsar.js"
47
+ },
48
+ "./orchestration": {
49
+ "types": "./dist/orchestration.d.ts",
50
+ "import": "./dist/orchestration.js",
51
+ "default": "./dist/orchestration.js"
52
+ },
53
+ "./policy": {
54
+ "types": "./dist/policy.d.ts",
55
+ "import": "./dist/policy.js",
56
+ "default": "./dist/policy.js"
57
+ },
58
+ "./tools": {
59
+ "types": "./dist/tools.d.ts",
60
+ "import": "./dist/tools.js",
61
+ "default": "./dist/tools.js"
62
+ },
63
+ "./rollout": {
64
+ "types": "./dist/rollout.d.ts",
65
+ "import": "./dist/rollout.js",
66
+ "default": "./dist/rollout.js"
67
+ },
68
+ "./sandbox": {
69
+ "types": "./dist/sandbox.d.ts",
70
+ "import": "./dist/sandbox.js",
71
+ "default": "./dist/sandbox.js"
72
+ },
73
+ "./adapters": {
74
+ "types": "./dist/adapters/index.d.ts",
75
+ "import": "./dist/adapters/index.js",
76
+ "default": "./dist/adapters/index.js"
77
+ },
78
+ "./adapters/mcp-catalog": {
79
+ "types": "./dist/adapters/mcp-catalog.d.ts",
80
+ "import": "./dist/adapters/mcp-catalog.js",
81
+ "default": "./dist/adapters/mcp-catalog.js"
82
+ },
83
+ "./adapters/dispatcher-sse": {
84
+ "types": "./dist/adapters/dispatcher-sse.d.ts",
85
+ "import": "./dist/adapters/dispatcher-sse.js",
86
+ "default": "./dist/adapters/dispatcher-sse.js"
87
+ },
88
+ "./adapters/prisma-rollout": {
89
+ "types": "./dist/adapters/prisma-rollout.d.ts",
90
+ "import": "./dist/adapters/prisma-rollout.js",
91
+ "default": "./dist/adapters/prisma-rollout.js"
92
+ }
37
93
  },
38
94
  "dependencies": {
39
- "zod": "^4.3.6"
40
- },
41
- "peerDependencies": {
42
- "@nebutra/mcp": "0.1.1"
43
- },
44
- "peerDependenciesMeta": {
45
- "@nebutra/mcp": {
46
- "optional": true
47
- }
95
+ "p-limit": "^7.3.0",
96
+ "zod": "^4.3.6",
97
+ "@nebutra/agents": "1.1.2",
98
+ "@nebutra/ai-primitives": "0.1.2",
99
+ "@nebutra/graph-model": "0.2.2",
100
+ "@nebutra/mcp": "0.1.3",
101
+ "@nebutra/capability-kit": "0.2.2",
102
+ "@nebutra/execution-policy": "0.1.2"
48
103
  },
49
104
  "devDependencies": {
50
- "@types/node": "^22.19.15",
105
+ "@types/node": "^25.9.1",
51
106
  "tsup": "^8.5.1",
52
107
  "typescript": "^5.9.3",
53
- "vitest": "^4.0.18",
54
- "@nebutra/mcp": "0.1.1"
108
+ "vitest": "^4.0.18"
55
109
  },
56
110
  "homepage": "https://github.com/Nebutra/Nebutra-Sailor/tree/main/packages/ai/agent-runtime#readme",
57
111
  "repository": {
@@ -65,6 +119,9 @@
65
119
  "publishConfig": {
66
120
  "access": "public"
67
121
  },
122
+ "files": [
123
+ "dist"
124
+ ],
68
125
  "scripts": {
69
126
  "build": "tsup",
70
127
  "dev": "tsup --watch",
@@ -1,115 +0,0 @@
1
-
2
- > @nebutra/agent-runtime@0.2.0 build /home/runner/work/Nebutra-Sailor/Nebutra-Sailor/packages/ai/agent-runtime
3
- > tsup
4
-
5
- CLI Building entry: {"index":"src/index.ts","adapters/index":"src/adapters/index.ts","adapters/dispatcher-sse":"src/adapters/dispatcher-sse.ts","adapters/mcp-catalog":"src/adapters/mcp-catalog.ts","adapters/prisma-rollout":"src/adapters/prisma-rollout.ts","commands":"src/commands.ts","definitions":"src/definitions.ts","dispatcher":"src/dispatcher.ts","durable-turn":"src/durable-turn.ts","hook-pipeline":"src/hook-pipeline.ts","loop":"src/loop.ts","mcp-bridge":"src/mcp-bridge.ts","model":"src/model.ts","policy":"src/policy.ts","protocol":"src/protocol.ts","rollout":"src/rollout.ts","rollout-store-persistent":"src/rollout-store-persistent.ts","sandbox":"src/sandbox.ts","skills":"src/skills.ts","subagents":"src/subagents.ts","tools":"src/tools.ts"}
6
- CLI Using tsconfig: tsconfig.json
7
- CLI tsup v8.5.1
8
- CLI Using tsup config: /home/runner/work/Nebutra-Sailor/Nebutra-Sailor/packages/ai/agent-runtime/tsup.config.ts
9
- CLI Target: es2022
10
- CLI Cleaning output folder
11
- ESM Build start
12
- ESM dist/rollout-store-persistent.js 189.00 B
13
- ESM dist/adapters/index.js 449.00 B
14
- ESM dist/sandbox.js 318.00 B
15
- ESM dist/skills.js 185.00 B
16
- ESM dist/subagents.js 374.00 B
17
- ESM dist/tools.js 146.00 B
18
- ESM dist/durable-turn.js 191.00 B
19
- ESM dist/hook-pipeline.js 214.00 B
20
- ESM dist/loop.js 163.00 B
21
- ESM dist/mcp-bridge.js 157.00 B
22
- ESM dist/model.js 156.00 B
23
- ESM dist/policy.js 497.00 B
24
- ESM dist/protocol.js 263.00 B
25
- ESM dist/rollout.js 286.00 B
26
- ESM dist/index.js 93.88 KB
27
- ESM dist/chunk-2DA6Q6TN.js 3.42 KB
28
- ESM dist/chunk-MUF7ZZTO.js 1.62 KB
29
- ESM dist/chunk-ZMYX5VBU.js 4.14 KB
30
- ESM dist/chunk-5N4644PB.js 1.92 KB
31
- ESM dist/chunk-5YS7WAPS.js 5.67 KB
32
- ESM dist/chunk-BJBBR3QA.js 4.19 KB
33
- ESM dist/chunk-LO24VOA3.js 6.31 KB
34
- ESM dist/chunk-PGGWSUTM.js 1.00 KB
35
- ESM dist/chunk-NN7DATXA.js 1.38 KB
36
- ESM dist/chunk-6EGG2OZC.js 324.00 B
37
- ESM dist/chunk-CGRCUKGT.js 2.38 KB
38
- ESM dist/chunk-37BBB2P2.js 2.19 KB
39
- ESM dist/adapters/dispatcher-sse.js 214.00 B
40
- ESM dist/chunk-ZTSKS42I.js 3.65 KB
41
- ESM dist/adapters/mcp-catalog.js 187.00 B
42
- ESM dist/chunk-24ZXP7FI.js 2.47 KB
43
- ESM dist/adapters/prisma-rollout.js 160.00 B
44
- ESM dist/chunk-57W3AR43.js 1.55 KB
45
- ESM dist/commands.js 187.00 B
46
- ESM dist/chunk-YYFPDBJG.js 1.86 KB
47
- ESM dist/definitions.js 292.00 B
48
- ESM dist/chunk-7BUOF367.js 4.13 KB
49
- ESM dist/dispatcher.js 161.00 B
50
- ESM dist/chunk-RDKYDMXT.js 4.08 KB
51
- ESM dist/chunk-FUG5DT2C.js 2.45 KB
52
- ESM dist/rollout-store-persistent.js.map 71.00 B
53
- ESM dist/adapters/index.js.map 71.00 B
54
- ESM dist/sandbox.js.map 71.00 B
55
- ESM dist/skills.js.map 71.00 B
56
- ESM dist/subagents.js.map 71.00 B
57
- ESM dist/tools.js.map 71.00 B
58
- ESM dist/durable-turn.js.map 71.00 B
59
- ESM dist/hook-pipeline.js.map 71.00 B
60
- ESM dist/loop.js.map 71.00 B
61
- ESM dist/mcp-bridge.js.map 71.00 B
62
- ESM dist/model.js.map 71.00 B
63
- ESM dist/policy.js.map 71.00 B
64
- ESM dist/protocol.js.map 71.00 B
65
- ESM dist/rollout.js.map 71.00 B
66
- ESM dist/index.js.map 251.69 KB
67
- ESM dist/chunk-2DA6Q6TN.js.map 8.01 KB
68
- ESM dist/chunk-MUF7ZZTO.js.map 4.91 KB
69
- ESM dist/chunk-ZMYX5VBU.js.map 12.29 KB
70
- ESM dist/chunk-5N4644PB.js.map 6.73 KB
71
- ESM dist/chunk-5YS7WAPS.js.map 15.75 KB
72
- ESM dist/chunk-BJBBR3QA.js.map 10.81 KB
73
- ESM dist/chunk-LO24VOA3.js.map 17.32 KB
74
- ESM dist/chunk-PGGWSUTM.js.map 3.50 KB
75
- ESM dist/chunk-NN7DATXA.js.map 5.34 KB
76
- ESM dist/chunk-6EGG2OZC.js.map 5.96 KB
77
- ESM dist/chunk-CGRCUKGT.js.map 7.65 KB
78
- ESM dist/chunk-37BBB2P2.js.map 6.88 KB
79
- ESM dist/adapters/dispatcher-sse.js.map 71.00 B
80
- ESM dist/chunk-ZTSKS42I.js.map 10.83 KB
81
- ESM dist/adapters/mcp-catalog.js.map 71.00 B
82
- ESM dist/chunk-24ZXP7FI.js.map 8.26 KB
83
- ESM dist/adapters/prisma-rollout.js.map 71.00 B
84
- ESM dist/chunk-57W3AR43.js.map 4.88 KB
85
- ESM dist/commands.js.map 71.00 B
86
- ESM dist/chunk-YYFPDBJG.js.map 6.97 KB
87
- ESM dist/definitions.js.map 71.00 B
88
- ESM dist/chunk-7BUOF367.js.map 10.17 KB
89
- ESM dist/dispatcher.js.map 71.00 B
90
- ESM dist/chunk-RDKYDMXT.js.map 8.81 KB
91
- ESM dist/chunk-FUG5DT2C.js.map 7.87 KB
92
- ESM ⚡️ Build success in 132ms
93
- DTS Build start
94
- DTS ⚡️ Build success in 8571ms
95
- DTS dist/adapters/index.d.ts 581.00 B
96
- DTS dist/adapters/dispatcher-sse.d.ts 3.18 KB
97
- DTS dist/adapters/mcp-catalog.d.ts 2.77 KB
98
- DTS dist/adapters/prisma-rollout.d.ts 2.10 KB
99
- DTS dist/commands.d.ts 3.64 KB
100
- DTS dist/dispatcher.d.ts 1.91 KB
101
- DTS dist/durable-turn.d.ts 2.55 KB
102
- DTS dist/hook-pipeline.d.ts 5.33 KB
103
- DTS dist/loop.d.ts 3.15 KB
104
- DTS dist/mcp-bridge.d.ts 1.89 KB
105
- DTS dist/protocol.d.ts 5.32 KB
106
- DTS dist/rollout-store-persistent.d.ts 1.77 KB
107
- DTS dist/rollout.d.ts 3.28 KB
108
- DTS dist/sandbox.d.ts 2.80 KB
109
- DTS dist/policy.d.ts 5.59 KB
110
- DTS dist/skills.d.ts 4.40 KB
111
- DTS dist/subagents.d.ts 5.74 KB
112
- DTS dist/model.d.ts 5.79 KB
113
- DTS dist/definitions.d.ts 3.96 KB
114
- DTS dist/tools.d.ts 2.95 KB
115
- DTS dist/index.d.ts 86.35 KB