agency-lang 0.0.102 → 0.0.103
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/lib/importPaths.js +1 -8
- package/dist/lib/importPaths.test.js +3 -13
- package/dist/lib/version.d.ts +1 -1
- package/dist/lib/version.js +1 -1
- package/package.json +3 -2
- package/stdlib/agent.js +1 -1
- package/stdlib/array.js +1 -1
- package/stdlib/clipboard.js +1 -1
- package/stdlib/fs.js +1 -1
- package/stdlib/http.js +1 -1
- package/stdlib/math.js +1 -1
- package/stdlib/object.js +1 -1
- package/stdlib/path.js +1 -1
- package/stdlib/shell.js +1 -1
- package/stdlib/speech.js +1 -1
- package/stdlib/strategy.js +1 -1
- package/stdlib/system.js +1 -1
- package/stdlib/ui.js +1 -1
- package/stdlib/weather.js +1 -1
- package/stdlib/wikipedia.js +1 -1
- package/dist/lib/debugger/hotReload.d.ts +0 -11
- package/dist/lib/debugger/hotReload.js +0 -73
package/dist/lib/importPaths.js
CHANGED
|
@@ -229,14 +229,7 @@ export function resolveAgencyImportPath(importPath, fromFile) {
|
|
|
229
229
|
*/
|
|
230
230
|
export function toCompiledImportPath(importPath, fromFile) {
|
|
231
231
|
if (isStdlibImport(importPath)) {
|
|
232
|
-
|
|
233
|
-
if (fromFile) {
|
|
234
|
-
let rel = path.relative(path.dirname(fromFile), absTarget).replace(/\\/g, "/");
|
|
235
|
-
if (!rel.startsWith("."))
|
|
236
|
-
rel = "./" + rel;
|
|
237
|
-
return rel;
|
|
238
|
-
}
|
|
239
|
-
return absTarget;
|
|
232
|
+
return "agency-lang/stdlib/" + normalizeStdlibPath(importPath) + ".js";
|
|
240
233
|
}
|
|
241
234
|
if (isPkgImport(importPath)) {
|
|
242
235
|
// Emit bare specifier — Node resolves it at runtime via node_modules
|
|
@@ -35,9 +35,9 @@ describe("resolveAgencyImportPath", () => {
|
|
|
35
35
|
});
|
|
36
36
|
});
|
|
37
37
|
describe("toCompiledImportPath", () => {
|
|
38
|
-
it("should convert std:: paths to absolute
|
|
38
|
+
it("should convert std:: paths to package-absolute paths", () => {
|
|
39
39
|
const result = toCompiledImportPath("std::math");
|
|
40
|
-
expect(result).toBe(
|
|
40
|
+
expect(result).toBe("agency-lang/stdlib/math.js");
|
|
41
41
|
});
|
|
42
42
|
it("should convert relative .agency paths to .js", () => {
|
|
43
43
|
const result = toCompiledImportPath("./utils.agency");
|
|
@@ -45,17 +45,7 @@ describe("toCompiledImportPath", () => {
|
|
|
45
45
|
});
|
|
46
46
|
it("should handle std:: paths with subdirectories", () => {
|
|
47
47
|
const result = toCompiledImportPath("std::collections/queue");
|
|
48
|
-
expect(result).toBe(
|
|
49
|
-
});
|
|
50
|
-
});
|
|
51
|
-
describe("std:: import code generation", () => {
|
|
52
|
-
it("generated import path should point to a .js file inside the stdlib dir", () => {
|
|
53
|
-
const result = toCompiledImportPath("std::math");
|
|
54
|
-
// Must be an absolute path ending with stdlib/math.js
|
|
55
|
-
expect(path.isAbsolute(result)).toBe(true);
|
|
56
|
-
expect(result).toMatch(/stdlib[/\\]math\.js$/);
|
|
57
|
-
// The stdlib dir should exist
|
|
58
|
-
expect(fs.existsSync(path.dirname(result))).toBe(true);
|
|
48
|
+
expect(result).toBe("agency-lang/stdlib/collections/queue.js");
|
|
59
49
|
});
|
|
60
50
|
});
|
|
61
51
|
describe("isPkgImport", () => {
|
package/dist/lib/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "0.0.
|
|
1
|
+
export declare const VERSION = "0.0.103";
|
package/dist/lib/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = "0.0.
|
|
1
|
+
export const VERSION = "0.0.103";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agency-lang",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.103",
|
|
4
4
|
"description": "The Agency language",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -52,7 +52,8 @@
|
|
|
52
52
|
"types": "./dist/lib/runtime/index.d.ts",
|
|
53
53
|
"import": "./dist/lib/runtime/index.js",
|
|
54
54
|
"require": "./dist/lib/runtime/index.js"
|
|
55
|
-
}
|
|
55
|
+
},
|
|
56
|
+
"./stdlib/*": "./stdlib/*"
|
|
56
57
|
},
|
|
57
58
|
"type": "module",
|
|
58
59
|
"types": "./dist/lib/index.d.ts",
|
package/stdlib/agent.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { print, __printTool, __printToolParams, printJSON, __printJSONTool, __printJSONToolParams, input, __inputTool, __inputToolParams, sleep, __sleepTool, __sleepToolParams, round, __roundTool, __roundToolParams, fetch, __fetchTool, __fetchToolParams, fetchJSON, __fetchJSONTool, __fetchJSONToolParams, read, __readTool, __readToolParams, write, __writeTool, __writeToolParams, readImage, __readImageTool, __readImageToolParams, notify, __notifyTool, __notifyToolParams, range, __rangeTool, __rangeToolParams, mostCommon, __mostCommonTool, __mostCommonToolParams, keys, __keysTool, __keysToolParams, values, __valuesTool, __valuesToolParams, entries, __entriesTool, __entriesToolParams } from "
|
|
1
|
+
import { print, __printTool, __printToolParams, printJSON, __printJSONTool, __printJSONToolParams, input, __inputTool, __inputToolParams, sleep, __sleepTool, __sleepToolParams, round, __roundTool, __roundToolParams, fetch, __fetchTool, __fetchToolParams, fetchJSON, __fetchJSONTool, __fetchJSONToolParams, read, __readTool, __readToolParams, write, __writeTool, __writeToolParams, readImage, __readImageTool, __readImageToolParams, notify, __notifyTool, __notifyToolParams, range, __rangeTool, __rangeToolParams, mostCommon, __mostCommonTool, __mostCommonToolParams, keys, __keysTool, __keysToolParams, values, __valuesTool, __valuesToolParams, entries, __entriesTool, __entriesToolParams } from "agency-lang/stdlib/index.js";
|
|
2
2
|
import { fileURLToPath } from "url";
|
|
3
3
|
import __process from "process";
|
|
4
4
|
import { z } from "zod";
|
package/stdlib/array.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { print, __printTool, __printToolParams, printJSON, __printJSONTool, __printJSONToolParams, input, __inputTool, __inputToolParams, sleep, __sleepTool, __sleepToolParams, round, __roundTool, __roundToolParams, fetch, __fetchTool, __fetchToolParams, fetchJSON, __fetchJSONTool, __fetchJSONToolParams, read, __readTool, __readToolParams, write, __writeTool, __writeToolParams, readImage, __readImageTool, __readImageToolParams, notify, __notifyTool, __notifyToolParams, range, __rangeTool, __rangeToolParams, mostCommon, __mostCommonTool, __mostCommonToolParams, keys, __keysTool, __keysToolParams, values, __valuesTool, __valuesToolParams, entries, __entriesTool, __entriesToolParams } from "
|
|
1
|
+
import { print, __printTool, __printToolParams, printJSON, __printJSONTool, __printJSONToolParams, input, __inputTool, __inputToolParams, sleep, __sleepTool, __sleepToolParams, round, __roundTool, __roundToolParams, fetch, __fetchTool, __fetchToolParams, fetchJSON, __fetchJSONTool, __fetchJSONToolParams, read, __readTool, __readToolParams, write, __writeTool, __writeToolParams, readImage, __readImageTool, __readImageToolParams, notify, __notifyTool, __notifyToolParams, range, __rangeTool, __rangeToolParams, mostCommon, __mostCommonTool, __mostCommonToolParams, keys, __keysTool, __keysToolParams, values, __valuesTool, __valuesToolParams, entries, __entriesTool, __entriesToolParams } from "agency-lang/stdlib/index.js";
|
|
2
2
|
import { fileURLToPath } from "url";
|
|
3
3
|
import __process from "process";
|
|
4
4
|
import { z } from "zod";
|
package/stdlib/clipboard.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { print, __printTool, __printToolParams, printJSON, __printJSONTool, __printJSONToolParams, input, __inputTool, __inputToolParams, sleep, __sleepTool, __sleepToolParams, round, __roundTool, __roundToolParams, fetch, __fetchTool, __fetchToolParams, fetchJSON, __fetchJSONTool, __fetchJSONToolParams, read, __readTool, __readToolParams, write, __writeTool, __writeToolParams, readImage, __readImageTool, __readImageToolParams, notify, __notifyTool, __notifyToolParams, range, __rangeTool, __rangeToolParams, mostCommon, __mostCommonTool, __mostCommonToolParams, keys, __keysTool, __keysToolParams, values, __valuesTool, __valuesToolParams, entries, __entriesTool, __entriesToolParams } from "
|
|
1
|
+
import { print, __printTool, __printToolParams, printJSON, __printJSONTool, __printJSONToolParams, input, __inputTool, __inputToolParams, sleep, __sleepTool, __sleepToolParams, round, __roundTool, __roundToolParams, fetch, __fetchTool, __fetchToolParams, fetchJSON, __fetchJSONTool, __fetchJSONToolParams, read, __readTool, __readToolParams, write, __writeTool, __writeToolParams, readImage, __readImageTool, __readImageToolParams, notify, __notifyTool, __notifyToolParams, range, __rangeTool, __rangeToolParams, mostCommon, __mostCommonTool, __mostCommonToolParams, keys, __keysTool, __keysToolParams, values, __valuesTool, __valuesToolParams, entries, __entriesTool, __entriesToolParams } from "agency-lang/stdlib/index.js";
|
|
2
2
|
import { _copy, _paste } from "./lib/clipboard.js";
|
|
3
3
|
import { fileURLToPath } from "url";
|
|
4
4
|
import __process from "process";
|
package/stdlib/fs.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { print, __printTool, __printToolParams, printJSON, __printJSONTool, __printJSONToolParams, input, __inputTool, __inputToolParams, sleep, __sleepTool, __sleepToolParams, round, __roundTool, __roundToolParams, fetch, __fetchTool, __fetchToolParams, fetchJSON, __fetchJSONTool, __fetchJSONToolParams, read, __readTool, __readToolParams, write, __writeTool, __writeToolParams, readImage, __readImageTool, __readImageToolParams, notify, __notifyTool, __notifyToolParams, range, __rangeTool, __rangeToolParams, mostCommon, __mostCommonTool, __mostCommonToolParams, keys, __keysTool, __keysToolParams, values, __valuesTool, __valuesToolParams, entries, __entriesTool, __entriesToolParams } from "
|
|
1
|
+
import { print, __printTool, __printToolParams, printJSON, __printJSONTool, __printJSONToolParams, input, __inputTool, __inputToolParams, sleep, __sleepTool, __sleepToolParams, round, __roundTool, __roundToolParams, fetch, __fetchTool, __fetchToolParams, fetchJSON, __fetchJSONTool, __fetchJSONToolParams, read, __readTool, __readToolParams, write, __writeTool, __writeToolParams, readImage, __readImageTool, __readImageToolParams, notify, __notifyTool, __notifyToolParams, range, __rangeTool, __rangeToolParams, mostCommon, __mostCommonTool, __mostCommonToolParams, keys, __keysTool, __keysToolParams, values, __valuesTool, __valuesToolParams, entries, __entriesTool, __entriesToolParams } from "agency-lang/stdlib/index.js";
|
|
2
2
|
import { _edit, _multiedit, _applyPatch, _mkdir, _copy, _move, _remove } from "./lib/fs.js";
|
|
3
3
|
import { fileURLToPath } from "url";
|
|
4
4
|
import __process from "process";
|
package/stdlib/http.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { print, __printTool, __printToolParams, printJSON, __printJSONTool, __printJSONToolParams, input, __inputTool, __inputToolParams, sleep, __sleepTool, __sleepToolParams, round, __roundTool, __roundToolParams, read, __readTool, __readToolParams, write, __writeTool, __writeToolParams, readImage, __readImageTool, __readImageToolParams, notify, __notifyTool, __notifyToolParams, range, __rangeTool, __rangeToolParams, mostCommon, __mostCommonTool, __mostCommonToolParams, keys, __keysTool, __keysToolParams, values, __valuesTool, __valuesToolParams, entries, __entriesTool, __entriesToolParams } from "
|
|
1
|
+
import { print, __printTool, __printToolParams, printJSON, __printJSONTool, __printJSONToolParams, input, __inputTool, __inputToolParams, sleep, __sleepTool, __sleepToolParams, round, __roundTool, __roundToolParams, read, __readTool, __readToolParams, write, __writeTool, __writeToolParams, readImage, __readImageTool, __readImageToolParams, notify, __notifyTool, __notifyToolParams, range, __rangeTool, __rangeToolParams, mostCommon, __mostCommonTool, __mostCommonToolParams, keys, __keysTool, __keysToolParams, values, __valuesTool, __valuesToolParams, entries, __entriesTool, __entriesToolParams } from "agency-lang/stdlib/index.js";
|
|
2
2
|
import { _fetch, _fetchJSON, _webfetch } from "./lib/http.js";
|
|
3
3
|
import { fileURLToPath } from "url";
|
|
4
4
|
import __process from "process";
|
package/stdlib/math.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { print, __printTool, __printToolParams, printJSON, __printJSONTool, __printJSONToolParams, input, __inputTool, __inputToolParams, sleep, __sleepTool, __sleepToolParams, round, __roundTool, __roundToolParams, fetch, __fetchTool, __fetchToolParams, fetchJSON, __fetchJSONTool, __fetchJSONToolParams, read, __readTool, __readToolParams, write, __writeTool, __writeToolParams, readImage, __readImageTool, __readImageToolParams, notify, __notifyTool, __notifyToolParams, range, __rangeTool, __rangeToolParams, mostCommon, __mostCommonTool, __mostCommonToolParams, keys, __keysTool, __keysToolParams, values, __valuesTool, __valuesToolParams, entries, __entriesTool, __entriesToolParams } from "
|
|
1
|
+
import { print, __printTool, __printToolParams, printJSON, __printJSONTool, __printJSONToolParams, input, __inputTool, __inputToolParams, sleep, __sleepTool, __sleepToolParams, round, __roundTool, __roundToolParams, fetch, __fetchTool, __fetchToolParams, fetchJSON, __fetchJSONTool, __fetchJSONToolParams, read, __readTool, __readToolParams, write, __writeTool, __writeToolParams, readImage, __readImageTool, __readImageToolParams, notify, __notifyTool, __notifyToolParams, range, __rangeTool, __rangeToolParams, mostCommon, __mostCommonTool, __mostCommonToolParams, keys, __keysTool, __keysToolParams, values, __valuesTool, __valuesToolParams, entries, __entriesTool, __entriesToolParams } from "agency-lang/stdlib/index.js";
|
|
2
2
|
import { fileURLToPath } from "url";
|
|
3
3
|
import __process from "process";
|
|
4
4
|
import { z } from "zod";
|
package/stdlib/object.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { print, __printTool, __printToolParams, printJSON, __printJSONTool, __printJSONToolParams, input, __inputTool, __inputToolParams, sleep, __sleepTool, __sleepToolParams, round, __roundTool, __roundToolParams, fetch, __fetchTool, __fetchToolParams, fetchJSON, __fetchJSONTool, __fetchJSONToolParams, read, __readTool, __readToolParams, write, __writeTool, __writeToolParams, readImage, __readImageTool, __readImageToolParams, notify, __notifyTool, __notifyToolParams, range, __rangeTool, __rangeToolParams, mostCommon, __mostCommonTool, __mostCommonToolParams, keys, __keysTool, __keysToolParams, values, __valuesTool, __valuesToolParams, entries, __entriesTool, __entriesToolParams } from "
|
|
1
|
+
import { print, __printTool, __printToolParams, printJSON, __printJSONTool, __printJSONToolParams, input, __inputTool, __inputToolParams, sleep, __sleepTool, __sleepToolParams, round, __roundTool, __roundToolParams, fetch, __fetchTool, __fetchToolParams, fetchJSON, __fetchJSONTool, __fetchJSONToolParams, read, __readTool, __readToolParams, write, __writeTool, __writeToolParams, readImage, __readImageTool, __readImageToolParams, notify, __notifyTool, __notifyToolParams, range, __rangeTool, __rangeToolParams, mostCommon, __mostCommonTool, __mostCommonToolParams, keys, __keysTool, __keysToolParams, values, __valuesTool, __valuesToolParams, entries, __entriesTool, __entriesToolParams } from "agency-lang/stdlib/index.js";
|
|
2
2
|
import { fileURLToPath } from "url";
|
|
3
3
|
import __process from "process";
|
|
4
4
|
import { z } from "zod";
|
package/stdlib/path.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { print, __printTool, __printToolParams, printJSON, __printJSONTool, __printJSONToolParams, input, __inputTool, __inputToolParams, sleep, __sleepTool, __sleepToolParams, round, __roundTool, __roundToolParams, fetch, __fetchTool, __fetchToolParams, fetchJSON, __fetchJSONTool, __fetchJSONToolParams, read, __readTool, __readToolParams, write, __writeTool, __writeToolParams, readImage, __readImageTool, __readImageToolParams, notify, __notifyTool, __notifyToolParams, range, __rangeTool, __rangeToolParams, mostCommon, __mostCommonTool, __mostCommonToolParams, keys, __keysTool, __keysToolParams, values, __valuesTool, __valuesToolParams, entries, __entriesTool, __entriesToolParams } from "
|
|
1
|
+
import { print, __printTool, __printToolParams, printJSON, __printJSONTool, __printJSONToolParams, input, __inputTool, __inputToolParams, sleep, __sleepTool, __sleepToolParams, round, __roundTool, __roundToolParams, fetch, __fetchTool, __fetchToolParams, fetchJSON, __fetchJSONTool, __fetchJSONToolParams, read, __readTool, __readToolParams, write, __writeTool, __writeToolParams, readImage, __readImageTool, __readImageToolParams, notify, __notifyTool, __notifyToolParams, range, __rangeTool, __rangeToolParams, mostCommon, __mostCommonTool, __mostCommonToolParams, keys, __keysTool, __keysToolParams, values, __valuesTool, __valuesToolParams, entries, __entriesTool, __entriesToolParams } from "agency-lang/stdlib/index.js";
|
|
2
2
|
import { _join, _resolve, _basename, _dirname, _extname, _relative, _isAbsolute } from "./lib/path.js";
|
|
3
3
|
import { fileURLToPath } from "url";
|
|
4
4
|
import __process from "process";
|
package/stdlib/shell.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { print, __printTool, __printToolParams, printJSON, __printJSONTool, __printJSONToolParams, input, __inputTool, __inputToolParams, sleep, __sleepTool, __sleepToolParams, round, __roundTool, __roundToolParams, fetch, __fetchTool, __fetchToolParams, fetchJSON, __fetchJSONTool, __fetchJSONToolParams, read, __readTool, __readToolParams, write, __writeTool, __writeToolParams, readImage, __readImageTool, __readImageToolParams, notify, __notifyTool, __notifyToolParams, range, __rangeTool, __rangeToolParams, mostCommon, __mostCommonTool, __mostCommonToolParams, keys, __keysTool, __keysToolParams, values, __valuesTool, __valuesToolParams, entries, __entriesTool, __entriesToolParams } from "
|
|
1
|
+
import { print, __printTool, __printToolParams, printJSON, __printJSONTool, __printJSONToolParams, input, __inputTool, __inputToolParams, sleep, __sleepTool, __sleepToolParams, round, __roundTool, __roundToolParams, fetch, __fetchTool, __fetchToolParams, fetchJSON, __fetchJSONTool, __fetchJSONToolParams, read, __readTool, __readToolParams, write, __writeTool, __writeToolParams, readImage, __readImageTool, __readImageToolParams, notify, __notifyTool, __notifyToolParams, range, __rangeTool, __rangeToolParams, mostCommon, __mostCommonTool, __mostCommonToolParams, keys, __keysTool, __keysToolParams, values, __valuesTool, __valuesToolParams, entries, __entriesTool, __entriesToolParams } from "agency-lang/stdlib/index.js";
|
|
2
2
|
import { _bash, _ls, _grep, _glob, _stat, _exists, _which } from "./lib/shell.js";
|
|
3
3
|
import { fileURLToPath } from "url";
|
|
4
4
|
import __process from "process";
|
package/stdlib/speech.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { print, __printTool, __printToolParams, printJSON, __printJSONTool, __printJSONToolParams, input, __inputTool, __inputToolParams, sleep, __sleepTool, __sleepToolParams, round, __roundTool, __roundToolParams, fetch, __fetchTool, __fetchToolParams, fetchJSON, __fetchJSONTool, __fetchJSONToolParams, read, __readTool, __readToolParams, write, __writeTool, __writeToolParams, readImage, __readImageTool, __readImageToolParams, notify, __notifyTool, __notifyToolParams, range, __rangeTool, __rangeToolParams, mostCommon, __mostCommonTool, __mostCommonToolParams, keys, __keysTool, __keysToolParams, values, __valuesTool, __valuesToolParams, entries, __entriesTool, __entriesToolParams } from "
|
|
1
|
+
import { print, __printTool, __printToolParams, printJSON, __printJSONTool, __printJSONToolParams, input, __inputTool, __inputToolParams, sleep, __sleepTool, __sleepToolParams, round, __roundTool, __roundToolParams, fetch, __fetchTool, __fetchToolParams, fetchJSON, __fetchJSONTool, __fetchJSONToolParams, read, __readTool, __readToolParams, write, __writeTool, __writeToolParams, readImage, __readImageTool, __readImageToolParams, notify, __notifyTool, __notifyToolParams, range, __rangeTool, __rangeToolParams, mostCommon, __mostCommonTool, __mostCommonToolParams, keys, __keysTool, __keysToolParams, values, __valuesTool, __valuesToolParams, entries, __entriesTool, __entriesToolParams } from "agency-lang/stdlib/index.js";
|
|
2
2
|
import { _speak, _transcribe } from "./lib/speech.js";
|
|
3
3
|
import { fileURLToPath } from "url";
|
|
4
4
|
import __process from "process";
|
package/stdlib/strategy.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { print, __printTool, __printToolParams, printJSON, __printJSONTool, __printJSONToolParams, input, __inputTool, __inputToolParams, sleep, __sleepTool, __sleepToolParams, round, __roundTool, __roundToolParams, fetch, __fetchTool, __fetchToolParams, fetchJSON, __fetchJSONTool, __fetchJSONToolParams, read, __readTool, __readToolParams, write, __writeTool, __writeToolParams, readImage, __readImageTool, __readImageToolParams, notify, __notifyTool, __notifyToolParams, range, __rangeTool, __rangeToolParams, mostCommon, __mostCommonTool, __mostCommonToolParams, keys, __keysTool, __keysToolParams, values, __valuesTool, __valuesToolParams, entries, __entriesTool, __entriesToolParams } from "
|
|
1
|
+
import { print, __printTool, __printToolParams, printJSON, __printJSONTool, __printJSONToolParams, input, __inputTool, __inputToolParams, sleep, __sleepTool, __sleepToolParams, round, __roundTool, __roundToolParams, fetch, __fetchTool, __fetchToolParams, fetchJSON, __fetchJSONTool, __fetchJSONToolParams, read, __readTool, __readToolParams, write, __writeTool, __writeToolParams, readImage, __readImageTool, __readImageToolParams, notify, __notifyTool, __notifyToolParams, range, __rangeTool, __rangeToolParams, mostCommon, __mostCommonTool, __mostCommonToolParams, keys, __keysTool, __keysToolParams, values, __valuesTool, __valuesToolParams, entries, __entriesTool, __entriesToolParams } from "agency-lang/stdlib/index.js";
|
|
2
2
|
import { fileURLToPath } from "url";
|
|
3
3
|
import __process from "process";
|
|
4
4
|
import { z } from "zod";
|
package/stdlib/system.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { print, __printTool, __printToolParams, printJSON, __printJSONTool, __printJSONToolParams, input, __inputTool, __inputToolParams, sleep, __sleepTool, __sleepToolParams, round, __roundTool, __roundToolParams, fetch, __fetchTool, __fetchToolParams, fetchJSON, __fetchJSONTool, __fetchJSONToolParams, read, __readTool, __readToolParams, write, __writeTool, __writeToolParams, readImage, __readImageTool, __readImageToolParams, notify, __notifyTool, __notifyToolParams, range, __rangeTool, __rangeToolParams, mostCommon, __mostCommonTool, __mostCommonToolParams, keys, __keysTool, __keysToolParams, values, __valuesTool, __valuesToolParams, entries, __entriesTool, __entriesToolParams } from "
|
|
1
|
+
import { print, __printTool, __printToolParams, printJSON, __printJSONTool, __printJSONToolParams, input, __inputTool, __inputToolParams, sleep, __sleepTool, __sleepToolParams, round, __roundTool, __roundToolParams, fetch, __fetchTool, __fetchToolParams, fetchJSON, __fetchJSONTool, __fetchJSONToolParams, read, __readTool, __readToolParams, write, __writeTool, __writeToolParams, readImage, __readImageTool, __readImageToolParams, notify, __notifyTool, __notifyToolParams, range, __rangeTool, __rangeToolParams, mostCommon, __mostCommonTool, __mostCommonToolParams, keys, __keysTool, __keysToolParams, values, __valuesTool, __valuesToolParams, entries, __entriesTool, __entriesToolParams } from "agency-lang/stdlib/index.js";
|
|
2
2
|
import { _screenshot, _cwd, _env, _setEnv, _openUrl } from "./lib/system.js";
|
|
3
3
|
import { fileURLToPath } from "url";
|
|
4
4
|
import __process from "process";
|
package/stdlib/ui.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { print, __printTool, __printToolParams, printJSON, __printJSONTool, __printJSONToolParams, input, __inputTool, __inputToolParams, sleep, __sleepTool, __sleepToolParams, round, __roundTool, __roundToolParams, fetch, __fetchTool, __fetchToolParams, fetchJSON, __fetchJSONTool, __fetchJSONToolParams, read, __readTool, __readToolParams, write, __writeTool, __writeToolParams, readImage, __readImageTool, __readImageToolParams, notify, __notifyTool, __notifyToolParams, range, __rangeTool, __rangeToolParams, mostCommon, __mostCommonTool, __mostCommonToolParams, keys, __keysTool, __keysToolParams, values, __valuesTool, __valuesToolParams, entries, __entriesTool, __entriesToolParams } from "
|
|
1
|
+
import { print, __printTool, __printToolParams, printJSON, __printJSONTool, __printJSONToolParams, input, __inputTool, __inputToolParams, sleep, __sleepTool, __sleepToolParams, round, __roundTool, __roundToolParams, fetch, __fetchTool, __fetchToolParams, fetchJSON, __fetchJSONTool, __fetchJSONToolParams, read, __readTool, __readToolParams, write, __writeTool, __writeToolParams, readImage, __readImageTool, __readImageToolParams, notify, __notifyTool, __notifyToolParams, range, __rangeTool, __rangeToolParams, mostCommon, __mostCommonTool, __mostCommonToolParams, keys, __keysTool, __keysToolParams, values, __valuesTool, __valuesToolParams, entries, __entriesTool, __entriesToolParams } from "agency-lang/stdlib/index.js";
|
|
2
2
|
import { _initUI, _destroyUI, _log, _status, _chat, _code, _diff, _separator, _startSpinner, _stopSpinner, _prompt, _emptyLine } from "./lib/ui.js";
|
|
3
3
|
import { fileURLToPath } from "url";
|
|
4
4
|
import __process from "process";
|
package/stdlib/weather.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { print, __printTool, __printToolParams, printJSON, __printJSONTool, __printJSONToolParams, input, __inputTool, __inputToolParams, sleep, __sleepTool, __sleepToolParams, round, __roundTool, __roundToolParams, fetch, __fetchTool, __fetchToolParams, fetchJSON, __fetchJSONTool, __fetchJSONToolParams, read, __readTool, __readToolParams, write, __writeTool, __writeToolParams, readImage, __readImageTool, __readImageToolParams, notify, __notifyTool, __notifyToolParams, range, __rangeTool, __rangeToolParams, mostCommon, __mostCommonTool, __mostCommonToolParams, keys, __keysTool, __keysToolParams, values, __valuesTool, __valuesToolParams, entries, __entriesTool, __entriesToolParams } from "
|
|
1
|
+
import { print, __printTool, __printToolParams, printJSON, __printJSONTool, __printJSONToolParams, input, __inputTool, __inputToolParams, sleep, __sleepTool, __sleepToolParams, round, __roundTool, __roundToolParams, fetch, __fetchTool, __fetchToolParams, fetchJSON, __fetchJSONTool, __fetchJSONToolParams, read, __readTool, __readToolParams, write, __writeTool, __writeToolParams, readImage, __readImageTool, __readImageToolParams, notify, __notifyTool, __notifyToolParams, range, __rangeTool, __rangeToolParams, mostCommon, __mostCommonTool, __mostCommonToolParams, keys, __keysTool, __keysToolParams, values, __valuesTool, __valuesToolParams, entries, __entriesTool, __entriesToolParams } from "agency-lang/stdlib/index.js";
|
|
2
2
|
import { _weather } from "./lib/weather.js";
|
|
3
3
|
import { fileURLToPath } from "url";
|
|
4
4
|
import __process from "process";
|
package/stdlib/wikipedia.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { print, __printTool, __printToolParams, printJSON, __printJSONTool, __printJSONToolParams, input, __inputTool, __inputToolParams, sleep, __sleepTool, __sleepToolParams, round, __roundTool, __roundToolParams, fetch, __fetchTool, __fetchToolParams, fetchJSON, __fetchJSONTool, __fetchJSONToolParams, read, __readTool, __readToolParams, write, __writeTool, __writeToolParams, readImage, __readImageTool, __readImageToolParams, notify, __notifyTool, __notifyToolParams, range, __rangeTool, __rangeToolParams, mostCommon, __mostCommonTool, __mostCommonToolParams, keys, __keysTool, __keysToolParams, values, __valuesTool, __valuesToolParams, entries, __entriesTool, __entriesToolParams } from "
|
|
1
|
+
import { print, __printTool, __printToolParams, printJSON, __printJSONTool, __printJSONToolParams, input, __inputTool, __inputToolParams, sleep, __sleepTool, __sleepToolParams, round, __roundTool, __roundToolParams, fetch, __fetchTool, __fetchToolParams, fetchJSON, __fetchJSONTool, __fetchJSONToolParams, read, __readTool, __readToolParams, write, __writeTool, __writeToolParams, readImage, __readImageTool, __readImageToolParams, notify, __notifyTool, __notifyToolParams, range, __rangeTool, __rangeToolParams, mostCommon, __mostCommonTool, __mostCommonToolParams, keys, __keysTool, __keysToolParams, values, __valuesTool, __valuesToolParams, entries, __entriesTool, __entriesToolParams } from "agency-lang/stdlib/index.js";
|
|
2
2
|
import { _search, _summary, _article } from "./lib/wikipedia.js";
|
|
3
3
|
import { fileURLToPath } from "url";
|
|
4
4
|
import __process from "process";
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { type FSWatcher } from "chokidar";
|
|
2
|
-
import type { DebuggerDriver } from "./driver.js";
|
|
3
|
-
import type { AgencyConfig } from "../config.js";
|
|
4
|
-
type HotReloadOpts = {
|
|
5
|
-
config: AgencyConfig;
|
|
6
|
-
inputFile: string;
|
|
7
|
-
outputFile: string;
|
|
8
|
-
driver: DebuggerDriver;
|
|
9
|
-
};
|
|
10
|
-
export declare function setupHotReload(opts: HotReloadOpts): FSWatcher;
|
|
11
|
-
export {};
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
// @ts-nocheck
|
|
2
|
-
import { watch } from "chokidar";
|
|
3
|
-
import * as path from "path";
|
|
4
|
-
import { compile, resetCompilationCache, getCompiledFiles } from "../cli/commands.js";
|
|
5
|
-
import { clearFileCache } from "./ui.js";
|
|
6
|
-
const DEBOUNCE_MS = 100;
|
|
7
|
-
export function setupHotReload(opts) {
|
|
8
|
-
const { config, inputFile, outputFile, driver } = opts;
|
|
9
|
-
let importCounter = 0;
|
|
10
|
-
const debounceTimers = {};
|
|
11
|
-
// Collect all .agency files involved in compilation
|
|
12
|
-
const filesToWatch = getCompiledFiles();
|
|
13
|
-
const watcher = watch(filesToWatch, {
|
|
14
|
-
ignoreInitial: true,
|
|
15
|
-
});
|
|
16
|
-
const reload = (changedFile) => {
|
|
17
|
-
if (debounceTimers[changedFile]) {
|
|
18
|
-
clearTimeout(debounceTimers[changedFile]);
|
|
19
|
-
}
|
|
20
|
-
debounceTimers[changedFile] = setTimeout(() => {
|
|
21
|
-
delete debounceTimers[changedFile];
|
|
22
|
-
driver.setPendingReload(async () => {
|
|
23
|
-
// Recompile from the entry file
|
|
24
|
-
resetCompilationCache();
|
|
25
|
-
const originalExit = process.exit;
|
|
26
|
-
process.exit = ((code) => {
|
|
27
|
-
throw new Error(`Compilation failed (exit code ${code ?? 1})`);
|
|
28
|
-
});
|
|
29
|
-
try {
|
|
30
|
-
compile(config, inputFile);
|
|
31
|
-
}
|
|
32
|
-
catch (err) {
|
|
33
|
-
driver.ui.state.log(`hot reload failed: ${err instanceof Error ? err.message : err}`);
|
|
34
|
-
return;
|
|
35
|
-
}
|
|
36
|
-
finally {
|
|
37
|
-
process.exit = originalExit;
|
|
38
|
-
}
|
|
39
|
-
// Fresh import with cache-busting
|
|
40
|
-
let mod;
|
|
41
|
-
const absOutput = path.resolve(outputFile);
|
|
42
|
-
try {
|
|
43
|
-
mod = await import(absOutput + `?t=${importCounter++}`);
|
|
44
|
-
}
|
|
45
|
-
catch (err) {
|
|
46
|
-
driver.ui.state.log(`hot reload failed: ${err instanceof Error ? err.message : err}`);
|
|
47
|
-
return;
|
|
48
|
-
}
|
|
49
|
-
// Swap module and source map on the driver
|
|
50
|
-
driver.swapModule({
|
|
51
|
-
approveInterrupt: mod.approveInterrupt,
|
|
52
|
-
respondToInterrupt: mod.respondToInterrupt,
|
|
53
|
-
rewindFrom: mod.rewindFrom,
|
|
54
|
-
__setDebugger: mod.__setDebugger,
|
|
55
|
-
__getCheckpoints: mod.__getCheckpoints,
|
|
56
|
-
}, mod.__sourceMap ?? {});
|
|
57
|
-
// Wire up debugger state on the new module
|
|
58
|
-
mod.__setDebugger(driver.debuggerState);
|
|
59
|
-
// Clear source file cache so the UI picks up the new code
|
|
60
|
-
clearFileCache();
|
|
61
|
-
// Update watch list in case new dependencies were added
|
|
62
|
-
const newFiles = getCompiledFiles();
|
|
63
|
-
watcher.add(newFiles);
|
|
64
|
-
const basename = path.basename(changedFile);
|
|
65
|
-
driver.ui.state.log(`hot reloaded ${basename}`);
|
|
66
|
-
});
|
|
67
|
-
}, DEBOUNCE_MS);
|
|
68
|
-
};
|
|
69
|
-
watcher.on("change", (filePath) => {
|
|
70
|
-
reload(filePath);
|
|
71
|
-
});
|
|
72
|
-
return watcher;
|
|
73
|
-
}
|