@xandout/libra-harness 0.1.119 → 0.1.121
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/agent.d.ts.map +1 -1
- package/dist/agent.js +4 -2
- package/dist/agent.js.map +1 -1
- package/dist/extensions/code-tools/extension.d.ts +4 -0
- package/dist/extensions/code-tools/extension.d.ts.map +1 -1
- package/dist/extensions/code-tools/extension.js +3 -13
- package/dist/extensions/code-tools/extension.js.map +1 -1
- package/dist/extensions/code-tools/tools/shell.d.ts +7 -0
- package/dist/extensions/code-tools/tools/shell.d.ts.map +1 -1
- package/dist/extensions/code-tools/tools/shell.js +9 -2
- package/dist/extensions/code-tools/tools/shell.js.map +1 -1
- package/dist/extensions/loader.d.ts +10 -10
- package/dist/extensions/loader.js +10 -10
- package/dist/types.d.ts +6 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +13 -0
- package/dist/types.js.map +1 -1
- package/package.json +2 -65
- package/dist/extensions/auto-steer/extension.d.ts +0 -46
- package/dist/extensions/auto-steer/extension.d.ts.map +0 -1
- package/dist/extensions/auto-steer/extension.js +0 -52
- package/dist/extensions/auto-steer/extension.js.map +0 -1
- package/dist/extensions/auto-steer/extension.json +0 -7
- package/dist/extensions/auto-steer/index.d.ts +0 -3
- package/dist/extensions/auto-steer/index.d.ts.map +0 -1
- package/dist/extensions/auto-steer/index.js +0 -2
- package/dist/extensions/auto-steer/index.js.map +0 -1
- package/dist/extensions/emoji/extension.d.ts +0 -20
- package/dist/extensions/emoji/extension.d.ts.map +0 -1
- package/dist/extensions/emoji/extension.js +0 -22
- package/dist/extensions/emoji/extension.js.map +0 -1
- package/dist/extensions/emoji/extension.json +0 -7
- package/dist/extensions/emoji/index.d.ts +0 -3
- package/dist/extensions/emoji/index.d.ts.map +0 -1
- package/dist/extensions/emoji/index.js +0 -2
- package/dist/extensions/emoji/index.js.map +0 -1
- package/dist/extensions/filesystem/extension.d.ts +0 -53
- package/dist/extensions/filesystem/extension.d.ts.map +0 -1
- package/dist/extensions/filesystem/extension.js +0 -350
- package/dist/extensions/filesystem/extension.js.map +0 -1
- package/dist/extensions/filesystem/extension.json +0 -6
- package/dist/extensions/filesystem/extension.test.d.ts +0 -2
- package/dist/extensions/filesystem/extension.test.d.ts.map +0 -1
- package/dist/extensions/filesystem/extension.test.js +0 -387
- package/dist/extensions/filesystem/extension.test.js.map +0 -1
- package/dist/extensions/filesystem/index.d.ts +0 -2
- package/dist/extensions/filesystem/index.d.ts.map +0 -1
- package/dist/extensions/filesystem/index.js +0 -2
- package/dist/extensions/filesystem/index.js.map +0 -1
- package/dist/extensions/keyword-extractor/extension.d.ts +0 -53
- package/dist/extensions/keyword-extractor/extension.d.ts.map +0 -1
- package/dist/extensions/keyword-extractor/extension.js +0 -61
- package/dist/extensions/keyword-extractor/extension.js.map +0 -1
- package/dist/extensions/keyword-extractor/extension.json +0 -6
- package/dist/extensions/keyword-extractor/extension.test.d.ts +0 -2
- package/dist/extensions/keyword-extractor/extension.test.d.ts.map +0 -1
- package/dist/extensions/keyword-extractor/extension.test.js +0 -105
- package/dist/extensions/keyword-extractor/extension.test.js.map +0 -1
- package/dist/extensions/keyword-extractor/index.d.ts +0 -5
- package/dist/extensions/keyword-extractor/index.d.ts.map +0 -1
- package/dist/extensions/keyword-extractor/index.js +0 -3
- package/dist/extensions/keyword-extractor/index.js.map +0 -1
- package/dist/extensions/keyword-extractor/nlp.d.ts +0 -68
- package/dist/extensions/keyword-extractor/nlp.d.ts.map +0 -1
- package/dist/extensions/keyword-extractor/nlp.js +0 -156
- package/dist/extensions/keyword-extractor/nlp.js.map +0 -1
- package/dist/extensions/keyword-extractor/nlp.test.d.ts +0 -2
- package/dist/extensions/keyword-extractor/nlp.test.d.ts.map +0 -1
- package/dist/extensions/keyword-extractor/nlp.test.js +0 -176
- package/dist/extensions/keyword-extractor/nlp.test.js.map +0 -1
- package/dist/extensions/logger/extension.d.ts +0 -52
- package/dist/extensions/logger/extension.d.ts.map +0 -1
- package/dist/extensions/logger/extension.js +0 -68
- package/dist/extensions/logger/extension.js.map +0 -1
- package/dist/extensions/logger/extension.json +0 -7
- package/dist/extensions/logger/index.d.ts +0 -3
- package/dist/extensions/logger/index.d.ts.map +0 -1
- package/dist/extensions/logger/index.js +0 -2
- package/dist/extensions/logger/index.js.map +0 -1
- package/dist/extensions/mcp/extension.d.ts +0 -63
- package/dist/extensions/mcp/extension.d.ts.map +0 -1
- package/dist/extensions/mcp/extension.js +0 -437
- package/dist/extensions/mcp/extension.js.map +0 -1
- package/dist/extensions/mcp/extension.json +0 -7
- package/dist/extensions/mcp/extension.test.d.ts +0 -2
- package/dist/extensions/mcp/extension.test.d.ts.map +0 -1
- package/dist/extensions/mcp/extension.test.js +0 -286
- package/dist/extensions/mcp/extension.test.js.map +0 -1
- package/dist/extensions/mcp/index.d.ts +0 -3
- package/dist/extensions/mcp/index.d.ts.map +0 -1
- package/dist/extensions/mcp/index.js +0 -2
- package/dist/extensions/mcp/index.js.map +0 -1
- package/dist/extensions/mem-session/extension.d.ts +0 -24
- package/dist/extensions/mem-session/extension.d.ts.map +0 -1
- package/dist/extensions/mem-session/extension.js +0 -49
- package/dist/extensions/mem-session/extension.js.map +0 -1
- package/dist/extensions/mem-session/extension.json +0 -6
- package/dist/extensions/mem-session/index.d.ts +0 -2
- package/dist/extensions/mem-session/index.d.ts.map +0 -1
- package/dist/extensions/mem-session/index.js +0 -2
- package/dist/extensions/mem-session/index.js.map +0 -1
- package/dist/extensions/memory/extension.d.ts +0 -54
- package/dist/extensions/memory/extension.d.ts.map +0 -1
- package/dist/extensions/memory/extension.js +0 -143
- package/dist/extensions/memory/extension.js.map +0 -1
- package/dist/extensions/memory/extension.json +0 -7
- package/dist/extensions/memory/index.d.ts +0 -4
- package/dist/extensions/memory/index.d.ts.map +0 -1
- package/dist/extensions/memory/index.js +0 -3
- package/dist/extensions/memory/index.js.map +0 -1
- package/dist/extensions/memory/llm-extractor.d.ts +0 -42
- package/dist/extensions/memory/llm-extractor.d.ts.map +0 -1
- package/dist/extensions/memory/llm-extractor.js +0 -86
- package/dist/extensions/memory/llm-extractor.js.map +0 -1
- package/dist/extensions/memory/types.d.ts +0 -142
- package/dist/extensions/memory/types.d.ts.map +0 -1
- package/dist/extensions/memory/types.js +0 -2
- package/dist/extensions/memory/types.js.map +0 -1
- package/dist/extensions/otel/extension.d.ts +0 -57
- package/dist/extensions/otel/extension.d.ts.map +0 -1
- package/dist/extensions/otel/extension.js +0 -253
- package/dist/extensions/otel/extension.js.map +0 -1
- package/dist/extensions/otel/extension.json +0 -7
- package/dist/extensions/otel/extension.test.d.ts +0 -2
- package/dist/extensions/otel/extension.test.d.ts.map +0 -1
- package/dist/extensions/otel/extension.test.js +0 -399
- package/dist/extensions/otel/extension.test.js.map +0 -1
- package/dist/extensions/otel/index.d.ts +0 -4
- package/dist/extensions/otel/index.d.ts.map +0 -1
- package/dist/extensions/otel/index.js +0 -3
- package/dist/extensions/otel/index.js.map +0 -1
- package/dist/extensions/otel/jsonl-span-exporter.d.ts +0 -60
- package/dist/extensions/otel/jsonl-span-exporter.d.ts.map +0 -1
- package/dist/extensions/otel/jsonl-span-exporter.js +0 -134
- package/dist/extensions/otel/jsonl-span-exporter.js.map +0 -1
- package/dist/extensions/scripts/extension.d.ts +0 -180
- package/dist/extensions/scripts/extension.d.ts.map +0 -1
- package/dist/extensions/scripts/extension.js +0 -618
- package/dist/extensions/scripts/extension.js.map +0 -1
- package/dist/extensions/scripts/extension.json +0 -7
- package/dist/extensions/scripts/extension.test.d.ts +0 -2
- package/dist/extensions/scripts/extension.test.d.ts.map +0 -1
- package/dist/extensions/scripts/extension.test.js +0 -552
- package/dist/extensions/scripts/extension.test.js.map +0 -1
- package/dist/extensions/scripts/index.d.ts +0 -3
- package/dist/extensions/scripts/index.d.ts.map +0 -1
- package/dist/extensions/scripts/index.js +0 -2
- package/dist/extensions/scripts/index.js.map +0 -1
- package/dist/extensions/structured-output/extension.d.ts +0 -9
- package/dist/extensions/structured-output/extension.d.ts.map +0 -1
- package/dist/extensions/structured-output/extension.js +0 -93
- package/dist/extensions/structured-output/extension.js.map +0 -1
- package/dist/extensions/structured-output/extension.json +0 -7
- package/dist/extensions/structured-output/index.d.ts +0 -3
- package/dist/extensions/structured-output/index.d.ts.map +0 -1
- package/dist/extensions/structured-output/index.js +0 -2
- package/dist/extensions/structured-output/index.js.map +0 -1
- package/dist/extensions/timestamp/extension.d.ts +0 -11
- package/dist/extensions/timestamp/extension.d.ts.map +0 -1
- package/dist/extensions/timestamp/extension.js +0 -21
- package/dist/extensions/timestamp/extension.js.map +0 -1
- package/dist/extensions/timestamp/extension.json +0 -6
- package/dist/extensions/timestamp/index.d.ts +0 -2
- package/dist/extensions/timestamp/index.d.ts.map +0 -1
- package/dist/extensions/timestamp/index.js +0 -2
- package/dist/extensions/timestamp/index.js.map +0 -1
- package/dist/extensions/token-stats/extension.d.ts +0 -50
- package/dist/extensions/token-stats/extension.d.ts.map +0 -1
- package/dist/extensions/token-stats/extension.js +0 -99
- package/dist/extensions/token-stats/extension.js.map +0 -1
- package/dist/extensions/token-stats/extension.json +0 -7
- package/dist/extensions/token-stats/extension.test.d.ts +0 -2
- package/dist/extensions/token-stats/extension.test.d.ts.map +0 -1
- package/dist/extensions/token-stats/extension.test.js +0 -197
- package/dist/extensions/token-stats/extension.test.js.map +0 -1
- package/dist/extensions/token-stats/index.d.ts +0 -3
- package/dist/extensions/token-stats/index.d.ts.map +0 -1
- package/dist/extensions/token-stats/index.js +0 -2
- package/dist/extensions/token-stats/index.js.map +0 -1
- package/dist/extensions/tool-buffer/extension.d.ts +0 -89
- package/dist/extensions/tool-buffer/extension.d.ts.map +0 -1
- package/dist/extensions/tool-buffer/extension.js +0 -182
- package/dist/extensions/tool-buffer/extension.js.map +0 -1
- package/dist/extensions/tool-buffer/extension.json +0 -7
- package/dist/extensions/tool-buffer/extension.test.d.ts +0 -2
- package/dist/extensions/tool-buffer/extension.test.d.ts.map +0 -1
- package/dist/extensions/tool-buffer/extension.test.js +0 -549
- package/dist/extensions/tool-buffer/extension.test.js.map +0 -1
- package/dist/extensions/tool-buffer/index.d.ts +0 -3
- package/dist/extensions/tool-buffer/index.d.ts.map +0 -1
- package/dist/extensions/tool-buffer/index.js +0 -2
- package/dist/extensions/tool-buffer/index.js.map +0 -1
- package/dist/extensions/weather-tool/extension.d.ts +0 -22
- package/dist/extensions/weather-tool/extension.d.ts.map +0 -1
- package/dist/extensions/weather-tool/extension.js +0 -33
- package/dist/extensions/weather-tool/extension.js.map +0 -1
- package/dist/extensions/weather-tool/extension.json +0 -7
- package/dist/extensions/weather-tool/index.d.ts +0 -3
- package/dist/extensions/weather-tool/index.d.ts.map +0 -1
- package/dist/extensions/weather-tool/index.js +0 -2
- package/dist/extensions/weather-tool/index.js.map +0 -1
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import type { Extension } from '../../extension.js';
|
|
2
|
-
/**
|
|
3
|
-
* Config for the auto-steer extension.
|
|
4
|
-
*/
|
|
5
|
-
export interface AutoSteerConfig {
|
|
6
|
-
/**
|
|
7
|
-
* The max iterations the agent is configured for. The extension steers
|
|
8
|
-
* at `threshold` iterations before this limit. Default: 25 (matching
|
|
9
|
-
* the agent's default).
|
|
10
|
-
*/
|
|
11
|
-
maxIterations?: number;
|
|
12
|
-
/**
|
|
13
|
-
* How many iterations before the limit to steer. Default: 3.
|
|
14
|
-
* With maxIterations=25 and threshold=3, the steer fires at iteration 22.
|
|
15
|
-
*/
|
|
16
|
-
threshold?: number;
|
|
17
|
-
/**
|
|
18
|
-
* The steering message to inject. Default: a prompt to wrap up.
|
|
19
|
-
*/
|
|
20
|
-
steerMessage?: string;
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* Create an auto-steer extension.
|
|
24
|
-
*
|
|
25
|
-
* Watches iteration count and steers the agent to wrap up when it's
|
|
26
|
-
* approaching the max iterations limit. This prevents the agent from
|
|
27
|
-
* hitting the limit with no response — instead of silently running out
|
|
28
|
-
* of turns, the agent gets a nudge like "You're running low on turns,
|
|
29
|
-
* summarize and respond now."
|
|
30
|
-
*
|
|
31
|
-
* Tracks iterations by counting `afterLLM` hook calls per turn. The
|
|
32
|
-
* count resets on each `beforeTurn`.
|
|
33
|
-
*
|
|
34
|
-
* @example
|
|
35
|
-
* ```typescript
|
|
36
|
-
* import { createAutoSteerExtension } from '@xandout/libra-harness/extras/auto-steer';
|
|
37
|
-
*
|
|
38
|
-
* const autoSteer = createAutoSteerExtension({
|
|
39
|
-
* maxIterations: 15,
|
|
40
|
-
* threshold: 3,
|
|
41
|
-
* });
|
|
42
|
-
* agent.use(autoSteer);
|
|
43
|
-
* ```
|
|
44
|
-
*/
|
|
45
|
-
export default function createAutoSteerExtension(config?: AutoSteerConfig): Extension;
|
|
46
|
-
//# sourceMappingURL=extension.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"extension.d.ts","sourceRoot":"","sources":["../../../src/extensions/auto-steer/extension.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAEpD;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B;;;;OAIG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,CAAC,OAAO,UAAU,wBAAwB,CAC9C,MAAM,CAAC,EAAE,eAAe,GACvB,SAAS,CA+BX"}
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Create an auto-steer extension.
|
|
3
|
-
*
|
|
4
|
-
* Watches iteration count and steers the agent to wrap up when it's
|
|
5
|
-
* approaching the max iterations limit. This prevents the agent from
|
|
6
|
-
* hitting the limit with no response — instead of silently running out
|
|
7
|
-
* of turns, the agent gets a nudge like "You're running low on turns,
|
|
8
|
-
* summarize and respond now."
|
|
9
|
-
*
|
|
10
|
-
* Tracks iterations by counting `afterLLM` hook calls per turn. The
|
|
11
|
-
* count resets on each `beforeTurn`.
|
|
12
|
-
*
|
|
13
|
-
* @example
|
|
14
|
-
* ```typescript
|
|
15
|
-
* import { createAutoSteerExtension } from '@xandout/libra-harness/extras/auto-steer';
|
|
16
|
-
*
|
|
17
|
-
* const autoSteer = createAutoSteerExtension({
|
|
18
|
-
* maxIterations: 15,
|
|
19
|
-
* threshold: 3,
|
|
20
|
-
* });
|
|
21
|
-
* agent.use(autoSteer);
|
|
22
|
-
* ```
|
|
23
|
-
*/
|
|
24
|
-
export default function createAutoSteerExtension(config) {
|
|
25
|
-
const maxIter = config?.maxIterations ?? 25;
|
|
26
|
-
const threshold = config?.threshold ?? 3;
|
|
27
|
-
const steerAt = maxIter - threshold;
|
|
28
|
-
const message = config?.steerMessage ??
|
|
29
|
-
"You're running low on turns. Stop calling tools and respond to the user now with what you have so far. Be concise.";
|
|
30
|
-
let iterationCount = 0;
|
|
31
|
-
let steered = false;
|
|
32
|
-
return {
|
|
33
|
-
name: 'auto-steer',
|
|
34
|
-
priority: 90,
|
|
35
|
-
install(agent) {
|
|
36
|
-
// Reset counter at the start of each turn.
|
|
37
|
-
agent.hook('beforeTurn', 'auto-steer', async () => {
|
|
38
|
-
iterationCount = 0;
|
|
39
|
-
steered = false;
|
|
40
|
-
});
|
|
41
|
-
// Count LLM calls and steer when approaching the limit.
|
|
42
|
-
agent.hook('afterLLM', 'auto-steer', async (ctx) => {
|
|
43
|
-
iterationCount++;
|
|
44
|
-
if (!steered && iterationCount >= steerAt) {
|
|
45
|
-
steered = true;
|
|
46
|
-
ctx.turn.steer(message);
|
|
47
|
-
}
|
|
48
|
-
});
|
|
49
|
-
},
|
|
50
|
-
};
|
|
51
|
-
}
|
|
52
|
-
//# sourceMappingURL=extension.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"extension.js","sourceRoot":"","sources":["../../../src/extensions/auto-steer/extension.ts"],"names":[],"mappings":"AAuBA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,CAAC,OAAO,UAAU,wBAAwB,CAC9C,MAAwB;IAExB,MAAM,OAAO,GAAG,MAAM,EAAE,aAAa,IAAI,EAAE,CAAC;IAC5C,MAAM,SAAS,GAAG,MAAM,EAAE,SAAS,IAAI,CAAC,CAAC;IACzC,MAAM,OAAO,GAAG,OAAO,GAAG,SAAS,CAAC;IACpC,MAAM,OAAO,GAAG,MAAM,EAAE,YAAY;QAClC,oHAAoH,CAAC;IAEvH,IAAI,cAAc,GAAG,CAAC,CAAC;IACvB,IAAI,OAAO,GAAG,KAAK,CAAC;IAEpB,OAAO;QACL,IAAI,EAAE,YAAY;QAClB,QAAQ,EAAE,EAAE;QACZ,OAAO,CAAC,KAAK;YACX,2CAA2C;YAC3C,KAAK,CAAC,IAAI,CAAC,YAAY,EAAE,YAAY,EAAE,KAAK,IAAI,EAAE;gBAChD,cAAc,GAAG,CAAC,CAAC;gBACnB,OAAO,GAAG,KAAK,CAAC;YAClB,CAAC,CAAC,CAAC;YAEH,wDAAwD;YACxD,KAAK,CAAC,IAAI,CAAC,UAAU,EAAE,YAAY,EAAE,KAAK,EAAE,GAAG,EAAE,EAAE;gBACjD,cAAc,EAAE,CAAC;gBAEjB,IAAI,CAAC,OAAO,IAAI,cAAc,IAAI,OAAO,EAAE,CAAC;oBAC1C,OAAO,GAAG,IAAI,CAAC;oBACf,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;gBAC1B,CAAC;YACH,CAAC,CAAC,CAAC;QACL,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/extensions/auto-steer/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,wBAAwB,EAAE,MAAM,gBAAgB,CAAC;AACrE,YAAY,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/extensions/auto-steer/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,wBAAwB,EAAE,MAAM,gBAAgB,CAAC"}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import type { Extension } from '../../extension.js';
|
|
2
|
-
/**
|
|
3
|
-
* Config for the emoji extension.
|
|
4
|
-
*
|
|
5
|
-
* Passed by the extension loader from the host's config object.
|
|
6
|
-
* The key `emojiPrefix` should be declared in extension.json's `configKeys`.
|
|
7
|
-
*/
|
|
8
|
-
export interface EmojiExtensionConfig {
|
|
9
|
-
/** Prefix to prepend to each response. Default: "✨ ". */
|
|
10
|
-
emojiPrefix?: string;
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* emoji extension — decorates the final response with a leading emoji.
|
|
14
|
-
*
|
|
15
|
-
* Demonstrates the simplest possible factory extension: a single
|
|
16
|
-
* `beforeResponse` hook that mutates the outgoing message. Accepts an
|
|
17
|
-
* optional `emojiPrefix` via config (default: `"✨ "`).
|
|
18
|
-
*/
|
|
19
|
-
export default function createEmojiExtension(config?: EmojiExtensionConfig): Extension;
|
|
20
|
-
//# sourceMappingURL=extension.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"extension.d.ts","sourceRoot":"","sources":["../../../src/extensions/emoji/extension.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAEpD;;;;;GAKG;AACH,MAAM,WAAW,oBAAoB;IACnC,yDAAyD;IACzD,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;;;;;GAMG;AACH,MAAM,CAAC,OAAO,UAAU,oBAAoB,CAC1C,MAAM,CAAC,EAAE,oBAAoB,GAC5B,SAAS,CAaX"}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* emoji extension — decorates the final response with a leading emoji.
|
|
3
|
-
*
|
|
4
|
-
* Demonstrates the simplest possible factory extension: a single
|
|
5
|
-
* `beforeResponse` hook that mutates the outgoing message. Accepts an
|
|
6
|
-
* optional `emojiPrefix` via config (default: `"✨ "`).
|
|
7
|
-
*/
|
|
8
|
-
export default function createEmojiExtension(config) {
|
|
9
|
-
const prefix = config?.emojiPrefix ?? '\u2728 ';
|
|
10
|
-
return {
|
|
11
|
-
name: 'emoji',
|
|
12
|
-
priority: 0,
|
|
13
|
-
install(agent) {
|
|
14
|
-
agent.hook('beforeResponse', 'emoji', async (ctx) => {
|
|
15
|
-
if (ctx.turn.response?.message) {
|
|
16
|
-
ctx.turn.response.message = `${prefix}${ctx.turn.response.message}`;
|
|
17
|
-
}
|
|
18
|
-
});
|
|
19
|
-
},
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
|
-
//# sourceMappingURL=extension.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"extension.js","sourceRoot":"","sources":["../../../src/extensions/emoji/extension.ts"],"names":[],"mappings":"AAaA;;;;;;GAMG;AACH,MAAM,CAAC,OAAO,UAAU,oBAAoB,CAC1C,MAA6B;IAE7B,MAAM,MAAM,GAAG,MAAM,EAAE,WAAW,IAAI,SAAS,CAAC;IAChD,OAAO;QACL,IAAI,EAAE,OAAO;QACb,QAAQ,EAAE,CAAC;QACX,OAAO,CAAC,KAAK;YACX,KAAK,CAAC,IAAI,CAAC,gBAAgB,EAAE,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,EAAE;gBAClD,IAAI,GAAG,CAAC,IAAI,CAAC,QAAQ,EAAE,OAAO,EAAE,CAAC;oBAC/B,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,GAAG,GAAG,MAAM,GAAG,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC;gBACtE,CAAC;YACH,CAAC,CAAC,CAAC;QACL,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/extensions/emoji/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AACjE,YAAY,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/extensions/emoji/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,oBAAoB,EAAE,MAAM,gBAAgB,CAAC"}
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import type { Extension } from '@xandout/libra-harness';
|
|
2
|
-
/** A named sandboxed directory. */
|
|
3
|
-
export interface SandboxDir {
|
|
4
|
-
/** Display name the agent sees in paths (e.g. "downloads", "workspace"). */
|
|
5
|
-
name: string;
|
|
6
|
-
/** Absolute or relative path to the directory on disk. */
|
|
7
|
-
path: string;
|
|
8
|
-
}
|
|
9
|
-
export interface FilesystemConfig {
|
|
10
|
-
/**
|
|
11
|
-
* Named sandboxed directories. Each is presented to the agent by its
|
|
12
|
-
* display name. Paths from the agent are prefixed with the name
|
|
13
|
-
* (e.g. "downloads/report.txt").
|
|
14
|
-
*/
|
|
15
|
-
directories: SandboxDir[];
|
|
16
|
-
/**
|
|
17
|
-
* Max file size for read operations (bytes). Default: 1MB.
|
|
18
|
-
* Files larger than this return a metadata-only response.
|
|
19
|
-
*/
|
|
20
|
-
maxReadSize?: number;
|
|
21
|
-
/**
|
|
22
|
-
* Tool name prefix. Default: 'fs'.
|
|
23
|
-
*/
|
|
24
|
-
toolPrefix?: string;
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* Create a filesystem extension that exposes controlled read/write
|
|
28
|
-
* access to one or more sandboxed directories. All paths are resolved
|
|
29
|
-
* relative to a sandbox directory — path traversal (../) is blocked.
|
|
30
|
-
*
|
|
31
|
-
* When multiple directories are configured, paths are prefixed with
|
|
32
|
-
* the directory's display name (e.g. "downloads/report.txt"). The
|
|
33
|
-
* agent sees the available directory names in the tool descriptions
|
|
34
|
-
* and in `fs_list` output.
|
|
35
|
-
*
|
|
36
|
-
* Tools provided:
|
|
37
|
-
* - `fs_read` — read a file's content (text or base64 for binary)
|
|
38
|
-
* - `fs_write` — write text content to a file
|
|
39
|
-
* - `fs_list` — list files in a directory (or list sandboxes if no path)
|
|
40
|
-
* - `fs_delete` — delete a file or empty directory
|
|
41
|
-
* - `fs_info` — get file metadata (size, type, modified time)
|
|
42
|
-
*
|
|
43
|
-
* The `fs_save_bytes` internal helper is exposed on the extension
|
|
44
|
-
* object so other extensions can save binary content to the sandbox
|
|
45
|
-
* without going through the LLM.
|
|
46
|
-
*/
|
|
47
|
-
export default function createFilesystemExtension(config: FilesystemConfig): Extension & {
|
|
48
|
-
/** Save raw bytes to a sandbox. Used by other extensions. */
|
|
49
|
-
saveBytes(path: string, data: Buffer, mimetype?: string): string;
|
|
50
|
-
/** Resolve a sandbox-relative path to an absolute path. */
|
|
51
|
-
resolvePath(path: string): string;
|
|
52
|
-
};
|
|
53
|
-
//# sourceMappingURL=extension.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"extension.d.ts","sourceRoot":"","sources":["../../../src/extensions/filesystem/extension.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAExD,mCAAmC;AACnC,MAAM,WAAW,UAAU;IACzB,4EAA4E;IAC5E,IAAI,EAAE,MAAM,CAAC;IACb,0DAA0D;IAC1D,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,gBAAgB;IAC/B;;;;OAIG;IACH,WAAW,EAAE,UAAU,EAAE,CAAC;IAC1B;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAOD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,CAAC,OAAO,UAAU,yBAAyB,CAC/C,MAAM,EAAE,gBAAgB,GACvB,SAAS,GAAG;IACb,6DAA6D;IAC7D,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACjE,2DAA2D;IAC3D,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC;CACnC,CA2WA"}
|
|
@@ -1,350 +0,0 @@
|
|
|
1
|
-
import { existsSync, mkdirSync, readFileSync, writeFileSync, readdirSync, statSync, unlinkSync, rmdirSync } from 'node:fs';
|
|
2
|
-
import { join, resolve, relative, dirname, extname } from 'node:path';
|
|
3
|
-
/**
|
|
4
|
-
* Create a filesystem extension that exposes controlled read/write
|
|
5
|
-
* access to one or more sandboxed directories. All paths are resolved
|
|
6
|
-
* relative to a sandbox directory — path traversal (../) is blocked.
|
|
7
|
-
*
|
|
8
|
-
* When multiple directories are configured, paths are prefixed with
|
|
9
|
-
* the directory's display name (e.g. "downloads/report.txt"). The
|
|
10
|
-
* agent sees the available directory names in the tool descriptions
|
|
11
|
-
* and in `fs_list` output.
|
|
12
|
-
*
|
|
13
|
-
* Tools provided:
|
|
14
|
-
* - `fs_read` — read a file's content (text or base64 for binary)
|
|
15
|
-
* - `fs_write` — write text content to a file
|
|
16
|
-
* - `fs_list` — list files in a directory (or list sandboxes if no path)
|
|
17
|
-
* - `fs_delete` — delete a file or empty directory
|
|
18
|
-
* - `fs_info` — get file metadata (size, type, modified time)
|
|
19
|
-
*
|
|
20
|
-
* The `fs_save_bytes` internal helper is exposed on the extension
|
|
21
|
-
* object so other extensions can save binary content to the sandbox
|
|
22
|
-
* without going through the LLM.
|
|
23
|
-
*/
|
|
24
|
-
export default function createFilesystemExtension(config) {
|
|
25
|
-
const maxReadSize = config?.maxReadSize ?? 1_048_576; // 1MB
|
|
26
|
-
const prefix = config?.toolPrefix ?? 'fs';
|
|
27
|
-
// ── Resolve sandbox directories ────────────────────────────────
|
|
28
|
-
const dirs = config.directories.map((d) => {
|
|
29
|
-
const absPath = resolve(d.path);
|
|
30
|
-
if (!existsSync(absPath)) {
|
|
31
|
-
mkdirSync(absPath, { recursive: true });
|
|
32
|
-
}
|
|
33
|
-
return { name: d.name, absPath };
|
|
34
|
-
});
|
|
35
|
-
const dirMap = new Map(dirs.map((d) => [d.name, d]));
|
|
36
|
-
/**
|
|
37
|
-
* Parse a user-provided path into a directory name and a
|
|
38
|
-
* within-directory relative path.
|
|
39
|
-
*
|
|
40
|
-
* "downloads/report.txt" → { dir: "downloads", relPath: "report.txt" }
|
|
41
|
-
*
|
|
42
|
-
* Throws if the path doesn't start with a known directory name.
|
|
43
|
-
*/
|
|
44
|
-
function parsePath(userPath) {
|
|
45
|
-
// Exact match on a directory name (e.g. "documents").
|
|
46
|
-
const exact = dirMap.get(userPath);
|
|
47
|
-
if (exact) {
|
|
48
|
-
return { dir: exact, relPath: '.' };
|
|
49
|
-
}
|
|
50
|
-
const sep = userPath.indexOf('/');
|
|
51
|
-
if (sep !== -1) {
|
|
52
|
-
const dirName = userPath.slice(0, sep);
|
|
53
|
-
const rest = userPath.slice(sep + 1);
|
|
54
|
-
const dir = dirMap.get(dirName);
|
|
55
|
-
if (dir) {
|
|
56
|
-
return { dir, relPath: rest };
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
const valid = dirs.map((d) => `"${d.name}"`).join(', ');
|
|
60
|
-
throw new Error(`Path "${userPath}" must start with a sandbox name (${valid})`);
|
|
61
|
-
}
|
|
62
|
-
/**
|
|
63
|
-
* Resolve a user-provided path to an absolute path within a sandbox.
|
|
64
|
-
* Throws if the path escapes the sandbox (path traversal).
|
|
65
|
-
*/
|
|
66
|
-
function resolvePath(userPath) {
|
|
67
|
-
const { dir, relPath } = parsePath(userPath);
|
|
68
|
-
const absolute = resolve(dir.absPath, relPath);
|
|
69
|
-
const rel = relative(dir.absPath, absolute);
|
|
70
|
-
// If the relative path starts with '..' or is absolute, it escapes
|
|
71
|
-
// the sandbox.
|
|
72
|
-
if (rel.startsWith('..') || resolve(rel) === rel) {
|
|
73
|
-
throw new Error(`Path "${userPath}" escapes the filesystem sandbox "${dir.name}"`);
|
|
74
|
-
}
|
|
75
|
-
return absolute;
|
|
76
|
-
}
|
|
77
|
-
/**
|
|
78
|
-
* Save raw bytes to a sandbox. Creates parent directories as needed.
|
|
79
|
-
* Returns the full path including the directory name prefix.
|
|
80
|
-
*/
|
|
81
|
-
function saveBytes(userPath, data, mimetype) {
|
|
82
|
-
const { dir, relPath } = parsePath(userPath);
|
|
83
|
-
const abs = resolvePath(userPath);
|
|
84
|
-
const dir_ = dirname(abs);
|
|
85
|
-
if (!existsSync(dir_)) {
|
|
86
|
-
mkdirSync(dir_, { recursive: true });
|
|
87
|
-
}
|
|
88
|
-
writeFileSync(abs, data);
|
|
89
|
-
const fullPath = `${dir.name}/${relPath}`;
|
|
90
|
-
console.log(`[fs] saved ${data.length}b to ${fullPath} (${mimetype ?? 'unknown'})`);
|
|
91
|
-
return fullPath;
|
|
92
|
-
}
|
|
93
|
-
// Determine if a file is text or binary based on extension.
|
|
94
|
-
const textExtensions = new Set([
|
|
95
|
-
'.txt', '.csv', '.json', '.xml', '.yaml', '.yml', '.md', '.markdown',
|
|
96
|
-
'.js', '.ts', '.tsx', '.jsx', '.py', '.java', '.c', '.cpp', '.h',
|
|
97
|
-
'.go', '.rs', '.rb', '.php', '.sql', '.html', '.css', '.scss',
|
|
98
|
-
'.sh', '.bash', '.ini', '.conf', '.log', '.env', '.toml', '.graphql',
|
|
99
|
-
'.svg', '.srt', '.vtt', '.properties',
|
|
100
|
-
]);
|
|
101
|
-
function isTextFile(path) {
|
|
102
|
-
return textExtensions.has(extname(path).toLowerCase());
|
|
103
|
-
}
|
|
104
|
-
// Build the directory list string for tool descriptions.
|
|
105
|
-
const dirListStr = dirs.map((d) => `"${d.name}"`).join(', ');
|
|
106
|
-
return {
|
|
107
|
-
name: 'filesystem',
|
|
108
|
-
priority: 50,
|
|
109
|
-
saveBytes,
|
|
110
|
-
resolvePath,
|
|
111
|
-
install(agent) {
|
|
112
|
-
// ── fs_read ──────────────────────────────────────────────────
|
|
113
|
-
agent.tool({
|
|
114
|
-
name: `${prefix}_read`,
|
|
115
|
-
description: `Read a file from the sandboxed filesystem. ` +
|
|
116
|
-
`Available directories: ${dirListStr}. ` +
|
|
117
|
-
'Paths are prefixed with the directory name (e.g. "downloads/report.txt"). ' +
|
|
118
|
-
'Text files are returned as text. Binary files are returned as base64.',
|
|
119
|
-
parameters: {
|
|
120
|
-
type: 'object',
|
|
121
|
-
properties: {
|
|
122
|
-
path: { type: 'string', description: `Path within a sandbox (e.g. "${dirs[0]?.name}/report.txt")` },
|
|
123
|
-
},
|
|
124
|
-
required: ['path'],
|
|
125
|
-
},
|
|
126
|
-
async execute(args) {
|
|
127
|
-
const userPath = String(args.path ?? '');
|
|
128
|
-
let abs;
|
|
129
|
-
try {
|
|
130
|
-
abs = resolvePath(userPath);
|
|
131
|
-
}
|
|
132
|
-
catch (err) {
|
|
133
|
-
return { toolCallId: '', content: `Error: ${err instanceof Error ? err.message : String(err)}` };
|
|
134
|
-
}
|
|
135
|
-
if (!existsSync(abs)) {
|
|
136
|
-
return { toolCallId: '', content: `File not found: ${userPath}` };
|
|
137
|
-
}
|
|
138
|
-
const stat = statSync(abs);
|
|
139
|
-
if (stat.isDirectory()) {
|
|
140
|
-
return { toolCallId: '', content: `Path is a directory, not a file: ${userPath}. Use ${prefix}_list to list contents.` };
|
|
141
|
-
}
|
|
142
|
-
if (stat.size > maxReadSize) {
|
|
143
|
-
return {
|
|
144
|
-
toolCallId: '',
|
|
145
|
-
content: `File is too large (${stat.size} bytes, max ${maxReadSize}). Path: ${userPath}`,
|
|
146
|
-
};
|
|
147
|
-
}
|
|
148
|
-
const buf = readFileSync(abs);
|
|
149
|
-
if (isTextFile(userPath)) {
|
|
150
|
-
const text = buf.toString('utf-8');
|
|
151
|
-
const truncated = text.length > 50000
|
|
152
|
-
? text.slice(0, 50000) + `\n\n[truncated — ${text.length} chars total, showing first 50000]`
|
|
153
|
-
: text;
|
|
154
|
-
return {
|
|
155
|
-
toolCallId: '',
|
|
156
|
-
content: `File: ${userPath} (${stat.size}b)\n\n${truncated}`,
|
|
157
|
-
};
|
|
158
|
-
}
|
|
159
|
-
// Binary: return base64
|
|
160
|
-
const base64 = buf.toString('base64');
|
|
161
|
-
return {
|
|
162
|
-
toolCallId: '',
|
|
163
|
-
content: `File: ${userPath} (${stat.size}b, binary)\nbase64: ${base64}`,
|
|
164
|
-
};
|
|
165
|
-
},
|
|
166
|
-
});
|
|
167
|
-
// ── fs_write ─────────────────────────────────────────────────
|
|
168
|
-
agent.tool({
|
|
169
|
-
name: `${prefix}_write`,
|
|
170
|
-
description: `Write text content to a file in the sandboxed filesystem. ` +
|
|
171
|
-
`Available directories: ${dirListStr}. ` +
|
|
172
|
-
'Paths are prefixed with the directory name. ' +
|
|
173
|
-
'Creates parent directories as needed. Overwrites if the file exists.',
|
|
174
|
-
parameters: {
|
|
175
|
-
type: 'object',
|
|
176
|
-
properties: {
|
|
177
|
-
path: { type: 'string', description: `Path within a sandbox (e.g. "${dirs[0]?.name}/notes.txt")` },
|
|
178
|
-
content: { type: 'string', description: 'Text content to write' },
|
|
179
|
-
},
|
|
180
|
-
required: ['path', 'content'],
|
|
181
|
-
},
|
|
182
|
-
async execute(args) {
|
|
183
|
-
const userPath = String(args.path ?? '');
|
|
184
|
-
const content = String(args.content ?? '');
|
|
185
|
-
let abs;
|
|
186
|
-
try {
|
|
187
|
-
abs = resolvePath(userPath);
|
|
188
|
-
}
|
|
189
|
-
catch (err) {
|
|
190
|
-
return { toolCallId: '', content: `Error: ${err instanceof Error ? err.message : String(err)}` };
|
|
191
|
-
}
|
|
192
|
-
const dir = dirname(abs);
|
|
193
|
-
if (!existsSync(dir)) {
|
|
194
|
-
mkdirSync(dir, { recursive: true });
|
|
195
|
-
}
|
|
196
|
-
writeFileSync(abs, content, 'utf-8');
|
|
197
|
-
console.log(`[fs] wrote ${content.length} chars to ${userPath}`);
|
|
198
|
-
return {
|
|
199
|
-
toolCallId: '',
|
|
200
|
-
content: `Wrote ${content.length} chars to ${userPath}`,
|
|
201
|
-
};
|
|
202
|
-
},
|
|
203
|
-
});
|
|
204
|
-
// ── fs_list ──────────────────────────────────────────────────
|
|
205
|
-
agent.tool({
|
|
206
|
-
name: `${prefix}_list`,
|
|
207
|
-
description: `List files and directories in the sandboxed filesystem. ` +
|
|
208
|
-
`Available directories: ${dirListStr}. ` +
|
|
209
|
-
'With no path, lists the available sandbox directories. ' +
|
|
210
|
-
'With a path, lists the contents of that directory.',
|
|
211
|
-
parameters: {
|
|
212
|
-
type: 'object',
|
|
213
|
-
properties: {
|
|
214
|
-
path: { type: 'string', description: 'Directory path (e.g. "downloads" or "downloads/subdir"). Default: list all sandboxes.' },
|
|
215
|
-
},
|
|
216
|
-
},
|
|
217
|
-
async execute(args) {
|
|
218
|
-
const userPath = String(args.path ?? '');
|
|
219
|
-
// No path: list the available sandbox directories.
|
|
220
|
-
if (!userPath || userPath === '/' || userPath === '.') {
|
|
221
|
-
const lines = dirs.map((d) => {
|
|
222
|
-
const entries = readdirSync(d.absPath, { withFileTypes: true });
|
|
223
|
-
const count = entries.length;
|
|
224
|
-
return ` [dir] ${d.name}/ (${count} item${count === 1 ? '' : 's'})`;
|
|
225
|
-
});
|
|
226
|
-
return { toolCallId: '', content: `Sandbox directories:\n${lines.join('\n')}` };
|
|
227
|
-
}
|
|
228
|
-
let abs;
|
|
229
|
-
try {
|
|
230
|
-
abs = resolvePath(userPath);
|
|
231
|
-
}
|
|
232
|
-
catch (err) {
|
|
233
|
-
return { toolCallId: '', content: `Error: ${err instanceof Error ? err.message : String(err)}` };
|
|
234
|
-
}
|
|
235
|
-
if (!existsSync(abs)) {
|
|
236
|
-
return { toolCallId: '', content: `Directory not found: ${userPath}` };
|
|
237
|
-
}
|
|
238
|
-
if (!statSync(abs).isDirectory()) {
|
|
239
|
-
return { toolCallId: '', content: `Path is a file, not a directory: ${userPath}` };
|
|
240
|
-
}
|
|
241
|
-
const entries = readdirSync(abs, { withFileTypes: true });
|
|
242
|
-
if (entries.length === 0) {
|
|
243
|
-
return { toolCallId: '', content: `Directory is empty: ${userPath}` };
|
|
244
|
-
}
|
|
245
|
-
const lines = entries.map((e) => {
|
|
246
|
-
if (e.isDirectory()) {
|
|
247
|
-
return ` [dir] ${e.name}/`;
|
|
248
|
-
}
|
|
249
|
-
const size = statSync(join(abs, e.name)).size;
|
|
250
|
-
return ` [file] ${e.name} (${size}b)`;
|
|
251
|
-
});
|
|
252
|
-
return {
|
|
253
|
-
toolCallId: '',
|
|
254
|
-
content: `Contents of ${userPath}:\n${lines.join('\n')}`,
|
|
255
|
-
};
|
|
256
|
-
},
|
|
257
|
-
});
|
|
258
|
-
// ── fs_delete ────────────────────────────────────────────────
|
|
259
|
-
agent.tool({
|
|
260
|
-
name: `${prefix}_delete`,
|
|
261
|
-
description: `Delete a file from the sandboxed filesystem. ` +
|
|
262
|
-
`Available directories: ${dirListStr}. ` +
|
|
263
|
-
'Can also delete an empty directory. Refuses to delete a sandbox root.',
|
|
264
|
-
parameters: {
|
|
265
|
-
type: 'object',
|
|
266
|
-
properties: {
|
|
267
|
-
path: { type: 'string', description: 'Path within a sandbox (e.g. "downloads/old-report.txt")' },
|
|
268
|
-
},
|
|
269
|
-
required: ['path'],
|
|
270
|
-
},
|
|
271
|
-
async execute(args) {
|
|
272
|
-
const userPath = String(args.path ?? '');
|
|
273
|
-
if (!userPath || userPath === '/' || userPath === '.') {
|
|
274
|
-
return { toolCallId: '', content: 'Refusing to delete a sandbox root' };
|
|
275
|
-
}
|
|
276
|
-
// Check if the path is a sandbox root (e.g. "downloads").
|
|
277
|
-
const sep = userPath.indexOf('/');
|
|
278
|
-
const dirName = sep === -1 ? userPath : userPath.slice(0, sep);
|
|
279
|
-
if (dirMap.has(dirName) && (sep === -1 || userPath.slice(sep + 1) === '' || userPath.slice(sep + 1) === '.')) {
|
|
280
|
-
return { toolCallId: '', content: `Refusing to delete sandbox root: ${userPath}` };
|
|
281
|
-
}
|
|
282
|
-
let abs;
|
|
283
|
-
try {
|
|
284
|
-
abs = resolvePath(userPath);
|
|
285
|
-
}
|
|
286
|
-
catch (err) {
|
|
287
|
-
return { toolCallId: '', content: `Error: ${err instanceof Error ? err.message : String(err)}` };
|
|
288
|
-
}
|
|
289
|
-
if (!existsSync(abs)) {
|
|
290
|
-
return { toolCallId: '', content: `File not found: ${userPath}` };
|
|
291
|
-
}
|
|
292
|
-
const stat = statSync(abs);
|
|
293
|
-
if (stat.isDirectory()) {
|
|
294
|
-
// Only delete empty directories.
|
|
295
|
-
const entries = readdirSync(abs);
|
|
296
|
-
if (entries.length > 0) {
|
|
297
|
-
return { toolCallId: '', content: `Directory is not empty: ${userPath} (${entries.length} items). Remove contents first.` };
|
|
298
|
-
}
|
|
299
|
-
rmdirSync(abs);
|
|
300
|
-
}
|
|
301
|
-
else {
|
|
302
|
-
unlinkSync(abs);
|
|
303
|
-
}
|
|
304
|
-
console.log(`[fs] deleted ${userPath}`);
|
|
305
|
-
return { toolCallId: '', content: `Deleted: ${userPath}` };
|
|
306
|
-
},
|
|
307
|
-
});
|
|
308
|
-
// ── fs_info ──────────────────────────────────────────────────
|
|
309
|
-
agent.tool({
|
|
310
|
-
name: `${prefix}_info`,
|
|
311
|
-
description: `Get metadata about a file or directory in the sandbox. ` +
|
|
312
|
-
`Available directories: ${dirListStr}. ` +
|
|
313
|
-
'Returns size, type, and modification time.',
|
|
314
|
-
parameters: {
|
|
315
|
-
type: 'object',
|
|
316
|
-
properties: {
|
|
317
|
-
path: { type: 'string', description: 'Path within a sandbox (e.g. "downloads/report.txt")' },
|
|
318
|
-
},
|
|
319
|
-
required: ['path'],
|
|
320
|
-
},
|
|
321
|
-
async execute(args) {
|
|
322
|
-
const userPath = String(args.path ?? '');
|
|
323
|
-
let abs;
|
|
324
|
-
try {
|
|
325
|
-
abs = resolvePath(userPath);
|
|
326
|
-
}
|
|
327
|
-
catch (err) {
|
|
328
|
-
return { toolCallId: '', content: `Error: ${err instanceof Error ? err.message : String(err)}` };
|
|
329
|
-
}
|
|
330
|
-
if (!existsSync(abs)) {
|
|
331
|
-
return { toolCallId: '', content: `Not found: ${userPath}` };
|
|
332
|
-
}
|
|
333
|
-
const stat = statSync(abs);
|
|
334
|
-
const lines = [
|
|
335
|
-
`Path: ${userPath}`,
|
|
336
|
-
`Type: ${stat.isDirectory() ? 'directory' : 'file'}`,
|
|
337
|
-
`Size: ${stat.size} bytes`,
|
|
338
|
-
`Modified: ${stat.mtime.toISOString()}`,
|
|
339
|
-
];
|
|
340
|
-
if (!stat.isDirectory()) {
|
|
341
|
-
lines.push(`Extension: ${extname(userPath) || 'none'}`);
|
|
342
|
-
lines.push(`Text file: ${isTextFile(userPath)}`);
|
|
343
|
-
}
|
|
344
|
-
return { toolCallId: '', content: lines.join('\n') };
|
|
345
|
-
},
|
|
346
|
-
});
|
|
347
|
-
},
|
|
348
|
-
};
|
|
349
|
-
}
|
|
350
|
-
//# sourceMappingURL=extension.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"extension.js","sourceRoot":"","sources":["../../../src/extensions/filesystem/extension.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,aAAa,EAAE,WAAW,EAAE,QAAQ,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAC3H,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAkCtE;;;;;;;;;;;;;;;;;;;;GAoBG;AAC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