@botbotgo/agent-harness 0.0.95 → 0.0.97

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 (114) hide show
  1. package/README.md +1 -114
  2. package/README.zh.md +1 -70
  3. package/dist/api.d.ts +5 -5
  4. package/dist/config/workflows/langgraph-workflows.yaml +363 -111
  5. package/dist/config/workflows/runtime-profiles.yaml +94 -0
  6. package/dist/contracts/core.d.ts +9 -0
  7. package/dist/contracts/core.js +1 -0
  8. package/dist/contracts/runtime.d.ts +421 -0
  9. package/dist/contracts/runtime.js +1 -0
  10. package/dist/contracts/types.d.ts +3 -571
  11. package/dist/contracts/types.js +3 -1
  12. package/dist/contracts/workspace.d.ts +229 -0
  13. package/dist/contracts/workspace.js +1 -0
  14. package/dist/package-version.d.ts +1 -1
  15. package/dist/package-version.js +1 -1
  16. package/dist/runtime/adapter/compat/deepagent-compat.d.ts +16 -0
  17. package/dist/runtime/adapter/compat/deepagent-compat.js +45 -0
  18. package/dist/runtime/adapter/compat/openai-compatible.d.ts +2 -0
  19. package/dist/runtime/adapter/compat/openai-compatible.js +43 -0
  20. package/dist/runtime/adapter/index.d.ts +15 -0
  21. package/dist/runtime/adapter/index.js +15 -0
  22. package/dist/runtime/adapter/langgraph/presets.js +165 -0
  23. package/dist/runtime/{langgraph-profiles.d.ts → adapter/langgraph/profiles.d.ts} +1 -1
  24. package/dist/runtime/adapter/langgraph/profiles.js +206 -0
  25. package/dist/runtime/adapter/model/invocation-request.d.ts +10 -0
  26. package/dist/runtime/adapter/model/invocation-request.js +46 -0
  27. package/dist/runtime/adapter/model/message-assembly.d.ts +6 -0
  28. package/dist/runtime/adapter/model/message-assembly.js +21 -0
  29. package/dist/runtime/adapter/model/model-providers.d.ts +2 -0
  30. package/dist/runtime/adapter/model/model-providers.js +27 -0
  31. package/dist/runtime/adapter/resilience.d.ts +12 -0
  32. package/dist/runtime/adapter/resilience.js +60 -0
  33. package/dist/runtime/{declared-middleware.d.ts → adapter/tool/declared-middleware.d.ts} +1 -1
  34. package/dist/runtime/adapter/tool/interrupt-policy.d.ts +8 -0
  35. package/dist/runtime/adapter/tool/interrupt-policy.js +34 -0
  36. package/dist/runtime/adapter/tool/provider-tool.d.ts +2 -0
  37. package/dist/runtime/adapter/tool/provider-tool.js +25 -0
  38. package/dist/runtime/adapter/tool/resolved-tool.d.ts +18 -0
  39. package/dist/runtime/adapter/tool/resolved-tool.js +62 -0
  40. package/dist/runtime/adapter/tool/tool-arguments.d.ts +7 -0
  41. package/dist/runtime/adapter/tool/tool-arguments.js +87 -0
  42. package/dist/runtime/{tool-hitl.d.ts → adapter/tool/tool-hitl.d.ts} +2 -2
  43. package/dist/runtime/adapter/tool/tool-name-mapping.d.ts +13 -0
  44. package/dist/runtime/adapter/tool/tool-name-mapping.js +101 -0
  45. package/dist/runtime/agent-runtime-adapter.d.ts +5 -20
  46. package/dist/runtime/agent-runtime-adapter.js +42 -544
  47. package/dist/runtime/checkpoint-maintenance.d.ts +1 -45
  48. package/dist/runtime/checkpoint-maintenance.js +1 -259
  49. package/dist/runtime/file-checkpoint-saver.d.ts +1 -20
  50. package/dist/runtime/file-checkpoint-saver.js +1 -106
  51. package/dist/runtime/{event-bus.d.ts → harness/events/event-bus.d.ts} +1 -1
  52. package/dist/runtime/{event-sink.d.ts → harness/events/event-sink.d.ts} +1 -1
  53. package/dist/runtime/{event-sink.js → harness/events/event-sink.js} +1 -1
  54. package/dist/runtime/harness/events/events.d.ts +23 -0
  55. package/dist/runtime/harness/events/events.js +61 -0
  56. package/dist/runtime/harness/events/streaming.d.ts +19 -0
  57. package/dist/runtime/harness/events/streaming.js +96 -0
  58. package/dist/runtime/harness/index.d.ts +16 -0
  59. package/dist/runtime/harness/index.js +16 -0
  60. package/dist/runtime/harness/run/helpers.d.ts +33 -0
  61. package/dist/runtime/harness/run/helpers.js +74 -0
  62. package/dist/runtime/harness/run/resources.d.ts +7 -0
  63. package/dist/runtime/harness/run/resources.js +58 -0
  64. package/dist/runtime/harness/run/resume.d.ts +6 -0
  65. package/dist/runtime/harness/run/resume.js +56 -0
  66. package/dist/runtime/harness/run/routing.d.ts +12 -0
  67. package/dist/runtime/harness/run/routing.js +47 -0
  68. package/dist/runtime/harness/run/run-lifecycle.d.ts +37 -0
  69. package/dist/runtime/harness/run/run-lifecycle.js +109 -0
  70. package/dist/runtime/harness/run/run-queue.d.ts +17 -0
  71. package/dist/runtime/harness/run/run-queue.js +43 -0
  72. package/dist/runtime/{health-monitor.d.ts → harness/system/health-monitor.d.ts} +3 -3
  73. package/dist/runtime/{health-monitor.js → harness/system/health-monitor.js} +2 -2
  74. package/dist/runtime/{inventory.d.ts → harness/system/inventory.d.ts} +2 -2
  75. package/dist/runtime/{inventory.js → harness/system/inventory.js} +4 -4
  76. package/dist/runtime/{policy-engine.d.ts → harness/system/policy-engine.d.ts} +1 -1
  77. package/dist/runtime/{policy-engine.js → harness/system/policy-engine.js} +1 -1
  78. package/dist/runtime/{skill-requirements.d.ts → harness/system/skill-requirements.d.ts} +1 -1
  79. package/dist/runtime/{skill-requirements.js → harness/system/skill-requirements.js} +1 -1
  80. package/dist/runtime/{thread-memory-sync.d.ts → harness/system/thread-memory-sync.d.ts} +2 -2
  81. package/dist/runtime/{thread-memory-sync.js → harness/system/thread-memory-sync.js} +1 -1
  82. package/dist/runtime/harness.d.ts +2 -7
  83. package/dist/runtime/harness.js +158 -477
  84. package/dist/runtime/index.d.ts +7 -7
  85. package/dist/runtime/index.js +7 -7
  86. package/dist/runtime/maintenance/checkpoint-maintenance.d.ts +45 -0
  87. package/dist/runtime/maintenance/checkpoint-maintenance.js +259 -0
  88. package/dist/runtime/maintenance/file-checkpoint-saver.d.ts +20 -0
  89. package/dist/runtime/maintenance/file-checkpoint-saver.js +106 -0
  90. package/dist/runtime/maintenance/index.d.ts +4 -0
  91. package/dist/runtime/maintenance/index.js +4 -0
  92. package/dist/runtime/{runtime-record-maintenance.d.ts → maintenance/runtime-record-maintenance.d.ts} +1 -1
  93. package/dist/runtime/{runtime-record-maintenance.js → maintenance/runtime-record-maintenance.js} +2 -2
  94. package/dist/runtime/maintenance/sqlite-maintained-checkpoint-saver.d.ts +9 -0
  95. package/dist/runtime/maintenance/sqlite-maintained-checkpoint-saver.js +39 -0
  96. package/dist/runtime/parsing/stream-event-parsing.d.ts +6 -0
  97. package/dist/runtime/parsing/stream-event-parsing.js +231 -0
  98. package/dist/runtime/sqlite-maintained-checkpoint-saver.d.ts +1 -9
  99. package/dist/runtime/sqlite-maintained-checkpoint-saver.js +1 -39
  100. package/dist/runtime/support/harness-support.d.ts +4 -4
  101. package/dist/runtime/support/harness-support.js +14 -3
  102. package/dist/runtime/support/runtime-factories.d.ts +1 -1
  103. package/dist/runtime/support/runtime-factories.js +1 -1
  104. package/dist/workspace/agent-binding-compiler.js +39 -3
  105. package/dist/workspace/object-loader.js +5 -1
  106. package/package.json +4 -4
  107. package/dist/runtime/langgraph-presets.js +0 -165
  108. package/dist/runtime/langgraph-profiles.js +0 -206
  109. /package/dist/runtime/{langgraph-presets.d.ts → adapter/langgraph/presets.d.ts} +0 -0
  110. /package/dist/runtime/{declared-middleware.js → adapter/tool/declared-middleware.js} +0 -0
  111. /package/dist/runtime/{tool-hitl.js → adapter/tool/tool-hitl.js} +0 -0
  112. /package/dist/runtime/{event-bus.js → harness/events/event-bus.js} +0 -0
  113. /package/dist/runtime/{store.d.ts → harness/system/store.d.ts} +0 -0
  114. /package/dist/runtime/{store.js → harness/system/store.js} +0 -0
