@inbrowser/agent 0.2.0 → 0.3.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.
Files changed (61) hide show
  1. package/README.md +2 -2
  2. package/dist/cli/commands/run.js.map +1 -1
  3. package/dist/cli/fixtures.d.ts +2 -2
  4. package/dist/cli/fixtures.d.ts.map +1 -1
  5. package/dist/cli/fixtures.js +7 -16
  6. package/dist/cli/fixtures.js.map +1 -1
  7. package/dist/cli/llm/openrouter.d.ts +4 -4
  8. package/dist/cli/llm/openrouter.d.ts.map +1 -1
  9. package/dist/cli/llm/openrouter.js +20 -31
  10. package/dist/cli/llm/openrouter.js.map +1 -1
  11. package/dist/diagnostics/truthfulness.js.map +1 -1
  12. package/dist/eval/runner.d.ts +4 -4
  13. package/dist/eval/runner.d.ts.map +1 -1
  14. package/dist/eval/runner.js +1 -1
  15. package/dist/index.d.ts +8 -5
  16. package/dist/index.d.ts.map +1 -1
  17. package/dist/index.js +3 -2
  18. package/dist/index.js.map +1 -1
  19. package/dist/llm-adapter.d.ts +30 -34
  20. package/dist/llm-adapter.d.ts.map +1 -1
  21. package/dist/llm-adapter.js +61 -51
  22. package/dist/llm-adapter.js.map +1 -1
  23. package/dist/mcp/connect.d.ts +68 -0
  24. package/dist/mcp/connect.d.ts.map +1 -0
  25. package/dist/mcp/connect.js +111 -0
  26. package/dist/mcp/connect.js.map +1 -0
  27. package/dist/metrics.js +4 -4
  28. package/dist/metrics.js.map +1 -1
  29. package/dist/node.d.ts +2 -0
  30. package/dist/node.d.ts.map +1 -1
  31. package/dist/node.js +1 -0
  32. package/dist/node.js.map +1 -1
  33. package/dist/retrieval.d.ts +74 -0
  34. package/dist/retrieval.d.ts.map +1 -0
  35. package/dist/retrieval.js +287 -0
  36. package/dist/retrieval.js.map +1 -0
  37. package/dist/session.d.ts.map +1 -1
  38. package/dist/session.js +8 -2
  39. package/dist/session.js.map +1 -1
  40. package/dist/strategy.d.ts +2 -1
  41. package/dist/strategy.d.ts.map +1 -1
  42. package/dist/strategy.js +36 -26
  43. package/dist/strategy.js.map +1 -1
  44. package/dist/types/agent.d.ts +2 -3
  45. package/dist/types/agent.d.ts.map +1 -1
  46. package/dist/types/agent.js +1 -1
  47. package/dist/types/chat.d.ts +0 -15
  48. package/dist/types/chat.d.ts.map +1 -1
  49. package/dist/types/llm.d.ts +11 -64
  50. package/dist/types/llm.d.ts.map +1 -1
  51. package/dist/types/llm.js +7 -8
  52. package/dist/types/llm.js.map +1 -1
  53. package/dist/types/metrics.d.ts +2 -2
  54. package/dist/types/metrics.d.ts.map +1 -1
  55. package/dist/types/session.d.ts +2 -2
  56. package/dist/types/session.d.ts.map +1 -1
  57. package/dist/types/strategy.d.ts +13 -4
  58. package/dist/types/strategy.d.ts.map +1 -1
  59. package/dist/types/trace.d.ts +11 -9
  60. package/dist/types/trace.d.ts.map +1 -1
  61. package/package.json +3 -2
@@ -22,7 +22,7 @@
22
22
  * completed — that the eval harness uses to split language-model
23
23
  * time from tool-dispatch time.
24
24
  */
25
- import type { NormalizedMessage } from './chat.js';
25
+ import type { ModelMessage } from './llm.js';
26
26
  /**
27
27
  * Wire-level snapshot of a single LLM request as it leaves the
28
28
  * strategy. Captured exactly once per ReAct iteration — N times per
@@ -39,7 +39,7 @@ export interface LlmRequestTrace {
39
39
  /** 0-indexed ReAct iteration within this turn. */
40
40
  iteration: number;
