@grackle-ai/adapter-local 0.72.2

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 ADDED
@@ -0,0 +1,18 @@
1
+ # @grackle-ai/adapter-local
2
+
3
+ Grackle environment adapter for connecting to a locally-running PowerLine process.
4
+
5
+ ## Overview
6
+
7
+ The local adapter connects to a PowerLine gRPC server on the same machine. It is the simplest adapter — no tunneling, no remote provisioning.
8
+
9
+ ## Configuration
10
+
11
+ | Field | Type | Default | Description |
12
+ |-------|------|---------|-------------|
13
+ | `port` | `number` | `7433` | PowerLine port |
14
+ | `host` | `string` | `"localhost"` | PowerLine host |
15
+
16
+ ## Prerequisites
17
+
18
+ - A locally-running PowerLine process (typically managed by the Grackle server)
@@ -0,0 +1,3 @@
1
+ export { LocalAdapter } from "./local.js";
2
+ export type { LocalEnvironmentConfig } from "./local.js";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC1C,YAAY,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,2 @@
1
+ export { LocalAdapter } from "./local.js";
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC"}
@@ -0,0 +1,17 @@
1
+ import type { EnvironmentAdapter, BaseEnvironmentConfig, PowerLineConnection, ProvisionEvent, AdapterDependencies } from "@grackle-ai/adapter-sdk";
2
+ /** Local-specific environment configuration. */
3
+ export interface LocalEnvironmentConfig extends BaseEnvironmentConfig {
4
+ }
5
+ /** Environment adapter that connects to a locally-running PowerLine process. */
6
+ export declare class LocalAdapter implements EnvironmentAdapter {
7
+ type: string;
8
+ private readonly sleep;
9
+ constructor(deps?: AdapterDependencies);
10
+ provision(environmentId: string, config: Record<string, unknown>, powerlineToken: string): AsyncGenerator<ProvisionEvent>;
11
+ connect(environmentId: string, config: Record<string, unknown>, powerlineToken: string): Promise<PowerLineConnection>;
12
+ disconnect(): Promise<void>;
13
+ stop(): Promise<void>;
14
+ destroy(): Promise<void>;
15
+ healthCheck(connection: PowerLineConnection): Promise<boolean>;
16
+ }
17
+ //# sourceMappingURL=local.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"local.d.ts","sourceRoot":"","sources":["../src/local.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAMnJ,gDAAgD;AAChD,MAAM,WAAW,sBAAuB,SAAQ,qBAAqB;CAEpE;AAED,gFAAgF;AAChF,qBAAa,YAAa,YAAW,kBAAkB;IAC9C,IAAI,EAAE,MAAM,CAAW;IAC9B,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAgC;gBAEnC,IAAI,GAAE,mBAAwB;IAInC,SAAS,CAAC,aAAa,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,EAAE,MAAM,GAAG,cAAc,CAAC,cAAc,CAAC;IAyB1H,OAAO,CAAC,aAAa,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,mBAAmB,CAAC;IAWrH,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAI3B,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAIrB,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAIxB,WAAW,CAAC,UAAU,EAAE,mBAAmB,GAAG,OAAO,CAAC,OAAO,CAAC;CAQ5E"}
package/dist/local.js ADDED
@@ -0,0 +1,60 @@
1
+ import { DEFAULT_POWERLINE_PORT } from "@grackle-ai/common";
2
+ import { createPowerLineClient, sleep as defaultSleep } from "@grackle-ai/adapter-sdk";
3
+ const POWERLINE_RETRY_DELAY_MS = 1_000;
4
+ const POWERLINE_MAX_RETRIES = 5;
5
+ /** Environment adapter that connects to a locally-running PowerLine process. */
6
+ export class LocalAdapter {
7
+ type = "local";
8
+ sleep;
9
+ constructor(deps = {}) {
10
+ this.sleep = deps.sleep ?? defaultSleep;
11
+ }
12
+ async *provision(environmentId, config, powerlineToken) {
13
+ const cfg = config;
14
+ const port = cfg.port || DEFAULT_POWERLINE_PORT;
15
+ const host = cfg.host || "localhost";
16
+ yield { stage: "connecting", message: `Connecting to PowerLine at ${host}:${port}...`, progress: 0.5 };
17
+ const client = createPowerLineClient(`http://${host}:${port}`, powerlineToken);
18
+ let lastErr;
19
+ for (let attempt = 0; attempt < POWERLINE_MAX_RETRIES; attempt++) {
20
+ try {
21
+ await client.ping({});
22
+ yield { stage: "ready", message: "Connected to local PowerLine", progress: 1 };
23
+ return;
24
+ }
25
+ catch (err) {
26
+ lastErr = err;
27
+ yield { stage: "connecting", message: `Waiting for PowerLine (attempt ${attempt + 1}/${POWERLINE_MAX_RETRIES})...`, progress: 0.5 + attempt * 0.1 };
28
+ await this.sleep(POWERLINE_RETRY_DELAY_MS);
29
+ }
30
+ }
31
+ yield { stage: "error", message: `Could not reach PowerLine: ${lastErr instanceof Error ? lastErr.message : String(lastErr)}`, progress: 0 };
32
+ }
33
+ async connect(environmentId, config, powerlineToken) {
34
+ const cfg = config;
35
+ const port = cfg.port || DEFAULT_POWERLINE_PORT;
36
+ const host = cfg.host || "localhost";
37
+ const client = createPowerLineClient(`http://${host}:${port}`, powerlineToken);
38
+ await client.ping({});
39
+ return { client, environmentId, port };
40
+ }
41
+ async disconnect() {
42
+ // Nothing to clean up for local connections
43
+ }
44
+ async stop() {
45
+ // Local PowerLine lifecycle is managed externally
46
+ }
47
+ async destroy() {
48
+ // Local PowerLine lifecycle is managed externally
49
+ }
50
+ async healthCheck(connection) {
51
+ try {
52
+ await connection.client.ping({});
53
+ return true;
54
+ }
55
+ catch {
56
+ return false;
57
+ }
58
+ }
59
+ }
60
+ //# sourceMappingURL=local.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"local.js","sourceRoot":"","sources":["../src/local.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAE5D,OAAO,EAAE,qBAAqB,EAAE,KAAK,IAAI,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAEvF,MAAM,wBAAwB,GAAW,KAAK,CAAC;AAC/C,MAAM,qBAAqB,GAAW,CAAC,CAAC;AAOxC,gFAAgF;AAChF,MAAM,OAAO,YAAY;IAChB,IAAI,GAAW,OAAO,CAAC;IACb,KAAK,CAAgC;IAEtD,YAAmB,OAA4B,EAAE;QAC/C,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,IAAI,YAAY,CAAC;IAC1C,CAAC;IAEM,KAAK,CAAC,CAAC,SAAS,CAAC,aAAqB,EAAE,MAA+B,EAAE,cAAsB;QACpG,MAAM,GAAG,GAAG,MAA2C,CAAC;QACxD,MAAM,IAAI,GAAG,GAAG,CAAC,IAAI,IAAI,sBAAsB,CAAC;QAChD,MAAM,IAAI,GAAG,GAAG,CAAC,IAAI,IAAI,WAAW,CAAC;QAErC,MAAM,EAAE,KAAK,EAAE,YAAY,EAAE,OAAO,EAAE,8BAA8B,IAAI,IAAI,IAAI,KAAK,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC;QAEvG,MAAM,MAAM,GAAG,qBAAqB,CAAC,UAAU,IAAI,IAAI,IAAI,EAAE,EAAE,cAAc,CAAC,CAAC;QAE/E,IAAI,OAAgB,CAAC;QACrB,KAAK,IAAI,OAAO,GAAG,CAAC,EAAE,OAAO,GAAG,qBAAqB,EAAE,OAAO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C;IAEM,KAAK,CAAC,IAAI;QACf,kDAAkD;IACpD,CAAC;IAEM,KAAK,CAAC,OAAO;QAClB,kDAAkD;IACpD,CAAC;IAEM,KAAK,CAAC,WAAW,CAAC,UAA+B;QACtD,IAAI,CAAC;YACH,MAAM,UAAU,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;YACjC,OAAO,IAAI,CAAC;QACd,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,KAAK,CAAC;QACf,CAAC;IACH,CAAC;CACF"}
@@ -0,0 +1,11 @@
1
+ // This file is read by tools that parse documentation comments conforming to the TSDoc standard.
2
+ // It should be published with your NPM package. It should not be tracked by Git.
3
+ {
4
+ "tsdocVersion": "0.12",
5
+ "toolPackages": [
6
+ {
7
+ "packageName": "@microsoft/api-extractor",
8
+ "packageVersion": "7.57.7"
9
+ }
10
+ ]
11
+ }
package/package.json ADDED
@@ -0,0 +1,43 @@
1
+ {
2
+ "name": "@grackle-ai/adapter-local",
3
+ "version": "0.72.2",
4
+ "description": "Grackle local environment adapter",
5
+ "license": "MIT",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "https://github.com/nick-pape/grackle.git",
9
+ "directory": "packages/adapter-local"
10
+ },
11
+ "keywords": [
12
+ "grackle",
13
+ "adapter",
14
+ "local",
15
+ "environment"
16
+ ],
17
+ "engines": {
18
+ "node": ">=22.0.0"
19
+ },
20
+ "type": "module",
21
+ "main": "dist/index.js",
22
+ "types": "dist/index.d.ts",
23
+ "files": [
24
+ "dist/"
25
+ ],
26
+ "dependencies": {
27
+ "@grackle-ai/adapter-sdk": "0.72.2",
28
+ "@grackle-ai/common": "0.72.2"
29
+ },
30
+ "devDependencies": {
31
+ "@rushstack/heft": "1.2.7",
32
+ "@types/node": "^22.0.0",
33
+ "vitest": "^3.1.1",
34
+ "@grackle-ai/heft-rig": "0.0.1"
35
+ },
36
+ "scripts": {
37
+ "build": "heft build --clean",
38
+ "test": "vitest run",
39
+ "clean": "heft clean",
40
+ "_phase:build": "heft run --only build -- --clean",
41
+ "_phase:test": "vitest run"
42
+ }
43
+ }