@camstack/develop 0.1.3 → 0.1.5
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/hub/admin-token-store.d.ts +53 -0
- package/dist/hub/admin-token-store.d.ts.map +1 -0
- package/dist/hub/admin-token-store.js +139 -0
- package/dist/hub/credentials.d.ts +53 -0
- package/dist/hub/credentials.d.ts.map +1 -0
- package/dist/hub/credentials.js +151 -0
- package/dist/hub/hub-address.d.ts +24 -0
- package/dist/hub/hub-address.d.ts.map +1 -0
- package/dist/hub/hub-address.js +87 -0
- package/dist/hub/hub-client.d.ts +57 -0
- package/dist/hub/hub-client.d.ts.map +1 -0
- package/dist/hub/hub-client.js +176 -0
- package/dist/hub/hub-tls.d.ts +16 -0
- package/dist/hub/hub-tls.d.ts.map +1 -0
- package/dist/hub/hub-tls.js +67 -0
- package/dist/hub/hub-url.d.ts +17 -0
- package/dist/hub/hub-url.d.ts.map +1 -0
- package/dist/hub/hub-url.js +54 -0
- package/dist/hub/session-store.d.ts +55 -0
- package/dist/hub/session-store.d.ts.map +1 -0
- package/dist/hub/session-store.js +178 -0
- package/dist/hub-discovery/hub-candidates.d.ts +53 -0
- package/dist/hub-discovery/hub-candidates.d.ts.map +1 -0
- package/dist/hub-discovery/hub-candidates.js +103 -0
- package/dist/hub-discovery/index.d.ts +4 -0
- package/dist/hub-discovery/index.d.ts.map +1 -0
- package/dist/hub-discovery/index.js +3 -0
- package/dist/hub-discovery/mdns-browse.d.ts +51 -0
- package/dist/hub-discovery/mdns-browse.d.ts.map +1 -0
- package/dist/hub-discovery/mdns-browse.js +116 -0
- package/dist/index.d.ts +15 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +11 -2
- package/dist/scaffold/addon.d.ts.map +1 -1
- package/dist/scaffold/addon.js +6 -0
- package/dist/types.d.ts +6 -1
- package/dist/types.d.ts.map +1 -1
- package/package.json +10 -1
- package/skills/README.md +3 -0
- package/skills/camstack-addon.md +376 -98
- package/skills/camstack-capability.md +184 -77
- package/skills/camstack-secrets.md +121 -34
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A tRPC caller for the hub, shared by `scripts/hub/hub.mjs` and the operator
|
|
3
|
+
* MCP. It speaks the wire (`/trpc/<path>`, `{ json }` envelope, superjson Date
|
|
4
|
+
* metadata) over `node:https` with the TLS trust from `hub-tls.ts`; there is
|
|
5
|
+
* no login in here — the bearer comes from the credential chain.
|
|
6
|
+
*/
|
|
7
|
+
import * as http from 'node:http';
|
|
8
|
+
import * as https from 'node:https';
|
|
9
|
+
import { Buffer } from 'node:buffer';
|
|
10
|
+
import { createHubAgent, explainTlsFailure } from './hub-tls.js';
|
|
11
|
+
export class HubHttpError extends Error {
|
|
12
|
+
status;
|
|
13
|
+
path;
|
|
14
|
+
constructor(message, status, path) {
|
|
15
|
+
super(message);
|
|
16
|
+
this.status = status;
|
|
17
|
+
this.path = path;
|
|
18
|
+
this.name = 'HubHttpError';
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
/** The hub answered with a tRPC error envelope. */
|
|
22
|
+
export class HubRpcError extends Error {
|
|
23
|
+
code;
|
|
24
|
+
path;
|
|
25
|
+
status;
|
|
26
|
+
constructor(message, code, path, status) {
|
|
27
|
+
super(message);
|
|
28
|
+
this.code = code;
|
|
29
|
+
this.path = path;
|
|
30
|
+
this.status = status;
|
|
31
|
+
this.name = 'HubRpcError';
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
export const DEFAULT_TIMEOUT_MS = 60_000;
|
|
35
|
+
export const DEFAULT_MAX_BYTES = 64 * 1024 * 1024;
|
|
36
|
+
export const nodeHubTransport = (req) => new Promise((resolve, reject) => {
|
|
37
|
+
const parsed = new URL(req.url);
|
|
38
|
+
const isHttps = parsed.protocol === 'https:';
|
|
39
|
+
const options = {
|
|
40
|
+
protocol: parsed.protocol,
|
|
41
|
+
hostname: parsed.hostname,
|
|
42
|
+
port: parsed.port || (isHttps ? 443 : 80),
|
|
43
|
+
path: `${parsed.pathname}${parsed.search}`,
|
|
44
|
+
method: req.method,
|
|
45
|
+
headers: { ...req.headers },
|
|
46
|
+
timeout: req.timeoutMs,
|
|
47
|
+
...(isHttps ? { agent: createHubAgent(req.tls) } : {}),
|
|
48
|
+
};
|
|
49
|
+
const onResponse = (res) => {
|
|
50
|
+
const chunks = [];
|
|
51
|
+
let size = 0;
|
|
52
|
+
res.on('data', (chunk) => {
|
|
53
|
+
size += chunk.length;
|
|
54
|
+
if (size > req.maxBytes) {
|
|
55
|
+
res.destroy(new Error(`response larger than ${req.maxBytes} bytes — narrow the query`));
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
chunks.push(chunk);
|
|
59
|
+
});
|
|
60
|
+
res.on('end', () => resolve({
|
|
61
|
+
status: res.statusCode ?? 0,
|
|
62
|
+
text: Buffer.concat(chunks).toString('utf8'),
|
|
63
|
+
}));
|
|
64
|
+
res.on('error', reject);
|
|
65
|
+
};
|
|
66
|
+
const request = isHttps ? https.request(options, onResponse) : http.request(options, onResponse);
|
|
67
|
+
request.on('error', reject);
|
|
68
|
+
request.on('timeout', () => {
|
|
69
|
+
request.destroy(new Error(`hub request to ${parsed.host} timed out after ${req.timeoutMs}ms`));
|
|
70
|
+
});
|
|
71
|
+
if (req.body !== undefined)
|
|
72
|
+
request.write(req.body);
|
|
73
|
+
request.end();
|
|
74
|
+
});
|
|
75
|
+
/**
|
|
76
|
+
* The `{ json, meta }` envelope for an input. A `Date` travels as its ISO
|
|
77
|
+
* string and is named in `meta.values` so the hub's superjson revives it.
|
|
78
|
+
*/
|
|
79
|
+
export function encodeTrpcInput(input) {
|
|
80
|
+
const dates = {};
|
|
81
|
+
const walk = (value, at) => {
|
|
82
|
+
if (value instanceof Date) {
|
|
83
|
+
dates[at] = ['Date'];
|
|
84
|
+
return value.toISOString();
|
|
85
|
+
}
|
|
86
|
+
if (Array.isArray(value))
|
|
87
|
+
return value.map((v, i) => walk(v, at === '' ? `${i}` : `${at}.${i}`));
|
|
88
|
+
if (value !== null && typeof value === 'object') {
|
|
89
|
+
const out = {};
|
|
90
|
+
for (const [k, v] of Object.entries(value)) {
|
|
91
|
+
if (v === undefined)
|
|
92
|
+
continue;
|
|
93
|
+
out[k] = walk(v, at === '' ? k : `${at}.${k}`);
|
|
94
|
+
}
|
|
95
|
+
return out;
|
|
96
|
+
}
|
|
97
|
+
return value;
|
|
98
|
+
};
|
|
99
|
+
const json = walk(input, '');
|
|
100
|
+
return Object.keys(dates).length > 0 ? { json, meta: { values: dates } } : { json };
|
|
101
|
+
}
|
|
102
|
+
function readError(body) {
|
|
103
|
+
if (body === null || typeof body !== 'object')
|
|
104
|
+
return null;
|
|
105
|
+
const error = Reflect.get(body, 'error');
|
|
106
|
+
if (error === null || typeof error !== 'object')
|
|
107
|
+
return null;
|
|
108
|
+
const inner = Reflect.get(error, 'json') ?? error;
|
|
109
|
+
const message = inner !== null && typeof inner === 'object' ? Reflect.get(inner, 'message') : undefined;
|
|
110
|
+
const code = inner !== null && typeof inner === 'object' ? Reflect.get(inner, 'code') : undefined;
|
|
111
|
+
return {
|
|
112
|
+
message: typeof message === 'string' ? message : JSON.stringify(error).slice(0, 400),
|
|
113
|
+
code: typeof code === 'string' ? code : undefined,
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
function parseJson(text) {
|
|
117
|
+
try {
|
|
118
|
+
return JSON.parse(text);
|
|
119
|
+
}
|
|
120
|
+
catch {
|
|
121
|
+
return undefined;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
export function createHubClient(options) {
|
|
125
|
+
const transport = options.transport ?? nodeHubTransport;
|
|
126
|
+
const base = options.baseUrl.replace(/\/+$/, '');
|
|
127
|
+
return {
|
|
128
|
+
async call(method, path, input) {
|
|
129
|
+
const headers = {
|
|
130
|
+
'content-type': 'application/json',
|
|
131
|
+
authorization: `Bearer ${options.token}`,
|
|
132
|
+
};
|
|
133
|
+
let url = `${base}/trpc/${path}`;
|
|
134
|
+
let body;
|
|
135
|
+
if (method === 'POST') {
|
|
136
|
+
body = JSON.stringify(encodeTrpcInput(input));
|
|
137
|
+
}
|
|
138
|
+
else if (input !== undefined) {
|
|
139
|
+
url += `?input=${encodeURIComponent(JSON.stringify(encodeTrpcInput(input)))}`;
|
|
140
|
+
}
|
|
141
|
+
let res;
|
|
142
|
+
try {
|
|
143
|
+
res = await transport({
|
|
144
|
+
url,
|
|
145
|
+
method,
|
|
146
|
+
headers,
|
|
147
|
+
...(body !== undefined ? { body } : {}),
|
|
148
|
+
timeoutMs: options.timeoutMs ?? DEFAULT_TIMEOUT_MS,
|
|
149
|
+
maxBytes: options.maxBytes ?? DEFAULT_MAX_BYTES,
|
|
150
|
+
tls: options.tls ?? {},
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
catch (err) {
|
|
154
|
+
const explained = explainTlsFailure(base, err);
|
|
155
|
+
if (explained)
|
|
156
|
+
throw new Error(explained, { cause: err });
|
|
157
|
+
throw err;
|
|
158
|
+
}
|
|
159
|
+
const parsed = parseJson(res.text);
|
|
160
|
+
const rpcError = readError(parsed);
|
|
161
|
+
if (rpcError)
|
|
162
|
+
throw new HubRpcError(rpcError.message, rpcError.code, path, res.status);
|
|
163
|
+
if (res.status < 200 || res.status >= 300) {
|
|
164
|
+
throw new HubHttpError(`${path}: HTTP ${res.status} ${res.text.slice(0, 200)}`, res.status, path);
|
|
165
|
+
}
|
|
166
|
+
if (parsed === null || typeof parsed !== 'object') {
|
|
167
|
+
throw new HubHttpError(`${path}: response is not a tRPC envelope`, res.status, path);
|
|
168
|
+
}
|
|
169
|
+
const result = Reflect.get(parsed, 'result');
|
|
170
|
+
const data = result !== null && typeof result === 'object' ? Reflect.get(result, 'data') : undefined;
|
|
171
|
+
if (data !== null && typeof data === 'object' && 'json' in data)
|
|
172
|
+
return Reflect.get(data, 'json');
|
|
173
|
+
return data;
|
|
174
|
+
},
|
|
175
|
+
};
|
|
176
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import * as https from 'node:https';
|
|
2
|
+
export interface HubTlsConfig {
|
|
3
|
+
/** PEM text trusted for this hub (a pinned leaf or the hub's CA). */
|
|
4
|
+
readonly ca?: string;
|
|
5
|
+
/** Where `ca` came from, for error messages. */
|
|
6
|
+
readonly caFile?: string;
|
|
7
|
+
}
|
|
8
|
+
/** `~/.camstack/<host>.ca.pem` — the default pin file for a hub. */
|
|
9
|
+
export declare function hubCaFileForServer(serverUrl: string, dir?: string): string;
|
|
10
|
+
/** The trust configuration for `serverUrl`; empty when the system store should decide. */
|
|
11
|
+
export declare function resolveHubTls(serverUrl: string, env?: Readonly<Record<string, string | undefined>>, dir?: string): HubTlsConfig;
|
|
12
|
+
/** A TLS failure, with the one fix that applies. */
|
|
13
|
+
export declare function explainTlsFailure(serverUrl: string, err: unknown): string | null;
|
|
14
|
+
/** The https agent for hub traffic: the pinned PEM when there is one, else defaults. */
|
|
15
|
+
export declare function createHubAgent(tls: HubTlsConfig): https.Agent;
|
|
16
|
+
//# sourceMappingURL=hub-tls.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hub-tls.d.ts","sourceRoot":"","sources":["../../src/hub/hub-tls.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,KAAK,MAAM,YAAY,CAAA;AAInC,MAAM,WAAW,YAAY;IAC3B,qEAAqE;IACrE,QAAQ,CAAC,EAAE,CAAC,EAAE,MAAM,CAAA;IACpB,gDAAgD;IAChD,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CACzB;AAED,oEAAoE;AACpE,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,MAAM,EAAE,GAAG,GAAE,MAA4B,GAAG,MAAM,CAE/F;AAED,0FAA0F;AAC1F,wBAAgB,aAAa,CAC3B,SAAS,EAAE,MAAM,EACjB,GAAG,GAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAe,EAC/D,GAAG,GAAE,MAA4B,GAChC,YAAY,CAcd;AAED,oDAAoD;AACpD,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,MAAM,EAAE,GAAG,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,CAiBhF;AAED,wFAAwF;AACxF,wBAAgB,cAAc,CAAC,GAAG,EAAE,YAAY,GAAG,KAAK,CAAC,KAAK,CAK7D"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TLS trust for hub calls: a pinned certificate or the hub's CA — never
|
|
3
|
+
* `NODE_TLS_REJECT_UNAUTHORIZED=0`, never `rejectUnauthorized: false`.
|
|
4
|
+
*
|
|
5
|
+
* A hub on the LAN serves a self-signed (or privately issued) certificate. The
|
|
6
|
+
* operator tells the tools to trust it by dropping a PEM next to the session
|
|
7
|
+
* cache as `~/.camstack/<host>_<port>.ca.pem` (or naming another file in
|
|
8
|
+
* `$CAMSTACK_HUB_CA_FILE`): the hub's own certificate when it is self-signed,
|
|
9
|
+
* or the CA that issued it (e.g. mkcert's `rootCA.pem`, never its key). The PEM
|
|
10
|
+
* is a trust anchor for THAT hub only: standard verification still runs against
|
|
11
|
+
* it — chain, expiry and host name. A leaf issued by a CA cannot be pinned on
|
|
12
|
+
* its own (Node does not accept a partial chain); give the CA. A hub with a
|
|
13
|
+
* publicly trusted certificate needs nothing at all.
|
|
14
|
+
*/
|
|
15
|
+
import * as fs from 'node:fs';
|
|
16
|
+
import * as https from 'node:https';
|
|
17
|
+
import * as path from 'node:path';
|
|
18
|
+
import { defaultSessionDir, slugForServer } from './session-store.js';
|
|
19
|
+
/** `~/.camstack/<host>.ca.pem` — the default pin file for a hub. */
|
|
20
|
+
export function hubCaFileForServer(serverUrl, dir = defaultSessionDir()) {
|
|
21
|
+
return path.join(dir, `${slugForServer(serverUrl)}.ca.pem`);
|
|
22
|
+
}
|
|
23
|
+
/** The trust configuration for `serverUrl`; empty when the system store should decide. */
|
|
24
|
+
export function resolveHubTls(serverUrl, env = process.env, dir = defaultSessionDir()) {
|
|
25
|
+
if (!serverUrl.startsWith('https:'))
|
|
26
|
+
return {};
|
|
27
|
+
const named = env['CAMSTACK_HUB_CA_FILE']?.trim();
|
|
28
|
+
const candidate = named && named !== '' ? named : hubCaFileForServer(serverUrl, dir);
|
|
29
|
+
try {
|
|
30
|
+
return { ca: fs.readFileSync(candidate, 'utf8'), caFile: candidate };
|
|
31
|
+
}
|
|
32
|
+
catch (err) {
|
|
33
|
+
if (named && named !== '') {
|
|
34
|
+
throw new Error(`Cannot read the hub CA file named by CAMSTACK_HUB_CA_FILE: ${candidate}`, {
|
|
35
|
+
cause: err,
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
return {};
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
/** A TLS failure, with the one fix that applies. */
|
|
42
|
+
export function explainTlsFailure(serverUrl, err) {
|
|
43
|
+
const code = err instanceof Error ? Reflect.get(err, 'code') : undefined;
|
|
44
|
+
const tlsCodes = [
|
|
45
|
+
'DEPTH_ZERO_SELF_SIGNED_CERT',
|
|
46
|
+
'SELF_SIGNED_CERT_IN_CHAIN',
|
|
47
|
+
'UNABLE_TO_VERIFY_LEAF_SIGNATURE',
|
|
48
|
+
'UNABLE_TO_GET_ISSUER_CERT_LOCALLY',
|
|
49
|
+
'CERT_HAS_EXPIRED',
|
|
50
|
+
'ERR_TLS_CERT_ALTNAME_INVALID',
|
|
51
|
+
];
|
|
52
|
+
if (typeof code !== 'string' || !tlsCodes.includes(code))
|
|
53
|
+
return null;
|
|
54
|
+
return [
|
|
55
|
+
`TLS verification of ${serverUrl} failed (${code}). Verification is never switched off.`,
|
|
56
|
+
` Trust this hub: save the PEM of its certificate (when self-signed) or of the CA that`,
|
|
57
|
+
` issued it (e.g. mkcert's rootCA.pem — never its key) to ${hubCaFileForServer(serverUrl)},`,
|
|
58
|
+
' or point $CAMSTACK_HUB_CA_FILE at that PEM. A leaf issued by a CA needs the CA, not the leaf.',
|
|
59
|
+
].join('\n');
|
|
60
|
+
}
|
|
61
|
+
/** The https agent for hub traffic: the pinned PEM when there is one, else defaults. */
|
|
62
|
+
export function createHubAgent(tls) {
|
|
63
|
+
return new https.Agent({
|
|
64
|
+
keepAlive: false,
|
|
65
|
+
...(tls.ca ? { ca: tls.ca } : {}),
|
|
66
|
+
});
|
|
67
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export interface HubUrlInputs {
|
|
2
|
+
readonly explicit?: string;
|
|
3
|
+
readonly env?: Readonly<Record<string, string | undefined>>;
|
|
4
|
+
/** The checkout whose `scratchpad/.hub-url` may name the hub. */
|
|
5
|
+
readonly workspaceRoot?: string;
|
|
6
|
+
readonly session?: {
|
|
7
|
+
readonly server: string;
|
|
8
|
+
} | null;
|
|
9
|
+
}
|
|
10
|
+
export type HubUrlSource = 'flag' | 'env' | 'scratchpad' | 'session';
|
|
11
|
+
export interface ResolvedHubUrl {
|
|
12
|
+
readonly url: string;
|
|
13
|
+
readonly source: HubUrlSource;
|
|
14
|
+
}
|
|
15
|
+
/** The hub URL, or `undefined` when no source names one. */
|
|
16
|
+
export declare function resolveHubUrl(inputs: HubUrlInputs): ResolvedHubUrl | undefined;
|
|
17
|
+
//# sourceMappingURL=hub-url.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hub-url.d.ts","sourceRoot":"","sources":["../../src/hub/hub-url.ts"],"names":[],"mappings":"AAkBA,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;IAC1B,QAAQ,CAAC,GAAG,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC,CAAA;IAC3D,iEAAiE;IACjE,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,CAAA;IAC/B,QAAQ,CAAC,OAAO,CAAC,EAAE;QAAE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAA;CACtD;AAED,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,KAAK,GAAG,YAAY,GAAG,SAAS,CAAA;AAEpE,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;IACpB,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAA;CAC9B;AAuBD,4DAA4D;AAC5D,wBAAgB,aAAa,CAAC,MAAM,EAAE,YAAY,GAAG,cAAc,GAAG,SAAS,CAW9E"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Which hub a tool talks to. Never a literal address in code: the hub URL is
|
|
3
|
+
* the operator's, found in this order (first hit wins).
|
|
4
|
+
*
|
|
5
|
+
* 1. an explicit value (a `--server` flag)
|
|
6
|
+
* 2. `$CAMSTACK_HUB_URL`
|
|
7
|
+
* 3. `$CAMSTACK_SERVER` (the CLI's name for the same thing)
|
|
8
|
+
* 4. `<workspace>/scratchpad/.hub-url` (gitignored, one line)
|
|
9
|
+
* 5. the cached `camstack login` session's server
|
|
10
|
+
*
|
|
11
|
+
* Sources 1-4 are operator-typed, so each goes through `normalizeHubAddress`
|
|
12
|
+
* (`192.168.1.50` -> `https://192.168.1.50:4443`); a malformed value throws a
|
|
13
|
+
* `HubAddressError` rather than being used as written.
|
|
14
|
+
*/
|
|
15
|
+
import * as fs from 'node:fs';
|
|
16
|
+
import * as path from 'node:path';
|
|
17
|
+
import { normalizeHubAddress } from './hub-address.js';
|
|
18
|
+
function clean(value) {
|
|
19
|
+
const trimmed = value?.trim();
|
|
20
|
+
return trimmed ? normalizeHubAddress(trimmed) : undefined;
|
|
21
|
+
}
|
|
22
|
+
/** The session's server as saved: already canonical, never re-parsed. */
|
|
23
|
+
function cleanSession(value) {
|
|
24
|
+
const trimmed = value?.trim().replace(/\/+$/, '');
|
|
25
|
+
return trimmed ? trimmed : undefined;
|
|
26
|
+
}
|
|
27
|
+
function readScratchpadHubUrl(workspaceRoot) {
|
|
28
|
+
if (!workspaceRoot)
|
|
29
|
+
return undefined;
|
|
30
|
+
const file = path.join(workspaceRoot, 'scratchpad', '.hub-url');
|
|
31
|
+
try {
|
|
32
|
+
return clean(fs.readFileSync(file, 'utf8'));
|
|
33
|
+
}
|
|
34
|
+
catch {
|
|
35
|
+
return undefined;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
/** The hub URL, or `undefined` when no source names one. */
|
|
39
|
+
export function resolveHubUrl(inputs) {
|
|
40
|
+
const env = inputs.env ?? process.env;
|
|
41
|
+
const explicit = clean(inputs.explicit);
|
|
42
|
+
if (explicit)
|
|
43
|
+
return { url: explicit, source: 'flag' };
|
|
44
|
+
const fromEnv = clean(env['CAMSTACK_HUB_URL']) ?? clean(env['CAMSTACK_SERVER']);
|
|
45
|
+
if (fromEnv)
|
|
46
|
+
return { url: fromEnv, source: 'env' };
|
|
47
|
+
const scratch = readScratchpadHubUrl(inputs.workspaceRoot);
|
|
48
|
+
if (scratch)
|
|
49
|
+
return { url: scratch, source: 'scratchpad' };
|
|
50
|
+
const session = cleanSession(inputs.session?.server);
|
|
51
|
+
if (session)
|
|
52
|
+
return { url: session, source: 'session' };
|
|
53
|
+
return undefined;
|
|
54
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
export interface SessionFile {
|
|
2
|
+
readonly server: string;
|
|
3
|
+
readonly username: string;
|
|
4
|
+
readonly tokenId: string;
|
|
5
|
+
readonly token: string;
|
|
6
|
+
readonly scopes: readonly {
|
|
7
|
+
type: string;
|
|
8
|
+
target: string;
|
|
9
|
+
}[];
|
|
10
|
+
readonly createdAt: number;
|
|
11
|
+
/** Last time a command used this session (`touchSession`); absent on older files. */
|
|
12
|
+
readonly lastUsedAt?: number;
|
|
13
|
+
}
|
|
14
|
+
/** Where the cache lives; injectable so a test never touches the real home. */
|
|
15
|
+
export declare function defaultSessionDir(): string;
|
|
16
|
+
/** Slug a server URL into a single filesystem-safe filename component. */
|
|
17
|
+
export declare function slugForServer(serverUrl: string): string;
|
|
18
|
+
export declare function sessionFileForServer(serverUrl: string, dir?: string): string;
|
|
19
|
+
/**
|
|
20
|
+
* Where an operator drops a `csa_` admin token for a hub (owner-only file,
|
|
21
|
+
* D816). The extension is not `.json`, so the newest-session fallback below
|
|
22
|
+
* never mistakes it for a session.
|
|
23
|
+
*/
|
|
24
|
+
export declare function adminTokenFileForServer(serverUrl: string, dir?: string): string;
|
|
25
|
+
/**
|
|
26
|
+
* The admin token file to use, or `undefined` when none exists: the path named
|
|
27
|
+
* by `$CAMSTACK_ADMIN_TOKEN_FILE` (a PATH, never the token), else the default
|
|
28
|
+
* file for `serverUrl`.
|
|
29
|
+
*/
|
|
30
|
+
export declare function findAdminTokenFile(serverUrl: string | undefined, env?: Readonly<Record<string, string | undefined>>, dir?: string): string | undefined;
|
|
31
|
+
/** When a session was last used: `lastUsedAt`, else when it was created. */
|
|
32
|
+
export declare function sessionRecency(session: SessionFile): number;
|
|
33
|
+
/**
|
|
34
|
+
* Every readable saved session, most recently used first (ties: file mtime).
|
|
35
|
+
* A corrupt or partial file is skipped, never fatal.
|
|
36
|
+
*/
|
|
37
|
+
export declare function listSessions(dir?: string): readonly SessionFile[];
|
|
38
|
+
/**
|
|
39
|
+
* THE default-session rule, used by every command that is given no server:
|
|
40
|
+
* 1. the session of `$CAMSTACK_SERVER`, when one is set and saved;
|
|
41
|
+
* 2. otherwise the most recently used session (`lastUsedAt`, else `createdAt`).
|
|
42
|
+
*/
|
|
43
|
+
export declare function defaultSession(sessions: readonly SessionFile[], env?: Readonly<Record<string, string | undefined>>): SessionFile | null;
|
|
44
|
+
/**
|
|
45
|
+
* Shape check for a cached session blob. A partial or corrupted cache file
|
|
46
|
+
* (e.g. after a crashed login) is treated as "no session" instead of crashing
|
|
47
|
+
* a later `.slice` on undefined.
|
|
48
|
+
*/
|
|
49
|
+
export declare function isSessionFile(value: unknown): value is SessionFile;
|
|
50
|
+
export declare function loadSession(serverUrl?: string, dir?: string): SessionFile | null;
|
|
51
|
+
export declare function saveSession(session: SessionFile, dir?: string): string;
|
|
52
|
+
/** Record that a command just used this session; best effort, never throws. */
|
|
53
|
+
export declare function touchSession(serverUrl: string, dir?: string, now?: number): void;
|
|
54
|
+
export declare function clearSession(serverUrl: string, dir?: string): boolean;
|
|
55
|
+
//# sourceMappingURL=session-store.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session-store.d.ts","sourceRoot":"","sources":["../../src/hub/session-store.ts"],"names":[],"mappings":"AAYA,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;IACzB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IACxB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,QAAQ,CAAC,MAAM,EAAE,SAAS;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,EAAE,CAAA;IAC5D,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;IAC1B,qFAAqF;IACrF,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAA;CAC7B;AAED,+EAA+E;AAC/E,wBAAgB,iBAAiB,IAAI,MAAM,CAE1C;AAED,0EAA0E;AAC1E,wBAAgB,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAKvD;AAED,wBAAgB,oBAAoB,CAAC,SAAS,EAAE,MAAM,EAAE,GAAG,GAAE,MAA4B,GAAG,MAAM,CAEjG;AAED;;;;GAIG;AACH,wBAAgB,uBAAuB,CACrC,SAAS,EAAE,MAAM,EACjB,GAAG,GAAE,MAA4B,GAChC,MAAM,CAER;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAChC,SAAS,EAAE,MAAM,GAAG,SAAS,EAC7B,GAAG,GAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAe,EAC/D,GAAG,GAAE,MAA4B,GAChC,MAAM,GAAG,SAAS,CAMpB;AAeD,4EAA4E;AAC5E,wBAAgB,cAAc,CAAC,OAAO,EAAE,WAAW,GAAG,MAAM,CAE3D;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,GAAG,GAAE,MAA4B,GAAG,SAAS,WAAW,EAAE,CAEtF;AAoCD;;;;GAIG;AACH,wBAAgB,cAAc,CAC5B,QAAQ,EAAE,SAAS,WAAW,EAAE,EAChC,GAAG,GAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAe,GAC9D,WAAW,GAAG,IAAI,CAYpB;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,WAAW,CAUlE;AAED,wBAAgB,WAAW,CACzB,SAAS,CAAC,EAAE,MAAM,EAClB,GAAG,GAAE,MAA4B,GAChC,WAAW,GAAG,IAAI,CASpB;AAED,wBAAgB,WAAW,CAAC,OAAO,EAAE,WAAW,EAAE,GAAG,GAAE,MAA4B,GAAG,MAAM,CAK3F;AAED,+EAA+E;AAC/E,wBAAgB,YAAY,CAC1B,SAAS,EAAE,MAAM,EACjB,GAAG,GAAE,MAA4B,EACjC,GAAG,GAAE,MAAmB,GACvB,IAAI,CAQN;AAED,wBAAgB,YAAY,CAAC,SAAS,EAAE,MAAM,EAAE,GAAG,GAAE,MAA4B,GAAG,OAAO,CAK1F"}
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `camstack login` session cache — `~/.camstack/<host>.json` (0600), one
|
|
3
|
+
* file per hub. Moved here from the CLI so every hub-talking tool (CLI,
|
|
4
|
+
* `scripts/hub/hub.mjs`, the operator MCP) reads the SAME cache through the
|
|
5
|
+
* SAME code. The cache holds a long-lived scoped token (`cst_`), never a
|
|
6
|
+
* password and never a JWT.
|
|
7
|
+
*/
|
|
8
|
+
import * as fs from 'node:fs';
|
|
9
|
+
import * as os from 'node:os';
|
|
10
|
+
import * as path from 'node:path';
|
|
11
|
+
import { normalizeHubAddress } from './hub-address.js';
|
|
12
|
+
/** Where the cache lives; injectable so a test never touches the real home. */
|
|
13
|
+
export function defaultSessionDir() {
|
|
14
|
+
return path.join(os.homedir(), '.camstack');
|
|
15
|
+
}
|
|
16
|
+
/** Slug a server URL into a single filesystem-safe filename component. */
|
|
17
|
+
export function slugForServer(serverUrl) {
|
|
18
|
+
return serverUrl
|
|
19
|
+
.replace(/^https?:\/\//, '')
|
|
20
|
+
.replace(/[:/?#]+/g, '_')
|
|
21
|
+
.replace(/_+$/, '');
|
|
22
|
+
}
|
|
23
|
+
export function sessionFileForServer(serverUrl, dir = defaultSessionDir()) {
|
|
24
|
+
return path.join(dir, `${slugForServer(serverUrl)}.json`);
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Where an operator drops a `csa_` admin token for a hub (owner-only file,
|
|
28
|
+
* D816). The extension is not `.json`, so the newest-session fallback below
|
|
29
|
+
* never mistakes it for a session.
|
|
30
|
+
*/
|
|
31
|
+
export function adminTokenFileForServer(serverUrl, dir = defaultSessionDir()) {
|
|
32
|
+
return path.join(dir, `${slugForServer(serverUrl)}.admin-token`);
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* The admin token file to use, or `undefined` when none exists: the path named
|
|
36
|
+
* by `$CAMSTACK_ADMIN_TOKEN_FILE` (a PATH, never the token), else the default
|
|
37
|
+
* file for `serverUrl`.
|
|
38
|
+
*/
|
|
39
|
+
export function findAdminTokenFile(serverUrl, env = process.env, dir = defaultSessionDir()) {
|
|
40
|
+
const named = env['CAMSTACK_ADMIN_TOKEN_FILE'];
|
|
41
|
+
if (named && named.trim() !== '')
|
|
42
|
+
return named;
|
|
43
|
+
if (!serverUrl)
|
|
44
|
+
return undefined;
|
|
45
|
+
const candidate = adminTokenFileForServer(serverUrl, dir);
|
|
46
|
+
return fs.existsSync(candidate) ? candidate : undefined;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Resolve the right session file for the operator-supplied server URL.
|
|
50
|
+
* With no server, fall back to the most recently touched session — an
|
|
51
|
+
* operator typically works with one hub at a time.
|
|
52
|
+
*/
|
|
53
|
+
function resolveSessionFile(serverUrl, dir) {
|
|
54
|
+
if (serverUrl) {
|
|
55
|
+
const p = sessionFileForServer(serverUrl, dir);
|
|
56
|
+
return fs.existsSync(p) ? p : null;
|
|
57
|
+
}
|
|
58
|
+
return defaultSessionFile(dir);
|
|
59
|
+
}
|
|
60
|
+
/** When a session was last used: `lastUsedAt`, else when it was created. */
|
|
61
|
+
export function sessionRecency(session) {
|
|
62
|
+
return session.lastUsedAt ?? session.createdAt;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Every readable saved session, most recently used first (ties: file mtime).
|
|
66
|
+
* A corrupt or partial file is skipped, never fatal.
|
|
67
|
+
*/
|
|
68
|
+
export function listSessions(dir = defaultSessionDir()) {
|
|
69
|
+
return listSessionEntries(dir).map((e) => e.session);
|
|
70
|
+
}
|
|
71
|
+
function listSessionEntries(dir) {
|
|
72
|
+
if (!fs.existsSync(dir))
|
|
73
|
+
return [];
|
|
74
|
+
const entries = [];
|
|
75
|
+
for (const name of fs.readdirSync(dir)) {
|
|
76
|
+
if (!name.endsWith('.json'))
|
|
77
|
+
continue;
|
|
78
|
+
const file = path.join(dir, name);
|
|
79
|
+
try {
|
|
80
|
+
const parsed = JSON.parse(fs.readFileSync(file, 'utf8'));
|
|
81
|
+
if (isSessionFile(parsed)) {
|
|
82
|
+
entries.push({
|
|
83
|
+
file,
|
|
84
|
+
session: parsed,
|
|
85
|
+
mtime: fs.statSync(file).mtimeMs,
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
catch {
|
|
90
|
+
// an unreadable file is not a session
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
return entries.toSorted((a, b) => sessionRecency(b.session) - sessionRecency(a.session) || b.mtime - a.mtime);
|
|
94
|
+
}
|
|
95
|
+
function defaultSessionFile(dir) {
|
|
96
|
+
return listSessionEntries(dir)[0]?.file ?? null;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* THE default-session rule, used by every command that is given no server:
|
|
100
|
+
* 1. the session of `$CAMSTACK_SERVER`, when one is set and saved;
|
|
101
|
+
* 2. otherwise the most recently used session (`lastUsedAt`, else `createdAt`).
|
|
102
|
+
*/
|
|
103
|
+
export function defaultSession(sessions, env = process.env) {
|
|
104
|
+
const named = env['CAMSTACK_SERVER']?.trim();
|
|
105
|
+
if (named) {
|
|
106
|
+
try {
|
|
107
|
+
const server = normalizeHubAddress(named);
|
|
108
|
+
const hit = sessions.find((s) => s.server === server);
|
|
109
|
+
if (hit)
|
|
110
|
+
return hit;
|
|
111
|
+
}
|
|
112
|
+
catch {
|
|
113
|
+
// a malformed $CAMSTACK_SERVER is reported by the command that resolves it
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
return sessions.toSorted((a, b) => sessionRecency(b) - sessionRecency(a))[0] ?? null;
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Shape check for a cached session blob. A partial or corrupted cache file
|
|
120
|
+
* (e.g. after a crashed login) is treated as "no session" instead of crashing
|
|
121
|
+
* a later `.slice` on undefined.
|
|
122
|
+
*/
|
|
123
|
+
export function isSessionFile(value) {
|
|
124
|
+
if (value === null || typeof value !== 'object')
|
|
125
|
+
return false;
|
|
126
|
+
const v = value;
|
|
127
|
+
if (typeof v.server !== 'string')
|
|
128
|
+
return false;
|
|
129
|
+
if (typeof v.username !== 'string')
|
|
130
|
+
return false;
|
|
131
|
+
if (typeof v.token !== 'string')
|
|
132
|
+
return false;
|
|
133
|
+
if (typeof v.tokenId !== 'string')
|
|
134
|
+
return false;
|
|
135
|
+
if (typeof v.createdAt !== 'number')
|
|
136
|
+
return false;
|
|
137
|
+
if (!Array.isArray(v.scopes))
|
|
138
|
+
return false;
|
|
139
|
+
return true;
|
|
140
|
+
}
|
|
141
|
+
export function loadSession(serverUrl, dir = defaultSessionDir()) {
|
|
142
|
+
const file = resolveSessionFile(serverUrl, dir);
|
|
143
|
+
if (!file)
|
|
144
|
+
return null;
|
|
145
|
+
try {
|
|
146
|
+
const parsed = JSON.parse(fs.readFileSync(file, 'utf8'));
|
|
147
|
+
return isSessionFile(parsed) ? parsed : null;
|
|
148
|
+
}
|
|
149
|
+
catch {
|
|
150
|
+
return null;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
export function saveSession(session, dir = defaultSessionDir()) {
|
|
154
|
+
if (!fs.existsSync(dir))
|
|
155
|
+
fs.mkdirSync(dir, { recursive: true, mode: 0o700 });
|
|
156
|
+
const file = sessionFileForServer(session.server, dir);
|
|
157
|
+
fs.writeFileSync(file, JSON.stringify(session, null, 2), { mode: 0o600 });
|
|
158
|
+
return file;
|
|
159
|
+
}
|
|
160
|
+
/** Record that a command just used this session; best effort, never throws. */
|
|
161
|
+
export function touchSession(serverUrl, dir = defaultSessionDir(), now = Date.now()) {
|
|
162
|
+
const session = loadSession(serverUrl, dir);
|
|
163
|
+
if (!session)
|
|
164
|
+
return;
|
|
165
|
+
try {
|
|
166
|
+
saveSession({ ...session, lastUsedAt: now }, dir);
|
|
167
|
+
}
|
|
168
|
+
catch {
|
|
169
|
+
// a read-only home must not fail the command that used the session
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
export function clearSession(serverUrl, dir = defaultSessionDir()) {
|
|
173
|
+
const file = sessionFileForServer(serverUrl, dir);
|
|
174
|
+
if (!fs.existsSync(file))
|
|
175
|
+
return false;
|
|
176
|
+
fs.unlinkSync(file);
|
|
177
|
+
return true;
|
|
178
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hub candidates shared by every client that looks for a hub (D838, D839): the
|
|
3
|
+
* CLI's `login` / `discover` and the agent's local UI. Candidates come from
|
|
4
|
+
* what the LAN announces over mDNS plus whatever the caller already knows
|
|
5
|
+
* (cached sessions for the CLI, the configured hub address for an agent); each
|
|
6
|
+
* is probed on its https port, unreachable ones are dropped, the rest are
|
|
7
|
+
* deduped by host:port with every source that named them kept.
|
|
8
|
+
*/
|
|
9
|
+
import { type BrowseOptions, type MdnsHub } from './mdns-browse.js';
|
|
10
|
+
export declare const MDNS_SOURCE_LABEL = "LAN (mDNS)";
|
|
11
|
+
/** One reachable hub and everything that said so. */
|
|
12
|
+
export interface HubCandidate {
|
|
13
|
+
/** `https://host:port`, the dedupe key's origin. */
|
|
14
|
+
readonly url: string;
|
|
15
|
+
readonly host: string;
|
|
16
|
+
readonly port: number;
|
|
17
|
+
readonly nodeId: string | null;
|
|
18
|
+
readonly version: string | null;
|
|
19
|
+
/** Human labels: "LAN (mDNS)", "saved session admin", "CAMSTACK_HUB_URL"… */
|
|
20
|
+
readonly sources: readonly string[];
|
|
21
|
+
}
|
|
22
|
+
/** A hub some source named, before it is probed. */
|
|
23
|
+
export interface RawCandidate {
|
|
24
|
+
readonly url: string;
|
|
25
|
+
readonly source: string;
|
|
26
|
+
readonly nodeId?: string | null;
|
|
27
|
+
readonly version?: string | null;
|
|
28
|
+
}
|
|
29
|
+
export interface DiscoverHubsDeps {
|
|
30
|
+
/** Hubs the caller already knows, each tagged with where it learned it. */
|
|
31
|
+
readonly known?: readonly RawCandidate[];
|
|
32
|
+
readonly browse?: (options: BrowseOptions) => Promise<readonly MdnsHub[]>;
|
|
33
|
+
readonly probe?: (host: string, port: number) => Promise<boolean>;
|
|
34
|
+
readonly mdnsTimeoutMs?: number;
|
|
35
|
+
readonly onProblem?: (message: string) => void;
|
|
36
|
+
}
|
|
37
|
+
/** `https://host:port` for any URL-ish string; null when it is not an http(s) URL. */
|
|
38
|
+
export declare function normalizeHubUrl(value: string): {
|
|
39
|
+
url: string;
|
|
40
|
+
host: string;
|
|
41
|
+
port: number;
|
|
42
|
+
} | null;
|
|
43
|
+
/** Merge raw candidates by host:port, keeping every source and any identity. */
|
|
44
|
+
export declare function mergeCandidates(raw: readonly RawCandidate[]): readonly HubCandidate[];
|
|
45
|
+
/** The hubs worth offering: announced or known, deduped, and answering on https. */
|
|
46
|
+
export declare function discoverHubs(deps?: DiscoverHubsDeps): Promise<readonly HubCandidate[]>;
|
|
47
|
+
/**
|
|
48
|
+
* HEAD probe with a short timeout. `rejectUnauthorized: false` is intentional —
|
|
49
|
+
* hubs serve a private-CA certificate and this only asks "is something
|
|
50
|
+
* answering https here"; no credential is ever sent.
|
|
51
|
+
*/
|
|
52
|
+
export declare function probeHttps(host: string, port: number): Promise<boolean>;
|
|
53
|
+
//# sourceMappingURL=hub-candidates.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hub-candidates.d.ts","sourceRoot":"","sources":["../../src/hub-discovery/hub-candidates.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAAE,KAAK,aAAa,EAAkB,KAAK,OAAO,EAAE,MAAM,kBAAkB,CAAA;AAKnF,eAAO,MAAM,iBAAiB,eAAe,CAAA;AAE7C,qDAAqD;AACrD,MAAM,WAAW,YAAY;IAC3B,oDAAoD;IACpD,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;IACpB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAA;IAC9B,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAA;IAC/B,6EAA6E;IAC7E,QAAQ,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,CAAA;CACpC;AAED,oDAAoD;AACpD,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;IACpB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAC/B,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CACjC;AAED,MAAM,WAAW,gBAAgB;IAC/B,2EAA2E;IAC3E,QAAQ,CAAC,KAAK,CAAC,EAAE,SAAS,YAAY,EAAE,CAAA;IACxC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,aAAa,KAAK,OAAO,CAAC,SAAS,OAAO,EAAE,CAAC,CAAA;IACzE,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,CAAA;IACjE,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,CAAA;IAC/B,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAA;CAC/C;AAED,sFAAsF;AACtF,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAejG;AAED,gFAAgF;AAChF,wBAAgB,eAAe,CAAC,GAAG,EAAE,SAAS,YAAY,EAAE,GAAG,SAAS,YAAY,EAAE,CAmBrF;AAED,oFAAoF;AACpF,wBAAsB,YAAY,CAAC,IAAI,GAAE,gBAAqB,GAAG,OAAO,CAAC,SAAS,YAAY,EAAE,CAAC,CAmBhG;AAED;;;;GAIG;AACH,wBAAsB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAwB7E"}
|