@bendyline/gezel-sdk 1.0.9 → 1.1.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.
- package/README.md +28 -1
- package/dist/checks.d.ts +84 -2
- package/dist/checks.js +1352 -852
- package/dist/index.d.ts +5 -711
- package/dist/index.js +102 -91
- package/dist/portable.d.ts +742 -0
- package/dist/portable.js +102 -0
- package/dist/{types-DCBb1goX.d.ts → types-rOo0kM35.d.ts} +1 -1
- package/package.json +6 -2
package/dist/portable.js
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
// src/portable.ts
|
|
2
|
+
function defineScript(meta) {
|
|
3
|
+
return meta;
|
|
4
|
+
}
|
|
5
|
+
function createGezelSDK(rpc, options = {}) {
|
|
6
|
+
let outputStamped = false;
|
|
7
|
+
return {
|
|
8
|
+
get input() {
|
|
9
|
+
return rpc.init.input ?? {};
|
|
10
|
+
},
|
|
11
|
+
output(value) {
|
|
12
|
+
if (outputStamped) {
|
|
13
|
+
throw new Error(
|
|
14
|
+
"gezel.output() called more than once \u2014 a script may only stamp one output"
|
|
15
|
+
);
|
|
16
|
+
}
|
|
17
|
+
outputStamped = true;
|
|
18
|
+
rpc.notify("script.output", { value });
|
|
19
|
+
},
|
|
20
|
+
log(...args) {
|
|
21
|
+
rpc.notify("script.log", { args });
|
|
22
|
+
options.log?.(...args);
|
|
23
|
+
},
|
|
24
|
+
fs: {
|
|
25
|
+
read: (path) => rpc.call("fs.read", { path }),
|
|
26
|
+
write: (path, content) => rpc.call("fs.write", { path, content }),
|
|
27
|
+
list: (path) => rpc.call("fs.list", { path }),
|
|
28
|
+
listAll: () => rpc.call("fs.listAll"),
|
|
29
|
+
stat: (path) => rpc.call("fs.stat", { path }),
|
|
30
|
+
rm: (path) => rpc.call("fs.rm", { path }),
|
|
31
|
+
mkdir: (path) => rpc.call("fs.mkdir", { path }),
|
|
32
|
+
rename: (from, to) => rpc.call("fs.rename", { from, to })
|
|
33
|
+
},
|
|
34
|
+
artifacts: {
|
|
35
|
+
read: (path) => rpc.call("artifact.read", { path }),
|
|
36
|
+
write: (path, content) => rpc.call("artifact.write", { path, content }),
|
|
37
|
+
list: (prefix, opts) => rpc.call("artifact.list", {
|
|
38
|
+
prefix,
|
|
39
|
+
...opts?.recursive ? { recursive: true } : {}
|
|
40
|
+
}),
|
|
41
|
+
delete: (path) => rpc.call("artifact.delete", { path })
|
|
42
|
+
},
|
|
43
|
+
documents: {
|
|
44
|
+
read: (name) => rpc.call("document.read", { name }),
|
|
45
|
+
write: (name, content) => rpc.call("document.write", { name, content }),
|
|
46
|
+
list: () => rpc.call("document.list"),
|
|
47
|
+
delete: (name) => rpc.call("document.delete", { name })
|
|
48
|
+
},
|
|
49
|
+
task: {
|
|
50
|
+
get: (ref) => rpc.call("task.get", { ref }),
|
|
51
|
+
steps: (ref) => rpc.call("task.steps", { ref }),
|
|
52
|
+
currentStep: (ref) => rpc.call("task.currentStep", { ref }),
|
|
53
|
+
update: (ref, patch) => rpc.call("task.update", { ref, patch }),
|
|
54
|
+
advance: (ref, nextPhaseName) => rpc.call("task.advance", { ref, nextPhaseName }),
|
|
55
|
+
writeNotes: (ref, content, phaseId) => rpc.call("task.writeNotes", { ref, content, phaseId }),
|
|
56
|
+
appendNote: (ref, text, stepId) => rpc.call("task.appendNote", { ref, text, stepId }),
|
|
57
|
+
readNotes: (ref, phaseId) => rpc.call("task.readNotes", { ref, phaseId }),
|
|
58
|
+
deleteNote: (ref, noteId) => rpc.call("task.deleteNote", { ref, noteId }),
|
|
59
|
+
create: (req) => rpc.call("task.create", { req })
|
|
60
|
+
},
|
|
61
|
+
memory: {
|
|
62
|
+
search: (query) => rpc.call("memory.search", { query }),
|
|
63
|
+
save: (text, meta) => rpc.call("memory.save", { text, meta })
|
|
64
|
+
},
|
|
65
|
+
llm: {
|
|
66
|
+
oneShot: (prompt, opts) => rpc.call("llm.oneShot", { prompt, opts })
|
|
67
|
+
},
|
|
68
|
+
mcp: {
|
|
69
|
+
call: (tool, args) => rpc.call("mcp.call", { tool, args })
|
|
70
|
+
},
|
|
71
|
+
index: {
|
|
72
|
+
status: () => rpc.call("index.status"),
|
|
73
|
+
ensureFresh: (opts) => rpc.call("index.ensureFresh", {
|
|
74
|
+
...opts?.waitBudgetMs !== void 0 ? { waitBudgetMs: opts.waitBudgetMs } : {},
|
|
75
|
+
...opts?.reviews !== void 0 ? { reviews: opts.reviews } : {}
|
|
76
|
+
})
|
|
77
|
+
},
|
|
78
|
+
http: {
|
|
79
|
+
request: (url, opts) => rpc.call("http.request", {
|
|
80
|
+
url,
|
|
81
|
+
...opts?.method ? { method: opts.method } : {},
|
|
82
|
+
...opts?.body !== void 0 ? { body: opts.body } : {},
|
|
83
|
+
...opts?.headers ? { headers: opts.headers } : {}
|
|
84
|
+
}),
|
|
85
|
+
authed: (url, opts) => rpc.call("http.authed", {
|
|
86
|
+
url,
|
|
87
|
+
credential: opts.credential,
|
|
88
|
+
...opts.method ? { method: opts.method } : {},
|
|
89
|
+
...opts.body !== void 0 ? { body: opts.body } : {},
|
|
90
|
+
...opts.headers ? { headers: opts.headers } : {},
|
|
91
|
+
...opts.authScheme ? { authScheme: opts.authScheme } : {}
|
|
92
|
+
})
|
|
93
|
+
},
|
|
94
|
+
script: {
|
|
95
|
+
run: (name, input) => rpc.call("script.run", { name, input })
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
export {
|
|
100
|
+
createGezelSDK,
|
|
101
|
+
defineScript
|
|
102
|
+
};
|
|
@@ -279,4 +279,4 @@ type InferOutput<O extends ScriptOutputs | undefined> = O extends ScriptOutputs
|
|
|
279
279
|
[K in keyof O]: ResolvedOutputValue<O[K]>;
|
|
280
280
|
} : unknown;
|
|
281
281
|
|
|
282
|
-
export type { GateScriptResult as G, InferInput as I,
|
|
282
|
+
export type { GateScriptResult as G, InferInput as I, ScriptArrayOutput as S, InferOutput as a, ScriptBooleanInput as b, ScriptBooleanOutput as c, ScriptCapability as d, ScriptChoiceInput as e, ScriptChoiceOption as f, ScriptInputField as g, ScriptInputs as h, ScriptJsonInput as i, ScriptJsonOutput as j, ScriptMeta as k, ScriptNumberInput as l, ScriptNumberOutput as m, ScriptObjectOutput as n, ScriptOutputField as o, ScriptOutputs as p, ScriptRefInput as q, ScriptStringInput as r, ScriptStringOutput as s };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bendyline/gezel-sdk",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "SDK imported by scripts running in the Gezel sandbox. Exposes the `gezel` object and `defineScript` helper.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"keywords": [
|
|
@@ -40,6 +40,10 @@
|
|
|
40
40
|
"types": "./dist/index.d.ts",
|
|
41
41
|
"import": "./dist/index.js"
|
|
42
42
|
},
|
|
43
|
+
"./portable": {
|
|
44
|
+
"types": "./dist/portable.d.ts",
|
|
45
|
+
"import": "./dist/portable.js"
|
|
46
|
+
},
|
|
43
47
|
"./checks": {
|
|
44
48
|
"types": "./dist/checks.d.ts",
|
|
45
49
|
"import": "./dist/checks.js"
|
|
@@ -59,7 +63,7 @@
|
|
|
59
63
|
"!dist/**/*.map"
|
|
60
64
|
],
|
|
61
65
|
"devDependencies": {
|
|
62
|
-
"@bendyline/gezel": "1.
|
|
66
|
+
"@bendyline/gezel": "1.2.0",
|
|
63
67
|
"tsup": "^8.5.1",
|
|
64
68
|
"typescript": "^6.0.3",
|
|
65
69
|
"vitest": "^4.1.10"
|