@accomplish_ai/agent-core-cli 0.1.9 → 0.2.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/api.d.ts ADDED
@@ -0,0 +1,23 @@
1
+ import type { SandboxMessage } from './types.js';
2
+ export type { SandboxMessage };
3
+ export interface AgentConfig {
4
+ /** Anthropic API key */
5
+ apiKey: string;
6
+ /** Model identifier, default: 'anthropic/claude-sonnet-4-5' */
7
+ model?: string;
8
+ /** Working directory for the agent, default: process.cwd() */
9
+ workdir?: string;
10
+ /** Data directory for SQLite storage, default: '/app/data' */
11
+ dataDir?: string;
12
+ }
13
+ export interface Agent {
14
+ /** Start a new job with the given prompt. Returns immediately with a jobId. */
15
+ startJob(prompt: string): Promise<{
16
+ jobId: string;
17
+ }>;
18
+ /** Subscribe to events for a job. Returns an unsubscribe function. */
19
+ onEvent(jobId: string, cb: (event: SandboxMessage) => void): () => void;
20
+ /** Gracefully shut down the agent (cleanup storage, permission servers, etc.) */
21
+ shutdown(): Promise<void>;
22
+ }
23
+ export declare function createAgent(config: AgentConfig): Promise<Agent>;
package/dist/api.js ADDED
@@ -0,0 +1,37 @@
1
+ import { randomUUID } from 'node:crypto';
2
+ import { initialize } from './core/init.js';
3
+ import { JobRunner } from './core/job-runner.js';
4
+ import { EventBus } from './server/event-bus.js';
5
+ export async function createAgent(config) {
6
+ process.env.ANTHROPIC_API_KEY = config.apiKey;
7
+ const initOptions = {
8
+ model: config.model ?? 'anthropic/claude-sonnet-4-5',
9
+ workdir: config.workdir ?? process.cwd(),
10
+ dataDir: config.dataDir ?? '/app/data',
11
+ };
12
+ const { storage, taskManager, cleanup } = await initialize(initOptions);
13
+ const eventBus = new EventBus();
14
+ const backupDir = '/data/backup';
15
+ const jobRunner = new JobRunner({
16
+ storage,
17
+ taskManager,
18
+ eventBus,
19
+ dataDir: initOptions.dataDir,
20
+ backupDir,
21
+ });
22
+ return {
23
+ async startJob(prompt) {
24
+ const jobId = randomUUID();
25
+ // startJob is fire-and-forget — it saves the task and starts it async
26
+ await jobRunner.startJob(jobId, prompt, initOptions.workdir);
27
+ return { jobId };
28
+ },
29
+ onEvent(jobId, cb) {
30
+ return eventBus.subscribe(jobId, cb);
31
+ },
32
+ async shutdown() {
33
+ await cleanup();
34
+ },
35
+ };
36
+ }
37
+ //# sourceMappingURL=api.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api.js","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,UAAU,EAAoB,MAAM,gBAAgB,CAAC;AAC9D,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAyBjD,MAAM,CAAC,KAAK,UAAU,WAAW,CAAC,MAAmB;IACnD,OAAO,CAAC,GAAG,CAAC,iBAAiB,GAAG,MAAM,CAAC,MAAM,CAAC;IAE9C,MAAM,WAAW,GAAgB;QAC/B,KAAK,EAAE,MAAM,CAAC,KAAK,IAAI,6BAA6B;QACpD,OAAO,EAAE,MAAM,CAAC,OAAO,IAAI,OAAO,CAAC,GAAG,EAAE;QACxC,OAAO,EAAE,MAAM,CAAC,OAAO,IAAI,WAAW;KACvC,CAAC;IAEF,MAAM,EAAE,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,GAAG,MAAM,UAAU,CAAC,WAAW,CAAC,CAAC;IAExE,MAAM,QAAQ,GAAG,IAAI,QAAQ,EAAE,CAAC;IAChC,MAAM,SAAS,GAAG,cAAc,CAAC;IAEjC,MAAM,SAAS,GAAG,IAAI,SAAS,CAAC;QAC9B,OAAO;QACP,WAAW;QACX,QAAQ;QACR,OAAO,EAAE,WAAW,CAAC,OAAQ;QAC7B,SAAS;KACV,CAAC,CAAC;IAEH,OAAO;QACL,KAAK,CAAC,QAAQ,CAAC,MAAc;YAC3B,MAAM,KAAK,GAAG,UAAU,EAAE,CAAC;YAC3B,sEAAsE;YACtE,MAAM,SAAS,CAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC;YAC7D,OAAO,EAAE,KAAK,EAAE,CAAC;QACnB,CAAC;QAED,OAAO,CAAC,KAAa,EAAE,EAAmC;YACxD,OAAO,QAAQ,CAAC,SAAS,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;QACvC,CAAC;QAED,KAAK,CAAC,QAAQ;YACZ,MAAM,OAAO,EAAE,CAAC;QAClB,CAAC;KACF,CAAC;AACJ,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@accomplish_ai/agent-core-cli",
3
- "version": "0.1.9",
3
+ "version": "0.2.0",
4
4
  "description": "Headless CLI wrapping @accomplish_ai/agent-core",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -17,6 +17,10 @@
17
17
  "bin": {
18
18
  "agent-core-cli": "./dist/index.js"
19
19
  },
20
+ "exports": {
21
+ ".": "./dist/index.js",
22
+ "./api": "./dist/api.js"
23
+ },
20
24
  "main": "./dist/index.js",
21
25
  "types": "./dist/index.d.ts",
22
26
  "scripts": {