sim 2.2.33-preview.318.1 → 2.2.33-preview.320.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/commands/protocol/local-errors.d.ts +35 -0
- package/dist/commands/protocol/source-check.d.ts +83 -0
- package/dist/commands/protocol/source-dir/command-lock.d.ts +49 -0
- package/dist/commands/protocol/source-dir/dir-kind.d.ts +43 -0
- package/dist/commands/protocol/source-dir/files.d.ts +63 -0
- package/dist/commands/protocol/source-dir/index.d.ts +12 -0
- package/dist/commands/protocol/source-dir/layout.d.ts +74 -0
- package/dist/commands/protocol/source-dir/write-back.d.ts +13 -0
- package/dist/commands/protocol/source-dir/written.d.ts +82 -0
- package/dist/commands/protocol/source-exit-codes.d.ts +14 -3
- package/dist/commands/protocol/source-status.d.ts +7 -0
- package/dist/commands/protocol/source-ui.d.ts +5 -1
- package/dist/commands/protocol/source-write.d.ts +58 -0
- package/dist/commands/protocol/workflow-dir.d.ts +61 -0
- package/dist/commands/protocol/workflow-source-apply.d.ts +0 -19
- package/dist/commands/protocol/workflow-source-check.d.ts +0 -63
- package/dist/commands/protocol/workflow-source-get.d.ts +0 -28
- package/dist/commands/protocol/workspace-source-apply.d.ts +0 -6
- package/dist/commands/protocol/workspace-source-dir.d.ts +9 -0
- package/dist/commands/protocol/workspace-source-get.d.ts +0 -5
- package/dist/exit-codes.d.ts +2 -2
- package/dist/generated/v2-api.d.ts +12 -9
- package/dist/index.js +11464 -11030
- package/dist/runtime.js +11464 -11030
- package/package.json +1 -1
- package/dist/commands/protocol/source-dir.d.ts +0 -284
|
@@ -0,0 +1,61 @@
|
|
|
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 function-code files the source can reference: every `codeFile(…)` call the entry file makes,
|
|
13
|
+
* found by parsing it as compile does (an aliased import or spacing before the parenthesis still
|
|
14
|
+
* counts; a comment or string that spells one does not), plus every `codeFile` the lock records,
|
|
15
|
+
* limited to `.js`, `.py` and `.sh` files inside the directory. Only those are sent, so a
|
|
16
|
+
* reference to any other file never uploads it; the server reports a referenced file that is
|
|
17
|
+
* missing or of another kind.
|
|
18
|
+
*/
|
|
19
|
+
export declare function codeFilePaths(entry: string | null, lock: unknown): string[];
|
|
20
|
+
/**
|
|
21
|
+
* The base an apply sends, refused when it is not the named workflow's: a directory written for
|
|
22
|
+
* one workflow and applied to another would replace that workflow's draft with a stranger's
|
|
23
|
+
* source. Without a `workflowId` the apply targets the workflow the base names.
|
|
24
|
+
*/
|
|
25
|
+
export declare function readBase(directory: string, workflowId: string | undefined): Promise<SourceBase>;
|
|
26
|
+
/** The directory's lock, refused with every problem the lock parser finds. */
|
|
27
|
+
export declare function readLock(directory: string): Promise<WorkflowLockV1>;
|
|
28
|
+
/** The directory's `workflow.ts`, or a refusal naming the command that writes one. */
|
|
29
|
+
export declare function requireEntry(directory: string): Promise<string>;
|
|
30
|
+
/**
|
|
31
|
+
* The files a write sends: the entry file and the code files it or the lock references. A
|
|
32
|
+
* referenced file that is missing is left out, and the server reports it with its source line.
|
|
33
|
+
*/
|
|
34
|
+
export declare function readSourceFiles(directory: string, lock: WorkflowLockV1 | null): Promise<Record<string, string>>;
|
|
35
|
+
/** The create command for `dir` in `workspaceId`, as the next step a starter prints. */
|
|
36
|
+
export declare function createCommand(dir: string, workspaceId: string): string;
|
|
37
|
+
type WorkflowSource = GetWorkflowSourceResponse['data'];
|
|
38
|
+
/** The printed source a tree write saves: a get's answer, or an applied create's. */
|
|
39
|
+
export type PrintedSource = Pick<WorkflowSource, 'workflowId' | 'workspaceId' | 'files' | 'lock' | 'base'>;
|
|
40
|
+
/** The workflow directory's tree beside the printed source. */
|
|
41
|
+
export declare const WORKFLOW_TREE: SourceTreeProfile;
|
|
42
|
+
/**
|
|
43
|
+
* Starts a new source directory: a starter `workflow.ts` plus the tree a get writes (the
|
|
44
|
+
* declarations for the workspace catalog and its resources, `tsconfig.json`, the agent guide),
|
|
45
|
+
* with no lock or base, since no workflow exists yet, and {@link SOURCE_STARTER_FILE} naming the
|
|
46
|
+
* workspace those declarations are for. Only for a directory with no `workflow.ts`.
|
|
47
|
+
*/
|
|
48
|
+
export declare function writeSourceScaffold(client: OperationClient<'getSourceCatalog' | 'getSourceResources'>, dir: string, workspaceId: string): Promise<SourceTree>;
|
|
49
|
+
/**
|
|
50
|
+
* Writes a printed source with everything that makes the directory editable: the declarations
|
|
51
|
+
* for the workspace catalog and its resources, `tsconfig.json`, the agent guide and the LF lines.
|
|
52
|
+
* Shared by `get --dir` and `create --dir`, so a created workflow's directory is the one a get
|
|
53
|
+
* would have written.
|
|
54
|
+
*/
|
|
55
|
+
export declare function writeSourceDirectory(client: OperationClient<'getSourceCatalog' | 'getSourceResources'>, dir: string, source: PrintedSource, blockTypes: readonly string[]): Promise<SourceTree>;
|
|
56
|
+
/**
|
|
57
|
+
* After an apply, points the CLI's tsconfig files at the blocks the applied source uses, so a
|
|
58
|
+
* block the edit added is type-checked by `tsconfig.json` from then on.
|
|
59
|
+
*/
|
|
60
|
+
export declare function refreshWorkflowTsconfigs(dir: string, source: Pick<PrintedSource, 'workspaceId' | 'files'>): Promise<void>;
|
|
61
|
+
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 {};
|
|
@@ -103,6 +103,11 @@ export interface WorkspaceSubmission {
|
|
|
103
103
|
base?: ApplyWorkspaceSourceBody['base'];
|
|
104
104
|
/** Files under a kind folder that are not sent: hidden names and unsupported characters. */
|
|
105
105
|
ignored: string[];
|
|
106
|
+
/**
|
|
107
|
+
* Files under a workflow folder's `functions/` that neither its `workflow.ts` nor its lock names:
|
|
108
|
+
* never sent, as a workflow directory's apply never sends them.
|
|
109
|
+
*/
|
|
110
|
+
unnamed: string[];
|
|
106
111
|
/** The blobs this read hashed or reused a recorded digest for, with their stats. */
|
|
107
112
|
hashed: ReadonlyMap<string, StatDigest>;
|
|
108
113
|
}
|
|
@@ -132,4 +137,8 @@ export declare function readWorkspaceDir(dir: string, only: readonly WorkspaceKi
|
|
|
132
137
|
}): Promise<WorkspaceSubmission>;
|
|
133
138
|
/** `.sim/skipped.json`, or `null` when nothing was skipped. */
|
|
134
139
|
export declare function skippedFile(skipped: readonly unknown[]): string | null;
|
|
140
|
+
/** `--only`'s help: every kind by its folder. */
|
|
141
|
+
export declare const ONLY_KINDS_HELP: string;
|
|
142
|
+
/** `--only tables,workflows` (folders) or `--only table,workflow` (kinds) as kinds. */
|
|
143
|
+
export declare function parseKinds(value: string | undefined): WorkspaceKind[] | undefined;
|
|
135
144
|
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
|
package/dist/exit-codes.d.ts
CHANGED
|
@@ -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
|
|
42
|
-
*
|
|
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
|
*/
|