@vedmalex/ai-connect 0.7.0 → 0.9.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/README.md +37 -4
- package/dist/browser/index.js +717 -284
- package/dist/browser/index.js.map +3 -3
- package/dist/bun/index.js +1248 -450
- package/dist/bun/index.js.map +4 -4
- package/dist/bun/local.js +1194 -444
- package/dist/bun/local.js.map +4 -4
- package/dist/node/index.js +1248 -450
- package/dist/node/index.js.map +4 -4
- package/dist/node/local.js +1194 -444
- package/dist/node/local.js.map +4 -4
- package/dist/types/acp.d.ts +14 -0
- package/dist/types/acp.d.ts.map +1 -1
- package/dist/types/cli-presets.d.ts.map +1 -1
- package/dist/types/cli.d.ts.map +1 -1
- package/dist/types/client.d.ts.map +1 -1
- package/dist/types/config.d.ts.map +1 -1
- package/dist/types/default-handlers.d.ts.map +1 -1
- package/dist/types/errors.d.ts +11 -0
- package/dist/types/errors.d.ts.map +1 -1
- package/dist/types/fanout.d.ts.map +1 -1
- package/dist/types/files.d.ts +47 -1
- package/dist/types/files.d.ts.map +1 -1
- package/dist/types/local-handlers.d.ts.map +1 -1
- package/dist/types/logging.d.ts +18 -1
- package/dist/types/logging.d.ts.map +1 -1
- package/dist/types/mock-gateway.d.ts +20 -0
- package/dist/types/mock-gateway.d.ts.map +1 -1
- package/dist/types/model-reference.d.ts +5 -2
- package/dist/types/model-reference.d.ts.map +1 -1
- package/dist/types/router.d.ts.map +1 -1
- package/dist/types/server-presets.d.ts +1 -1
- package/dist/types/server-presets.d.ts.map +1 -1
- package/dist/types/server.d.ts.map +1 -1
- package/dist/types/transport-runtime.d.ts +75 -0
- package/dist/types/transport-runtime.d.ts.map +1 -0
- package/dist/types/types.d.ts +44 -0
- package/dist/types/types.d.ts.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -215,6 +215,27 @@ const result = await client.generate({
|
|
|
215
215
|
});
|
|
216
216
|
```
|
|
217
217
|
|
|
218
|
+
#### ACP model selection + headless harness-noise suppression
|
|
219
|
+
|
|
220
|
+
For headless / batch prompts (e.g. per-document extraction) the ACP transport drives an interactive coding agent. Two behaviours make that robust by default:
|
|
221
|
+
|
|
222
|
+
- **Model via the protocol.** The route's model (`routeHints.model ?? account model`) is selected through a `session/set_model` call after `session/new` — you do **not** need to inject an `ANTHROPIC_MODEL` env var, and there is no env-driven "model switched" announcement leaking into the output. The call is sent only when the agent advertises a model catalog, the requested model is in its `availableModels`, and it differs from the current model; a model the agent does not advertise is surfaced as a `warning` (it is not silently replaced by the agent default).
|
|
223
|
+
- **Harness-noise suppression + guard.** Known interactive-harness marker lines (a model-switch announcement, a `Готов к работе` / `Жду …` idle greeting, `<local-command-caveat>` commentary) are filtered out of the answer text on both the `generate` and the streaming (`delta`) paths. If a turn yields **only** such harness chatter and no task output, it is surfaced as `temporary_unavailable` so the consumer can retry / fall back rather than receiving the greeting as a successful generation.
|
|
224
|
+
|
|
225
|
+
All three are on by default and can be toggled via `acp` client options:
|
|
226
|
+
|
|
227
|
+
```ts
|
|
228
|
+
const client = createLocalClient(config, {
|
|
229
|
+
acp: {
|
|
230
|
+
selectModel: true, // session/set_model from the route model (default true)
|
|
231
|
+
suppressHarnessNoise: true, // filter harness marker lines from text + deltas (default true)
|
|
232
|
+
failOnHarnessOnlyTurn: true, // harness-only turn → temporary_unavailable (default true)
|
|
233
|
+
},
|
|
234
|
+
});
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
> Limitation: the harness-noise filter / guard recognises a curated, locale-specific marker set (Claude harness, RU greetings). A reworded or other-locale greeting that still carries non-marker text is not classified as harness-only. The model-switch root cause is removed independently by `selectModel`.
|
|
238
|
+
|
|
218
239
|
Dedicated provider-specific ACP examples:
|
|
219
240
|
|
|
220
241
|
- [examples/acp-claude.ts](/Users/vedmalex/work/ai-connect/examples/acp-claude.ts)
|
|
@@ -1059,7 +1080,7 @@ Use explicit runtime entry points when you know the target in advance:
|
|
|
1059
1080
|
Notes:
|
|
1060
1081
|
|
|
1061
1082
|
- `@vedmalex/ai-connect/browser` is the browser-safe bundle.
|
|
1062
|
-
- `@vedmalex/ai-connect` defaults to the full Node/Bun-oriented entry.
|
|
1083
|
+
- `@vedmalex/ai-connect` defaults to the full Node/Bun-oriented entry. Its `package.json` `exports` already resolve the `node` and `bun` conditions to the respective builds, so `@vedmalex/ai-connect/node` and `@vedmalex/ai-connect/bun` are just explicit aliases of `.` — both are built from the same `src/index.ts` entry (esbuild, `node20` target). The `node` and `bun` outputs are byte-identical builds; the separate subpaths exist only for callers who want to name the target explicitly. Prefer the default `.` import unless you have a specific reason to pin one.
|
|
1063
1084
|
- `@vedmalex/ai-connect/local` is the focused local runtime entry with ACP support.
|
|
1064
1085
|
|
|
1065
1086
|
## Public API
|
|
@@ -1291,12 +1312,24 @@ See:
|
|
|
1291
1312
|
- [examples/acp-claude.ts](/Users/vedmalex/work/ai-connect/examples/acp-claude.ts)
|
|
1292
1313
|
- [examples/acp-codex.ts](/Users/vedmalex/work/ai-connect/examples/acp-codex.ts)
|
|
1293
1314
|
- [examples/browser-basic.ts](/Users/vedmalex/work/ai-connect/examples/browser-basic.ts)
|
|
1315
|
+
- [examples/browser-client-tools.ts](/Users/vedmalex/work/ai-connect/examples/browser-client-tools.ts)
|
|
1316
|
+
- [examples/cancellation-timeout.ts](/Users/vedmalex/work/ai-connect/examples/cancellation-timeout.ts)
|
|
1317
|
+
- [examples/clean-context.ts](/Users/vedmalex/work/ai-connect/examples/clean-context.ts)
|
|
1318
|
+
- [examples/fanout-throttle.ts](/Users/vedmalex/work/ai-connect/examples/fanout-throttle.ts)
|
|
1319
|
+
- [examples/health-probe.ts](/Users/vedmalex/work/ai-connect/examples/health-probe.ts)
|
|
1320
|
+
- [examples/image-edit-test.ts](/Users/vedmalex/work/ai-connect/examples/image-edit-test.ts)
|
|
1321
|
+
- [examples/image-test.ts](/Users/vedmalex/work/ai-connect/examples/image-test.ts)
|
|
1322
|
+
- [examples/image-workflow.ts](/Users/vedmalex/work/ai-connect/examples/image-workflow.ts)
|
|
1294
1323
|
- [examples/local-acp.ts](/Users/vedmalex/work/ai-connect/examples/local-acp.ts)
|
|
1324
|
+
- [examples/local-client-tools.ts](/Users/vedmalex/work/ai-connect/examples/local-client-tools.ts)
|
|
1295
1325
|
- [examples/local-test-server.ts](/Users/vedmalex/work/ai-connect/examples/local-test-server.ts)
|
|
1326
|
+
- [examples/model-context.ts](/Users/vedmalex/work/ai-connect/examples/model-context.ts)
|
|
1327
|
+
- [examples/model-selector.ts](/Users/vedmalex/work/ai-connect/examples/model-selector.ts)
|
|
1328
|
+
- [examples/pdf-document-input.ts](/Users/vedmalex/work/ai-connect/examples/pdf-document-input.ts)
|
|
1329
|
+
- [examples/public-routes.ts](/Users/vedmalex/work/ai-connect/examples/public-routes.ts)
|
|
1296
1330
|
- [examples/rotation-fallback.ts](/Users/vedmalex/work/ai-connect/examples/rotation-fallback.ts)
|
|
1297
|
-
- [examples/
|
|
1298
|
-
- [examples/
|
|
1299
|
-
- [examples/image-workflow.ts](/Users/vedmalex/work/ai-connect/examples/image-workflow.ts)
|
|
1331
|
+
- [examples/streaming-deltas.ts](/Users/vedmalex/work/ai-connect/examples/streaming-deltas.ts)
|
|
1332
|
+
- [examples/usage-accounting.ts](/Users/vedmalex/work/ai-connect/examples/usage-accounting.ts)
|
|
1300
1333
|
- [examples/wide-event-logging.ts](/Users/vedmalex/work/ai-connect/examples/wide-event-logging.ts)
|
|
1301
1334
|
|
|
1302
1335
|
Example execution notes:
|