sim 2.2.33-preview.317.1 → 2.2.33-preview.319.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 (33) hide show
  1. package/dist/commands/protocol/git-provenance.d.ts +7 -0
  2. package/dist/commands/protocol/local-errors.d.ts +35 -0
  3. package/dist/commands/protocol/result.d.ts +1 -1
  4. package/dist/commands/protocol/source-check.d.ts +76 -0
  5. package/dist/commands/protocol/source-dir/command-lock.d.ts +49 -0
  6. package/dist/commands/protocol/source-dir/dir-kind.d.ts +43 -0
  7. package/dist/commands/protocol/source-dir/files.d.ts +63 -0
  8. package/dist/commands/protocol/source-dir/index.d.ts +12 -0
  9. package/dist/commands/protocol/source-dir/layout.d.ts +72 -0
  10. package/dist/commands/protocol/source-dir/write-back.d.ts +13 -0
  11. package/dist/commands/protocol/source-dir/written.d.ts +82 -0
  12. package/dist/commands/protocol/source-exit-codes.d.ts +14 -3
  13. package/dist/commands/protocol/source-status.d.ts +11 -0
  14. package/dist/commands/protocol/source-tree.d.ts +15 -1
  15. package/dist/commands/protocol/source-ui.d.ts +5 -1
  16. package/dist/commands/protocol/source-write.d.ts +58 -0
  17. package/dist/commands/protocol/stored-edges.d.ts +13 -5
  18. package/dist/commands/protocol/workflow-dir.d.ts +52 -0
  19. package/dist/commands/protocol/workflow-source-apply.d.ts +0 -19
  20. package/dist/commands/protocol/workflow-source-check.d.ts +0 -63
  21. package/dist/commands/protocol/workflow-source-get.d.ts +0 -28
  22. package/dist/commands/protocol/workspace-source-apply.d.ts +0 -6
  23. package/dist/commands/protocol/workspace-source-dir.d.ts +4 -0
  24. package/dist/commands/protocol/workspace-source-get.d.ts +0 -5
  25. package/dist/commands/search.d.ts +5 -0
  26. package/dist/exit-codes.d.ts +2 -2
  27. package/dist/generated/v2-api.d.ts +360 -8
  28. package/dist/http/client.d.ts +2 -1
  29. package/dist/index.js +23533 -22444
  30. package/dist/output/render.d.ts +3 -2
  31. package/dist/runtime.js +23533 -22444
  32. package/package.json +1 -1
  33. package/dist/commands/protocol/source-dir.d.ts +0 -263
@@ -1,4 +1,4 @@
1
- import { type BlockCatalog, type StoredEdgeRef } from '@sim/workflow-code';
1
+ import { type BlockCatalog, type CanonicalBlock, type StoredEdgeRef } from '@sim/workflow-code';
2
2
  import type { OperationClient } from '../../runtime/called-operations';
3
3
  /** A printed source as a get, apply or create answers it. */
