@nimbus-dev/client 0.2.3

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/paths.js ADDED
@@ -0,0 +1,57 @@
1
+ import { homedir, tmpdir } from "node:os";
2
+ import { join as joinNative } from "node:path";
3
+ import { join as joinPosix } from "node:path/posix";
4
+ function envOrEmpty(key) {
5
+ const v = process.env[key];
6
+ return typeof v === "string" ? v : "";
7
+ }
8
+ export function getNimbusPaths() {
9
+ switch (process.platform) {
10
+ case "win32": {
11
+ const appData = envOrEmpty("APPDATA");
12
+ const localAppData = envOrEmpty("LOCALAPPDATA");
13
+ if (appData.length === 0) {
14
+ throw new Error("APPDATA is not set. Nimbus requires a standard Windows user profile.");
15
+ }
16
+ if (localAppData.length === 0) {
17
+ throw new Error("LOCALAPPDATA is not set. Nimbus requires a standard Windows user profile.");
18
+ }
19
+ const configDir = joinNative(appData, "Nimbus");
20
+ const dataDir = joinNative(localAppData, "Nimbus", "data");
21
+ return {
22
+ configDir,
23
+ dataDir,
24
+ logDir: joinNative(dataDir, "logs"),
25
+ socketPath: String.raw `\\.\pipe\nimbus-gateway`,
26
+ extensionsDir: joinNative(localAppData, "Nimbus", "extensions"),
27
+ };
28
+ }
29
+ case "darwin": {
30
+ const root = joinPosix(homedir(), "Library", "Application Support", "Nimbus");
31
+ const tmp = envOrEmpty("TMPDIR") || "/tmp";
32
+ return {
33
+ configDir: root,
34
+ dataDir: root,
35
+ logDir: joinPosix(root, "logs"),
36
+ socketPath: joinPosix(tmp, "nimbus-gateway.sock"),
37
+ extensionsDir: joinPosix(root, "extensions"),
38
+ };
39
+ }
40
+ default: {
41
+ const home = homedir();
42
+ const configRoot = envOrEmpty("XDG_CONFIG_HOME") || joinPosix(home, ".config");
43
+ const dataRoot = envOrEmpty("XDG_DATA_HOME") || joinPosix(home, ".local", "share");
44
+ const runtimeDir = envOrEmpty("XDG_RUNTIME_DIR") || tmpdir();
45
+ const configDir = joinPosix(configRoot, "nimbus");
46
+ const dataDir = joinPosix(dataRoot, "nimbus");
47
+ return {
48
+ configDir,
49
+ dataDir,
50
+ logDir: joinPosix(dataDir, "logs"),
51
+ socketPath: joinPosix(runtimeDir, "nimbus-gateway.sock"),
52
+ extensionsDir: joinPosix(dataDir, "extensions"),
53
+ };
54
+ }
55
+ }
56
+ }
57
+ //# sourceMappingURL=paths.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"paths.js","sourceRoot":"","sources":["../src/paths.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAC1C,OAAO,EAAE,IAAI,IAAI,UAAU,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,EAAE,IAAI,IAAI,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAWpD,SAAS,UAAU,CAAC,GAAW;IAC7B,MAAM,CAAC,GAAG,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAC3B,OAAO,OAAO,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;AACxC,CAAC;AAED,MAAM,UAAU,cAAc;IAC5B,QAAQ,OAAO,CAAC,QAAQ,EAAE,CAAC;QACzB,KAAK,OAAO,CAAC,CAAC,CAAC;YACb,MAAM,OAAO,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC;YACtC,MAAM,YAAY,GAAG,UAAU,CAAC,cAAc,CAAC,CAAC;YAChD,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;gBACzB,MAAM,IAAI,KAAK,CAAC,sEAAsE,CAAC,CAAC;YAC1F,CAAC;YACD,IAAI,YAAY,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;gBAC9B,MAAM,IAAI,KAAK,CACb,2EAA2E,CAC5E,CAAC;YACJ,CAAC;YACD,MAAM,SAAS,GAAG,UAAU,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;YA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QAAQ,EAAE,QAAQ,CAAC,CAAC;YAC9C,OAAO;gBACL,SAAS;gBACT,OAAO;gBACP,MAAM,EAAE,SAAS,CAAC,OAAO,EAAE,MAAM,CAAC;gBAClC,UAAU,EAAE,SAAS,CAAC,UAAU,EAAE,qBAAqB,CAAC;gBACxD,aAAa,EAAE,SAAS,CAAC,OAAO,EAAE,YAAY,CAAC;aAChD,CAAC;QACJ,CAAC;IACH,CAAC;AACH,CAAC"}
@@ -0,0 +1,51 @@
1
+ /**
2
+ * Events emitted by NimbusClient.askStream() over its AsyncIterable surface.
3
+ * Single discriminated union so the consumer can `switch (ev.type)`.
4
+ */
5
+ export type StreamEvent = {
6
+ readonly type: "token";
7
+ readonly text: string;
8
+ } | {
9
+ readonly type: "subTaskProgress";
10
+ readonly subTaskId: string;
11
+ readonly status: string;
12
+ readonly progress?: number;
13
+ } | {
14
+ readonly type: "hitlBatch";
15
+ readonly requestId: string;
16
+ readonly prompt: string;
17
+ readonly details?: unknown;
18
+ } | {
19
+ readonly type: "done";
20
+ readonly reply: string;
21
+ readonly sessionId: string;
22
+ } | {
23
+ readonly type: "error";
24
+ readonly code: string;
25
+ readonly message: string;
26
+ };
27
+ export type AskStreamOptions = {
28
+ sessionId?: string;
29
+ agent?: string;
30
+ signal?: AbortSignal;
31
+ };
32
+ /**
33
+ * Returned from NimbusClient.askStream(). Iterate to consume events;
34
+ * call cancel() to terminate the stream early.
35
+ */
36
+ export type AskStreamHandle = AsyncIterable<StreamEvent> & {
37
+ readonly streamId: string;
38
+ cancel(): Promise<void>;
39
+ };
40
+ /**
41
+ * HITL request payload delivered via NimbusClient.subscribeHitl().
42
+ * Independent of any stream — used for background workflow / watcher HITL.
43
+ */
44
+ export type HitlRequest = {
45
+ readonly requestId: string;
46
+ readonly prompt: string;
47
+ readonly details?: unknown;
48
+ /** Present only when the batch was produced by a known stream. */
49
+ readonly streamId?: string;
50
+ };
51
+ //# sourceMappingURL=stream-events.d.ts.map
@@ -0,0 +1 @@
1
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AACH,MAAM,MAAM,WAAW,GAAG;IACxB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;IAC3B,kEAAkE;IAClE,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;CAC5B,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=stream-events.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stream-events.js","sourceRoot":"","sources":["../src/stream-events.ts"],"names":[],"mappings":""}
package/package.json ADDED
@@ -0,0 +1,45 @@
1
+ {
2
+ "name": "@nimbus-dev/client",
3
+ "version": "0.2.3",
4
+ "license": "MIT",
5
+ "private": false,
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/nimbus-agent/Nimbus.git",
9
+ "directory": "packages/client"
10
+ },
11
+ "type": "module",
12
+ "main": "./dist/index.js",
13
+ "types": "./dist/index.d.ts",
14
+ "exports": {
15
+ ".": {
16
+ "import": "./dist/index.js",
17
+ "require": "./dist/index.cjs",
18
+ "types": "./dist/index.d.ts"
19
+ }
20
+ },
21
+ "files": [
22
+ "dist",
23
+ "README.md"
24
+ ],
25
+ "publishConfig": {
26
+ "access": "public"
27
+ },
28
+ "scripts": {
29
+ "build": "bun run build:clean && tsc -p tsconfig.build.json && bun build ./src/index.ts --bundle --target=node --format=cjs --conditions=bun --outfile=dist/index.cjs",
30
+ "build:clean": "bun -e \"import { rmSync } from 'node:fs'; try { rmSync('dist', { recursive: true }); } catch {}\"",
31
+ "clean": "bun run build:clean",
32
+ "typecheck": "tsc --noEmit",
33
+ "lint": "biome check src/",
34
+ "test": "bun test",
35
+ "prepublishOnly": "bun run build && bun run typecheck && bun test"
36
+ },
37
+ "dependencies": {
38
+ "@nimbus-dev/sdk": "workspace:*"
39
+ },
40
+ "devDependencies": {
41
+ "@types/bun": "latest",
42
+ "tsx": "^4.22.3",
43
+ "typescript": "^6.0.3"
44
+ }
45
+ }