@node-agent/provider 0.1.9 → 0.1.10

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.
@@ -0,0 +1,7 @@
1
+ import type { NodeClass } from '@node-agent/sdk';
2
+ /** Register, say where, and stay until a signal arrives.
3
+ *
4
+ * The choices -- which address, and which words under it -- are `serveOptions(providerMode(argv))`:
5
+ * `local-provider` with its own label under `--local`, and nothing at all otherwise, so a shared
6
+ * provider keeps the package's name and the package's words. */
7
+ export declare function runProgram(Node: NodeClass, argv?: readonly string[]): Promise<void>;
@@ -0,0 +1,35 @@
1
+ // The body behind the provider's two bins: `provider` (dist/serve.js) and `provider-entry`
2
+ // (dist/index.js).
3
+ //
4
+ // It lives in its own module, and takes the Node class as an argument, because of one hard rule of
5
+ // this package: `dist/index.js` is both the CLI and the module the SDK loader imports for the class.
6
+ // An entry that awaited `servePackage` would wait for the loader, which waits for that same entry's
7
+ // evaluation -- the process then printed `unsettled top-level await` and joined nothing. With the
8
+ // class handed in, the entry serves its own definition and never re-imports itself.
9
+ import { fileURLToPath } from 'node:url';
10
+ import { nodeManifestOfPackage, serveDefinition } from '@node-agent/sdk';
11
+ import { providerMode, serveOptions } from './mode.js';
12
+ const BUS_URL = process.env.NODE_AGENT_BUS_URL ?? 'ws://127.0.0.1:8788';
13
+ function untilStopped() {
14
+ return new Promise((resolve) => {
15
+ process.once('SIGINT', () => resolve());
16
+ process.once('SIGTERM', () => resolve());
17
+ });
18
+ }
19
+ /** Register, say where, and stay until a signal arrives.
20
+ *
21
+ * The choices -- which address, and which words under it -- are `serveOptions(providerMode(argv))`:
22
+ * `local-provider` with its own label under `--local`, and nothing at all otherwise, so a shared
23
+ * provider keeps the package's name and the package's words. */
24
+ export async function runProgram(Node, argv = process.argv.slice(2)) {
25
+ const root = fileURLToPath(new URL('..', import.meta.url));
26
+ const host = await serveDefinition({ manifest: nodeManifestOfPackage(root), Node }, serveOptions(providerMode(argv))).catch((error) => {
27
+ const message = error instanceof Error ? error.message : String(error);
28
+ console.error(`provider: cannot join ${BUS_URL}: ${message}`);
29
+ process.exit(1);
30
+ });
31
+ console.log(`${host.manifest.name}: joined ${BUS_URL}`);
32
+ await untilStopped();
33
+ await host.stop();
34
+ }
35
+ //# sourceMappingURL=program.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"program.js","sourceRoot":"","sources":["../src/program.ts"],"names":[],"mappings":"AAAA,2FAA2F;AAC3F,mBAAmB;AACnB,EAAE;AACF,mGAAmG;AACnG,qGAAqG;AACrG,oGAAoG;AACpG,kGAAkG;AAClG,oFAAoF;AACpF,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,qBAAqB,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAEzE,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAEvD,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,kBAAkB,IAAI,qBAAqB,CAAC;AAExE,SAAS,YAAY;IACnB,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;QAC7B,OAAO,CAAC,IAAI,CAAC,QAAQ,EAAE,GAAG,EAAE,CAAC,OAAO,EAAE,CAAC,CAAC;QACxC,OAAO,CAAC,IAAI,CAAC,SAAS,EAAE,GAAG,EAAE,CAAC,OAAO,EAAE,CAAC,CAAC;IAC3C,CAAC,CAAC,CAAC;AACL,CAAC;AAED;;;;iEAIiE;AACjE,MAAM,CAAC,KAAK,UAAU,UAAU,CAC9B,IAAe,EACf,IAAI,GAAsB,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;IAE/C,MAAM,IAAI,GAAG,aAAa,CAAC,IAAI,GAAG,CAAC,IAAI,EAAE,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;IAC3D,MAAM,IAAI,GAAG,MAAM,eAAe,CAChC,EAAE,QAAQ,EAAE,qBAAqB,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,EAC/C,YAAY,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,CACjC,CAAC,KAAK,CAAC,CAAC,KAAc,EAAE,EAAE;QACzB,MAAM,OAAO,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QACvE,OAAO,CAAC,KAAK,CAAC,yBAAyB,OAAO,KAAK,OAAO,EAAE,CAAC,CAAC;QAC9D,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC,CAAC,CAAC;IAEH,OAAO,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC,IAAI,YAAY,OAAO,EAAE,CAAC,CAAC;IAExD,MAAM,YAAY,EAAE,CAAC;IACrB,MAAM,IAAI,CAAC,IAAI,EAAE,CAAC;AACpB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@node-agent/provider",
3
- "version": "0.1.9",
3
+ "version": "0.1.10",
4
4
  "type": "module",
5
5
  "description": "Independent named LLM provider node (TypeScript)",
6
6
  "publisher": "node-agent",
@@ -36,7 +36,7 @@
36
36
  "id": "provider",
37
37
  "i18n": "dist/i18n",
38
38
  "desc": "Named LLM serving: OpenAI, Anthropic and Responses behind one row",
39
- "entry": "dist/index.js",
39
+ "entry": "dist/serve.js",
40
40
  "icon": "src/icon.svg",
41
41
  "caps": {
42
42
  "providers": {
@@ -190,7 +190,6 @@
190
190
  "access": "public"
191
191
  },
192
192
  "bin": {
193
- "provider": "dist/serve.js",
194
- "provider-entry": "dist/index.js"
193
+ "provider": "dist/serve.js"
195
194
  }
196
195
  }