sim 2.1.18-dev.133.1 → 2.1.18
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/index.js +3654 -4127
- package/package.json +2 -12
- package/dist/auth/device-flow.d.ts +0 -39
- package/dist/auth/oauth-flow.d.ts +0 -119
- package/dist/auth/refresh.d.ts +0 -16
- package/dist/commands/auth.d.ts +0 -5
- package/dist/commands/configure.d.ts +0 -2
- package/dist/commands/credentials.d.ts +0 -3
- package/dist/commands/protocol/chat.d.ts +0 -11
- package/dist/commands/protocol/files-get.d.ts +0 -25
- package/dist/commands/protocol/files-upload.d.ts +0 -2
- package/dist/commands/protocol/index.d.ts +0 -3
- package/dist/commands/protocol/knowledge-document-upload.d.ts +0 -2
- package/dist/commands/protocol/knowledge-export.d.ts +0 -14
- package/dist/commands/protocol/logs-follow.d.ts +0 -39
- package/dist/commands/protocol/resource-directory.d.ts +0 -24
- package/dist/commands/protocol/result.d.ts +0 -2
- package/dist/commands/protocol/tables-import.d.ts +0 -2
- package/dist/commands/protocol/workflow-run-follow.d.ts +0 -56
- package/dist/commands/protocol/workflow-run-get.d.ts +0 -15
- package/dist/commands/protocol/workflow-run-wait.d.ts +0 -3
- package/dist/commands/protocol/workspace-operation-wait.d.ts +0 -14
- package/dist/commands/secrets.d.ts +0 -3
- package/dist/commands/telemetry.d.ts +0 -2
- package/dist/commands/update.d.ts +0 -2
- package/dist/config/index.d.ts +0 -2
- package/dist/config/ini.d.ts +0 -111
- package/dist/config/json-file.d.ts +0 -18
- package/dist/config/paths.d.ts +0 -29
- package/dist/config/profile.d.ts +0 -210
- package/dist/context.d.ts +0 -21
- package/dist/contract/commands.d.ts +0 -14
- package/dist/contract/types.d.ts +0 -306
- package/dist/embed-context.d.ts +0 -79
- package/dist/embed-output.d.ts +0 -15
- package/dist/embed.d.ts +0 -40
- package/dist/environment.d.ts +0 -22
- package/dist/generated/v2-api.d.ts +0 -15057
- package/dist/helpers.d.ts +0 -9
- package/dist/http/client.d.ts +0 -173
- package/dist/http/environment.d.ts +0 -24
- package/dist/http/ndjson.d.ts +0 -5
- package/dist/output/io.d.ts +0 -5
- package/dist/output/presentation.d.ts +0 -4
- package/dist/output/render.d.ts +0 -60
- package/dist/output/terminal-text.d.ts +0 -17
- package/dist/output/trace.d.ts +0 -3
- package/dist/output/truncation.d.ts +0 -3
- package/dist/program.d.ts +0 -21
- package/dist/runtime/build.d.ts +0 -38
- package/dist/runtime/derive.d.ts +0 -20
- package/dist/runtime/execute.d.ts +0 -32
- package/dist/runtime/naming.d.ts +0 -25
- package/dist/runtime/options.d.ts +0 -9
- package/dist/runtime/renamed.d.ts +0 -6
- package/dist/runtime/request.d.ts +0 -110
- package/dist/runtime/result.d.ts +0 -41
- package/dist/runtime/types.d.ts +0 -23
- package/dist/runtime.d.ts +0 -5
- package/dist/runtime.js +0 -21864
- package/dist/telemetry/client-info.d.ts +0 -20
- package/dist/telemetry/coding-agent.d.ts +0 -31
- package/dist/telemetry/index.d.ts +0 -4
- package/dist/telemetry/invocation.d.ts +0 -98
- package/dist/telemetry/policy.d.ts +0 -38
- package/dist/telemetry/state.d.ts +0 -47
- package/dist/telemetry/transport.d.ts +0 -47
- package/dist/terminal/secret-input.d.ts +0 -15
- package/dist/terminal.d.ts +0 -7
- package/dist/transfer/local-file.d.ts +0 -16
- package/dist/transfer/streaming-upload.d.ts +0 -16
- package/dist/transfer/upload-session.d.ts +0 -18
- package/dist/update/check.d.ts +0 -53
- package/dist/update/install.d.ts +0 -20
- package/dist/version.d.ts +0 -10
package/dist/helpers.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Local copies of the shared helpers.
|
|
3
|
-
*
|
|
4
|
-
* `@sim/utils` is a private workspace package, so the published `sim` package
|
|
5
|
-
* cannot depend on it — importing it would resolve in the monorepo and fail for
|
|
6
|
-
* anyone installing from npm.
|
|
7
|
-
*/
|
|
8
|
-
/** Resolves after `ms` milliseconds. */
|
|
9
|
-
export declare function sleep(ms: number): Promise<void>;
|
package/dist/http/client.d.ts
DELETED
|
@@ -1,173 +0,0 @@
|
|
|
1
|
-
import type { ResolvedProfile, StoredOAuthCredential } from '../config/index';
|
|
2
|
-
/**
|
|
3
|
-
* A failure the CLI can explain. Anything thrown as a `SimApiError` is printed
|
|
4
|
-
* as a clean message and a non-zero exit; anything else escapes as a stack
|
|
5
|
-
* trace, which is the signal that the CLI itself is broken rather than the
|
|
6
|
-
* request.
|
|
7
|
-
*/
|
|
8
|
-
export declare class SimApiError extends Error {
|
|
9
|
-
readonly status: number;
|
|
10
|
-
readonly code: string | null;
|
|
11
|
-
readonly details?: unknown;
|
|
12
|
-
readonly exitCode: number;
|
|
13
|
-
constructor(message: string, status: number, code?: string | null, details?: unknown, exitCode?: number);
|
|
14
|
-
}
|
|
15
|
-
/** `{ data, nextCursor }` — one page of a list. */
|
|
16
|
-
export interface V2Page<T> {
|
|
17
|
-
data: T[];
|
|
18
|
-
nextCursor: string | null;
|
|
19
|
-
}
|
|
20
|
-
export interface RequestAllPagesOptions extends Omit<RequestOptions, 'query'> {
|
|
21
|
-
query?: Record<string, QueryValue>;
|
|
22
|
-
/** Server page size; callers choose one accepted by the endpoint contract. */
|
|
23
|
-
pageSize: number;
|
|
24
|
-
/** Maximum items to return. Omit to follow the cursor through the full list. */
|
|
25
|
-
limit?: number;
|
|
26
|
-
}
|
|
27
|
-
export type QueryValue = string | number | boolean | null | undefined;
|
|
28
|
-
export type AuthRequirement = 'required' | 'optional';
|
|
29
|
-
export interface RequestOptions {
|
|
30
|
-
method?: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
|
|
31
|
-
query?: Record<string, QueryValue>;
|
|
32
|
-
body?: unknown;
|
|
33
|
-
/** Contract-declared headers, e.g. the `upload-token` a transfer is bound to. */
|
|
34
|
-
headers?: Record<string, string>;
|
|
35
|
-
/** Cancels both the initial request and any subsequent streaming body read. */
|
|
36
|
-
signal?: AbortSignal;
|
|
37
|
-
/** Self-hosted, auth-disabled routes may deliberately omit a local API key. */
|
|
38
|
-
auth?: AuthRequirement;
|
|
39
|
-
}
|
|
40
|
-
export interface WorkspaceOptions {
|
|
41
|
-
auth?: AuthRequirement;
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* Joins an endpoint and a route into a request URL.
|
|
45
|
-
*
|
|
46
|
-
* Concatenation rather than `new URL(path, endpoint)`, which is the trap it
|
|
47
|
-
* exists to avoid: a leading-slash path is absolute, so `new URL()` resolves it
|
|
48
|
-
* against the endpoint's ORIGIN and silently drops any path the endpoint
|
|
49
|
-
* carries. A deployment served under a prefix — `https://host/sim` behind a
|
|
50
|
-
* proxy that fronts several apps — would have every request rewritten to
|
|
51
|
-
* `https://host/...`, losing the prefix that identifies it.
|
|
52
|
-
*
|
|
53
|
-
* Empty values are skipped rather than sent blank so an omitted optional
|
|
54
|
-
* parameter reads as absent, not as the empty string.
|
|
55
|
-
*/
|
|
56
|
-
export declare function buildUrl(endpoint: string, path: string, query?: Record<string, QueryValue>): string;
|
|
57
|
-
/**
|
|
58
|
-
* Statuses `fetch` would otherwise follow for us, and must not.
|
|
59
|
-
*
|
|
60
|
-
* A 301/302/303 is rewritten to a bodyless GET per the Fetch spec, so an
|
|
61
|
-
* endpoint that redirects (an apex host pointing at `www.`, say) keeps every
|
|
62
|
-
* read working through its query string while every write silently arrives with
|
|
63
|
-
* no body — the endpoint looks correct and only writes fail. Following a
|
|
64
|
-
* redirect would also hand the API key to whatever origin `Location` names.
|
|
65
|
-
*/
|
|
66
|
-
export declare const REDIRECT_STATUSES: Set<number>;
|
|
67
|
-
/** The one instruction that resolves an elapsed request bound, wherever it surfaces. */
|
|
68
|
-
export declare const RAISE_TIMEOUT_HINT = "Raise SIM_TIMEOUT_SECONDS, or set it to 0 to wait indefinitely.";
|
|
69
|
-
/**
|
|
70
|
-
* Whether this is the CLI's own request bound elapsing.
|
|
71
|
-
*
|
|
72
|
-
* `AbortSignal.timeout` raises `TimeoutError`, while a caller's cancel raises
|
|
73
|
-
* `AbortError` — so this distinguishes a bound the user can raise from a stop
|
|
74
|
-
* the user asked for, which must keep reading as a cancellation.
|
|
75
|
-
*/
|
|
76
|
-
export declare function isRequestTimeout(error: unknown): boolean;
|
|
77
|
-
/** Formats nested validation issues as readable, path-aware lines. */
|
|
78
|
-
export declare function formatApiErrorDetails(details: unknown): string[];
|
|
79
|
-
/**
|
|
80
|
-
* Renews an OAuth login and returns the new pair; injected so the HTTP client
|
|
81
|
-
* does not import the OAuth flow, which imports the client.
|
|
82
|
-
*/
|
|
83
|
-
export type OAuthRefresher = (profile: ResolvedProfile, current: StoredOAuthCredential) => Promise<StoredOAuthCredential>;
|
|
84
|
-
export interface SimClientOptions {
|
|
85
|
-
refreshOAuth?: OAuthRefresher;
|
|
86
|
-
}
|
|
87
|
-
export declare class SimClient {
|
|
88
|
-
private readonly profile;
|
|
89
|
-
private readonly options;
|
|
90
|
-
private oauth;
|
|
91
|
-
private refreshing;
|
|
92
|
-
constructor(profile: ResolvedProfile, options?: SimClientOptions);
|
|
93
|
-
private resolveCredential;
|
|
94
|
-
/**
|
|
95
|
-
* One refresh at a time per process, shared by every request that finds the
|
|
96
|
-
* token expiring; the cross-process half lives behind the refresher.
|
|
97
|
-
*/
|
|
98
|
-
private refreshOAuth;
|
|
99
|
-
/**
|
|
100
|
-
* The workspace every workspace-scoped command defaults to.
|
|
101
|
-
*
|
|
102
|
-
* By default this checks the key first even though it does not need one:
|
|
103
|
-
* commands resolve the workspace while building their query, so without this
|
|
104
|
-
* a brand-new install is told to set a workspace when the actual first step
|
|
105
|
-
* is logging in. Auth-disabled self-hosted protocols opt out explicitly.
|
|
106
|
-
*/
|
|
107
|
-
requireWorkspace(explicit?: string, options?: WorkspaceOptions): string;
|
|
108
|
-
/**
|
|
109
|
-
* Makes a request without consuming its body. Authentication is required
|
|
110
|
-
* unless a self-hosted protocol explicitly opts out.
|
|
111
|
-
*
|
|
112
|
-
* JSON commands use {@link request}; streaming and binary protocols keep the
|
|
113
|
-
* raw response so they can process bytes incrementally. HTTP failures still
|
|
114
|
-
* become the same structured `SimApiError` either way.
|
|
115
|
-
*/
|
|
116
|
-
requestRaw(path: string, options?: RequestOptions): Promise<Response>;
|
|
117
|
-
request<T>(path: string, options?: RequestOptions): Promise<T>;
|
|
118
|
-
private send;
|
|
119
|
-
/**
|
|
120
|
-
* Explains a redirect instead of following it, naming the endpoint to switch to.
|
|
121
|
-
*
|
|
122
|
-
* The destination comes from `Location` resolved against the request URL, so a
|
|
123
|
-
* relative target works and no string surgery is done on the configured
|
|
124
|
-
* endpoint. A `Location` that is missing or unparseable still has to produce a
|
|
125
|
-
* sentence — the redirect is the finding either way.
|
|
126
|
-
*/
|
|
127
|
-
private toRedirectError;
|
|
128
|
-
}
|
|
129
|
-
/**
|
|
130
|
-
* The endpoint a redirect implies, or null when it implies no change.
|
|
131
|
-
*
|
|
132
|
-
* Strips the request's own path from the target rather than taking
|
|
133
|
-
* `target.origin`, so a self-hosted endpoint carrying a path prefix
|
|
134
|
-
* (`https://host/sim`) keeps it. Naming the bare origin would hand back a value
|
|
135
|
-
* that is not an API root, and following that advice would break a deployment
|
|
136
|
-
* that was only ever one hostname away from working.
|
|
137
|
-
*
|
|
138
|
-
* Null when the target resolves to the endpoint already configured — a
|
|
139
|
-
* trailing-slash or path-normalization redirect keeps the origin, and telling
|
|
140
|
-
* someone to set the value they already have explains nothing.
|
|
141
|
-
*/
|
|
142
|
-
export declare function redirectEndpoint(endpoint: string, requestPath: string, target: URL): string | null;
|
|
143
|
-
export interface PageProgress {
|
|
144
|
-
/** Call once a further page is known to be coming, with the count so far. */
|
|
145
|
-
advance: (fetched: number) => void;
|
|
146
|
-
/** Erases the line, if anything was ever written to it. */
|
|
147
|
-
finish: () => void;
|
|
148
|
-
}
|
|
149
|
-
/**
|
|
150
|
-
* Reports cursor progress on stderr while a list keeps paging.
|
|
151
|
-
*
|
|
152
|
-
* A long cursor is many sequential requests and reads as a hang, so say so — but
|
|
153
|
-
* only on a terminal, and only on stderr, because stdout is what gets piped to
|
|
154
|
-
* `jq`.
|
|
155
|
-
*
|
|
156
|
-
* Shared because the CLI pages in two places: {@link requestAllPages} for the
|
|
157
|
-
* `ls` commands, and the contract-driven loop in `runtime/execute`, which also
|
|
158
|
-
* has to carry a cursor in the body. Only one of them had the writer, and it was
|
|
159
|
-
* not the one nearly every `list --limit 0` goes through.
|
|
160
|
-
*/
|
|
161
|
-
export declare function pageProgress(): PageProgress;
|
|
162
|
-
/** Rejects cursor cycles before a pager repeats requests or returns an unusable continuation. */
|
|
163
|
-
export declare function assertCursorAdvances(cursor: string | null, seenCursors: Set<string>): void;
|
|
164
|
-
/** Follows a standard v2 cursor envelope without duplicating pagination loops. */
|
|
165
|
-
export declare function requestAllPages<T>(client: Pick<SimClient, 'request'>, path: string, options: RequestAllPagesOptions): Promise<T[]>;
|
|
166
|
-
/**
|
|
167
|
-
* Substitutes `[id]`-style path segments.
|
|
168
|
-
*
|
|
169
|
-
* Values are percent-encoded: table and workspace ids are opaque, and a `/` or
|
|
170
|
-
* `?` inside one would otherwise silently retarget the request at a different
|
|
171
|
-
* endpoint.
|
|
172
|
-
*/
|
|
173
|
-
export declare function resolvePath(template: string, params?: Record<string, string>): string;
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/** Test seam: notices are once-per-process, and each test needs a clean slate. */
|
|
2
|
-
export declare function resetEnvironmentNotices(): void;
|
|
3
|
-
/**
|
|
4
|
-
* Reports a proxy the request will not actually go through.
|
|
5
|
-
*
|
|
6
|
-
* Node's `fetch` ignores `HTTP(S)_PROXY` unless `NODE_USE_ENV_PROXY` opts in,
|
|
7
|
-
* and older releases ignore them outright — so on a network that only reaches
|
|
8
|
-
* the API through a proxy, every command fails to connect while the variable
|
|
9
|
-
* that would have fixed it is already set. The CLI cannot enable the support
|
|
10
|
-
* from inside the process (Node reads the flag at startup), so it says what to
|
|
11
|
-
* do instead of proxying itself, which would mean bundling an HTTP stack for a
|
|
12
|
-
* setting the platform now owns.
|
|
13
|
-
*/
|
|
14
|
-
export declare function warnIfProxyIgnored(env?: NodeJS.ProcessEnv, version?: string): void;
|
|
15
|
-
/**
|
|
16
|
-
* Reports an API key about to cross the network in cleartext.
|
|
17
|
-
*
|
|
18
|
-
* A warning rather than a refusal: `http://` is the documented way to reach a
|
|
19
|
-
* local dev server, and an internal deployment terminating TLS at a gateway is
|
|
20
|
-
* a real deployment, not a mistake to block. Loopback is silent because that is
|
|
21
|
-
* the documented case; anything else means the key is on the wire in the clear,
|
|
22
|
-
* which is worth one line.
|
|
23
|
-
*/
|
|
24
|
-
export declare function warnIfCredentialOverCleartext(endpoint: string, hasCredential: boolean): void;
|
package/dist/http/ndjson.d.ts
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Parses a newline-delimited JSON response incrementally and releases its
|
|
3
|
-
* reader when the consumer reaches a terminal event or stops early.
|
|
4
|
-
*/
|
|
5
|
-
export declare function readNdjson(body: ReadableStream<Uint8Array> | null, protocol: string): AsyncGenerator<unknown>;
|
package/dist/output/io.d.ts
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
/** Only CLI-owned output enters the invocation result; host logs retain their normal sinks. */
|
|
2
|
-
export declare function printLine(...args: unknown[]): void;
|
|
3
|
-
export declare function printError(...args: unknown[]): void;
|
|
4
|
-
export declare function writeStdout(chunk: string | Uint8Array): boolean;
|
|
5
|
-
export declare function writeStderr(chunk: string | Uint8Array): boolean;
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
/** Embedded output is data; choose plain CLI styling without changing the host's Chalk. */
|
|
2
|
-
export declare function styles(): import("chalk").ChalkInstance;
|
|
3
|
-
/** A hosting server's terminal is never the embedded invocation's progress display. */
|
|
4
|
-
export declare function hasProgressTerminal(): boolean;
|
package/dist/output/render.d.ts
DELETED
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import type { OutputFormat } from '../config/index';
|
|
2
|
-
export interface Column<T> {
|
|
3
|
-
header: string;
|
|
4
|
-
value: (row: T) => string;
|
|
5
|
-
}
|
|
6
|
-
/**
|
|
7
|
-
* Removes terminal control sequences from a server-supplied string.
|
|
8
|
-
*
|
|
9
|
-
* Applied where API values become display text, so the colour the CLI adds
|
|
10
|
-
* afterwards still works — sanitizing the finished cell would strip our own
|
|
11
|
-
* formatting too.
|
|
12
|
-
*/
|
|
13
|
-
export declare function sanitize(value: string): string;
|
|
14
|
-
/** Flattens untrusted terminal text into one compact, display-safe line. */
|
|
15
|
-
export declare function safeOneLine(value: string): string;
|
|
16
|
-
export declare function text(value: unknown): string;
|
|
17
|
-
/** ISO timestamps are the wire format everywhere; show them without the milliseconds. */
|
|
18
|
-
export declare function timestamp(value: string | null | undefined): string;
|
|
19
|
-
export declare function bool(value: boolean | null | undefined): string;
|
|
20
|
-
export declare function bytes(value: number | null | undefined): string;
|
|
21
|
-
export declare function duration(ms: number | null | undefined): string;
|
|
22
|
-
/**
|
|
23
|
-
* Visible width of a cell, ignoring ANSI colour codes.
|
|
24
|
-
*
|
|
25
|
-
* Padding on the raw string would count the escape sequences as characters and
|
|
26
|
-
* skew every coloured column, so widths are measured on the stripped text while
|
|
27
|
-
* the coloured text is what gets printed.
|
|
28
|
-
*/
|
|
29
|
-
/**
|
|
30
|
-
* Visible width of a cell.
|
|
31
|
-
*
|
|
32
|
-
* Delegates to the grapheme-aware measurement: the previous implementation
|
|
33
|
-
* counted stripped string length, so emoji and East Asian characters measured
|
|
34
|
-
* as one column and mis-aligned every table containing them.
|
|
35
|
-
*/
|
|
36
|
-
export declare function visibleWidth(value: string): number;
|
|
37
|
-
/**
|
|
38
|
-
* Prints a list in the profile's output format.
|
|
39
|
-
*
|
|
40
|
-
* `text` emits the table's cells tab-separated with no header and no colour —
|
|
41
|
-
* the shape `cut -f2` and `while read` expect. It uses the formatted cells
|
|
42
|
-
* rather than the raw values on purpose: it is a human-ish format for shell
|
|
43
|
-
* plumbing, and a raw ISO timestamp or byte count is worse in that context.
|
|
44
|
-
*/
|
|
45
|
-
export declare function printList<T>(format: OutputFormat, rows: T[], columns: Column<T>[], raw?: unknown): void;
|
|
46
|
-
/**
|
|
47
|
-
* Prints a payload whose value IS the deliverable — `workflows export`, which
|
|
48
|
-
* is meant to be redirected to a file and fed back to `import`.
|
|
49
|
-
*
|
|
50
|
-
* `table` and `text` are display formats: they flatten, truncate and colour, so
|
|
51
|
-
* neither can round-trip a document. Rather than emit something that looks like
|
|
52
|
-
* an export but cannot be re-imported, those two fall back to JSON. Only `yaml`
|
|
53
|
-
* is honoured, because it round-trips.
|
|
54
|
-
*/
|
|
55
|
-
export declare function printDocument(format: OutputFormat, raw: unknown): void;
|
|
56
|
-
/**
|
|
57
|
-
* Prints a single record: machine formats from the raw value, otherwise aligned
|
|
58
|
-
* lines. As in `printList`, only the `table` rendering is clamped.
|
|
59
|
-
*/
|
|
60
|
-
export declare function printRecord(format: OutputFormat, fields: Array<[string, string]>, raw: unknown): void;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
export declare function graphemes(value: string): Array<{
|
|
2
|
-
segment: string;
|
|
3
|
-
index: number;
|
|
4
|
-
}>;
|
|
5
|
-
/** First grapheme cluster of a string, or null when it is empty. */
|
|
6
|
-
export declare function firstGrapheme(value: string): string | null;
|
|
7
|
-
export declare function previousGraphemeIndex(value: string, cursor: number): number;
|
|
8
|
-
export declare function nextGraphemeIndex(value: string, cursor: number): number;
|
|
9
|
-
export declare function lineStart(value: string, cursor: number): number;
|
|
10
|
-
export declare function lineEnd(value: string, cursor: number): number;
|
|
11
|
-
export declare function displayWidth(value: string): number;
|
|
12
|
-
export declare function graphemeWidth(value: string): number;
|
|
13
|
-
export declare function isWideCodePoint(codePoint: number): boolean;
|
|
14
|
-
export declare function truncateDisplay(value: string, width: number): string;
|
|
15
|
-
export declare function tailToWidth(value: string, width: number): string;
|
|
16
|
-
/** Squares off a ragged art line so every box border starts at the same column. */
|
|
17
|
-
export declare function artPad(line: string, width: number): string;
|
package/dist/output/trace.d.ts
DELETED
package/dist/program.d.ts
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { Command } from 'commander';
|
|
2
|
-
/** Root program description, shared by `--help` and the generated docs. */
|
|
3
|
-
export declare const PROGRAM_DESCRIPTION = "Talk to the Sim API from your terminal";
|
|
4
|
-
export declare const HELP_EPILOGUE = "\nProfiles work like the AWS CLI: settings live in ~/.sim/config, keys in\n~/.sim/credentials (0600), or under SIM_CONFIG_DIR when it is set. Select one\nwith -P, --profile, or SIM_PROFILE.\n\nWorkflow, knowledge-base and workspace IDs are bare UUIDs. Table IDs carry a\ntbl_ prefix and file IDs a wf_ one, so wf_ never names a workflow. An audit-log\nor custom-tool ID can open with a dash, which reads as a flag; put -- in front\nof it, as in sim audit-logs get -- -HlDcD1z76nK6R4crsUp0.\n\nExamples:\n $ sim login Authorize the default profile\n $ sim login --profile dev --endpoint http://localhost:3000\n $ sim profile add acme --workspace 7e2d9c14-6b83-4a55-8f01-c4d3e9a76b28\n $ sim workflows list\n $ sim logs list --level error --limit 20\n $ sim configure --set-output json Save a profile output default\n $ sim --output json tables get tbl_9f3c1a05d4b7426e8c2f0917ab35de64\n $ sim knowledge search --query \"refund policy\" --kb 4c1b7f60-2d55-4a3e-9c18-70b6ea2f9d31\n $ sim workflows export 3a9e21d8-5f47-4c0b-b2ea-91d7c6034ef8 > wf.json\n $ sim workflows import --workflow @wf.json\n $ sim knowledge export 4c1b7f60-2d55-4a3e-9c18-70b6ea2f9d31 -o ./kb.simkb.zip\n $ sim whoami --profile dev\n";
|
|
5
|
-
/**
|
|
6
|
-
* Assemble the complete command tree.
|
|
7
|
-
*
|
|
8
|
-
* Kept separate from the entrypoint so the documentation generator can walk the
|
|
9
|
-
* same tree the terminal parses. A generator that rebuilt the surface from the
|
|
10
|
-
* contract instead would be a second implementation of `buildGeneratedCommands`,
|
|
11
|
-
* free to drift from the one users actually run.
|
|
12
|
-
*
|
|
13
|
-
* `version` is optional because the generator reads the package metadata itself
|
|
14
|
-
* and the emitted pages must not carry a version that goes stale on every
|
|
15
|
-
* release.
|
|
16
|
-
*/
|
|
17
|
-
export declare function buildProgram(options?: {
|
|
18
|
-
version?: boolean;
|
|
19
|
-
helpText?: string;
|
|
20
|
-
program?: Command;
|
|
21
|
-
}): Command;
|
package/dist/runtime/build.d.ts
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { Command } from 'commander';
|
|
2
|
-
import type { OperationSpec } from './types';
|
|
3
|
-
/**
|
|
4
|
-
* States the workspace-key restriction the way every generated command states it.
|
|
5
|
-
*
|
|
6
|
-
* The suffix lives here, once, because a fully hand-written command renders its
|
|
7
|
-
* own `.description()` and never reaches the generated path — three commands
|
|
8
|
-
* (`secrets set`, `credentials create`, `credentials connect`/`reconnect`) sat
|
|
9
|
-
* beside siblings that carried the warning and silently read as accepting a
|
|
10
|
-
* workspace key. Taking the `OperationSpec` rather than a boolean means a
|
|
11
|
-
* caller has to name the operation it actually calls, so the two cannot drift.
|
|
12
|
-
*/
|
|
13
|
-
export declare function describeOperation(operationSpec: OperationSpec, described: string): string;
|
|
14
|
-
/**
|
|
15
|
-
* Sweeps the assembled program for a flag the root already owns.
|
|
16
|
-
*
|
|
17
|
-
* `assertNoReservedFlags` runs while a generated leaf is configured, so it sees
|
|
18
|
-
* nothing that is attached by hand (`attachSecretCommands`,
|
|
19
|
-
* `attachProtocolCommands`, `attachCredentialCommands`) or added to a leaf
|
|
20
|
-
* after it is built. Walking the finished tree is what covers those.
|
|
21
|
-
*/
|
|
22
|
-
export declare function assertNoReservedProgramFlags(program: Command): void;
|
|
23
|
-
/**
|
|
24
|
-
* Refuses `--help` typed after a command that does not exist.
|
|
25
|
-
*
|
|
26
|
-
* Commander answers a help flag before it looks at the operands, so `sim
|
|
27
|
-
* workspaces zzzz --help` printed the group's help and exited `0` while the
|
|
28
|
-
* same words without the flag exit `1`. A capability probe reading the exit
|
|
29
|
-
* code therefore concluded a command exists when it does not.
|
|
30
|
-
*
|
|
31
|
-
* Only pure dispatchers are guarded. A command that takes arguments or acts on
|
|
32
|
-
* its own (`sim files restore <fileId>`, `sim profiles`) legitimately sees an
|
|
33
|
-
* operand it did not register as a subcommand, and refusing there would break
|
|
34
|
-
* `--help` on argv the CLI accepts.
|
|
35
|
-
*/
|
|
36
|
-
export declare function refuseHelpAfterUnknownCommand(program: Command): void;
|
|
37
|
-
/** Builds every JSON command described by the generated operation table. */
|
|
38
|
-
export declare function buildGeneratedCommands(): Command[];
|
package/dist/runtime/derive.d.ts
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { type V2OperationName } from '../generated/v2-api';
|
|
2
|
-
/**
|
|
3
|
-
* Derives a command path from an operation's route.
|
|
4
|
-
*
|
|
5
|
-
* `<resource> [sub-resource] <verb>`, where the verb comes from the method and
|
|
6
|
-
* whether the path ends in a parameter (an item) or not (a collection). This
|
|
7
|
-
* covers 41 of the 47 operations; the rest are named in the CLI contract.
|
|
8
|
-
*/
|
|
9
|
-
export declare function deriveCommandPath(operation: V2OperationName): string[];
|
|
10
|
-
/** `conflictTarget` → `conflict-target`. */
|
|
11
|
-
export declare function kebab(value: string): string;
|
|
12
|
-
/**
|
|
13
|
-
* `min-duration-ms` → `minDurationMs`, the key commander actually stores.
|
|
14
|
-
*
|
|
15
|
-
* Commander camelCases every multi-word flag when it builds its options object,
|
|
16
|
-
* so a lookup by the flag's own name finds nothing and the value is silently
|
|
17
|
-
* dropped — no error, the field just never reaches the API. Every read of a
|
|
18
|
-
* parsed flag has to go through this.
|
|
19
|
-
*/
|
|
20
|
-
export declare function camel(flag: string): string;
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import type { CommandSpec } from '../contract/types';
|
|
2
|
-
import type { V2OperationName } from '../generated/v2-api';
|
|
3
|
-
import type { OperationSpec } from './types';
|
|
4
|
-
/** The one-line explanation of an in-band run failure, or `null` if there is none. */
|
|
5
|
-
export declare function runFailureMessage(operation: V2OperationName, payload: unknown): string | null;
|
|
6
|
-
/**
|
|
7
|
-
* Bulk operations that answer `200` even when they changed nothing.
|
|
8
|
-
*
|
|
9
|
-
* These endpoints are deliberately best-effort: they attempt every item, then
|
|
10
|
-
* report per-item outcomes in the payload. That is right for a partial
|
|
11
|
-
* success — some items really were deleted or moved — but a call that touched
|
|
12
|
-
* nothing at all is a failure the caller has to notice, and exiting `0` left
|
|
13
|
-
* `sim tables batch-delete --table-ids '["tbl_typo"]'` indistinguishable from a
|
|
14
|
-
* real deletion in a CI step.
|
|
15
|
-
*
|
|
16
|
-
* Only a total miss fails. A partial success still exits `0`: the payload names
|
|
17
|
-
* every item that did not make it, and failing the process there would break
|
|
18
|
-
* every caller that legitimately sweeps a list containing already-gone items.
|
|
19
|
-
*/
|
|
20
|
-
/**
|
|
21
|
-
* Reads a bulk payload, and the request that produced it, for a total miss.
|
|
22
|
-
*
|
|
23
|
-
* The request is needed because not every bulk response reports the items it
|
|
24
|
-
* failed on: `bulkDeleteFiles` answers with a deleted count and nothing else,
|
|
25
|
-
* so the only place the number of items asked for exists is the body that was
|
|
26
|
-
* sent.
|
|
27
|
-
*/
|
|
28
|
-
type BulkOutcomeCheck = (payload: Record<string, unknown>, body: Record<string, unknown> | undefined) => string | null;
|
|
29
|
-
export declare const BULK_OUTCOME_CHECKS: Readonly<Partial<Record<V2OperationName, BulkOutcomeCheck>>>;
|
|
30
|
-
/** Executes a parsed generated command, including cursor pagination. */
|
|
31
|
-
export declare function executeOperation(operation: V2OperationName, commandSpec: CommandSpec, operationSpec: OperationSpec, invocation: unknown[]): Promise<void>;
|
|
32
|
-
export {};
|
package/dist/runtime/naming.d.ts
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import type { CommandSpec } from '../contract/types';
|
|
2
|
-
import type { V2OperationName } from '../generated/v2-api';
|
|
3
|
-
import type { OperationSpec } from './types';
|
|
4
|
-
/**
|
|
5
|
-
* The spelling a caller types for a wire field, or `null` when there is none.
|
|
6
|
-
*
|
|
7
|
-
* Resolved through the same helpers the command builder uses, never by
|
|
8
|
-
* kebab-casing the wire name: `folderPath` is typed `--folder` and
|
|
9
|
-
* `knowledgeBaseIds` is typed `--kb`, so a mechanical translation would name
|
|
10
|
-
* flags that do not exist — strictly worse than leaving the wire name alone.
|
|
11
|
-
*/
|
|
12
|
-
export declare function spellingFor(operation: V2OperationName, commandSpec: CommandSpec, operationSpec: OperationSpec, field: string): string | null;
|
|
13
|
-
/**
|
|
14
|
-
* Restates a server validation error in the spellings the terminal accepts.
|
|
15
|
-
*
|
|
16
|
-
* The API names its own fields, correctly — `drop includeJobRuns` is right for
|
|
17
|
-
* an OpenAPI reader and untypeable here, where the flag is
|
|
18
|
-
* `--include-job-runs`. Applied at the one frame that still holds the
|
|
19
|
-
* operation, its command spec and its operation spec; by the time the error
|
|
20
|
-
* reaches the entrypoint that context is gone.
|
|
21
|
-
*
|
|
22
|
-
* A CLI-raised error (`status: 0`) is already phrased in flags and passes
|
|
23
|
-
* through untouched, as does anything that is not a `SimApiError`.
|
|
24
|
-
*/
|
|
25
|
-
export declare function retypeApiError(error: unknown, operation: V2OperationName, commandSpec: CommandSpec, operationSpec: OperationSpec): unknown;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { type Command } from 'commander';
|
|
2
|
-
import type { CommandSpec } from '../contract/types';
|
|
3
|
-
import type { V2OperationName } from '../generated/v2-api';
|
|
4
|
-
import type { OperationSpec } from './types';
|
|
5
|
-
export declare const DEFAULT_PAGE_SIZE = 100;
|
|
6
|
-
/** Zero fetches every page. Unclassified operations keep the bounded default. */
|
|
7
|
-
export declare function defaultListLimit(operation: V2OperationName): number;
|
|
8
|
-
/** Adds request-field and safety options for one generated operation. */
|
|
9
|
-
export declare function addOperationOptions(command: Command, operation: V2OperationName, commandSpec: CommandSpec, operationSpec: OperationSpec): void;
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
/** Announces a command path that has been renamed, naming its current spelling. */
|
|
2
|
-
export declare function warnRenamedCommand(from: string, to: string): void;
|
|
3
|
-
/** Announces a flag that has been renamed, naming its current spelling. */
|
|
4
|
-
export declare function warnRenamedFlag(from: string, to: string): void;
|
|
5
|
-
/** Test seam: renames warn once per process, and each test needs a clean slate. */
|
|
6
|
-
export declare function resetRenameWarnings(): void;
|
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
import type { CommandSpec, FlagSpec } from '../contract/types';
|
|
2
|
-
import { type V2OperationName } from '../generated/v2-api';
|
|
3
|
-
import { type QueryValue } from '../http/client';
|
|
4
|
-
import type { OperationSpec } from './types';
|
|
5
|
-
/** One request field, as the generator describes it. */
|
|
6
|
-
export interface FieldSpec {
|
|
7
|
-
kind: 'string' | 'number' | 'integer' | 'boolean' | 'enum' | 'array' | 'object' | 'unknown';
|
|
8
|
-
required?: boolean;
|
|
9
|
-
values?: readonly string[];
|
|
10
|
-
default?: unknown;
|
|
11
|
-
/** The field's `.describe()` from the route contract, used as `--help` text. */
|
|
12
|
-
describe?: string;
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* The workspace never becomes a flag.
|
|
16
|
-
*
|
|
17
|
-
* It is the one field every workspace-scoped operation declares, and it comes
|
|
18
|
-
* from the profile — surfacing it as `--workspace-id` on 30-odd commands would
|
|
19
|
-
* duplicate the global `--workspace` and invite the two to disagree.
|
|
20
|
-
*/
|
|
21
|
-
export declare const PROFILE_INJECTED_FIELD = "workspaceId";
|
|
22
|
-
/** Whether this path segment comes from the active profile's workspace. */
|
|
23
|
-
export declare function isProfileWorkspacePath(commandSpec: CommandSpec, param: string): boolean;
|
|
24
|
-
/**
|
|
25
|
-
* The slot a cursor-paginated operation carries its `cursor` field in.
|
|
26
|
-
*
|
|
27
|
-
* Pagination, not the name of a field, is what makes `limit` a page size. It
|
|
28
|
-
* lives here rather than beside its reader in `execute.ts` because `options.ts`
|
|
29
|
-
* has to ask the same question while it builds the flag, and importing
|
|
30
|
-
* `execute.ts` from `options.ts` would close a module cycle — `execute.ts`
|
|
31
|
-
* already reads `DEFAULT_PAGE_SIZE` from `options.ts`.
|
|
32
|
-
*/
|
|
33
|
-
export declare function cursorSlot(operationSpec: Pick<OperationSpec, 'query' | 'body'>): 'query' | 'body' | null;
|
|
34
|
-
export declare function flagSpecFor(operation: V2OperationName, field: string): FlagSpec;
|
|
35
|
-
/**
|
|
36
|
-
* Long and short flags the root program has already claimed.
|
|
37
|
-
*
|
|
38
|
-
* Commander matches the root's own options across the whole of argv, including
|
|
39
|
-
* after a subcommand name, so a leaf that declares one of these never sees what
|
|
40
|
-
* the caller typed. The two failure modes differ only in how loud they are:
|
|
41
|
-
* `--version` and `--help` terminate, so `sim workflows rollback wf_1 --version
|
|
42
|
-
* 1` printed the CLI version and exited `0` without issuing a request; the
|
|
43
|
-
* root's value flags do not terminate, so a colliding leaf simply reads
|
|
44
|
-
* `undefined` and acts as though the flag were never typed.
|
|
45
|
-
*/
|
|
46
|
-
export declare const RESERVED_PROGRAM_FLAGS: ReadonlySet<string>;
|
|
47
|
-
/** The flag name a field is exposed under, honouring any contract override. */
|
|
48
|
-
export declare function flagNameFor(operation: V2OperationName, field: string): string;
|
|
49
|
-
/** The named option used for a path parameter that is contextual rather than primary. */
|
|
50
|
-
export declare function pathFlagNameFor(commandSpec: CommandSpec, param: string): string;
|
|
51
|
-
export declare function takesJson(field: FieldSpec, flag: FlagSpec): boolean;
|
|
52
|
-
/**
|
|
53
|
-
* Drains stdin synchronously.
|
|
54
|
-
*
|
|
55
|
-
* `readFileSync(0)` looks like the obvious way to do this and fails on the one
|
|
56
|
-
* case that matters: a pipe is opened non-blocking, so a single read of an
|
|
57
|
-
* upstream process that has not written yet returns EAGAIN rather than waiting,
|
|
58
|
-
* and `export … | import --workflow @-` died with a raw stack trace. Reading in
|
|
59
|
-
* a loop and treating EAGAIN as "not ready yet" is what makes a pipe work.
|
|
60
|
-
*
|
|
61
|
-
* `Atomics.wait` is the only synchronous sleep available; without it the retry
|
|
62
|
-
* spins a core for as long as the writer takes.
|
|
63
|
-
*/
|
|
64
|
-
export declare const MAX_JSON_ARGUMENT_BYTES: number;
|
|
65
|
-
export declare function readArgumentSource(raw: string, flagName: string): Promise<{
|
|
66
|
-
text: string;
|
|
67
|
-
from: string;
|
|
68
|
-
}>;
|
|
69
|
-
/**
|
|
70
|
-
* Reads a primitive list from argv or a newline-delimited file. A `manifest`
|
|
71
|
-
* list drops blank and `#` comment lines read from a file, so a requirements
|
|
72
|
-
* file can be passed as it is on disk.
|
|
73
|
-
*/
|
|
74
|
-
export declare function readListValues(raw: unknown, flagName: string, manifest?: boolean): Promise<string[]>;
|
|
75
|
-
/**
|
|
76
|
-
* Rewrites one folder path into the API's canonical wire form.
|
|
77
|
-
*
|
|
78
|
-
* The wire form encodes each segment, so `/Folder 1` in the app is
|
|
79
|
-
* `/Folder%201` to the API — and typing the name you can see was rejected with
|
|
80
|
-
* a message that never said the word encoding. Splitting on `/` first is what
|
|
81
|
-
* keeps the separators: `encodeURIComponent` over the whole path would turn
|
|
82
|
-
* every one of them into `%2F` and address a single top-level folder whose name
|
|
83
|
-
* contains slashes.
|
|
84
|
-
*
|
|
85
|
-
* Decoding each segment before encoding it is what makes this idempotent, and
|
|
86
|
-
* it has to be: the encoded spelling is what the CLI prints today, what the
|
|
87
|
-
* README shows, and therefore what people will paste back. `/Folder 1` and
|
|
88
|
-
* `/Folder%201` must reach the same folder, and `%2520` is the failure to
|
|
89
|
-
* avoid. The limit of that rule is a folder whose name really contains a `%`
|
|
90
|
-
* followed by two hex digits — `100%20off` reads as `100 off`. A stray `%` is
|
|
91
|
-
* safe, because it fails to decode and is encoded literally, and the ambiguous
|
|
92
|
-
* name can always be typed in its encoded form (`100%2520off`).
|
|
93
|
-
*/
|
|
94
|
-
export declare function encodeFolderPath(value: string): string;
|
|
95
|
-
/**
|
|
96
|
-
* Turns the string argv provides into the value the contract expects.
|
|
97
|
-
*
|
|
98
|
-
* Every failure names the flag rather than the field, because the flag is what
|
|
99
|
-
* the caller typed — and every one of these is caught before any request is
|
|
100
|
-
* made, so a typo costs nothing.
|
|
101
|
-
*/
|
|
102
|
-
export declare function coerce(raw: unknown, field: FieldSpec, flag: FlagSpec, flagName: string): Promise<unknown>;
|
|
103
|
-
export interface BuiltRequest {
|
|
104
|
-
path: string;
|
|
105
|
-
query: Record<string, QueryValue>;
|
|
106
|
-
body: Record<string, unknown> | undefined;
|
|
107
|
-
/** Contract-declared request headers, absent when the operation declares none. */
|
|
108
|
-
headers?: Record<string, string>;
|
|
109
|
-
}
|
|
110
|
-
export declare function buildRequest(operation: V2OperationName, positional: string[], flags: Record<string, unknown>, workspaceId: string | null): Promise<BuiltRequest>;
|
package/dist/runtime/result.d.ts
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import type { OutputFormat } from '../config/index';
|
|
2
|
-
import type { CommandSpec } from '../contract/types';
|
|
3
|
-
import type { V2OperationName } from '../generated/v2-api';
|
|
4
|
-
interface RenderResultOptions {
|
|
5
|
-
expandedTrace?: boolean;
|
|
6
|
-
}
|
|
7
|
-
/**
|
|
8
|
-
* Undoes the wire encoding of a folder path for the human formats.
|
|
9
|
-
*
|
|
10
|
-
* The inverse of `encodeFolderPath`, per segment for the same reason: `%2F` is
|
|
11
|
-
* a slash inside one folder's name, not a separator. A segment that fails to
|
|
12
|
-
* decode is shown as it arrived rather than dropped — the point is to show the
|
|
13
|
-
* name, and a malformed one is still the truth about what the server holds.
|
|
14
|
-
*
|
|
15
|
-
* A segment whose decoded name contains the separator is shown in wire form for
|
|
16
|
-
* the same reason: decoding it would print a root folder named `a/b` as
|
|
17
|
-
* `/a/b`, byte-identical to a folder `b` nested under `a` — and the printed
|
|
18
|
-
* path is what people paste back, so `folders delete` addressed the other
|
|
19
|
-
* folder. Rendering must not manufacture structure that is not there.
|
|
20
|
-
*
|
|
21
|
-
* Callers must reach this only from a `table` or `text` rendering path — the
|
|
22
|
-
* hand-written `ls` builds its own columns and so decodes through here directly.
|
|
23
|
-
* `json` and `yaml` render from the raw payload so that switching format never
|
|
24
|
-
* changes the data, and a script piping a path back needs the wire form.
|
|
25
|
-
*/
|
|
26
|
-
export declare function decodeFolderPath(value: string): string;
|
|
27
|
-
export declare function renderPage(format: OutputFormat, page: {
|
|
28
|
-
data: unknown[];
|
|
29
|
-
nextCursor: string | null;
|
|
30
|
-
}, spec: CommandSpec, envelope?: unknown): void;
|
|
31
|
-
/**
|
|
32
|
-
* Carries a truncation stated on any page, not only the first.
|
|
33
|
-
*
|
|
34
|
-
* The envelope is otherwise the first page's, because a fact about the whole
|
|
35
|
-
* query (billing's `scope`) is stated once — but `toolNamesTruncated` is
|
|
36
|
-
* computed per page, so a walk that clipped on page 7 would have said nothing.
|
|
37
|
-
*/
|
|
38
|
-
export declare function foldPageEnvelope(current: unknown, page: unknown): unknown;
|
|
39
|
-
/** Renders one non-paginated operation result according to its CLI contract. */
|
|
40
|
-
export declare function renderResult(operation: V2OperationName, format: OutputFormat, raw: unknown, spec: CommandSpec, options?: RenderResultOptions, envelope?: unknown): void;
|
|
41
|
-
export {};
|