sim 2.1.7-preview.92.1 → 2.1.8-dev.101.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.
Files changed (57) hide show
  1. package/dist/auth/device-flow.d.ts +38 -0
  2. package/dist/commands/auth.d.ts +5 -0
  3. package/dist/commands/configure.d.ts +2 -0
  4. package/dist/commands/credentials.d.ts +3 -0
  5. package/dist/commands/protocol/chat.d.ts +11 -0
  6. package/dist/commands/protocol/files-get.d.ts +25 -0
  7. package/dist/commands/protocol/files-upload.d.ts +2 -0
  8. package/dist/commands/protocol/index.d.ts +3 -0
  9. package/dist/commands/protocol/knowledge-document-upload.d.ts +2 -0
  10. package/dist/commands/protocol/logs-follow.d.ts +39 -0
  11. package/dist/commands/protocol/resource-directory.d.ts +24 -0
  12. package/dist/commands/protocol/result.d.ts +2 -0
  13. package/dist/commands/protocol/tables-import.d.ts +2 -0
  14. package/dist/commands/protocol/workflow-run-follow.d.ts +56 -0
  15. package/dist/commands/protocol/workflow-run-get.d.ts +15 -0
  16. package/dist/commands/protocol/workflow-run-wait.d.ts +3 -0
  17. package/dist/commands/secrets.d.ts +3 -0
  18. package/dist/config/index.d.ts +2 -0
  19. package/dist/config/ini.d.ts +111 -0
  20. package/dist/config/paths.d.ts +21 -0
  21. package/dist/config/profile.d.ts +158 -0
  22. package/dist/context.d.ts +21 -0
  23. package/dist/contract/commands.d.ts +14 -0
  24. package/dist/contract/types.d.ts +304 -0
  25. package/dist/embed-context.d.ts +77 -0
  26. package/dist/embed-output.d.ts +15 -0
  27. package/dist/embed.d.ts +39 -0
  28. package/dist/generated/v2-api.d.ts +13498 -0
  29. package/dist/helpers.d.ts +9 -0
  30. package/dist/http/client.d.ts +166 -0
  31. package/dist/http/environment.d.ts +24 -0
  32. package/dist/index.js +768 -281
  33. package/dist/output/io.d.ts +5 -0
  34. package/dist/output/presentation.d.ts +4 -0
  35. package/dist/output/render.d.ts +60 -0
  36. package/dist/output/terminal-text.d.ts +17 -0
  37. package/dist/output/trace.d.ts +3 -0
  38. package/dist/program.d.ts +21 -0
  39. package/dist/runtime/build.d.ts +38 -0
  40. package/dist/runtime/derive.d.ts +20 -0
  41. package/dist/runtime/execute.d.ts +30 -0
  42. package/dist/runtime/naming.d.ts +25 -0
  43. package/dist/runtime/options.d.ts +7 -0
  44. package/dist/runtime/renamed.d.ts +6 -0
  45. package/dist/runtime/request.d.ts +107 -0
  46. package/dist/runtime/result.d.ts +50 -0
  47. package/dist/runtime/types.d.ts +23 -0
  48. package/dist/runtime.d.ts +5 -0
  49. package/dist/runtime.js +17708 -0
  50. package/dist/terminal/secret-input.d.ts +15 -0
  51. package/dist/terminal.d.ts +6 -0
  52. package/dist/transfer/local-file.d.ts +16 -0
  53. package/dist/transfer/streaming-upload.d.ts +16 -0
  54. package/dist/transfer/upload-session.d.ts +18 -0
  55. package/dist/update/check.d.ts +53 -0
  56. package/dist/version.d.ts +10 -0
  57. package/package.json +15 -2
