@earendil-works/pi-durable 1.0.2 → 1.0.4
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/CHANGELOG.md +48 -0
- package/README.md +15 -1
- package/dist/env/decode.d.ts +16 -0
- package/dist/env/decode.d.ts.map +1 -0
- package/dist/env/decode.js +28 -0
- package/dist/env/decode.js.map +1 -0
- package/dist/env/index.d.ts +155 -3
- package/dist/env/index.d.ts.map +1 -1
- package/dist/env/index.js +2 -0
- package/dist/env/index.js.map +1 -1
- package/dist/env/line-scan.d.ts +13 -0
- package/dist/env/line-scan.d.ts.map +1 -0
- package/dist/env/line-scan.js +147 -0
- package/dist/env/line-scan.js.map +1 -0
- package/dist/env/node-watch.d.ts +29 -0
- package/dist/env/node-watch.d.ts.map +1 -0
- package/dist/env/node-watch.js +485 -0
- package/dist/env/node-watch.js.map +1 -0
- package/dist/env/node.d.ts +11 -2
- package/dist/env/node.d.ts.map +1 -1
- package/dist/env/node.js +284 -21
- package/dist/env/node.js.map +1 -1
- package/dist/harness/agent.d.ts +2 -1
- package/dist/harness/agent.d.ts.map +1 -1
- package/dist/harness/agent.js +9 -0
- package/dist/harness/agent.js.map +1 -1
- package/dist/harness/generation.d.ts.map +1 -1
- package/dist/harness/generation.js +6 -5
- package/dist/harness/generation.js.map +1 -1
- package/dist/harness/output.d.ts +13 -6
- package/dist/harness/output.d.ts.map +1 -1
- package/dist/harness/output.js +75 -18
- package/dist/harness/output.js.map +1 -1
- package/dist/harness/tool.d.ts.map +1 -1
- package/dist/harness/tool.js +12 -4
- package/dist/harness/tool.js.map +1 -1
- package/dist/harness/types.d.ts +24 -3
- package/dist/harness/types.d.ts.map +1 -1
- package/dist/harness/types.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/testing/env-conformance.d.ts +7 -0
- package/dist/testing/env-conformance.d.ts.map +1 -0
- package/dist/testing/env-conformance.js +431 -0
- package/dist/testing/env-conformance.js.map +1 -0
- package/dist/testing/index.d.ts +3 -2
- package/dist/testing/index.d.ts.map +1 -1
- package/dist/testing/index.js +2 -1
- package/dist/testing/index.js.map +1 -1
- package/dist/testing/runner.d.ts +4 -2
- package/dist/testing/runner.d.ts.map +1 -1
- package/dist/testing/runner.js +9 -0
- package/dist/testing/runner.js.map +1 -1
- package/dist/testing/types.d.ts +18 -0
- package/dist/testing/types.d.ts.map +1 -1
- package/dist/testing/types.js.map +1 -1
- package/dist/tools/bash.d.ts +22 -3
- package/dist/tools/bash.d.ts.map +1 -1
- package/dist/tools/bash.js +86 -36
- package/dist/tools/bash.js.map +1 -1
- package/dist/tools/image.d.ts +10 -0
- package/dist/tools/image.d.ts.map +1 -1
- package/dist/tools/image.js +39 -0
- package/dist/tools/image.js.map +1 -1
- package/dist/tools/index.d.ts +2 -2
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +2 -2
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/read.d.ts.map +1 -1
- package/dist/tools/read.js +150 -75
- package/dist/tools/read.js.map +1 -1
- package/dist/truncate.d.ts +9 -0
- package/dist/truncate.d.ts.map +1 -1
- package/dist/truncate.js +12 -4
- package/dist/truncate.js.map +1 -1
- package/package.json +3 -3
package/dist/testing/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { createExpectAssertions } from "./assertions.js";
|
|
2
|
-
export {
|
|
2
|
+
export { createEnvConformance } from "./env-conformance.js";
|
|
3
|
+
export { registerEnvConformance, registerStorageConformance } from "./runner.js";
|
|
3
4
|
export { STORAGE_MEMORY_SCALES, STORAGE_READ_BENCHMARKS, STORAGE_WRITE_BENCHMARKS, seedStorageBenchmark, seedStorageWriteBenchmark, storageBenchmarkPrimaryRecordCount, TIMING_SCALE, } from "./storage-benchmark.js";
|
|
4
5
|
export { createStorageConformance } from "./storage-conformance.js";
|
|
5
6
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/testing/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAmB,MAAM,iBAAiB,CAAC;AAC1E,OAAO,EAAE,0BAA0B,EAAiC,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/testing/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAmB,MAAM,iBAAiB,CAAC;AAC1E,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EAAE,sBAAsB,EAAE,0BAA0B,EAAiC,MAAM,aAAa,CAAC;AAChH,OAAO,EACN,qBAAqB,EACrB,uBAAuB,EACvB,wBAAwB,EAKxB,oBAAoB,EACpB,yBAAyB,EACzB,kCAAkC,EAClC,YAAY,GACZ,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,wBAAwB,EAAE,MAAM,0BAA0B,CAAC","sourcesContent":["export { createExpectAssertions, type ExpectLike } from \"./assertions.ts\";\nexport { createEnvConformance } from \"./env-conformance.ts\";\nexport { registerEnvConformance, registerStorageConformance, type StorageConformanceRunner } from \"./runner.ts\";\nexport {\n\tSTORAGE_MEMORY_SCALES,\n\tSTORAGE_READ_BENCHMARKS,\n\tSTORAGE_WRITE_BENCHMARKS,\n\ttype StorageBenchmarkDataset,\n\ttype StorageBenchmarkScale,\n\ttype StorageReadBenchmark,\n\ttype StorageWriteBenchmark,\n\tseedStorageBenchmark,\n\tseedStorageWriteBenchmark,\n\tstorageBenchmarkPrimaryRecordCount,\n\tTIMING_SCALE,\n} from \"./storage-benchmark.ts\";\nexport { createStorageConformance } from \"./storage-conformance.ts\";\nexport type {\n\tEnvConformanceAssertions,\n\tEnvConformanceCase,\n\tEnvConformanceOptions,\n\tEnvConformanceProvider,\n\tStorageConformanceAssertions,\n\tStorageConformanceCase,\n\tStorageConformanceOptions,\n\tStorageConformanceProvider,\n} from \"./types.ts\";\n"]}
|
package/dist/testing/runner.d.ts
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { type ExpectLike } from "./assertions.ts";
|
|
2
|
-
import type { StorageConformanceProvider } from "./types.ts";
|
|
2
|
+
import type { EnvConformanceOptions, EnvConformanceProvider, StorageConformanceProvider } from "./types.ts";
|
|
3
3
|
export interface StorageConformanceRunner {
|
|
4
4
|
readonly describe: (name: string, suite: () => void) => unknown;
|
|
5
5
|
readonly expect: ExpectLike;
|
|
6
|
-
readonly it: (name: string, test: () => Promise<void
|
|
6
|
+
readonly it: (name: string, test: () => Promise<void>, timeoutMs?: number) => unknown;
|
|
7
7
|
}
|
|
8
8
|
/** Registers the runner-independent cases with a Vitest/Jest-compatible test runner. */
|
|
9
9
|
export declare function registerStorageConformance(runner: StorageConformanceRunner, name: string, withStorage: StorageConformanceProvider): void;
|
|
10
|
+
/** Registers the runner-independent `ExecutionEnv` cases with a Vitest/Jest-compatible test runner. */
|
|
11
|
+
export declare function registerEnvConformance(runner: StorageConformanceRunner, name: string, withEnv: EnvConformanceProvider, options?: Pick<EnvConformanceOptions, "shell" | "symlinks">): void;
|
|
10
12
|
//# sourceMappingURL=runner.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runner.d.ts","sourceRoot":"","sources":["../../src/testing/runner.ts"],"names":[],"mappings":"AAAA,OAAO,EAA0B,KAAK,UAAU,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"runner.d.ts","sourceRoot":"","sources":["../../src/testing/runner.ts"],"names":[],"mappings":"AAAA,OAAO,EAA0B,KAAK,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAG1E,OAAO,KAAK,EAAE,qBAAqB,EAAE,sBAAsB,EAAE,0BAA0B,EAAE,MAAM,YAAY,CAAC;AAE5G,MAAM,WAAW,wBAAwB;IACxC,QAAQ,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,IAAI,KAAK,OAAO,CAAC;IAChE,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAC;IAC5B,QAAQ,CAAC,EAAE,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,EAAE,SAAS,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC;CACtF;AAED,wFAAwF;AACxF,wBAAgB,0BAA0B,CACzC,MAAM,EAAE,wBAAwB,EAChC,IAAI,EAAE,MAAM,EACZ,WAAW,EAAE,0BAA0B,GACrC,IAAI,CAQN;AAED,uGAAuG;AACvG,wBAAgB,sBAAsB,CACrC,MAAM,EAAE,wBAAwB,EAChC,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,sBAAsB,EAC/B,OAAO,GAAE,IAAI,CAAC,qBAAqB,EAAE,OAAO,GAAG,UAAU,CAAM,GAC7D,IAAI,CAKN"}
|
package/dist/testing/runner.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { createExpectAssertions } from "./assertions.js";
|
|
2
|
+
import { createEnvConformance } from "./env-conformance.js";
|
|
2
3
|
import { createStorageConformance } from "./storage-conformance.js";
|
|
3
4
|
/** Registers the runner-independent cases with a Vitest/Jest-compatible test runner. */
|
|
4
5
|
export function registerStorageConformance(runner, name, withStorage) {
|
|
@@ -11,4 +12,12 @@ export function registerStorageConformance(runner, name, withStorage) {
|
|
|
11
12
|
runner.it(testCase.name, testCase.run);
|
|
12
13
|
});
|
|
13
14
|
}
|
|
15
|
+
/** Registers the runner-independent `ExecutionEnv` cases with a Vitest/Jest-compatible test runner. */
|
|
16
|
+
export function registerEnvConformance(runner, name, withEnv, options = {}) {
|
|
17
|
+
const cases = createEnvConformance({ ...options, assertions: createExpectAssertions(runner.expect), withEnv });
|
|
18
|
+
runner.describe(name, () => {
|
|
19
|
+
for (const testCase of cases)
|
|
20
|
+
runner.it(testCase.name, testCase.run, testCase.timeoutMs);
|
|
21
|
+
});
|
|
22
|
+
}
|
|
14
23
|
//# sourceMappingURL=runner.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runner.js","sourceRoot":"","sources":["../../src/testing/runner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAmB,MAAM,iBAAiB,CAAC;AAC1E,OAAO,EAAE,wBAAwB,EAAE,MAAM,0BAA0B,CAAC;AASpE,wFAAwF;AACxF,MAAM,UAAU,0BAA0B,CACzC,MAAgC,EAChC,IAAY,EACZ,WAAuC;IAEvC,MAAM,KAAK,GAAG,wBAAwB,CAAC;QACtC,UAAU,EAAE,sBAAsB,CAAC,MAAM,CAAC,MAAM,CAAC;QACjD,WAAW;KACX,CAAC,CAAC;IACH,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,GAAG,EAAE;QAC1B,KAAK,MAAM,QAAQ,IAAI,KAAK;YAAE,MAAM,CAAC,EAAE,CAAC,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC,GAAG,CAAC,CAAC;IACtE,CAAC,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import { createExpectAssertions, type ExpectLike } from \"./assertions.ts\";\nimport { createStorageConformance } from \"./storage-conformance.ts\";\nimport type { StorageConformanceProvider } from \"./types.ts\";\n\nexport interface StorageConformanceRunner {\n\treadonly describe: (name: string, suite: () => void) => unknown;\n\treadonly expect: ExpectLike;\n\treadonly it: (name: string, test: () => Promise<void
|
|
1
|
+
{"version":3,"file":"runner.js","sourceRoot":"","sources":["../../src/testing/runner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAmB,MAAM,iBAAiB,CAAC;AAC1E,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EAAE,wBAAwB,EAAE,MAAM,0BAA0B,CAAC;AASpE,wFAAwF;AACxF,MAAM,UAAU,0BAA0B,CACzC,MAAgC,EAChC,IAAY,EACZ,WAAuC;IAEvC,MAAM,KAAK,GAAG,wBAAwB,CAAC;QACtC,UAAU,EAAE,sBAAsB,CAAC,MAAM,CAAC,MAAM,CAAC;QACjD,WAAW;KACX,CAAC,CAAC;IACH,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,GAAG,EAAE;QAC1B,KAAK,MAAM,QAAQ,IAAI,KAAK;YAAE,MAAM,CAAC,EAAE,CAAC,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC,GAAG,CAAC,CAAC;IACtE,CAAC,CAAC,CAAC;AACJ,CAAC;AAED,uGAAuG;AACvG,MAAM,UAAU,sBAAsB,CACrC,MAAgC,EAChC,IAAY,EACZ,OAA+B,EAC/B,OAAO,GAAsD,EAAE;IAE/D,MAAM,KAAK,GAAG,oBAAoB,CAAC,EAAE,GAAG,OAAO,EAAE,UAAU,EAAE,sBAAsB,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC;IAC/G,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,GAAG,EAAE;QAC1B,KAAK,MAAM,QAAQ,IAAI,KAAK;YAAE,MAAM,CAAC,EAAE,CAAC,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC,GAAG,EAAE,QAAQ,CAAC,SAAS,CAAC,CAAC;IAC1F,CAAC,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import { createExpectAssertions, type ExpectLike } from \"./assertions.ts\";\nimport { createEnvConformance } from \"./env-conformance.ts\";\nimport { createStorageConformance } from \"./storage-conformance.ts\";\nimport type { EnvConformanceOptions, EnvConformanceProvider, StorageConformanceProvider } from \"./types.ts\";\n\nexport interface StorageConformanceRunner {\n\treadonly describe: (name: string, suite: () => void) => unknown;\n\treadonly expect: ExpectLike;\n\treadonly it: (name: string, test: () => Promise<void>, timeoutMs?: number) => unknown;\n}\n\n/** Registers the runner-independent cases with a Vitest/Jest-compatible test runner. */\nexport function registerStorageConformance(\n\trunner: StorageConformanceRunner,\n\tname: string,\n\twithStorage: StorageConformanceProvider,\n): void {\n\tconst cases = createStorageConformance({\n\t\tassertions: createExpectAssertions(runner.expect),\n\t\twithStorage,\n\t});\n\trunner.describe(name, () => {\n\t\tfor (const testCase of cases) runner.it(testCase.name, testCase.run);\n\t});\n}\n\n/** Registers the runner-independent `ExecutionEnv` cases with a Vitest/Jest-compatible test runner. */\nexport function registerEnvConformance(\n\trunner: StorageConformanceRunner,\n\tname: string,\n\twithEnv: EnvConformanceProvider,\n\toptions: Pick<EnvConformanceOptions, \"shell\" | \"symlinks\"> = {},\n): void {\n\tconst cases = createEnvConformance({ ...options, assertions: createExpectAssertions(runner.expect), withEnv });\n\trunner.describe(name, () => {\n\t\tfor (const testCase of cases) runner.it(testCase.name, testCase.run, testCase.timeoutMs);\n\t});\n}\n"]}
|
package/dist/testing/types.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ExecutionEnv } from "../env/index.ts";
|
|
1
2
|
import type { Storage } from "../types.ts";
|
|
2
3
|
export interface StorageConformanceAssertions {
|
|
3
4
|
ok(value: unknown, message?: string): void;
|
|
@@ -16,4 +17,21 @@ export interface StorageConformanceCase {
|
|
|
16
17
|
readonly name: string;
|
|
17
18
|
run(): Promise<void>;
|
|
18
19
|
}
|
|
20
|
+
export type EnvConformanceAssertions = StorageConformanceAssertions;
|
|
21
|
+
/** Calls `use` once with an environment whose `cwd` is a fresh, empty, writable directory, then cleans up. */
|
|
22
|
+
export type EnvConformanceProvider = (use: (env: ExecutionEnv) => Promise<void>) => Promise<void>;
|
|
23
|
+
export interface EnvConformanceOptions {
|
|
24
|
+
readonly assertions: EnvConformanceAssertions;
|
|
25
|
+
readonly withEnv: EnvConformanceProvider;
|
|
26
|
+
/** Program and flag that run a POSIX shell script from the next argument; default `["sh", "-c"]`. */
|
|
27
|
+
readonly shell?: readonly string[];
|
|
28
|
+
/** Whether the shell's `ln -s` creates symbolic links; default true. */
|
|
29
|
+
readonly symlinks?: boolean;
|
|
30
|
+
}
|
|
31
|
+
export interface EnvConformanceCase {
|
|
32
|
+
readonly name: string;
|
|
33
|
+
/** Cases that wait for an environment's watch latency need longer than a test runner's default timeout. */
|
|
34
|
+
readonly timeoutMs?: number;
|
|
35
|
+
run(): Promise<void>;
|
|
36
|
+
}
|
|
19
37
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/testing/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAE3C,MAAM,WAAW,4BAA4B;IAC5C,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3C,WAAW,CAAC,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,GAAG,IAAI,CAAC;IACtD,SAAS,CAAC,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,GAAG,IAAI,CAAC;IACpD,gBAAgB,CAAC,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,GAAG,IAAI,CAAC;IAC3D,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACpD,OAAO,CAAC,SAAS,EAAE,OAAO,CAAC,OAAO,CAAC,EAAE,eAAe,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC7E;AAED,MAAM,MAAM,0BAA0B,GAAG,CAAC,GAAG,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,OAAO,CAAC,IAAI,CAAC,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;AAErG,MAAM,WAAW,yBAAyB;IACzC,QAAQ,CAAC,UAAU,EAAE,4BAA4B,CAAC;IAClD,QAAQ,CAAC,WAAW,EAAE,0BAA0B,CAAC;CACjD;AAED,MAAM,WAAW,sBAAsB;IACtC,QAAQ,CAAC,I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wB,GAAG,4BAA4B,CAAC;AAEpE,8GAA8G;AAC9G,MAAM,MAAM,sBAAsB,GAAG,CAAC,GAAG,EAAE,CAAC,GAAG,EAAE,YAAY,KAAK,OAAO,CAAC,IAAI,CAAC,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;AAElG,MAAM,WAAW,qBAAqB;IACrC,QAAQ,CAAC,UAAU,EAAE,wBAAwB,CAAC;IAC9C,QAAQ,CAAC,OAAO,EAAE,sBAAsB,CAAC;IACzC,qGAAqG;IACrG,QAAQ,CAAC,KAAK,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACnC,wEAAwE;IACxE,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;CAC5B;AAED,MAAM,WAAW,kBAAkB;IAClC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,2GAA2G;IAC3G,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACrB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/testing/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { Storage } from \"../types.ts\";\n\nexport interface StorageConformanceAssertions {\n\tok(value: unknown, message?: string): void;\n\tstrictEqual(actual: unknown, expected: unknown): void;\n\tdeepEqual(actual: unknown, expected: unknown): void;\n\tpartialDeepEqual(actual: unknown, expected: unknown): void;\n\tgreaterThan(actual: number, expected: number): void;\n\trejects(operation: Promise<unknown>, messageIncludes: string): Promise<void>;\n}\n\nexport type StorageConformanceProvider = (use: (storage: Storage) => Promise<void>) => Promise<void>;\n\nexport interface StorageConformanceOptions {\n\treadonly assertions: StorageConformanceAssertions;\n\treadonly withStorage: StorageConformanceProvider;\n}\n\nexport interface StorageConformanceCase {\n\treadonly name: string;\n\trun(): Promise<void>;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/testing/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { ExecutionEnv } from \"../env/index.ts\";\nimport type { Storage } from \"../types.ts\";\n\nexport interface StorageConformanceAssertions {\n\tok(value: unknown, message?: string): void;\n\tstrictEqual(actual: unknown, expected: unknown): void;\n\tdeepEqual(actual: unknown, expected: unknown): void;\n\tpartialDeepEqual(actual: unknown, expected: unknown): void;\n\tgreaterThan(actual: number, expected: number): void;\n\trejects(operation: Promise<unknown>, messageIncludes: string): Promise<void>;\n}\n\nexport type StorageConformanceProvider = (use: (storage: Storage) => Promise<void>) => Promise<void>;\n\nexport interface StorageConformanceOptions {\n\treadonly assertions: StorageConformanceAssertions;\n\treadonly withStorage: StorageConformanceProvider;\n}\n\nexport interface StorageConformanceCase {\n\treadonly name: string;\n\trun(): Promise<void>;\n}\n\nexport type EnvConformanceAssertions = StorageConformanceAssertions;\n\n/** Calls `use` once with an environment whose `cwd` is a fresh, empty, writable directory, then cleans up. */\nexport type EnvConformanceProvider = (use: (env: ExecutionEnv) => Promise<void>) => Promise<void>;\n\nexport interface EnvConformanceOptions {\n\treadonly assertions: EnvConformanceAssertions;\n\treadonly withEnv: EnvConformanceProvider;\n\t/** Program and flag that run a POSIX shell script from the next argument; default `[\"sh\", \"-c\"]`. */\n\treadonly shell?: readonly string[];\n\t/** Whether the shell's `ln -s` creates symbolic links; default true. */\n\treadonly symlinks?: boolean;\n}\n\nexport interface EnvConformanceCase {\n\treadonly name: string;\n\t/** Cases that wait for an environment's watch latency need longer than a test runner's default timeout. */\n\treadonly timeoutMs?: number;\n\trun(): Promise<void>;\n}\n"]}
|
package/dist/tools/bash.d.ts
CHANGED
|
@@ -5,7 +5,13 @@ declare const bashSchema: Type.TObject<{
|
|
|
5
5
|
command: Type.TString;
|
|
6
6
|
timeout: Type.TOptional<Type.TNumber>;
|
|
7
7
|
}>;
|
|
8
|
+
declare const powershellSchema: Type.TObject<{
|
|
9
|
+
command: Type.TString;
|
|
10
|
+
timeout: Type.TOptional<Type.TNumber>;
|
|
11
|
+
}>;
|
|
8
12
|
export type BashToolInput = Static<typeof bashSchema>;
|
|
13
|
+
export type PowerShellToolInput = Static<typeof powershellSchema>;
|
|
14
|
+
/** A command about to run, which `prepare` may change: the script, its working directory and environment. */
|
|
9
15
|
export interface BashExecution {
|
|
10
16
|
command: string;
|
|
11
17
|
cwd: string;
|
|
@@ -17,12 +23,25 @@ export interface BashToolOptions {
|
|
|
17
23
|
commandPrefix?: string;
|
|
18
24
|
prepare?: BashPrepare;
|
|
19
25
|
}
|
|
26
|
+
export interface PowerShellToolOptions {
|
|
27
|
+
/** Lines run before each command. */
|
|
28
|
+
commandPrefix?: string;
|
|
29
|
+
prepare?: BashPrepare;
|
|
30
|
+
/** PowerShell programs to try in order; default `pwsh`, then `powershell`. A program that cannot start is skipped. */
|
|
31
|
+
programs?: readonly string[];
|
|
32
|
+
}
|
|
20
33
|
/**
|
|
21
34
|
* Runs a command through the environment's shell. Its output streams to `api.output()`, where the Harness keeps the
|
|
22
|
-
* tail within the default limits; the result content is that retained output.
|
|
23
|
-
*
|
|
24
|
-
*
|
|
35
|
+
* tail within the default limits; the result content is that retained output. The retained window goes to the
|
|
36
|
+
* environment, which may omit output outside it and report how much it omitted, so dropped counts stay exact. Output
|
|
37
|
+
* beyond the limits is spilled to a file whose path is reported as a diagnostic. A nonzero exit or timeout throws, which
|
|
38
|
+
* makes an error result that still carries the output and diagnostics.
|
|
25
39
|
*/
|
|
26
40
|
export declare function createBashTool(options?: BashToolOptions): ToolRegistration<typeof bashSchema>;
|
|
41
|
+
/**
|
|
42
|
+
* Runs a PowerShell command, like `bash` but through PowerShell instead of the environment's shell: `pwsh` (PowerShell
|
|
43
|
+
* 7), else Windows PowerShell, started directly with the command as an argument, so no other shell parses it.
|
|
44
|
+
*/
|
|
45
|
+
export declare function createPowerShellTool(options?: PowerShellToolOptions): ToolRegistration<typeof powershellSchema>;
|
|
27
46
|
export {};
|
|
28
47
|
//# sourceMappingURL=bash.d.ts.map
|
package/dist/tools/bash.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bash.d.ts","sourceRoot":"","sources":["../../src/tools/bash.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,KAAK,MAAM,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAE5C,OAAO,KAAK,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAM9E,QAAA,MAAM,UAAU;;;EAGd,CAAC;AAEH,MAAM,MAAM,aAAa,GAAG,MAAM,CAAC,OAAO,UAAU,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"bash.d.ts","sourceRoot":"","sources":["../../src/tools/bash.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,KAAK,MAAM,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAE5C,OAAO,KAAK,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAM9E,QAAA,MAAM,UAAU;;;EAGd,CAAC;AAEH,QAAA,MAAM,gBAAgB;;;EAGpB,CAAC;AAEH,MAAM,MAAM,aAAa,GAAG,MAAM,CAAC,OAAO,UAAU,CAAC,CAAC;AACtD,MAAM,MAAM,mBAAmB,GAAG,MAAM,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAElE,6GAA6G;AAC7G,MAAM,WAAW,aAAa;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC5B,UAAU,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,MAAM,WAAW,GAAG,CAAC,SAAS,EAAE,aAAa,EAAE,GAAG,EAAE,gBAAgB,EAAE,OAAO,EAAE,OAAO,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;AAEtH,MAAM,WAAW,eAAe;IAC/B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,OAAO,CAAC,EAAE,WAAW,CAAC;CACtB;AAED,MAAM,WAAW,qBAAqB;IACrC,qCAAqC;IACrC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,OAAO,CAAC,EAAE,WAAW,CAAC;IACtB,sHAAsH;IACtH,QAAQ,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CAC7B;AA0ED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,OAAO,CAAC,EAAE,eAAe,GAAG,gBAAgB,CAAC,OAAO,UAAU,CAAC,CAa7F;AAMD;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,CAAC,EAAE,qBAAqB,GAAG,gBAAgB,CAAC,OAAO,gBAAgB,CAAC,CAgB/G"}
|
package/dist/tools/bash.js
CHANGED
|
@@ -7,6 +7,10 @@ const bashSchema = Type.Object({
|
|
|
7
7
|
command: Type.String({ description: "Bash command to execute" }),
|
|
8
8
|
timeout: Type.Optional(Type.Number({ description: "Timeout in seconds (optional, no default timeout)" })),
|
|
9
9
|
});
|
|
10
|
+
const powershellSchema = Type.Object({
|
|
11
|
+
command: Type.String({ description: "PowerShell command to execute" }),
|
|
12
|
+
timeout: Type.Optional(Type.Number({ description: "Timeout in seconds (optional, no default timeout)" })),
|
|
13
|
+
});
|
|
10
14
|
function validateTimeout(timeout) {
|
|
11
15
|
if (timeout === undefined)
|
|
12
16
|
return;
|
|
@@ -17,11 +21,63 @@ function validateTimeout(timeout) {
|
|
|
17
21
|
throw new Error(`Invalid timeout: maximum is ${MAX_TIMEOUT_SECONDS} seconds`);
|
|
18
22
|
}
|
|
19
23
|
}
|
|
24
|
+
/** The execution of one call: the command with its prefix, in the environment's working directory, then `prepare`. */
|
|
25
|
+
async function prepareExecution(command, options, api, context) {
|
|
26
|
+
const execution = {
|
|
27
|
+
command: options?.commandPrefix ? `${options.commandPrefix}\n${command}` : command,
|
|
28
|
+
cwd: requireEnv(api).cwd,
|
|
29
|
+
env: {},
|
|
30
|
+
inheritEnv: true,
|
|
31
|
+
};
|
|
32
|
+
await options?.prepare?.(execution, api, context);
|
|
33
|
+
return execution;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Run each command form in turn until one starts, streaming output to `api.output()` within the retained window, and
|
|
37
|
+
* turn the result into the tool's outcome: a spill diagnostic, and a thrown error for a failure or a nonzero exit.
|
|
38
|
+
*/
|
|
39
|
+
async function runCommand(commands, execution, timeout, api, context) {
|
|
40
|
+
const env = requireEnv(api);
|
|
41
|
+
let result;
|
|
42
|
+
for (const command of commands) {
|
|
43
|
+
result = await env.exec(command, {
|
|
44
|
+
cwd: execution.cwd,
|
|
45
|
+
env: execution.env,
|
|
46
|
+
inheritEnv: execution.inheritEnv,
|
|
47
|
+
...(timeout === undefined ? {} : { timeout }),
|
|
48
|
+
onOutput: (text, _context, info) => api.output(text, info.skipped),
|
|
49
|
+
spill: { afterBytes: DEFAULT_MAX_BYTES, afterLines: DEFAULT_MAX_LINES },
|
|
50
|
+
// An environment may then omit output outside the retained tail and report the omission.
|
|
51
|
+
...(api.outputWindow === undefined ? {} : { window: api.outputWindow }),
|
|
52
|
+
}, context);
|
|
53
|
+
// A program that could not start produced no output; the next form may.
|
|
54
|
+
if (result.ok || result.error.code !== "spawn_error")
|
|
55
|
+
break;
|
|
56
|
+
}
|
|
57
|
+
if (result === undefined)
|
|
58
|
+
throw new Error("No command to run");
|
|
59
|
+
const spillPath = result.ok ? result.value.spillPath : result.error.spillPath;
|
|
60
|
+
if (spillPath !== undefined) {
|
|
61
|
+
api.diagnostic({ severity: "info", code: "full_output", message: `Full output: ${spillPath}` });
|
|
62
|
+
}
|
|
63
|
+
if (!result.ok) {
|
|
64
|
+
if (result.error.code === "aborted" && context.abortSignal?.aborted)
|
|
65
|
+
throw result.error;
|
|
66
|
+
if (result.error.code === "timeout")
|
|
67
|
+
throw new Error(`Command timed out after ${timeout} seconds`);
|
|
68
|
+
if (result.error.code === "aborted")
|
|
69
|
+
throw new Error("Command aborted");
|
|
70
|
+
throw result.error;
|
|
71
|
+
}
|
|
72
|
+
if (result.value.exitCode !== 0)
|
|
73
|
+
throw new Error(`Command exited with code ${result.value.exitCode}`);
|
|
74
|
+
}
|
|
20
75
|
/**
|
|
21
76
|
* Runs a command through the environment's shell. Its output streams to `api.output()`, where the Harness keeps the
|
|
22
|
-
* tail within the default limits; the result content is that retained output.
|
|
23
|
-
*
|
|
24
|
-
*
|
|
77
|
+
* tail within the default limits; the result content is that retained output. The retained window goes to the
|
|
78
|
+
* environment, which may omit output outside it and report how much it omitted, so dropped counts stay exact. Output
|
|
79
|
+
* beyond the limits is spilled to a file whose path is reported as a diagnostic. A nonzero exit or timeout throws, which
|
|
80
|
+
* makes an error result that still carries the output and diagnostics.
|
|
25
81
|
*/
|
|
26
82
|
export function createBashTool(options) {
|
|
27
83
|
return defineTool({
|
|
@@ -30,39 +86,33 @@ export function createBashTool(options) {
|
|
|
30
86
|
parameters: bashSchema,
|
|
31
87
|
outputLimits: { retain: "tail" },
|
|
32
88
|
async execute(args, api, context) {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
if (result.error.code === "aborted")
|
|
61
|
-
throw new Error("Command aborted");
|
|
62
|
-
throw result.error;
|
|
63
|
-
}
|
|
64
|
-
if (result.value.exitCode !== 0)
|
|
65
|
-
throw new Error(`Command exited with code ${result.value.exitCode}`);
|
|
89
|
+
validateTimeout(args.timeout);
|
|
90
|
+
const execution = await prepareExecution(args.command, options, api, context);
|
|
91
|
+
await runCommand([execution.command], execution, args.timeout, api, context);
|
|
92
|
+
return {};
|
|
93
|
+
},
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
/** Output in UTF-8 whatever the console's code page, as the coding agent's `powershell` tool does. */
|
|
97
|
+
const UTF8_OUTPUT = "try { [Console]::OutputEncoding=[System.Text.Encoding]::UTF8 } catch {}";
|
|
98
|
+
const POWERSHELL_ARGS = ["-NoProfile", "-NonInteractive", "-ExecutionPolicy", "Bypass", "-Command"];
|
|
99
|
+
/**
|
|
100
|
+
* Runs a PowerShell command, like `bash` but through PowerShell instead of the environment's shell: `pwsh` (PowerShell
|
|
101
|
+
* 7), else Windows PowerShell, started directly with the command as an argument, so no other shell parses it.
|
|
102
|
+
*/
|
|
103
|
+
export function createPowerShellTool(options) {
|
|
104
|
+
const programs = options?.programs ?? ["pwsh", "powershell"];
|
|
105
|
+
return defineTool({
|
|
106
|
+
name: "powershell",
|
|
107
|
+
description: `Execute a PowerShell command in the current working directory. Returns combined stdout and stderr. Output is truncated to last ${DEFAULT_MAX_LINES} lines or ${DEFAULT_MAX_BYTES / 1024}KB (whichever is hit first). If truncated, full output is saved to a temp file. Optionally provide a timeout in seconds.`,
|
|
108
|
+
parameters: powershellSchema,
|
|
109
|
+
outputLimits: { retain: "tail" },
|
|
110
|
+
async execute(args, api, context) {
|
|
111
|
+
validateTimeout(args.timeout);
|
|
112
|
+
const execution = await prepareExecution(args.command, options, api, context);
|
|
113
|
+
const script = `${UTF8_OUTPUT}\n${execution.command}`;
|
|
114
|
+
const commands = programs.map((program) => [program, ...POWERSHELL_ARGS, script]);
|
|
115
|
+
await runCommand(commands, execution, args.timeout, api, context);
|
|
66
116
|
return {};
|
|
67
117
|
},
|
|
68
118
|
});
|
package/dist/tools/bash.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":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AAE,IAAI,EAAE,aAAa,EAAE,OAAO,EAAE,gBAAgB,SAAS,EAAE,EAAE,CAAC,CAAC;YACjG,CAAC;YACD,IAAI,CAAC,MAAM,CAAC,EAAE,EAAE,CAAC;gBAChB,IAAI,MAAM,CAAC,KAAK,CAAC,IAAI,KAAK,SAAS,IAAI,OAAO,CAAC,WAAW,EAAE,OAAO;oBAAE,MAAM,MAAM,CAAC,KAAK,CAAC;gBACxF,IAAI,MAAM,CAAC,KAAK,CAAC,IAAI,KAAK,SAAS;oBAAE,MAAM,IAAI,KAAK,CAAC,2BAA2B,OAAO,UAAU,CAAC,CAAC;gBACnG,IAAI,MAAM,CAAC,KAAK,CAAC,IAAI,KAAK,SAAS;oBAAE,MAAM,IAAI,KAAK,CAAC,iBAAiB,CAAC,CAAC;gBACxE,MAAM,MAAM,CAAC,KAAK,CAAC;YACpB,CAAC;YACD,IAAI,MAAM,CAAC,KAAK,CAAC,QAAQ,KAAK,CAAC;gBAAE,MAAM,IAAI,KAAK,CAAC,4BAA4B,MAAM,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAC;YACtG,OAAO,EAAE,CAAC;QACX,CAAC;KACD,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import type { Context } from \"@earendil-works/chord\";\nimport { type Static, Type } from \"typebox\";\nimport { defineTool } from \"../harness/define.ts\";\nimport type { ToolExecutionApi, ToolRegistration } from \"../harness/types.ts\";\nimport { DEFAULT_MAX_BYTES, DEFAULT_MAX_LINES } from \"../truncate.ts\";\nimport { requireEnv } from \"./env.ts\";\n\nconst MAX_TIMEOUT_SECONDS = 2_147_483_647 / 1000;\n\nconst bashSchema = Type.Object({\n\tcommand: Type.String({ description: \"Bash command to execute\" }),\n\ttimeout: Type.Optional(Type.Number({ description: \"Timeout in seconds (optional, no default timeout)\" })),\n});\n\nexport type BashToolInput = Static<typeof bashSchema>;\n\nexport interface BashExecution {\n\tcommand: string;\n\tcwd: string;\n\tenv: Record<string, string>;\n\tinheritEnv: boolean;\n}\n\nexport type BashPrepare = (execution: BashExecution, api: ToolExecutionApi, context: Context) => void | Promise<void>;\n\nexport interface BashToolOptions {\n\tcommandPrefix?: string;\n\tprepare?: BashPrepare;\n}\n\nfunction validateTimeout(timeout: number | undefined): void {\n\tif (timeout === undefined) return;\n\tif (!Number.isFinite(timeout) || timeout <= 0) {\n\t\tthrow new Error(\"Invalid timeout: must be a finite number of seconds\");\n\t}\n\tif (timeout > MAX_TIMEOUT_SECONDS) {\n\t\tthrow new Error(`Invalid timeout: maximum is ${MAX_TIMEOUT_SECONDS} seconds`);\n\t}\n}\n\n/**\n * Runs a command through the environment's shell. Its output streams to `api.output()`, where the Harness keeps the\n * tail within the default limits; the result content is that retained output. Output beyond the limits is spilled to a\n * file whose path is reported as a diagnostic. A nonzero exit or timeout throws, which makes an error result that still\n * carries the output and diagnostics.\n */\nexport function createBashTool(options?: BashToolOptions): ToolRegistration<typeof bashSchema> {\n\treturn defineTool({\n\t\tname: \"bash\",\n\t\tdescription: `Execute a bash command in the current working directory. Returns combined stdout and stderr. Output is truncated to last ${DEFAULT_MAX_LINES} lines or ${DEFAULT_MAX_BYTES / 1024}KB (whichever is hit first). If truncated, full output is saved to a temp file. Optionally provide a timeout in seconds.`,\n\t\tparameters: bashSchema,\n\t\toutputLimits: { retain: \"tail\" },\n\t\tasync execute(args, api, context) {\n\t\t\tconst { command, timeout } = args;\n\t\t\tvalidateTimeout(timeout);\n\t\t\tconst env = requireEnv(api);\n\t\t\tconst execution: BashExecution = {\n\t\t\t\tcommand: options?.commandPrefix ? `${options.commandPrefix}\\n${command}` : command,\n\t\t\t\tcwd: env.cwd,\n\t\t\t\tenv: {},\n\t\t\t\tinheritEnv: true,\n\t\t\t};\n\t\t\tawait options?.prepare?.(execution, api, context);\n\t\t\tconst result = await env.exec(\n\t\t\t\texecution.command,\n\t\t\t\t{\n\t\t\t\t\tcwd: execution.cwd,\n\t\t\t\t\tenv: execution.env,\n\t\t\t\t\tinheritEnv: execution.inheritEnv,\n\t\t\t\t\t...(timeout === undefined ? {} : { timeout }),\n\t\t\t\t\tonOutput: (text) => api.output(text),\n\t\t\t\t\tspill: { afterBytes: DEFAULT_MAX_BYTES, afterLines: DEFAULT_MAX_LINES },\n\t\t\t\t},\n\t\t\t\tcontext,\n\t\t\t);\n\t\t\tconst spillPath = result.ok ? result.value.spillPath : result.error.spillPath;\n\t\t\tif (spillPath !== undefined) {\n\t\t\t\tapi.diagnostic({ severity: \"info\", code: \"full_output\", message: `Full output: ${spillPath}` });\n\t\t\t}\n\t\t\tif (!result.ok) {\n\t\t\t\tif (result.error.code === \"aborted\" && context.abortSignal?.aborted) throw result.error;\n\t\t\t\tif (result.error.code === \"timeout\") throw new Error(`Command timed out after ${timeout} seconds`);\n\t\t\t\tif (result.error.code === \"aborted\") throw new Error(\"Command aborted\");\n\t\t\t\tthrow result.error;\n\t\t\t}\n\t\t\tif (result.value.exitCode !== 0) throw new Error(`Command exited with code ${result.value.exitCode}`);\n\t\t\treturn {};\n\t\t},\n\t});\n}\n"]}
|
|
1
|
+
{"version":3,"file":"bash.js","sourceRoot":"","sources":["../../src/tools/bash.ts"],"names":[],"mappings":"AACA,OAAO,EAAe,IAAI,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAElD,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACtE,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAEtC,MAAM,mBAAmB,GAAG,aAAa,GAAG,IAAI,CAAC;AAEjD,MAAM,UAAU,GAAG,IAAI,CAAC,MAAM,CAAC;IAC9B,OAAO,EAAE,IAAI,CAAC,MAAM,CAAC,EAAE,WAAW,EAAE,yBAAyB,EAAE,CAAC;IAChE,OAAO,EAAE,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,WAAW,EAAE,mDAAmD,EAAE,CAAC,CAAC;CAC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{ type Static, Type } from \"typebox\";\nimport { defineTool } from \"../harness/define.ts\";\nimport type { ToolExecutionApi, ToolRegistration } from \"../harness/types.ts\";\nimport { DEFAULT_MAX_BYTES, DEFAULT_MAX_LINES } from \"../truncate.ts\";\nimport { requireEnv } from \"./env.ts\";\n\nconst MAX_TIMEOUT_SECONDS = 2_147_483_647 / 1000;\n\nconst bashSchema = Type.Object({\n\tcommand: Type.String({ description: \"Bash command to execute\" }),\n\ttimeout: Type.Optional(Type.Number({ description: \"Timeout in seconds (optional, no default timeout)\" })),\n});\n\nconst powershellSchema = Type.Object({\n\tcommand: Type.String({ description: \"PowerShell command to execute\" }),\n\ttimeout: Type.Optional(Type.Number({ description: \"Timeout in seconds (optional, no default timeout)\" })),\n});\n\nexport type BashToolInput = Static<typeof bashSchema>;\nexport type PowerShellToolInput = Static<typeof powershellSchema>;\n\n/** A command about to run, which `prepare` may change: the script, its working directory and environment. */\nexport interface BashExecution {\n\tcommand: string;\n\tcwd: string;\n\tenv: Record<string, string>;\n\tinheritEnv: boolean;\n}\n\nexport type BashPrepare = (execution: BashExecution, api: ToolExecutionApi, context: Context) => void | Promise<void>;\n\nexport interface BashToolOptions {\n\tcommandPrefix?: string;\n\tprepare?: BashPrepare;\n}\n\nexport interface PowerShellToolOptions {\n\t/** Lines run before each command. */\n\tcommandPrefix?: string;\n\tprepare?: BashPrepare;\n\t/** PowerShell programs to try in order; default `pwsh`, then `powershell`. A program that cannot start is skipped. */\n\tprograms?: readonly string[];\n}\n\nfunction validateTimeout(timeout: number | undefined): void {\n\tif (timeout === undefined) return;\n\tif (!Number.isFinite(timeout) || timeout <= 0) {\n\t\tthrow new Error(\"Invalid timeout: must be a finite number of seconds\");\n\t}\n\tif (timeout > MAX_TIMEOUT_SECONDS) {\n\t\tthrow new Error(`Invalid timeout: maximum is ${MAX_TIMEOUT_SECONDS} seconds`);\n\t}\n}\n\n/** The execution of one call: the command with its prefix, in the environment's working directory, then `prepare`. */\nasync function prepareExecution(\n\tcommand: string,\n\toptions: { commandPrefix?: string; prepare?: BashPrepare } | undefined,\n\tapi: ToolExecutionApi,\n\tcontext: Context,\n): Promise<BashExecution> {\n\tconst execution: BashExecution = {\n\t\tcommand: options?.commandPrefix ? `${options.commandPrefix}\\n${command}` : command,\n\t\tcwd: requireEnv(api).cwd,\n\t\tenv: {},\n\t\tinheritEnv: true,\n\t};\n\tawait options?.prepare?.(execution, api, context);\n\treturn execution;\n}\n\n/**\n * Run each command form in turn until one starts, streaming output to `api.output()` within the retained window, and\n * turn the result into the tool's outcome: a spill diagnostic, and a thrown error for a failure or a nonzero exit.\n */\nasync function runCommand(\n\tcommands: readonly (string | readonly string[])[],\n\texecution: BashExecution,\n\ttimeout: number | undefined,\n\tapi: ToolExecutionApi,\n\tcontext: Context,\n): Promise<void> {\n\tconst env = requireEnv(api);\n\tlet result: Awaited<ReturnType<typeof env.exec>> | undefined;\n\tfor (const command of commands) {\n\t\tresult = await env.exec(\n\t\t\tcommand,\n\t\t\t{\n\t\t\t\tcwd: execution.cwd,\n\t\t\t\tenv: execution.env,\n\t\t\t\tinheritEnv: execution.inheritEnv,\n\t\t\t\t...(timeout === undefined ? {} : { timeout }),\n\t\t\t\tonOutput: (text, _context, info) => api.output(text, info.skipped),\n\t\t\t\tspill: { afterBytes: DEFAULT_MAX_BYTES, afterLines: DEFAULT_MAX_LINES },\n\t\t\t\t// An environment may then omit output outside the retained tail and report the omission.\n\t\t\t\t...(api.outputWindow === undefined ? {} : { window: api.outputWindow }),\n\t\t\t},\n\t\t\tcontext,\n\t\t);\n\t\t// A program that could not start produced no output; the next form may.\n\t\tif (result.ok || result.error.code !== \"spawn_error\") break;\n\t}\n\tif (result === undefined) throw new Error(\"No command to run\");\n\tconst spillPath = result.ok ? result.value.spillPath : result.error.spillPath;\n\tif (spillPath !== undefined) {\n\t\tapi.diagnostic({ severity: \"info\", code: \"full_output\", message: `Full output: ${spillPath}` });\n\t}\n\tif (!result.ok) {\n\t\tif (result.error.code === \"aborted\" && context.abortSignal?.aborted) throw result.error;\n\t\tif (result.error.code === \"timeout\") throw new Error(`Command timed out after ${timeout} seconds`);\n\t\tif (result.error.code === \"aborted\") throw new Error(\"Command aborted\");\n\t\tthrow result.error;\n\t}\n\tif (result.value.exitCode !== 0) throw new Error(`Command exited with code ${result.value.exitCode}`);\n}\n\n/**\n * Runs a command through the environment's shell. Its output streams to `api.output()`, where the Harness keeps the\n * tail within the default limits; the result content is that retained output. The retained window goes to the\n * environment, which may omit output outside it and report how much it omitted, so dropped counts stay exact. Output\n * beyond the limits is spilled to a file whose path is reported as a diagnostic. A nonzero exit or timeout throws, which\n * makes an error result that still carries the output and diagnostics.\n */\nexport function createBashTool(options?: BashToolOptions): ToolRegistration<typeof bashSchema> {\n\treturn defineTool({\n\t\tname: \"bash\",\n\t\tdescription: `Execute a bash command in the current working directory. Returns combined stdout and stderr. Output is truncated to last ${DEFAULT_MAX_LINES} lines or ${DEFAULT_MAX_BYTES / 1024}KB (whichever is hit first). If truncated, full output is saved to a temp file. Optionally provide a timeout in seconds.`,\n\t\tparameters: bashSchema,\n\t\toutputLimits: { retain: \"tail\" },\n\t\tasync execute(args, api, context) {\n\t\t\tvalidateTimeout(args.timeout);\n\t\t\tconst execution = await prepareExecution(args.command, options, api, context);\n\t\t\tawait runCommand([execution.command], execution, args.timeout, api, context);\n\t\t\treturn {};\n\t\t},\n\t});\n}\n\n/** Output in UTF-8 whatever the console's code page, as the coding agent's `powershell` tool does. */\nconst UTF8_OUTPUT = \"try { [Console]::OutputEncoding=[System.Text.Encoding]::UTF8 } catch {}\";\nconst POWERSHELL_ARGS = [\"-NoProfile\", \"-NonInteractive\", \"-ExecutionPolicy\", \"Bypass\", \"-Command\"] as const;\n\n/**\n * Runs a PowerShell command, like `bash` but through PowerShell instead of the environment's shell: `pwsh` (PowerShell\n * 7), else Windows PowerShell, started directly with the command as an argument, so no other shell parses it.\n */\nexport function createPowerShellTool(options?: PowerShellToolOptions): ToolRegistration<typeof powershellSchema> {\n\tconst programs = options?.programs ?? [\"pwsh\", \"powershell\"];\n\treturn defineTool({\n\t\tname: \"powershell\",\n\t\tdescription: `Execute a PowerShell command in the current working directory. Returns combined stdout and stderr. Output is truncated to last ${DEFAULT_MAX_LINES} lines or ${DEFAULT_MAX_BYTES / 1024}KB (whichever is hit first). If truncated, full output is saved to a temp file. Optionally provide a timeout in seconds.`,\n\t\tparameters: powershellSchema,\n\t\toutputLimits: { retain: \"tail\" },\n\t\tasync execute(args, api, context) {\n\t\t\tvalidateTimeout(args.timeout);\n\t\t\tconst execution = await prepareExecution(args.command, options, api, context);\n\t\t\tconst script = `${UTF8_OUTPUT}\\n${execution.command}`;\n\t\t\tconst commands = programs.map((program) => [program, ...POWERSHELL_ARGS, script]);\n\t\t\tawait runCommand(commands, execution, args.timeout, api, context);\n\t\t\treturn {};\n\t\t},\n\t});\n}\n"]}
|
package/dist/tools/image.d.ts
CHANGED
|
@@ -1,2 +1,12 @@
|
|
|
1
|
+
/** Positional reads of a file of `size` bytes. */
|
|
2
|
+
export type ByteSource = {
|
|
3
|
+
readonly size: number;
|
|
4
|
+
read(offset: number, length: number): Promise<Uint8Array>;
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* `detectSupportedImageMimeType` of a whole file, reading only its header and, for PNG, the chunk headers up to the
|
|
8
|
+
* first `acTL` or `IDAT`.
|
|
9
|
+
*/
|
|
10
|
+
export declare function detectSupportedImageMimeTypeOf(source: ByteSource): Promise<string | undefined>;
|
|
1
11
|
export declare function detectSupportedImageMimeType(buffer: Uint8Array): string | undefined;
|
|
2
12
|
//# sourceMappingURL=image.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"image.d.ts","sourceRoot":"","sources":["../../src/tools/image.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"image.d.ts","sourceRoot":"","sources":["../../src/tools/image.ts"],"names":[],"mappings":"AAKA,kDAAkD;AAClD,MAAM,MAAM,UAAU,GAAG;IACxB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;CAC1D,CAAC;AAEF;;;GAGG;AACH,wBAAsB,8BAA8B,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAIpG;AA0BD,wBAAgB,4BAA4B,CAAC,MAAM,EAAE,UAAU,GAAG,MAAM,GAAG,SAAS,CAOnF"}
|
package/dist/tools/image.js
CHANGED
|
@@ -1,4 +1,43 @@
|
|
|
1
1
|
const PNG_SIGNATURE = [0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a];
|
|
2
|
+
/** Bytes every check except the APNG chunk walk needs: BMP reads up to offset 29. */
|
|
3
|
+
const HEADER_BYTES = 32;
|
|
4
|
+
const BLOCK_BYTES = 64 * 1024;
|
|
5
|
+
/**
|
|
6
|
+
* `detectSupportedImageMimeType` of a whole file, reading only its header and, for PNG, the chunk headers up to the
|
|
7
|
+
* first `acTL` or `IDAT`.
|
|
8
|
+
*/
|
|
9
|
+
export async function detectSupportedImageMimeTypeOf(source) {
|
|
10
|
+
const header = await source.read(0, HEADER_BYTES);
|
|
11
|
+
if (!startsWith(header, PNG_SIGNATURE))
|
|
12
|
+
return detectSupportedImageMimeType(header);
|
|
13
|
+
return isPng(header) && !(await isAnimatedPngOf(source)) ? "image/png" : undefined;
|
|
14
|
+
}
|
|
15
|
+
/** `isAnimatedPng` over a file read in blocks. */
|
|
16
|
+
async function isAnimatedPngOf(source) {
|
|
17
|
+
let block = new Uint8Array(0);
|
|
18
|
+
let blockStart = 0;
|
|
19
|
+
const bytesAt = async (offset, length) => {
|
|
20
|
+
if (offset < blockStart || offset + length > blockStart + block.length) {
|
|
21
|
+
blockStart = offset;
|
|
22
|
+
block = await source.read(offset, BLOCK_BYTES);
|
|
23
|
+
}
|
|
24
|
+
return block.subarray(offset - blockStart, offset - blockStart + length);
|
|
25
|
+
};
|
|
26
|
+
let offset = PNG_SIGNATURE.length;
|
|
27
|
+
while (offset + 8 <= source.size) {
|
|
28
|
+
const chunkHeader = await bytesAt(offset, 8);
|
|
29
|
+
const chunkLength = readUint32BE(chunkHeader, 0);
|
|
30
|
+
if (startsWithAscii(chunkHeader, 4, "acTL"))
|
|
31
|
+
return true;
|
|
32
|
+
if (startsWithAscii(chunkHeader, 4, "IDAT"))
|
|
33
|
+
return false;
|
|
34
|
+
const nextOffset = offset + 8 + chunkLength + 4;
|
|
35
|
+
if (nextOffset <= offset || nextOffset > source.size)
|
|
36
|
+
return false;
|
|
37
|
+
offset = nextOffset;
|
|
38
|
+
}
|
|
39
|
+
return false;
|
|
40
|
+
}
|
|
2
41
|
export function detectSupportedImageMimeType(buffer) {
|
|
3
42
|
if (startsWith(buffer, [0xff, 0xd8, 0xff]))
|
|
4
43
|
return buffer[3] === 0xf7 ? undefined : "image/jpeg";
|
package/dist/tools/image.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"image.js","sourceRoot":"","sources":["../../src/tools/image.ts"],"names":[],"mappings":"AAAA,MAAM,aAAa,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;AAEvE,MAAM,UAAU,4BAA4B,CAAC,MAAkB;IAC9D,IAAI,UAAU,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;QAAE,OAAO,MAAM,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,YAAY,CAAC;IACjG,IAAI,UAAU,CAAC,MAAM,EAAE,aAAa,CAAC;QAAE,OAAO,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAA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,OAAO,KAAK,CAAC,KAAK,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,IAAI,CAAC,CAAC;AAC7D,CAAC;AAED,SAAS,eAAe,CAAC,MAAkB,EAAE,MAAc,EAAE,IAAY;IACxE,IAAI,MAAM,CAAC,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC,MAAM;QAAE,OAAO,KAAK,CAAC;IACvD,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,IAAI,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,CAAC;QAClD,IAAI,MAAM,CAAC,MAAM,GAAG,KAAK,CAAC,KAAK,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC;YAAE,OAAO,KAAK,CAAC;IACrE,CAAC;IACD,OAAO,IAAI,CAAC;AACb,CAAC","sourcesContent":["const PNG_SIGNATURE = [0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a];\n\nexport function detectSupportedImageMimeType(buffer: Uint8Array): string | undefined {\n\tif (startsWith(buffer, [0xff, 0xd8, 0xff])) return buffer[3] === 0xf7 ? undefined : \"image/jpeg\";\n\tif (startsWith(buffer, PNG_SIGNATURE)) return isPng(buffer) && !isAnimatedPng(buffer) ? \"image/png\" : undefined;\n\tif (startsWithAscii(buffer, 0, \"GIF87a\") || startsWithAscii(buffer, 0, \"GIF89a\")) return \"image/gif\";\n\tif (startsWithAscii(buffer, 0, \"RIFF\") && startsWithAscii(buffer, 8, \"WEBP\")) return \"image/webp\";\n\tif (startsWithAscii(buffer, 0, \"BM\") && isBmp(buffer)) return \"image/bmp\";\n\treturn undefined;\n}\n\nfunction isPng(buffer: Uint8Array): boolean {\n\treturn (\n\t\tbuffer.length >= 16 && readUint32BE(buffer, PNG_SIGNATURE.length) === 13 && startsWithAscii(buffer, 12, \"IHDR\")\n\t);\n}\n\nfunction isAnimatedPng(buffer: Uint8Array): boolean {\n\tlet offset = PNG_SIGNATURE.length;\n\twhile (offset + 8 <= buffer.length) {\n\t\tconst chunkLength = readUint32BE(buffer, offset);\n\t\tconst chunkTypeOffset = offset + 4;\n\t\tif (startsWithAscii(buffer, chunkTypeOffset, \"acTL\")) return true;\n\t\tif (startsWithAscii(buffer, chunkTypeOffset, \"IDAT\")) return false;\n\t\tconst nextOffset = offset + 8 + chunkLength + 4;\n\t\tif (nextOffset <= offset || nextOffset > buffer.length) return false;\n\t\toffset = nextOffset;\n\t}\n\treturn false;\n}\n\nfunction isBmp(buffer: Uint8Array): boolean {\n\tif (buffer.length < 26) return false;\n\tconst declaredFileSize = readUint32LE(buffer, 2);\n\tconst pixelDataOffset = readUint32LE(buffer, 10);\n\tconst dibHeaderSize = readUint32LE(buffer, 14);\n\tif (declaredFileSize !== 0 && declaredFileSize < 26) return false;\n\tif (pixelDataOffset < 14 + dibHeaderSize) return false;\n\tif (declaredFileSize !== 0 && pixelDataOffset >= declaredFileSize) return false;\n\n\tlet colorPlanes: number;\n\tlet bitsPerPixel: number;\n\tif (dibHeaderSize === 12) {\n\t\tcolorPlanes = readUint16LE(buffer, 22);\n\t\tbitsPerPixel = readUint16LE(buffer, 24);\n\t} else if (dibHeaderSize >= 40 && dibHeaderSize <= 124) {\n\t\tif (buffer.length < 30) return false;\n\t\tcolorPlanes = readUint16LE(buffer, 26);\n\t\tbitsPerPixel = readUint16LE(buffer, 28);\n\t} else {\n\t\treturn false;\n\t}\n\treturn colorPlanes === 1 && [1, 4, 8, 16, 24, 32].includes(bitsPerPixel);\n}\n\nfunction readUint16LE(buffer: Uint8Array, offset: number): number {\n\treturn (buffer[offset] ?? 0) + ((buffer[offset + 1] ?? 0) << 8);\n}\n\nfunction readUint32BE(buffer: Uint8Array, offset: number): number {\n\treturn (\n\t\t(buffer[offset] ?? 0) * 0x1000000 +\n\t\t((buffer[offset + 1] ?? 0) << 16) +\n\t\t((buffer[offset + 2] ?? 0) << 8) +\n\t\t(buffer[offset + 3] ?? 0)\n\t);\n}\n\nfunction readUint32LE(buffer: Uint8Array, offset: number): number {\n\treturn (\n\t\t(buffer[offset] ?? 0) +\n\t\t((buffer[offset + 1] ?? 0) << 8) +\n\t\t((buffer[offset + 2] ?? 0) << 16) +\n\t\t(buffer[offset + 3] ?? 0) * 0x1000000\n\t);\n}\n\nfunction startsWith(buffer: Uint8Array, bytes: number[]): boolean {\n\tif (buffer.length < bytes.length) return false;\n\treturn bytes.every((byte, index) => buffer[index] === byte);\n}\n\nfunction startsWithAscii(buffer: Uint8Array, offset: number, text: string): boolean {\n\tif (buffer.length < offset + text.length) return false;\n\tfor (let index = 0; index < text.length; index++) {\n\t\tif (buffer[offset + index] !== text.charCodeAt(index)) return false;\n\t}\n\treturn true;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"image.js","sourceRoot":"","sources":["../../src/tools/image.ts"],"names":[],"mappings":"AAAA,MAAM,aAAa,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;AACvE,qFAAqF;AACrF,MAAM,YAAY,GAAG,EAAE,CAAC;AACxB,MAAM,WAAW,GAAG,EAAE,GAAG,IAAI,CAAC;AAQ9B;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,8BAA8B,CAAC,MAAkB;IACtE,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,IAAI,CAAC,CAAC,EAAE,YAAY,CAAC,CAAC;IAClD,IAAI,CAAC,UAAU,CAAC,MAAM,EAAE,aAAa,CAAC;QAAE,OAAO,4BAA4B,CAAC,MAAM,CAAC,CAAC;IACpF,OAAO,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,MAAM,eAAe,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,SAAS,CAAC;AACpF,CAAC;AAED,kDAAkD;AAClD,KAAK,UAAU,eAAe,CAAC,MAAkB;IAChD,IAA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AM,CAAC,MAAM,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,CAAC;QACjC,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,SAAS,CACrC,CAAC;AACH,CAAC;AAED,SAAS,UAAU,CAAC,MAAkB,EAAE,KAAe;IACtD,IAAI,MAAM,CAAC,MAAM,GAAG,KAAK,CAAC,MAAM;QAAE,OAAO,KAAK,CAAC;IAC/C,OAAO,KAAK,CAAC,KAAK,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,IAAI,CAAC,CAAC;AAC7D,CAAC;AAED,SAAS,eAAe,CAAC,MAAkB,EAAE,MAAc,EAAE,IAAY;IACxE,IAAI,MAAM,CAAC,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC,MAAM;QAAE,OAAO,KAAK,CAAC;IACvD,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,IAAI,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,CAAC;QAClD,IAAI,MAAM,CAAC,MAAM,GAAG,KAAK,CAAC,KAAK,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC;YAAE,OAAO,KAAK,CAAC;IACrE,CAAC;IACD,OAAO,IAAI,CAAC;AACb,CAAC","sourcesContent":["const PNG_SIGNATURE = [0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a];\n/** Bytes every check except the APNG chunk walk needs: BMP reads up to offset 29. */\nconst HEADER_BYTES = 32;\nconst BLOCK_BYTES = 64 * 1024;\n\n/** Positional reads of a file of `size` bytes. */\nexport type ByteSource = {\n\treadonly size: number;\n\tread(offset: number, length: number): Promise<Uint8Array>;\n};\n\n/**\n * `detectSupportedImageMimeType` of a whole file, reading only its header and, for PNG, the chunk headers up to the\n * first `acTL` or `IDAT`.\n */\nexport async function detectSupportedImageMimeTypeOf(source: ByteSource): Promise<string | undefined> {\n\tconst header = await source.read(0, HEADER_BYTES);\n\tif (!startsWith(header, PNG_SIGNATURE)) return detectSupportedImageMimeType(header);\n\treturn isPng(header) && !(await isAnimatedPngOf(source)) ? \"image/png\" : undefined;\n}\n\n/** `isAnimatedPng` over a file read in blocks. */\nasync function isAnimatedPngOf(source: ByteSource): Promise<boolean> {\n\tlet block: Uint8Array = new Uint8Array(0);\n\tlet blockStart = 0;\n\tconst bytesAt = async (offset: number, length: number): Promise<Uint8Array> => {\n\t\tif (offset < blockStart || offset + length > blockStart + block.length) {\n\t\t\tblockStart = offset;\n\t\t\tblock = await source.read(offset, BLOCK_BYTES);\n\t\t}\n\t\treturn block.subarray(offset - blockStart, offset - blockStart + length);\n\t};\n\tlet offset = PNG_SIGNATURE.length;\n\twhile (offset + 8 <= source.size) {\n\t\tconst chunkHeader = await bytesAt(offset, 8);\n\t\tconst chunkLength = readUint32BE(chunkHeader, 0);\n\t\tif (startsWithAscii(chunkHeader, 4, \"acTL\")) return true;\n\t\tif (startsWithAscii(chunkHeader, 4, \"IDAT\")) return false;\n\t\tconst nextOffset = offset + 8 + chunkLength + 4;\n\t\tif (nextOffset <= offset || nextOffset > source.size) return false;\n\t\toffset = nextOffset;\n\t}\n\treturn false;\n}\n\nexport function detectSupportedImageMimeType(buffer: Uint8Array): string | undefined {\n\tif (startsWith(buffer, [0xff, 0xd8, 0xff])) return buffer[3] === 0xf7 ? undefined : \"image/jpeg\";\n\tif (startsWith(buffer, PNG_SIGNATURE)) return isPng(buffer) && !isAnimatedPng(buffer) ? \"image/png\" : undefined;\n\tif (startsWithAscii(buffer, 0, \"GIF87a\") || startsWithAscii(buffer, 0, \"GIF89a\")) return \"image/gif\";\n\tif (startsWithAscii(buffer, 0, \"RIFF\") && startsWithAscii(buffer, 8, \"WEBP\")) return \"image/webp\";\n\tif (startsWithAscii(buffer, 0, \"BM\") && isBmp(buffer)) return \"image/bmp\";\n\treturn undefined;\n}\n\nfunction isPng(buffer: Uint8Array): boolean {\n\treturn (\n\t\tbuffer.length >= 16 && readUint32BE(buffer, PNG_SIGNATURE.length) === 13 && startsWithAscii(buffer, 12, \"IHDR\")\n\t);\n}\n\nfunction isAnimatedPng(buffer: Uint8Array): boolean {\n\tlet offset = PNG_SIGNATURE.length;\n\twhile (offset + 8 <= buffer.length) {\n\t\tconst chunkLength = readUint32BE(buffer, offset);\n\t\tconst chunkTypeOffset = offset + 4;\n\t\tif (startsWithAscii(buffer, chunkTypeOffset, \"acTL\")) return true;\n\t\tif (startsWithAscii(buffer, chunkTypeOffset, \"IDAT\")) return false;\n\t\tconst nextOffset = offset + 8 + chunkLength + 4;\n\t\tif (nextOffset <= offset || nextOffset > buffer.length) return false;\n\t\toffset = nextOffset;\n\t}\n\treturn false;\n}\n\nfunction isBmp(buffer: Uint8Array): boolean {\n\tif (buffer.length < 26) return false;\n\tconst declaredFileSize = readUint32LE(buffer, 2);\n\tconst pixelDataOffset = readUint32LE(buffer, 10);\n\tconst dibHeaderSize = readUint32LE(buffer, 14);\n\tif (declaredFileSize !== 0 && declaredFileSize < 26) return false;\n\tif (pixelDataOffset < 14 + dibHeaderSize) return false;\n\tif (declaredFileSize !== 0 && pixelDataOffset >= declaredFileSize) return false;\n\n\tlet colorPlanes: number;\n\tlet bitsPerPixel: number;\n\tif (dibHeaderSize === 12) {\n\t\tcolorPlanes = readUint16LE(buffer, 22);\n\t\tbitsPerPixel = readUint16LE(buffer, 24);\n\t} else if (dibHeaderSize >= 40 && dibHeaderSize <= 124) {\n\t\tif (buffer.length < 30) return false;\n\t\tcolorPlanes = readUint16LE(buffer, 26);\n\t\tbitsPerPixel = readUint16LE(buffer, 28);\n\t} else {\n\t\treturn false;\n\t}\n\treturn colorPlanes === 1 && [1, 4, 8, 16, 24, 32].includes(bitsPerPixel);\n}\n\nfunction readUint16LE(buffer: Uint8Array, offset: number): number {\n\treturn (buffer[offset] ?? 0) + ((buffer[offset + 1] ?? 0) << 8);\n}\n\nfunction readUint32BE(buffer: Uint8Array, offset: number): number {\n\treturn (\n\t\t(buffer[offset] ?? 0) * 0x1000000 +\n\t\t((buffer[offset + 1] ?? 0) << 16) +\n\t\t((buffer[offset + 2] ?? 0) << 8) +\n\t\t(buffer[offset + 3] ?? 0)\n\t);\n}\n\nfunction readUint32LE(buffer: Uint8Array, offset: number): number {\n\treturn (\n\t\t(buffer[offset] ?? 0) +\n\t\t((buffer[offset + 1] ?? 0) << 8) +\n\t\t((buffer[offset + 2] ?? 0) << 16) +\n\t\t(buffer[offset + 3] ?? 0) * 0x1000000\n\t);\n}\n\nfunction startsWith(buffer: Uint8Array, bytes: number[]): boolean {\n\tif (buffer.length < bytes.length) return false;\n\treturn bytes.every((byte, index) => buffer[index] === byte);\n}\n\nfunction startsWithAscii(buffer: Uint8Array, offset: number, text: string): boolean {\n\tif (buffer.length < offset + text.length) return false;\n\tfor (let index = 0; index < text.length; index++) {\n\t\tif (buffer[offset + index] !== text.charCodeAt(index)) return false;\n\t}\n\treturn true;\n}\n"]}
|
package/dist/tools/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export { type BashExecution, type BashPrepare, type BashToolInput, type BashToolOptions, createBashTool, } from "./bash.ts";
|
|
1
|
+
export { type BashExecution, type BashPrepare, type BashToolInput, type BashToolOptions, createBashTool, createPowerShellTool, type PowerShellToolInput, type PowerShellToolOptions, } from "./bash.ts";
|
|
2
2
|
export { createEditTool, type EditToolDetails, type EditToolInput } from "./edit.ts";
|
|
3
3
|
export { createReadTool, type ReadToolDetails, type ReadToolInput } from "./read.ts";
|
|
4
4
|
export { createWriteTool, type WriteToolInput } from "./write.ts";
|
|
5
|
-
/** `read`, `write`, `edit`, and `bash`; nothing installs it automatically. */
|
|
5
|
+
/** `read`, `write`, `edit`, and `bash`; nothing installs it automatically. `createPowerShellTool()` adds `powershell`. */
|
|
6
6
|
export declare const CodingTools: import("../index.ts").Extension<import("../index.ts").ToolRegistration<import("typebox").TObject<{
|
|
7
7
|
command: import("typebox").TString;
|
|
8
8
|
timeout: import("typebox").TOptional<import("typebox").TNumber>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAMA,OAAO,EACN,KAAK,aAAa,EAClB,KAAK,WAAW,EAChB,KAAK,aAAa,EAClB,KAAK,eAAe,EACpB,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAMA,OAAO,EACN,KAAK,aAAa,EAClB,KAAK,WAAW,EAChB,KAAK,aAAa,EAClB,KAAK,eAAe,EACpB,cAAc,EACd,oBAAoB,EACpB,KAAK,mBAAmB,EACxB,KAAK,qBAAqB,GAC1B,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,cAAc,EAAE,KAAK,eAAe,EAAE,KAAK,aAAa,EAAE,MAAM,WAAW,CAAC;AACrF,OAAO,EAAE,cAAc,EAAE,KAAK,eAAe,EAAE,KAAK,aAAa,EAAE,MAAM,WAAW,CAAC;AACrF,OAAO,EAAE,eAAe,EAAE,KAAK,cAAc,EAAE,MAAM,YAAY,CAAC;AAElE,0HAA0H;AAC1H,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;yCAGtB,CAAC"}
|
package/dist/tools/index.js
CHANGED
|
@@ -3,11 +3,11 @@ import { createBashTool } from "./bash.js";
|
|
|
3
3
|
import { createEditTool } from "./edit.js";
|
|
4
4
|
import { createReadTool } from "./read.js";
|
|
5
5
|
import { createWriteTool } from "./write.js";
|
|
6
|
-
export { createBashTool, } from "./bash.js";
|
|
6
|
+
export { createBashTool, createPowerShellTool, } from "./bash.js";
|
|
7
7
|
export { createEditTool } from "./edit.js";
|
|
8
8
|
export { createReadTool } from "./read.js";
|
|
9
9
|
export { createWriteTool } from "./write.js";
|
|
10
|
-
/** `read`, `write`, `edit`, and `bash`; nothing installs it automatically. */
|
|
10
|
+
/** `read`, `write`, `edit`, and `bash`; nothing installs it automatically. `createPowerShellTool()` adds `powershell`. */
|
|
11
11
|
export const CodingTools = defineExtension({
|
|
12
12
|
name: "coding-tools",
|
|
13
13
|
tools: [createReadTool(), createWriteTool(), createEditTool(), createBashTool()],
|
package/dist/tools/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAE7C,OAAO,EAKN,cAAc,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAE7C,OAAO,EAKN,cAAc,EACd,oBAAoB,GAGpB,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,cAAc,EAA4C,MAAM,WAAW,CAAC;AACrF,OAAO,EAAE,cAAc,EAA4C,MAAM,WAAW,CAAC;AACrF,OAAO,EAAE,eAAe,EAAuB,MAAM,YAAY,CAAC;AAElE,0HAA0H;AAC1H,MAAM,CAAC,MAAM,WAAW,GAAG,eAAe,CAAC;IAC1C,IAAI,EAAE,cAAc;IACpB,KAAK,EAAE,CAAC,cAAc,EAAE,EAAE,eAAe,EAAE,EAAE,cAAc,EAAE,EAAE,cAAc,EAAE,CAAC;CAChF,CAAC,CAAC","sourcesContent":["import { defineExtension } from \"../harness/define.ts\";\nimport { createBashTool } from \"./bash.ts\";\nimport { createEditTool } from \"./edit.ts\";\nimport { createReadTool } from \"./read.ts\";\nimport { createWriteTool } from \"./write.ts\";\n\nexport {\n\ttype BashExecution,\n\ttype BashPrepare,\n\ttype BashToolInput,\n\ttype BashToolOptions,\n\tcreateBashTool,\n\tcreatePowerShellTool,\n\ttype PowerShellToolInput,\n\ttype PowerShellToolOptions,\n} from \"./bash.ts\";\nexport { createEditTool, type EditToolDetails, type EditToolInput } from \"./edit.ts\";\nexport { createReadTool, type ReadToolDetails, type ReadToolInput } from \"./read.ts\";\nexport { createWriteTool, type WriteToolInput } from \"./write.ts\";\n\n/** `read`, `write`, `edit`, and `bash`; nothing installs it automatically. `createPowerShellTool()` adds `powershell`. */\nexport const CodingTools = defineExtension({\n\tname: \"coding-tools\",\n\ttools: [createReadTool(), createWriteTool(), createEditTool(), createBashTool()],\n});\n"]}
|
package/dist/tools/read.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"read.d.ts","sourceRoot":"","sources":["../../src/tools/read.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"read.d.ts","sourceRoot":"","sources":["../../src/tools/read.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,MAAM,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAW5C,OAAO,KAAK,EAAkB,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAC5E,OAAO,EAIN,KAAK,gBAAgB,EAGrB,MAAM,gBAAgB,CAAC;AAKxB,QAAA,MAAM,UAAU;;;;EAId,CAAC;AAEH,MAAM,MAAM,aAAa,GAAG,MAAM,CAAC,OAAO,UAAU,CAAC,CAAC;AAEtD,MAAM,MAAM,eAAe,GAAG;IAC7B,yEAAyE;IACzE,UAAU,CAAC,EAAE,IAAI,CAAC,gBAAgB,EAAE,SAAS,CAAC,CAAC;CAC/C,CAAC;AAmCF,kHAAkH;AAClH,wBAAgB,cAAc,IAAI,gBAAgB,CAAC,OAAO,UAAU,EAAE,eAAe,CAAC,CA2BrF"}
|