@opencode/codemode 0.0.0-reserved → 2.0.0

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.
Files changed (84) hide show
  1. package/README.md +184 -2
  2. package/dist/codemode.d.ts +145 -0
  3. package/dist/codemode.js +66 -0
  4. package/dist/data.d.ts +25 -0
  5. package/dist/data.js +153 -0
  6. package/dist/index.d.ts +7 -0
  7. package/dist/index.js +7 -0
  8. package/dist/interpreter/errors.d.ts +7 -0
  9. package/dist/interpreter/errors.js +106 -0
  10. package/dist/interpreter/execute.d.ts +5 -0
  11. package/dist/interpreter/execute.js +171 -0
  12. package/dist/interpreter/globals.d.ts +13 -0
  13. package/dist/interpreter/globals.js +63 -0
  14. package/dist/interpreter/host.d.ts +41 -0
  15. package/dist/interpreter/host.js +44 -0
  16. package/dist/interpreter/methods.d.ts +4 -0
  17. package/dist/interpreter/methods.js +837 -0
  18. package/dist/interpreter/model.d.ts +82 -0
  19. package/dist/interpreter/model.js +86 -0
  20. package/dist/interpreter/objects.d.ts +37 -0
  21. package/dist/interpreter/objects.js +151 -0
  22. package/dist/interpreter/promises.d.ts +31 -0
  23. package/dist/interpreter/promises.js +271 -0
  24. package/dist/interpreter/references.d.ts +7 -0
  25. package/dist/interpreter/references.js +93 -0
  26. package/dist/interpreter/runner.d.ts +24 -0
  27. package/dist/interpreter/runner.js +45 -0
  28. package/dist/interpreter/runtime.d.ts +19 -0
  29. package/dist/interpreter/runtime.js +1940 -0
  30. package/dist/interpreter/scope.d.ts +15 -0
  31. package/dist/interpreter/scope.js +79 -0
  32. package/dist/interpreter/transpile.node.d.ts +5 -0
  33. package/dist/interpreter/transpile.node.js +19 -0
  34. package/dist/interpreter/transpile.workerd.d.ts +5 -0
  35. package/dist/interpreter/transpile.workerd.js +6 -0
  36. package/dist/namespace.d.ts +15 -0
  37. package/dist/namespace.js +7 -0
  38. package/dist/openapi/index.d.ts +7 -0
  39. package/dist/openapi/index.js +101 -0
  40. package/dist/openapi/runtime.d.ts +4 -0
  41. package/dist/openapi/runtime.js +283 -0
  42. package/dist/openapi/spec.d.ts +20 -0
  43. package/dist/openapi/spec.js +583 -0
  44. package/dist/openapi/types.d.ts +122 -0
  45. package/dist/openapi/types.js +2 -0
  46. package/dist/stdlib/array.d.ts +3 -0
  47. package/dist/stdlib/array.js +68 -0
  48. package/dist/stdlib/collections.d.ts +9 -0
  49. package/dist/stdlib/collections.js +173 -0
  50. package/dist/stdlib/console.d.ts +3 -0
  51. package/dist/stdlib/console.js +137 -0
  52. package/dist/stdlib/date.d.ts +8 -0
  53. package/dist/stdlib/date.js +208 -0
  54. package/dist/stdlib/json.d.ts +3 -0
  55. package/dist/stdlib/json.js +101 -0
  56. package/dist/stdlib/math.d.ts +8 -0
  57. package/dist/stdlib/math.js +89 -0
  58. package/dist/stdlib/number.d.ts +4 -0
  59. package/dist/stdlib/number.js +69 -0
  60. package/dist/stdlib/object.d.ts +7 -0
  61. package/dist/stdlib/object.js +106 -0
  62. package/dist/stdlib/regexp.d.ts +10 -0
  63. package/dist/stdlib/regexp.js +120 -0
  64. package/dist/stdlib/string.d.ts +2 -0
  65. package/dist/stdlib/string.js +51 -0
  66. package/dist/stdlib/url.d.ts +16 -0
  67. package/dist/stdlib/url.js +161 -0
  68. package/dist/stdlib/value.d.ts +13 -0
  69. package/dist/stdlib/value.js +120 -0
  70. package/dist/stdlib/web.d.ts +4 -0
  71. package/dist/stdlib/web.js +20 -0
  72. package/dist/tool-error.d.ts +11 -0
  73. package/dist/tool-error.js +9 -0
  74. package/dist/tool-runtime.d.ts +69 -0
  75. package/dist/tool-runtime.js +254 -0
  76. package/dist/tool-schema.d.ts +16 -0
  77. package/dist/tool-schema.js +263 -0
  78. package/dist/tool.d.ts +66 -0
  79. package/dist/tool.js +16 -0
  80. package/dist/tools.d.ts +5 -0
  81. package/dist/tools.js +1 -0
  82. package/dist/values.d.ts +37 -0
  83. package/dist/values.js +56 -0
  84. package/package.json +37 -6