package/README.md CHANGED
@@ -82,7 +82,7 @@ Recommended orchestration shape for long-running flows:
82
82
 
83
83
  - let callers select the host agent explicitly whenever possible
84
84
  - use `backend: deepagent` when you want high-level execution semantics with minimal application wiring
85
- - use `backend: langgraph` when approvals, recovery, and long-running orchestration need application-owned workflow control
85
+ - keep `backend: langchain-v1` for lighter direct-response or explicitly chosen V1 agent shapes
86
86
 
87
87
  ## Why This Exists
88
88
 
@@ -130,8 +130,6 @@ your-workspace/
130
130
  backends.yaml
131
131
  tools.yaml
132
132
  mcp.yaml
133
- workflows/
134
- langgraph-workflows.yaml
135
133
  agents/
136
134
  direct.yaml
137
135
  orchestra.yaml
@@ -376,7 +374,6 @@ Core workspace files:
376
374
  - `config/catalogs/backends.yaml`
377
375
  - `config/catalogs/tools.yaml`
378
376
  - `config/catalogs/mcp.yaml`
379
- - `config/workflows/langgraph-workflows.yaml`
380
377
  - `config/agents/direct.yaml`
381
378
  - `config/agents/orchestra.yaml`
382
379
  - `resources/tools/`
