@botbotgo/agent-harness 0.0.45 → 0.0.47
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/README.md +323 -29
- package/dist/api.d.ts +1 -0
- package/dist/api.js +3 -0
- package/dist/config/workspace.yaml +20 -18
- package/dist/contracts/types.d.ts +4 -2
- package/dist/extensions.js +3 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/package-version.d.ts +1 -1
- package/dist/package-version.js +1 -1
- package/dist/persistence/file-store.d.ts +14 -1
- package/dist/persistence/file-store.js +54 -0
- package/dist/resource/resource-impl.d.ts +1 -0
- package/dist/runtime/harness.d.ts +6 -0
- package/dist/runtime/harness.js +298 -112
- package/dist/runtime/thread-memory-sync.js +2 -0
- package/dist/tool-modules.d.ts +1 -0
- package/dist/tool-modules.js +11 -0
- package/dist/tools.d.ts +2 -0
- package/dist/workspace/object-loader.js +1 -0
- package/dist/workspace/resource-compilers.js +1 -0
- package/dist/workspace/support/workspace-ref-utils.d.ts +1 -1
- package/dist/workspace/support/workspace-ref-utils.js +1 -1
- package/dist/workspace/tool-hydration.js +1 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -17,7 +17,7 @@ What it provides:
|
|
|
17
17
|
- YAML-defined runtime assembly for hosts, models, routing, recovery, concurrency, MCP, and maintenance policy
|
|
18
18
|
- backend-adapted execution with a generic runtime contract and current LangChain v1 / DeepAgents adapters
|
|
19
19
|
- local `resources/tools/` and `resources/skills/` loading
|
|
20
|
-
- persisted runs, threads, approvals, events, and resumable checkpoints
|
|
20
|
+
- persisted runs, threads, approvals, events, queued tasks, and resumable checkpoints
|
|
21
21
|
|
|
22
22
|
## Quick Start
|
|
23
23
|
|
|
@@ -35,6 +35,8 @@ your-workspace/
|
|
|
35
35
|
agent-context.md
|
|
36
36
|
workspace.yaml
|
|
37
37
|
models.yaml
|
|
38
|
+
embedding-models.yaml
|
|
39
|
+
vector-stores.yaml
|
|
38
40
|
stores.yaml
|
|
39
41
|
tools.yaml
|
|
40
42
|
mcp.yaml
|
|
@@ -77,7 +79,7 @@ try {
|
|
|
77
79
|
- Persisted threads, runs, approvals, and lifecycle events
|
|
78
80
|
- Recovery policy and resumable checkpoints
|
|
79
81
|
- Background checkpoint maintenance
|
|
80
|
-
- Runtime-level concurrency control
|
|
82
|
+
- Runtime-level concurrency control and queued-run persistence
|
|
81
83
|
|
|
82
84
|
## How To Use
|
|
83
85
|
|
|
@@ -150,6 +152,16 @@ const result = await run(runtime, {
|
|
|
150
152
|
|
|
151
153
|
`subscribe(...)` is a read-only observer surface over stored lifecycle events.
|
|
152
154
|
|
|
155
|
+
The event stream includes:
|
|
156
|
+
|
|
157
|
+
- `run.created`
|
|
158
|
+
- `run.queued`
|
|
159
|
+
- `run.dequeued`
|
|
160
|
+
- `run.state.changed`
|
|
161
|
+
- `approval.requested`
|
|
162
|
+
- `approval.resolved`
|
|
163
|
+
- `output.delta`
|
|
164
|
+
|
|
153
165
|
### Inspect Threads And Approvals
|
|
154
166
|
|
|
155
167
|
```ts
|
|
@@ -225,29 +237,105 @@ Use Kubernetes-style YAML:
|
|
|
225
237
|
|
|
226
238
|
Use distinct names for named objects such as models, stores, checkpointers, tools, and MCP servers.
|
|
227
239
|
|
|
228
|
-
###
|
|
240
|
+
### Client-Configurable YAML Reference
|
|
241
|
+
|
|
242
|
+
This section is the client-facing explanation of what can be configured in YAML today and what each field changes at runtime.
|
|
243
|
+
|
|
244
|
+
There are three layers of client configuration:
|
|
245
|
+
|
|
246
|
+
- runtime-level policy in `config/workspace.yaml`
|
|
247
|
+
- reusable object catalogs in `config/*.yaml`
|
|
248
|
+
- agent assembly in `config/agents/*.yaml`
|
|
229
249
|
|
|
230
|
-
|
|
250
|
+
### `config/workspace.yaml`
|
|
231
251
|
|
|
232
|
-
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
- `
|
|
237
|
-
- `
|
|
238
|
-
- `
|
|
239
|
-
- `
|
|
240
|
-
- `
|
|
241
|
-
- `
|
|
252
|
+
Use this file for runtime-level policy shared by the whole workspace.
|
|
253
|
+
|
|
254
|
+
Primary fields:
|
|
255
|
+
|
|
256
|
+
- `runRoot`: root directory where the runtime stores thread indexes, runs, approvals, artifacts, queued requests, and default local persistence
|
|
257
|
+
- `routing.defaultAgentId`: default host selected when no explicit routing rule matches
|
|
258
|
+
- `routing.rules`: ordered YAML routing rules evaluated before backend routing
|
|
259
|
+
- `routing.systemPrompt`: optional model-classifier prompt used only when model routing is enabled
|
|
260
|
+
- `routing.modelRouting`: opt in to model-driven host classification fallback
|
|
261
|
+
- `concurrency.maxConcurrentRuns`: maximum number of active runs; extra runs enter the persistent queue
|
|
262
|
+
- `recovery.enabled`: enables runtime-managed startup recovery
|
|
263
|
+
- `recovery.resumeOnStartup`: compatibility alias for resuming interrupted approval-driven runs on startup
|
|
264
|
+
- `recovery.resumeResumingRunsOnStartup`: explicit control for resuming interrupted approval-driven runs on startup
|
|
265
|
+
- `recovery.maxRecoveryAttempts`: upper bound for startup recovery retries
|
|
266
|
+
- `maintenance.checkpoints.enabled`: turns on background checkpoint cleanup
|
|
267
|
+
- `maintenance.checkpoints.schedule.intervalSeconds`: maintenance loop interval
|
|
268
|
+
- `maintenance.checkpoints.schedule.runOnStartup`: run checkpoint cleanup during startup
|
|
269
|
+
- `maintenance.checkpoints.policies.maxAgeSeconds`: age-based checkpoint cleanup
|
|
270
|
+
- `maintenance.checkpoints.policies.maxBytes`: size-based checkpoint cleanup
|
|
271
|
+
- `maintenance.checkpoints.sqlite.sweepBatchSize`: batch size for SQLite cleanup scans
|
|
272
|
+
- `maintenance.checkpoints.sqlite.vacuum`: vacuum SQLite after deletions
|
|
242
273
|
|
|
243
274
|
If `runRoot` is omitted, the runtime defaults to `<workspace-root>/run-data`.
|
|
244
275
|
|
|
276
|
+
Example:
|
|
277
|
+
|
|
278
|
+
```yaml
|
|
279
|
+
apiVersion: agent-harness/v1alpha1
|
|
280
|
+
kind: Runtime
|
|
281
|
+
metadata:
|
|
282
|
+
name: default
|
|
283
|
+
spec:
|
|
284
|
+
runRoot: ./.agent
|
|
285
|
+
concurrency:
|
|
286
|
+
maxConcurrentRuns: 3
|
|
287
|
+
routing:
|
|
288
|
+
defaultAgentId: orchestra
|
|
289
|
+
modelRouting: false
|
|
290
|
+
rules:
|
|
291
|
+
- agentId: orchestra
|
|
292
|
+
contains: ["latest", "recent", "today", "news"]
|
|
293
|
+
- agentId: orchestra
|
|
294
|
+
regex:
|
|
295
|
+
- "\\b(create|build|implement|fix|debug|review|inspect)\\b"
|
|
296
|
+
maintenance:
|
|
297
|
+
checkpoints:
|
|
298
|
+
enabled: true
|
|
299
|
+
schedule:
|
|
300
|
+
intervalSeconds: 3600
|
|
301
|
+
runOnStartup: true
|
|
302
|
+
policies:
|
|
303
|
+
maxAgeSeconds: 604800
|
|
304
|
+
sqlite:
|
|
305
|
+
sweepBatchSize: 200
|
|
306
|
+
vacuum: false
|
|
307
|
+
recovery:
|
|
308
|
+
enabled: true
|
|
309
|
+
resumeResumingRunsOnStartup: true
|
|
310
|
+
maxRecoveryAttempts: 3
|
|
311
|
+
```
|
|
312
|
+
|
|
313
|
+
Notes:
|
|
314
|
+
|
|
315
|
+
- `routing.rules` only choose the starting host agent; they do not replace backend planning semantics
|
|
316
|
+
- queued runs are persisted under `runRoot` and continue after process restart
|
|
317
|
+
- `running` runs are only replayed on startup when the bound tools are retryable
|
|
318
|
+
|
|
245
319
|
### `config/agent-context.md`
|
|
246
320
|
|
|
247
321
|
Use this file for shared startup context loaded into agents at construction time.
|
|
248
322
|
|
|
249
323
|
Put stable project context here. Do not use it as mutable long-term memory.
|
|
250
324
|
|
|
325
|
+
Good uses:
|
|
326
|
+
|
|
327
|
+
- product positioning
|
|
328
|
+
- codebase conventions
|
|
329
|
+
- stable domain vocabulary
|
|
330
|
+
- organization-specific rules
|
|
331
|
+
|
|
332
|
+
Bad uses:
|
|
333
|
+
|
|
334
|
+
- transient scratch notes
|
|
335
|
+
- per-run execution state
|
|
336
|
+
- approval packets
|
|
337
|
+
- long-term memory that should live in the store
|
|
338
|
+
|
|
251
339
|
### `config/models.yaml`
|
|
252
340
|
|
|
253
341
|
Use one file for multiple named models:
|
|
@@ -259,6 +347,7 @@ spec:
|
|
|
259
347
|
- name: default
|
|
260
348
|
provider: openai
|
|
261
349
|
model: gpt-4.1
|
|
350
|
+
temperature: 0.2
|
|
262
351
|
- name: planner
|
|
263
352
|
provider: openai
|
|
264
353
|
model: gpt-4.1-mini
|
|
@@ -266,6 +355,70 @@ spec:
|
|
|
266
355
|
|
|
267
356
|
These load as `model/default` and `model/planner`.
|
|
268
357
|
|
|
358
|
+
Client-configurable model fields:
|
|
359
|
+
|
|
360
|
+
- `name`: catalog name referenced by `model/<name>`
|
|
361
|
+
- `provider`: provider family such as `openai`, `openai-compatible`, `ollama`, `anthropic`, or `google`
|
|
362
|
+
- `model`: provider model id
|
|
363
|
+
- top-level provider init fields such as `temperature`, `baseUrl`, API-specific settings, and client options
|
|
364
|
+
- `clientRef`: optional external client reference
|
|
365
|
+
- `fallbacks`: optional fallback model refs
|
|
366
|
+
- `metadata`: optional model metadata
|
|
367
|
+
|
|
368
|
+
### `config/embedding-models.yaml`
|
|
369
|
+
|
|
370
|
+
Use this file for named embedding model presets used by retrieval-oriented tools.
|
|
371
|
+
|
|
372
|
+
```yaml
|
|
373
|
+
apiVersion: agent-harness/v1alpha1
|
|
374
|
+
kind: EmbeddingModels
|
|
375
|
+
spec:
|
|
376
|
+
- name: default
|
|
377
|
+
provider: ollama
|
|
378
|
+
model: nomic-embed-text
|
|
379
|
+
baseUrl: http://localhost:11434
|
|
380
|
+
```
|
|
381
|
+
|
|
382
|
+
Client-configurable embedding fields:
|
|
383
|
+
|
|
384
|
+
- `name`
|
|
385
|
+
- `provider`
|
|
386
|
+
- `model`
|
|
387
|
+
- top-level provider init fields such as `baseUrl`
|
|
388
|
+
- `clientRef`
|
|
389
|
+
- `metadata`
|
|
390
|
+
|
|
391
|
+
These load as `embedding-model/default`.
|
|
392
|
+
|
|
393
|
+
### `config/vector-stores.yaml`
|
|
394
|
+
|
|
395
|
+
Use this file for named vector store presets referenced by retrieval tools.
|
|
396
|
+
|
|
397
|
+
```yaml
|
|
398
|
+
apiVersion: agent-harness/v1alpha1
|
|
399
|
+
kind: VectorStores
|
|
400
|
+
spec:
|
|
401
|
+
- name: default
|
|
402
|
+
storeKind: LibSQLVectorStore
|
|
403
|
+
url: file:.agent/vector-store.db
|
|
404
|
+
table: rag_chunks
|
|
405
|
+
column: embedding
|
|
406
|
+
embeddingModelRef: embedding-model/default
|
|
407
|
+
```
|
|
408
|
+
|
|
409
|
+
Client-configurable vector store fields:
|
|
410
|
+
|
|
411
|
+
- `name`
|
|
412
|
+
- `storeKind`
|
|
413
|
+
- `url`
|
|
414
|
+
- `authToken`
|
|
415
|
+
- `table`
|
|
416
|
+
- `column`
|
|
417
|
+
- `embeddingModelRef`
|
|
418
|
+
- `metadata`
|
|
419
|
+
|
|
420
|
+
These load as `vector-store/default`.
|
|
421
|
+
|
|
269
422
|
### `config/stores.yaml`
|
|
270
423
|
|
|
271
424
|
Use one file for named persistence presets:
|
|
@@ -285,6 +438,73 @@ spec:
|
|
|
285
438
|
|
|
286
439
|
These load as `store/default` and `checkpointer/default`.
|
|
287
440
|
|
|
441
|
+
Client-configurable store fields:
|
|
442
|
+
|
|
443
|
+
- `kind: Store` for backend stores
|
|
444
|
+
- `kind: Checkpointer` for resumable execution state
|
|
445
|
+
- `name` for refs
|
|
446
|
+
- `storeKind` such as `FileStore`, `InMemoryStore`, `RedisStore`, `PostgresStore`
|
|
447
|
+
- `checkpointerKind` such as `MemorySaver`, `FileCheckpointer`, `SqliteSaver`
|
|
448
|
+
- storage-specific fields such as `path`, connection strings, auth, and provider options
|
|
449
|
+
|
|
450
|
+
### `config/tools.yaml`
|
|
451
|
+
|
|
452
|
+
Use this file for reusable tool presets and tool bundles.
|
|
453
|
+
|
|
454
|
+
Minimal collection form:
|
|
455
|
+
|
|
456
|
+
```yaml
|
|
457
|
+
apiVersion: agent-harness/v1alpha1
|
|
458
|
+
kind: Tools
|
|
459
|
+
spec:
|
|
460
|
+
- kind: Tool
|
|
461
|
+
name: fetch_docs
|
|
462
|
+
type: function
|
|
463
|
+
description: Fetch a documentation page.
|
|
464
|
+
```
|
|
465
|
+
|
|
466
|
+
Client-configurable tool fields:
|
|
467
|
+
|
|
468
|
+
- `name`
|
|
469
|
+
- `type`: `function`, `backend`, `mcp`, or `bundle`
|
|
470
|
+
- `description`
|
|
471
|
+
- `implementationName` for local JS tool modules
|
|
472
|
+
- `inputSchema.ref`
|
|
473
|
+
- `backend.operation`
|
|
474
|
+
- `mcp.ref` or `mcp.tool`
|
|
475
|
+
- `refs` for bundle composition
|
|
476
|
+
- `hitl.enabled` and `hitl.allow` for approval-gated tools
|
|
477
|
+
- `retryable: true` for tools that are safe to replay during startup recovery
|
|
478
|
+
- `config` for tool-specific options
|
|
479
|
+
|
|
480
|
+
Use `retryable` carefully. Mark a tool retryable only when repeated execution is safe or intentionally idempotent.
|
|
481
|
+
|
|
482
|
+
### `config/mcp.yaml`
|
|
483
|
+
|
|
484
|
+
Use this file for reusable MCP server definitions and MCP-backed tool presets.
|
|
485
|
+
|
|
486
|
+
```yaml
|
|
487
|
+
apiVersion: agent-harness/v1alpha1
|
|
488
|
+
kind: McpServers
|
|
489
|
+
spec:
|
|
490
|
+
- name: docs
|
|
491
|
+
transport: http
|
|
492
|
+
url: https://example.com/mcp
|
|
493
|
+
- name: local-browser
|
|
494
|
+
transport: stdio
|
|
495
|
+
command: node
|
|
496
|
+
args: ["./mcp-browser-server.mjs"]
|
|
497
|
+
```
|
|
498
|
+
|
|
499
|
+
Client-configurable MCP fields:
|
|
500
|
+
|
|
501
|
+
- `name`
|
|
502
|
+
- `transport`: `stdio`, `http`, `sse`, or `websocket`
|
|
503
|
+
- `command`, `args`, `env`, `cwd` for stdio servers
|
|
504
|
+
- `url`, `token`, `headers` for network servers
|
|
505
|
+
|
|
506
|
+
These load as `mcp/<name>`.
|
|
507
|
+
|
|
288
508
|
### `config/agents/*.yaml`
|
|
289
509
|
|
|
290
510
|
Prefer the generic agent form and declare the current execution backend explicitly:
|
|
@@ -303,20 +523,75 @@ spec:
|
|
|
303
523
|
|
|
304
524
|
`kind: DeepAgent` and `kind: LangChainAgent` remain supported as compatibility forms, but `kind: Agent` is the recommended product-facing entry point.
|
|
305
525
|
|
|
306
|
-
Common fields
|
|
307
|
-
|
|
308
|
-
- `
|
|
309
|
-
- `
|
|
310
|
-
- `
|
|
311
|
-
- `
|
|
312
|
-
- `
|
|
313
|
-
- `
|
|
314
|
-
- `
|
|
315
|
-
- `
|
|
316
|
-
- `
|
|
317
|
-
- `
|
|
318
|
-
- `
|
|
319
|
-
- `
|
|
526
|
+
Common client-configurable agent fields:
|
|
527
|
+
|
|
528
|
+
- `metadata.name`
|
|
529
|
+
- `metadata.description`
|
|
530
|
+
- `spec.execution.backend`
|
|
531
|
+
- `spec.modelRef`
|
|
532
|
+
- `spec.systemPrompt`
|
|
533
|
+
- `spec.tools`
|
|
534
|
+
- `spec.skills`
|
|
535
|
+
- `spec.memory`
|
|
536
|
+
- `spec.checkpointer`
|
|
537
|
+
- `spec.store`
|
|
538
|
+
- `spec.backend`
|
|
539
|
+
- `spec.middleware`
|
|
540
|
+
- `spec.subagents`
|
|
541
|
+
- `spec.mcpServers`
|
|
542
|
+
- `spec.responseFormat`
|
|
543
|
+
- `spec.contextSchema`
|
|
544
|
+
|
|
545
|
+
Typical patterns:
|
|
546
|
+
|
|
547
|
+
- use `direct` as a lightweight host for simple one-turn requests
|
|
548
|
+
- use `orchestra` as the main execution host for tools, multi-step work, and delegation
|
|
549
|
+
- keep routing policy in `config/workspace.yaml`, not buried in prompts
|
|
550
|
+
|
|
551
|
+
Example direct agent:
|
|
552
|
+
|
|
553
|
+
```yaml
|
|
554
|
+
apiVersion: agent-harness/v1alpha1
|
|
555
|
+
kind: Agent
|
|
556
|
+
metadata:
|
|
557
|
+
name: direct
|
|
558
|
+
spec:
|
|
559
|
+
execution:
|
|
560
|
+
backend: langchain-v1
|
|
561
|
+
modelRef: model/default
|
|
562
|
+
checkpointer:
|
|
563
|
+
ref: checkpointer/default
|
|
564
|
+
systemPrompt: |-
|
|
565
|
+
You are the direct agent.
|
|
566
|
+
Answer simple requests directly.
|
|
567
|
+
```
|
|
568
|
+
|
|
569
|
+
Example orchestra agent:
|
|
570
|
+
|
|
571
|
+
```yaml
|
|
572
|
+
apiVersion: agent-harness/v1alpha1
|
|
573
|
+
kind: Agent
|
|
574
|
+
metadata:
|
|
575
|
+
name: orchestra
|
|
576
|
+
spec:
|
|
577
|
+
execution:
|
|
578
|
+
backend: deepagent
|
|
579
|
+
modelRef: model/default
|
|
580
|
+
memory:
|
|
581
|
+
- path: config/agent-context.md
|
|
582
|
+
store:
|
|
583
|
+
ref: store/default
|
|
584
|
+
checkpointer:
|
|
585
|
+
ref: checkpointer/default
|
|
586
|
+
backend:
|
|
587
|
+
kind: CompositeBackend
|
|
588
|
+
state:
|
|
589
|
+
kind: VfsSandbox
|
|
590
|
+
timeout: 600
|
|
591
|
+
routes:
|
|
592
|
+
/memories/:
|
|
593
|
+
kind: StoreBackend
|
|
594
|
+
```
|
|
320
595
|
|
|
321
596
|
### `resources/`
|
|
322
597
|
|
|
@@ -329,6 +604,24 @@ Tool modules are discovered from `resources/tools/*.js`, `resources/tools/*.mjs`
|
|
|
329
604
|
|
|
330
605
|
The preferred tool module format is exporting `tool({...})`.
|
|
331
606
|
|
|
607
|
+
Example:
|
|
608
|
+
|
|
609
|
+
```js
|
|
610
|
+
import { z } from "zod";
|
|
611
|
+
import { tool } from "@botbotgo/agent-harness/tools";
|
|
612
|
+
|
|
613
|
+
export const local_lookup = tool({
|
|
614
|
+
description: "Lookup a ticker from a local tool module.",
|
|
615
|
+
retryable: true,
|
|
616
|
+
schema: {
|
|
617
|
+
ticker: z.string().min(1),
|
|
618
|
+
},
|
|
619
|
+
async invoke(input) {
|
|
620
|
+
return input.ticker.toUpperCase();
|
|
621
|
+
},
|
|
622
|
+
});
|
|
623
|
+
```
|
|
624
|
+
|
|
332
625
|
Keep runtime extension source under `resources/`. Keep tests outside the published source tree, for example under repository `test/`.
|
|
333
626
|
|
|
334
627
|
## Design Notes
|
|
@@ -337,11 +630,12 @@ Keep runtime extension source under `resources/`. Keep tests outside the publish
|
|
|
337
630
|
- agent-level execution behavior stays upstream
|
|
338
631
|
- application-level orchestration and lifecycle management stays in the harness
|
|
339
632
|
- checkpoint resume is treated as a system-managed runtime behavior, not a primary public abstraction
|
|
633
|
+
- public runtime contract generic does not mean backend-agnostic implementation internals; it means client-facing semantics stay stable even when adapters change
|
|
340
634
|
|
|
341
635
|
## API Summary
|
|
342
636
|
|
|
343
637
|
- `createAgentHarness(...)`
|
|
344
|
-
- `run(...)`
|
|
638
|
+
- `run(runtime, {...})`
|
|
345
639
|
- `subscribe(...)`
|
|
346
640
|
- `listThreads(...)`
|
|
347
641
|
- `getThread(...)`
|
package/dist/api.d.ts
CHANGED
|
@@ -13,6 +13,7 @@ export declare function run(runtime: AgentHarnessRuntime, options: RunOptions):
|
|
|
13
13
|
export declare function subscribe(runtime: AgentHarnessRuntime, listener: Parameters<AgentHarnessRuntime["subscribe"]>[0]): () => void;
|
|
14
14
|
export declare function listThreads(runtime: AgentHarnessRuntime, filter?: Parameters<AgentHarnessRuntime["listThreads"]>[0]): Promise<ThreadSummary[]>;
|
|
15
15
|
export declare function getThread(runtime: AgentHarnessRuntime, threadId: string): Promise<ThreadRecord | null>;
|
|
16
|
+
export declare function deleteThread(runtime: AgentHarnessRuntime, threadId: string): Promise<boolean>;
|
|
16
17
|
export declare function listApprovals(runtime: AgentHarnessRuntime, filter?: Parameters<AgentHarnessRuntime["listApprovals"]>[0]): Promise<ApprovalRecord[]>;
|
|
17
18
|
export declare function getApproval(runtime: AgentHarnessRuntime, approvalId: string): Promise<ApprovalRecord | null>;
|
|
18
19
|
export declare function stop(runtime: AgentHarnessRuntime): Promise<void>;
|
package/dist/api.js
CHANGED
|
@@ -21,6 +21,9 @@ export async function listThreads(runtime, filter) {
|
|
|
21
21
|
export async function getThread(runtime, threadId) {
|
|
22
22
|
return runtime.getThread(threadId);
|
|
23
23
|
}
|
|
24
|
+
export async function deleteThread(runtime, threadId) {
|
|
25
|
+
return runtime.deleteThread(threadId);
|
|
26
|
+
}
|
|
24
27
|
export async function listApprovals(runtime, filter) {
|
|
25
28
|
return runtime.listApprovals(filter);
|
|
26
29
|
}
|
|
@@ -22,6 +22,11 @@ spec:
|
|
|
22
22
|
# Value options: relative workspace path like `./.agent`, or an absolute filesystem path.
|
|
23
23
|
runRoot: ./.agent
|
|
24
24
|
|
|
25
|
+
# agent-harness feature: runtime-level task queue and maximum number of concurrent runs.
|
|
26
|
+
# Additional runs wait in the harness queue until a slot becomes available.
|
|
27
|
+
concurrency:
|
|
28
|
+
maxConcurrentRuns: 3
|
|
29
|
+
|
|
25
30
|
# agent-harness feature: optional host-router prompt override used when the runtime chooses between
|
|
26
31
|
# top-level host agents such as a main execution host and an optional low-latency side host.
|
|
27
32
|
# Use placeholders so the same prompt can survive host renames:
|
|
@@ -90,19 +95,17 @@ spec:
|
|
|
90
95
|
# - oldest-first deletion by time policy and/or size policy
|
|
91
96
|
# - background scheduling inside the harness lifecycle
|
|
92
97
|
#
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
# sweepBatchSize: 200
|
|
105
|
-
# vacuum: false
|
|
98
|
+
maintenance:
|
|
99
|
+
checkpoints:
|
|
100
|
+
enabled: true
|
|
101
|
+
schedule:
|
|
102
|
+
intervalSeconds: 3600
|
|
103
|
+
runOnStartup: true
|
|
104
|
+
policies:
|
|
105
|
+
maxAgeSeconds: 604800
|
|
106
|
+
sqlite:
|
|
107
|
+
sweepBatchSize: 200
|
|
108
|
+
vacuum: false
|
|
106
109
|
|
|
107
110
|
# agent-harness feature: runtime-managed recovery policy for interrupted runs.
|
|
108
111
|
# This keeps checkpoint resume as an internal lifecycle concern instead of a primary user-facing API concept.
|
|
@@ -112,8 +115,7 @@ spec:
|
|
|
112
115
|
# - persisted approval-decision intent for cross-restart resume continuation
|
|
113
116
|
# - bounded retry attempts to avoid infinite restart loops
|
|
114
117
|
#
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
# maxRecoveryAttempts: 3
|
|
118
|
+
recovery:
|
|
119
|
+
enabled: true
|
|
120
|
+
resumeResumingRunsOnStartup: true
|
|
121
|
+
maxRecoveryAttempts: 3
|
|
@@ -4,7 +4,7 @@ export type RuntimeCapabilities = {
|
|
|
4
4
|
delegation?: boolean;
|
|
5
5
|
memory?: boolean;
|
|
6
6
|
};
|
|
7
|
-
export type RunState = "running" | "waiting_for_approval" | "resuming" | "completed" | "failed";
|
|
7
|
+
export type RunState = "queued" | "running" | "waiting_for_approval" | "resuming" | "completed" | "failed";
|
|
8
8
|
export type ParsedAgentObject = {
|
|
9
9
|
id: string;
|
|
10
10
|
executionMode: ExecutionMode;
|
|
@@ -85,6 +85,7 @@ export type ParsedToolObject = {
|
|
|
85
85
|
enabled: boolean;
|
|
86
86
|
allow?: Array<"approve" | "edit" | "reject">;
|
|
87
87
|
};
|
|
88
|
+
retryable?: boolean;
|
|
88
89
|
sourcePath: string;
|
|
89
90
|
};
|
|
90
91
|
export type LangChainAgentParams = {
|
|
@@ -172,6 +173,7 @@ export type CompiledTool = {
|
|
|
172
173
|
enabled: boolean;
|
|
173
174
|
allow: Array<"approve" | "edit" | "reject">;
|
|
174
175
|
};
|
|
176
|
+
retryable?: boolean;
|
|
175
177
|
runtimeValue: {
|
|
176
178
|
name: string;
|
|
177
179
|
description: string;
|
|
@@ -221,7 +223,7 @@ export type ThreadSummary = {
|
|
|
221
223
|
status: RunState;
|
|
222
224
|
};
|
|
223
225
|
export type SessionRecord = ThreadSummary;
|
|
224
|
-
export type KnownHarnessEventType = "run.created" | "run.state.changed" | "run.resumed" | "approval.requested" | "approval.resolved" | "artifact.created" | "output.delta" | "reasoning.delta" | "runtime.synthetic_fallback";
|
|
226
|
+
export type KnownHarnessEventType = "run.created" | "run.queued" | "run.dequeued" | "run.state.changed" | "run.resumed" | "approval.requested" | "approval.resolved" | "artifact.created" | "output.delta" | "reasoning.delta" | "runtime.synthetic_fallback";
|
|
225
227
|
export type HarnessEventType = KnownHarnessEventType | (string & {});
|
|
226
228
|
export type HarnessEvent = {
|
|
227
229
|
eventId: string;
|
package/dist/extensions.js
CHANGED
|
@@ -126,6 +126,7 @@ registerToolKind({
|
|
|
126
126
|
allow: tool.hitl.allow ?? ["approve", "edit", "reject"],
|
|
127
127
|
}
|
|
128
128
|
: undefined,
|
|
129
|
+
retryable: tool.retryable,
|
|
129
130
|
runtimeValue: { name: tool.name, description: tool.description, type: "function" },
|
|
130
131
|
},
|
|
131
132
|
];
|
|
@@ -158,6 +159,7 @@ registerToolKind({
|
|
|
158
159
|
allow: tool.hitl.allow ?? ["approve", "edit", "reject"],
|
|
159
160
|
}
|
|
160
161
|
: undefined,
|
|
162
|
+
retryable: tool.retryable,
|
|
161
163
|
runtimeValue: { name: tool.name, description: tool.description, type: "backend" },
|
|
162
164
|
},
|
|
163
165
|
];
|
|
@@ -190,6 +192,7 @@ registerToolKind({
|
|
|
190
192
|
allow: tool.hitl.allow ?? ["approve", "edit", "reject"],
|
|
191
193
|
}
|
|
192
194
|
: undefined,
|
|
195
|
+
retryable: tool.retryable,
|
|
193
196
|
runtimeValue: { name: tool.name, description: tool.description, type: "mcp" },
|
|
194
197
|
},
|
|
195
198
|
];
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { AgentHarnessRuntime, createAgentHarness, createToolMcpServer, getApproval, getThread, listApprovals, listThreads, run, serveToolsOverStdio, subscribe, stop, } from "./api.js";
|
|
1
|
+
export { AgentHarnessRuntime, createAgentHarness, createToolMcpServer, deleteThread, getApproval, getThread, listApprovals, listThreads, run, serveToolsOverStdio, subscribe, stop, } from "./api.js";
|
|
2
2
|
export type { ToolMcpServerOptions } from "./mcp.js";
|
|
3
3
|
export { tool } from "./tools.js";
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { AgentHarnessRuntime, createAgentHarness, createToolMcpServer, getApproval, getThread, listApprovals, listThreads, run, serveToolsOverStdio, subscribe, stop, } from "./api.js";
|
|
1
|
+
export { AgentHarnessRuntime, createAgentHarness, createToolMcpServer, deleteThread, getApproval, getThread, listApprovals, listThreads, run, serveToolsOverStdio, subscribe, stop, } from "./api.js";
|
|
2
2
|
export { tool } from "./tools.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const AGENT_HARNESS_VERSION = "0.0.
|
|
1
|
+
export declare const AGENT_HARNESS_VERSION = "0.0.46";
|
package/dist/package-version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const AGENT_HARNESS_VERSION = "0.0.
|
|
1
|
+
export const AGENT_HARNESS_VERSION = "0.0.46";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ArtifactListing, ArtifactRecord, DelegationRecord, HarnessEvent, InternalApprovalRecord, RunState, ThreadSummary, ThreadRunRecord, TranscriptMessage } from "../contracts/types.js";
|
|
1
|
+
import type { ArtifactListing, ArtifactRecord, DelegationRecord, HarnessEvent, InternalApprovalRecord, InvocationEnvelope, MessageContent, RunState, ThreadSummary, ThreadRunRecord, TranscriptMessage } from "../contracts/types.js";
|
|
2
2
|
type ThreadMeta = {
|
|
3
3
|
threadId: string;
|
|
4
4
|
workspaceId: string;
|
|
@@ -39,9 +39,18 @@ type RecoveryIntent = {
|
|
|
39
39
|
resumePayload: unknown;
|
|
40
40
|
attempts: number;
|
|
41
41
|
};
|
|
42
|
+
type PersistedRunRequest = {
|
|
43
|
+
input: MessageContent;
|
|
44
|
+
invocation?: InvocationEnvelope;
|
|
45
|
+
savedAt: string;
|
|
46
|
+
};
|
|
42
47
|
export declare class FilePersistence {
|
|
43
48
|
private readonly runRoot;
|
|
44
49
|
constructor(runRoot: string);
|
|
50
|
+
private threadIndexPath;
|
|
51
|
+
private runIndexPath;
|
|
52
|
+
private approvalIndexPath;
|
|
53
|
+
private delegationIndexPath;
|
|
45
54
|
initialize(): Promise<void>;
|
|
46
55
|
threadDir(threadId: string): string;
|
|
47
56
|
runDir(threadId: string, runId: string): string;
|
|
@@ -73,6 +82,10 @@ export declare class FilePersistence {
|
|
|
73
82
|
getRunApprovals(threadId: string, runId: string): Promise<InternalApprovalRecord[]>;
|
|
74
83
|
getRunMeta(threadId: string, runId: string): Promise<RunMeta>;
|
|
75
84
|
getRunLifecycle(threadId: string, runId: string): Promise<Lifecycle>;
|
|
85
|
+
deleteThread(threadId: string): Promise<boolean>;
|
|
86
|
+
saveRunRequest(threadId: string, runId: string, request: PersistedRunRequest): Promise<void>;
|
|
87
|
+
getRunRequest(threadId: string, runId: string): Promise<PersistedRunRequest | null>;
|
|
88
|
+
clearRunRequest(threadId: string, runId: string): Promise<void>;
|
|
76
89
|
listDelegations(): Promise<DelegationRecord[]>;
|
|
77
90
|
createApproval(record: InternalApprovalRecord): Promise<void>;
|
|
78
91
|
resolveApproval(threadId: string, runId: string, approvalId: string, status: InternalApprovalRecord["status"]): Promise<InternalApprovalRecord>;
|