@hachej/boring-agent 0.4.28 → 0.4.29
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 +4 -0
- package/dist/actions.d.ts +2 -0
- package/dist/actions.js +6 -2
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -551,3 +551,7 @@ Reply placeholders such as `{note.title}` accept actual strings, finite numbers
|
|
|
551
551
|
Hosts must explicitly configure existing conversations when adopting this virtual model; deployment alone does not change their persisted selection. Keep the action's tool and result contract compatible while native work is pending. Changing definitions during an outstanding action is not a version-pinning guarantee.
|
|
552
552
|
|
|
553
553
|
Evidence: `node --test test/packages/agent-actions.test.mjs` runs the public package through a native Harness, SQLite reopen, native tool gates and scripted models. `npm run test:definitions-consumer -- --actions` repeats these tests and checks strict installed declarations. Real-model speed and decision accuracy remain consumer evals, not claims of these scripted tests.
|
|
554
|
+
|
|
555
|
+
### Deferred action context
|
|
556
|
+
|
|
557
|
+
`withActionModels(models, { resolve, prepareFullContext })` optionally prepares context only before a full-model fallback. The asynchronous callback receives the native model context and request options, including cancellation. Successful extraction and automatic replies never invoke it. A preparation failure fails the generation without sending unprepared context. Hosts must install required guards before routing and preserve their native request/task ownership when deferring memory; this callback does not create background work or persist anything.
|
package/dist/actions.d.ts
CHANGED
|
@@ -26,6 +26,8 @@ export interface StructuredAction {
|
|
|
26
26
|
export interface ActionModelsOptions {
|
|
27
27
|
/** Resolve trusted configuration; this never registers tools or grants permissions. */
|
|
28
28
|
readonly resolve: (id: string) => StructuredAction | undefined;
|
|
29
|
+
/** Prepare memory only when a real full-model request is needed; errors fail closed. */
|
|
30
|
+
readonly prepareFullContext?: (context: Parameters<Models['streamSimple']>[1], options: Parameters<Models['streamSimple']>[2]) => Promise<Parameters<Models['streamSimple']>[1]>;
|
|
29
31
|
readonly now?: () => number;
|
|
30
32
|
}
|
|
31
33
|
/** Substitute actual scalar results only. Missing values cannot become invented confirmations. */
|
package/dist/actions.js
CHANGED
|
@@ -72,8 +72,12 @@ export function withActionModels(models, options) {
|
|
|
72
72
|
const action = resolve(model.id);
|
|
73
73
|
const original = required(action.model);
|
|
74
74
|
const out = createAssistantMessageEventStream();
|
|
75
|
-
const full = async () => {
|
|
76
|
-
|
|
75
|
+
const full = async () => {
|
|
76
|
+
const prepared = options.prepareFullContext ? await options.prepareFullContext(context, requestOptions) : context;
|
|
77
|
+
requestOptions?.signal?.throwIfAborted();
|
|
78
|
+
for await (const event of models.streamSimple(original, prepared, requestOptions))
|
|
79
|
+
out.push(event);
|
|
80
|
+
};
|
|
77
81
|
const emit = (message) => {
|
|
78
82
|
if (message.stopReason === 'error' || message.stopReason === 'aborted')
|
|
79
83
|
out.push({ type: 'error', reason: message.stopReason, error: message });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hachej/boring-agent",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.29",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"private": false,
|
|
6
6
|
"type": "module",
|
|
@@ -180,8 +180,8 @@
|
|
|
180
180
|
"@earendil-works/pi-durable": "~1.4.0",
|
|
181
181
|
"@earendil-works/pi-ai": "~1.4.0",
|
|
182
182
|
"@earendil-works/chord": "~1.4.0",
|
|
183
|
-
"@hachej/boring-files": "^0.4.
|
|
184
|
-
"@hachej/boring-ui-kit": "^0.4.
|
|
183
|
+
"@hachej/boring-files": "^0.4.29",
|
|
184
|
+
"@hachej/boring-ui-kit": "^0.4.29",
|
|
185
185
|
"typebox": "1.3.27",
|
|
186
186
|
"xlsx": "^0.20.3"
|
|
187
187
|
},
|