@amd-gaia/gaia 0.1.0 → 0.2.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/dist/logger.js ADDED
@@ -0,0 +1,30 @@
1
+ // Copyright(C) 2025-2026 Advanced Micro Devices, Inc. All rights reserved.
2
+ // SPDX-License-Identifier: MIT
3
+ /**
4
+ * Minimal namespaced logger. Debug output is OFF by default and enabled via the
5
+ * `DEBUG` env var (substring match on `gaia`, or `*`). Everything goes to stderr
6
+ * so it never corrupts stdout — which the TUI owns once it is exec'd.
7
+ */
8
+ function debugEnabled() {
9
+ const d = (typeof process !== "undefined" && process.env?.["DEBUG"]) || "";
10
+ return d === "*" || d.includes("gaia");
11
+ }
12
+ export function createLogger(namespace) {
13
+ const tag = `[gaia:${namespace}]`;
14
+ return {
15
+ debug(msg, ...rest) {
16
+ if (debugEnabled())
17
+ console.error(`${tag} ${msg}`, ...rest);
18
+ },
19
+ info(msg, ...rest) {
20
+ console.error(`${tag} ${msg}`, ...rest);
21
+ },
22
+ warn(msg, ...rest) {
23
+ console.error(`${tag} WARN ${msg}`, ...rest);
24
+ },
25
+ error(msg, ...rest) {
26
+ console.error(`${tag} ERROR ${msg}`, ...rest);
27
+ },
28
+ };
29
+ }
30
+ //# sourceMappingURL=logger.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logger.js","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":"AAAA,2EAA2E;AAC3E,+BAA+B;AAC/B;;;;GAIG;AAEH,SAAS,YAAY;IACnB,MAAM,CAAC,GAAG,CAAC,OAAO,OAAO,KAAK,WAAW,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,CAAC;IAC3E,OAAO,CAAC,KAAK,GAAG,IAAI,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;AACzC,CAAC;AASD,MAAM,UAAU,YAAY,CAAC,SAAiB;IAC5C,MAAM,GAAG,GAAG,SAAS,SAAS,GAAG,CAAC;IAClC,OAAO;QACL,KAAK,CAAC,GAAG,EAAE,GAAG,IAAI;YAChB,IAAI,YAAY,EAAE;gBAAE,OAAO,CAAC,KAAK,CAAC,GAAG,GAAG,IAAI,GAAG,EAAE,EAAE,GAAG,IAAI,CAAC,CAAC;QAC9D,CAAC;QACD,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI;YACf,OAAO,CAAC,KAAK,CAAC,GAAG,GAAG,IAAI,GAAG,EAAE,EAAE,GAAG,IAAI,CAAC,CAAC;QAC1C,CAAC;QACD,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI;YACf,OAAO,CAAC,KAAK,CAAC,GAAG,GAAG,SAAS,GAAG,EAAE,EAAE,GAAG,IAAI,CAAC,CAAC;QAC/C,CAAC;QACD,KAAK,CAAC,GAAG,EAAE,GAAG,IAAI;YAChB,OAAO,CAAC,KAAK,CAAC,GAAG,GAAG,UAAU,GAAG,EAAE,EAAE,GAAG,IAAI,CAAC,CAAC;QAChD,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,100 @@
1
+ /**
2
+ * Platform/arch resolution and binary-lock loading.
3
+ *
4
+ * The lock file (`binaries.lock.json`, shipped in the published package) is the
5
+ * single source of truth for which artifacts to download for the current host
6
+ * and what their SHA-256 must be. Platform keys are
7
+ * `${process.platform}-${process.arch}`.
8
+ *
9
+ * The lock is keyed by COMPONENT first (`sidecar` and `tui`), because
10
+ * `npx @amd-gaia/gaia` needs both and they differ in three ways: platform
11
+ * coverage (the Go TUI cross-compiles to arm64 Linux/Windows, the frozen Python
12
+ * sidecar does not), version, and — since schemaVersion 3.0 — the hub lane they
13
+ * are published in.
14
+ *
15
+ * The two lanes:
16
+ *
17
+ * sidecar agents/gaia/<agentVersion>/ built by this package's release
18
+ * tui agents/terminal-hub/<tuiVersion>/ the `terminal-hub` component,
19
+ * published by the core release
20
+ *
21
+ * The TUI is therefore the SAME binary as `gaia tui` from a core install — this
22
+ * package consumes it rather than building a second copy, so the two can never
23
+ * drift in behaviour or version. Each component carries its own `baseUrl`, which
24
+ * is what schemaVersion 2.0's single top-level `baseUrl` could not express.
25
+ *
26
+ * The terminal-hub lane spells its Windows artifacts `win-x64` / `win-arm64`,
27
+ * while Node's `process.platform` gives `win32`. That difference is carried by
28
+ * the entry's `filename` (data), never by a code path — see `TUI_ARTIFACT_NAMES`.
29
+ */
30
+ /** The two binaries `npx @amd-gaia/gaia` needs. */
31
+ export declare const COMPONENTS: readonly ["sidecar", "tui"];
32
+ export type ComponentName = (typeof COMPONENTS)[number];
33
+ /** The lock schema this package reads. Loading any other major fails loudly. */
34
+ export declare const SCHEMA_MAJOR = 3;
35
+ /** One component+platform artifact entry in the lock file. */
36
+ export interface BinaryLockEntry {
37
+ /** Artifact filename as published under the component's base URL. */
38
+ filename: string;
39
+ /** Lowercase hex SHA-256 of the downloaded artifact. */
40
+ sha256: string;
41
+ /** Size in bytes (informational; not enforced). */
42
+ size?: number;
43
+ /** Basename the executable is written as on disk (with platform ext). */
44
+ executable: string;
45
+ }
46
+ /** One component's lane: where it is published, at what version, for which platforms. */
47
+ export interface ComponentLock {
48
+ /** The component's own released version — not necessarily `agentVersion`. */
49
+ componentVersion: string;
50
+ /** Download base URL for THIS component. Overridable at fetch time. */
51
+ baseUrl: string;
52
+ platforms: Record<string, BinaryLockEntry>;
53
+ }
54
+ /** The whole lock file (`binaries.lock.json`), schemaVersion 3.x. */
55
+ export interface BinaryLock {
56
+ schemaVersion: string;
57
+ agentVersion: string;
58
+ components: Record<string, ComponentLock>;
59
+ }
60
+ /**
61
+ * Platform keys the sidecar publishes for. PyInstaller freezes on the host it
62
+ * runs on and there is no arm64 Linux/Windows CI runner for it, so this is a
63
+ * strict subset of the TUI's coverage.
64
+ */
65
+ export declare const SUPPORTED_SIDECAR_PLATFORMS: readonly ["win32-x64", "darwin-arm64", "darwin-x64", "linux-x64"];
66
+ /** Platform keys the TUI publishes for (Go cross-compiles all six). */
67
+ export declare const SUPPORTED_TUI_PLATFORMS: readonly ["win32-x64", "win32-arm64", "darwin-arm64", "darwin-x64", "linux-x64", "linux-arm64"];
68
+ /** Every platform key at least one component publishes for. */
69
+ export declare const SUPPORTED_PLATFORMS: readonly ["win32-x64", "win32-arm64", "darwin-arm64", "darwin-x64", "linux-x64", "linux-arm64"];
70
+ /**
71
+ * npm platform key → the artifact name the terminal-hub lane publishes.
72
+ *
73
+ * The mapping exists for exactly one reason: terminal-hub names its Windows
74
+ * builds `win-x64` / `win-arm64` (Go's GOOS vocabulary), while our keys come
75
+ * from `process.platform`, which says `win32`. Everything else is identical.
76
+ * This table is the assertion, not the lookup — the lock's `filename` is what
77
+ * the fetcher uses, and `test/lock.test.ts` checks the two agree, so a hub-side
78
+ * rename shows up as a failing test rather than a 404 on a user's first run.
79
+ */
80
+ export declare const TUI_ARTIFACT_NAMES: Record<string, string>;
81
+ /** Resolve the current host's platform key, e.g. "win32-x64". */
82
+ export declare function currentPlatformKey(platform?: NodeJS.Platform, arch?: string): string;
83
+ /** Locate `binaries.lock.json` (package root, one level up from dist/ or src/). */
84
+ export declare function defaultLockPath(): string;
85
+ /** Load and minimally validate the lock file. */
86
+ export declare function loadLock(lockPath?: string): BinaryLock;
87
+ /** One component's lane, failing loudly when the lock does not declare it. */
88
+ export declare function componentLock(lock: BinaryLock, component: ComponentName): ComponentLock;
89
+ /** The download base URL for one component. */
90
+ export declare function componentBaseUrl(lock: BinaryLock, component: ComponentName): string;
91
+ /** The platform keys a component publishes for, per the lock. */
92
+ export declare function platformsFor(lock: BinaryLock, component: ComponentName): string[];
93
+ /**
94
+ * Resolve one component's lock entry for a platform key, failing loudly when the
95
+ * component has no build for it (e.g. the sidecar on linux-arm64).
96
+ */
97
+ export declare function resolveEntry(lock: BinaryLock, component: ComponentName, platformKey: string): BinaryLockEntry;
98
+ /** True when an entry's sha256 is the not-yet-published placeholder sentinel. */
99
+ export declare function isPlaceholderSha(sha256: string): boolean;
100
+ //# sourceMappingURL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GAAE,MAAM,CAAC,QAA2B,EAC5C,IAAI,GAAE,MAAqB,GAC1B,MAAM,CAER;AAED,mFAAmF;AACnF,wBAAgB,eAAe,IAAI,MAAM,CAGxC;AAED,iDAAiD;AACjD,wBAAgB,QAAQ,CAAC,QAAQ,GAAE,MAA0B,GAAG,UAAU,CA2DzE;AAED,8EAA8E;AAC9E,wBAAgB,aAAa,CAAC,IAAI,EAAE,UAAU,EAAE,SAAS,EAAE,aAAa,GAAG,aAAa,CASvF;AAED,+CAA+C;AAC/C,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,UAAU,EAAE,SAAS,EAAE,aAAa,GAAG,MAAM,CASnF;AAED,iEAAiE;AACjE,wBAAgB,YAAY,CAAC,IAAI,EAAE,UAAU,EAAE,SAAS,EAAE,aAAa,GAAG,MAAM,EAAE,CAEjF;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAC1B,IAAI,EAAE,UAAU,EAChB,SAAS,EAAE,aAAa,EACxB,WAAW,EAAE,MAAM,GAClB,eAAe,CAqCjB;AAED,iFAAiF;AACjF,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAGxD"}
@@ -0,0 +1,202 @@
1
+ // Copyright(C) 2025-2026 Advanced Micro Devices, Inc. All rights reserved.
2
+ // SPDX-License-Identifier: MIT
3
+ /**
4
+ * Platform/arch resolution and binary-lock loading.
5
+ *
6
+ * The lock file (`binaries.lock.json`, shipped in the published package) is the
7
+ * single source of truth for which artifacts to download for the current host
8
+ * and what their SHA-256 must be. Platform keys are
9
+ * `${process.platform}-${process.arch}`.
10
+ *
11
+ * The lock is keyed by COMPONENT first (`sidecar` and `tui`), because
12
+ * `npx @amd-gaia/gaia` needs both and they differ in three ways: platform
13
+ * coverage (the Go TUI cross-compiles to arm64 Linux/Windows, the frozen Python
14
+ * sidecar does not), version, and — since schemaVersion 3.0 — the hub lane they
15
+ * are published in.
16
+ *
17
+ * The two lanes:
18
+ *
19
+ * sidecar agents/gaia/<agentVersion>/ built by this package's release
20
+ * tui agents/terminal-hub/<tuiVersion>/ the `terminal-hub` component,
21
+ * published by the core release
22
+ *
23
+ * The TUI is therefore the SAME binary as `gaia tui` from a core install — this
24
+ * package consumes it rather than building a second copy, so the two can never
25
+ * drift in behaviour or version. Each component carries its own `baseUrl`, which
26
+ * is what schemaVersion 2.0's single top-level `baseUrl` could not express.
27
+ *
28
+ * The terminal-hub lane spells its Windows artifacts `win-x64` / `win-arm64`,
29
+ * while Node's `process.platform` gives `win32`. That difference is carried by
30
+ * the entry's `filename` (data), never by a code path — see `TUI_ARTIFACT_NAMES`.
31
+ */
32
+ import { fileURLToPath } from "node:url";
33
+ import path from "node:path";
34
+ import fs from "node:fs";
35
+ import { PlatformError } from "./errors.js";
36
+ /** The two binaries `npx @amd-gaia/gaia` needs. */
37
+ export const COMPONENTS = ["sidecar", "tui"];
38
+ /** The lock schema this package reads. Loading any other major fails loudly. */
39
+ export const SCHEMA_MAJOR = 3;
40
+ /**
41
+ * Platform keys the sidecar publishes for. PyInstaller freezes on the host it
42
+ * runs on and there is no arm64 Linux/Windows CI runner for it, so this is a
43
+ * strict subset of the TUI's coverage.
44
+ */
45
+ export const SUPPORTED_SIDECAR_PLATFORMS = [
46
+ "win32-x64",
47
+ "darwin-arm64",
48
+ "darwin-x64",
49
+ "linux-x64",
50
+ ];
51
+ /** Platform keys the TUI publishes for (Go cross-compiles all six). */
52
+ export const SUPPORTED_TUI_PLATFORMS = [
53
+ "win32-x64",
54
+ "win32-arm64",
55
+ "darwin-arm64",
56
+ "darwin-x64",
57
+ "linux-x64",
58
+ "linux-arm64",
59
+ ];
60
+ /** Every platform key at least one component publishes for. */
61
+ export const SUPPORTED_PLATFORMS = SUPPORTED_TUI_PLATFORMS;
62
+ /**
63
+ * npm platform key → the artifact name the terminal-hub lane publishes.
64
+ *
65
+ * The mapping exists for exactly one reason: terminal-hub names its Windows
66
+ * builds `win-x64` / `win-arm64` (Go's GOOS vocabulary), while our keys come
67
+ * from `process.platform`, which says `win32`. Everything else is identical.
68
+ * This table is the assertion, not the lookup — the lock's `filename` is what
69
+ * the fetcher uses, and `test/lock.test.ts` checks the two agree, so a hub-side
70
+ * rename shows up as a failing test rather than a 404 on a user's first run.
71
+ */
72
+ export const TUI_ARTIFACT_NAMES = {
73
+ "win32-x64": "gaia-win-x64.exe",
74
+ "win32-arm64": "gaia-win-arm64.exe",
75
+ "darwin-arm64": "gaia-darwin-arm64",
76
+ "darwin-x64": "gaia-darwin-x64",
77
+ "linux-x64": "gaia-linux-x64",
78
+ "linux-arm64": "gaia-linux-arm64",
79
+ };
80
+ /** Resolve the current host's platform key, e.g. "win32-x64". */
81
+ export function currentPlatformKey(platform = process.platform, arch = process.arch) {
82
+ return `${platform}-${arch}`;
83
+ }
84
+ /** Locate `binaries.lock.json` (package root, one level up from dist/ or src/). */
85
+ export function defaultLockPath() {
86
+ const here = path.dirname(fileURLToPath(import.meta.url));
87
+ return path.resolve(here, "..", "binaries.lock.json");
88
+ }
89
+ /** Load and minimally validate the lock file. */
90
+ export function loadLock(lockPath = defaultLockPath()) {
91
+ let raw;
92
+ try {
93
+ raw = fs.readFileSync(lockPath, "utf8");
94
+ }
95
+ catch (e) {
96
+ throw new PlatformError(`cannot read binaries.lock.json at ${lockPath}: ${e.message}. ` +
97
+ "This manifest ships with the package; reinstall @amd-gaia/gaia if it is missing.");
98
+ }
99
+ let parsed;
100
+ try {
101
+ parsed = JSON.parse(raw);
102
+ }
103
+ catch (e) {
104
+ throw new PlatformError(`binaries.lock.json at ${lockPath} is not valid JSON: ${e.message}`);
105
+ }
106
+ const major = Number.parseInt(String(parsed.schemaVersion ?? ""), 10);
107
+ if (major !== SCHEMA_MAJOR) {
108
+ throw new PlatformError(`binaries.lock.json at ${lockPath} declares schemaVersion ` +
109
+ `'${parsed.schemaVersion ?? "(absent)"}', but this package reads ` +
110
+ `${SCHEMA_MAJOR}.x — where each component carries its own baseUrl ` +
111
+ "(the sidecar from the gaia lane, the TUI from the terminal-hub lane). " +
112
+ "Reinstall @amd-gaia/gaia so the lock and the code ship together.");
113
+ }
114
+ if (!parsed.components || typeof parsed.components !== "object") {
115
+ throw new PlatformError(`binaries.lock.json at ${lockPath} is missing a "components" map. ` +
116
+ `Expected schemaVersion ${SCHEMA_MAJOR}.x with components.sidecar and components.tui.`);
117
+ }
118
+ for (const component of COMPONENTS) {
119
+ const lane = parsed.components[component];
120
+ if (!lane || typeof lane !== "object") {
121
+ throw new PlatformError(`binaries.lock.json at ${lockPath} has no "${component}" component. ` +
122
+ `Both of ${COMPONENTS.join(" and ")} are required — \`gaia\` launches the ` +
123
+ "TUI against the sidecar and cannot run with only one of them.");
124
+ }
125
+ if (!lane.platforms || typeof lane.platforms !== "object") {
126
+ throw new PlatformError(`binaries.lock.json at ${lockPath}: component "${component}" has no ` +
127
+ `"platforms" map. Under schemaVersion ${SCHEMA_MAJOR}.x each component is ` +
128
+ '{ componentVersion, baseUrl, platforms }, not a bare platform map.');
129
+ }
130
+ if (typeof lane.baseUrl !== "string" || lane.baseUrl === "") {
131
+ throw new PlatformError(`binaries.lock.json at ${lockPath}: component "${component}" has no ` +
132
+ '"baseUrl". Each component is published in its own hub lane at its own ' +
133
+ "version, so each carries its own download base URL.");
134
+ }
135
+ }
136
+ return parsed;
137
+ }
138
+ /** One component's lane, failing loudly when the lock does not declare it. */
139
+ export function componentLock(lock, component) {
140
+ const lane = lock.components[component];
141
+ if (!lane) {
142
+ throw new PlatformError(`binaries.lock.json has no "${component}" component (components present: ` +
143
+ `${Object.keys(lock.components).join(", ") || "(none)"}).`);
144
+ }
145
+ return lane;
146
+ }
147
+ /** The download base URL for one component. */
148
+ export function componentBaseUrl(lock, component) {
149
+ const { baseUrl } = componentLock(lock, component);
150
+ if (!baseUrl) {
151
+ throw new PlatformError(`binaries.lock.json has no baseUrl for "${component}", so there is nowhere ` +
152
+ "to download it from. Pass { baseUrl } to point at where the binaries are hosted.");
153
+ }
154
+ return baseUrl;
155
+ }
156
+ /** The platform keys a component publishes for, per the lock. */
157
+ export function platformsFor(lock, component) {
158
+ return Object.keys(lock.components[component]?.platforms ?? {});
159
+ }
160
+ /**
161
+ * Resolve one component's lock entry for a platform key, failing loudly when the
162
+ * component has no build for it (e.g. the sidecar on linux-arm64).
163
+ */
164
+ export function resolveEntry(lock, component, platformKey) {
165
+ const table = componentLock(lock, component).platforms;
166
+ const entry = table[platformKey];
167
+ if (!entry) {
168
+ const available = Object.keys(table).join(", ") || "(none)";
169
+ throw new PlatformError(`no '${component}' binary for platform '${platformKey}'. ` +
170
+ `Published '${component}' platforms: ${available}. ` +
171
+ (component === "sidecar"
172
+ ? "The frozen agent sidecar has no arm64 Linux or arm64 Windows build, so " +
173
+ "`gaia` cannot run there yet. Run it on one of the platforms above, or " +
174
+ "run the agent from source (see hub/agents/gaia/python/) and drive the " +
175
+ "TUI against it."
176
+ : "Run `gaia` on one of the platforms above."));
177
+ }
178
+ if (!entry.sha256 || !entry.filename || !entry.executable) {
179
+ throw new PlatformError(`binaries.lock.json entry for ${component}/'${platformKey}' is incomplete ` +
180
+ "(needs filename, sha256, executable) — likely a stub entry with no " +
181
+ "published binary for this platform.");
182
+ }
183
+ // The lock is trusted package data, but `lockPath` is caller-overridable — a
184
+ // name with a separator or `..` would escape the cache dir / the base URL.
185
+ for (const [field, value] of [
186
+ ["filename", entry.filename],
187
+ ["executable", entry.executable],
188
+ ]) {
189
+ if (value === "." || value === ".." || /[/\\]/.test(value)) {
190
+ throw new PlatformError(`binaries.lock.json entry for ${component}/'${platformKey}' has an unsafe ` +
191
+ `${field} '${value}': it must be a bare filename with no path separators.`);
192
+ }
193
+ }
194
+ return entry;
195
+ }
196
+ /** True when an entry's sha256 is the not-yet-published placeholder sentinel. */
197
+ export function isPlaceholderSha(sha256) {
198
+ if (!sha256)
199
+ return false;
200
+ return /^0+$/.test(sha256) || sha256.toUpperCase().includes("PENDING");
201
+ }
202
+ //# sourceMappingURL=platform.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":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Q,IAAI,CAAC,KAAK,CAAC,UAAU,EAAE,CAAC;QAC1D,MAAM,IAAI,aAAa,CACrB,gCAAgC,SAAS,KAAK,WAAW,kBAAkB;YACzE,qEAAqE;YACrE,qCAAqC,CACxC,CAAC;IACJ,CAAC;IACD,6EAA6E;IAC7E,2EAA2E;IAC3E,KAAK,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,IAAI;QAC3B,CAAC,UAAU,EAAE,KAAK,CAAC,QAAQ,CAAC;QAC5B,CAAC,YAAY,EAAE,KAAK,CAAC,UAAU,CAAC;KACxB,EAAE,CAAC;QACX,IAAI,KAAK,KAAK,GAAG,IAAI,KAAK,KAAK,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;YAC3D,MAAM,IAAI,aAAa,CACrB,gCAAgC,SAAS,KAAK,WAAW,kBAAkB;gBACzE,GAAG,KAAK,KAAK,KAAK,wDAAwD,CAC7E,CAAC;QACJ,CAAC;IACH,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED,iFAAiF;AACjF,MAAM,UAAU,gBAAgB,CAAC,MAAc;IAC7C,IAAI,CAAC,MAAM;QAAE,OAAO,KAAK,CAAC;IAC1B,OAAO,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,MAAM,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;AACzE,CAAC"}
package/dist/url.d.ts ADDED
@@ -0,0 +1,4 @@
1
+ export declare function stripTrailingSlashes(s: string): string;
2
+ export declare function stripLeadingSlashes(s: string): string;
3
+ export declare function joinUrl(base: string, file: string): string;
4
+ //# sourceMappingURL=url.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"url.d.ts","sourceRoot":"","sources":["../src/url.ts"],"names":[],"mappings":"AASA,wBAAgB,oBAAoB,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAItD;AAED,wBAAgB,mBAAmB,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAIrD;AAED,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAE1D"}
package/dist/url.js ADDED
@@ -0,0 +1,22 @@
1
+ // Copyright(C) 2025-2026 Advanced Micro Devices, Inc. All rights reserved.
2
+ // SPDX-License-Identifier: MIT
3
+ // Linear-time slash trimming. The regex forms (`/\/+$/`, `/^\/+/`) backtrack
4
+ // polynomially on a long run of slashes from an untrusted URL (CodeQL
5
+ // js/polynomial-redos); a char scan is O(n) and allocation-free.
6
+ const SLASH = 47; // '/'
7
+ export function stripTrailingSlashes(s) {
8
+ let end = s.length;
9
+ while (end > 0 && s.charCodeAt(end - 1) === SLASH)
10
+ end -= 1;
11
+ return s.slice(0, end);
12
+ }
13
+ export function stripLeadingSlashes(s) {
14
+ let start = 0;
15
+ while (start < s.length && s.charCodeAt(start) === SLASH)
16
+ start += 1;
17
+ return s.slice(start);
18
+ }
19
+ export function joinUrl(base, file) {
20
+ return `${stripTrailingSlashes(base)}/${stripLeadingSlashes(file)}`;
21
+ }
22
+ //# sourceMappingURL=url.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"url.js","sourceRoot":"","sources":["../src/url.ts"],"names":[],"mappings":"AAAA,2EAA2E;AAC3E,+BAA+B;AAE/B,6EAA6E;AAC7E,sEAAsE;AACtE,iEAAiE;AAEjE,MAAM,KAAK,GAAG,EAAE,CAAC,CAAC,MAAM;AAExB,MAAM,UAAU,oBAAoB,CAAC,CAAS;IAC5C,IAAI,GAAG,GAAG,CAAC,CAAC,MAAM,CAAC;IACnB,OAAO,GAAG,GAAG,CAAC,IAAI,CAAC,CAAC,UAAU,CAAC,GAAG,GAAG,CAAC,CAAC,KAAK,KAAK;QAAE,GAAG,IAAI,CAAC,CAAC;IAC5D,OAAO,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;AACzB,CAAC;AAED,MAAM,UAAU,mBAAmB,CAAC,CAAS;IAC3C,IAAI,KAAK,GAAG,CAAC,CAAC;IACd,OAAO,KAAK,GAAG,CAAC,CAAC,MAAM,IAAI,CAAC,CAAC,UAAU,CAAC,KAAK,CAAC,KAAK,KAAK;QAAE,KAAK,IAAI,CAAC,CAAC;IACrE,OAAO,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;AACxB,CAAC;AAED,MAAM,UAAU,OAAO,CAAC,IAAY,EAAE,IAAY;IAChD,OAAO,GAAG,oBAAoB,CAAC,IAAI,CAAC,IAAI,mBAAmB,CAAC,IAAI,CAAC,EAAE,CAAC;AACtE,CAAC"}
package/package.json CHANGED
@@ -1,15 +1,66 @@
1
- {
2
- "name": "@amd-gaia/gaia",
3
- "version": "0.1.0",
4
- "description": "Reserves the package so npm trusted publishing (OIDC) can be configured; OIDC cannot create a package. Not the CLI - see 0.1.1 and later.",
5
- "license": "MIT",
6
- "repository": {
7
- "type": "git",
8
- "url": "git+https://github.com/amd/gaia.git",
9
- "directory": "hub/agents/gaia/npm"
10
- },
11
- "homepage": "https://amd-gaia.ai",
12
- "publishConfig": {
13
- "access": "public"
14
- }
15
- }
1
+ {
2
+ "name": "@amd-gaia/gaia",
3
+ "version": "0.2.0",
4
+ "type": "module",
5
+ "description": "One command to run GAIA: fetches and SHA-256 verifies the flagship agent sidecar and the terminal UI, then launches them. Runs 100% locally on AMD Ryzen AI.",
6
+ "author": "AMD AI Group",
7
+ "license": "MIT",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "https://github.com/amd/gaia.git",
11
+ "directory": "hub/agents/gaia/npm"
12
+ },
13
+ "homepage": "https://amd-gaia.ai/docs/guides/gaia",
14
+ "bugs": {
15
+ "url": "https://github.com/amd/gaia/issues"
16
+ },
17
+ "keywords": [
18
+ "gaia",
19
+ "amd",
20
+ "ryzen-ai",
21
+ "agent",
22
+ "tui",
23
+ "local-llm",
24
+ "privacy",
25
+ "sidecar"
26
+ ],
27
+ "main": "./dist/index.js",
28
+ "types": "./dist/index.d.ts",
29
+ "sideEffects": false,
30
+ "exports": {
31
+ ".": {
32
+ "types": "./dist/index.d.ts",
33
+ "import": "./dist/index.js"
34
+ }
35
+ },
36
+ "bin": {
37
+ "gaia": "./dist/cli.js"
38
+ },
39
+ "files": [
40
+ "dist/",
41
+ "binaries.lock.json",
42
+ "README.md",
43
+ "CHANGELOG.md",
44
+ "SPEC.md",
45
+ "SKILL.md",
46
+ "LICENSE"
47
+ ],
48
+ "engines": {
49
+ "node": ">=18"
50
+ },
51
+ "publishConfig": {
52
+ "access": "public"
53
+ },
54
+ "scripts": {
55
+ "build": "tsc -p tsconfig.json",
56
+ "clean": "node -e \"require('fs').rmSync('dist',{recursive:true,force:true})\"",
57
+ "prepublishOnly": "npm run clean && npm run build",
58
+ "test": "vitest run",
59
+ "test:watch": "vitest"
60
+ },
61
+ "devDependencies": {
62
+ "@types/node": "^22.10.0",
63
+ "typescript": "^5.7.2",
64
+ "vitest": "^2.1.8"
65
+ }
66
+ }