@a3s-lab/code 3.6.2 → 4.0.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/generated.d.ts CHANGED
@@ -1234,6 +1234,51 @@ export declare class Agent {
1234
1234
  * deployments.
1235
1235
  */
1236
1236
  disconnectIdleMcp(idleThresholdMs: number): Promise<Array<string>>
1237
+ /**
1238
+ * Serve a filesystem-first agent directory's cron schedules until stopped.
1239
+ *
1240
+ * Loads the directory by convention: `instructions.md` (required), optional
1241
+ * `agent.acl`, `skills/`, `schedules/*.md` (cron jobs), and `tools/*.md`
1242
+ * (`kind: mcp` servers or `kind: script` sandboxed QuickJS tools). It starts
1243
+ * one durable session per enabled schedule (stable id `schedule:<name>`) with
1244
+ * the agent dir's tools installed; each schedule fires as a FULL harness turn
1245
+ * (context, tool visibility, safety gate, verification), never a raw model call.
1246
+ *
1247
+ * Returns immediately with a {@link ServeHandle}; the daemon runs in the
1248
+ * background until `handle.stop()` is called. The handle MUST be kept and
1249
+ * stopped explicitly — dropping it does NOT cancel the daemon.
1250
+ *
1251
+ * ```js
1252
+ * const handle = await agent.serveAgentDir('./my-agent', '/my-project');
1253
+ * // ... later ...
1254
+ * await handle.stop();
1255
+ * ```
1256
+ *
1257
+ * @param dir - Path to the agent directory (prompt/skills/schedules/tools)
1258
+ * @param workspace - Workspace directory each scheduled turn operates in
1259
+ * @param options - Optional session overrides merged into every schedule session
1260
+ * (model, llmClient, sessionStore, …); `promptSlots`/`sessionId` set here are
1261
+ * NOT overridden so a host can pin them per schedule
1262
+ */
1263
+ serveAgentDir(dir: string, workspace: string, options?: SessionOptions | undefined | null): Promise<ServeHandle>
1264
+ }
1265
+ /**
1266
+ * Lifetime handle for a running serve daemon (see {@link Agent.serveAgentDir}).
1267
+ *
1268
+ * The daemon keeps running until `stop()` is called. Dropping the handle does
1269
+ * NOT cancel the daemon — call `stop()` explicitly for graceful shutdown.
1270
+ */
1271
+ export declare class ServeHandle {
1272
+ /**
1273
+ * Request graceful shutdown of the serve daemon.
1274
+ *
1275
+ * Signals every per-schedule job to stop after its current fire. Idempotent:
1276
+ * calling `stop()` more than once is a no-op. Resolves once the cancellation
1277
+ * has been signalled.
1278
+ */
1279
+ stop(): Promise<void>
1280
+ /** Whether `stop()` has been called on this handle. */
1281
+ isStopped(): boolean
1237
1282
  }
1238
1283
  /** Workspace-bound session. All LLM and tool operations happen here. */
1239
1284
  export declare class Session {
package/index.js CHANGED
@@ -310,7 +310,7 @@ if (!nativeBinding) {
310
310
  throw new Error(`Failed to load native binding`)
311
311
  }
312
312
 
313
- const { formatVerificationSummary, EventStream, FileMemoryStore, FileSessionStore, MemorySessionStore, DefaultSecurityProvider, LocalWorkspaceBackend, S3WorkspaceBackend, StdioTransport, HttpTransport, WebSocketTransport, UnixSocketTransport, Agent, Session, builtinSkills, BrowserBackend } = nativeBinding
313
+ const { formatVerificationSummary, EventStream, FileMemoryStore, FileSessionStore, MemorySessionStore, DefaultSecurityProvider, LocalWorkspaceBackend, S3WorkspaceBackend, StdioTransport, HttpTransport, WebSocketTransport, UnixSocketTransport, Agent, ServeHandle, Session, builtinSkills, BrowserBackend } = nativeBinding
314
314
 
315
315
  module.exports.formatVerificationSummary = formatVerificationSummary
316
316
  module.exports.EventStream = EventStream
@@ -325,6 +325,7 @@ module.exports.HttpTransport = HttpTransport
325
325
  module.exports.WebSocketTransport = WebSocketTransport
326
326
  module.exports.UnixSocketTransport = UnixSocketTransport
327
327
  module.exports.Agent = Agent
328
+ module.exports.ServeHandle = ServeHandle
328
329
  module.exports.Session = Session
329
330
  module.exports.builtinSkills = builtinSkills
330
331
  module.exports.BrowserBackend = BrowserBackend
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@a3s-lab/code",
3
- "version": "3.6.2",
3
+ "version": "4.0.0",
4
4
  "description": "A3S Code - Native Node.js bindings for the coding-agent runtime",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -38,16 +38,16 @@
38
38
  "build": "napi build --platform --release --js index.js --dts generated.d.ts",
39
39
  "build:debug": "napi build --platform --js index.js --dts generated.d.ts",
40
40
  "prepublishOnly": "napi prepublish -t npm",
41
- "test": "node test.mjs",
41
+ "test": "node test.mjs && node test_serve.mjs",
42
42
  "test:types": "tsc --noEmit --module nodenext --moduleResolution nodenext --target es2022 --strict --skipLibCheck test-types.ts",
43
43
  "test:helpers": "node test-helpers.mjs"
44
44
  },
45
45
  "optionalDependencies": {
46
- "@a3s-lab/code-darwin-arm64": "3.6.2",
47
- "@a3s-lab/code-linux-x64-gnu": "3.6.2",
48
- "@a3s-lab/code-linux-x64-musl": "3.6.2",
49
- "@a3s-lab/code-linux-arm64-gnu": "3.6.2",
50
- "@a3s-lab/code-linux-arm64-musl": "3.6.2",
51
- "@a3s-lab/code-win32-x64-msvc": "3.6.2"
46
+ "@a3s-lab/code-darwin-arm64": "4.0.0",
47
+ "@a3s-lab/code-linux-x64-gnu": "4.0.0",
48
+ "@a3s-lab/code-linux-x64-musl": "4.0.0",
49
+ "@a3s-lab/code-linux-arm64-gnu": "4.0.0",
50
+ "@a3s-lab/code-linux-arm64-musl": "4.0.0",
51
+ "@a3s-lab/code-win32-x64-msvc": "4.0.0"
52
52
  }
53
53
  }