hoomanjs 1.37.0 → 1.37.1
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/dist/acp/acp-agent.js +128 -2
- package/dist/acp/acp-agent.js.map +1 -1
- package/dist/acp/commands.js +5 -0
- package/dist/acp/commands.js.map +1 -1
- package/dist/acp/session-config.d.ts +2 -0
- package/dist/acp/session-config.js +27 -0
- package/dist/acp/session-config.js.map +1 -1
- package/dist/chat/app.js +71 -58
- package/dist/chat/app.js.map +1 -1
- package/dist/chat/components/BottomChrome.d.ts +2 -1
- package/dist/chat/components/BottomChrome.js +2 -2
- package/dist/chat/components/BottomChrome.js.map +1 -1
- package/dist/chat/components/ChromePicker.d.ts +3 -2
- package/dist/chat/components/ChromePicker.js +15 -1
- package/dist/chat/components/ChromePicker.js.map +1 -1
- package/dist/core/agent/index.js +3 -2
- package/dist/core/agent/index.js.map +1 -1
- package/dist/core/models/reasoning-effort.d.ts +55 -0
- package/dist/core/models/reasoning-effort.js +91 -0
- package/dist/core/models/reasoning-effort.js.map +1 -0
- package/dist/core/prompts/harness/execution.md +1 -0
- package/dist/core/sessions/tolerant-file-storage.d.ts +24 -0
- package/dist/core/sessions/tolerant-file-storage.js +81 -0
- package/dist/core/sessions/tolerant-file-storage.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { basename, extname, join } from "node:path";
|
|
2
|
+
import { readdir } from "node:fs/promises";
|
|
3
|
+
import { FileStorage, } from "@strands-agents/sdk/vended-plugins/context-offloader";
|
|
4
|
+
/** Sidecar file the vended {@link FileStorage} writes; never a real reference. */
|
|
5
|
+
const METADATA_FILE = ".metadata.json";
|
|
6
|
+
/**
|
|
7
|
+
* Host-filesystem offload storage that tolerates slightly-mangled references.
|
|
8
|
+
*
|
|
9
|
+
* The vended `FileStorage.retrieve` resolves the reference to an exact file
|
|
10
|
+
* path, so a model that copies the reference imperfectly — most commonly by
|
|
11
|
+
* dropping the content-type extension (`…_0.json` -> `…_0`) or the directory
|
|
12
|
+
* prefix — gets an unhelpful "reference not found" even though the artifact is
|
|
13
|
+
* on disk. This wrapper first tries the exact lookup, then falls back to a
|
|
14
|
+
* basename / extension-insensitive match within the artifact directory.
|
|
15
|
+
*
|
|
16
|
+
* It implements {@link Storage} directly (rather than extending `FileStorage`)
|
|
17
|
+
* so the `ContextOffloader` treats it as an opaque backend and uses it as-is
|
|
18
|
+
* (no per-agent sandbox rebinding), keeping retrieval on the host-fs path.
|
|
19
|
+
*/
|
|
20
|
+
export class TolerantFileStorage {
|
|
21
|
+
#artifactDir;
|
|
22
|
+
#inner;
|
|
23
|
+
constructor(artifactDir) {
|
|
24
|
+
this.#artifactDir = artifactDir;
|
|
25
|
+
this.#inner = new FileStorage(artifactDir);
|
|
26
|
+
}
|
|
27
|
+
store(key, content, contentType) {
|
|
28
|
+
return this.#inner.store(key, content, contentType);
|
|
29
|
+
}
|
|
30
|
+
async retrieve(reference) {
|
|
31
|
+
try {
|
|
32
|
+
return await this.#inner.retrieve(reference);
|
|
33
|
+
}
|
|
34
|
+
catch (error) {
|
|
35
|
+
const resolved = await this.#resolveReference(reference);
|
|
36
|
+
if (resolved && resolved !== reference) {
|
|
37
|
+
return this.#inner.retrieve(resolved);
|
|
38
|
+
}
|
|
39
|
+
throw error;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Best-effort match of a mangled reference to an on-disk artifact filename.
|
|
44
|
+
* Returns the resolved filename (relative to the artifact dir) or `null`.
|
|
45
|
+
*/
|
|
46
|
+
async #resolveReference(reference) {
|
|
47
|
+
let entries;
|
|
48
|
+
try {
|
|
49
|
+
entries = await readdir(this.#artifactDir);
|
|
50
|
+
}
|
|
51
|
+
catch {
|
|
52
|
+
return null;
|
|
53
|
+
}
|
|
54
|
+
const candidates = entries.filter((entry) => entry !== METADATA_FILE);
|
|
55
|
+
const wanted = basename(reference.trim());
|
|
56
|
+
if (!wanted) {
|
|
57
|
+
return null;
|
|
58
|
+
}
|
|
59
|
+
// Exact filename (reference had the right name but a wrong/absent dir).
|
|
60
|
+
if (candidates.includes(wanted)) {
|
|
61
|
+
return join(this.#artifactDir, wanted);
|
|
62
|
+
}
|
|
63
|
+
// Extension dropped: match on the filename stem (e.g. `…_0` -> `…_0.json`).
|
|
64
|
+
const stemMatches = candidates.filter((entry) => stripExt(entry) === wanted);
|
|
65
|
+
if (stemMatches.length === 1) {
|
|
66
|
+
return join(this.#artifactDir, stemMatches[0]);
|
|
67
|
+
}
|
|
68
|
+
// Reference itself carried an extension the model altered; match by stem.
|
|
69
|
+
const wantedStem = stripExt(wanted);
|
|
70
|
+
const bothStemMatches = candidates.filter((entry) => stripExt(entry) === wantedStem);
|
|
71
|
+
if (bothStemMatches.length === 1) {
|
|
72
|
+
return join(this.#artifactDir, bothStemMatches[0]);
|
|
73
|
+
}
|
|
74
|
+
return null;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
function stripExt(filename) {
|
|
78
|
+
const ext = extname(filename);
|
|
79
|
+
return ext ? filename.slice(0, -ext.length) : filename;
|
|
80
|
+
}
|
|
81
|
+
//# sourceMappingURL=tolerant-file-storage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tolerant-file-storage.js","sourceRoot":"","sources":["../../../src/core/sessions/tolerant-file-storage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACpD,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EACL,WAAW,GAEZ,MAAM,sDAAsD,CAAC;AAE9D,kFAAkF;AAClF,MAAM,aAAa,GAAG,gBAAgB,CAAC;AAEvC;;;;;;;;;;;;;GAaG;AACH,MAAM,OAAO,mBAAmB;IACrB,YAAY,CAAS;IACrB,MAAM,CAAc;IAE7B,YAAY,WAAmB;QAC7B,IAAI,CAAC,Y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