@hasna/instructions 0.4.33 → 0.4.35
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 +6 -7
- package/dist/cli/index.js +682 -155
- package/dist/data/config-store.d.ts +4 -4
- package/dist/data/config-store.d.ts.map +1 -1
- package/dist/db/database.d.ts.map +1 -1
- package/dist/generated/storage-kit/backend.d.ts +20 -0
- package/dist/generated/storage-kit/backend.d.ts.map +1 -0
- package/dist/generated/storage-kit/index.d.ts +2 -2
- package/dist/generated/storage-kit/index.d.ts.map +1 -1
- package/dist/generated/storage-kit/migrations.d.ts.map +1 -1
- package/dist/generated/storage-kit/own.d.ts +11 -0
- package/dist/generated/storage-kit/own.d.ts.map +1 -0
- package/dist/generated/storage-kit/pool.d.ts +7 -6
- package/dist/generated/storage-kit/pool.d.ts.map +1 -1
- package/dist/generated/storage-kit/tls.d.ts +30 -3
- package/dist/generated/storage-kit/tls.d.ts.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +39 -14
- package/dist/lib/retired-storage-mode.d.ts +8 -0
- package/dist/lib/retired-storage-mode.d.ts.map +1 -0
- package/dist/mcp/index.js +43 -14
- package/dist/server/cloud.d.ts +2 -2
- package/dist/server/cloud.d.ts.map +1 -1
- package/dist/server/index.d.ts +1 -1
- package/dist/server/index.js +456 -271
- package/package.json +2 -1
- package/dist/generated/storage-kit/mode.d.ts +0 -48
- package/dist/generated/storage-kit/mode.d.ts.map +0 -1
|
@@ -25,14 +25,14 @@ export declare function isCloudAuthError(err: unknown): err is CloudHttpError;
|
|
|
25
25
|
*/
|
|
26
26
|
export declare function formatCliError(err: unknown, env?: NodeJS.ProcessEnv): string;
|
|
27
27
|
/**
|
|
28
|
-
* Resolve
|
|
29
|
-
* - both vars set -> config (
|
|
28
|
+
* Resolve the HTTP API config from the environment.
|
|
29
|
+
* - both vars set -> config (HTTP `/v1` API transport)
|
|
30
30
|
* - neither set -> null (local SQLite)
|
|
31
31
|
* - exactly one set -> throws (no silent local drift)
|
|
32
32
|
*/
|
|
33
33
|
export declare function resolveCloudConfig(env?: NodeJS.ProcessEnv): CloudConfig | null;
|
|
34
|
-
/** True when
|
|
35
|
-
export declare function
|
|
34
|
+
/** True when the HTTP API transport is active (`HASNA_INSTRUCTIONS_API_URL` set). */
|
|
35
|
+
export declare function isApiTransport(env?: NodeJS.ProcessEnv): boolean;
|
|
36
36
|
/**
|
|
37
37
|
* The single Store contract. Two transports implement it: LocalConfigStore
|
|
38
38
|
* (on-box SQLite) and CloudConfigStore (HTTP /v1 + bearer key).
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config-store.d.ts","sourceRoot":"","sources":["../../src/data/config-store.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"config-store.d.ts","sourceRoot":"","sources":["../../src/data/config-store.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAuC3C,OAAO,EAAkF,KAAK,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAEvI,OAAO,KAAK,EACV,MAAM,EACN,YAAY,EACZ,cAAc,EACd,iBAAiB,EACjB,kBAAkB,EAClB,OAAO,EACP,cAAc,EACd,OAAO,EACP,kBAAkB,EAClB,eAAe,EACf,qBAAqB,EACrB,iBAAiB,EACjB,kBAAkB,EAClB,oBAAoB,EACpB,wBAAwB,EACxB,mBAAmB,EACnB,uBAAuB,EACxB,MAAM,mBAAmB,CAAC;AAK3B,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,qBAAa,cAAe,SAAQ,KAAK;IAC3B,QAAQ,CAAC,MAAM,EAAE,MAAM;IAAmB,QAAQ,CAAC,IAAI,CAAC,EAAE,OAAO;gBAAxD,MAAM,EAAE,MAAM,EAAE,OAA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CAAC,qBAAqB,CAAC;IAgD3B,eAAe,CAAC,QAAQ,CAAC,EAAE,MAAM,EAAE,EAAE,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAUhF,oBAAoB,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAItD,YAAY,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;IAKlC,YAAY,CAAC,KAAK,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC;IASjD,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;CAM7B;AAED,+EAA+E;AAC/E,wBAAgB,kBAAkB,CAAC,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,WAAW,CAGpF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"database.d.ts","sourceRoot":"","sources":["../../src/db/database.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"database.d.ts","sourceRoot":"","sources":["../../src/db/database.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAgBtC,wBAAgB,IAAI,IAAI,MAAM,CAE7B;AAED,wBAAgB,GAAG,IAAI,MAAM,CAE5B;AAED,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAK5C;AAuFD,wBAAgB,WAAW,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,QAAQ,CAsBnD;AAED,wBAAgB,aAAa,IAAI,IAAI,CAKpC;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,IAAI,IAAI,CAOzC;AAgED,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACzB;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,aAAa,EAAE,EAAE,CAAC,EAAE,QAAQ,GAAG,IAAI,CAMxE"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export declare const SERVER_DATA_BACKENDS: readonly ["sqlite", "postgresql"];
|
|
2
|
+
export type ServerDataBackend = (typeof SERVER_DATA_BACKENDS)[number];
|
|
3
|
+
export type Env = Record<string, string | undefined>;
|
|
4
|
+
/** Upper-snake env token for an app name, e.g. `todos` -> `TODOS`. */
|
|
5
|
+
export declare function envToken(name: string): string;
|
|
6
|
+
export interface ServerDataBackendEnvKeys {
|
|
7
|
+
databaseUrlKeys: string[];
|
|
8
|
+
}
|
|
9
|
+
export declare function serverDataBackendEnvKeys(name: string): ServerDataBackendEnvKeys;
|
|
10
|
+
export declare function assertNoLegacyStorageMode(name: string, env?: Env): void;
|
|
11
|
+
export interface ServerDataBackendResolution {
|
|
12
|
+
backend: ServerDataBackend;
|
|
13
|
+
source: string;
|
|
14
|
+
databaseUrlPresent: boolean;
|
|
15
|
+
databaseUrlSource: string | null;
|
|
16
|
+
}
|
|
17
|
+
export declare function resolveServerDataBackend(name: string, env?: Env): ServerDataBackendResolution;
|
|
18
|
+
/** Resolve the database URL without logging it. Returns `null` when unset. */
|
|
19
|
+
export declare function resolveDatabaseUrl(name: string, env?: Env): string | null;
|
|
20
|
+
//# sourceMappingURL=backend.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"backend.d.ts","sourceRoot":"","sources":["../../../src/generated/storage-kit/backend.ts"],"names":[],"mappings":"AAaA,eAAO,MAAM,oBAAoB,mCAAoC,CAAC;AACtE,MAAM,MAAM,iBAAiB,GAAG,CAAC,OAAO,oBAAoB,CAAC,CAAC,MAAM,CAAC,CAAC;AAEtE,MAAM,MAAM,GAAG,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC;AAErD,sEAAsE;AACtE,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAE7C;AAED,MAAM,WAAW,wBAAwB;IACvC,eAAe,EAAE,MAAM,EAAE,CAAC;CAC3B;AAED,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,MAAM,GAAG,wBAAwB,CAK/E;AA+BD,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,GAAE,GAAiB,GAAG,IAAI,CASpF;AAED,MAAM,WAAW,2BAA2B;IAC1C,OAAO,EAAE,iBAAiB,CAAC;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,kBAAkB,EAAE,OAAO,CAAC;IAC5B,iBAAiB,EAAE,MAAM,GAAG,IAAI,CAAC;CAClC;AAED,wBAAgB,wBAAwB,CACtC,IAAI,EAAE,MAAM,EACZ,GAAG,GAAE,GAAiB,GACrB,2BAA2B,CAiB7B;AAED,8EAA8E;AAC9E,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,GAAE,GAAiB,GAAG,MAAM,GAAG,IAAI,CAItF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/generated/storage-kit/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/generated/storage-kit/index.ts"],"names":[],"mappings":"AAaA,eAAO,MAAM,WAAW,WAAW,CAAC;AAEpC,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,iBAAiB,CAAC;AAChC,cAAc,aAAa,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"migrations.d.ts","sourceRoot":"","sources":["../../../src/generated/storage-kit/migrations.ts"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EAA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,OAAO,CAAC,QAAQ,CAAC,UAAU;IAJ7B,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAS;gBAGlB,MAAM,EAAE,gBAAgB,EACxB,UAAU,EAAE,SAAS,SAAS,EAAE,EACjD,OAAO,GAAE,sBAA2B;IAahC,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC;IAU7B,WAAW,IAAI,OAAO,CAAC,gBAAgB,EAAE,CAAC;YAKlC,WAAW;IAWzB,oEAAoE;IACpE,OAAO,CAAC,SAAS;IAsBjB,yEAAyE;IACnE,OAAO,CAAC,IAAI,GAAE;QAAE,MAAM,CAAC,EAAE,OAAO,CAAA;KAAO,GAAG,OAAO,CAAC,eAAe,CAAC;CAmBzE;AAED,kEAAkE;AAClE,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,gBAAgB,EACxB,UAAU,EAAE,SAAS,SAAS,EAAE,EAChC,OAAO,GAAE,sBAA2B,GACnC,eAAe,CAEjB"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Read `key` from `source` only when `source` OWNS it.
|
|
3
|
+
*
|
|
4
|
+
* Returns `undefined` for an inherited property and for a null/undefined or
|
|
5
|
+
* non-object source, so a guarded read is a drop-in for `source?.[key]` that
|
|
6
|
+
* cannot be answered by the prototype chain.
|
|
7
|
+
*/
|
|
8
|
+
export declare function ownProp<T>(source: unknown, key: string): T | undefined;
|
|
9
|
+
/** `ownProp` narrowed to a string, so a polluted non-string cannot slip through. */
|
|
10
|
+
export declare function ownString(source: unknown, key: string): string | undefined;
|
|
11
|
+
//# sourceMappingURL=own.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"own.d.ts","sourceRoot":"","sources":["../../../src/generated/storage-kit/own.ts"],"names":[],"mappings":"AAyCA;;;;;;GAMG;AACH,wBAAgB,OAAO,CAAC,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,GAAG,CAAC,GAAG,SAAS,CAMtE;AAED,oFAAoF;AACpF,wBAAgB,SAAS,CAAC,MAAM,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAG1E"}
|
|
@@ -14,21 +14,22 @@ export interface CreatePgPoolOptions extends TlsResolveOptions {
|
|
|
14
14
|
}
|
|
15
15
|
/** Build a `pg.Pool` with fleet-standard TLS handling. */
|
|
16
16
|
export declare function createPgPool(options: CreatePgPoolOptions): Pool;
|
|
17
|
-
export interface
|
|
17
|
+
export interface CreateServerPoolFromEnvOptions extends TlsResolveOptions {
|
|
18
18
|
max?: number;
|
|
19
19
|
idleTimeoutMillis?: number;
|
|
20
20
|
connectionTimeoutMillis?: number;
|
|
21
21
|
applicationName?: string;
|
|
22
22
|
}
|
|
23
|
-
export interface
|
|
23
|
+
export interface ServerPoolFromEnv {
|
|
24
24
|
client: PoolQueryClient;
|
|
25
25
|
connectionSource: string;
|
|
26
26
|
}
|
|
27
27
|
/**
|
|
28
|
-
* Resolve
|
|
28
|
+
* Resolve backend + database URL from the environment and build the server's
|
|
29
|
+
* PostgreSQL pool.
|
|
29
30
|
*
|
|
30
|
-
* Throws when
|
|
31
|
-
*
|
|
31
|
+
* Throws when no database URL selects the `postgresql` backend. Never logs the
|
|
32
|
+
* URL.
|
|
32
33
|
*/
|
|
33
|
-
export declare function
|
|
34
|
+
export declare function createServerPoolFromEnv(appName: string, options?: CreateServerPoolFromEnvOptions): ServerPoolFromEnv;
|
|
34
35
|
//# sourceMappingURL=pool.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pool.d.ts","sourceRoot":"","sources":["../../../src/generated/storage-kit/pool.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,IAAI,EAAc,MAAM,IAAI,CAAC;AAE3C,OAAO,
|
|
1
|
+
{"version":3,"file":"pool.d.ts","sourceRoot":"","sources":["../../../src/generated/storage-kit/pool.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,IAAI,EAAc,MAAM,IAAI,CAAC;AAE3C,OAAO,EAIL,KAAK,iBAAiB,EACvB,MAAM,UAAU,CAAC;AAClB,OAAO,EAAqB,KAAK,eAAe,EAAE,MAAM,YAAY,CAAC;AAgDrE,MAAM,WAAW,mBAAoB,SAAQ,iBAAiB;IAC5D,gBAAgB,EAAE,MAAM,CAAC;IACzB,8DAA8D;IAC9D,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,gCAAgC;IAChC,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,2CAA2C;IAC3C,uBAAuB,CAAC,EAAE,MAAM,CAAC;IACjC,yEAAyE;IACzE,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,0DAA0D;AAC1D,wBAAgB,YAAY,CAAC,OAAO,EAAE,mBAAmB,GAAG,IAAI,CAmC/D;AAED,MAAM,WAAW,8BAA+B,SAAQ,iBAAiB;IACvE,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,uBAAuB,CAAC,EAAE,MAAM,CAAC;IACjC,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,eAAe,CAAC;IACxB,gBAAgB,EAAE,MAAM,CAAC;CAC1B;AAED;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CACrC,OAAO,EAAE,MAAM,EACf,OAAO,GAAE,8BAAmC,GAC3C,iBAAiB,CAoBnB"}
|
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
export type PgSslConfig = boolean | {
|
|
3
3
|
rejectUnauthorized: boolean;
|
|
4
4
|
ca?: string;
|
|
5
|
+
cert?: string;
|
|
6
|
+
key?: string;
|
|
7
|
+
passphrase?: string;
|
|
5
8
|
};
|
|
6
9
|
export interface TlsResolveOptions {
|
|
7
10
|
/** Inline CA bundle (PEM). Wins over every other CA source. */
|
|
@@ -12,15 +15,39 @@ export interface TlsResolveOptions {
|
|
|
12
15
|
env?: Record<string, string | undefined>;
|
|
13
16
|
}
|
|
14
17
|
export type SslMode = "disable" | "prefer" | "require" | "verify-ca" | "verify-full";
|
|
18
|
+
/**
|
|
19
|
+
* Remove the TLS query parameters once this module has resolved them into an
|
|
20
|
+
* explicit `ssl` option. pg re-parses `connectionString` AFTER merging pool
|
|
21
|
+
* options and lets the parse win, so leaving `sslmode` (or `ssl`, `sslcert`,
|
|
22
|
+
* `sslkey`, `sslrootcert`, `sslnegotiation`) in the URL replaces the resolved
|
|
23
|
+
* SSL object with pg's own — discarding the CA bundle with it.
|
|
24
|
+
*
|
|
25
|
+
* Non-TLS parameters and any fragment are preserved exactly.
|
|
26
|
+
*/
|
|
27
|
+
export declare function connectionStringWithoutTlsParameters(connectionString: string): string;
|
|
28
|
+
/**
|
|
29
|
+
* Preserve pg's transport negotiation choice outside the stripped URL, so
|
|
30
|
+
* `sslnegotiation=direct` survives as an explicit pool option instead of being
|
|
31
|
+
* silently dropped.
|
|
32
|
+
*/
|
|
33
|
+
export declare function sslNegotiationFromConnectionString(connectionString: string): "postgres" | "direct" | undefined;
|
|
15
34
|
/**
|
|
16
35
|
* Extract the effective `sslmode` from a Postgres connection string. Honors the
|
|
17
|
-
* `sslmode` query param
|
|
18
|
-
*
|
|
36
|
+
* `sslmode` query param, the legacy `ssl=true` boolean, and pg's rule that
|
|
37
|
+
* `sslnegotiation=direct` implies TLS when no explicit SSL setting is present.
|
|
38
|
+
* Returns `disable` when TLS is not requested.
|
|
19
39
|
*/
|
|
20
40
|
export declare function sslModeFromConnectionString(connectionString: string): SslMode;
|
|
21
41
|
/**
|
|
22
42
|
* Resolve the `pg` ssl config for a connection string. See the module header
|
|
23
|
-
* for the full mode table.
|
|
43
|
+
* for the full mode table.
|
|
44
|
+
*
|
|
45
|
+
* Returns `false` when TLS was explicitly switched off, and `undefined` when the
|
|
46
|
+
* DSN expressed no TLS policy at all — those are different answers, and pg
|
|
47
|
+
* treats them differently: only `undefined` lets `PGSSLMODE` decide.
|
|
48
|
+
*
|
|
49
|
+
* The caller MUST hand pg `connectionStringWithoutTlsParameters(connectionString)`
|
|
50
|
+
* rather than the original DSN, or pg discards everything resolved here.
|
|
24
51
|
*/
|
|
25
52
|
export declare function resolveTlsConfig(connectionString: string, options?: TlsResolveOptions): PgSslConfig | undefined;
|
|
26
53
|
//# sourceMappingURL=tls.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tls.d.ts","sourceRoot":"","sources":["../../../src/generated/storage-kit/tls.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"tls.d.ts","sourceRoot":"","sources":["../../../src/generated/storage-kit/tls.ts"],"names":[],"mappings":"AAwNA,iEAAiE;AACjE,MAAM,MAAM,WAAW,GACnB,OAAO,GACP;IACE,kBAAkB,EAAE,OAAO,CAAC;IAC5B,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AAEN,MAAM,WAAW,iBAAiB;IAChC,+DAA+D;IAC/D,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,uEAAuE;IACvE,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,wEAAwE;IACxE,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC;CAC1C;AAED,MAAM,MAAM,OAAO,GAAG,SAAS,GAAG,QAAQ,GAAG,SAAS,GAAG,WAAW,GAAG,aAAa,CAAC;AA+BrF;;;;;;;;GAQG;AACH,wBAAgB,oCAAoC,CAAC,gBAAgB,EAAE,MAAM,GAAG,MAAM,CAOrF;AAgBD;;;;GAIG;AACH,wBAAgB,kCAAkC,CAChD,gBAAgB,EAAE,MAAM,GACvB,UAAU,GAAG,QAAQ,GAAG,SAAS,CAKnC;AAED;;;;;GAKG;AACH,wBAAgB,2BAA2B,CAAC,gBAAgB,EAAE,MAAM,GAAG,OAAO,CAmD7E;AA6CD;;;;;;;;;;GAUG;AACH,wBAAgB,gBAAgB,CAC9B,gBAAgB,EAAE,MAAM,EACxB,OAAO,GAAE,iBAAsB,GAC9B,WAAW,GAAG,SAAS,CAgEzB"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export * from "./types/index.js";
|
|
2
|
-
export { CloudConfigStore, CloudHttpError, LocalConfigStore,
|
|
2
|
+
export { CloudConfigStore, CloudHttpError, LocalConfigStore, isApiTransport, resolveCloudConfig, resolveConfigStore, } from "./data/config-store.js";
|
|
3
3
|
export type { CloudConfig, ConfigStore } from "./data/config-store.js";
|
|
4
4
|
export { boundedReadPage, normalizeBoundedReadOptions } from "./lib/bounded-read.js";
|
|
5
5
|
export { currentHostname, currentOs, currentArch } from "./db/machines.js";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,cAAc,kBAAkB,CAAC;AAIjC,OAAO,EACL,gBAAgB,EAChB,cAAc,EACd,gBAAgB,EAChB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,cAAc,kBAAkB,CAAC;AAIjC,OAAO,EACL,gBAAgB,EAChB,cAAc,EACd,gBAAgB,EAChB,cAAc,EACd,kBAAkB,EAClB,kBAAkB,GACnB,MAAM,wBAAwB,CAAC;AAChC,YAAY,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACvE,OAAO,EAAE,eAAe,EAAE,2BAA2B,EAAE,MAAM,uBAAuB,CAAC;AAGrF,OAAO,EAAE,eAAe,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC3E,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM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1G,YAAY,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAG5D,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,YAAY,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACrD,YAAY,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAGnE,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,cAAc,EAAE,qBAAqB,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC9H,YAAY,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGrD,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AACzE,YAAY,EAAE,YAAY,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAG/E,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAC3E,YAAY,EACV,qBAAqB,EACrB,yBAAyB,EACzB,wBAAwB,EACxB,sBAAsB,EACtB,qBAAqB,GACtB,MAAM,gCAAgC,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -106,6 +106,29 @@ import { Database } from "bun:sqlite";
|
|
|
106
106
|
import { existsSync, mkdirSync, rmSync } from "fs";
|
|
107
107
|
import { join } from "path";
|
|
108
108
|
import { randomUUID } from "crypto";
|
|
109
|
+
|
|
110
|
+
// src/lib/retired-storage-mode.ts
|
|
111
|
+
var LEGACY_STORAGE_MODE_KEYS = [
|
|
112
|
+
"HASNA_INSTRUCTIONS_STORAGE_MODE",
|
|
113
|
+
"HASNA_INSTRUCTIONS_MODE",
|
|
114
|
+
"INSTRUCTIONS_STORAGE_MODE",
|
|
115
|
+
"INSTRUCTIONS_MODE"
|
|
116
|
+
];
|
|
117
|
+
function firstDefinedEnvKey(env, keys) {
|
|
118
|
+
for (const key of keys) {
|
|
119
|
+
if (Object.hasOwn(env, key) && env[key] !== undefined)
|
|
120
|
+
return key;
|
|
121
|
+
}
|
|
122
|
+
return null;
|
|
123
|
+
}
|
|
124
|
+
function assertNoLegacyStorageMode(env = process.env) {
|
|
125
|
+
const legacyKey = firstDefinedEnvKey(env, LEGACY_STORAGE_MODE_KEYS);
|
|
126
|
+
if (!legacyKey)
|
|
127
|
+
return;
|
|
128
|
+
throw new Error(`${legacyKey} was removed. Deployment modes no longer exist: delete the storage-mode variable. ` + `The client uses the local SQLite store, or the HTTP API selected by ` + `HASNA_INSTRUCTIONS_API_URL + HASNA_INSTRUCTIONS_API_KEY. ` + `On the server, set HASNA_INSTRUCTIONS_DATABASE_URL to select the postgresql backend, ` + `or leave it unset for sqlite.`);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
// src/db/database.ts
|
|
109
132
|
function getDbPath() {
|
|
110
133
|
if (process.env["HASNA_INSTRUCTIONS_DB_PATH"]) {
|
|
111
134
|
return process.env["HASNA_INSTRUCTIONS_DB_PATH"];
|
|
@@ -210,8 +233,9 @@ var _db = null;
|
|
|
210
233
|
function getDatabase(path) {
|
|
211
234
|
if (_db)
|
|
212
235
|
return _db;
|
|
236
|
+
assertNoLegacyStorageMode();
|
|
213
237
|
if (!path && process.env["HASNA_INSTRUCTIONS_API_URL"] && process.env["HASNA_INSTRUCTIONS_API_KEY"]) {
|
|
214
|
-
throw new Error("instructions is
|
|
238
|
+
throw new Error("instructions is using the HTTP API transport (HASNA_INSTRUCTIONS_API_URL set): this command is not wired to the API yet. " + "Unset HASNA_INSTRUCTIONS_API_URL / HASNA_INSTRUCTIONS_API_KEY to use it against the local store.");
|
|
215
239
|
}
|
|
216
240
|
const dbPath = path || getDbPath();
|
|
217
241
|
const db = new Database(dbPath);
|
|
@@ -991,7 +1015,7 @@ import {
|
|
|
991
1015
|
} from "fs";
|
|
992
1016
|
import { basename, dirname, isAbsolute, join as join3, parse, relative, resolve } from "path";
|
|
993
1017
|
|
|
994
|
-
// node_modules/zod/v3/external.js
|
|
1018
|
+
// ../../node_modules/.bun/zod@3.25.76/node_modules/zod/v3/external.js
|
|
995
1019
|
var exports_external = {};
|
|
996
1020
|
__export(exports_external, {
|
|
997
1021
|
void: () => voidType,
|
|
@@ -1103,7 +1127,7 @@ __export(exports_external, {
|
|
|
1103
1127
|
BRAND: () => BRAND
|
|
1104
1128
|
});
|
|
1105
1129
|
|
|
1106
|
-
// node_modules/zod/v3/helpers/util.js
|
|
1130
|
+
// ../../node_modules/.bun/zod@3.25.76/node_modules/zod/v3/helpers/util.js
|
|
1107
1131
|
var util;
|
|
1108
1132
|
(function(util2) {
|
|
1109
1133
|
util2.assertEqual = (_) => {};
|
|
@@ -1234,7 +1258,7 @@ var getParsedType = (data) => {
|
|
|
1234
1258
|
}
|
|
1235
1259
|
};
|
|
1236
1260
|
|
|
1237
|
-
// node_modules/zod/v3/ZodError.js
|
|
1261
|
+
// ../../node_modules/.bun/zod@3.25.76/node_modules/zod/v3/ZodError.js
|
|
1238
1262
|
var ZodIssueCode = util.arrayToEnum([
|
|
1239
1263
|
"invalid_type",
|
|
1240
1264
|
"invalid_literal",
|
|
@@ -1353,7 +1377,7 @@ ZodError.create = (issues) => {
|
|
|
1353
1377
|
return error;
|
|
1354
1378
|
};
|
|
1355
1379
|
|
|
1356
|
-
// node_modules/zod/v3/locales/en.js
|
|
1380
|
+
// ../../node_modules/.bun/zod@3.25.76/node_modules/zod/v3/locales/en.js
|
|
1357
1381
|
var errorMap = (issue, _ctx) => {
|
|
1358
1382
|
let message;
|
|
1359
1383
|
switch (issue.code) {
|
|
@@ -1456,7 +1480,7 @@ var errorMap = (issue, _ctx) => {
|
|
|
1456
1480
|
};
|
|
1457
1481
|
var en_default = errorMap;
|
|
1458
1482
|
|
|
1459
|
-
// node_modules/zod/v3/errors.js
|
|
1483
|
+
// ../../node_modules/.bun/zod@3.25.76/node_modules/zod/v3/errors.js
|
|
1460
1484
|
var overrideErrorMap = en_default;
|
|
1461
1485
|
function setErrorMap(map) {
|
|
1462
1486
|
overrideErrorMap = map;
|
|
@@ -1464,7 +1488,7 @@ function setErrorMap(map) {
|
|
|
1464
1488
|
function getErrorMap() {
|
|
1465
1489
|
return overrideErrorMap;
|
|
1466
1490
|
}
|
|
1467
|
-
// node_modules/zod/v3/helpers/parseUtil.js
|
|
1491
|
+
// ../../node_modules/.bun/zod@3.25.76/node_modules/zod/v3/helpers/parseUtil.js
|
|
1468
1492
|
var makeIssue = (params) => {
|
|
1469
1493
|
const { data, path, errorMaps, issueData } = params;
|
|
1470
1494
|
const fullPath = [...path, ...issueData.path || []];
|
|
@@ -1570,14 +1594,14 @@ var isAborted = (x) => x.status === "aborted";
|
|
|
1570
1594
|
var isDirty = (x) => x.status === "dirty";
|
|
1571
1595
|
var isValid = (x) => x.status === "valid";
|
|
1572
1596
|
var isAsync = (x) => typeof Promise !== "undefined" && x instanceof Promise;
|
|
1573
|
-
// node_modules/zod/v3/helpers/errorUtil.js
|
|
1597
|
+
// ../../node_modules/.bun/zod@3.25.76/node_modules/zod/v3/helpers/errorUtil.js
|
|
1574
1598
|
var errorUtil;
|
|
1575
1599
|
(function(errorUtil2) {
|
|
1576
1600
|
errorUtil2.errToObj = (message) => typeof message === "string" ? { message } : message || {};
|
|
1577
1601
|
errorUtil2.toString = (message) => typeof message === "string" ? message : message?.message;
|
|
1578
1602
|
})(errorUtil || (errorUtil = {}));
|
|
1579
1603
|
|
|
1580
|
-
// node_modules/zod/v3/types.js
|
|
1604
|
+
// ../../node_modules/.bun/zod@3.25.76/node_modules/zod/v3/types.js
|
|
1581
1605
|
class ParseInputLazyPath {
|
|
1582
1606
|
constructor(parent, value, path, key) {
|
|
1583
1607
|
this._cachedPath = [];
|
|
@@ -4969,7 +4993,7 @@ var SECRET_KEY_PATTERN = /^(.*_?API_?KEY|.*_?TOKEN|.*_?SECRET|.*_?PASSWORD|.*_?P
|
|
|
4969
4993
|
var VALUE_PATTERNS = [
|
|
4970
4994
|
{ re: /npm_[A-Za-z0-9]{36,}/, reason: "npm token" },
|
|
4971
4995
|
{ re: /gh[pousr]_[A-Za-z0-9_]{36,}/, reason: "GitHub token" },
|
|
4972
|
-
{ re: /sk-ant-[A-Za-z0-9\-_]{40,}/, reason: "Anthropic API key" },
|
|
4996
|
+
{ re: /sk[-]ant-[A-Za-z0-9\-_]{40,}/, reason: "Anthropic API key" },
|
|
4973
4997
|
{ re: /sk-[A-Za-z0-9]{48,}/, reason: "OpenAI API key" },
|
|
4974
4998
|
{ re: /xoxb-[0-9]+-[A-Za-z0-9\-]+/, reason: "Slack bot token" },
|
|
4975
4999
|
{ re: /AIza[0-9A-Za-z\-_]{35}/, reason: "Google API key" },
|
|
@@ -11345,16 +11369,17 @@ function parseBoundedOrLegacyPage(value, legacyItems, options, label) {
|
|
|
11345
11369
|
var API_URL_ENV = "HASNA_INSTRUCTIONS_API_URL";
|
|
11346
11370
|
var API_KEY_ENV = "HASNA_INSTRUCTIONS_API_KEY";
|
|
11347
11371
|
function resolveCloudConfig(env = process.env) {
|
|
11372
|
+
assertNoLegacyStorageMode(env);
|
|
11348
11373
|
const apiUrl = env[API_URL_ENV]?.trim();
|
|
11349
11374
|
const apiKey = env[API_KEY_ENV]?.trim();
|
|
11350
11375
|
if (!apiUrl && !apiKey)
|
|
11351
11376
|
return null;
|
|
11352
11377
|
if (!apiUrl || !apiKey) {
|
|
11353
|
-
throw new Error(`API mode requires BOTH ${API_URL_ENV} and ${API_KEY_ENV}; only ` + `${apiUrl ? API_URL_ENV : API_KEY_ENV} is set. Set both to use the
|
|
11378
|
+
throw new Error(`API mode requires BOTH ${API_URL_ENV} and ${API_KEY_ENV}; only ` + `${apiUrl ? API_URL_ENV : API_KEY_ENV} is set. Set both to use the HTTP API, ` + `or unset both to use the local store.`);
|
|
11354
11379
|
}
|
|
11355
11380
|
return { apiUrl, apiKey };
|
|
11356
11381
|
}
|
|
11357
|
-
function
|
|
11382
|
+
function isApiTransport(env = process.env) {
|
|
11358
11383
|
return resolveCloudConfig(env) !== null;
|
|
11359
11384
|
}
|
|
11360
11385
|
|
|
@@ -14501,7 +14526,7 @@ var HOME_FILES = [
|
|
|
14501
14526
|
var TOKEN_VALUE_PATTERNS = [
|
|
14502
14527
|
{ re: /npm_[A-Za-z0-9]{36,}/, rule: "literal-npm-token", detail: "literal npm token-like value" },
|
|
14503
14528
|
{ re: /gh[pousr]_[A-Za-z0-9_]{36,}/, rule: "literal-github-token", detail: "literal GitHub token-like value" },
|
|
14504
|
-
{ re: /sk-ant-[A-Za-z0-9\-_]{40,}/, rule: "literal-anthropic-key", detail: "literal Anthropic key-like value" },
|
|
14529
|
+
{ re: /sk[-]ant-[A-Za-z0-9\-_]{40,}/, rule: "literal-anthropic-key", detail: "literal Anthropic key-like value" },
|
|
14505
14530
|
{ re: /sk-[A-Za-z0-9]{48,}/, rule: "literal-openai-key", detail: "literal OpenAI key-like value" },
|
|
14506
14531
|
{ re: /AKIA[0-9A-Z]{16}/, rule: "literal-aws-access-key", detail: "literal AWS access-key-like value" },
|
|
14507
14532
|
{ re: /xoxb-[0-9]+-[A-Za-z0-9-]+/, rule: "literal-slack-token", detail: "literal Slack token-like value" }
|
|
@@ -14899,7 +14924,7 @@ export {
|
|
|
14899
14924
|
machineContextToVariables,
|
|
14900
14925
|
legacyProfileConfigBinding,
|
|
14901
14926
|
isTemplate,
|
|
14902
|
-
|
|
14927
|
+
isApiTransport,
|
|
14903
14928
|
importConfigs,
|
|
14904
14929
|
hasSecrets,
|
|
14905
14930
|
getConfigsStatus,
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Throw when a retired storage-mode variable is set. Naming the retired var
|
|
3
|
+
* and the supported switches makes the error actionable without accepting the
|
|
4
|
+
* value. Safe to call from any entry (client store resolution, db guard,
|
|
5
|
+
* server backend resolution) — it is a no-op when no legacy key is set.
|
|
6
|
+
*/
|
|
7
|
+
export declare function assertNoLegacyStorageMode(env?: NodeJS.ProcessEnv): void;
|
|
8
|
+
//# sourceMappingURL=retired-storage-mode.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"retired-storage-mode.d.ts","sourceRoot":"","sources":["../../src/lib/retired-storage-mode.ts"],"names":[],"mappings":"AAwBA;;;;;GAKG;AACH,wBAAgB,yBAAyB,CAAC,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,IAAI,CAUpF"}
|
package/dist/mcp/index.js
CHANGED
|
@@ -73,6 +73,30 @@ var init_types = __esm(() => {
|
|
|
73
73
|
};
|
|
74
74
|
});
|
|
75
75
|
|
|
76
|
+
// src/lib/retired-storage-mode.ts
|
|
77
|
+
function firstDefinedEnvKey(env, keys) {
|
|
78
|
+
for (const key of keys) {
|
|
79
|
+
if (Object.hasOwn(env, key) && env[key] !== undefined)
|
|
80
|
+
return key;
|
|
81
|
+
}
|
|
82
|
+
return null;
|
|
83
|
+
}
|
|
84
|
+
function assertNoLegacyStorageMode(env = process.env) {
|
|
85
|
+
const legacyKey = firstDefinedEnvKey(env, LEGACY_STORAGE_MODE_KEYS);
|
|
86
|
+
if (!legacyKey)
|
|
87
|
+
return;
|
|
88
|
+
throw new Error(`${legacyKey} was removed. Deployment modes no longer exist: delete the storage-mode variable. ` + `The client uses the local SQLite store, or the HTTP API selected by ` + `HASNA_INSTRUCTIONS_API_URL + HASNA_INSTRUCTIONS_API_KEY. ` + `On the server, set HASNA_INSTRUCTIONS_DATABASE_URL to select the postgresql backend, ` + `or leave it unset for sqlite.`);
|
|
89
|
+
}
|
|
90
|
+
var LEGACY_STORAGE_MODE_KEYS;
|
|
91
|
+
var init_retired_storage_mode = __esm(() => {
|
|
92
|
+
LEGACY_STORAGE_MODE_KEYS = [
|
|
93
|
+
"HASNA_INSTRUCTIONS_STORAGE_MODE",
|
|
94
|
+
"HASNA_INSTRUCTIONS_MODE",
|
|
95
|
+
"INSTRUCTIONS_STORAGE_MODE",
|
|
96
|
+
"INSTRUCTIONS_MODE"
|
|
97
|
+
];
|
|
98
|
+
});
|
|
99
|
+
|
|
76
100
|
// src/db/database.ts
|
|
77
101
|
import { Database } from "bun:sqlite";
|
|
78
102
|
import { existsSync, mkdirSync, rmSync } from "fs";
|
|
@@ -99,8 +123,9 @@ function slugify(name) {
|
|
|
99
123
|
function getDatabase(path) {
|
|
100
124
|
if (_db)
|
|
101
125
|
return _db;
|
|
126
|
+
assertNoLegacyStorageMode();
|
|
102
127
|
if (!path && process.env["HASNA_INSTRUCTIONS_API_URL"] && process.env["HASNA_INSTRUCTIONS_API_KEY"]) {
|
|
103
|
-
throw new Error("instructions is
|
|
128
|
+
throw new Error("instructions is using the HTTP API transport (HASNA_INSTRUCTIONS_API_URL set): this command is not wired to the API yet. " + "Unset HASNA_INSTRUCTIONS_API_URL / HASNA_INSTRUCTIONS_API_KEY to use it against the local store.");
|
|
104
129
|
}
|
|
105
130
|
const dbPath = path || getDbPath();
|
|
106
131
|
const db = new Database(dbPath);
|
|
@@ -181,6 +206,7 @@ function insertFeedback(input, db) {
|
|
|
181
206
|
}
|
|
182
207
|
var MIGRATIONS, _db = null;
|
|
183
208
|
var init_database = __esm(() => {
|
|
209
|
+
init_retired_storage_mode();
|
|
184
210
|
MIGRATIONS = [
|
|
185
211
|
`
|
|
186
212
|
CREATE TABLE IF NOT EXISTS configs (
|
|
@@ -860,7 +886,7 @@ Policy reference: \`${CODEWITH_SHARED_TODOS_STORAGE_POLICY_REFERENCE}\`
|
|
|
860
886
|
`;
|
|
861
887
|
});
|
|
862
888
|
|
|
863
|
-
// node_modules/zod/v3/helpers/util.js
|
|
889
|
+
// ../../node_modules/.bun/zod@3.25.76/node_modules/zod/v3/helpers/util.js
|
|
864
890
|
var util, objectUtil, ZodParsedType, getParsedType = (data) => {
|
|
865
891
|
const t = typeof data;
|
|
866
892
|
switch (t) {
|
|
@@ -991,7 +1017,7 @@ var init_util = __esm(() => {
|
|
|
991
1017
|
]);
|
|
992
1018
|
});
|
|
993
1019
|
|
|
994
|
-
// node_modules/zod/v3/ZodError.js
|
|
1020
|
+
// ../../node_modules/.bun/zod@3.25.76/node_modules/zod/v3/ZodError.js
|
|
995
1021
|
var ZodIssueCode, quotelessJson = (obj) => {
|
|
996
1022
|
const json = JSON.stringify(obj, null, 2);
|
|
997
1023
|
return json.replace(/"([^"]+)":/g, "$1:");
|
|
@@ -1112,7 +1138,7 @@ var init_ZodError = __esm(() => {
|
|
|
1112
1138
|
};
|
|
1113
1139
|
});
|
|
1114
1140
|
|
|
1115
|
-
// node_modules/zod/v3/locales/en.js
|
|
1141
|
+
// ../../node_modules/.bun/zod@3.25.76/node_modules/zod/v3/locales/en.js
|
|
1116
1142
|
var errorMap = (issue, _ctx) => {
|
|
1117
1143
|
let message;
|
|
1118
1144
|
switch (issue.code) {
|
|
@@ -1219,7 +1245,7 @@ var init_en = __esm(() => {
|
|
|
1219
1245
|
en_default = errorMap;
|
|
1220
1246
|
});
|
|
1221
1247
|
|
|
1222
|
-
// node_modules/zod/v3/errors.js
|
|
1248
|
+
// ../../node_modules/.bun/zod@3.25.76/node_modules/zod/v3/errors.js
|
|
1223
1249
|
function setErrorMap(map) {
|
|
1224
1250
|
overrideErrorMap = map;
|
|
1225
1251
|
}
|
|
@@ -1232,7 +1258,7 @@ var init_errors = __esm(() => {
|
|
|
1232
1258
|
overrideErrorMap = en_default;
|
|
1233
1259
|
});
|
|
1234
1260
|
|
|
1235
|
-
// node_modules/zod/v3/helpers/parseUtil.js
|
|
1261
|
+
// ../../node_modules/.bun/zod@3.25.76/node_modules/zod/v3/helpers/parseUtil.js
|
|
1236
1262
|
function addIssueToContext(ctx, issueData) {
|
|
1237
1263
|
const overrideMap = getErrorMap();
|
|
1238
1264
|
const issue = makeIssue({
|
|
@@ -1337,10 +1363,10 @@ var init_parseUtil = __esm(() => {
|
|
|
1337
1363
|
});
|
|
1338
1364
|
});
|
|
1339
1365
|
|
|
1340
|
-
// node_modules/zod/v3/helpers/typeAliases.js
|
|
1366
|
+
// ../../node_modules/.bun/zod@3.25.76/node_modules/zod/v3/helpers/typeAliases.js
|
|
1341
1367
|
var init_typeAliases = () => {};
|
|
1342
1368
|
|
|
1343
|
-
// node_modules/zod/v3/helpers/errorUtil.js
|
|
1369
|
+
// ../../node_modules/.bun/zod@3.25.76/node_modules/zod/v3/helpers/errorUtil.js
|
|
1344
1370
|
var errorUtil;
|
|
1345
1371
|
var init_errorUtil = __esm(() => {
|
|
1346
1372
|
(function(errorUtil2) {
|
|
@@ -1349,7 +1375,7 @@ var init_errorUtil = __esm(() => {
|
|
|
1349
1375
|
})(errorUtil || (errorUtil = {}));
|
|
1350
1376
|
});
|
|
1351
1377
|
|
|
1352
|
-
// node_modules/zod/v3/types.js
|
|
1378
|
+
// ../../node_modules/.bun/zod@3.25.76/node_modules/zod/v3/types.js
|
|
1353
1379
|
class ParseInputLazyPath {
|
|
1354
1380
|
constructor(parent, value, path, key) {
|
|
1355
1381
|
this._cachedPath = [];
|
|
@@ -4700,7 +4726,7 @@ var init_types2 = __esm(() => {
|
|
|
4700
4726
|
NEVER = INVALID;
|
|
4701
4727
|
});
|
|
4702
4728
|
|
|
4703
|
-
// node_modules/zod/v3/external.js
|
|
4729
|
+
// ../../node_modules/.bun/zod@3.25.76/node_modules/zod/v3/external.js
|
|
4704
4730
|
var exports_external = {};
|
|
4705
4731
|
__export(exports_external, {
|
|
4706
4732
|
void: () => voidType,
|
|
@@ -4820,7 +4846,7 @@ var init_external = __esm(() => {
|
|
|
4820
4846
|
init_ZodError();
|
|
4821
4847
|
});
|
|
4822
4848
|
|
|
4823
|
-
// node_modules/zod/index.js
|
|
4849
|
+
// ../../node_modules/.bun/zod@3.25.76/node_modules/zod/index.js
|
|
4824
4850
|
var init_zod = __esm(() => {
|
|
4825
4851
|
init_external();
|
|
4826
4852
|
init_external();
|
|
@@ -5023,7 +5049,7 @@ var init_redact = __esm(() => {
|
|
|
5023
5049
|
VALUE_PATTERNS = [
|
|
5024
5050
|
{ re: /npm_[A-Za-z0-9]{36,}/, reason: "npm token" },
|
|
5025
5051
|
{ re: /gh[pousr]_[A-Za-z0-9_]{36,}/, reason: "GitHub token" },
|
|
5026
|
-
{ re: /sk-ant-[A-Za-z0-9\-_]{40,}/, reason: "Anthropic API key" },
|
|
5052
|
+
{ re: /sk[-]ant-[A-Za-z0-9\-_]{40,}/, reason: "Anthropic API key" },
|
|
5027
5053
|
{ re: /sk-[A-Za-z0-9]{48,}/, reason: "OpenAI API key" },
|
|
5028
5054
|
{ re: /xoxb-[0-9]+-[A-Za-z0-9\-]+/, reason: "Slack bot token" },
|
|
5029
5055
|
{ re: /AIza[0-9A-Za-z\-_]{35}/, reason: "Google API key" },
|
|
@@ -6293,12 +6319,13 @@ function parseBoundedOrLegacyPage(value, legacyItems, options, label) {
|
|
|
6293
6319
|
return { ...page, source_bounded: false };
|
|
6294
6320
|
}
|
|
6295
6321
|
function resolveCloudConfig(env = process.env) {
|
|
6322
|
+
assertNoLegacyStorageMode(env);
|
|
6296
6323
|
const apiUrl = env[API_URL_ENV]?.trim();
|
|
6297
6324
|
const apiKey = env[API_KEY_ENV]?.trim();
|
|
6298
6325
|
if (!apiUrl && !apiKey)
|
|
6299
6326
|
return null;
|
|
6300
6327
|
if (!apiUrl || !apiKey) {
|
|
6301
|
-
throw new Error(`API mode requires BOTH ${API_URL_ENV} and ${API_KEY_ENV}; only ` + `${apiUrl ? API_URL_ENV : API_KEY_ENV} is set. Set both to use the
|
|
6328
|
+
throw new Error(`API mode requires BOTH ${API_URL_ENV} and ${API_KEY_ENV}; only ` + `${apiUrl ? API_URL_ENV : API_KEY_ENV} is set. Set both to use the HTTP API, ` + `or unset both to use the local store.`);
|
|
6302
6329
|
}
|
|
6303
6330
|
return { apiUrl, apiKey };
|
|
6304
6331
|
}
|
|
@@ -6785,6 +6812,7 @@ var init_config_store = __esm(() => {
|
|
|
6785
6812
|
init_types();
|
|
6786
6813
|
init_bounded_read();
|
|
6787
6814
|
init_instruction_graph();
|
|
6815
|
+
init_retired_storage_mode();
|
|
6788
6816
|
CloudHttpError = class CloudHttpError extends Error {
|
|
6789
6817
|
status;
|
|
6790
6818
|
body;
|
|
@@ -7948,7 +7976,7 @@ var init_sync_dir = __esm(() => {
|
|
|
7948
7976
|
var require_package = __commonJS((exports, module) => {
|
|
7949
7977
|
module.exports = {
|
|
7950
7978
|
name: "@hasna/instructions",
|
|
7951
|
-
version: "0.4.
|
|
7979
|
+
version: "0.4.35",
|
|
7952
7980
|
description: "AI coding agent instruction & configuration manager \u2014 store, version, apply, and share all your AI coding configs. CLI + MCP + HTTP API (instructions-serve) + generated SDK + Dashboard.",
|
|
7953
7981
|
type: "module",
|
|
7954
7982
|
main: "dist/index.js",
|
|
@@ -8037,6 +8065,7 @@ var require_package = __commonJS((exports, module) => {
|
|
|
8037
8065
|
"@types/bun": "^1.2.4",
|
|
8038
8066
|
"@types/pg": "^8.11.11",
|
|
8039
8067
|
"@types/react": "^18.3.18",
|
|
8068
|
+
"bun-types": "1.3.14",
|
|
8040
8069
|
typescript: "^5.7.3"
|
|
8041
8070
|
}
|
|
8042
8071
|
};
|