@vite-hub/workflow 0.0.3 → 0.1.0
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/LICENSE +201 -0
- package/README.md +187 -56
- package/dist/{_app-DgwN4ulW.d.ts → app-BojnC_yf.d.ts} +1 -4
- package/dist/{app-BZpq2cwC.js → app-CzPoP84f.js} +2 -1
- package/dist/client-DsGM3M4U.js +389 -0
- package/dist/cloudflare-env-BNrYo29x.js +113 -0
- package/dist/cloudflare-nF4abPd4.js +59 -0
- package/dist/cloudflare-shared-CaxrMD1A.d.ts +1 -0
- package/dist/{cloudflare-vite-B0zel2Do.js → cloudflare-vite-B3IabBsv.js} +18 -10
- package/dist/{config-BDqB6I4E.js → config-IJMb0eeZ.js} +39 -25
- package/dist/error-diagnostics-A_8Kp-48.js +116 -0
- package/dist/error-diagnostics-pwNFvAHP.js +67 -0
- package/dist/index.d.ts +24 -20
- package/dist/index.js +25 -334
- package/dist/inspect-B72iFyj-.js +70 -0
- package/dist/operations-B_rYG71W.js +230 -0
- package/dist/operations-tNUdj3G4.d.ts +212 -0
- package/dist/operations.d.ts +37 -0
- package/dist/operations.js +887 -0
- package/dist/out-CsaJxg8m.js +21755 -0
- package/dist/{provider-operation-CWIV4k42.js → provider-operation-CW2cYfVy.js} +13 -10
- package/dist/rolldown-runtime-CMFfr-1z.js +26 -0
- package/dist/runtime/cloudflare-runner.d.ts +8 -14
- package/dist/runtime/cloudflare-runner.js +77 -14
- package/dist/runtime/cloudflare-shared.d.ts +1 -0
- package/dist/runtime/cloudflare-shared.js +1 -1
- package/dist/runtime/cloudflare-vite.d.ts +8 -9
- package/dist/runtime/cloudflare-vite.js +2 -2
- package/dist/runtime/execute.d.ts +8 -7
- package/dist/runtime/execute.js +28 -5
- package/dist/runtime/openworkflow-worker.d.ts +6 -8
- package/dist/runtime/openworkflow-worker.js +43 -6
- package/dist/runtime/openworkflow.d.ts +8 -10
- package/dist/runtime/openworkflow.js +50 -32
- package/dist/runtime/state.d.ts +20 -21
- package/dist/runtime/state.js +90 -20
- package/dist/runtime/vercel-vite.d.ts +10 -11
- package/dist/runtime/vercel-vite.js +11 -8
- package/dist/runtime-type-DBCvIh5x.js +7 -0
- package/dist/{types-BUlYBZwH.d.ts → types-D82WmfZa.d.ts} +35 -18
- package/dist/{vercel-D2_J5D_Y.js → vercel-D-ZNtB_u.js} +59 -26
- package/dist/vite.d.ts +365 -6
- package/dist/vite.js +4667 -910
- package/package.json +78 -28
- package/dist/cloudflare-Cds1VIWa.js +0 -42
- package/dist/cloudflare-env-mFp2Uj6Z.js +0 -53
- package/dist/cloudflare-shared-BVVgDSdq.d.ts +0 -1
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
//#region ../../node_modules/.pnpm/@standard-schema+spec@1.1.0/node_modules/@standard-schema/spec/dist/index.d.ts
|
|
2
|
+
/** The Standard Typed interface. This is a base type extended by other specs. */
|
|
3
|
+
interface StandardTypedV1<Input = unknown, Output = Input> {
|
|
4
|
+
/** The Standard properties. */
|
|
5
|
+
readonly "~standard": StandardTypedV1.Props<Input, Output>;
|
|
6
|
+
}
|
|
7
|
+
declare namespace StandardTypedV1 {
|
|
8
|
+
/** The Standard Typed properties interface. */
|
|
9
|
+
interface Props<Input = unknown, Output = Input> {
|
|
10
|
+
/** The version number of the standard. */
|
|
11
|
+
readonly version: 1;
|
|
12
|
+
/** The vendor name of the schema library. */
|
|
13
|
+
readonly vendor: string;
|
|
14
|
+
/** Inferred types associated with the schema. */
|
|
15
|
+
readonly types?: Types<Input, Output> | undefined;
|
|
16
|
+
}
|
|
17
|
+
/** The Standard Typed types interface. */
|
|
18
|
+
interface Types<Input = unknown, Output = Input> {
|
|
19
|
+
/** The input type of the schema. */
|
|
20
|
+
readonly input: Input;
|
|
21
|
+
/** The output type of the schema. */
|
|
22
|
+
readonly output: Output;
|
|
23
|
+
}
|
|
24
|
+
/** Infers the input type of a Standard Typed. */
|
|
25
|
+
type InferInput<Schema extends StandardTypedV1> = NonNullable<Schema["~standard"]["types"]>["input"];
|
|
26
|
+
/** Infers the output type of a Standard Typed. */
|
|
27
|
+
type InferOutput<Schema extends StandardTypedV1> = NonNullable<Schema["~standard"]["types"]>["output"];
|
|
28
|
+
}
|
|
29
|
+
/** The Standard Schema interface. */
|
|
30
|
+
interface StandardSchemaV1<Input = unknown, Output = Input> {
|
|
31
|
+
/** The Standard Schema properties. */
|
|
32
|
+
readonly "~standard": StandardSchemaV1.Props<Input, Output>;
|
|
33
|
+
}
|
|
34
|
+
declare namespace StandardSchemaV1 {
|
|
35
|
+
/** The Standard Schema properties interface. */
|
|
36
|
+
interface Props<Input = unknown, Output = Input> extends StandardTypedV1.Props<Input, Output> {
|
|
37
|
+
/** Validates unknown input values. */
|
|
38
|
+
readonly validate: (value: unknown, options?: StandardSchemaV1.Options | undefined) => Result<Output> | Promise<Result<Output>>;
|
|
39
|
+
}
|
|
40
|
+
/** The result interface of the validate function. */
|
|
41
|
+
type Result<Output> = SuccessResult<Output> | FailureResult;
|
|
42
|
+
/** The result interface if validation succeeds. */
|
|
43
|
+
interface SuccessResult<Output> {
|
|
44
|
+
/** The typed output value. */
|
|
45
|
+
readonly value: Output;
|
|
46
|
+
/** A falsy value for `issues` indicates success. */
|
|
47
|
+
readonly issues?: undefined;
|
|
48
|
+
}
|
|
49
|
+
interface Options {
|
|
50
|
+
/** Explicit support for additional vendor-specific parameters, if needed. */
|
|
51
|
+
readonly libraryOptions?: Record<string, unknown> | undefined;
|
|
52
|
+
}
|
|
53
|
+
/** The result interface if validation fails. */
|
|
54
|
+
interface FailureResult {
|
|
55
|
+
/** The issues of failed validation. */
|
|
56
|
+
readonly issues: ReadonlyArray<Issue>;
|
|
57
|
+
}
|
|
58
|
+
/** The issue interface of the failure output. */
|
|
59
|
+
interface Issue {
|
|
60
|
+
/** The error message of the issue. */
|
|
61
|
+
readonly message: string;
|
|
62
|
+
/** The path of the issue, if any. */
|
|
63
|
+
readonly path?: ReadonlyArray<PropertyKey | PathSegment> | undefined;
|
|
64
|
+
}
|
|
65
|
+
/** The path segment interface of the issue. */
|
|
66
|
+
interface PathSegment {
|
|
67
|
+
/** The key representing a path segment. */
|
|
68
|
+
readonly key: PropertyKey;
|
|
69
|
+
}
|
|
70
|
+
/** The Standard types interface. */
|
|
71
|
+
interface Types<Input = unknown, Output = Input> extends StandardTypedV1.Types<Input, Output> {}
|
|
72
|
+
/** Infers the input type of a Standard. */
|
|
73
|
+
type InferInput<Schema extends StandardTypedV1> = StandardTypedV1.InferInput<Schema>;
|
|
74
|
+
/** Infers the output type of a Standard. */
|
|
75
|
+
type InferOutput<Schema extends StandardTypedV1> = StandardTypedV1.InferOutput<Schema>;
|
|
76
|
+
}
|
|
77
|
+
//#endregion
|
|
78
|
+
//#region ../internal/src/operations.d.ts
|
|
79
|
+
/** `read` never changes state. `write` changes state. `destructive` deletes or publishes. */
|
|
80
|
+
type OperationKind = "read" | "write" | "destructive";
|
|
81
|
+
/** The signed-in user of a call. */
|
|
82
|
+
interface OperationUser {
|
|
83
|
+
id: string;
|
|
84
|
+
name?: string;
|
|
85
|
+
email?: string;
|
|
86
|
+
image?: string;
|
|
87
|
+
[key: string]: unknown;
|
|
88
|
+
}
|
|
89
|
+
/** The Agent Actor when an agent calls through a capability or MCP on behalf of a user. */
|
|
90
|
+
interface OperationActor {
|
|
91
|
+
id: string;
|
|
92
|
+
kind?: string;
|
|
93
|
+
label?: string;
|
|
94
|
+
meta?: object;
|
|
95
|
+
}
|
|
96
|
+
/** The checked Console access of a call. `vite-hub` issues it. `ConsoleAccess` has this shape. */
|
|
97
|
+
interface OperationAccess {
|
|
98
|
+
readonly mode: string;
|
|
99
|
+
/**
|
|
100
|
+
* The sections that the call may use. `"all"` when no section filter applies. An entry is a section id (`"kv"`, every
|
|
101
|
+
* operation of the section) or `"<section>:read"` (only the operations that read).
|
|
102
|
+
*/
|
|
103
|
+
readonly sections: "all" | readonly string[];
|
|
104
|
+
readonly user?: OperationUser;
|
|
105
|
+
}
|
|
106
|
+
interface OperationContext {
|
|
107
|
+
/** The checked Console access of the call. */
|
|
108
|
+
access: OperationAccess;
|
|
109
|
+
/** The signed-in user, or null. */
|
|
110
|
+
user: OperationUser | null;
|
|
111
|
+
/** The Agent Actor when an agent calls on behalf of `user`. */
|
|
112
|
+
actor?: OperationActor;
|
|
113
|
+
surface: "console" | "cli" | "mcp" | "agent";
|
|
114
|
+
/** Set by the host from generated build identity, never from request input or runtime NODE_ENV. */
|
|
115
|
+
development?: boolean;
|
|
116
|
+
env?: Record<string, unknown>;
|
|
117
|
+
waitUntil?: (task: Promise<unknown>) => void;
|
|
118
|
+
request?: Request;
|
|
119
|
+
/** Operations set a success status here, such as 202 for an accepted call. */
|
|
120
|
+
response?: {
|
|
121
|
+
status?: number;
|
|
122
|
+
};
|
|
123
|
+
/**
|
|
124
|
+
* An agent or an MCP client may pass `lease: "override"` to `content.save`, `content.remove`, and `content.restore`
|
|
125
|
+
* only when the developer allowed it. Defaults to false, so a model cannot take over a document that a person is editing.
|
|
126
|
+
*/
|
|
127
|
+
overrideLeases?: boolean;
|
|
128
|
+
/**
|
|
129
|
+
* What an Agent may read of the Channel conversations, set by `operations({ conversations })`. `participant`: only the
|
|
130
|
+
* threads that the Actor takes part in. `all`: every thread. Unset: none.
|
|
131
|
+
*/
|
|
132
|
+
conversations?: "all" | "participant";
|
|
133
|
+
}
|
|
134
|
+
interface OperationDefinition<Input, Output> {
|
|
135
|
+
/** `<section>.<verb>`, such as `content.publish`. Unique per app. */
|
|
136
|
+
name: string;
|
|
137
|
+
/** One sentence. Becomes the CLI help line and the MCP tool description. */
|
|
138
|
+
description: string;
|
|
139
|
+
/**
|
|
140
|
+
* Console section that grants access, such as `content`. `false`: any Console user. A function reads the section
|
|
141
|
+
* from the input, for operations that serve several sections.
|
|
142
|
+
*/
|
|
143
|
+
section: string | false | ((input: Input) => string | undefined);
|
|
144
|
+
/** `read` never changes state. `write` changes state. `destructive` deletes or publishes; the CLI asks for `--yes`, MCP marks `destructiveHint`, agents require approval by default. */
|
|
145
|
+
kind: OperationKind;
|
|
146
|
+
/** Standard Schema (valibot in this repo). Its Standard JSON Schema builds CLI flags and the MCP input schema. */
|
|
147
|
+
input: StandardSchemaV1<unknown, Input>;
|
|
148
|
+
output?: StandardSchemaV1<unknown, Output>;
|
|
149
|
+
cli?: {
|
|
150
|
+
/** Defaults: namespace = section, command = verb. */
|
|
151
|
+
namespace?: string;
|
|
152
|
+
command?: string;
|
|
153
|
+
/** Input keys read from positional arguments, in order. */
|
|
154
|
+
positional?: string[];
|
|
155
|
+
/** Human output, written verbatim. Without it the CLI prints JSON. `--json` always prints JSON. */
|
|
156
|
+
format?: (output: Output) => string;
|
|
157
|
+
/** `vitehub <namespace>` runs this command when no command is named, such as `vitehub usage`. */
|
|
158
|
+
default?: boolean;
|
|
159
|
+
/**
|
|
160
|
+
* Route of the app that takes a signed dispatch of this operation, such as `/_vitehub/schedules/run`. With `--url`
|
|
161
|
+
* and a dispatch key in the environment (`VITEHUB_DISPATCH_KEY`), the command signs the input and posts it there, so
|
|
162
|
+
* a CI job needs no Console credentials. Without a key it calls the RPC.
|
|
163
|
+
*/
|
|
164
|
+
dispatch?: string;
|
|
165
|
+
};
|
|
166
|
+
/** Largest request body in bytes. It can raise the 64 KiB default but not lower it. */
|
|
167
|
+
maxRequestBytes?: number;
|
|
168
|
+
/**
|
|
169
|
+
* Returns true when this call only reads, such as a dry run of a `destructive` operation. The CLI then skips the
|
|
170
|
+
* confirmation, and agents run it without approval. Without it, every call of a `destructive` operation asks.
|
|
171
|
+
*/
|
|
172
|
+
readOnlyWhen?: (input: Input) => boolean;
|
|
173
|
+
/** `false`: MCP does not offer the operation as a tool, such as an editor transport that only the Console uses. */
|
|
174
|
+
mcp?: false;
|
|
175
|
+
/** `false`: the operation never reads `context.user`, so the Console skips the session lookup for it. */
|
|
176
|
+
user?: false;
|
|
177
|
+
/**
|
|
178
|
+
* The operation runs code of the app, such as a workflow, a job, a task, or a schedule. The Console registers it only
|
|
179
|
+
* when `console.invoke` is on, which is the default in development and off in a production build.
|
|
180
|
+
*/
|
|
181
|
+
invoke?: true;
|
|
182
|
+
run: (input: Input, context: OperationContext) => Output | Promise<Output>;
|
|
183
|
+
}
|
|
184
|
+
/** An operation of any input and output, as a registry holds it. */
|
|
185
|
+
interface AnyOperation extends Omit<OperationDefinition<unknown, unknown>, "cli" | "input" | "output" | "readOnlyWhen" | "run" | "section"> {
|
|
186
|
+
readOnlyWhen?: (input: never) => boolean;
|
|
187
|
+
cli?: {
|
|
188
|
+
namespace?: string;
|
|
189
|
+
command?: string;
|
|
190
|
+
default?: boolean;
|
|
191
|
+
dispatch?: string;
|
|
192
|
+
positional?: string[];
|
|
193
|
+
format?: (output: never) => string;
|
|
194
|
+
};
|
|
195
|
+
input: StandardSchemaV1;
|
|
196
|
+
output?: StandardSchemaV1;
|
|
197
|
+
run: (input: never, context: OperationContext) => unknown;
|
|
198
|
+
section: string | false | ((input: never) => string | undefined);
|
|
199
|
+
}
|
|
200
|
+
/** The contribution of one plugin: operations, or a module that exports them. */
|
|
201
|
+
interface OperationContributionEntry {
|
|
202
|
+
/** Module the app imports, such as `@vite-hub/content/operations`. */
|
|
203
|
+
module: string;
|
|
204
|
+
/** Named export that holds an operation or an array of operations. Defaults to `default`. */
|
|
205
|
+
export?: string;
|
|
206
|
+
/** Loads the export in the tool process, for a module that the tool cannot resolve by name. */
|
|
207
|
+
load?: () => Promise<unknown>;
|
|
208
|
+
/** `false`: the app already has these operations at runtime. Only tools such as the CLI and `vitehub inspect` read the entry. */
|
|
209
|
+
runtime?: false;
|
|
210
|
+
}
|
|
211
|
+
//#endregion
|
|
212
|
+
export { OperationContributionEntry as n, AnyOperation as t };
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { E as WorkflowRunStatus, x as WorkflowProvider } from "./types-D82WmfZa.js";
|
|
2
|
+
import { t as AnyOperation } from "./operations-tNUdj3G4.js";
|
|
3
|
+
//#region src/results.d.ts
|
|
4
|
+
/** One Workflow run as the operations return it. The start payload is not included. */
|
|
5
|
+
interface WorkflowRunView {
|
|
6
|
+
completedAt?: string;
|
|
7
|
+
createdAt?: string;
|
|
8
|
+
error?: {
|
|
9
|
+
code?: string;
|
|
10
|
+
message: string;
|
|
11
|
+
name?: string;
|
|
12
|
+
};
|
|
13
|
+
id: string;
|
|
14
|
+
metadata?: unknown;
|
|
15
|
+
provider: WorkflowProvider;
|
|
16
|
+
result?: unknown;
|
|
17
|
+
startedAt?: string;
|
|
18
|
+
status: WorkflowRunStatus;
|
|
19
|
+
workflow: string;
|
|
20
|
+
}
|
|
21
|
+
/** The signal that `workflow.resume` delivered. */
|
|
22
|
+
interface WorkflowSignalView {
|
|
23
|
+
id: string;
|
|
24
|
+
provider: WorkflowProvider;
|
|
25
|
+
}
|
|
26
|
+
interface WorkflowRunResult {
|
|
27
|
+
run: WorkflowRunView;
|
|
28
|
+
}
|
|
29
|
+
interface WorkflowSignalResult {
|
|
30
|
+
signal: WorkflowSignalView;
|
|
31
|
+
}
|
|
32
|
+
//#endregion
|
|
33
|
+
//#region src/operations.d.ts
|
|
34
|
+
/** The `workflow.*` operations: start, get, cancel, and resume. The Console, `vitehub workflow`, and agents run them. */
|
|
35
|
+
export declare const workflowOperations: readonly AnyOperation[];
|
|
36
|
+
//#endregion
|
|
37
|
+
export type { WorkflowRunResult, WorkflowRunView, WorkflowSignalResult, WorkflowSignalView };
|