package/dist/values.js ADDED
@@ -0,0 +1,56 @@
1
+ export * as Values from "./values.js";
2
+ /**
3
+ * Runtime values the interpreter recognizes by class. Each wraps the host value it stands for,
4
+ * so hosts construct these to hand a value to a program and receive them back unchanged.
5
+ */
6
+ export class Promise {
7
+ fiber;
8
+ constructor(fiber) {
9
+ this.fiber = fiber;
10
+ }
11
+ }
12
+ export class Date {
13
+ time;
14
+ constructor(time) {
15
+ this.time = time;
16
+ }
17
+ }
18
+ export class RegExp {
19
+ regex;
20
+ constructor(pattern, flags) {
21
+ this.regex = new globalThis.RegExp(pattern, flags);
22
+ }
23
+ get lastIndex() {
24
+ return Reflect.get(this.regex, "lastIndex");
25
+ }
26
+ set lastIndex(value) {
27
+ Reflect.set(this.regex, "lastIndex", value);
28
+ }
29
+ }
30
+ export class Map {
31
+ map = new globalThis.Map();
32
+ }
33
+ export class Set {
34
+ set = new globalThis.Set();
35
+ }
36
+ export class URLSearchParams {
37
+ params;
38
+ constructor(params) {
39
+ this.params = params;
40
+ }
41
+ }
42
+ export class URL {
43
+ url;
44
+ searchParams;
45
+ constructor(url) {
46
+ this.url = url;
47
+ this.searchParams = new URLSearchParams(url.searchParams);
48
+ }
49
+ }
50
+ /** Data-like runtime values; excludes Promise, which never crosses a boundary. */
51
+ export const isValue = (value) => value instanceof Date ||
52
+ value instanceof RegExp ||
53
+ value instanceof Map ||
54
+ value instanceof Set ||
55
+ value instanceof URL ||
56
+ value instanceof URLSearchParams;
package/package.json CHANGED
@@ -1,15 +1,46 @@
1
1
  {
2
+ "$schema": "https://json.schemastore.org/package.json",
2
3
  "name": "@opencode/codemode",
3
- "version": "0.0.0-reserved",
4
- "description": "OpenCode package bootstrap not a functional release",
4
+ "version": "2.0.0",
5
+ "description": "Effect-native confined code execution over schema-described tools",
6
+ "type": "module",
5
7
  "license": "MIT",
6
8
  "repository": {
7
9
  "type": "git",
8
- "url": "git+https://github.com/anomalyco/opencode.git"
10
+ "url": "git+https://github.com/anomalyco/opencode.git",
11
+ "directory": "packages/codemode"
9
12
  },
10
13
  "publishConfig": {
11
- "registry": "https://registry.npmjs.org",
12
- "access": "public",
13
- "tag": "reserved"
14
+ "access": "public"
15
+ },
16
+ "files": [
17
+ "dist"
18
+ ],
19
+ "exports": {
20
+ ".": {
21
+ "import": "./dist/index.js",
22
+ "types": "./dist/index.d.ts"
23
+ }
24
+ },
25
+ "imports": {
26
+ "#transpile": {
27
+ "workerd": "./dist/interpreter/transpile.workerd.js",
28
+ "default": "./dist/interpreter/transpile.node.js"
29
+ }
30
+ },
31
+ "scripts": {
32
+ "build": "bun run script/build.ts",
33
+ "typecheck": "tsgo --noEmit",
34
+ "test": "bun test"
35
+ },
36
+ "dependencies": {
37
+ "acorn": "8.15.0",
38
+ "effect": "4.0.0-rc.112",
39
+ "typescript": "5.8.2"
40
+ },
41
+ "devDependencies": {
42
+ "@tsconfig/bun": "1.0.9",
43
+ "@types/bun": "1.4.0",
44
+ "@typescript/native-preview": "7.0.0-dev.20251207.1"
14
45
  }
15
46
  }