@@ -394,7 +391,6 @@ There are three main configuration layers:
394
391
  ### Backend Guidance
395
392
 
396
393
  At the moment, the most stable path for complex production-style runs is `backend: deepagent`.
397
- `backend: langgraph` now exists as an explicit adapter boundary for LangGraph-shaped runtime entry design, but it still reuses the current LangChain-style runnable path internally rather than exposing a fully custom graph DSL.
398
394
 
399
395
  Current temporary limits on the `backend: langchain-v1` path are:
400
396
 
@@ -405,117 +401,8 @@ Current temporary limits on the `backend: langchain-v1` path are:
405
401
  Practical guidance:
406
402
 
407
403
  - use `backend: deepagent` for approvals, resume, multi-agent orchestration, rich memory flows, and heavier tool chains
408
- - use `backend: langgraph` when you want the agent to bind to a built-in preset or an explicit LangGraph workflow resource in config
409
404
  - keep `backend: langchain-v1` for lighter direct-response or explicitly chosen V1 agent shapes while this upstream behavior settles
410
405
 
411
- Minimal Kubernetes-style LangGraph example:
412
-
413
- ```yaml
414
- apiVersion: agent-harness/v1alpha1
415
- kind: LangGraphWorkflows
416
- spec:
417
- - id: default
418
- entryNode: planner
419
- nodes:
420
- - id: planner
421
- kind: llm
422
- role: planner
423
- - id: executor
424
- kind: agent
425
- edges:
426
- - from: planner
427
- to: executor
428
- ```
429
-
430
- ```yaml
431
- apiVersion: agent-harness/v1alpha1
432
- kind: Agent
433
- metadata:
434
- name: graph-entry
435
- spec:
436
- runtime:
437
- runRoot: ./.agent
438
- execution:
439
- backend: langgraph
440
- modelRef: model/default
441
- config:
442
- preset: review-loop
443
- ```
444
-
445
- Built-in LangGraph presets currently supported:
446
-
447
- - `react`
448
- - `prompt-chaining`
449
- - `routing`
450
- - `parallelization`
451
- - `plan-execute`
452
- - `review-loop`
453
- - `evaluator-optimizer`
454
- - `approval-gate`
455
- - `handoff`
456
- - `orchestrator-workers`
457
-
458
- The repository also checks in matching YAML workflow resources for these patterns in
459
- `config/workflows/langgraph-workflows.yaml`, so applications can reference them directly with
460
- `workflow.ref: langgraph-workflow/<pattern-id>`.
461
-
462
- For agent-driven presets such as `routing`, `parallelization`, `handoff`, and `orchestrator-workers`, also set:
463
-
464
- ```yaml
465
- config:
466
- preset: handoff
467
- agent: researcher
468
- ```
469
-
470
- LangGraph also supports profile-first entry config for common application shapes:
471
-
472
- - `coding-runtime`
473
- - `personal-assistant`
474
- - `research-runtime`
475
- - `approval-review-runtime`
476
- - `claw-style-assistant`
477
- - `chat-operator`
478
- - `copilot-sidecar`
479
- - `task-delegation-hub`
480
-
481
- ```yaml
482
- config:
483
- profile: copilot-sidecar
484
- with:
485
- coderAgent: repo-coder-lite
486
- ```
487
-
488
- These presets are harness-owned workflow templates built on top of the LangGraph backend. They are not LangGraph-native node kinds or edge conditions.
489
-
490
- Current workflow primitive node kinds:
491
-
492
- - `llm`
493
- - `agent`
494
- - `tool`
495
- - `approval`
496
- - `condition`
497
-
498
- Only these primitive node kinds are supported in workflow YAML. Role-shaped names such as `planner`, `reviewer`,
499
- `replanner`, `specialist`, `executor`, and `finalizer` are not part of the final DSL.
500
-
501
- Use an explicit workflow ref when an application wants full graph control:
502
-
503
- ```yaml
504
- apiVersion: agent-harness/v1alpha1
505
- kind: Agent
506
- metadata:
507
- name: graph-entry
508
- spec:
509
- runtime:
510
- runRoot: ./.agent
511
- execution:
512
- backend: langgraph
513
- modelRef: model/default
514
- config:
515
- workflow:
516
- ref: langgraph-workflow/default
517
- ```
518
-
519
406
  ### `config/runtime/workspace.yaml`
