@hachej/boring-agent 0.1.111 → 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.
Files changed (156) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +262 -51
  3. package/dist/agents.d.ts +75 -0
  4. package/dist/agents.js +91 -0
  5. package/dist/approval.d.ts +71 -0
  6. package/dist/approval.js +126 -0
  7. package/dist/artifacts.d.ts +53 -0
  8. package/dist/artifacts.js +129 -0
  9. package/dist/ask-user.d.ts +40 -0
  10. package/dist/ask-user.js +134 -0
  11. package/dist/attachment.d.ts +5 -0
  12. package/dist/attachment.js +4 -0
  13. package/dist/browser-task.d.ts +32 -0
  14. package/dist/browser-task.js +119 -0
  15. package/dist/chat-transport.d.ts +80 -0
  16. package/dist/chat-transport.js +306 -0
  17. package/dist/contracts.d.ts +40 -0
  18. package/dist/contracts.js +1 -0
  19. package/dist/conversations.d.ts +136 -0
  20. package/dist/conversations.js +366 -0
  21. package/dist/definitions.d.ts +37 -0
  22. package/dist/definitions.js +99 -0
  23. package/dist/delivery-input.d.ts +35 -0
  24. package/dist/delivery-input.js +56 -0
  25. package/dist/delivery.d.ts +33 -0
  26. package/dist/delivery.js +154 -0
  27. package/dist/durable-wait.d.ts +23 -0
  28. package/dist/durable-wait.js +79 -0
  29. package/dist/file-convert.d.ts +46 -0
  30. package/dist/file-convert.js +159 -0
  31. package/dist/file-guard.d.ts +50 -0
  32. package/dist/file-guard.js +171 -0
  33. package/dist/file-types.d.ts +17 -0
  34. package/dist/file-types.js +95 -0
  35. package/dist/gateway-provider.d.ts +24 -0
  36. package/dist/gateway-provider.js +42 -0
  37. package/dist/git.d.ts +34 -0
  38. package/dist/git.js +79 -0
  39. package/dist/harness-pool.d.ts +38 -0
  40. package/dist/harness-pool.js +134 -0
  41. package/dist/index.d.ts +4 -0
  42. package/dist/index.js +1 -0
  43. package/dist/json-schema-tool.d.ts +25 -0
  44. package/dist/json-schema-tool.js +19 -0
  45. package/dist/memory/optchat-core.d.ts +118 -0
  46. package/dist/memory/optchat-core.js +317 -0
  47. package/dist/memory/optchat.d.ts +156 -0
  48. package/dist/memory/optchat.js +432 -0
  49. package/dist/mentions.d.ts +56 -0
  50. package/dist/mentions.js +140 -0
  51. package/dist/metering.d.ts +183 -0
  52. package/dist/metering.js +443 -0
  53. package/dist/model-gateway.d.ts +86 -0
  54. package/dist/model-gateway.js +241 -0
  55. package/dist/native-version.d.ts +9 -0
  56. package/dist/native-version.js +7 -0
  57. package/dist/native.d.ts +4 -0
  58. package/dist/native.js +1 -0
  59. package/dist/presentation.d.ts +17 -0
  60. package/dist/presentation.js +39 -0
  61. package/dist/projection-format.d.ts +68 -0
  62. package/dist/projection-format.js +118 -0
  63. package/dist/projection-window.d.ts +9 -0
  64. package/dist/projection-window.js +93 -0
  65. package/dist/projection.d.ts +22 -0
  66. package/dist/projection.js +153 -0
  67. package/dist/question-response.d.ts +20 -0
  68. package/dist/question-response.js +75 -0
  69. package/dist/questions.d.ts +74 -0
  70. package/dist/questions.js +199 -0
  71. package/dist/self-evolving.d.ts +55 -0
  72. package/dist/self-evolving.js +239 -0
  73. package/dist/skills.d.ts +15 -0
  74. package/dist/skills.js +51 -0
  75. package/dist/tool-evidence.d.ts +14 -0
  76. package/dist/tool-evidence.js +54 -0
  77. package/dist/validation.d.ts +38 -0
  78. package/dist/validation.js +68 -0
  79. package/dist/workspaces.d.ts +107 -0
  80. package/dist/workspaces.js +212 -0
  81. package/package.json +145 -150
  82. package/dist/DebugDrawer-JNA43SVR.js +0 -8
  83. package/dist/admin-DORVQfLn.d.ts +0 -340
  84. package/dist/chunk-2BGLZZ7T.js +0 -10
  85. package/dist/chunk-42D6KAQV.js +0 -2882
  86. package/dist/chunk-4XOW57KJ.js +0 -343
  87. package/dist/chunk-72KT6VWV.js +0 -1338
  88. package/dist/chunk-7XAOVFSN.js +0 -28
  89. package/dist/chunk-KJIEMSQP.js +0 -198
  90. package/dist/chunk-KN72XWP7.js +0 -394
  91. package/dist/chunk-N6THTH7P.js +0 -110
  92. package/dist/chunk-V3H5A3BR.js +0 -22501
  93. package/dist/chunk-YGRQ4Q5P.js +0 -20
  94. package/dist/chunk-YTUZFKB3.js +0 -78
  95. package/dist/core/index.d.ts +0 -28
  96. package/dist/core/index.js +0 -617
  97. package/dist/createHarness-DOLOHA62.js +0 -18
  98. package/dist/eval/index.d.ts +0 -247
  99. package/dist/eval/index.js +0 -541
  100. package/dist/file-search-BUgMSKZE.d.ts +0 -289
  101. package/dist/front/artifacts.d.ts +0 -34
  102. package/dist/front/artifacts.js +0 -21
  103. package/dist/front/index.d.ts +0 -1082
  104. package/dist/front/index.js +0 -12912
  105. package/dist/front/styles.css +0 -5380
  106. package/dist/harness-qHlMJhZo.d.ts +0 -276
  107. package/dist/middleware-CaAEXpi5.d.ts +0 -115
  108. package/dist/piChatEvent-DpE0lIb9.d.ts +0 -450
  109. package/dist/piChatSessionService-CBct-hmz.d.ts +0 -86
  110. package/dist/sandbox-BMhut3kh.d.ts +0 -317
  111. package/dist/server/agent-host/testing/compositionRouteProof.d.ts +0 -8
  112. package/dist/server/agent-host/testing/compositionRouteProof.js +0 -78
  113. package/dist/server/agent-host/testing/gatewayConformance.d.ts +0 -43
  114. package/dist/server/agent-host/testing/gatewayConformance.js +0 -605
  115. package/dist/server/index.d.ts +0 -2278
  116. package/dist/server/index.js +0 -274
  117. package/dist/server/pi-session-readability.d.ts +0 -12
  118. package/dist/server/pi-session-readability.js +0 -23
  119. package/dist/server/worker/index.d.ts +0 -68
  120. package/dist/server/worker/index.js +0 -377
  121. package/dist/share-entry-CxS6UJ_L.d.ts +0 -330
  122. package/dist/shared/index.d.ts +0 -2111
  123. package/dist/shared/index.js +0 -262
  124. package/dist/types-DcWoQMn8.d.ts +0 -1377
  125. package/docs/ACCESSIBILITY.md +0 -52
  126. package/docs/AGENT_GATEWAY_V0.md +0 -212
  127. package/docs/AGENT_PACKAGES.md +0 -90
  128. package/docs/API.md +0 -123
  129. package/docs/AUTHORING.md +0 -68
  130. package/docs/CSP.md +0 -41
  131. package/docs/ERROR_CODES.md +0 -229
  132. package/docs/KNOWN_LIMITATIONS.md +0 -100
  133. package/docs/MIGRATION.md +0 -50
  134. package/docs/PERFORMANCE.md +0 -68
  135. package/docs/PLUGINS.md +0 -138
  136. package/docs/README.md +0 -98
  137. package/docs/RISKS-MULTI-TAB.md +0 -46
  138. package/docs/SESSION_IDENTITY.md +0 -91
  139. package/docs/STYLING.md +0 -73
  140. package/docs/UI-SHADCN.md +0 -56
  141. package/docs/VERCEL_COSTS.md +0 -103
  142. package/docs/plans/archive/AGENT_EVAL_FRAMEWORK.md +0 -466
  143. package/docs/plans/archive/agent-package-spec.md +0 -1777
  144. package/docs/plans/archive/harness-followup-capabilities.md +0 -440
  145. package/docs/plans/archive/harness-tool-ui-capabilities.md +0 -144
  146. package/docs/plans/archive/pi-followup-history-projection.md +0 -229
  147. package/docs/plans/archive/pi-tools-migration.md +0 -1061
  148. package/docs/plans/archive/reviews/pi-followup-history-codex-review.md +0 -11
  149. package/docs/plans/archive/reviews/pi-followup-history-gpt-review.md +0 -64
  150. package/docs/plans/archive/reviews/pi-followup-history-opus-review.md +0 -43
  151. package/docs/plans/archive/reviews/pi-followup-history-xai-review.md +0 -43
  152. package/docs/plans/archive/vercel-base-snapshot-template-plan.md +0 -527
  153. package/docs/plans/archive/vercel-persistent-sandbox-adapter.md +0 -553
  154. package/docs/runtime-provisioning.md +0 -157
  155. package/docs/runtime.md +0 -296
  156. package/docs/tools.md +0 -102