4
4
  interface PrintedAnswer {
@@ -6,11 +6,13 @@ interface PrintedAnswer {
6
6
  lock: unknown;
7
7
  base: unknown;
8
8
  }
9
+ /** A digest of one compiled block, to tell a block an edit changed from one it left alone. */
10
+ export declare function blockDigest(block: CanonicalBlock): string;
9
11
  /**
10
- * The `.sim/stored-edges.json` write for a printed source: its edges, compiled against `catalog`
11
- * (the one it was printed with), tagged with its base fingerprint. `null` when the answer has no
12
- * fingerprint or entry, or nothing to compile it with; the record left on disk then names an
13
- * older fingerprint, which a check ignores.
12
+ * The `.sim/stored-edges.json` write for a printed source: its edges and a digest of each block
13
+ * ({@link blockDigest}, by key), compiled against `catalog` (the one it was printed with), tagged
14
+ * with its base fingerprint. `null` when the answer has no fingerprint or entry, or nothing to
15
+ * compile it with; the record left on disk then names an older fingerprint, which a check ignores.
14
16
  */
15
17
  export declare function storedEdgesWrite(answer: PrintedAnswer, catalog: BlockCatalog | null, folder?: string): readonly [string, string] | null;
16
18
  /** The stored-edges records of a workspace answer, and the folders left without one. */
@@ -39,6 +41,12 @@ export declare function unrecordedFoldersWarning(unrecorded: readonly string[]):
39
41
  * record, one an older CLI or another base wrote, or a malformed one.
40
42
  */
41
43
  export declare function readStoredEdges(dir: string): Promise<StoredEdgeRef[] | undefined>;
44
+ /**
45
+ * The digest of each block of the printed source the record of the base `dir` holds now was
46
+ * written from, by key (see {@link storedEdgesWrite}); `undefined` when there is no such record or
47
+ * it records no blocks (an older CLI wrote it).
48
+ */
49
+ export declare function readStoredBlockDigests(dir: string): Promise<ReadonlyMap<string, string> | undefined>;
42
50
  /** The stored-edges records of the workflow folders whose base a write removes (`paths`). */
43
51
  export declare function removedWorkflowRecords(paths: Iterable<string>): string[];
44
52
  export {};
@@ -0,0 +1,52 @@
1
+ /**
2
+ * A workflow source directory (`workflow.ts`, its function files, `.sim/lock.json` and
3
+ * `.sim/base.json`): what an apply, status or check reads from it, and what a get or create writes
4
+ * into it, so no command reads another's directory through that command's file.
5
+ */
6
+ import { type WorkflowLockV1 } from '@sim/workflow-code';
7
+ import type { ApplyWorkflowSourceBody, GetWorkflowSourceResponse } from '../../generated/v2-api';
8
+ import type { OperationClient } from '../../runtime/called-operations';
9
+ import { type SourceTree, type SourceTreeProfile } from './source-tree';
10
+ type SourceBase = ApplyWorkflowSourceBody['base'];
11
+ /**
12
+ * The base an apply sends, refused when it is not the named workflow's: a directory written for
13
+ * one workflow and applied to another would replace that workflow's draft with a stranger's
14
+ * source. Without a `workflowId` the apply targets the workflow the base names.
15
+ */
16
+ export declare function readBase(directory: string, workflowId: string | undefined): Promise<SourceBase>;
17
+ /** The directory's lock, refused with every problem the lock parser finds. */
18
+ export declare function readLock(directory: string): Promise<WorkflowLockV1>;
19
+ /** The directory's `workflow.ts`, or a refusal naming the command that writes one. */
20
+ export declare function requireEntry(directory: string): Promise<string>;
21
+ /**
22
+ * The files a write sends: the entry file and the code files it or the lock references. A
23
+ * referenced file that is missing is left out, and the server reports it with its source line.
24
+ */
25
+ export declare function readSourceFiles(directory: string, lock: WorkflowLockV1 | null): Promise<Record<string, string>>;
26
+ /** The create command for `dir` in `workspaceId`, as the next step a starter prints. */
27
+ export declare function createCommand(dir: string, workspaceId: string): string;
28
+ type WorkflowSource = GetWorkflowSourceResponse['data'];
29
+ /** The printed source a tree write saves: a get's answer, or an applied create's. */
30
+ export type PrintedSource = Pick<WorkflowSource, 'workflowId' | 'workspaceId' | 'files' | 'lock' | 'base'>;
31
+ /** The workflow directory's tree beside the printed source. */
32
+ export declare const WORKFLOW_TREE: SourceTreeProfile;
33
+ /**
34
+ * Starts a new source directory: a starter `workflow.ts` plus the tree a get writes (the
35
+ * declarations for the workspace catalog and its resources, `tsconfig.json`, the agent guide),
36
+ * with no lock or base, since no workflow exists yet, and {@link SOURCE_STARTER_FILE} naming the
37
+ * workspace those declarations are for. Only for a directory with no `workflow.ts`.
38
+ */
39
+ export declare function writeSourceScaffold(client: OperationClient<'getSourceCatalog' | 'getSourceResources'>, dir: string, workspaceId: string): Promise<SourceTree>;
40
+ /**
41
+ * Writes a printed source with everything that makes the directory editable: the declarations
42
+ * for the workspace catalog and its resources, `tsconfig.json`, the agent guide and the LF lines.
43
+ * Shared by `get --dir` and `create --dir`, so a created workflow's directory is the one a get
44
+ * would have written.
45
+ */
46
+ export declare function writeSourceDirectory(client: OperationClient<'getSourceCatalog' | 'getSourceResources'>, dir: string, source: PrintedSource, blockTypes: readonly string[]): Promise<SourceTree>;
47
+ /**
48
+ * After an apply, points the CLI's tsconfig files at the blocks the applied source uses, so a
49
+ * block the edit added is type-checked by `tsconfig.json` from then on.
50
+ */
51
+ export declare function refreshWorkflowTsconfigs(dir: string, source: Pick<PrintedSource, 'workspaceId' | 'files'>): Promise<void>;
52
+ export {};
@@ -1,22 +1,4 @@
1
- import { type WorkflowLockV1 } from '@sim/workflow-code';
2
1
  import type { Command } from 'commander';
3
- import type { ApplyWorkflowSourceBody } from '../../generated/v2-api';
4
- type SourceBase = ApplyWorkflowSourceBody['base'];
5
- /**
6
- * The base an apply sends, refused when it is not the named workflow's: a directory written for
7
- * one workflow and applied to another would replace that workflow's draft with a stranger's
8
- * source. Without a `workflowId` the apply targets the workflow the base names.
9
- */
10
- export declare function readBase(directory: string, workflowId: string | undefined): Promise<SourceBase>;
11
- /** The directory's lock, refused with every problem the lock parser finds. */
12
- export declare function readLock(directory: string): Promise<WorkflowLockV1>;
13
- /** The directory's `workflow.ts`, or a refusal naming the command that writes one. */
14
- export declare function requireEntry(directory: string): Promise<string>;
15
- /**
16
- * The files a write sends: the entry file and the code files it or the lock references. A
17
- * referenced file that is missing is left out, and the server reports it with its source line.
18
- */
19
- export declare function readSourceFiles(directory: string, lock: WorkflowLockV1 | null): Promise<Record<string, string>>;
20
2
  /**
21
3
  * `sim workflows source apply [workflowId] --dir <dir>`: sends a source directory written by
22
4
  * `workflows source get` (`workflow.ts`, its function-code files, `.sim/lock.json` and
@@ -35,4 +17,3 @@ export declare function attachWorkflowSourceApply(source: Command): void;
35
17
  * for the edit loop. Same consent rule as `apply`.
36
18
  */
37
19
  export declare function attachWorkflowSourceCreate(source: Command): void;
38
- export {};
@@ -1,70 +1,7 @@
1
- import { type BlockCatalog, type WorkflowInput } from '@sim/workflow-code';
2
1
  import type { Command } from 'commander';
3
- import { printProtocolResult } from './result';
4
- import { type LocalDeclarations } from './source-tree';
5
- import { type Diagnostic } from './source-ui';
6
- import { type WorkspaceDeclarations } from './workspace-source-dir';
7
- /**
8
- * Which {@link STRICT_CODES} warnings fail a check: `new` those on a block the lock does not bind
9
- * (one added since the get, or every block of a workflow that has no lock yet), `all` every one,
10
- * `off` none. Printed source can hold such a warning on a block nobody edited (a field left empty
11
- * in the editor), so the default fails only on blocks the edit wrote.
12
- */
13
- type StrictMode = 'new' | 'all' | 'off';
14
- /** One finding of a check, as the write commands print theirs. */
15
- export type CheckFinding = Diagnostic;
16
- /** The `--strict` / `--no-strict` pair: absent selects the default, {@link StrictMode} `new`. */
17
- export interface StrictOptions {
18
- strict?: boolean;
19
- }
20
- /** The strict mode the `--strict` / `--no-strict` pair selects. */
21
- export declare function strictMode(options: StrictOptions): StrictMode;
22
- /** Help shared by both check commands: what fails, and the strict flags. */
23
- export declare const STRICT_HELP: string;
24
- /** Adds the `--strict` / `--no-strict` pair to a check command. */
25
- export declare function strictFlags(command: Command): Command;
26
- /** Every workflow key of the workspace directory `root` that has a `workflow.ts`. */
27
- export declare function workspaceWorkflowKeys(root: string): Promise<string[]>;
28
- /**
29
- * Points the workspace directory's tsconfig files at the blocks its workflows now use, keeping the
30
- * blocks they include.
31
- */
32
- export declare function refreshWorkspaceTsconfigs(root: string, workspaceId: string): Promise<void>;
33
- /**
34
- * The inputs of each workflow of the workspace directory `root` that compiles (`startInputs`,
35
- * `null` for one without a Start trigger), by key: what a child workflow call is checked against
36
- * and what `workspace.d.ts` types its `inputMapping` with.
37
- */
38
- export declare function workspaceWorkflowInputs(root: string, catalog: BlockCatalog): Promise<Map<string, WorkflowInput[] | null>>;
39
- /**
40
- * The workflows of `local` typed with the inputs each declares (`inputs`), for `workspace.d.ts`.
41
- */
42
- export declare function withWorkflowInputs(local: LocalDeclarations, inputs: ReadonlyMap<string, readonly WorkflowInput[] | null>): LocalDeclarations;
43
- /**
44
- * Compiles one workflow source directory offline against `catalog`, with the workspace's
45
- * declarations when the directory sits in a workspace directory, and returns its findings with
46
- * the {@link STRICT_CODES} the strict mode fails on raised to errors, and the `workflow.ts` text.
47
- * `prefix` goes before each file path (`workflows/<key>/` in a workspace check).
48
- */
49
- export declare function checkWorkflowDir(dir: string, catalog: BlockCatalog, options: {
50
- declarations?: WorkspaceDeclarations;
51
- strict: StrictMode;
52
- prefix?: string;
53
- }): Promise<{
54
- findings: CheckFinding[];
55
- entry: string;
56
- }>;
57
- /**
58
- * Prints a check's findings and result, and exits 1 on any error. `verbose` keeps info findings in
59
- * a machine result.
60
- */
61
- export declare function reportCheck(output: Parameters<typeof printProtocolResult>[0], findings: CheckFinding[], result: Record<string, unknown>, verbose?: boolean): void;
62
- /** The cached catalog of `workspaceId`, or a refusal naming `get`, the command that caches one. */
63
- export declare function requireCachedCatalog(workspaceId: string, get: string): BlockCatalog;
64
2
  /**
65
3
  * `sim workflows source check [--dir <dir>]`: compiles a source directory locally with the bundled
66
4
  * compiler and the cached catalog, so an agent's edit loop gets syntax and builder findings in
67
5
  * milliseconds and without the network. The dry run stays the authority.
68
6
  */
69
7
  export declare function attachWorkflowSourceCheck(source: Command): void;
70
- export {};
@@ -1,31 +1,4 @@
1
1
  import type { Command } from 'commander';
2
- import type { GetWorkflowSourceResponse } from '../../generated/v2-api';
3
- import { type OperationClient } from '../../runtime/called-operations';
4
- import { type SourceTree, type SourceTreeProfile } from './source-tree';
5
- type WorkflowSource = GetWorkflowSourceResponse['data'];
6
- /** The printed source a tree write saves: a get's answer, or an applied create's. */
7
- type PrintedSource = Pick<WorkflowSource, 'workflowId' | 'workspaceId' | 'files' | 'lock' | 'base'>;
8
- /** The workflow directory's tree beside the printed source. */
9
- export declare const WORKFLOW_TREE: SourceTreeProfile;
10
- /**
11
- * Starts a new source directory: a starter `workflow.ts` plus the tree a get writes (the
12
- * declarations for the workspace catalog and its resources, `tsconfig.json`, the agent guide),
13
- * with no lock or base, since no workflow exists yet, and {@link SOURCE_STARTER_FILE} naming the
14
- * workspace those declarations are for. Only for a directory with no `workflow.ts`.
15
- */
16
- export declare function writeSourceScaffold(client: OperationClient<'getSourceCatalog' | 'getSourceResources'>, dir: string, workspaceId: string): Promise<SourceTree>;
17
- /**
18
- * Writes a printed source with everything that makes the directory editable: the declarations
19
- * for the workspace catalog and its resources, `tsconfig.json`, the agent guide and the LF lines.
20
- * Shared by `get --dir` and `create --dir`, so a created workflow's directory is the one a get
21
- * would have written.
22
- */
23
- export declare function writeSourceDirectory(client: OperationClient<'getSourceCatalog' | 'getSourceResources'>, dir: string, source: PrintedSource, blockTypes: readonly string[]): Promise<SourceTree>;
24
- /**
25
- * After an apply, points the CLI's tsconfig files at the blocks the applied source uses, so a
26
- * block the edit added is type-checked by `tsconfig.json` from then on.
27
- */
28
- export declare function refreshWorkflowTsconfigs(dir: string, source: Pick<PrintedSource, 'workspaceId' | 'files'>): Promise<void>;
29
2
  /**
30
3
  * Teaches the generated `workflows source get` leaf `--dir <dir>`: instead of printing the
31
4
  * response, it writes `workflow.ts`, `functions/*`, `.sim/lock.json`, `.sim/base.json`, SDK
@@ -37,4 +10,3 @@ export declare function refreshWorkflowTsconfigs(dir: string, source: Pick<Print
37
10
  * no way to read the action it holds, so it is captured and delegated to, as `runs get` does.
38
11
  */
39
12
  export declare function attachWorkflowSourceGet(source: Command): void;
40
- export {};
@@ -1,9 +1,4 @@
1
1
  import type { Command } from 'commander';
2
- import type { ApplyWorkspaceSourceResponse } from '../../generated/v2-api';
3
- type ApplyData = ApplyWorkspaceSourceResponse['data'];
4
- type Change = ApplyData['plan'][number];
5
- /** The changes that delete something (a resource, rows, documents, columns, a deployment). */
6
- export declare function destructiveChanges(changes: readonly Change[]): number;
7
2
  /**
8
3
  * `sim workspaces source apply --dir <dir>`: applies a directory `workspaces source get` wrote.
9
4
  * On a terminal it shows the plan and asks; anywhere else it needs `--yes`. Binary files are
@@ -12,4 +7,3 @@ export declare function destructiveChanges(changes: readonly Change[]): number;
12
7
  * nothing when a blob it needs is missing.
13
8
  */
14
9
  export declare function attachWorkspaceSourceApply(source: Command): void;
15
- export {};
@@ -132,4 +132,8 @@ export declare function readWorkspaceDir(dir: string, only: readonly WorkspaceKi
132
132
  }): Promise<WorkspaceSubmission>;
