@keystrokehq/hosting 0.1.7 → 0.1.8
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.cjs +544 -36
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +544 -36
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -4
package/dist/index.cjs
CHANGED
|
@@ -2299,6 +2299,21 @@ function handleReadonlyResult(payload) {
|
|
|
2299
2299
|
payload.value = Object.freeze(payload.value);
|
|
2300
2300
|
return payload;
|
|
2301
2301
|
}
|
|
2302
|
+
const $ZodLazy = /* @__PURE__ */ $constructor("$ZodLazy", (inst, def) => {
|
|
2303
|
+
$ZodType.init(inst, def);
|
|
2304
|
+
defineLazy(inst._zod, "innerType", () => {
|
|
2305
|
+
const d = def;
|
|
2306
|
+
if (!d._cachedInner) d._cachedInner = def.getter();
|
|
2307
|
+
return d._cachedInner;
|
|
2308
|
+
});
|
|
2309
|
+
defineLazy(inst._zod, "pattern", () => inst._zod.innerType?._zod?.pattern);
|
|
2310
|
+
defineLazy(inst._zod, "propValues", () => inst._zod.innerType?._zod?.propValues);
|
|
2311
|
+
defineLazy(inst._zod, "optin", () => inst._zod.innerType?._zod?.optin ?? void 0);
|
|
2312
|
+
defineLazy(inst._zod, "optout", () => inst._zod.innerType?._zod?.optout ?? void 0);
|
|
2313
|
+
inst._zod.parse = (payload, ctx) => {
|
|
2314
|
+
return inst._zod.innerType._zod.run(payload, ctx);
|
|
2315
|
+
};
|
|
2316
|
+
});
|
|
2302
2317
|
const $ZodCustom = /* @__PURE__ */ $constructor("$ZodCustom", (inst, def) => {
|
|
2303
2318
|
$ZodCheck.init(inst, def);
|
|
2304
2319
|
$ZodType.init(inst, def);
|
|
@@ -3441,6 +3456,12 @@ const optionalProcessor = (schema, ctx, _json, params) => {
|
|
|
3441
3456
|
const seen = ctx.seen.get(schema);
|
|
3442
3457
|
seen.ref = def.innerType;
|
|
3443
3458
|
};
|
|
3459
|
+
const lazyProcessor = (schema, ctx, _json, params) => {
|
|
3460
|
+
const innerType = schema._zod.innerType;
|
|
3461
|
+
process$1(innerType, ctx, params);
|
|
3462
|
+
const seen = ctx.seen.get(schema);
|
|
3463
|
+
seen.ref = innerType;
|
|
3464
|
+
};
|
|
3444
3465
|
//#endregion
|
|
3445
3466
|
//#region ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/classic/iso.js
|
|
3446
3467
|
const ZodISODateTime = /* @__PURE__ */ $constructor("ZodISODateTime", (inst, def) => {
|
|
@@ -4304,6 +4325,18 @@ function readonly(innerType) {
|
|
|
4304
4325
|
innerType
|
|
4305
4326
|
});
|
|
4306
4327
|
}
|
|
4328
|
+
const ZodLazy = /* @__PURE__ */ $constructor("ZodLazy", (inst, def) => {
|
|
4329
|
+
$ZodLazy.init(inst, def);
|
|
4330
|
+
ZodType.init(inst, def);
|
|
4331
|
+
inst._zod.processJSONSchema = (ctx, json, params) => lazyProcessor(inst, ctx, json, params);
|
|
4332
|
+
inst.unwrap = () => inst._zod.def.getter();
|
|
4333
|
+
});
|
|
4334
|
+
function lazy(getter) {
|
|
4335
|
+
return new ZodLazy({
|
|
4336
|
+
type: "lazy",
|
|
4337
|
+
getter
|
|
4338
|
+
});
|
|
4339
|
+
}
|
|
4307
4340
|
const ZodCustom = /* @__PURE__ */ $constructor("ZodCustom", (inst, def) => {
|
|
4308
4341
|
$ZodCustom.init(inst, def);
|
|
4309
4342
|
ZodType.init(inst, def);
|
|
@@ -4979,10 +5012,244 @@ const AppSlugSchema = ProjectSlugSchema;
|
|
|
4979
5012
|
function resolveExplicitPublicPlatformOrigin(env = process.env) {
|
|
4980
5013
|
return env.PUBLIC_PLATFORM_URL?.replace(/\/$/, "") || void 0;
|
|
4981
5014
|
}
|
|
5015
|
+
/** How a credential instance is stored (`credential_instances.auth_kind`). */
|
|
5016
|
+
const CredentialAuthKindSchema = _enum([
|
|
5017
|
+
"api_key",
|
|
5018
|
+
"oauth_managed",
|
|
5019
|
+
"keystroke"
|
|
5020
|
+
]);
|
|
5021
|
+
/**
|
|
5022
|
+
* Where a credential instance is stored (`credential_instances.scope_type`), and the only thing an
|
|
5023
|
+
* action/tool can pin via `.scope(...)`. There is no resolution chain: when no scope is pinned, the
|
|
5024
|
+
* resolver tries the project default, then the org default, then throws.
|
|
5025
|
+
*/
|
|
5026
|
+
const CredentialScopeTypeSchema = _enum([
|
|
5027
|
+
"organization",
|
|
5028
|
+
"project",
|
|
5029
|
+
"user"
|
|
5030
|
+
]);
|
|
5031
|
+
CredentialAuthKindSchema.options;
|
|
5032
|
+
CredentialScopeTypeSchema.options;
|
|
5033
|
+
/** Non-empty human-readable label or description (trimmed). */
|
|
5034
|
+
const requiredDisplayTextSchema = string().trim().min(1);
|
|
5035
|
+
/**
|
|
5036
|
+
* Structural workflow-canvas graph contract.
|
|
5037
|
+
*
|
|
5038
|
+
* This is the deterministic skeleton the deploy-time AST producer emits for a
|
|
5039
|
+
* workflow (nodes + edges), plus the manifest-derived trigger-source nodes. It
|
|
5040
|
+
* is the single source of truth shared by:
|
|
5041
|
+
* - the AST producer (emits it at deploy, stored with the manifest),
|
|
5042
|
+
* - the platform route that serves the canvas, and
|
|
5043
|
+
* - the SDK / web client that renders it (React Flow).
|
|
5044
|
+
*
|
|
5045
|
+
* Only the structural skeleton lives here. The LLM enrichment + run-overlay
|
|
5046
|
+
* envelope types live in `workflow-canvas-envelope.ts`; the SDK re-exports them.
|
|
5047
|
+
* See WORKFLOW.md (§4 grammar, §8 node ids, §9 caching).
|
|
5048
|
+
*/
|
|
5049
|
+
/**
|
|
5050
|
+
* Canvas node taxonomy — the single discriminator for every canvas node. The
|
|
5051
|
+
* client derives the React Flow component, icon, and per-node treatment from it
|
|
5052
|
+
* (no parallel `type` / `data.kind` fields), and the producer + fixtures emit it
|
|
5053
|
+
* directly, so the structural contract can never silently diverge across the
|
|
5054
|
+
* deploy → render boundary.
|
|
5055
|
+
* - Boundaries: `entry` (Start, owns input) · `exit` (Output, owns output) ·
|
|
5056
|
+
* `error` (a terminal `throw` — an error output that ends the run on a branch)
|
|
5057
|
+
* - Callable: `step` (action / agent / llm / hook / child-workflow invocation) —
|
|
5058
|
+
* the invocation flavor lives in {@link WorkflowCanvasCallKind}
|
|
5059
|
+
* - Structural control flow: `code-block` · `decision` · `merge` · `loop` ·
|
|
5060
|
+
* `parallel` (group containers) · `loop-start` (the group body's entry marker,
|
|
5061
|
+
* shared by loop + parallel)
|
|
5062
|
+
* - Upstream of entry: `trigger-source` (one per manifest trigger attachment)
|
|
5063
|
+
*
|
|
5064
|
+
* `Promise.all([...])` is modeled as a `parallel` group container: the branches
|
|
5065
|
+
* are stacked inside and the container itself is the single prong leaving the
|
|
5066
|
+
* wrapper (there is no separate fork/join pair).
|
|
5067
|
+
*
|
|
5068
|
+
* `exit` and `error` are both terminals: a `return` flows to the shared `exit`
|
|
5069
|
+
* (the workflow output), while a `throw` gets its own `error` terminal off the
|
|
5070
|
+
* branch so guard clauses (`if (bad) throw …`) read as a visible dead-end.
|
|
5071
|
+
*/
|
|
5072
|
+
const WorkflowCanvasNodeTypeSchema = _enum([
|
|
5073
|
+
"entry",
|
|
5074
|
+
"exit",
|
|
5075
|
+
"error",
|
|
5076
|
+
"step",
|
|
5077
|
+
"code-block",
|
|
5078
|
+
"decision",
|
|
5079
|
+
"merge",
|
|
5080
|
+
"loop",
|
|
5081
|
+
"parallel",
|
|
5082
|
+
"loop-start",
|
|
5083
|
+
"trigger-source"
|
|
5084
|
+
]);
|
|
5085
|
+
_enum([
|
|
5086
|
+
"workflow-step",
|
|
5087
|
+
"agent",
|
|
5088
|
+
"llm",
|
|
5089
|
+
"wait",
|
|
5090
|
+
"hook",
|
|
5091
|
+
"tool",
|
|
5092
|
+
"child-workflow"
|
|
5093
|
+
]);
|
|
5094
|
+
/** A labeled branch output on a decision-style node. */
|
|
5095
|
+
const WorkflowCanvasNodeOutputSchema = object({
|
|
5096
|
+
id: string(),
|
|
5097
|
+
label: string()
|
|
5098
|
+
});
|
|
5099
|
+
/**
|
|
5100
|
+
* A step input's configured value at its call site, captured deterministically
|
|
5101
|
+
* by the producer from the call's argument object. The platform join turns this
|
|
5102
|
+
* into the inspector's {@link WorkflowNodeInputBinding} (filling display labels).
|
|
5103
|
+
*/
|
|
5104
|
+
const WorkflowCanvasRawBindingSchema = object({
|
|
5105
|
+
tokens: array(discriminatedUnion("kind", [
|
|
5106
|
+
object({
|
|
5107
|
+
kind: literal("text"),
|
|
5108
|
+
text: string()
|
|
5109
|
+
}),
|
|
5110
|
+
object({
|
|
5111
|
+
kind: literal("reference"),
|
|
5112
|
+
/** Upstream node id this value flows from; absent only for unresolved refs. */
|
|
5113
|
+
sourceNodeId: string().optional(),
|
|
5114
|
+
/** Output field of the source (dotted path); omitted = the whole output. */
|
|
5115
|
+
field: string().optional()
|
|
5116
|
+
}),
|
|
5117
|
+
object({
|
|
5118
|
+
kind: literal("variable"),
|
|
5119
|
+
text: string()
|
|
5120
|
+
}),
|
|
5121
|
+
object({
|
|
5122
|
+
kind: literal("call"),
|
|
5123
|
+
name: string()
|
|
5124
|
+
})
|
|
5125
|
+
])),
|
|
5126
|
+
/** Render as a tall multi-line box (object/array/multiline template values). */
|
|
5127
|
+
multiline: boolean().optional()
|
|
5128
|
+
});
|
|
5129
|
+
/**
|
|
5130
|
+
* Statically-captured `promptLlm` options for an `llm` step node. Literal-only:
|
|
5131
|
+
* dynamic/expression values (a computed model, a `system` built by a function) are
|
|
5132
|
+
* not captured; `system`/`outputSchema` record presence so the inspector can note
|
|
5133
|
+
* "a system prompt is configured" / "structured output" without their values.
|
|
5134
|
+
*/
|
|
5135
|
+
const WorkflowCanvasLlmOptionsSchema = object({
|
|
5136
|
+
model: string().optional(),
|
|
5137
|
+
maxTokens: number$1().optional(),
|
|
5138
|
+
temperature: number$1().optional(),
|
|
5139
|
+
thinkingLevel: string().optional(),
|
|
5140
|
+
hasSystemPrompt: boolean().optional(),
|
|
5141
|
+
hasOutputSchema: boolean().optional()
|
|
5142
|
+
});
|
|
5143
|
+
const WorkflowCanvasNodeDataSchema = object({
|
|
5144
|
+
label: string(),
|
|
5145
|
+
/** Set on group nodes (loop / parallel section containers). */
|
|
5146
|
+
groupKind: _enum([
|
|
5147
|
+
"loop",
|
|
5148
|
+
"parallel",
|
|
5149
|
+
"conditional"
|
|
5150
|
+
]).optional(),
|
|
5151
|
+
description: string().optional(),
|
|
5152
|
+
/** {@link WorkflowCanvasCallKind} or a looser raw call-site label. */
|
|
5153
|
+
callKind: string().optional(),
|
|
5154
|
+
/**
|
|
5155
|
+
* App/integration slug for a `step` whose action/agent is imported directly
|
|
5156
|
+
* from a `@keystrokehq/<app>` package (e.g. "slack", "apollo"). Lets the client
|
|
5157
|
+
* badge the node with that app's logo; absent for custom (project-local)
|
|
5158
|
+
* actions, which fall back to the call-kind icon.
|
|
5159
|
+
*/
|
|
5160
|
+
appSlug: string().optional(),
|
|
5161
|
+
/** Cron/webhook/poll discriminator on trigger-source nodes. */
|
|
5162
|
+
triggerType: string().optional(),
|
|
5163
|
+
/** Branch outputs (decision nodes). */
|
|
5164
|
+
outputs: array(WorkflowCanvasNodeOutputSchema).optional(),
|
|
5165
|
+
/**
|
|
5166
|
+
* Action/agent/workflow slug resolved at deploy time (via import → definition).
|
|
5167
|
+
* Optional when the deploy build cannot resolve source (dist-only artifacts).
|
|
5168
|
+
*/
|
|
5169
|
+
slug: string().optional(),
|
|
5170
|
+
/**
|
|
5171
|
+
* Durable call-site ids nested inside an off-grammar `code-block` (same-file only).
|
|
5172
|
+
* Used by the run overlay to light the block when any contained step executes.
|
|
5173
|
+
*/
|
|
5174
|
+
containedCallSiteIds: array(string()).optional(),
|
|
5175
|
+
/**
|
|
5176
|
+
* Per-input call-site value bindings for `step` nodes, keyed by input field name.
|
|
5177
|
+
* Deterministically captured from the call's argument object; reference tokens point
|
|
5178
|
+
* at the upstream node that produced the value. The platform join fills display labels.
|
|
5179
|
+
*/
|
|
5180
|
+
inputBindings: record(string(), WorkflowCanvasRawBindingSchema).optional(),
|
|
5181
|
+
/**
|
|
5182
|
+
* Static `promptLlm(prompt, options)` configuration captured at the call site for
|
|
5183
|
+
* `llm` step nodes. Only literal values are captured (model/maxTokens/temperature/
|
|
5184
|
+
* thinkingLevel); `system`/`outputSchema` are usually expressions, so only their
|
|
5185
|
+
* presence is recorded. Absent when no options are statically resolvable.
|
|
5186
|
+
*/
|
|
5187
|
+
llmOptions: WorkflowCanvasLlmOptionsSchema.optional()
|
|
5188
|
+
});
|
|
5189
|
+
/**
|
|
5190
|
+
* A single structural node. This is the deploy artifact's shape: identity
|
|
5191
|
+
* (`id`), the canonical discriminator (`nodeType`), display `data`, and group
|
|
5192
|
+
* nesting (`parentId`). All layout/rendering — React Flow component key,
|
|
5193
|
+
* positions, sizes, `extent`, group box dimensions — is derived entirely
|
|
5194
|
+
* client-side from this structure, so it never leaks into the wire contract.
|
|
5195
|
+
*/
|
|
5196
|
+
const WorkflowCanvasGraphNodeSchema = object({
|
|
5197
|
+
id: string(),
|
|
5198
|
+
nodeType: WorkflowCanvasNodeTypeSchema,
|
|
5199
|
+
data: WorkflowCanvasNodeDataSchema,
|
|
5200
|
+
/** Set on children nested inside a group (loop / parallel) container. */
|
|
5201
|
+
parentId: string().optional()
|
|
5202
|
+
});
|
|
5203
|
+
const WorkflowCanvasEdgeSchema = object({
|
|
5204
|
+
id: string(),
|
|
5205
|
+
source: string(),
|
|
5206
|
+
target: string(),
|
|
5207
|
+
type: string().optional(),
|
|
5208
|
+
label: string().optional(),
|
|
5209
|
+
sourceHandle: string().optional(),
|
|
5210
|
+
targetHandle: string().optional(),
|
|
5211
|
+
data: object({ branchKind: _enum([
|
|
5212
|
+
"then",
|
|
5213
|
+
"else",
|
|
5214
|
+
"parallel-branch",
|
|
5215
|
+
"error"
|
|
5216
|
+
]).optional() }).optional()
|
|
5217
|
+
});
|
|
5218
|
+
/** A statically-evaluable top-level `const` value (literal scalars only). */
|
|
5219
|
+
const WorkflowCanvasConstantValueSchema = union([
|
|
5220
|
+
string(),
|
|
5221
|
+
number$1(),
|
|
5222
|
+
boolean()
|
|
5223
|
+
]);
|
|
5224
|
+
/**
|
|
5225
|
+
* Top-level `const NAME = <literal>` declarations in the workflow source, captured
|
|
5226
|
+
* at deploy. Lets the platform resolve `variable` value tokens (e.g. a `model` set
|
|
5227
|
+
* to a named const) to their concrete value for display. Scalars only — computed,
|
|
5228
|
+
* function-local, or non-literal consts are intentionally omitted.
|
|
5229
|
+
*/
|
|
5230
|
+
const WorkflowCanvasConstantsSchema = record(string(), WorkflowCanvasConstantValueSchema);
|
|
5231
|
+
const WorkflowCanvasGraphSchema = object({
|
|
5232
|
+
nodes: array(WorkflowCanvasGraphNodeSchema),
|
|
5233
|
+
edges: array(WorkflowCanvasEdgeSchema),
|
|
5234
|
+
/** Top-level literal constants from the workflow source (for value-token resolution). */
|
|
5235
|
+
constants: WorkflowCanvasConstantsSchema.optional()
|
|
5236
|
+
});
|
|
5237
|
+
/**
|
|
5238
|
+
* Deploy-time summary of one credential a step requires, derived from the
|
|
5239
|
+
* action/agent-tool definition's `.credentials`. The workflow-canvas credential
|
|
5240
|
+
* overlay joins a step node's `slug` to these to resolve the bound instance.
|
|
5241
|
+
* `key` doubles as the app slug (matches `credential_instances.app_slug`).
|
|
5242
|
+
*/
|
|
5243
|
+
const CredentialRequirementSummarySchema = object({
|
|
5244
|
+
key: string(),
|
|
5245
|
+
kind: CredentialAuthKindSchema,
|
|
5246
|
+
/** Scope pinned via `.scope(...)`; absent means project-default → org-default. */
|
|
5247
|
+
scope: CredentialScopeTypeSchema.optional()
|
|
5248
|
+
});
|
|
4982
5249
|
const StoredRouteManifestSkillSchema = object({
|
|
4983
5250
|
slug: string(),
|
|
4984
|
-
name:
|
|
4985
|
-
description:
|
|
5251
|
+
name: requiredDisplayTextSchema,
|
|
5252
|
+
description: requiredDisplayTextSchema,
|
|
4986
5253
|
moduleFile: string()
|
|
4987
5254
|
});
|
|
4988
5255
|
const attachmentSchemasSchema = record(string(), object({
|
|
@@ -4990,8 +5257,8 @@ const attachmentSchemasSchema = record(string(), object({
|
|
|
4990
5257
|
filterSchema: record(string(), unknown()).optional()
|
|
4991
5258
|
}));
|
|
4992
5259
|
const attachmentMetaSchema = record(string(), object({
|
|
4993
|
-
name:
|
|
4994
|
-
description:
|
|
5260
|
+
name: requiredDisplayTextSchema,
|
|
5261
|
+
description: requiredDisplayTextSchema
|
|
4995
5262
|
}));
|
|
4996
5263
|
const storedRouteManifestEntryV2Schema = discriminatedUnion("kind", [
|
|
4997
5264
|
object({ kind: literal("health") }),
|
|
@@ -4999,23 +5266,43 @@ const storedRouteManifestEntryV2Schema = discriminatedUnion("kind", [
|
|
|
4999
5266
|
kind: literal("agent"),
|
|
5000
5267
|
slug: string(),
|
|
5001
5268
|
moduleFile: string(),
|
|
5002
|
-
name:
|
|
5003
|
-
description:
|
|
5269
|
+
name: requiredDisplayTextSchema,
|
|
5270
|
+
description: requiredDisplayTextSchema,
|
|
5004
5271
|
model: string(),
|
|
5005
5272
|
systemPrompt: string(),
|
|
5006
5273
|
toolCount: number$1().int().nonnegative(),
|
|
5007
5274
|
credentialCount: number$1().int().nonnegative(),
|
|
5008
5275
|
appSlugs: array(string()).default([]),
|
|
5009
|
-
toolSlugs: array(string()).default([])
|
|
5276
|
+
toolSlugs: array(string()).default([]),
|
|
5277
|
+
/** Credential requirements per tool slug (the agent's credential consumer key). */
|
|
5278
|
+
toolRequirements: record(string(), array(CredentialRequirementSummarySchema)).optional()
|
|
5279
|
+
}),
|
|
5280
|
+
object({
|
|
5281
|
+
kind: literal("action"),
|
|
5282
|
+
slug: string(),
|
|
5283
|
+
name: requiredDisplayTextSchema,
|
|
5284
|
+
description: requiredDisplayTextSchema,
|
|
5285
|
+
moduleFile: string(),
|
|
5286
|
+
/** App slug for actions imported from an integration package (`@keystrokehq/<app>/actions`). */
|
|
5287
|
+
appSlug: string().optional(),
|
|
5288
|
+
inputSchema: record(string(), unknown()),
|
|
5289
|
+
outputSchema: record(string(), unknown()),
|
|
5290
|
+
/** Credentials this action requires (for the canvas credential overlay). */
|
|
5291
|
+
requirements: array(CredentialRequirementSummarySchema).optional()
|
|
5010
5292
|
}),
|
|
5011
5293
|
object({
|
|
5012
5294
|
kind: literal("workflow"),
|
|
5013
5295
|
slug: string(),
|
|
5014
|
-
name:
|
|
5015
|
-
description:
|
|
5296
|
+
name: requiredDisplayTextSchema,
|
|
5297
|
+
description: requiredDisplayTextSchema,
|
|
5016
5298
|
subscribable: boolean(),
|
|
5017
5299
|
moduleFile: string(),
|
|
5018
|
-
requestSchema: record(string(), unknown())
|
|
5300
|
+
requestSchema: record(string(), unknown()),
|
|
5301
|
+
responseSchema: record(string(), unknown()).optional(),
|
|
5302
|
+
/** Deterministic AST control-flow skeleton (deploy-time producer). */
|
|
5303
|
+
flowGraph: WorkflowCanvasGraphSchema.optional(),
|
|
5304
|
+
/** sha256 of the workflow source the `flowGraph` was produced from (staleness). */
|
|
5305
|
+
flowGraphSourceHash: string().optional()
|
|
5019
5306
|
}),
|
|
5020
5307
|
object({
|
|
5021
5308
|
kind: literal("trigger-webhook"),
|
|
@@ -5034,8 +5321,8 @@ const storedRouteManifestEntryV2Schema = discriminatedUnion("kind", [
|
|
|
5034
5321
|
moduleFile: string(),
|
|
5035
5322
|
sourceHash: string().optional(),
|
|
5036
5323
|
schedule: string(),
|
|
5037
|
-
name:
|
|
5038
|
-
description:
|
|
5324
|
+
name: requiredDisplayTextSchema,
|
|
5325
|
+
description: requiredDisplayTextSchema
|
|
5039
5326
|
}),
|
|
5040
5327
|
object({
|
|
5041
5328
|
kind: literal("trigger-poll-group"),
|
|
@@ -5051,8 +5338,8 @@ const storedRouteManifestEntryV2Schema = discriminatedUnion("kind", [
|
|
|
5051
5338
|
moduleFile: string(),
|
|
5052
5339
|
sourceHash: string().optional(),
|
|
5053
5340
|
schedule: string(),
|
|
5054
|
-
name:
|
|
5055
|
-
description:
|
|
5341
|
+
name: requiredDisplayTextSchema,
|
|
5342
|
+
description: requiredDisplayTextSchema
|
|
5056
5343
|
})
|
|
5057
5344
|
]);
|
|
5058
5345
|
object({
|
|
@@ -5478,24 +5765,6 @@ object({
|
|
|
5478
5765
|
outputParameters: record(string(), unknown()).optional(),
|
|
5479
5766
|
version: string().optional()
|
|
5480
5767
|
});
|
|
5481
|
-
/** How a credential instance is stored (`credential_instances.auth_kind`). */
|
|
5482
|
-
const CredentialAuthKindSchema = _enum([
|
|
5483
|
-
"api_key",
|
|
5484
|
-
"oauth_managed",
|
|
5485
|
-
"keystroke"
|
|
5486
|
-
]);
|
|
5487
|
-
/**
|
|
5488
|
-
* Where a credential instance is stored (`credential_instances.scope_type`), and the only thing an
|
|
5489
|
-
* action/tool can pin via `.scope(...)`. There is no resolution chain: when no scope is pinned, the
|
|
5490
|
-
* resolver tries the project default, then the org default, then throws.
|
|
5491
|
-
*/
|
|
5492
|
-
const CredentialScopeTypeSchema = _enum([
|
|
5493
|
-
"organization",
|
|
5494
|
-
"project",
|
|
5495
|
-
"user"
|
|
5496
|
-
]);
|
|
5497
|
-
CredentialAuthKindSchema.options;
|
|
5498
|
-
CredentialScopeTypeSchema.options;
|
|
5499
5768
|
/** Scope of a platform app credential (maps to `credential_instances.scope_type`). */
|
|
5500
5769
|
const AppCredentialScopeSchema = _enum([
|
|
5501
5770
|
"user",
|
|
@@ -6491,7 +6760,7 @@ object({
|
|
|
6491
6760
|
id: string(),
|
|
6492
6761
|
slug: string(),
|
|
6493
6762
|
name: string(),
|
|
6494
|
-
description: string().
|
|
6763
|
+
description: string().min(1),
|
|
6495
6764
|
type: TriggerTypeSchema,
|
|
6496
6765
|
status: TriggerStatusSchema,
|
|
6497
6766
|
projectId: string(),
|
|
@@ -6787,7 +7056,7 @@ const AgentSummarySchema = object({
|
|
|
6787
7056
|
name: string().min(1),
|
|
6788
7057
|
projectId: string().min(1),
|
|
6789
7058
|
updatedAt: string().min(1),
|
|
6790
|
-
description: string().
|
|
7059
|
+
description: string().min(1),
|
|
6791
7060
|
sourcePath: string().min(1).optional(),
|
|
6792
7061
|
model: string().optional(),
|
|
6793
7062
|
capabilities: object({
|
|
@@ -6809,7 +7078,7 @@ const WorkflowSummarySchema = object({
|
|
|
6809
7078
|
name: string().min(1),
|
|
6810
7079
|
projectId: string().min(1),
|
|
6811
7080
|
updatedAt: string().min(1),
|
|
6812
|
-
description: string().
|
|
7081
|
+
description: string().min(1),
|
|
6813
7082
|
sourcePath: string().min(1).optional(),
|
|
6814
7083
|
lastRunAt: optionalTimestamp
|
|
6815
7084
|
});
|
|
@@ -6819,7 +7088,7 @@ const SkillSummarySchema = object({
|
|
|
6819
7088
|
name: string().min(1),
|
|
6820
7089
|
projectId: string().min(1),
|
|
6821
7090
|
updatedAt: string().min(1),
|
|
6822
|
-
description: string().
|
|
7091
|
+
description: string().min(1),
|
|
6823
7092
|
sourcePath: string().min(1).optional()
|
|
6824
7093
|
});
|
|
6825
7094
|
AgentSummarySchema.nullable();
|
|
@@ -6928,6 +7197,245 @@ object({ files: array(object({
|
|
|
6928
7197
|
id: string(),
|
|
6929
7198
|
path: string().min(1)
|
|
6930
7199
|
})) });
|
|
7200
|
+
/** Whether the overview is still being produced or finished. */
|
|
7201
|
+
const WorkflowOverviewStatusSchema = _enum(["generating", "ready"]);
|
|
7202
|
+
/** One phase of the guided-tour overview. */
|
|
7203
|
+
const WorkflowPhaseSchema = object({
|
|
7204
|
+
id: string(),
|
|
7205
|
+
title: string(),
|
|
7206
|
+
copy: string(),
|
|
7207
|
+
nodeIds: array(string())
|
|
7208
|
+
});
|
|
7209
|
+
object({
|
|
7210
|
+
status: WorkflowOverviewStatusSchema,
|
|
7211
|
+
summary: string(),
|
|
7212
|
+
phases: array(WorkflowPhaseSchema),
|
|
7213
|
+
hash: string(),
|
|
7214
|
+
generatedAt: string().nullable(),
|
|
7215
|
+
model: string()
|
|
7216
|
+
});
|
|
7217
|
+
/** Subset of JSON-Schema field types the dashboard form renders inline. */
|
|
7218
|
+
const WorkflowInputFieldTypeSchema = _enum([
|
|
7219
|
+
"string",
|
|
7220
|
+
"number",
|
|
7221
|
+
"boolean",
|
|
7222
|
+
"enum",
|
|
7223
|
+
"object",
|
|
7224
|
+
"array"
|
|
7225
|
+
]);
|
|
7226
|
+
const WorkflowInputFieldSchema = lazy(() => object({
|
|
7227
|
+
key: string(),
|
|
7228
|
+
label: string(),
|
|
7229
|
+
type: WorkflowInputFieldTypeSchema,
|
|
7230
|
+
required: boolean(),
|
|
7231
|
+
description: string().optional(),
|
|
7232
|
+
placeholder: string().optional(),
|
|
7233
|
+
options: array(string()).optional(),
|
|
7234
|
+
default: union([
|
|
7235
|
+
string(),
|
|
7236
|
+
number$1(),
|
|
7237
|
+
boolean()
|
|
7238
|
+
]).optional(),
|
|
7239
|
+
children: array(WorkflowInputFieldSchema).optional(),
|
|
7240
|
+
format: string().optional()
|
|
7241
|
+
}));
|
|
7242
|
+
object({
|
|
7243
|
+
schema: object({ fields: array(WorkflowInputFieldSchema) }),
|
|
7244
|
+
values: record(string(), unknown()).nullable()
|
|
7245
|
+
});
|
|
7246
|
+
object({ runId: string() });
|
|
7247
|
+
/** Annotation lifecycle: "generating" while the LLM pass streams in, then "ready". */
|
|
7248
|
+
const WorkflowCanvasStatusSchema = _enum(["generating", "ready"]);
|
|
7249
|
+
/** LLM-produced enrichment for a single skeleton node. */
|
|
7250
|
+
const WorkflowCanvasAnnotationSchema = object({
|
|
7251
|
+
label: string().optional(),
|
|
7252
|
+
description: string().optional()
|
|
7253
|
+
});
|
|
7254
|
+
/** The configured value of one input at this call site. */
|
|
7255
|
+
const WorkflowNodeInputBindingSchema = object({
|
|
7256
|
+
tokens: array(discriminatedUnion("kind", [
|
|
7257
|
+
object({
|
|
7258
|
+
kind: literal("text"),
|
|
7259
|
+
text: string()
|
|
7260
|
+
}),
|
|
7261
|
+
object({
|
|
7262
|
+
kind: literal("reference"),
|
|
7263
|
+
sourceNodeId: string().optional(),
|
|
7264
|
+
sourceLabel: string(),
|
|
7265
|
+
field: string().optional()
|
|
7266
|
+
}),
|
|
7267
|
+
object({
|
|
7268
|
+
kind: literal("variable"),
|
|
7269
|
+
text: string(),
|
|
7270
|
+
/** Concrete value when `text` resolves to a top-level literal constant. */
|
|
7271
|
+
resolvedValue: string().optional()
|
|
7272
|
+
}),
|
|
7273
|
+
object({
|
|
7274
|
+
kind: literal("call"),
|
|
7275
|
+
name: string()
|
|
7276
|
+
})
|
|
7277
|
+
])),
|
|
7278
|
+
multiline: boolean().optional()
|
|
7279
|
+
});
|
|
7280
|
+
/** An inspector input with optional call-site binding. */
|
|
7281
|
+
const WorkflowCanvasNodeInputSchema = WorkflowInputFieldSchema.and(object({
|
|
7282
|
+
binding: WorkflowNodeInputBindingSchema.optional(),
|
|
7283
|
+
additional: boolean().optional()
|
|
7284
|
+
}));
|
|
7285
|
+
/** Authored, deterministic metadata for a single node. */
|
|
7286
|
+
const WorkflowCanvasNodeMetaSchema = object({
|
|
7287
|
+
kind: _enum([
|
|
7288
|
+
"action",
|
|
7289
|
+
"agent",
|
|
7290
|
+
"workflow",
|
|
7291
|
+
"llm",
|
|
7292
|
+
"trigger",
|
|
7293
|
+
"boundary"
|
|
7294
|
+
]),
|
|
7295
|
+
slug: string(),
|
|
7296
|
+
name: string(),
|
|
7297
|
+
description: string().optional(),
|
|
7298
|
+
appSlug: string().optional(),
|
|
7299
|
+
inputs: array(WorkflowCanvasNodeInputSchema),
|
|
7300
|
+
outputs: array(WorkflowInputFieldSchema),
|
|
7301
|
+
requiredApps: array(string()).optional(),
|
|
7302
|
+
model: string().optional(),
|
|
7303
|
+
toolCount: number$1().int().nonnegative().optional()
|
|
7304
|
+
});
|
|
7305
|
+
object({
|
|
7306
|
+
graph: WorkflowCanvasGraphSchema,
|
|
7307
|
+
nodeMetadata: record(string(), WorkflowCanvasNodeMetaSchema),
|
|
7308
|
+
annotations: record(string(), WorkflowCanvasAnnotationSchema),
|
|
7309
|
+
status: WorkflowCanvasStatusSchema,
|
|
7310
|
+
hash: string(),
|
|
7311
|
+
generatedAt: string().nullable(),
|
|
7312
|
+
model: string()
|
|
7313
|
+
});
|
|
7314
|
+
const WorkflowCanvasNodeRunStateSchema = object({
|
|
7315
|
+
status: _enum([
|
|
7316
|
+
"pending",
|
|
7317
|
+
"running",
|
|
7318
|
+
"succeeded",
|
|
7319
|
+
"failed",
|
|
7320
|
+
"skipped"
|
|
7321
|
+
]),
|
|
7322
|
+
iteration: object({
|
|
7323
|
+
index: number$1().int().nonnegative(),
|
|
7324
|
+
total: number$1().int().nonnegative()
|
|
7325
|
+
}).optional()
|
|
7326
|
+
});
|
|
7327
|
+
/** Overall lifecycle of a run as the canvas animates it. */
|
|
7328
|
+
const WorkflowCanvasRunStatusSchema = _enum([
|
|
7329
|
+
"running",
|
|
7330
|
+
"succeeded",
|
|
7331
|
+
"failed",
|
|
7332
|
+
"canceled"
|
|
7333
|
+
]);
|
|
7334
|
+
object({
|
|
7335
|
+
runId: string(),
|
|
7336
|
+
status: WorkflowCanvasRunStatusSchema,
|
|
7337
|
+
startedAt: string(),
|
|
7338
|
+
finishedAt: string().nullable(),
|
|
7339
|
+
nodeStates: record(string(), WorkflowCanvasNodeRunStateSchema)
|
|
7340
|
+
});
|
|
7341
|
+
/** Scope a credential instance lives in. */
|
|
7342
|
+
const WorkflowCredentialScopeSchema = _enum([
|
|
7343
|
+
"organization",
|
|
7344
|
+
"project",
|
|
7345
|
+
"user"
|
|
7346
|
+
]);
|
|
7347
|
+
/** The concrete credential instance a binding currently resolves to. */
|
|
7348
|
+
const WorkflowResolvedCredentialSchema = object({
|
|
7349
|
+
id: string(),
|
|
7350
|
+
name: string(),
|
|
7351
|
+
scope: WorkflowCredentialScopeSchema,
|
|
7352
|
+
appSlug: string().optional(),
|
|
7353
|
+
isDefault: boolean().optional(),
|
|
7354
|
+
projectId: string().optional(),
|
|
7355
|
+
projectName: string().optional()
|
|
7356
|
+
});
|
|
7357
|
+
record(string(), WorkflowCanvasAnnotationSchema);
|
|
7358
|
+
/** One opaque code-block the annotation pass should label, keyed by its canvas node id. */
|
|
7359
|
+
const WorkflowCanvasAnnotationCodeBlockSchema = object({
|
|
7360
|
+
nodeId: string(),
|
|
7361
|
+
/** The raw source snippet (the node's label) the LLM turns into human copy. */
|
|
7362
|
+
source: string()
|
|
7363
|
+
});
|
|
7364
|
+
/** Inputs the worker feeds the LLM for the gated code-block annotation pass. */
|
|
7365
|
+
const WorkflowCanvasAnnotationsInputSchema = object({
|
|
7366
|
+
workflowName: string(),
|
|
7367
|
+
workflowDescription: string().nullable(),
|
|
7368
|
+
codeBlocks: array(WorkflowCanvasAnnotationCodeBlockSchema)
|
|
7369
|
+
});
|
|
7370
|
+
object({
|
|
7371
|
+
workflowId: string(),
|
|
7372
|
+
projectId: string(),
|
|
7373
|
+
hash: string(),
|
|
7374
|
+
model: string(),
|
|
7375
|
+
input: WorkflowCanvasAnnotationsInputSchema
|
|
7376
|
+
});
|
|
7377
|
+
/** One node as the overview LLM sees it (derived from the canvas node metadata + graph). */
|
|
7378
|
+
const WorkflowOverviewNodeSchema = object({
|
|
7379
|
+
nodeId: string(),
|
|
7380
|
+
label: string(),
|
|
7381
|
+
kind: string(),
|
|
7382
|
+
description: string().optional(),
|
|
7383
|
+
/** App/integration slug for steps imported from a `@keystrokehq/<app>` package. */
|
|
7384
|
+
appSlug: string().optional(),
|
|
7385
|
+
/** Authored input field keys (from the action/agent/workflow definition). */
|
|
7386
|
+
inputs: array(string()).optional(),
|
|
7387
|
+
/** Authored output field keys. */
|
|
7388
|
+
outputs: array(string()).optional(),
|
|
7389
|
+
/** Agent-only: the model the agent runs on. */
|
|
7390
|
+
model: string().optional(),
|
|
7391
|
+
/** Agent-only: number of tools available to the agent. */
|
|
7392
|
+
toolCount: number$1().int().nonnegative().optional()
|
|
7393
|
+
});
|
|
7394
|
+
/** Inputs the worker feeds the LLM to produce the workflow overview (summary + phases). */
|
|
7395
|
+
const WorkflowOverviewInputSchema = object({
|
|
7396
|
+
workflowName: string(),
|
|
7397
|
+
workflowDescription: string().nullable(),
|
|
7398
|
+
/** Display labels of the trigger sources upstream of the workflow (read-only context). */
|
|
7399
|
+
triggers: array(string()),
|
|
7400
|
+
nodes: array(WorkflowOverviewNodeSchema),
|
|
7401
|
+
/** The workflow's TypeScript source (best-effort; null when the deploy has no source snapshot). */
|
|
7402
|
+
source: string().nullable()
|
|
7403
|
+
});
|
|
7404
|
+
object({
|
|
7405
|
+
workflowId: string(),
|
|
7406
|
+
projectId: string(),
|
|
7407
|
+
hash: string(),
|
|
7408
|
+
model: string(),
|
|
7409
|
+
input: WorkflowOverviewInputSchema
|
|
7410
|
+
});
|
|
7411
|
+
const WorkflowCanvasCredentialBindingBaseSchema = object({
|
|
7412
|
+
credentialKey: string(),
|
|
7413
|
+
label: string(),
|
|
7414
|
+
appSlug: string().optional()
|
|
7415
|
+
});
|
|
7416
|
+
/** How one credential requirement on a step currently resolves. */
|
|
7417
|
+
const WorkflowCanvasCredentialBindingSchema = union([
|
|
7418
|
+
WorkflowCanvasCredentialBindingBaseSchema.extend({
|
|
7419
|
+
policy: _enum([
|
|
7420
|
+
"project-default",
|
|
7421
|
+
"org-default",
|
|
7422
|
+
"assigned"
|
|
7423
|
+
]),
|
|
7424
|
+
instance: WorkflowResolvedCredentialSchema
|
|
7425
|
+
}),
|
|
7426
|
+
WorkflowCanvasCredentialBindingBaseSchema.extend({
|
|
7427
|
+
policy: literal("scope-pinned"),
|
|
7428
|
+
pinnedScope: WorkflowCredentialScopeSchema,
|
|
7429
|
+
instance: WorkflowResolvedCredentialSchema
|
|
7430
|
+
}),
|
|
7431
|
+
WorkflowCanvasCredentialBindingBaseSchema.extend({
|
|
7432
|
+
policy: literal("unresolved"),
|
|
7433
|
+
reason: _enum(["needs-selection", "missing"]),
|
|
7434
|
+
pinnedScope: WorkflowCredentialScopeSchema.optional()
|
|
7435
|
+
})
|
|
7436
|
+
]);
|
|
7437
|
+
record(string(), array(WorkflowCanvasCredentialBindingSchema));
|
|
7438
|
+
record(string(), unknown());
|
|
6931
7439
|
//#endregion
|
|
6932
7440
|
//#region src/runtime.ts
|
|
6933
7441
|
/** Builds base64 `KEYSTROKE_ORG_ARTIFACTS` payload for org worker containers. */
|