520
407
 
521
408
  Use this file for workspace-wide runtime policy.
package/README.zh.md CHANGED
@@ -82,7 +82,7 @@
82
82
 
83
83
  - 尽量由调用方显式指定要运行的 host agent
84
84
  - 想用高层执行语义、少写应用编排时,优先选择 `backend: deepagent`
85
- - approvals、recovery 与长链路 orchestration 需要由应用自己控制时,使用 `backend: langgraph`
85
+ - 轻量 direct-response 或明确需要 V1 agent 语义时,使用 `backend: langchain-v1`
86
86
 
87
87
  ## 为何需要它
88
88
 
@@ -130,8 +130,6 @@ your-workspace/
130
130
  backends.yaml
131
131
  tools.yaml
132
132
  mcp.yaml
133
- workflows/
134
- langgraph-workflows.yaml
135
133
  agents/
136
134
  direct.yaml
137
135
  orchestra.yaml
@@ -376,7 +374,6 @@ await stop(runtime);
376
374
  - `config/catalogs/backends.yaml`
377
375
  - `config/catalogs/tools.yaml`
378
376
  - `config/catalogs/mcp.yaml`
379
- - `config/workflows/langgraph-workflows.yaml`
380
377
  - `config/agents/direct.yaml`
381
378
  - `config/agents/orchestra.yaml`
382
379
  - `resources/tools/`
@@ -394,7 +391,6 @@ await stop(runtime);
394
391
  ### Backend 选择建议
395
392
 
396
393
  当前对于复杂、生产化风格的运行链路,最稳定的路径仍然是 `backend: deepagent`。
397
- 现在也支持 `backend: langgraph` 作为显式的 LangGraph 风格 adapter 边界;不过内部实现当前仍复用现有 LangChain runnable 路径,还不是完整自定义 graph DSL。
398
394
 
399
395
  目前 `backend: langchain-v1` 这条路径的暂时限制是:
400
396
 
@@ -405,73 +401,8 @@ await stop(runtime);
405
401
  实际建议:
406
402
 
407
403
  - approvals、resume、多 agent orchestration、复杂 memory 流、重工具链,优先使用 `backend: deepagent`
408
- - 如果你想让 agent 在配置层显式绑定到一个 LangGraph workflow 资源,使用 `backend: langgraph`
409
404
  - `backend: langchain-v1` 先保留给轻量 direct-response 场景,或明确需要 V1 agent 语义的工作区
410
405
 
