@cjhyy/code-shell 0.1.0-alpha.0 → 0.1.0-alpha.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.
@@ -4,7 +4,7 @@
4
4
 
5
5
 
6
6
 
7
- var _chunkQHDYFC5Ucjs = require('./chunk-QHDYFC5U.cjs');
7
+ var _chunkQ6BYFYGDcjs = require('./chunk-Q6BYFYGD.cjs');
8
8
 
9
9
 
10
10
  var _chunkIJSHQGMPcjs = require('./chunk-IJSHQGMP.cjs');
@@ -61,12 +61,12 @@ function defineProduct(definition, runtime) {
61
61
  builtinTools: [...enabledSet],
62
62
  defaultPermissionRules: permissionRules
63
63
  };
64
- _chunkQHDYFC5Ucjs.registerPreset.call(void 0, agentPreset);
64
+ _chunkQ6BYFYGDcjs.registerPreset.call(void 0, agentPreset);
65
65
  let evaluator;
66
66
  if (!_optionalChain([contract, 'optionalAccess', _4 => _4.evaluator])) {
67
- evaluator = new (0, _chunkQHDYFC5Ucjs.NoopEvaluator)();
67
+ evaluator = new (0, _chunkQ6BYFYGDcjs.NoopEvaluator)();
68
68
  } else if (Array.isArray(contract.evaluator)) {
69
- evaluator = new (0, _chunkQHDYFC5Ucjs.CompositeEvaluator)(contract.evaluator);
69
+ evaluator = new (0, _chunkQ6BYFYGDcjs.CompositeEvaluator)(contract.evaluator);
70
70
  } else {
71
71
  evaluator = contract.evaluator;
72
72
  }
@@ -76,8 +76,8 @@ function defineProduct(definition, runtime) {
76
76
  execute: ct.execute
77
77
  }));
78
78
  const runsDir = _nullishCoalesce(runtime.runsDir, () => ( _path.join.call(void 0, _os.homedir.call(void 0, ), ".code-shell", "runs")));
