ai-hist 0.18.0 → 0.18.1
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/cli.d.ts +126 -0
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +372 -182
- package/dist/cli.js.map +1 -1
- package/dist/cloud-contract.d.ts +111 -0
- package/dist/cloud-contract.d.ts.map +1 -0
- package/dist/cloud-contract.js +28 -0
- package/dist/cloud-contract.js.map +1 -0
- package/dist/delivery-cli.d.ts +19 -3
- package/dist/delivery-cli.d.ts.map +1 -1
- package/dist/delivery-cli.js +30 -29
- package/dist/delivery-cli.js.map +1 -1
- package/dist/relay-cli.d.ts +77 -0
- package/dist/relay-cli.d.ts.map +1 -0
- package/dist/relay-cli.js +488 -0
- package/dist/relay-cli.js.map +1 -0
- package/package.json +12 -3
- package/dist/delivery.test.d.ts +0 -2
- package/dist/delivery.test.d.ts.map +0 -1
- package/dist/delivery.test.js +0 -396
- package/dist/delivery.test.js.map +0 -1
- package/dist/source-plugins.test.d.ts +0 -2
- package/dist/source-plugins.test.d.ts.map +0 -1
- package/dist/source-plugins.test.js +0 -379
- package/dist/source-plugins.test.js.map +0 -1
package/dist/cli.d.ts
CHANGED
|
@@ -1,3 +1,129 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import type { Writable } from 'node:stream';
|
|
3
|
+
type Parsed = {
|
|
4
|
+
positional: string[];
|
|
5
|
+
flags: Map<string, Array<string | true>>;
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* Where a run's output goes.
|
|
9
|
+
*
|
|
10
|
+
* The bin writes to the real streams; a host that mounts this CLI (see
|
|
11
|
+
* `relay-cli.ts`) supplies its own sink. Nothing below `runCli` touches
|
|
12
|
+
* `process.stdout`/`process.stderr` directly, so the same dispatch serves both.
|
|
13
|
+
*/
|
|
14
|
+
export interface CliIo {
|
|
15
|
+
stdout(chunk: string): void;
|
|
16
|
+
stderr(chunk: string): void;
|
|
17
|
+
}
|
|
18
|
+
export declare const BOOLEAN_FLAGS: Set<string>;
|
|
19
|
+
export declare const VALUE_FLAGS: Set<string>;
|
|
20
|
+
export declare function humanLine(value: unknown): string;
|
|
21
|
+
export declare function output(io: CliIo, value: unknown, json: boolean): void;
|
|
22
|
+
/** One positional argument, as the mounted help renders it. */
|
|
23
|
+
export interface CommandArgSpec {
|
|
24
|
+
name: string;
|
|
25
|
+
description: string;
|
|
26
|
+
required: boolean;
|
|
27
|
+
variadic?: boolean;
|
|
28
|
+
}
|
|
29
|
+
export interface CommandSpec {
|
|
30
|
+
/** Name used in flag- and argument-rejection messages. */
|
|
31
|
+
name: string;
|
|
32
|
+
/**
|
|
33
|
+
* One line for the mounted help.
|
|
34
|
+
*
|
|
35
|
+
* A host renders its own help from this table rather than forwarding
|
|
36
|
+
* `--help`, so an empty description is a user-visible hole, not an internal
|
|
37
|
+
* detail.
|
|
38
|
+
*/
|
|
39
|
+
description: string;
|
|
40
|
+
/**
|
|
41
|
+
* Path under the mounted group, or `null` for a command the group does not
|
|
42
|
+
* expose. `['sessions', 'list']` here is `ai-hist sessions list`, reached as
|
|
43
|
+
* `agent-relay sessions list`.
|
|
44
|
+
*/
|
|
45
|
+
surface: readonly string[] | null;
|
|
46
|
+
/** Extra spellings the mounted group accepts for `surface`. */
|
|
47
|
+
surfaceAliases?: readonly string[];
|
|
48
|
+
/**
|
|
49
|
+
* The positionals named for help. `positionals` below stays the authority on
|
|
50
|
+
* how many are accepted; the drift test asserts the two agree.
|
|
51
|
+
*/
|
|
52
|
+
args?: readonly CommandArgSpec[];
|
|
53
|
+
allowed: readonly string[];
|
|
54
|
+
/** Positional arguments after the command words: [minimum, maximum]. */
|
|
55
|
+
positionals: readonly [number, number | null];
|
|
56
|
+
/** Named in the usage error when fewer than the minimum are given. */
|
|
57
|
+
requires?: string;
|
|
58
|
+
/** Answers from the local database, so it takes the shared first-use bootstrap. */
|
|
59
|
+
readsLocalStore?: boolean;
|
|
60
|
+
/** Addresses a session by identity; --local/--remote/--all are meaningless. */
|
|
61
|
+
rejectsScope?: boolean;
|
|
62
|
+
/** Remaining command-line checks, run before any store work. */
|
|
63
|
+
validate?: (args: Parsed) => void;
|
|
64
|
+
/**
|
|
65
|
+
* Reads `RunCliOptions.signal`, so the bin claims the process's signals for
|
|
66
|
+
* it. Left off, the bin leaves `SIGINT`/`SIGTERM` at their default: a
|
|
67
|
+
* listener suppresses Node's own termination, so claiming them for a command
|
|
68
|
+
* that never looks at the signal swallows the user's first Ctrl-C.
|
|
69
|
+
*/
|
|
70
|
+
cancellable?: true;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Every option a command may list in `allowed`, spelled the way help shows it.
|
|
74
|
+
*
|
|
75
|
+
* This is the only place a flag's user-facing text lives. The drift test
|
|
76
|
+
* asserts it covers exactly the flags the command table allows, and that each
|
|
77
|
+
* one's arity matches `BOOLEAN_FLAGS`/`VALUE_FLAGS` — so a flag that `parse`
|
|
78
|
+
* cannot accept can never reach the mounted help.
|
|
79
|
+
*/
|
|
80
|
+
export declare const FLAG_SPECS: Record<string, {
|
|
81
|
+
flags: string;
|
|
82
|
+
description: string;
|
|
83
|
+
}>;
|
|
84
|
+
/** Options the host owns, so they never reach a mounted command's help. */
|
|
85
|
+
export declare const HOST_OWNED_FLAGS: Set<string>;
|
|
86
|
+
export declare const COMMANDS: Map<string, CommandSpec>;
|
|
87
|
+
/**
|
|
88
|
+
* Whether this command line routes to a command that reads the cancellation
|
|
89
|
+
* signal.
|
|
90
|
+
*
|
|
91
|
+
* The bin asks before installing a `SIGINT`/`SIGTERM` handler. A listener
|
|
92
|
+
* replaces Node's default termination, so a handler on an invocation that
|
|
93
|
+
* never reads the signal swallows the first shutdown request: the user presses
|
|
94
|
+
* Ctrl-C, nothing happens, and they press it again. Resolved from the same
|
|
95
|
+
* `COMMANDS` table `dispatch` resolves against, so the two cannot disagree
|
|
96
|
+
* about which commands those are.
|
|
97
|
+
*/
|
|
98
|
+
export declare function usesCancellation(argv: readonly string[]): boolean;
|
|
99
|
+
/** Knobs the bin owns and a mounted host does not. */
|
|
100
|
+
export interface RunCliOptions {
|
|
101
|
+
/**
|
|
102
|
+
* Cancels a long-running `delivery drain`/`delivery run`.
|
|
103
|
+
*
|
|
104
|
+
* The signal handlers that produce it belong to whoever owns the process:
|
|
105
|
+
* the bin installs them, a host passes its own, and `dispatch` installs none.
|
|
106
|
+
*/
|
|
107
|
+
signal?: AbortSignal;
|
|
108
|
+
/** Check npm for a newer release on `--version`. The bin only. */
|
|
109
|
+
updateNotice?: boolean;
|
|
110
|
+
/** Colourize `sessions list --pretty`. Defaults to stdout being a TTY. */
|
|
111
|
+
color?: boolean;
|
|
112
|
+
/**
|
|
113
|
+
* Where `export` writes when no `--out` is given.
|
|
114
|
+
*
|
|
115
|
+
* NDJSON export is unbounded, so it needs a real stream with backpressure
|
|
116
|
+
* rather than the unbuffered `io.stdout` callback.
|
|
117
|
+
*/
|
|
118
|
+
stdoutStream?: Writable;
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Run one `ai-hist` command line and resolve to its exit code.
|
|
122
|
+
*
|
|
123
|
+
* Never calls `process.exit`, never writes to `process.stdout`/`process.stderr`
|
|
124
|
+
* and never installs a signal handler: the caller owns all three. `argv` is the
|
|
125
|
+
* arguments after the program name.
|
|
126
|
+
*/
|
|
127
|
+
export declare function runCli(argv: readonly string[], io: CliIo, options?: RunCliOptions): Promise<number>;
|
|
2
128
|
export {};
|
|
3
129
|
//# sourceMappingURL=cli.d.ts.map
|
package/dist/cli.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AAIA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAY5C,KAAK,MA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