411
- 最小的 Kubernetes 风格 LangGraph 示例:
412
-
413
- ```yaml
414
- apiVersion: agent-harness/v1alpha1
415
- kind: LangGraphWorkflows
416
- spec:
417
- - id: default
418
- entryNode: planner
419
- nodes:
420
- - id: planner
421
- kind: llm
422
- role: planner
423
- - id: executor
424
- kind: agent
425
- edges:
426
- - from: planner
427
- to: executor
428
- ```
429
-
430
- 当前建议优先使用的 workflow primitive node kinds:
431
-
432
- - `llm`
433
- - `agent`
434
- - `tool`
435
- - `approval`
436
- - `condition`
437
-
438
- 最终版 workflow YAML 只支持这些 primitive node kinds。`planner`、`reviewer`、`replanner`、`specialist`、
439
- `executor`、`finalizer` 这类角色型名字不属于最终 DSL。
440
-
441
- LangGraph 也支持面向常见应用入口的 profile-first 配置:
442
-
443
- - `coding-runtime`
444
- - `personal-assistant`
445
- - `research-runtime`
446
- - `approval-review-runtime`
447
- - `claw-style-assistant`
448
- - `chat-operator`
449
- - `copilot-sidecar`
450
- - `task-delegation-hub`
451
-
452
- ```yaml
453
- config:
454
- profile: copilot-sidecar
455
- with:
456
- coderAgent: repo-coder-lite
457
- ```
458
-
459
- ```yaml
460
- apiVersion: agent-harness/v1alpha1
461
- kind: Agent
462
- metadata:
463
- name: graph-entry
464
- spec:
465
- runtime:
466
- runRoot: ./.agent
467
- execution:
468
- backend: langgraph
469
- modelRef: model/default
470
- config:
471
- workflow:
472
- ref: langgraph-workflow/default
473
- ```
474
-
475
406
  ### `config/runtime/workspace.yaml`
476
407
 
477
408
  用于工作区范围的运行时策略。
package/dist/api.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import type { ApprovalRecord, CancelOptions, RunRecord, RunOptions, RunSummary, ResumeOptions, RuntimeHealthSnapshot, RuntimeAdapterOptions, ThreadSummary, ThreadRecord, WorkspaceLoadOptions } from "./contracts/types.js";
2
2
  import { AgentHarnessRuntime } from "./runtime/harness.js";
3
- import type { InventoryAgentRecord, InventorySkillRecord } from "./runtime/inventory.js";
4
- import type { RequirementAssessmentOptions } from "./runtime/skill-requirements.js";
3
+ import type { InventoryAgentRecord, InventorySkillRecord } from "./runtime/harness/system/inventory.js";
4
+ import type { RequirementAssessmentOptions } from "./runtime/harness/system/skill-requirements.js";
5
5
  import type { ToolMcpServerOptions } from "./mcp.js";
6
6
  export { AgentHarnessRuntime } from "./runtime/harness.js";
7
7
  type CreateAgentHarnessOptions = {
@@ -14,7 +14,7 @@ type CreateAgentHarnessOptions = {
14
14
  };
15
15
  export declare function createAgentHarness(): Promise<AgentHarnessRuntime>;
16
16
  export declare function createAgentHarness(workspaceRoot: string, options?: CreateAgentHarnessOptions): Promise<AgentHarnessRuntime>;
17
- export declare function run(runtime: AgentHarnessRuntime, options: RunOptions): Promise<import("./contracts/types.js").RunResult>;
17
+ export declare function run(runtime: AgentHarnessRuntime, options: RunOptions): Promise<import("./contracts/runtime.js").RunResult>;
18
18
  export declare function subscribe(runtime: AgentHarnessRuntime, listener: Parameters<AgentHarnessRuntime["subscribe"]>[0]): () => void;
19
19
  export declare function listThreads(runtime: AgentHarnessRuntime, filter?: Parameters<AgentHarnessRuntime["listThreads"]>[0]): Promise<ThreadSummary[]>;
20
20
  export declare function listRuns(runtime: AgentHarnessRuntime, filter?: Parameters<AgentHarnessRuntime["listRuns"]>[0]): Promise<RunSummary[]>;
@@ -29,8 +29,8 @@ export declare function describeInventory(runtime: AgentHarnessRuntime, options?
29
29
  workspaceRoot: string;
30
30
  agents: InventoryAgentRecord[];
31
31
  };
32
- export declare function resolveApproval(runtime: AgentHarnessRuntime, options: ResumeOptions): Promise<import("./contracts/types.js").RunResult>;
33
- export declare function cancelRun(runtime: AgentHarnessRuntime, options: CancelOptions): Promise<import("./contracts/types.js").RunResult>;
32
+ export declare function resolveApproval(runtime: AgentHarnessRuntime, options: ResumeOptions): Promise<import("./contracts/runtime.js").RunResult>;
33
+ export declare function cancelRun(runtime: AgentHarnessRuntime, options: CancelOptions): Promise<import("./contracts/runtime.js").RunResult>;
34
34
  export declare function stop(runtime: AgentHarnessRuntime): Promise<void>;
35
35
  export declare function createToolMcpServer(runtime: AgentHarnessRuntime, options: ToolMcpServerOptions): Promise<import("@modelcontextprotocol/sdk/server/mcp.js").McpServer>;
36
36
  export declare function serveToolsOverStdio(runtime: AgentHarnessRuntime, options: ToolMcpServerOptions): Promise<import("@modelcontextprotocol/sdk/server/mcp.js").McpServer>;