@gutilab/sdk 0.0.0-stage → 0.10.0-rc.1

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/package.json CHANGED
@@ -1,6 +1,29 @@
1
1
  {
2
2
  "name": "@gutilab/sdk",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "0.10.0-rc.1",
4
+ "license": "MIT",
5
+ "type": "module",
6
+ "exports": {
7
+ ".": {
8
+ "types": "./dist/index.d.ts",
9
+ "default": "./dist/index.js"
10
+ }
11
+ },
12
+ "bin": {
13
+ "gutilab-sdk": "./dist/main.js"
14
+ },
15
+ "files": [
16
+ "dist",
17
+ "template"
18
+ ],
19
+ "engines": {
20
+ "node": ">=24.11.0"
21
+ },
22
+ "dependencies": {
23
+ "birpc": "^4.2.0",
24
+ "commander": "^15.1.0"
25
+ },
26
+ "peerDependencies": {
27
+ "zod": "^4.0.0"
28
+ }
6
29
  }
@@ -0,0 +1 @@
1
+ node_modules/
@@ -0,0 +1,19 @@
1
+ {
2
+ "private": true,
3
+ "type": "module",
4
+ "engines": {
5
+ "node": ">=24.11.0"
6
+ },
7
+ "scripts": {
8
+ "start": "node src/main.ts",
9
+ "typecheck": "tsc"
10
+ },
11
+ "dependencies": {
12
+ "@gutilab/sdk": "0.0.0",
13
+ "zod": "^4.0.0"
14
+ },
15
+ "devDependencies": {
16
+ "@types/node": "^24.0.0",
17
+ "typescript": "^6.0.0"
18
+ }
19
+ }
@@ -0,0 +1,14 @@
1
+ import { runAgent } from '@gutilab/sdk';
2
+ import { nodes } from './nodes.ts';
3
+
4
+ const stop = new AbortController();
5
+ process.once('SIGTERM', () => {
6
+ stop.abort();
7
+ });
8
+
9
+ await runAgent({
10
+ url: process.env.ORCHESTRATOR_URL ?? '',
11
+ auth: { kind: 'agent', token: process.env.AGENT_TOKEN ?? '' },
12
+ nodes,
13
+ signal: stop.signal,
14
+ });
@@ -0,0 +1,21 @@
1
+ import { defineNode } from '@gutilab/sdk';
2
+ import { z } from 'zod';
3
+
4
+ export const ocr = defineNode({
5
+ identifier: 'acme.ocr',
6
+ version: '1.0.0',
7
+ inputs: { file: z.string() },
8
+ outputs: { text: z.string(), lang: z.string().optional() },
9
+ parameters: { lang: z.enum(['fr', 'en']).default('fr') },
10
+ async run({ inputs, parameters, signal, log }) {
11
+ log.info(`Reading ${inputs.file} in ${parameters.lang}`);
12
+ const response = await fetch(inputs.file, { signal });
13
+ if (!response.ok) {
14
+ throw new Error(`Cannot read ${inputs.file}: HTTP ${response.status}`);
15
+ }
16
+ return { text: await response.text(), lang: parameters.lang };
17
+ },
18
+ });
19
+
20
+ // The nodes of this agent: `gutilab-sdk dev` and `gutilab-sdk validate` read this list, and `main.ts` runs it.
21
+ export const nodes = [ocr];
@@ -0,0 +1,12 @@
1
+ {
2
+ "compilerOptions": {
3
+ "module": "nodenext",
4
+ "strict": true,
5
+ "noEmit": true,
6
+ "erasableSyntaxOnly": true,
7
+ "allowImportingTsExtensions": true,
8
+ "verbatimModuleSyntax": true,
9
+ "types": ["node"]
10
+ },
11
+ "include": ["src"]
12
+ }