133
133
  /** `.sim/skipped.json`, or `null` when nothing was skipped. */
134
134
  export declare function skippedFile(skipped: readonly unknown[]): string | null;
135
+ /** `--only`'s help: every kind by its folder. */
136
+ export declare const ONLY_KINDS_HELP: string;
137
+ /** `--only tables,workflows` (folders) or `--only table,workflow` (kinds) as kinds. */
138
+ export declare function parseKinds(value: string | undefined): WorkspaceKind[] | undefined;
135
139
  export {};
@@ -1,9 +1,4 @@
1
- import { type WorkspaceKind } from '@sim/workspace-code';
2
1
  import type { Command } from 'commander';
3
- /** `--only`'s help: every kind by its folder. */
4
- export declare const ONLY_KINDS_HELP: string;
5
- /** `--only tables,workflows` (folders) or `--only table,workflow` (kinds) as kinds. */
6
- export declare function parseKinds(value: string | undefined): WorkspaceKind[] | undefined;
7
2
  /**
8
3
  * `sim workspaces source get --dir <dir> [--only kinds]`: writes the workspace as a source
9
4
  * directory: `tables/`, `tools/`, `skills/`, `knowledge/`, `files/` and `workflows/<key>/` (each a
@@ -1,4 +1,9 @@
1
1
  import { Command } from 'commander';
2
+ /**
3
+ * Indexes `command` for `tasks` too, so `sim cli search` finds it from how an agent or a person
4
+ * phrases the job, not only from its name. Returns the command, to chain.
5
+ */
6
+ export declare function searchTasks(command: Command, tasks: readonly string[]): Command;
2
7
  export interface SearchResult {
3
8
  command: string;
4
9
  summary: string;
@@ -38,8 +38,8 @@ export declare const SOURCE_PARTIAL_EXIT_CODE = 8;
38
38
  export declare const RATE_LIMITED_EXIT_CODE = 9;
39
39
  /**
40
40
  * Busy, retry. A `workspaces source apply` refused because another apply is writing the workspace
41
- * (`409` with `SOURCE_BUSY`), or any `workspaces source` command refused because another one holds
42
- * the same directory (`SOURCE_DIR_BUSY`): nothing of this one was read or written. Wait for the
41
+ * (`409` with `SOURCE_BUSY`), or a source command refused because another one holds the same
42
+ * directory (`SOURCE_DIR_BUSY`): nothing of this one was read or written. Wait for the
43
43
  * other to finish, then run it again; a write the other apply made to a resource this directory
44
44
  * changes then exits 5.
45
45
  */