@oomol-lab/open-flow 0.1.0-beta.62 → 0.1.0-beta.63
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/browser/{createResourceDialog-DZgJsr3e.js → createResourceDialog-BAJXbzNH.js} +20 -7
- package/dist/browser/flow-authoring.js +8 -7
- package/dist/browser/flow-change-schema.d.ts +1 -0
- package/dist/browser/flow-change.d.ts +1 -0
- package/dist/browser/flow-change.js +8 -7
- package/dist/browser/{flowChanges-CzYIVevI.js → flowChanges-DpZOQuJE.js} +784 -443
- package/dist/browser/{flowRunInputEditorStore-Dsxyfwae.js → flowRunInputEditorStore-B2Rw4VsT.js} +1 -1
- package/dist/browser/{flowWorkspace-BgZaFKZm.js → flowWorkspace-B7a5NNA_.js} +41 -29
- package/dist/browser/{icons-CajfDpy_.js → icons-Db2Jb2iX.js} +30 -10
- package/dist/browser/preview.css +5 -6
- package/dist/browser/preview.js +437 -402
- package/dist/browser/{typeScriptSession-fXPMFGjW.js → typeScriptSession-D0bjYDeg.js} +1 -1
- package/dist/browser/ui.css +4 -5
- package/dist/browser/ui.js +2 -2
- package/dist/browser/{value-DL_poNiC.js → value-BADHeZ9I.js} +12 -1
- package/dist/browser/workbench-contract.d.ts +10 -0
- package/dist/browser/workbench.css +5 -6
- package/dist/browser/workbench.d.ts +5 -3
- package/dist/browser/workbench.js +198 -171
- package/dist/browser/{workbenchSelect-H9wzEFkH.js → workbenchSelect-C-jf6NIM.js} +1 -1
- package/dist/command/index.js +40 -39
- package/dist/common/authoringSchema.d.ts +1 -0
- package/dist/common/connector-action.d.ts +1 -0
- package/dist/common/connector-action.js +15 -12
- package/dist/common/control-api-conformance.js +107 -8
- package/dist/common/control-api.d.ts +8 -0
- package/dist/common/control-api.js +47 -8
- package/dist/common/control-requests.d.ts +6 -0
- package/dist/common/control-requests.js +41 -18
- package/dist/common/decision.js +8 -7
- package/dist/common/flow-connectionUsage.d.ts +1 -0
- package/dist/common/flow-encoding.d.ts +1 -0
- package/dist/common/flow-encoding.js +202 -10
- package/dist/common/flow-semantics.js +64 -46
- package/dist/common/flow-workflowFile.d.ts +23 -0
- package/dist/common/integration-trigger.js +8 -7
- package/dist/common/localization.d.ts +1 -0
- package/dist/common/localization.js +12 -1
- package/dist/common/mcp.d.ts +61 -0
- package/dist/common/mcp.js +92 -9
- package/dist/common/openapi.js +8 -7
- package/dist/common/poll-trigger.js +8 -7
- package/dist/common/runtime-contract.js +1 -1
- package/dist/common/scheduler.d.ts +22 -2
- package/dist/common/scheduler.js +354 -83
- package/dist/common/trigger-config.d.ts +2 -0
- package/dist/common/webhook-trigger.js +8 -7
- package/dist/index.d.ts +2 -2
- package/package.json +1 -1
- package/skills/open-flow/SKILL.md +1 -1
- package/skills/open-flow/references/flow-authoring.md +20 -0
|
@@ -209,6 +209,7 @@ export declare const authoringConfigurations: {
|
|
|
209
209
|
notification: z.ZodOptional<z.ZodObject<{
|
|
210
210
|
action: z.ZodString;
|
|
211
211
|
connectionId: z.ZodOptional<z.ZodString>;
|
|
212
|
+
outputMode: z.ZodOptional<z.ZodLiteral<"value">>;
|
|
212
213
|
messageHandle: z.ZodString;
|
|
213
214
|
inputs: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodObject<{
|
|
214
215
|
kind: z.ZodLiteral<"value">;
|
|
@@ -24,3 +24,4 @@ export interface ConnectorRuntimeInputPort {
|
|
|
24
24
|
}
|
|
25
25
|
export declare function connectorActionPorts(inputSchema: unknown, outputSchema: unknown): ConnectorActionPorts;
|
|
26
26
|
export declare function normalizeConnectorRuntimeInputs<Value>(ports: readonly ConnectorRuntimeInputPort[], inputs: Readonly<Record<string, Value>>): Readonly<Record<string, Value>>;
|
|
27
|
+
export declare function connectorOutputMode(schema: unknown): 'fields' | 'value';
|
|
@@ -43,24 +43,27 @@ function inputPorts(schema) {
|
|
|
43
43
|
};
|
|
44
44
|
});
|
|
45
45
|
}
|
|
46
|
-
function
|
|
46
|
+
function connectorOutputMode(schema) {
|
|
47
47
|
const root = toPlainObject(schema);
|
|
48
48
|
const properties = toPlainObject(root?.properties);
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
handle,
|
|
55
|
-
json_schema: propertySchemaWithDefinitions(root, propertySchema),
|
|
56
|
-
nullable: !required.has(handle) || schemaAllowsNull(propertySchema, root)
|
|
57
|
-
}));
|
|
58
|
-
} else return [{
|
|
49
|
+
return properties != null && Object.keys(properties).length > 0 || root?.type == "object" && root.additionalProperties === false ? "fields" : "value";
|
|
50
|
+
}
|
|
51
|
+
function outputPorts(schema) {
|
|
52
|
+
const root = toPlainObject(schema);
|
|
53
|
+
if (connectorOutputMode(schema) == "value") return [{
|
|
59
54
|
description: schemaDescription(root, schema),
|
|
60
55
|
handle: "output",
|
|
61
56
|
json_schema: schema,
|
|
62
57
|
nullable: schemaAllowsNull(schema)
|
|
63
58
|
}];
|
|
59
|
+
const properties = toPlainObject(root?.properties) ?? {};
|
|
60
|
+
const required = stringSet(root?.required);
|
|
61
|
+
return Object.entries(properties).map(([handle, propertySchema]) => ({
|
|
62
|
+
description: schemaDescription(root, propertySchema),
|
|
63
|
+
handle,
|
|
64
|
+
json_schema: propertySchemaWithDefinitions(root, propertySchema),
|
|
65
|
+
nullable: !required.has(handle) || schemaAllowsNull(propertySchema, root)
|
|
66
|
+
}));
|
|
64
67
|
}
|
|
65
68
|
function propertySchemaWithDefinitions(root, schema) {
|
|
66
69
|
const property = toPlainObject(schema);
|
|
@@ -124,4 +127,4 @@ function resolveLocalReference(root, reference) {
|
|
|
124
127
|
return current;
|
|
125
128
|
}
|
|
126
129
|
//#endregion
|
|
127
|
-
export { connectorActionPorts, normalizeConnectorRuntimeInputs };
|
|
130
|
+
export { connectorActionPorts, connectorOutputMode, normalizeConnectorRuntimeInputs };
|
|
@@ -6684,10 +6684,10 @@ function compileEnumAndConst(context, enumList, constValue, schema) {
|
|
|
6684
6684
|
}
|
|
6685
6685
|
if (compiledEnum.length === 0) recordWarn(context, "all of elements from list is rejected by currently schema object", "enum");
|
|
6686
6686
|
}
|
|
6687
|
-
if (constValue && valid(schema, constValue) === ValidResult.Invalid) isNever = true;
|
|
6687
|
+
if (constValue !== void 0 && valid(schema, constValue) === ValidResult.Invalid) isNever = true;
|
|
6688
6688
|
if (compiledEnum) {
|
|
6689
6689
|
if (compiledEnum.length === 0) isNever = true;
|
|
6690
|
-
else if (constValue) {
|
|
6690
|
+
else if (constValue !== void 0) {
|
|
6691
6691
|
let foundEquals = false;
|
|
6692
6692
|
for (const enumValue of compiledEnum) if (isDeepEquals(enumValue, constValue)) {
|
|
6693
6693
|
foundEquals = true;
|
|
@@ -6700,7 +6700,7 @@ function compileEnumAndConst(context, enumList, constValue, schema) {
|
|
|
6700
6700
|
const compiledSchema = {};
|
|
6701
6701
|
if (schema.type) compiledSchema.type = schema.type;
|
|
6702
6702
|
if (compiledEnum) compiledSchema.enum = compiledEnum;
|
|
6703
|
-
if (constValue) compiledSchema.const = wrapCompiledValue(deepCopy(constValue));
|
|
6703
|
+
if (constValue !== void 0) compiledSchema.const = wrapCompiledValue(deepCopy(constValue));
|
|
6704
6704
|
return wrapCompiledSchema(kind, compiledSchema, context.delegate, context.path);
|
|
6705
6705
|
}
|
|
6706
6706
|
//#endregion
|
|
@@ -7095,7 +7095,7 @@ function compileSchema(context, schema) {
|
|
|
7095
7095
|
let targetSchema = schema;
|
|
7096
7096
|
let shouldHandleEnumAndConst = false;
|
|
7097
7097
|
const { enum: enumList, const: constValue } = schema;
|
|
7098
|
-
if (enumList || constValue) {
|
|
7098
|
+
if (enumList || constValue !== void 0) {
|
|
7099
7099
|
const { enum: _0, const: _1, ...rest } = schema;
|
|
7100
7100
|
targetSchema = rest;
|
|
7101
7101
|
shouldHandleEnumAndConst = true;
|
|
@@ -7685,7 +7685,7 @@ function schemaEqualsChecker(extendsContext) {
|
|
|
7685
7685
|
}
|
|
7686
7686
|
function isValueEquals(value1, value2) {
|
|
7687
7687
|
if (value1 === value2) return true;
|
|
7688
|
-
if (value1 === null) return false;
|
|
7688
|
+
if (value1 === null || value2 === null) return false;
|
|
7689
7689
|
if (typeof value1 !== "object") return false;
|
|
7690
7690
|
if (typeof value1 !== typeof value2) return false;
|
|
7691
7691
|
if (isCompiledSchema(value1) && isCompiledSchema(value2)) return isCompiledSchemaEquals(value1, value2);
|
|
@@ -8251,7 +8251,7 @@ function findMismatchPath(source, target) {
|
|
|
8251
8251
|
if ((sourceSchema.maxProperties ?? Number.POSITIVE_INFINITY) > (targetSchema.maxProperties ?? Number.POSITIVE_INFINITY)) return [...targetPath, "maxProperties"];
|
|
8252
8252
|
break;
|
|
8253
8253
|
}
|
|
8254
|
-
case CompiledKind.EnumOrConst: return [...targetPath, targetSchema.const
|
|
8254
|
+
case CompiledKind.EnumOrConst: return [...targetPath, targetSchema.const === void 0 ? "enum" : "const"];
|
|
8255
8255
|
}
|
|
8256
8256
|
return targetPath;
|
|
8257
8257
|
}
|
|
@@ -8716,7 +8716,8 @@ var managedFields = object({
|
|
|
8716
8716
|
object({
|
|
8717
8717
|
kind: literal("connector"),
|
|
8718
8718
|
action: text,
|
|
8719
|
-
connectionId: text.optional()
|
|
8719
|
+
connectionId: text.optional(),
|
|
8720
|
+
outputMode: literal("value").optional()
|
|
8720
8721
|
}),
|
|
8721
8722
|
object({
|
|
8722
8723
|
kind: literal("openapi"),
|
|
@@ -9314,7 +9315,7 @@ var authoringConfigurations = {
|
|
|
9314
9315
|
outputs: outputFields,
|
|
9315
9316
|
capabilities: authoringDefinitionSchemas.capabilities.optional()
|
|
9316
9317
|
}),
|
|
9317
|
-
connector: authoringDefinitionSchemas.connector.strict(),
|
|
9318
|
+
connector: authoringDefinitionSchemas.connector.omit({ outputMode: true }).strict(),
|
|
9318
9319
|
openapi: authoringOpenApiSchema,
|
|
9319
9320
|
agent: authoringDefinitionSchemas.agent.omit({
|
|
9320
9321
|
prompt: true,
|
|
@@ -10034,6 +10035,24 @@ function providerIconAppearance(metadata, position) {
|
|
|
10034
10035
|
}
|
|
10035
10036
|
};
|
|
10036
10037
|
}
|
|
10038
|
+
//#endregion
|
|
10039
|
+
//#region src/flow/common/workflowFile.ts
|
|
10040
|
+
var envelope = strictObject({
|
|
10041
|
+
kind: literal("open-flow-workflow"),
|
|
10042
|
+
version: literal(1),
|
|
10043
|
+
name: string$1().optional(),
|
|
10044
|
+
content: unknown(),
|
|
10045
|
+
presentation: record$3(string$1(), json$4()).optional()
|
|
10046
|
+
});
|
|
10047
|
+
/** Structural decoding only: incomplete drafts are supported, repair is never attempted. */
|
|
10048
|
+
function decodeWorkflowFile(value) {
|
|
10049
|
+
checkJsonDepth(value, -1);
|
|
10050
|
+
const file = envelope.parse(value);
|
|
10051
|
+
return {
|
|
10052
|
+
...file,
|
|
10053
|
+
content: decodeRevisionContent(file.content)
|
|
10054
|
+
};
|
|
10055
|
+
}
|
|
10037
10056
|
new TextEncoder();
|
|
10038
10057
|
//#endregion
|
|
10039
10058
|
//#region src/control/common/providerAccess.ts
|
|
@@ -11418,6 +11437,26 @@ var ControlClient = class {
|
|
|
11418
11437
|
exact(source, ["version"]);
|
|
11419
11438
|
if (source.version != 1) return invalidResponse();
|
|
11420
11439
|
}
|
|
11440
|
+
async exportFlow(flowId) {
|
|
11441
|
+
const value = await this.request(`/v1/flows/${segment(flowId)}/export`);
|
|
11442
|
+
try {
|
|
11443
|
+
return decodeWorkflowFile(value);
|
|
11444
|
+
} catch {
|
|
11445
|
+
return invalidResponse();
|
|
11446
|
+
}
|
|
11447
|
+
}
|
|
11448
|
+
async importFlow(file, options = {}) {
|
|
11449
|
+
return flow(await this.request("/v1/flows/import", {
|
|
11450
|
+
method: "POST",
|
|
11451
|
+
headers: { "Idempotency-Key": options.idempotencyKey ?? `flow-${randomId()}` },
|
|
11452
|
+
body: JSON.stringify({
|
|
11453
|
+
file,
|
|
11454
|
+
name: options.name,
|
|
11455
|
+
teamId: options.teamId,
|
|
11456
|
+
version: 1
|
|
11457
|
+
})
|
|
11458
|
+
}));
|
|
11459
|
+
}
|
|
11421
11460
|
async createFlow(name, idempotencyKey = `flow-${randomId()}`, teamId) {
|
|
11422
11461
|
return flow(await this.request("/v1/flows", {
|
|
11423
11462
|
body: JSON.stringify({
|
|
@@ -12107,6 +12146,66 @@ function liveRunRequest(harness, publicationId, key) {
|
|
|
12107
12146
|
});
|
|
12108
12147
|
}
|
|
12109
12148
|
var controlApiConformanceCases = [
|
|
12149
|
+
{
|
|
12150
|
+
name: "imports workflow files atomically and exports a new unpublished draft with its Presentation",
|
|
12151
|
+
async verify(harness) {
|
|
12152
|
+
const api = new ControlClient((url, init) => harness.request(new Request(new URL(url, harness.origin), init)));
|
|
12153
|
+
const file = {
|
|
12154
|
+
kind: "open-flow-workflow",
|
|
12155
|
+
version: 1,
|
|
12156
|
+
name: "Portable flow",
|
|
12157
|
+
content: {
|
|
12158
|
+
modelVersion: 6,
|
|
12159
|
+
modules: {},
|
|
12160
|
+
document: {
|
|
12161
|
+
bindings: {},
|
|
12162
|
+
graph: {
|
|
12163
|
+
nodes: { start: {
|
|
12164
|
+
kind: "manual",
|
|
12165
|
+
name: "Start"
|
|
12166
|
+
} },
|
|
12167
|
+
edges: []
|
|
12168
|
+
}
|
|
12169
|
+
}
|
|
12170
|
+
},
|
|
12171
|
+
presentation: { viewport: {
|
|
12172
|
+
x: 10,
|
|
12173
|
+
y: 20,
|
|
12174
|
+
zoom: 1
|
|
12175
|
+
} }
|
|
12176
|
+
};
|
|
12177
|
+
const idempotencyKey = crypto.randomUUID();
|
|
12178
|
+
const created = await api.importFlow(file, { idempotencyKey });
|
|
12179
|
+
equal(dequal(await api.importFlow(file, { idempotencyKey }), created), true, "Import retry must return the same Flow.");
|
|
12180
|
+
equal(dequal(await api.exportFlow(created.flowId), file), true, "Export must retain the graph and Presentation.");
|
|
12181
|
+
const editor = await api.getEditor(created.flowId);
|
|
12182
|
+
equal(editor.live.publication == null, true, "Import must not publish.");
|
|
12183
|
+
equal(editor.draft.parentRevisionId == null, true, "Import must create an initial Revision.");
|
|
12184
|
+
equal(dequal(editor.presentation.value, file.presentation), true, "Import must atomically save Presentation.");
|
|
12185
|
+
await error(await request(harness, "/v1/flows/import", {
|
|
12186
|
+
method: "POST",
|
|
12187
|
+
headers: { "idempotency-key": idempotencyKey },
|
|
12188
|
+
body: JSON.stringify({
|
|
12189
|
+
file,
|
|
12190
|
+
name: "Changed",
|
|
12191
|
+
version: 1
|
|
12192
|
+
})
|
|
12193
|
+
}), 409, "flow.conflict", "Reject changed import retry");
|
|
12194
|
+
const before = await api.listFlows();
|
|
12195
|
+
await error(await request(harness, "/v1/flows/import", {
|
|
12196
|
+
method: "POST",
|
|
12197
|
+
headers: { "idempotency-key": crypto.randomUUID() },
|
|
12198
|
+
body: JSON.stringify({
|
|
12199
|
+
file: {
|
|
12200
|
+
...file,
|
|
12201
|
+
version: 99
|
|
12202
|
+
},
|
|
12203
|
+
version: 1
|
|
12204
|
+
})
|
|
12205
|
+
}), 400, "flow.invalid", "Reject unsupported file");
|
|
12206
|
+
equal(dequal((await api.listFlows()).flows, before.flows), true, "Rejected import left an empty Flow.");
|
|
12207
|
+
}
|
|
12208
|
+
},
|
|
12110
12209
|
{
|
|
12111
12210
|
name: "authors nodes atomically with public views, fixed reads and replay before CAS",
|
|
12112
12211
|
async verify(harness) {
|
|
@@ -22,6 +22,8 @@ import type { ResultQuery } from './run-results.js';
|
|
|
22
22
|
import { decodeResultList, decodeResultRead } from './run-results.js';
|
|
23
23
|
export { readResult, parseResultQuery, decodeResultList, decodeResultRead, type ResultCall, type ResultInfo, type ResultPage, type ResultQuery, } from './run-results.js';
|
|
24
24
|
import type { RunStatus } from './run-lifecycle.js';
|
|
25
|
+
import type { WorkflowFile } from './flow-workflowFile.js';
|
|
26
|
+
export type { WorkflowFile, WorkflowCleanupSummary } from './flow-workflowFile.js';
|
|
25
27
|
import type { InputPortDefinition, JsonValue, PortDefinition, RevisionContent, TriggerKeySnapshot, WaitAction } from '../browser/flow-change.js';
|
|
26
28
|
import type { FlowResourceReferences } from './flow-semantics.js';
|
|
27
29
|
export type { JsonValue, TriggerKeySnapshot, WaitAction } from '../browser/flow-change.js';
|
|
@@ -782,6 +784,12 @@ export declare class ControlClient {
|
|
|
782
784
|
getVariable(name: string): Promise<Variable>;
|
|
783
785
|
putVariable(name: string, value: string): Promise<Variable>;
|
|
784
786
|
deleteVariable(name: string): Promise<void>;
|
|
787
|
+
exportFlow(flowId: string): Promise<WorkflowFile>;
|
|
788
|
+
importFlow(file: WorkflowFile, options?: {
|
|
789
|
+
readonly name?: string;
|
|
790
|
+
readonly teamId?: string;
|
|
791
|
+
readonly idempotencyKey?: string;
|
|
792
|
+
}): Promise<Flow>;
|
|
785
793
|
createFlow(name: string, idempotencyKey?: string, teamId?: string): Promise<Flow>;
|
|
786
794
|
getFlow(flowId: string): Promise<Flow>;
|
|
787
795
|
getErrorListeners(flowId: string, signal?: AbortSignal): Promise<readonly ErrorListener[]>;
|
|
@@ -6711,10 +6711,10 @@ function compileEnumAndConst(context, enumList, constValue, schema) {
|
|
|
6711
6711
|
}
|
|
6712
6712
|
if (compiledEnum.length === 0) recordWarn(context, "all of elements from list is rejected by currently schema object", "enum");
|
|
6713
6713
|
}
|
|
6714
|
-
if (constValue && valid(schema, constValue) === ValidResult.Invalid) isNever = true;
|
|
6714
|
+
if (constValue !== void 0 && valid(schema, constValue) === ValidResult.Invalid) isNever = true;
|
|
6715
6715
|
if (compiledEnum) {
|
|
6716
6716
|
if (compiledEnum.length === 0) isNever = true;
|
|
6717
|
-
else if (constValue) {
|
|
6717
|
+
else if (constValue !== void 0) {
|
|
6718
6718
|
let foundEquals = false;
|
|
6719
6719
|
for (const enumValue of compiledEnum) if (isDeepEquals(enumValue, constValue)) {
|
|
6720
6720
|
foundEquals = true;
|
|
@@ -6727,7 +6727,7 @@ function compileEnumAndConst(context, enumList, constValue, schema) {
|
|
|
6727
6727
|
const compiledSchema = {};
|
|
6728
6728
|
if (schema.type) compiledSchema.type = schema.type;
|
|
6729
6729
|
if (compiledEnum) compiledSchema.enum = compiledEnum;
|
|
6730
|
-
if (constValue) compiledSchema.const = wrapCompiledValue(deepCopy(constValue));
|
|
6730
|
+
if (constValue !== void 0) compiledSchema.const = wrapCompiledValue(deepCopy(constValue));
|
|
6731
6731
|
return wrapCompiledSchema(kind, compiledSchema, context.delegate, context.path);
|
|
6732
6732
|
}
|
|
6733
6733
|
//#endregion
|
|
@@ -7122,7 +7122,7 @@ function compileSchema(context, schema) {
|
|
|
7122
7122
|
let targetSchema = schema;
|
|
7123
7123
|
let shouldHandleEnumAndConst = false;
|
|
7124
7124
|
const { enum: enumList, const: constValue } = schema;
|
|
7125
|
-
if (enumList || constValue) {
|
|
7125
|
+
if (enumList || constValue !== void 0) {
|
|
7126
7126
|
const { enum: _0, const: _1, ...rest } = schema;
|
|
7127
7127
|
targetSchema = rest;
|
|
7128
7128
|
shouldHandleEnumAndConst = true;
|
|
@@ -7712,7 +7712,7 @@ function schemaEqualsChecker(extendsContext) {
|
|
|
7712
7712
|
}
|
|
7713
7713
|
function isValueEquals(value1, value2) {
|
|
7714
7714
|
if (value1 === value2) return true;
|
|
7715
|
-
if (value1 === null) return false;
|
|
7715
|
+
if (value1 === null || value2 === null) return false;
|
|
7716
7716
|
if (typeof value1 !== "object") return false;
|
|
7717
7717
|
if (typeof value1 !== typeof value2) return false;
|
|
7718
7718
|
if (isCompiledSchema(value1) && isCompiledSchema(value2)) return isCompiledSchemaEquals(value1, value2);
|
|
@@ -8278,7 +8278,7 @@ function findMismatchPath(source, target) {
|
|
|
8278
8278
|
if ((sourceSchema.maxProperties ?? Number.POSITIVE_INFINITY) > (targetSchema.maxProperties ?? Number.POSITIVE_INFINITY)) return [...targetPath, "maxProperties"];
|
|
8279
8279
|
break;
|
|
8280
8280
|
}
|
|
8281
|
-
case CompiledKind.EnumOrConst: return [...targetPath, targetSchema.const
|
|
8281
|
+
case CompiledKind.EnumOrConst: return [...targetPath, targetSchema.const === void 0 ? "enum" : "const"];
|
|
8282
8282
|
}
|
|
8283
8283
|
return targetPath;
|
|
8284
8284
|
}
|
|
@@ -8743,7 +8743,8 @@ var managedFields = object({
|
|
|
8743
8743
|
object({
|
|
8744
8744
|
kind: literal("connector"),
|
|
8745
8745
|
action: text,
|
|
8746
|
-
connectionId: text.optional()
|
|
8746
|
+
connectionId: text.optional(),
|
|
8747
|
+
outputMode: literal("value").optional()
|
|
8747
8748
|
}),
|
|
8748
8749
|
object({
|
|
8749
8750
|
kind: literal("openapi"),
|
|
@@ -9341,7 +9342,7 @@ var authoringConfigurations = {
|
|
|
9341
9342
|
outputs: outputFields,
|
|
9342
9343
|
capabilities: authoringDefinitionSchemas.capabilities.optional()
|
|
9343
9344
|
}),
|
|
9344
|
-
connector: authoringDefinitionSchemas.connector.strict(),
|
|
9345
|
+
connector: authoringDefinitionSchemas.connector.omit({ outputMode: true }).strict(),
|
|
9345
9346
|
openapi: authoringOpenApiSchema,
|
|
9346
9347
|
agent: authoringDefinitionSchemas.agent.omit({
|
|
9347
9348
|
prompt: true,
|
|
@@ -10164,6 +10165,24 @@ function providerIconAppearance(metadata, position) {
|
|
|
10164
10165
|
};
|
|
10165
10166
|
}
|
|
10166
10167
|
//#endregion
|
|
10168
|
+
//#region src/flow/common/workflowFile.ts
|
|
10169
|
+
var envelope = strictObject({
|
|
10170
|
+
kind: literal("open-flow-workflow"),
|
|
10171
|
+
version: literal(1),
|
|
10172
|
+
name: string$1().optional(),
|
|
10173
|
+
content: unknown(),
|
|
10174
|
+
presentation: record$2(string$1(), json$3()).optional()
|
|
10175
|
+
});
|
|
10176
|
+
/** Structural decoding only: incomplete drafts are supported, repair is never attempted. */
|
|
10177
|
+
function decodeWorkflowFile(value) {
|
|
10178
|
+
checkJsonDepth(value, -1);
|
|
10179
|
+
const file = envelope.parse(value);
|
|
10180
|
+
return {
|
|
10181
|
+
...file,
|
|
10182
|
+
content: decodeRevisionContent(file.content)
|
|
10183
|
+
};
|
|
10184
|
+
}
|
|
10185
|
+
//#endregion
|
|
10167
10186
|
//#region src/flow/common/encoding.ts
|
|
10168
10187
|
var encoder$1 = new TextEncoder();
|
|
10169
10188
|
function canonicalText(value) {
|
|
@@ -12074,6 +12093,26 @@ var ControlClient = class {
|
|
|
12074
12093
|
exact(source, ["version"]);
|
|
12075
12094
|
if (source.version != 1) return invalidResponse();
|
|
12076
12095
|
}
|
|
12096
|
+
async exportFlow(flowId) {
|
|
12097
|
+
const value = await this.request(`/v1/flows/${segment(flowId)}/export`);
|
|
12098
|
+
try {
|
|
12099
|
+
return decodeWorkflowFile(value);
|
|
12100
|
+
} catch {
|
|
12101
|
+
return invalidResponse();
|
|
12102
|
+
}
|
|
12103
|
+
}
|
|
12104
|
+
async importFlow(file, options = {}) {
|
|
12105
|
+
return flow(await this.request("/v1/flows/import", {
|
|
12106
|
+
method: "POST",
|
|
12107
|
+
headers: { "Idempotency-Key": options.idempotencyKey ?? `flow-${randomId()}` },
|
|
12108
|
+
body: JSON.stringify({
|
|
12109
|
+
file,
|
|
12110
|
+
name: options.name,
|
|
12111
|
+
teamId: options.teamId,
|
|
12112
|
+
version: 1
|
|
12113
|
+
})
|
|
12114
|
+
}));
|
|
12115
|
+
}
|
|
12077
12116
|
async createFlow(name, idempotencyKey = `flow-${randomId()}`, teamId) {
|
|
12078
12117
|
return flow(await this.request("/v1/flows", {
|
|
12079
12118
|
body: JSON.stringify({
|
|
@@ -162,6 +162,12 @@ export declare const controlRequests: {
|
|
|
162
162
|
version: 1;
|
|
163
163
|
expectedRevision: number;
|
|
164
164
|
};
|
|
165
|
+
importFlow: (value: unknown) => {
|
|
166
|
+
file: JsonValue;
|
|
167
|
+
name?: string | undefined;
|
|
168
|
+
teamId?: string | undefined;
|
|
169
|
+
version: 1;
|
|
170
|
+
};
|
|
165
171
|
createFlow: (value: unknown) => {
|
|
166
172
|
name: string;
|
|
167
173
|
teamId?: string | undefined;
|
|
@@ -8360,10 +8360,10 @@ function compileEnumAndConst(context, enumList, constValue, schema) {
|
|
|
8360
8360
|
}
|
|
8361
8361
|
if (compiledEnum.length === 0) recordWarn(context, "all of elements from list is rejected by currently schema object", "enum");
|
|
8362
8362
|
}
|
|
8363
|
-
if (constValue && valid(schema, constValue) === ValidResult.Invalid) isNever = true;
|
|
8363
|
+
if (constValue !== void 0 && valid(schema, constValue) === ValidResult.Invalid) isNever = true;
|
|
8364
8364
|
if (compiledEnum) {
|
|
8365
8365
|
if (compiledEnum.length === 0) isNever = true;
|
|
8366
|
-
else if (constValue) {
|
|
8366
|
+
else if (constValue !== void 0) {
|
|
8367
8367
|
let foundEquals = false;
|
|
8368
8368
|
for (const enumValue of compiledEnum) if (isDeepEquals(enumValue, constValue)) {
|
|
8369
8369
|
foundEquals = true;
|
|
@@ -8376,7 +8376,7 @@ function compileEnumAndConst(context, enumList, constValue, schema) {
|
|
|
8376
8376
|
const compiledSchema = {};
|
|
8377
8377
|
if (schema.type) compiledSchema.type = schema.type;
|
|
8378
8378
|
if (compiledEnum) compiledSchema.enum = compiledEnum;
|
|
8379
|
-
if (constValue) compiledSchema.const = wrapCompiledValue(deepCopy(constValue));
|
|
8379
|
+
if (constValue !== void 0) compiledSchema.const = wrapCompiledValue(deepCopy(constValue));
|
|
8380
8380
|
return wrapCompiledSchema(kind, compiledSchema, context.delegate, context.path);
|
|
8381
8381
|
}
|
|
8382
8382
|
//#endregion
|
|
@@ -8771,7 +8771,7 @@ function compileSchema(context, schema) {
|
|
|
8771
8771
|
let targetSchema = schema;
|
|
8772
8772
|
let shouldHandleEnumAndConst = false;
|
|
8773
8773
|
const { enum: enumList, const: constValue } = schema;
|
|
8774
|
-
if (enumList || constValue) {
|
|
8774
|
+
if (enumList || constValue !== void 0) {
|
|
8775
8775
|
const { enum: _0, const: _1, ...rest } = schema;
|
|
8776
8776
|
targetSchema = rest;
|
|
8777
8777
|
shouldHandleEnumAndConst = true;
|
|
@@ -9361,7 +9361,7 @@ function schemaEqualsChecker(extendsContext) {
|
|
|
9361
9361
|
}
|
|
9362
9362
|
function isValueEquals(value1, value2) {
|
|
9363
9363
|
if (value1 === value2) return true;
|
|
9364
|
-
if (value1 === null) return false;
|
|
9364
|
+
if (value1 === null || value2 === null) return false;
|
|
9365
9365
|
if (typeof value1 !== "object") return false;
|
|
9366
9366
|
if (typeof value1 !== typeof value2) return false;
|
|
9367
9367
|
if (isCompiledSchema(value1) && isCompiledSchema(value2)) return isCompiledSchemaEquals(value1, value2);
|
|
@@ -9927,7 +9927,7 @@ function findMismatchPath(source, target) {
|
|
|
9927
9927
|
if ((sourceSchema.maxProperties ?? Number.POSITIVE_INFINITY) > (targetSchema.maxProperties ?? Number.POSITIVE_INFINITY)) return [...targetPath, "maxProperties"];
|
|
9928
9928
|
break;
|
|
9929
9929
|
}
|
|
9930
|
-
case CompiledKind.EnumOrConst: return [...targetPath, targetSchema.const
|
|
9930
|
+
case CompiledKind.EnumOrConst: return [...targetPath, targetSchema.const === void 0 ? "enum" : "const"];
|
|
9931
9931
|
}
|
|
9932
9932
|
return targetPath;
|
|
9933
9933
|
}
|
|
@@ -10464,7 +10464,8 @@ var managedFields = object$1({
|
|
|
10464
10464
|
object$1({
|
|
10465
10465
|
kind: literal("connector"),
|
|
10466
10466
|
action: text$1,
|
|
10467
|
-
connectionId: text$1.optional()
|
|
10467
|
+
connectionId: text$1.optional(),
|
|
10468
|
+
outputMode: literal("value").optional()
|
|
10468
10469
|
}),
|
|
10469
10470
|
object$1({
|
|
10470
10471
|
kind: literal("openapi"),
|
|
@@ -11613,7 +11614,7 @@ var authoringConfigurations = {
|
|
|
11613
11614
|
outputs: outputFields,
|
|
11614
11615
|
capabilities: authoringDefinitionSchemas.capabilities.optional()
|
|
11615
11616
|
}),
|
|
11616
|
-
connector: authoringDefinitionSchemas.connector.strict(),
|
|
11617
|
+
connector: authoringDefinitionSchemas.connector.omit({ outputMode: true }).strict(),
|
|
11617
11618
|
openapi: authoringOpenApiSchema,
|
|
11618
11619
|
agent: authoringDefinitionSchemas.agent.omit({
|
|
11619
11620
|
prompt: true,
|
|
@@ -12019,6 +12020,13 @@ var authoringSearchResponse = object$1({
|
|
|
12019
12020
|
version: literal(1)
|
|
12020
12021
|
});
|
|
12021
12022
|
//#endregion
|
|
12023
|
+
//#region src/connector/common/actionSchema.ts
|
|
12024
|
+
function connectorOutputMode(schema) {
|
|
12025
|
+
const root = toPlainObject(schema);
|
|
12026
|
+
const properties = toPlainObject(root?.properties);
|
|
12027
|
+
return properties != null && Object.keys(properties).length > 0 || root?.type == "object" && root.additionalProperties === false ? "fields" : "value";
|
|
12028
|
+
}
|
|
12029
|
+
//#endregion
|
|
12022
12030
|
//#region src/trigger/common/contract.ts
|
|
12023
12031
|
var errorOutputs = [
|
|
12024
12032
|
{
|
|
@@ -12920,6 +12928,9 @@ function authoringNode(content, ref) {
|
|
|
12920
12928
|
const { inputDefinitions: _definitions, ...noticeSettings } = notification;
|
|
12921
12929
|
config.notification = noticeSettings;
|
|
12922
12930
|
}
|
|
12931
|
+
} else if (task.executor.kind == "connector") {
|
|
12932
|
+
const { kind: _kind, outputMode: _outputMode, ...settings } = task.executor;
|
|
12933
|
+
config = settings;
|
|
12923
12934
|
} else if (task.executor.kind == "llm") config = {
|
|
12924
12935
|
...llmConfigurationView(task),
|
|
12925
12936
|
inputs: fieldsView([...task.inputs, ...node.kind == "task" ? node.additionalInputs ?? [] : []].filter((port) => !("handle" in port) || !llmReservedInputs.includes(port.handle)))
|
|
@@ -13168,7 +13179,8 @@ async function compileAuthoring(base, request, host) {
|
|
|
13168
13179
|
executor: {
|
|
13169
13180
|
kind: "connector",
|
|
13170
13181
|
action: action.actionId,
|
|
13171
|
-
...config.connectionId == null ? {} : { connectionId: String(config.connectionId) }
|
|
13182
|
+
...config.connectionId == null ? {} : { connectionId: String(config.connectionId) },
|
|
13183
|
+
...action.outputSchema !== void 0 && connectorOutputMode(action.outputSchema) == "value" ? { outputMode: "value" } : {}
|
|
13172
13184
|
},
|
|
13173
13185
|
inputs: Object.entries(action.inputs).map(([handle, port]) => Object.assign({ handle }, port)),
|
|
13174
13186
|
outputs: Object.entries(action.outputs).map(([handle, port]) => Object.assign({ handle }, port))
|
|
@@ -13236,15 +13248,19 @@ async function compileAuthoring(base, request, host) {
|
|
|
13236
13248
|
} else if (node.kind == "task" && "executor" in node.task) {
|
|
13237
13249
|
const before = node.task;
|
|
13238
13250
|
let task;
|
|
13239
|
-
if (type == "connector")
|
|
13240
|
-
|
|
13241
|
-
|
|
13242
|
-
|
|
13243
|
-
|
|
13244
|
-
|
|
13245
|
-
|
|
13246
|
-
|
|
13247
|
-
|
|
13251
|
+
if (type == "connector") {
|
|
13252
|
+
if (before.executor.kind == "connector" && config.action == before.executor.action) {
|
|
13253
|
+
const { connectionId: _connectionId, ...executor } = before.executor;
|
|
13254
|
+
task = {
|
|
13255
|
+
...before,
|
|
13256
|
+
name: String(update.name),
|
|
13257
|
+
executor: {
|
|
13258
|
+
...executor,
|
|
13259
|
+
...config
|
|
13260
|
+
}
|
|
13261
|
+
};
|
|
13262
|
+
} else task = await connectorTask(config, String(update.name));
|
|
13263
|
+
} else if (type == "decision") task = decisionTask(config.questions, String(update.name));
|
|
13248
13264
|
else if (type == "openapi") task = await prepareOpenApiTask(config, before, (url) => host.openapi(url), String(update.name), {
|
|
13249
13265
|
authentication: explicit("authentication"),
|
|
13250
13266
|
serverUrl: explicit("serverUrl")
|
|
@@ -14008,6 +14024,12 @@ var schemas = {
|
|
|
14008
14024
|
createEventSource: createEventSourceSchema,
|
|
14009
14025
|
updateEventSource: updateEventSourceSchema,
|
|
14010
14026
|
eventSourceRevision: eventSourceRevisionSchema,
|
|
14027
|
+
importFlow: strictObject({
|
|
14028
|
+
file: json,
|
|
14029
|
+
name: flowName.optional(),
|
|
14030
|
+
teamId: id.optional(),
|
|
14031
|
+
version
|
|
14032
|
+
}),
|
|
14011
14033
|
createFlow: strictObject({
|
|
14012
14034
|
name: flowName,
|
|
14013
14035
|
teamId: id.optional(),
|
|
@@ -14110,6 +14132,7 @@ var controlRequests = {
|
|
|
14110
14132
|
createEventSource: decoder(schemas.createEventSource),
|
|
14111
14133
|
updateEventSource: decoder(schemas.updateEventSource),
|
|
14112
14134
|
eventSourceRevision: decoder(schemas.eventSourceRevision),
|
|
14135
|
+
importFlow: decoder(schemas.importFlow),
|
|
14113
14136
|
createFlow: decoder(schemas.createFlow),
|
|
14114
14137
|
renameFlow: decoder(schemas.renameFlow),
|
|
14115
14138
|
changeDraft(value) {
|
package/dist/common/decision.js
CHANGED
|
@@ -6711,7 +6711,8 @@ var managedFields = object({
|
|
|
6711
6711
|
object({
|
|
6712
6712
|
kind: literal("connector"),
|
|
6713
6713
|
action: text,
|
|
6714
|
-
connectionId: text.optional()
|
|
6714
|
+
connectionId: text.optional(),
|
|
6715
|
+
outputMode: literal("value").optional()
|
|
6715
6716
|
}),
|
|
6716
6717
|
object({
|
|
6717
6718
|
kind: literal("openapi"),
|
|
@@ -8096,10 +8097,10 @@ function compileEnumAndConst(context, enumList, constValue, schema) {
|
|
|
8096
8097
|
}
|
|
8097
8098
|
if (compiledEnum.length === 0) recordWarn(context, "all of elements from list is rejected by currently schema object", "enum");
|
|
8098
8099
|
}
|
|
8099
|
-
if (constValue && valid(schema, constValue) === ValidResult.Invalid) isNever = true;
|
|
8100
|
+
if (constValue !== void 0 && valid(schema, constValue) === ValidResult.Invalid) isNever = true;
|
|
8100
8101
|
if (compiledEnum) {
|
|
8101
8102
|
if (compiledEnum.length === 0) isNever = true;
|
|
8102
|
-
else if (constValue) {
|
|
8103
|
+
else if (constValue !== void 0) {
|
|
8103
8104
|
let foundEquals = false;
|
|
8104
8105
|
for (const enumValue of compiledEnum) if (isDeepEquals(enumValue, constValue)) {
|
|
8105
8106
|
foundEquals = true;
|
|
@@ -8112,7 +8113,7 @@ function compileEnumAndConst(context, enumList, constValue, schema) {
|
|
|
8112
8113
|
const compiledSchema = {};
|
|
8113
8114
|
if (schema.type) compiledSchema.type = schema.type;
|
|
8114
8115
|
if (compiledEnum) compiledSchema.enum = compiledEnum;
|
|
8115
|
-
if (constValue) compiledSchema.const = wrapCompiledValue(deepCopy(constValue));
|
|
8116
|
+
if (constValue !== void 0) compiledSchema.const = wrapCompiledValue(deepCopy(constValue));
|
|
8116
8117
|
return wrapCompiledSchema(kind, compiledSchema, context.delegate, context.path);
|
|
8117
8118
|
}
|
|
8118
8119
|
//#endregion
|
|
@@ -8507,7 +8508,7 @@ function compileSchema(context, schema) {
|
|
|
8507
8508
|
let targetSchema = schema;
|
|
8508
8509
|
let shouldHandleEnumAndConst = false;
|
|
8509
8510
|
const { enum: enumList, const: constValue } = schema;
|
|
8510
|
-
if (enumList || constValue) {
|
|
8511
|
+
if (enumList || constValue !== void 0) {
|
|
8511
8512
|
const { enum: _0, const: _1, ...rest } = schema;
|
|
8512
8513
|
targetSchema = rest;
|
|
8513
8514
|
shouldHandleEnumAndConst = true;
|
|
@@ -9097,7 +9098,7 @@ function schemaEqualsChecker(extendsContext) {
|
|
|
9097
9098
|
}
|
|
9098
9099
|
function isValueEquals(value1, value2) {
|
|
9099
9100
|
if (value1 === value2) return true;
|
|
9100
|
-
if (value1 === null) return false;
|
|
9101
|
+
if (value1 === null || value2 === null) return false;
|
|
9101
9102
|
if (typeof value1 !== "object") return false;
|
|
9102
9103
|
if (typeof value1 !== typeof value2) return false;
|
|
9103
9104
|
if (isCompiledSchema(value1) && isCompiledSchema(value2)) return isCompiledSchemaEquals(value1, value2);
|
|
@@ -9663,7 +9664,7 @@ function findMismatchPath(source, target) {
|
|
|
9663
9664
|
if ((sourceSchema.maxProperties ?? Number.POSITIVE_INFINITY) > (targetSchema.maxProperties ?? Number.POSITIVE_INFINITY)) return [...targetPath, "maxProperties"];
|
|
9664
9665
|
break;
|
|
9665
9666
|
}
|
|
9666
|
-
case CompiledKind.EnumOrConst: return [...targetPath, targetSchema.const
|
|
9667
|
+
case CompiledKind.EnumOrConst: return [...targetPath, targetSchema.const === void 0 ? "enum" : "const"];
|
|
9667
9668
|
}
|
|
9668
9669
|
return targetPath;
|
|
9669
9670
|
}
|
|
@@ -10,3 +10,4 @@ export interface ConnectionUsage {
|
|
|
10
10
|
}
|
|
11
11
|
export declare function connectionUsage(document: FlowDocument): readonly ConnectionUsage[];
|
|
12
12
|
export declare function removeConnectionUsage(content: RevisionContent, connectionId: string): RevisionContent;
|
|
13
|
+
export declare function clearNodeConnections(graph: FlowDocument['graph'], connectionId?: string): FlowDocument['graph'];
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { CodeModule, FlowDocument, Graph, Group, InputPort, JsonValue, ManagedTaskDefinition, Port, RevisionContent, TriggerNode } from '@oomol-lab/open-flow/flow-change';
|
|
2
|
+
export * from './flow-workflowFile.js';
|
|
2
3
|
export { maxJsonDepth } from './flow-json.js';
|
|
3
4
|
export { decodeFlowDocument, decodeRevisionContent } from '../browser/flow-change-schema.js';
|
|
4
5
|
export declare function canonicalJsonBytes(value: JsonValue): Uint8Array;
|