41
41
  /** Wall-clock ms captured immediately before the strategy hands
42
- * the request to `LlmClient.chat()`. Pair with
42
+ * the request to `ModelClient.chat()`. Pair with
43
43
  * `LlmResponseTrace.ts` (response completed) and
44
44
  * `TurnDispatchCompleteTrace.ts` (tool dispatch completed) to
45
45
  * derive the language-model vs tool-dispatch wall-clock split for
@@ -52,7 +52,7 @@ export interface LlmRequestTrace {
52
52
  * the synthesized leading system message, the prior history, the
53
53
  * current user prompt, and any assistant+tool entries the ReAct
54
54
  * loop appended this turn. */
55
- messages: NormalizedMessage[];
55
+ messages: ModelMessage[];
56
56
  /** Tool declarations as filtered + shaped by the strategy. The
57
57
  * `parameters` value is captured opaquely — providers normalize
58
58
  * it (Gemini sanitizes; OpenRouter is permissive), so the trace
@@ -68,10 +68,11 @@ export interface LlmRequestTrace {
68
68
  };
69
69
  }
70
70
  /**
71
- * Tool-decl row as the agent loop produced it pre-provider. Mirrors
72
- * the `toolDecls` shape strategy.ts builds when constructing the
73
- * `ChatRequest`. Not coupled to the in-process `ToolHandler` type
74
- * the trace is a wire snapshot, not a live handle.
71
+ * Tool-decl row as the agent loop produced it pre-provider. The
72
+ * agent loop builds nested `ToolSpec`s for the `ModelRequest`; this
73
+ * flat view is the canonical pre-provider snapshot the trace exposes.
74
+ * Not coupled to the in-process `ToolHandler` type the trace is a
75
+ * wire snapshot, not a live handle.
75
76
  */
76
77
  export interface ToolDeclarationView {
77
78
  name: string;
@@ -89,8 +90,9 @@ export interface LlmResponseTrace {
89
90
  /** Same id as the matching `LlmRequestTrace.requestId`. */
90
91
  requestId: string;
91
92
  /** Wall-clock ms captured immediately after the `chat()` iterator
92
- * has yielded its terminal event for this iteration (typically
93
- * `turn_complete`, or `error` on a streaming failure). Not
93
+ * has drained for this iteration (the `usage` event arrives just
94
+ * before the iterable returns, or `error` on a streaming failure).
95
+ * Not
94
96
  * emitted on mid-stream error — callers should treat a missing
95
97
  * `llm_response` as "language-model time unknown for this
96
98
  * iteration." */
@@ -1 +1 @@
1
- {"version":3,"file":"trace.d.ts","sourceRoot":"","sources":["../../src/types/trace.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAEnD;;;;;GAKG;AACH,MAAM,WAAW,eAAe;IAC9B;;+CAE2C;IAC3C,SAAS,EAAE,MAAM,CAAC;IAClB,kEAAkE;IAClE,MAAM,EAAE,MAAM,CAAC;IACf,kDAAkD;IAClD,SAAS,EAAE,MAAM,CAAC;IAClB;;;;;0BAKsB;IACtB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/agent",
3
- "version": "0.2.0",
4
- "description": "Agent runtime + CLI. Library exports AgentSession, AgentStrategy, ToolRegistry, LlmClient, MetricsCollector, SandboxObserver. Ships an `agent` binary with NDJSON output, --json stdin, --dry-run, schema introspection, and inverse-mode MCP serve. Domain-agnostic — hosts wire their own AgentDefinitions.",
3
+ "version": "0.3.0",
4
+ "description": "Agent runtime + CLI. Library exports AgentSession, AgentStrategy, ToolRegistry, ModelClient, MetricsCollector, SandboxObserver. Ships an `agent` binary with NDJSON output, --json stdin, --dry-run, schema introspection, and inverse-mode MCP serve. Domain-agnostic — hosts wire their own AgentDefinitions.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
7
7
  "types": "./dist/index.d.ts",
@@ -29,6 +29,7 @@
29
29
  "typecheck": "tsc -p tsconfig.json --noEmit"
30
30
  },
31
31
  "dependencies": {
32
+ "@inbrowser/model": "workspace:*",
32
33
  "@modelcontextprotocol/sdk": "^1.0.0",
33
34
  "@opentui/core": "^0.1.0",
34
35
  "@opentui/react": "^0.1.0",