@gajae-gateway/cli 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/main.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  #!/usr/bin/env bun
2
2
  import type { OpsCycleResult } from "@gajae-gateway/protocol";
3
- import { type InstallServicesOptions } from "./services";
3
+ import { type LaunchRestartOptions, type RunRestartOptions } from "./restart-stack";
4
+ import { type InstallServicesOptions, type ServicePlatform } from "./services";
4
5
  export declare function socketPath(home?: string | undefined): string;
5
6
  /**
6
7
  * Every dispatchable top-level subcommand. An empty argv used to fall through
@@ -9,7 +10,7 @@ export declare function socketPath(home?: string | undefined): string;
9
10
  * never after, so the list is checked up front.
10
11
  */
11
12
  export declare const COMMANDS: readonly ["status", "shutdown", "chat", "daemon", "sessions", "ops", "memory", "monitors", "work", "services"];
12
- export declare const CLI_USAGE = "usage: gajaeway [--socket PATH] status|shutdown|chat|daemon run|sessions list [--json] [--fields a,b,c] [--limit N] [--offset N]|sessions inspect <originKey-or-index>|memory audit|memory search <query>|monitors ...|work run|start <name> [--cwd DIR] [--resume] [--model ID|--preset NAME] [--notify originKey (start only)] <text>|work status <name>|work steer <name> <text>|work retire <name>|work jobs|ops backup <path>|ops cycle [--json]|ops integrity|ops restore <backupPath>|services install|repair --bin-dir DIR [--launch-agents-dir DIR] (work run waits for a response; caller timeout does not end the attempt)";
13
+ export declare const CLI_USAGE = "usage: gajaeway [--socket PATH] status|shutdown|chat|daemon run|sessions list [--json] [--fields a,b,c] [--limit N] [--offset N]|sessions inspect <originKey-or-index>|memory audit|memory search <query>|monitors ... (test <id> [--type T] [--payload J] [--wait[=SECONDS]])|work run|start <name> [--cwd DIR] [--resume] [--model ID|--preset NAME] <text>|work status <name>|work steer <name> <text>|work retire <name>|work jobs|ops backup <path>|ops redeliver <deliveryId>|ops redeliver --since <iso>|ops cycle [--json]|ops integrity|ops restore <backupPath>|ops restart-stack [--status]|services install|repair --bin-dir DIR [--launch-agents-dir DIR] [--unit-dir DIR] [--platform darwin|linux] (work run waits for a response; caller timeout does not end the attempt)";
13
14
  /** Usage errors exit 2, as `gajaeway-gateway` does; 1 stays a runtime failure. */
14
15
  export declare const USAGE_EXIT_CODE = 2;
15
16
  /** The usage text when `command` cannot be dispatched, undefined when it can. */
@@ -21,12 +22,19 @@ export declare function parseArgs(args: string[]): {
21
22
  };
22
23
  export interface MainOptions {
23
24
  readonly services?: Pick<InstallServicesOptions, "loginPathRunner" | "writeFile">;
25
+ /** Test seams for `ops restart-stack`; the real path spawns the service manager. */
26
+ readonly restartStack?: {
27
+ readonly launch?: Omit<LaunchRestartOptions, "home">;
28
+ readonly run?: Omit<RunRestartOptions, "home" | "id">;
29
+ };
24
30
  }
25
31
  export type ServicesAction = "install" | "repair";
26
32
  export interface ParsedServicesArgs {
27
33
  readonly action: ServicesAction;
28
34
  readonly binDir: string;
29
35
  readonly launchAgentsDir?: string;
36
+ readonly unitDir?: string;
37
+ readonly platform?: ServicePlatform;
30
38
  }
31
39
  export declare function parseServicesArgs(args: readonly string[]): ParsedServicesArgs;
32
40
  /**
@@ -45,6 +53,34 @@ export declare function renderCycle(cycle: OpsCycleResult): string[];
45
53
  * healthy. Extracted so the automation-facing contract is pinned by tests.
46
54
  */
47
55
  export declare function cycleExitCode(cycle: OpsCycleResult): number;
56
+ /**
57
+ * The same acceptance the gateway applies at boot (`PRAGMA integrity_check`
58
+ * must answer `ok`), run read-only against the backup before it replaces
59
+ * anything. A 16-byte header match is not a database: a truncated or
60
+ * bit-flipped file passes it, gets copied into place, and the next boot
61
+ * fails while the restore already reported success.
62
+ *
63
+ * An empty file is also refused: SQLite treats a zero-length file as a valid
64
+ * empty database and `integrity_check` answers `ok` for it, but restoring it
65
+ * would boot a gateway with every table freshly created and nothing in them.
66
+ *
67
+ * Opening a WAL-mode backup read-only may leave empty `-wal`/`-shm` sidecars
68
+ * next to the backup; `ops backup` writes delete-mode files, which gain none.
69
+ */
70
+ export declare function verifyBackupIntegrity(backupPath: string): void;
71
+ /**
72
+ * The database the gateway actually opens: `config.json` `dbPath` when set,
73
+ * otherwise `<home>/gateway.db` — the same file-based resolution as the
74
+ * gateway's `loadConfig`. An absent `config.json` means defaults, exactly as
75
+ * at boot. A present-but-unreadable one (EACCES, EISDIR, or a dangling symlink,
76
+ * which reports ENOENT while the entry exists) refuses the restore instead of
77
+ * guessing, as boot refuses to start: copying a backup over the wrong file
78
+ * reports success while the live database stays broken.
79
+ *
80
+ * `schemaVersion` is deliberately not checked: `dbPath` is a version-independent
81
+ * string, and disaster recovery must not be blocked by an unrelated schema bump.
82
+ */
83
+ export declare function restoreTargetPath(home?: string): Promise<string>;
48
84
  export declare function restoreDatabase(socket: string, backupPath: string): Promise<void>;
49
85
  export declare function main(args?: string[], options?: MainOptions): Promise<void>;
50
86
  //# sourceMappingURL=main.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":";AAGA,OAAO,KAAK,EAEX,cAAc,EASd,MAAM,yBAAyB,CAAC;AAYjC,OAAO,EAAE,KAAK,sBAAsB,EAAiC,MAAM,YAAY,CAAC;AAExF,wBAAgB,UAAU,CAAC,IAAI,qBAA4B,GAAG,MAAM,CAEnE;AAED;;;;;GAKG;AACH,eAAO,MAAM,QAAQ,gHAWX,CAAC;AAEX,eAAO,MAAM,SAAS,0mBACklB,CAAC;AAEzmB,kFAAkF;AAClF,eAAO,MAAM,eAAe,IAAI,CAAC;AAEjC,iFAAiF;AACjF,wBAAgB,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAExE;AAED,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG;IAAE,OAAO,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,EAAE,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAQ9F;AA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