79
- const store = new (0, _chunkQHDYFC5Ucjs.FileRunStore)(runsDir);
80
- const manager = new (0, _chunkQHDYFC5Ucjs.RunManager)({
79
+ const store = new (0, _chunkQ6BYFYGDcjs.FileRunStore)(runsDir);
80
+ const manager = new (0, _chunkQ6BYFYGDcjs.RunManager)({
81
81
  store,
82
82
  executor: {
83
83
  llm: runtime.llm,
@@ -90,11 +90,14 @@ function defineProduct(definition, runtime) {
90
90
  disabledBuiltinTools: _optionalChain([adapter, 'optionalAccess', _9 => _9.disableTools]),
91
91
  customSystemPrompt: presetDef.customPrompt,
92
92
  appendSystemPrompt: presetDef.appendPrompt,
93
+ hooks: _optionalChain([adapter, 'optionalAccess', _10 => _10.hooks]),
93
94
  customTools: customToolEntries.length > 0 ? customToolEntries : void 0
94
95
  },
95
- concurrency: _nullishCoalesce(_optionalChain([contract, 'optionalAccess', _10 => _10.concurrency]), () => ( 1)),
96
+ concurrency: _nullishCoalesce(_optionalChain([contract, 'optionalAccess', _11 => _11.concurrency]), () => ( 1)),
96
97
  runsDir,
97
- evaluator
98
+ evaluator,
99
+ defaultTags: _optionalChain([contract, 'optionalAccess', _12 => _12.defaultTags]),
100
+ defaultMetadata: _optionalChain([contract, 'optionalAccess', _13 => _13.defaultMetadata])
98
101
  });
99
102
  return { manager, preset: agentPreset, customTools };
100
103
  }
package/dist/cli/main.cjs CHANGED
@@ -20,7 +20,8 @@ var _chunk5LHVI777cjs = require('../chunk-5LHVI777.cjs');
20
20
 
21
21
 
22
22
 
23
- var _chunkQHDYFC5Ucjs = require('../chunk-QHDYFC5U.cjs');
23
+
24
+ var _chunkQ6BYFYGDcjs = require('../chunk-Q6BYFYGD.cjs');
24
25
  require('../chunk-3QR52LL5.cjs');
25
26
  require('../chunk-UK2SU23S.cjs');
26
27
 
@@ -109,7 +110,7 @@ function isNotification(msg) {
109
110
  }
110
111
 
111
112
  // src/protocol/server.ts
112
- _chunkQHDYFC5Ucjs.init_plan.call(void 0, );
113
+ _chunkQ6BYFYGDcjs.init_plan.call(void 0, );
113
114
  var _nanoid = require('nanoid');
114
115
  var AgentServer = (_class = class _AgentServer {
115
116
 
@@ -134,10 +135,10 @@ var AgentServer = (_class = class _AgentServer {
134
135
  });
135
136
  }
136
137
  });
137
- _chunkQHDYFC5Ucjs.setInteractiveApprovalFn.call(void 0, (request) => {
138
+ _chunkQ6BYFYGDcjs.setInteractiveApprovalFn.call(void 0, (request) => {
138
139
  return this.requestApprovalFromClient(request);
139
140
  });
140
- _chunkQHDYFC5Ucjs.setAskUserFn.call(void 0, (question) => {
141
+ _chunkQ6BYFYGDcjs.setAskUserFn.call(void 0, (question) => {
141
142
  return this.requestAskUserFromClient(question);
142
143
  });
143
144
  this.notify(Methods.Status, { status: "ready" });
@@ -248,10 +249,10 @@ var AgentServer = (_class = class _AgentServer {
248
249
  handleConfigure(req) {
249
250
  const params = _nullishCoalesce(req.params, () => ( {}));
250
251
  if (params.planMode !== void 0) {
251
- _chunkQHDYFC5Ucjs.setInPlanMode.call(void 0, params.planMode);
252
+ _chunkQ6BYFYGDcjs.setInPlanMode.call(void 0, params.planMode);
252
253
  }
253
254
  if (params.bypassPermissions !== void 0) {
254
- _chunkQHDYFC5Ucjs.setRuntimeBypass.call(void 0, params.bypassPermissions);
255
+ _chunkQ6BYFYGDcjs.setRuntimeBypass.call(void 0, params.bypassPermissions);
255
256
  }
256
257
  if (params.model !== void 0) {
257
258
  try {
@@ -288,7 +289,7 @@ var AgentServer = (_class = class _AgentServer {
288
289
  type: "config",
289
290
  data: {
290
291
  permissionMode: _nullishCoalesce(config.permissionMode, () => ( "default")),
291
- planMode: _chunkQHDYFC5Ucjs.isInPlanMode.call(void 0, ),
292
+ planMode: _chunkQ6BYFYGDcjs.isInPlanMode.call(void 0, ),
292
293
  preset: config.preset,
293
294
  model: config.llm.model,
294
295
  cwd: config.cwd,
@@ -858,7 +859,7 @@ async function runCommand(options) {
858
859
  maxTokens: _nullishCoalesce(settings.model.maxTokens, () => ( 8192)),
859
860
  enableStreaming: true
860
861
  };
861
- const engine = new (0, _chunkQHDYFC5Ucjs.Engine)({
862
+ const engine = new (0, _chunkQ6BYFYGDcjs.Engine)({
862
863
  llm: llmConfig,
863
864
  cwd,
864
865
  preset: _nullishCoalesce(options.preset, () => ( settings.agent.preset)),
@@ -8968,7 +8969,7 @@ var App = (_class14 = class extends _react.PureComponent {constructor(...args2)
8968
8969
  }, _class14.__initStatic2(), _class14);
8969
8970
  function processKeysInBatch(app, items, _unused1, _unused2) {
8970
8971
  if (items.some((i) => i.kind === "key" || i.kind === "mouse" && !((i.button & 32) !== 0 && (i.button & 3) === 3))) {
8971
- _chunkQHDYFC5Ucjs.updateLastInteractionTime.call(void 0, );
8972
+ _chunkQ6BYFYGDcjs.updateLastInteractionTime.call(void 0, );
8972
8973
  }
8973
8974
  for (const item of items) {
8974
8975
  if (item.kind === "response") {
@@ -11637,7 +11638,7 @@ var Ink = (_class18 = class {
11637
11638
  clearTimeout(this.drainTimer);
11638
11639
  this.drainTimer = null;
11639
11640
  }
11640
- _chunkQHDYFC5Ucjs.flushInteractionTime.call(void 0, );
11641
+ _chunkQ6BYFYGDcjs.flushInteractionTime.call(void 0, );
11641
11642
  const renderStart = performance.now();
11642
11643
  const terminalWidth = this.options.stdout.columns || 80;
11643
11644
  const terminalRows = this.options.stdout.rows || 24;
@@ -16657,7 +16658,7 @@ var utilityCommands = [
16657
16658
  description: "Check for and install updates",
16658
16659
  execute: async (_arg, ctx) => {
16659
16660
  try {
16660
- const { getCurrentVersion, getUpdateAvailable } = await Promise.resolve().then(() => _interopRequireWildcard(require("../updater-URVNPDPW.cjs")));
16661
+ const { getCurrentVersion, getUpdateAvailable } = await Promise.resolve().then(() => _interopRequireWildcard(require("../updater-2N6745WR.cjs")));
16661
16662
  const current = getCurrentVersion();
16662
16663
  const available = getUpdateAvailable();
16663
16664
  if (available) {
@@ -17272,7 +17273,7 @@ ${formatted.join("\n")}`);
17272
17273
  name: "/plan",
17273
17274
  description: "Toggle plan mode (read-only exploration, plan output as text)",
17274
17275
  execute: (_arg, ctx) => {
17275
- const { isInPlanMode: isInPlanMode2, setInPlanMode: setInPlanMode2 } = (_chunkQHDYFC5Ucjs.init_plan.call(void 0, ), _chunkIJSHQGMPcjs.__toCommonJS.call(void 0, _chunkQHDYFC5Ucjs.plan_exports));
17276
+ const { isInPlanMode: isInPlanMode2, setInPlanMode: setInPlanMode2 } = (_chunkQ6BYFYGDcjs.init_plan.call(void 0, ), _chunkIJSHQGMPcjs.__toCommonJS.call(void 0, _chunkQ6BYFYGDcjs.plan_exports));
17276
17277
  const current = isInPlanMode2();
17277
17278
  setInPlanMode2(!current);
17278
17279
  if (!current) {
@@ -18093,7 +18094,7 @@ function App2({ client, model: initialModel, effort, maxTurns, cwd, maxContextTo
18093
18094
  chatStore.update((prev) => [...prev, entry({ type: "user", text: trimmed })]);
18094
18095
  setIsRunning(true);
18095
18096
  streamingCharsRef.current = 0;
18096
- _chunkQHDYFC5Ucjs.taskManager.reset();
18097
+ _chunkQ6BYFYGDcjs.taskManager.reset();
18097
18098
  try {
18098
18099
  let engineMessage = trimmed;
18099
18100
  if (pendingContextRef.current) {
@@ -19276,7 +19277,7 @@ async function replCommand(options) {
19276
19277
  };
19277
19278
  const permissionMode = _nullishCoalesce(options.permissionMode, () => ( "acceptEdits"));
19278
19279
  const maxContextTokens = _nullishCoalesce(settings.context.maxTokens, () => ( 2e5));
19279
- const engine = new (0, _chunkQHDYFC5Ucjs.Engine)({
19280
+ const engine = new (0, _chunkQ6BYFYGDcjs.Engine)({
19280
19281
  llm: llmConfig,
19281
19282
  cwd,
19282
19283
  preset: _nullishCoalesce(options.preset, () => ( settings.agent.preset)),
@@ -19289,7 +19290,8 @@ async function replCommand(options) {
19289
19290
  maxContextTokens,
19290
19291
  sessionStorageDir: settings.session.storageDir,
19291
19292
  costStore: _chunk5LHVI777cjs.costTracker,
19292
- mcpServers: settings.mcpServers
19293
+ mcpServers: settings.mcpServers,
19294
+ approvalBackend: _chunkQ6BYFYGDcjs.getInteractiveApprovalBackend.call(void 0, )
19293
19295
  });
19294
19296
  const [serverTransport, clientTransport] = createInProcessTransport();
19295
19297
  const _server = new AgentServer({ engine, transport: serverTransport });
@@ -19367,8 +19369,8 @@ function createRunManager() {
19367
19369
  maxTokens: _nullishCoalesce(settings.model.maxTokens, () => ( 8192)),
19368
19370
  enableStreaming: true
19369
19371
  };
19370
- const store = new (0, _chunkQHDYFC5Ucjs.FileRunStore)();
19371
- return new (0, _chunkQHDYFC5Ucjs.RunManager)({
19372
+ const store = new (0, _chunkQ6BYFYGDcjs.FileRunStore)();
19373
+ return new (0, _chunkQ6BYFYGDcjs.RunManager)({
19372
19374
  store,
19373
19375
  executor: {
19374
19376
  llm,
@@ -19493,7 +19495,7 @@ function createRunsCommand() {
19493
19495
  console.error(`Run not found: ${runId}`);
19494
19496
  process.exit(1);
19495
19497
  }
19496
- const store = new (0, _chunkQHDYFC5Ucjs.FileRunStore)();
19498
+ const store = new (0, _chunkQ6BYFYGDcjs.FileRunStore)();
19497
19499
  let approvalDecision;
19498
19500
  if (opts.approve || opts.reject) {
19499
19501
  const pendingApproval = await store.getPendingApproval(runId);
package/dist/cli/main.js CHANGED
@@ -11,6 +11,7 @@ import {
11
11
  FileRunStore,
12
12
  RunManager,
13
13
  flushInteractionTime,
14
+ getInteractiveApprovalBackend,
14
15
  init_plan,
15
16
  isInPlanMode,
16
17
  plan_exports,
@@ -20,7 +21,7 @@ import {
20
21
  setRuntimeBypass,
21
22
  taskManager,
22
23
  updateLastInteractionTime
23
- } from "../chunk-7RMAR2Y3.js";
24
+ } from "../chunk-JUHRV2XF.js";
24
25
  import "../chunk-SK62UVS6.js";
25
26
  import "../chunk-KO2FPF7G.js";
26
27
  import {
@@ -16657,7 +16658,7 @@ var utilityCommands = [
16657
16658
  description: "Check for and install updates",
16658
16659
  execute: async (_arg, ctx) => {
16659
16660
  try {
16660
- const { getCurrentVersion, getUpdateAvailable } = await import("../updater-AVD4LKTQ.js");
16661
+ const { getCurrentVersion, getUpdateAvailable } = await import("../updater-PV7FKSUI.js");
16661
16662
  const current = getCurrentVersion();
16662
16663
  const available = getUpdateAvailable();
16663
16664
  if (available) {
@@ -19289,7 +19290,8 @@ async function replCommand(options) {
19289
19290
  maxContextTokens,
19290
19291
  sessionStorageDir: settings.session.storageDir,
19291
19292
  costStore: costTracker,
19292
- mcpServers: settings.mcpServers
19293
+ mcpServers: settings.mcpServers,
19294
+ approvalBackend: getInteractiveApprovalBackend()
19293
19295
  });
19294
19296
  const [serverTransport, clientTransport] = createInProcessTransport();
19295
19297
  const _server = new AgentServer({ engine, transport: serverTransport });
@@ -5,6 +5,8 @@ import type { LLMConfig, StreamCallback, TerminalReason, TokenUsage } from "../t
5
5
  import { ToolRegistry } from "../tool-system/registry.js";
6
6
  import { type ApprovalBackend } from "../tool-system/permission.js";
7
7
  import { HookRegistry } from "../hooks/registry.js";
8
+ import type { HookEventName } from "../hooks/events.js";
9
+ import type { HookHandler } from "../hooks/registry.js";
8
10
  import { SessionManager } from "../session/session-manager.js";
9
11
  import type { CostStateStore } from "./cost-store.js";
10
12
  import { type AskUserFn } from "../tool-system/builtin/ask-user.js";
@@ -24,6 +26,7 @@ export interface EngineConfig {
24
26
  sessionStorageDir?: string;
25
27
  maxContextTokens?: number;
26
28
  approvalBackend?: ApprovalBackend;
29
+ hooks?: EngineHookConfig[];
27
30
  askUser?: AskUserFn;
28
31
  mcpServers?: Record<string, import("../types.js").MCPServerConfig>;
29
32
  /**
@@ -34,6 +37,12 @@ export interface EngineConfig {
34
37
  */
35
38
  costStore?: CostStateStore;
36
39
  }
40
+ export interface EngineHookConfig {
41
+ event: HookEventName;
42
+ handler: HookHandler;
43
+ priority?: number;
44
+ name?: string;
45
+ }
37
46
  export interface EngineResult {
38
47
  text: string;
39
48
  reason: TerminalReason;
@@ -91,6 +100,7 @@ export declare class Engine {
91
100
  after: number;
92
101
  strategy: string;
93
102
  };
103
+ private stripUserContextMessage;
94
104
  /**
95
105
  * Update a config setting at runtime.
96
106
  */
@@ -98,4 +108,6 @@ export declare class Engine {
98
108
  /** Track last context manager and messages for /compact support. */
99
109
  private lastContextManager;
100
110
  private lastMessages;
111
+ private lastSessionId;
112
+ private compactedMessagesBySession;
101
113
  }
@@ -26,6 +26,11 @@ export interface TurnLoopDeps {
26
26
  systemPrompt: string;
27
27
  tools: import("../types.js").ToolDefinition[];
28
28
  }
29
+ export interface TurnLoopResult {
30
+ text: string;
31
+ reason: TerminalReason;
32
+ messages: Message[];
33
+ }
29
34
  export declare class TurnLoop {
30
35
  private readonly deps;
31
36
  private readonly config;
@@ -36,10 +41,7 @@ export declare class TurnLoop {
36
41
  /**
37
42
  * Run the multi-turn agent loop until completion.
38
43
  */
39
- run(initialMessages: Message[]): Promise<{
40
- text: string;
41
- reason: TerminalReason;
42
- }>;
44
+ run(initialMessages: Message[]): Promise<TurnLoopResult>;
43
45
  /**
44
46
  * Call model with streaming fallback.
45
47
  * If streaming fails, emit tombstone and retry non-streaming.
package/dist/index.cjs CHANGED
@@ -1,9 +1,9 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }
2
2
 
3
- var _chunkWFQF3RT4cjs = require('./chunk-WFQF3RT4.cjs');
3
+ var _chunkWYKNZ54Ecjs = require('./chunk-WYKNZ54E.cjs');
4
4
 
5
5
 
6
- var _chunkR32DJSJEcjs = require('./chunk-R32DJSJE.cjs');
6
+ var _chunkMOILS4WEcjs = require('./chunk-MOILS4WE.cjs');
7
7
 
8
8
 
9
9
 
@@ -44,7 +44,7 @@ var _chunkR32DJSJEcjs = require('./chunk-R32DJSJE.cjs');
44
44
 
45
45
 
46
46
 
47
- var _chunkQHDYFC5Ucjs = require('./chunk-QHDYFC5U.cjs');
47
+ var _chunkQ6BYFYGDcjs = require('./chunk-Q6BYFYGD.cjs');
48
48
 
49
49
 
50
50
  var _chunk3QR52LL5cjs = require('./chunk-3QR52LL5.cjs');
@@ -333,4 +333,4 @@ var VERSION = "0.1.0";
333
333
 
334
334
 
335
335
 
336
- exports.AnthropicClient = _chunkZJV3YSY3cjs.AnthropicClient; exports.Arena = _chunkFVP7XJGScjs.Arena; exports.ArenaLedger = _chunkFVP7XJGScjs.ArenaLedger; exports.ArtifactTracker = _chunkQHDYFC5Ucjs.ArtifactTracker; exports.AutoApprovalBackend = _chunkQHDYFC5Ucjs.AutoApprovalBackend; exports.BUILTIN_AGENT_PRESETS = _chunkQHDYFC5Ucjs.BUILTIN_AGENT_PRESETS; exports.BUILTIN_TOOLS = _chunkQHDYFC5Ucjs.BUILTIN_TOOLS; exports.CheckpointWriter = _chunkQHDYFC5Ucjs.CheckpointWriter; exports.CompositeEvaluator = _chunkQHDYFC5Ucjs.CompositeEvaluator; exports.ConfigError = _chunkEL2RL5DGcjs.ConfigError; exports.ContextLimitError = _chunkEL2RL5DGcjs.ContextLimitError; exports.ContextManager = _chunkQHDYFC5Ucjs.ContextManager; exports.DEFAULT_AGENT_PRESET = _chunkQHDYFC5Ucjs.DEFAULT_AGENT_PRESET; exports.DEFAULT_CLI_PRESET = _chunkQHDYFC5Ucjs.DEFAULT_CLI_PRESET; exports.DiscussionStrategy = _chunkFVP7XJGScjs.DiscussionStrategy; exports.Engine = _chunkQHDYFC5Ucjs.Engine; exports.EngineRunner = _chunkQHDYFC5Ucjs.EngineRunner; exports.FileHistory = _chunk3QR52LL5cjs.FileHistory; exports.FileRunStore = _chunkQHDYFC5Ucjs.FileRunStore; exports.FrameworkError = _chunkEL2RL5DGcjs.FrameworkError; exports.HeadlessApprovalBackend = _chunkQHDYFC5Ucjs.HeadlessApprovalBackend; exports.Heartbeat = _chunkQHDYFC5Ucjs.Heartbeat; exports.HookRegistry = _chunkQHDYFC5Ucjs.HookRegistry; exports.IterativeArena = _chunk3EUDE77Ecjs.IterativeArena; exports.LLMClientBase = _chunkDICG4AB7cjs.LLMClientBase; exports.LLMError = _chunkEL2RL5DGcjs.LLMError; exports.LLMRateLimitError = _chunkEL2RL5DGcjs.LLMRateLimitError; exports.MCPManager = _chunkBMH65OVBcjs.MCPManager; exports.MODEL_PRESETS = _chunkFVP7XJGScjs.MODEL_PRESETS; exports.MemoryManager = _chunk3EAEC566cjs.MemoryManager; exports.ModelPool = _chunkUK2SU23Scjs.ModelPool; exports.NoopEvaluator = _chunkQHDYFC5Ucjs.NoopEvaluator; exports.OpenAIClient = _chunkWHRTARDJcjs.OpenAIClient; exports.PermissionClassifier = _chunkQHDYFC5Ucjs.PermissionClassifier; exports.PermissionDeniedError = _chunkEL2RL5DGcjs.PermissionDeniedError; exports.PlanningStrategy = _chunkFVP7XJGScjs.PlanningStrategy; exports.PromptComposer = _chunkQHDYFC5Ucjs.PromptComposer; exports.ReviewStrategy = _chunkFVP7XJGScjs.ReviewStrategy; exports.RunApprovalBackend = _chunkQHDYFC5Ucjs.RunApprovalBackend; exports.RunLock = _chunkQHDYFC5Ucjs.RunLock; exports.RunManager = _chunkQHDYFC5Ucjs.RunManager; exports.RunQueue = _chunkQHDYFC5Ucjs.RunQueue; exports.SectionCache = _chunkQHDYFC5Ucjs.SectionCache; exports.SessionError = _chunkEL2RL5DGcjs.SessionError; exports.SessionManager = _chunkNG73UR3Lcjs.SessionManager; exports.SettingsManager = _chunkFGZGCFJXcjs.SettingsManager; exports.SettingsSchema = _chunkFGZGCFJXcjs.SettingsSchema; exports.ToolError = _chunkEL2RL5DGcjs.ToolError; exports.ToolExecutionError = _chunkEL2RL5DGcjs.ToolExecutionError; exports.ToolExecutor = _chunkQHDYFC5Ucjs.ToolExecutor; exports.ToolNotFoundError = _chunkEL2RL5DGcjs.ToolNotFoundError; exports.ToolRegistry = _chunkQHDYFC5Ucjs.ToolRegistry; exports.ToolTimeoutError = _chunkEL2RL5DGcjs.ToolTimeoutError; exports.Transcript = _chunkNG73UR3Lcjs.Transcript; exports.TranscriptError = _chunkEL2RL5DGcjs.TranscriptError; exports.VALID_TRANSITIONS = _chunkQHDYFC5Ucjs.VALID_TRANSITIONS; exports.VERSION = VERSION; exports.applyReviewResult = _chunkFVP7XJGScjs.applyReviewResult; exports.applySummaryCompaction = _chunkLRAY5IYCcjs.applySummaryCompaction; exports.availableSections = _chunkQHDYFC5Ucjs.availableSections; exports.buildDigest = _chunkFVP7XJGScjs.buildDigest; exports.buildPresetSystemPrompt = _chunkQHDYFC5Ucjs.buildPresetSystemPrompt; exports.buildSkillListing = _chunkCSO5EOEPcjs.buildSkillListing; exports.buildSummarizationPrompt = _chunkLRAY5IYCcjs.buildSummarizationPrompt; exports.collectEvidence = _chunkFVP7XJGScjs.collectEvidence; exports.combineInstructions = _chunkQHDYFC5Ucjs.combineInstructions; exports.createLLMClient = _chunkFVP7XJGScjs.createLLMClient; exports.createRunAskUserFn = _chunkQHDYFC5Ucjs.createRunAskUserFn; exports.createRunManager = _chunkR32DJSJEcjs.createRunManager; exports.defaultIterateConvergence = _chunk3EUDE77Ecjs.defaultConvergence; exports.defineProduct = _chunkWFQF3RT4cjs.defineProduct; exports.detectArenaMode = detectArenaMode; exports.estimateTokens = _chunkLRAY5IYCcjs.estimateTokens; exports.formatDigest = _chunkFVP7XJGScjs.formatDigest; exports.getIterateFormat = _chunk3EUDE77Ecjs.getFormat; exports.getMaxOutputTokens = _chunkFVP7XJGScjs.getMaxOutputTokens; exports.getStrategy = _chunkFVP7XJGScjs.getStrategy; exports.getStrategyForPlan = _chunkFVP7XJGScjs.getStrategyForPlan; exports.hasTools = _chunkFVP7XJGScjs.hasTools; exports.isTerminal = _chunkFVP7XJGScjs.isTerminal; exports.iterateCodeFormat = _chunk3EUDE77Ecjs.codeFormat; exports.iterateDiffRatio = _chunk3EUDE77Ecjs.diffRatio; exports.iterateDocumentFormat = _chunk3EUDE77Ecjs.documentFormat; exports.listPresetNames = _chunkQHDYFC5Ucjs.listPresetNames; exports.loadSection = _chunkQHDYFC5Ucjs.loadSection; exports.loadSections = _chunkQHDYFC5Ucjs.loadSections; exports.logger = _chunkIMMTBZ33cjs.logger; exports.markUnderReview = _chunkFVP7XJGScjs.markUnderReview; exports.markUnresolved = _chunkFVP7XJGScjs.markUnresolved; exports.matchSkillsByInput = _chunkCSO5EOEPcjs.matchSkillsByInput; exports.matchSkillsByTool = _chunkCSO5EOEPcjs.matchSkillsByTool; exports.microcompact = _chunkLRAY5IYCcjs.microcompact; exports.planArena = _chunkFVP7XJGScjs.planArena; exports.registerClaims = _chunkFVP7XJGScjs.registerClaims; exports.registerPreset = _chunkQHDYFC5Ucjs.registerPreset; exports.registerProvider = _chunkFVP7XJGScjs.registerProvider; exports.registerSection = _chunkQHDYFC5Ucjs.registerSection; exports.resolveAgentPreset = _chunkQHDYFC5Ucjs.resolveAgentPreset; exports.resolveBuiltinToolNames = _chunkQHDYFC5Ucjs.resolveBuiltinToolNames; exports.resolveClaimStatus = _chunkFVP7XJGScjs.resolveClaimStatus; exports.scanInstructions = _chunkQHDYFC5Ucjs.scanInstructions; exports.scanSkills = _chunkCSO5EOEPcjs.scanSkills; exports.selectClaimsForReview = _chunkFVP7XJGScjs.selectClaimsForReview; exports.selectTools = _chunkFVP7XJGScjs.selectTools; exports.taskManager = _chunkQHDYFC5Ucjs.taskManager; exports.transitionClaim = _chunkFVP7XJGScjs.transitionClaim; exports.truncateToolResult = _chunkLRAY5IYCcjs.truncateToolResult; exports.validTransitions = _chunkFVP7XJGScjs.validTransitions; exports.validateSettings = _chunkFGZGCFJXcjs.validateSettings; exports.windowCompact = _chunkLRAY5IYCcjs.windowCompact;
336
+ exports.AnthropicClient = _chunkZJV3YSY3cjs.AnthropicClient; exports.Arena = _chunkFVP7XJGScjs.Arena; exports.ArenaLedger = _chunkFVP7XJGScjs.ArenaLedger; exports.ArtifactTracker = _chunkQ6BYFYGDcjs.ArtifactTracker; exports.AutoApprovalBackend = _chunkQ6BYFYGDcjs.AutoApprovalBackend; exports.BUILTIN_AGENT_PRESETS = _chunkQ6BYFYGDcjs.BUILTIN_AGENT_PRESETS; exports.BUILTIN_TOOLS = _chunkQ6BYFYGDcjs.BUILTIN_TOOLS; exports.CheckpointWriter = _chunkQ6BYFYGDcjs.CheckpointWriter; exports.CompositeEvaluator = _chunkQ6BYFYGDcjs.CompositeEvaluator; exports.ConfigError = _chunkEL2RL5DGcjs.ConfigError; exports.ContextLimitError = _chunkEL2RL5DGcjs.ContextLimitError; exports.ContextManager = _chunkQ6BYFYGDcjs.ContextManager; exports.DEFAULT_AGENT_PRESET = _chunkQ6BYFYGDcjs.DEFAULT_AGENT_PRESET; exports.DEFAULT_CLI_PRESET = _chunkQ6BYFYGDcjs.DEFAULT_CLI_PRESET; exports.DiscussionStrategy = _chunkFVP7XJGScjs.DiscussionStrategy; exports.Engine = _chunkQ6BYFYGDcjs.Engine; exports.EngineRunner = _chunkQ6BYFYGDcjs.EngineRunner; exports.FileHistory = _chunk3QR52LL5cjs.FileHistory; exports.FileRunStore = _chunkQ6BYFYGDcjs.FileRunStore; exports.FrameworkError = _chunkEL2RL5DGcjs.FrameworkError; exports.HeadlessApprovalBackend = _chunkQ6BYFYGDcjs.HeadlessApprovalBackend; exports.Heartbeat = _chunkQ6BYFYGDcjs.Heartbeat; exports.HookRegistry = _chunkQ6BYFYGDcjs.HookRegistry; exports.IterativeArena = _chunk3EUDE77Ecjs.IterativeArena; exports.LLMClientBase = _chunkDICG4AB7cjs.LLMClientBase; exports.LLMError = _chunkEL2RL5DGcjs.LLMError; exports.LLMRateLimitError = _chunkEL2RL5DGcjs.LLMRateLimitError; exports.MCPManager = _chunkBMH65OVBcjs.MCPManager; exports.MODEL_PRESETS = _chunkFVP7XJGScjs.MODEL_PRESETS; exports.MemoryManager = _chunk3EAEC566cjs.MemoryManager; exports.ModelPool = _chunkUK2SU23Scjs.ModelPool; exports.NoopEvaluator = _chunkQ6BYFYGDcjs.NoopEvaluator; exports.OpenAIClient = _chunkWHRTARDJcjs.OpenAIClient; exports.PermissionClassifier = _chunkQ6BYFYGDcjs.PermissionClassifier; exports.PermissionDeniedError = _chunkEL2RL5DGcjs.PermissionDeniedError; exports.PlanningStrategy = _chunkFVP7XJGScjs.PlanningStrategy; exports.PromptComposer = _chunkQ6BYFYGDcjs.PromptComposer; exports.ReviewStrategy = _chunkFVP7XJGScjs.ReviewStrategy; exports.RunApprovalBackend = _chunkQ6BYFYGDcjs.RunApprovalBackend; exports.RunLock = _chunkQ6BYFYGDcjs.RunLock; exports.RunManager = _chunkQ6BYFYGDcjs.RunManager; exports.RunQueue = _chunkQ6BYFYGDcjs.RunQueue; exports.SectionCache = _chunkQ6BYFYGDcjs.SectionCache; exports.SessionError = _chunkEL2RL5DGcjs.SessionError; exports.SessionManager = _chunkNG73UR3Lcjs.SessionManager; exports.SettingsManager = _chunkFGZGCFJXcjs.SettingsManager; exports.SettingsSchema = _chunkFGZGCFJXcjs.SettingsSchema; exports.ToolError = _chunkEL2RL5DGcjs.ToolError; exports.ToolExecutionError = _chunkEL2RL5DGcjs.ToolExecutionError; exports.ToolExecutor = _chunkQ6BYFYGDcjs.ToolExecutor; exports.ToolNotFoundError = _chunkEL2RL5DGcjs.ToolNotFoundError; exports.ToolRegistry = _chunkQ6BYFYGDcjs.ToolRegistry; exports.ToolTimeoutError = _chunkEL2RL5DGcjs.ToolTimeoutError; exports.Transcript = _chunkNG73UR3Lcjs.Transcript; exports.TranscriptError = _chunkEL2RL5DGcjs.TranscriptError; exports.VALID_TRANSITIONS = _chunkQ6BYFYGDcjs.VALID_TRANSITIONS; exports.VERSION = VERSION; exports.applyReviewResult = _chunkFVP7XJGScjs.applyReviewResult; exports.applySummaryCompaction = _chunkLRAY5IYCcjs.applySummaryCompaction; exports.availableSections = _chunkQ6BYFYGDcjs.availableSections; exports.buildDigest = _chunkFVP7XJGScjs.buildDigest; exports.buildPresetSystemPrompt = _chunkQ6BYFYGDcjs.buildPresetSystemPrompt; exports.buildSkillListing = _chunkCSO5EOEPcjs.buildSkillListing; exports.buildSummarizationPrompt = _chunkLRAY5IYCcjs.buildSummarizationPrompt; exports.collectEvidence = _chunkFVP7XJGScjs.collectEvidence; exports.combineInstructions = _chunkQ6BYFYGDcjs.combineInstructions; exports.createLLMClient = _chunkFVP7XJGScjs.createLLMClient; exports.createRunAskUserFn = _chunkQ6BYFYGDcjs.createRunAskUserFn; exports.createRunManager = _chunkMOILS4WEcjs.createRunManager; exports.defaultIterateConvergence = _chunk3EUDE77Ecjs.defaultConvergence; exports.defineProduct = _chunkWYKNZ54Ecjs.defineProduct; exports.detectArenaMode = detectArenaMode; exports.estimateTokens = _chunkLRAY5IYCcjs.estimateTokens; exports.formatDigest = _chunkFVP7XJGScjs.formatDigest; exports.getIterateFormat = _chunk3EUDE77Ecjs.getFormat; exports.getMaxOutputTokens = _chunkFVP7XJGScjs.getMaxOutputTokens; exports.getStrategy = _chunkFVP7XJGScjs.getStrategy; exports.getStrategyForPlan = _chunkFVP7XJGScjs.getStrategyForPlan; exports.hasTools = _chunkFVP7XJGScjs.hasTools; exports.isTerminal = _chunkFVP7XJGScjs.isTerminal; exports.iterateCodeFormat = _chunk3EUDE77Ecjs.codeFormat; exports.iterateDiffRatio = _chunk3EUDE77Ecjs.diffRatio; exports.iterateDocumentFormat = _chunk3EUDE77Ecjs.documentFormat; exports.listPresetNames = _chunkQ6BYFYGDcjs.listPresetNames; exports.loadSection = _chunkQ6BYFYGDcjs.loadSection; exports.loadSections = _chunkQ6BYFYGDcjs.loadSections; exports.logger = _chunkIMMTBZ33cjs.logger; exports.markUnderReview = _chunkFVP7XJGScjs.markUnderReview; exports.markUnresolved = _chunkFVP7XJGScjs.markUnresolved; exports.matchSkillsByInput = _chunkCSO5EOEPcjs.matchSkillsByInput; exports.matchSkillsByTool = _chunkCSO5EOEPcjs.matchSkillsByTool; exports.microcompact = _chunkLRAY5IYCcjs.microcompact; exports.planArena = _chunkFVP7XJGScjs.planArena; exports.registerClaims = _chunkFVP7XJGScjs.registerClaims; exports.registerPreset = _chunkQ6BYFYGDcjs.registerPreset; exports.registerProvider = _chunkFVP7XJGScjs.registerProvider; exports.registerSection = _chunkQ6BYFYGDcjs.registerSection; exports.resolveAgentPreset = _chunkQ6BYFYGDcjs.resolveAgentPreset; exports.resolveBuiltinToolNames = _chunkQ6BYFYGDcjs.resolveBuiltinToolNames; exports.resolveClaimStatus = _chunkFVP7XJGScjs.resolveClaimStatus; exports.scanInstructions = _chunkQ6BYFYGDcjs.scanInstructions; exports.scanSkills = _chunkCSO5EOEPcjs.scanSkills; exports.selectClaimsForReview = _chunkFVP7XJGScjs.selectClaimsForReview; exports.selectTools = _chunkFVP7XJGScjs.selectTools; exports.taskManager = _chunkQ6BYFYGDcjs.taskManager; exports.transitionClaim = _chunkFVP7XJGScjs.transitionClaim; exports.truncateToolResult = _chunkLRAY5IYCcjs.truncateToolResult; exports.validTransitions = _chunkFVP7XJGScjs.validTransitions; exports.validateSettings = _chunkFGZGCFJXcjs.validateSettings; exports.windowCompact = _chunkLRAY5IYCcjs.windowCompact;
package/dist/index.d.ts CHANGED
@@ -7,7 +7,7 @@ export declare const VERSION = "0.1.0";
7
7
  export type { Message, ContentBlock, ToolDefinition, ToolCall, ToolResult, RegisteredTool, TranscriptEvent, TranscriptEventType, SessionState, TokenUsage, CompiledInput, PermissionDecision, PermissionMode, PermissionRule, TurnPhase, TurnResult, TerminalReason, StreamEvent, StreamCallback, LLMConfig, LLMResponse, Settings, MCPServerConfig, } from "./types.js";
8
8
  export { FrameworkError, LLMError, LLMRateLimitError, ContextLimitError, ToolError, ToolNotFoundError, ToolExecutionError, ToolTimeoutError, PermissionDeniedError, SessionError, TranscriptError, ConfigError, } from "./exceptions.js";
9
9
  export { Engine } from "./engine/engine.js";
10
- export type { EngineConfig, EngineResult } from "./engine/engine.js";
10
+ export type { EngineConfig, EngineHookConfig, EngineResult } from "./engine/engine.js";
11
11
  export type { CostStateStore, CostStateSnapshot } from "./engine/cost-store.js";
12
12
  export { LLMClientBase } from "./llm/client-base.js";
13
13
  export { createLLMClient, registerProvider } from "./llm/client-factory.js";
package/dist/index.js CHANGED
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  defineProduct
3
- } from "./chunk-6JOOLG6F.js";
3
+ } from "./chunk-AP5F6VYE.js";
4
4
  import {
5
5
  createRunManager
6
- } from "./chunk-BHGIJ2DJ.js";
6
+ } from "./chunk-FECTK5KJ.js";
7
7
  import {
8
8
  ArtifactTracker,
9
9
  AutoApprovalBackend,
@@ -44,7 +44,7 @@ import {
44
44
  resolveBuiltinToolNames,
45
45
  scanInstructions,
46
46
  taskManager
47
- } from "./chunk-7RMAR2Y3.js";
47
+ } from "./chunk-JUHRV2XF.js";
48
48
  import {
49
49
  FileHistory
50
50
  } from "./chunk-SK62UVS6.js";
@@ -1,7 +1,7 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunkWFQF3RT4cjs = require('../chunk-WFQF3RT4.cjs');
4
- require('../chunk-QHDYFC5U.cjs');
3
+ var _chunkWYKNZ54Ecjs = require('../chunk-WYKNZ54E.cjs');
4
+ require('../chunk-Q6BYFYGD.cjs');
5
5
  require('../chunk-3QR52LL5.cjs');
6
6
  require('../chunk-UK2SU23S.cjs');
7
7
  require('../chunk-FGZGCFJX.cjs');
@@ -20,4 +20,4 @@ require('../chunk-XHC2JMEC.cjs');
20
20
  require('../chunk-IJSHQGMP.cjs');
21
21
 
22
22
 
23
- exports.defineProduct = _chunkWFQF3RT4cjs.defineProduct;
23
+ exports.defineProduct = _chunkWYKNZ54Ecjs.defineProduct;
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  defineProduct
3
- } from "../chunk-6JOOLG6F.js";
4
- import "../chunk-7RMAR2Y3.js";
3
+ } from "../chunk-AP5F6VYE.js";
4
+ import "../chunk-JUHRV2XF.js";
5
5
  import "../chunk-SK62UVS6.js";
6
6
  import "../chunk-KO2FPF7G.js";
7
7
  import "../chunk-6ZIROYXX.js";
@@ -20,8 +20,8 @@
20
20
  */
21
21
  import type { PermissionRule, MCPServerConfig } from "../types.js";
22
22
  import type { Evaluator } from "../run/Evaluator.js";
23
- import type { HookEventName } from "../hooks/events.js";
24
23
  import type { RegisteredTool } from "../types.js";
24
+ import type { EngineHookConfig } from "../engine/engine.js";
25
25
  export interface ProductPreset {
26
26
  /** Unique name for this product's preset. */
27
27
  name: string;
@@ -75,12 +75,7 @@ export interface ProductAdapter {
75
75
  * Hooks to register for this product.
76
76
  * Key: hook event name, Value: handler function.
77
77
  */
78
- hooks?: Array<{
79
- event: HookEventName;
80
- handler: (context: Record<string, unknown>) => Promise<Record<string, unknown>>;
81
- priority?: number;
82
- name?: string;
83
- }>;
78
+ hooks?: EngineHookConfig[];
84
79
  }
85
80
  export interface ProductContract {
86
81
  /**
@@ -8,7 +8,7 @@
8
8
  * - Forward stream events to RunManager
9
9
  * - Return execution result (does NOT manage run state transitions)
10
10
  */
11
- import { type EngineConfig } from "../engine/engine.js";
11
+ import { type EngineConfig, type EngineHookConfig } from "../engine/engine.js";
12
12
  import type { LLMConfig, RegisteredTool } from "../types.js";
13
13
  import type { RunSnapshot, RunExecutionContext, RunExecutionResult } from "./types.js";
14
14
  import { type RunLifecycleHooks } from "./RunApprovalBackend.js";
@@ -59,6 +59,8 @@ export interface EngineRunnerConfig {
59
59
  mcpServers?: EngineConfig["mcpServers"];
60
60
  /** Custom tools registered by the product adapter. */
61
61
  customTools?: CustomToolEntry[];
62
+ /** Hooks registered into each Engine instance before run execution. */
63
+ hooks?: EngineHookConfig[];
62
64
  }
63
65
  export declare class EngineRunner implements RunExecutor {
64
66
  private readonly config;
@@ -31,6 +31,10 @@ export interface RunManagerConfig {
31
31
  staleLockMs?: number;
32
32
  /** Optional evaluator to run on completion. Default: NoopEvaluator */
33
33
  evaluator?: Evaluator;
34
+ /** Tags applied to every submitted run unless already present. */
35
+ defaultTags?: string[];
36
+ /** Metadata merged into every submitted run. Submit input wins on conflicts. */
37
+ defaultMetadata?: Record<string, unknown>;
34
38
  }
35
39
  export declare class RunManager {
36
40
  private readonly store;
@@ -39,6 +43,8 @@ export declare class RunManager {
39
43
  private readonly lock;
40
44
  private readonly heartbeat;
41
45
  private readonly evaluator;
46
+ private readonly defaultTags;
47
+ private readonly defaultMetadata;
42
48
  private readonly subscribers;
43
49
  private readonly abortControllers;
44
50
  /** Active execution handles — used to resolve pending approvals/input while Engine is suspended */
@@ -18,7 +18,7 @@
18
18
  * ```
19
19
  */
20
20
  import type { LLMConfig, PermissionMode } from "../types.js";
21
- import type { EngineConfig } from "../engine/engine.js";
21
+ import type { EngineConfig, EngineHookConfig } from "../engine/engine.js";
22
22
  import type { Evaluator } from "./Evaluator.js";
23
23
  import { RunManager } from "./RunManager.js";
24
24
  export interface CreateRunManagerOptions {
@@ -50,6 +50,12 @@ export interface CreateRunManagerOptions {
50
50
  appendSystemPrompt?: string;
51
51
  /** Optional evaluator for run completion. */
52
52
  evaluator?: Evaluator;
53
+ /** Hooks registered into each Engine instance before run execution. */
54
+ hooks?: EngineHookConfig[];
55
+ /** Tags applied to every submitted run unless already present. */
56
+ defaultTags?: string[];
57
+ /** Metadata merged into every submitted run. Submit input wins on conflicts. */
58
+ defaultMetadata?: Record<string, unknown>;
53
59
  }
54
60
  /**
55
61
  * Create a fully configured RunManager with one call.
@@ -1,6 +1,6 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunkR32DJSJEcjs = require('../chunk-R32DJSJE.cjs');
3
+ var _chunkMOILS4WEcjs = require('../chunk-MOILS4WE.cjs');
4
4
 
5
5
 
6
6
 
@@ -15,7 +15,7 @@ var _chunkR32DJSJEcjs = require('../chunk-R32DJSJE.cjs');
15
15
 
16
16
 
17
17
 
18
- var _chunkQHDYFC5Ucjs = require('../chunk-QHDYFC5U.cjs');
18
+ var _chunkQ6BYFYGDcjs = require('../chunk-Q6BYFYGD.cjs');
19
19
  require('../chunk-3QR52LL5.cjs');
20
20
  require('../chunk-UK2SU23S.cjs');
21
21
  require('../chunk-FGZGCFJX.cjs');
@@ -47,4 +47,4 @@ require('../chunk-IJSHQGMP.cjs');
47
47
 
48
48
 
49
49
 
50
- exports.ArtifactTracker = _chunkQHDYFC5Ucjs.ArtifactTracker; exports.CheckpointWriter = _chunkQHDYFC5Ucjs.CheckpointWriter; exports.CompositeEvaluator = _chunkQHDYFC5Ucjs.CompositeEvaluator; exports.EngineRunner = _chunkQHDYFC5Ucjs.EngineRunner; exports.FileRunStore = _chunkQHDYFC5Ucjs.FileRunStore; exports.Heartbeat = _chunkQHDYFC5Ucjs.Heartbeat; exports.NoopEvaluator = _chunkQHDYFC5Ucjs.NoopEvaluator; exports.RunApprovalBackend = _chunkQHDYFC5Ucjs.RunApprovalBackend; exports.RunLock = _chunkQHDYFC5Ucjs.RunLock; exports.RunManager = _chunkQHDYFC5Ucjs.RunManager; exports.RunQueue = _chunkQHDYFC5Ucjs.RunQueue; exports.VALID_TRANSITIONS = _chunkQHDYFC5Ucjs.VALID_TRANSITIONS; exports.createRunAskUserFn = _chunkQHDYFC5Ucjs.createRunAskUserFn; exports.createRunManager = _chunkR32DJSJEcjs.createRunManager;
50
+ exports.ArtifactTracker = _chunkQ6BYFYGDcjs.ArtifactTracker; exports.CheckpointWriter = _chunkQ6BYFYGDcjs.CheckpointWriter; exports.CompositeEvaluator = _chunkQ6BYFYGDcjs.CompositeEvaluator; exports.EngineRunner = _chunkQ6BYFYGDcjs.EngineRunner; exports.FileRunStore = _chunkQ6BYFYGDcjs.FileRunStore; exports.Heartbeat = _chunkQ6BYFYGDcjs.Heartbeat; exports.NoopEvaluator = _chunkQ6BYFYGDcjs.NoopEvaluator; exports.RunApprovalBackend = _chunkQ6BYFYGDcjs.RunApprovalBackend; exports.RunLock = _chunkQ6BYFYGDcjs.RunLock; exports.RunManager = _chunkQ6BYFYGDcjs.RunManager; exports.RunQueue = _chunkQ6BYFYGDcjs.RunQueue; exports.VALID_TRANSITIONS = _chunkQ6BYFYGDcjs.VALID_TRANSITIONS; exports.createRunAskUserFn = _chunkQ6BYFYGDcjs.createRunAskUserFn; exports.createRunManager = _chunkMOILS4WEcjs.createRunManager;
package/dist/run/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  createRunManager
3
- } from "../chunk-BHGIJ2DJ.js";
3
+ } from "../chunk-FECTK5KJ.js";
4
4
  import {
5
5
  ArtifactTracker,
6
6
  CheckpointWriter,
@@ -15,7 +15,7 @@ import {
15
15
  RunQueue,
16
16
  VALID_TRANSITIONS,
17
17
  createRunAskUserFn
18
- } from "../chunk-7RMAR2Y3.js";
18
+ } from "../chunk-JUHRV2XF.js";
19
19
  import "../chunk-SK62UVS6.js";
20
20
  import "../chunk-KO2FPF7G.js";
21
21
  import "../chunk-6ZIROYXX.js";
@@ -0,0 +1,36 @@
1
+ /**
2
+ * In-process async agent registry.
3
+ *
4
+ * When an Agent tool call uses run_in_background: true, the sub-agent
5
+ * runs detached from the current turn. We need somewhere to track
6
+ * agentId → status / result / cancel handle so the parent agent can
7
+ * later check on it (AgentStatus) or cancel it (AgentCancel).
8
+ *
9
+ * Lifetime: process-local. Crashing the process loses these — that's
10
+ * the same contract Claude Code's Agent.run_in_background gives, and
11
+ * the right boundary: long-running cross-process work belongs to
12
+ * RunManager, not here.
13
+ */
14
+ export type AsyncAgentStatus = "running" | "completed" | "failed" | "cancelled";
15
+ export interface AsyncAgentEntry {
16
+ agentId: string;
17
+ description: string;
18
+ status: AsyncAgentStatus;
19
+ startedAt: number;
20
+ finishedAt?: number;
21
+ result?: string;
22
+ error?: string;
23
+ abort: () => void;
24
+ }
25
+ declare class AsyncAgentRegistry {
26
+ private agents;
27
+ register(entry: AsyncAgentEntry): void;
28
+ get(agentId: string): AsyncAgentEntry | undefined;
29
+ list(): AsyncAgentEntry[];
30
+ markCompleted(agentId: string, result: string): void;
31
+ markFailed(agentId: string, error: string): void;
32
+ cancel(agentId: string): boolean;
33
+ reset(): void;
34
+ }
35
+ export declare const asyncAgentRegistry: AsyncAgentRegistry;
36
+ export {};
@@ -33,3 +33,7 @@ export interface SubAgentConfig {
33
33
  }
34
34
  export declare function setSubAgentConfig(config: SubAgentConfig | undefined): void;
35
35
  export declare function agentTool(args: Record<string, unknown>): Promise<string>;
36
+ export declare const agentStatusToolDef: ToolDefinition;
37
+ export declare function agentStatusTool(args: Record<string, unknown>): Promise<string>;
38
+ export declare const agentCancelToolDef: ToolDefinition;
39
+ export declare function agentCancelTool(args: Record<string, unknown>): Promise<string>;
@@ -3,6 +3,12 @@
3
3
  */
4
4
  import type { RegisteredTool, ToolDefinition, ToolResult } from "../types.js";
5
5
  import { type BuiltinToolFn } from "./builtin/index.js";
6
+ /**
7
+ * Default execution timeout for any tool that does not declare its own
8
+ * timeoutMs at registration time. Tools that need to run longer (Agent,
9
+ * Arena, Bash, custom long-running tools) should set timeoutMs explicitly.
10
+ */
11
+ export declare const DEFAULT_TOOL_TIMEOUT_MS = 120000;
6
12
  export interface ToolRegistryOptions {
7
13
  builtinTools?: readonly string[];
8
14
  }
package/dist/types.d.ts CHANGED
@@ -49,6 +49,12 @@ export interface RegisteredTool {
49
49
  permissionDefault: PermissionDecision;
50
50
  isConcurrencySafe?: boolean;
51
51
  isReadOnly?: boolean;
52
+ /**
53
+ * Override the default tool execution timeout (ms).
54
+ * Falls back to DEFAULT_TOOL_TIMEOUT_MS (120s) if unset.
55
+ * The caller of executeTool() can still override via options.timeoutMs.
56
+ */
57
+ timeoutMs?: number;
52
58
  }
53
59
  export type TranscriptEventType = "message" | "tool_use" | "tool_result" | "summary" | "content_replace" | "file_history" | "plan_operation" | "session_meta" | "turn_boundary" | "error";
54
60
  export interface TranscriptEvent {
@@ -8,7 +8,7 @@ var require_package = _chunkIJSHQGMPcjs.__commonJS.call(void 0, {
8
8
  "package.json"(exports, module) {
9
9
  module.exports = {
10
10
  name: "@cjhyy/code-shell",
11
- version: "0.1.0-alpha.0",
11
+ version: "0.1.0-alpha.1",
12
12
  description: "Code Shell \u2014 general-purpose agent orchestration framework with a terminal coding preset",
13
13
  type: "module",
14
14
  main: "./dist/index.cjs",
@@ -8,7 +8,7 @@ var require_package = __commonJS({
8
8
  "package.json"(exports, module) {
9
9
  module.exports = {
10
10
  name: "@cjhyy/code-shell",
11
- version: "0.1.0-alpha.0",
11
+ version: "0.1.0-alpha.1",
12
12
  description: "Code Shell \u2014 general-purpose agent orchestration framework with a terminal coding preset",
13
13
  type: "module",
14
14
  main: "./dist/index.cjs",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cjhyy/code-shell",
3
- "version": "0.1.0-alpha.0",
3
+ "version": "0.1.0-alpha.1",
4
4
  "description": "Code Shell — general-purpose agent orchestration framework with a terminal coding preset",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",