@@ -0,0 +1,15 @@
1
+ import type { ReadStream } from 'node:tty';
2
+ import { SimApiError } from '../http/client';
3
+ /**
4
+ * Raised when the user abandons the prompt with Ctrl-C or Ctrl-D, so the caller
5
+ * can exit 130 rather than folding an abort into the generic failure code.
6
+ */
7
+ export declare class SecretInputCancelledError extends SimApiError {
8
+ constructor();
9
+ }
10
+ interface SecretOutput {
11
+ write(value: string): unknown;
12
+ }
13
+ /** Reads a secret from a TTY while rendering one mask character per entered character. */
14
+ export declare function promptSecret(input?: ReadStream, output?: SecretOutput): Promise<string>;
15
+ export {};
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Anything the CLI can explain prints as one line and exits 1. An unexpected
3
+ * error keeps its stack trace — that is a bug in the CLI, and hiding it behind a
4
+ * friendly message would make it unreportable.
5
+ */
6
+ export declare function runTerminalCli(program?: import("commander").Command): Promise<void>;
@@ -0,0 +1,16 @@
1
+ import { type EmbedContext } from '../embed-context';
2
+ /** Both positional file spellings address the caller's same path. */
3
+ export declare function embeddedFileKey(path: string): string;
4
+ /**
5
+ * An embedded run executes in-process on the hosting server, so a positional path must
6
+ * never reach the server's filesystem. Only the caller-provided file reader may
7
+ * resolve it; missing capabilities and read failures stay explicit.
8
+ */
9
+ export declare function embeddedFileContent(embedded: EmbedContext, path: string): Promise<string | Uint8Array<ArrayBuffer>>;
10
+ export declare function contentTypeFor(name: string): string;
11
+ export interface LocalFile {
12
+ name: string;
13
+ size: number;
14
+ }
15
+ /** Validates the size and name shared by every local-file transfer. */
16
+ export declare function localFile(path: string, override?: string): Promise<LocalFile>;
@@ -0,0 +1,16 @@
1
+ /** One forward-only file stream shared by a PUT or successive multipart requests. */
2
+ export declare class StreamingUpload {
3
+ private readonly size;
4
+ private position;
5
+ private pending;
6
+ private closed;
7
+ private readonly reader;
8
+ private readonly onAbort;
9
+ private readonly stopped;
10
+ readonly signal: AbortSignal;
11
+ constructor(stream: ReadableStream<Uint8Array>, size: number, signal?: AbortSignal);
12
+ slice(start: number, end: number): ReadableStream<Uint8Array>;
13
+ assertConsumed(end: number): void;
14
+ verifyComplete(): Promise<void>;
15
+ close(): Promise<void>;
16
+ }
@@ -0,0 +1,18 @@
1
+ import { SimClient } from '../http/client';
2
+ export type UploadTransfer = {
3
+ method: 'put';
4
+ url: string;
5
+ headers: Record<string, string>;
6
+ } | {
7
+ method: 'multipart';
8
+ partSize: number;
9
+ partCount: number;
10
+ };
11
+ export interface UploadSession {
12
+ basePath: string;
13
+ uploadToken: string;
14
+ transfer: UploadTransfer;
15
+ size: number;
16
+ }
17
+ /** Uploads and completes a signed transfer, aborting its session if the transfer fails. */
18
+ export declare function finishUploadSession<T>(client: SimClient, workspaceId: string, session: UploadSession, path: string): Promise<T>;
@@ -0,0 +1,53 @@
1
+ /**
2
+ * The once-a-day "there is a newer sim" notice.
3
+ *
4
+ * It exists because a missing subcommand is indistinguishable from a feature
5
+ * that was never built: someone on 2.1.2 looking for `sim tools execute` — added
6
+ * in 2.1.5 — sees a help listing without it and concludes the CLI cannot do it.
7
+ * The version is the only thing that can tell them otherwise.
8
+ *
9
+ * Everything here fails silently. A courtesy notice that breaks a command, or
10
+ * that writes anything to stdout, is worse than no notice at all.
11
+ */
12
+ export interface UpdateCheckOptions {
13
+ /** Current working directory. Injected so project-local installation detection is testable. */
14
+ cwd?: string;
15
+ currentVersion?: string;
16
+ env?: NodeJS.ProcessEnv;
17
+ /** Whether stderr is a terminal. Injected so the suppression rule is testable. */
18
+ isTty?: boolean;
19
+ /** Location of the running module, used to recognise npx and local builds. */
20
+ modulePath?: string;
21
+ now?: Date;
22
+ /** Registry transport. Injectable so network behavior can be tested without global state. */
23
+ registryRequest?: RegistryRequest;
24
+ write?: (message: string) => void;
25
+ }
26
+ interface RegistryRequestOptions {
27
+ headers: Record<string, string>;
28
+ maxResponseBytes: number;
29
+ timeoutMs: number;
30
+ }
31
+ type RegistryRequest = (url: URL, options: RegistryRequestOptions) => Promise<string | null>;
32
+ /**
33
+ * The command that upgrades *this* installation.
34
+ *
35
+ * The path is asked first because it describes the installation; the
36
+ * environment is a fallback because for a globally installed CLI it usually
37
+ * describes nothing but the shell that happened to invoke it.
38
+ */
39
+ export declare function upgradeCommand(modulePath?: string, env?: NodeJS.ProcessEnv): string;
40
+ /**
41
+ * Uses a daily cache before telling the user their installation is out of date.
42
+ *
43
+ * Wired as a root `preAction` hook rather than a teardown in the entrypoint for
44
+ * two structural reasons: commander answers `--help` and `--version` during
45
+ * parsing, before any action hook runs, so the two most latency-sensitive
46
+ * invocations are excluded by construction rather than by a check; and some
47
+ * commands call `process.exit` directly, which a `finally` would never see.
48
+ *
49
+ * Never throws, writes only plain text to stderr, and stays silent when stderr
50
+ * is redirected. The caller runs this before the user's actual command.
51
+ */
52
+ export declare function announceUpdateIfAvailable(options?: UpdateCheckOptions): Promise<void>;
53
+ export {};
@@ -0,0 +1,10 @@
1
+ export declare function cliVersion(): string;
2
+ /**
3
+ * Identifies the CLI to the API, the way every other terminal client does.
4
+ *
5
+ * Without it a CLI request is indistinguishable from any other API traffic, so
6
+ * a bug that only reproduces on one CLI version cannot be found in the server's
7
+ * own logs. The runtime and platform ride along for the same reason: they are
8
+ * the first things asked about a transport failure that only some users see.
9
+ */
10
+ export declare function userAgent(): string;
package/package.json CHANGED
@@ -1,14 +1,17 @@
1
1
  {
2
2
  "name": "sim",
3
- "version": "2.1.7-preview.92.1",
3
+ "version": "2.1.8-dev.101.1",
4
4
  "description": "Sim CLI - talk to the Sim API from your terminal",
5
5
  "type": "module",
6
+ "imports": {
7
+ "#cli/*": "./src/*.ts"
8
+ },
6
9
  "bin": {
7
10
  "sim": "dist/index.js"
8
11
  },
9
12
  "scripts": {
10
13
  "prebuild": "bun run clean",
11
- "build": "bun build src/index.ts --target=node --format=esm --packages=bundle --reject-unresolved --outfile=dist/index.js",
14
+ "build": "bun build src/index.ts src/runtime.ts --target=node --format=esm --packages=bundle --reject-unresolved --outdir=dist && tsc -p tsconfig.types.json",
12
15
  "clean": "bun -e \"import { rmSync } from 'node:fs'; rmSync('dist', { recursive: true, force: true })\"",
13
16
  "type-check": "tsc --noEmit",
14
17
  "lint": "biome check --write --unsafe .",
@@ -57,5 +60,15 @@
57
60
  "@types/node": "24.2.1",
58
61
  "typescript": "^7.0.2",
59
62
  "vitest": "^4.1.0"
63
+ },
64
+ "exports": {
65
+ "./embed": {
66
+ "types": "./src/embed.ts",
67
+ "default": "./src/embed.ts"
68
+ },
69
+ "./runtime": {
70
+ "types": "./dist/runtime.d.ts",
71
+ "default": "./dist/runtime.js"
72
+ }
60
73
  }
61
74
  }