@@ -1,247 +0,0 @@
1
- import { FastifyInstance } from 'fastify';
2
-
3
- /**
4
- * Public types for @hachej/boring-agent/eval — the eval framework.
5
- *
6
- * See packages/agent/docs/plans/AGENT_EVAL_FRAMEWORK.md for the design
7
- * rationale and approved contract.
8
- */
9
-
10
- /**
11
- * A captured tool call from an LLM response. Anthropic / OpenAI both
12
- * support emitting multiple tool calls in a single response (parallel)
13
- * or across turns (sequential). The framework collects ALL of them; the
14
- * matcher then checks for existence (default) or ordering (`expectFirst`).
15
- */
16
- interface ToolCall {
17
- tool: string;
18
- params: Record<string, unknown>;
19
- }
20
- /**
21
- * Sentinel for "must be present at this key, any value". Use in
22
- * `expect.params` for fields the LLM generates (uuids, timestamps).
23
- *
24
- * In YAML fixtures: `id: !EvalAny`.
25
- */
26
- declare const EvalAny: unique symbol;
27
- type EvalAnyType = typeof EvalAny;
28
- /**
29
- * Tagged regex matcher for string params. Use when the value is partially
30
- * structured (e.g. an id that must start with `chart:`) but the suffix
31
- * varies between runs.
32
- *
33
- * In YAML fixtures: `component: !EvalRegex "^chart:"`.
34
- */
35
- interface EvalRegexMatcher {
36
- __evalRegex: RegExp;
37
- }
38
- declare function EvalRegex(re: RegExp | string): EvalRegexMatcher;
39
- declare function isEvalRegex(value: unknown): value is EvalRegexMatcher;
40
- /**
41
- * Expected shape of a tool call. The matcher (matcher.ts) decides if an
42
- * actual ToolCall satisfies it.
43
- *
44
- * - `tool`: exact name match (required).
45
- * - `params`: partial match by default — every key in `expect.params` must
46
- * appear in the actual call's params with a matching value. Extra keys
47
- * in the actual call are allowed unless `strict: true`.
48
- * - Values inside `params` may be the `EvalAny` sentinel or an
49
- * `EvalRegexMatcher` wildcard.
50
- */
51
- interface ExpectedCall {
52
- tool: string;
53
- params?: Record<string, unknown>;
54
- strict?: boolean;
55
- }
56
- /**
57
- * Per-prompt eval options. See `evalAgentPrompt(opts)` in evalPrompt.ts.
58
- */
59
- type EvalModelSelection = string | {
60
- provider: string;
61
- id: string;
62
- };
63
- interface EvalPromptOptions {
64
- /** A FastifyInstance from createStandaloneAgentHostApp / createWorkspaceAgentApp / etc. */
65
- app: FastifyInstance;
66
- /** Addressed Agent owner exercised by this eval. */
67
- agentTypeId: string;
68
- /** User prompt sent to the agent. */
69
- prompt: string;
70
- /**
71
- * Expected tool calls. Default: assert each ExpectedCall here matches
72
- * AT LEAST ONE call in the LLM's response (any order). Mutually
73
- * exclusive with `expectFirst` and `expectNoToolCall`.
74
- */
75
- expect?: ExpectedCall | ExpectedCall[];
76
- /**
77
- * Stricter alternative: assert the FIRST tool call matches.
78
- * Mutually exclusive with `expect` and `expectNoToolCall`.
79
- */
80
- expectFirst?: ExpectedCall;
81
- /**
82
- * Negative assertion: NO tool was called (LLM answered in plain text).
83
- * Mutually exclusive with `expect` and `expectFirst`.
84
- */
85
- expectNoToolCall?: boolean;
86
- /**
87
- * Model id. Defaults to the agent's pinned model (see evalConfig.ts).
88
- * Suites typically override at the suite level (in YAML).
89
- */
90
- model?: EvalModelSelection;
91
- /** Optional system prompt. */
92
- systemPrompt?: string;
93
- /** Override the chat session id (defaults to a fresh uuid). */
94
- sessionId?: string;
95
- /** Optional headers sent to session/chat requests (e.g. workspace scoping). */
96
- headers?: Record<string, string>;
97
- /** Per-call timeout in ms. Defaults to 30_000. */
98
- timeoutMs?: number;
99
- /** Per-prompt retry count. Default: 0. */
100
- retries?: number;
101
- }
102
- interface EvalResult {
103
- ok: boolean;
104
- /** All tool calls the LLM made, in order. */
105
- actual: ToolCall[];
106
- /** Plain-text response from the LLM. */
107
- text: string;
108
- /** Human-readable reason on failure. */
109
- reason?: string;
110
- /** Tokens consumed. */
111
- usage?: {
112
- input: number;
113
- output: number;
114
- };
115
- /** Number of attempts used (1 + retries on failure). */
116
- attempts: number;
117
- }
118
- /**
119
- * Suite runner options. See `runEvalSuite(opts)` in runSuite.ts.
120
- */
121
- interface SuiteOptions {
122
- app: FastifyInstance;
123
- /** Addressed Agent owner exercised by every fixture. */
124
- agentTypeId: string;
125
- /** Path to a YAML fixture file. See AGENT_EVAL_FRAMEWORK.md for format. */
126
- fixturesPath: string;
127
- /** Stop on first failure. Default: false. */
128
- bail?: boolean;
129
- /** Concurrency. Default: 4. */
130
- concurrency?: number;
131
- /** Suite-level timeout in ms. Default: 5 * 60_000 (5 minutes). */
132
- suiteTimeoutMs?: number;
133
- /** Override per-prompt model. Useful for ad-hoc model comparison runs. */
134
- model?: EvalModelSelection;
135
- }
136
- interface SuiteFixturePrompt {
137
- prompt: string;
138
- expect?: ExpectedCall | ExpectedCall[];
139
- expectFirst?: ExpectedCall;
140
- expectNoToolCall?: boolean;
141
- retries?: number;
142
- timeoutMs?: number;
143
- model?: EvalModelSelection;
144
- }
145
- interface SuiteFixture {
146
- /** Pinned model for the whole suite (each prompt may override). */
147
- model?: EvalModelSelection;
148
- /** System prompt prepended to every prompt in this suite. */
149
- systemPrompt?: string;
150
- /** Defaults applied to each prompt unless inline-overridden. */
151
- defaults?: Pick<SuiteFixturePrompt, "retries" | "timeoutMs" | "model">;
152
- prompts: SuiteFixturePrompt[];
153
- }
154
- interface SuiteReport {
155
- total: number;
156
- passed: number;
157
- failed: number;
158
- passRate: number;
159
- results: Array<EvalResult & {
160
- prompt: string;
161
- expected: SuiteFixturePrompt;
162
- }>;
163
- totalUsage: {
164
- input: number;
165
- output: number;
166
- };
167
- totalDurationMs: number;
168
- /** True iff every result is ok: true. */
169
- allPassed: boolean;
170
- }
171
-
172
- declare function evalAgentPrompt(opts: EvalPromptOptions): Promise<EvalResult>;
173
-
174
- declare function runEvalSuite(opts: SuiteOptions): Promise<SuiteReport>;
175
-
176
- /**
177
- * Parse a YAML fixture file (text contents) into a `SuiteFixture`.
178
- *
179
- * Delegates to the `yaml` package with the custom-tag schema so the
180
- * matcher wildcards (`!EvalAny`, `!EvalRegex`) resolve into runtime
181
- * values matcher.ts can consume.
182
- *
183
- * Throws on invalid YAML syntax. Returns whatever shape parses — minimal
184
- * runtime validation here (caller asserts with the SuiteFixture type).
185
- */
186
- declare function parseFixtureYaml(text: string): SuiteFixture;
187
-
188
- /**
189
- * Pure matcher logic for the eval framework. No LLM, no fetch, no
190
- * Fastify — exercised in unit tests against fixed ToolCall[] inputs.
191
- *
192
- * The matcher implements three modes:
193
- * 1. someCallMatches (default `expect`) — every ExpectedCall must match
194
- * at least one actual ToolCall, any order. Captures parallel /
195
- * sequential tool calling without assuming an order the LLM didn't
196
- * actually commit to.
197
- * 2. firstCallMatches (`expectFirst`) — actual[0] must match the
198
- * ExpectedCall. Use only when ordering is part of the contract.
199
- * 3. noToolCall (`expectNoToolCall`) — actual must be empty. The LLM
200
- * answered in plain text without tooling.
201
- *
202
- * Param matching is partial by default: every key in expect.params must
203
- * appear in actual.params with a matching value, but extra keys in
204
- * actual are ignored. Set `strict: true` to require exact equality (no
205
- * extra keys allowed).
206
- */
207
-
208
- interface MatchOutcome {
209
- ok: boolean;
210
- /** Index into `actual[]` that satisfied the expected call. -1 on failure. */
211
- matchedIndex: number;
212
- /** Diagnostic when ok is false. */
213
- reason?: string;
214
- }
215
- /**
216
- * Does ONE actual call satisfy ONE expected call? Used as the inner
217
- * predicate by all three modes.
218
- */
219
- declare function callSatisfies(expected: ExpectedCall, actual: ToolCall): MatchOutcome;
220
- /**
221
- * "Does at least one of `actual` satisfy each entry in `expected`?"
222
- * Returns the index of the first match for each expected entry.
223
- */
224
- declare function someCallMatches(expected: ExpectedCall | ExpectedCall[], actual: ToolCall[]): MatchOutcome;
225
- declare function firstCallMatches(expected: ExpectedCall, actual: ToolCall[]): MatchOutcome;
226
- declare function noToolCallMatches(actual: ToolCall[]): MatchOutcome;
227
-
228
- /**
229
- * Default model for the eval framework.
230
- *
231
- * Pinned deliberately so model deprecation is a visible PR (changelog
232
- * entry + intentional bump), not a transparent update. Per-suite YAML
233
- * fixtures override this at the suite level so consumers upgrade at
234
- * their own pace.
235
- */
236
- declare const DEFAULT_EVAL_MODEL: {
237
- readonly provider: "openrouter";
238
- readonly id: "qwen/qwen3.6-plus";
239
- };
240
- /** Default per-call timeout in ms. */
241
- declare const DEFAULT_TIMEOUT_MS = 30000;
242
- /** Default suite-level timeout in ms (5 minutes). */
243
- declare const DEFAULT_SUITE_TIMEOUT_MS: number;
244
- /** Default concurrency for runEvalSuite. */
245
- declare const DEFAULT_CONCURRENCY = 4;
246
-
247
- export { DEFAULT_CONCURRENCY, DEFAULT_EVAL_MODEL, DEFAULT_SUITE_TIMEOUT_MS, DEFAULT_TIMEOUT_MS, EvalAny, type EvalAnyType, type EvalModelSelection, type EvalPromptOptions, EvalRegex, type EvalRegexMatcher, type EvalResult, type ExpectedCall, type MatchOutcome, type SuiteFixture, type SuiteFixturePrompt, type SuiteOptions, type SuiteReport, type ToolCall, callSatisfies, evalAgentPrompt, firstCallMatches, isEvalRegex, noToolCallMatches, parseFixtureYaml, runEvalSuite, someCallMatches };