@oomol-lab/open-flow 0.1.0-beta.64 → 0.1.0-beta.65
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/flow-authoring.js +21 -2
- package/dist/browser/{flowChanges-BAMkSaKF.js → flowChanges-DkvG5uDq.js} +1774 -1663
- package/dist/browser/{flowWorkspace-DxLc1Ybv.js → flowWorkspace-BEp-lxqF.js} +116 -1
- package/dist/browser/preview.css +8 -0
- package/dist/browser/preview.js +1870 -1663
- package/dist/browser/ui.css +8 -0
- package/dist/browser/workbench.css +8 -0
- package/dist/browser/workbench.js +31 -4
- package/dist/command/index.js +22 -22
- package/dist/common/connectorDecoders.d.ts +2 -1
- package/dist/common/control-api-conformance.js +19 -0
- package/dist/common/control-api.d.ts +7 -0
- package/dist/common/control-api.js +25 -0
- package/dist/common/control-requests.js +45 -5
- package/dist/common/flow-semantics.js +6 -0
- package/dist/common/mcp.js +3310 -3291
- package/dist/common/scheduler.d.ts +1 -0
- package/dist/common/scheduler.js +49 -3
- package/package.json +1 -1
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type { ConnectorAccess, ConnectorAccessSnapshot, ConnectorAccessCandidates, ConnectorAccessCandidatesBatch, ConnectorAction, ConnectorActionMetadata, ConnectorConnection, ConnectorProvider } from './control-api.js';
|
|
1
|
+
import type { ConnectorAccess, ConnectorAccessSnapshot, ConnectorAccessCandidates, ConnectorAccessCandidatesBatch, ConnectorAction, ConnectorActionMetadata, ConnectorConnection, ConnectorProvider, LeinaBot } from './control-api.js';
|
|
2
|
+
export declare function leinaBots(value: unknown): readonly LeinaBot[];
|
|
2
3
|
export declare function connectorAccess(value: unknown): ConnectorAccess;
|
|
3
4
|
export declare function connectorAccessSnapshot(value: unknown): ConnectorAccessSnapshot;
|
|
4
5
|
export declare function connectorAccessCandidates(value: unknown, providerId: string): ConnectorAccessCandidates;
|
|
@@ -10065,6 +10065,22 @@ function parseProviderAccessSource(value) {
|
|
|
10065
10065
|
}
|
|
10066
10066
|
//#endregion
|
|
10067
10067
|
//#region src/control/common/connectorDecoders.ts
|
|
10068
|
+
function leinaBots(value) {
|
|
10069
|
+
const source = record$1(value);
|
|
10070
|
+
if (!Array.isArray(source.bots)) return invalidResponse("Leina bots: expected an array.");
|
|
10071
|
+
const bots = source.bots.map((entry) => {
|
|
10072
|
+
const bot = record$1(entry);
|
|
10073
|
+
if (!Array.isArray(bot.platforms)) return invalidResponse("Leina platforms: expected an array.");
|
|
10074
|
+
return {
|
|
10075
|
+
leinaId: string(bot.leinaId),
|
|
10076
|
+
name: string(bot.name),
|
|
10077
|
+
status: string(bot.status),
|
|
10078
|
+
platforms: bot.platforms.map(string)
|
|
10079
|
+
};
|
|
10080
|
+
});
|
|
10081
|
+
if (new Set(bots.map((bot) => bot.leinaId)).size != bots.length) return invalidResponse("Leina bots: duplicate identifiers.");
|
|
10082
|
+
return bots;
|
|
10083
|
+
}
|
|
10068
10084
|
function accessPermissions(value) {
|
|
10069
10085
|
const source = record$1(value);
|
|
10070
10086
|
exact(source, [
|
|
@@ -11668,6 +11684,9 @@ var ControlClient = class {
|
|
|
11668
11684
|
const query = connectorProvidersQuery(flowId, locale);
|
|
11669
11685
|
return this.connectorRequest(query.path, "providers", signal, query.decode);
|
|
11670
11686
|
}
|
|
11687
|
+
async listLeinaBots(flowId, signal) {
|
|
11688
|
+
return leinaBots(await this.request(`/v1/connector/leina/bots?flowId=${segment(flowId)}`, { signal }));
|
|
11689
|
+
}
|
|
11671
11690
|
async removeConnectionUsage(flowId, connectionId, expectedRevisionId, expectedAccessRevision, idempotencyKey) {
|
|
11672
11691
|
return draftChange(await this.request(`/v1/flows/${segment(flowId)}/connection-usage/remove`, {
|
|
11673
11692
|
method: "POST",
|
|
@@ -201,6 +201,12 @@ export interface ConnectorProvider extends ProviderIconAppearance {
|
|
|
201
201
|
readonly serviceName: string;
|
|
202
202
|
}
|
|
203
203
|
export type ConnectorAccessMode = 'implicit' | 'selectable';
|
|
204
|
+
export interface LeinaBot {
|
|
205
|
+
readonly leinaId: string;
|
|
206
|
+
readonly name: string;
|
|
207
|
+
readonly status: string;
|
|
208
|
+
readonly platforms: readonly string[];
|
|
209
|
+
}
|
|
204
210
|
export type ProviderAccessBindingStatus = 'active' | 'forbidden' | 'invalid' | 'missing';
|
|
205
211
|
export type ProviderAccessBinding = ((ProviderAccessIdentity & {
|
|
206
212
|
readonly status: ProviderAccessBindingStatus;
|
|
@@ -841,6 +847,7 @@ export declare class ControlClient {
|
|
|
841
847
|
version: 1;
|
|
842
848
|
}>;
|
|
843
849
|
listConnectorProviders(signal?: AbortSignal, flowId?: string, locale?: string): Promise<readonly ConnectorProvider[]>;
|
|
850
|
+
listLeinaBots(flowId: string, signal?: AbortSignal): Promise<readonly LeinaBot[]>;
|
|
844
851
|
removeConnectionUsage(flowId: string, connectionId: string, expectedRevisionId: string, expectedAccessRevision: number, idempotencyKey: string): Promise<DraftChange>;
|
|
845
852
|
getConnectorAccess(flowId: string, signal?: AbortSignal): Promise<ConnectorAccess>;
|
|
846
853
|
getPublishedConnectorAccess(flowId: string, publicationId: string, signal?: AbortSignal): Promise<ConnectorAccessSnapshot>;
|
|
@@ -10220,6 +10220,22 @@ async function providerAccessBindingId(teamId, identity) {
|
|
|
10220
10220
|
}
|
|
10221
10221
|
//#endregion
|
|
10222
10222
|
//#region src/control/common/connectorDecoders.ts
|
|
10223
|
+
function leinaBots(value) {
|
|
10224
|
+
const source = record(value);
|
|
10225
|
+
if (!Array.isArray(source.bots)) return invalidResponse("Leina bots: expected an array.");
|
|
10226
|
+
const bots = source.bots.map((entry) => {
|
|
10227
|
+
const bot = record(entry);
|
|
10228
|
+
if (!Array.isArray(bot.platforms)) return invalidResponse("Leina platforms: expected an array.");
|
|
10229
|
+
return {
|
|
10230
|
+
leinaId: string(bot.leinaId),
|
|
10231
|
+
name: string(bot.name),
|
|
10232
|
+
status: string(bot.status),
|
|
10233
|
+
platforms: bot.platforms.map(string)
|
|
10234
|
+
};
|
|
10235
|
+
});
|
|
10236
|
+
if (new Set(bots.map((bot) => bot.leinaId)).size != bots.length) return invalidResponse("Leina bots: duplicate identifiers.");
|
|
10237
|
+
return bots;
|
|
10238
|
+
}
|
|
10223
10239
|
function accessPermissions(value) {
|
|
10224
10240
|
const source = record(value);
|
|
10225
10241
|
exact(source, [
|
|
@@ -10736,6 +10752,12 @@ function resolutionOutputPorts(node) {
|
|
|
10736
10752
|
pending: objectPort({
|
|
10737
10753
|
inputs,
|
|
10738
10754
|
prompt: { type: "string" },
|
|
10755
|
+
pageUrl: { type: "string" },
|
|
10756
|
+
message: {
|
|
10757
|
+
type: "string",
|
|
10758
|
+
minLength: 1,
|
|
10759
|
+
pattern: "\\S"
|
|
10760
|
+
},
|
|
10739
10761
|
...Object.fromEntries(actions.map((action) => [`${action}Url`, { type: "string" }])),
|
|
10740
10762
|
expiresAt: { type: "string" }
|
|
10741
10763
|
}),
|
|
@@ -12324,6 +12346,9 @@ var ControlClient = class {
|
|
|
12324
12346
|
const query = connectorProvidersQuery(flowId, locale);
|
|
12325
12347
|
return this.connectorRequest(query.path, "providers", signal, query.decode);
|
|
12326
12348
|
}
|
|
12349
|
+
async listLeinaBots(flowId, signal) {
|
|
12350
|
+
return leinaBots(await this.request(`/v1/connector/leina/bots?flowId=${segment(flowId)}`, { signal }));
|
|
12351
|
+
}
|
|
12327
12352
|
async removeConnectionUsage(flowId, connectionId, expectedRevisionId, expectedAccessRevision, idempotencyKey) {
|
|
12328
12353
|
return draftChange(await this.request(`/v1/flows/${segment(flowId)}/connection-usage/remove`, {
|
|
12329
12354
|
method: "POST",
|
|
@@ -12044,6 +12044,41 @@ function connectorOutputMode(schema) {
|
|
|
12044
12044
|
return properties != null && Object.keys(properties).length > 0 || root?.type == "object" && root.additionalProperties === false ? "fields" : "value";
|
|
12045
12045
|
}
|
|
12046
12046
|
//#endregion
|
|
12047
|
+
//#region src/flow/common/edgeChanges.ts
|
|
12048
|
+
function connect(content, edge) {
|
|
12049
|
+
const selected = content.document.graph;
|
|
12050
|
+
if (selected?.edges.some((candidate) => dequal(candidate, edge))) return [];
|
|
12051
|
+
const changes = [{
|
|
12052
|
+
edge,
|
|
12053
|
+
kind: "graph.edge.connect"
|
|
12054
|
+
}];
|
|
12055
|
+
const source = selected.nodes[edge.source];
|
|
12056
|
+
const target = selected.nodes[edge.target];
|
|
12057
|
+
if (edge.sourceHandle == "pending" && (source?.kind == "approval" || source?.kind == "wait") && target?.kind == "task" && "executor" in target.task && target.task.executor.kind == "connector" && target.task.executor.action == "leina.send_notification" && (target.inputs.message == null || target.inputs.message.kind == "unset")) changes.push({
|
|
12058
|
+
kind: "graph.node.input.set",
|
|
12059
|
+
nodeId: edge.target,
|
|
12060
|
+
handle: "message",
|
|
12061
|
+
before: target.inputs.message,
|
|
12062
|
+
value: {
|
|
12063
|
+
kind: "sources",
|
|
12064
|
+
sources: [{
|
|
12065
|
+
kind: "node",
|
|
12066
|
+
nodeId: edge.source,
|
|
12067
|
+
output: "pending",
|
|
12068
|
+
field: "message"
|
|
12069
|
+
}]
|
|
12070
|
+
}
|
|
12071
|
+
});
|
|
12072
|
+
return changes;
|
|
12073
|
+
}
|
|
12074
|
+
function disconnect(content, edge) {
|
|
12075
|
+
if (!content.document.graph?.edges.some((candidate) => dequal(candidate, edge))) return [];
|
|
12076
|
+
return [{
|
|
12077
|
+
edge,
|
|
12078
|
+
kind: "graph.edge.disconnect"
|
|
12079
|
+
}];
|
|
12080
|
+
}
|
|
12081
|
+
//#endregion
|
|
12047
12082
|
//#region src/trigger/common/contract.ts
|
|
12048
12083
|
var errorOutputs = [
|
|
12049
12084
|
{
|
|
@@ -12207,6 +12242,12 @@ function resolutionOutputPorts(node) {
|
|
|
12207
12242
|
pending: objectPort({
|
|
12208
12243
|
inputs,
|
|
12209
12244
|
prompt: { type: "string" },
|
|
12245
|
+
pageUrl: { type: "string" },
|
|
12246
|
+
message: {
|
|
12247
|
+
type: "string",
|
|
12248
|
+
minLength: 1,
|
|
12249
|
+
pattern: "\\S"
|
|
12250
|
+
},
|
|
12210
12251
|
...Object.fromEntries(actions.map((action) => [`${action}Url`, { type: "string" }])),
|
|
12211
12252
|
expiresAt: { type: "string" }
|
|
12212
12253
|
}),
|
|
@@ -13130,6 +13171,7 @@ async function compileAuthoring(base, request, host) {
|
|
|
13130
13171
|
let content = base, index = 0, sequence = 0;
|
|
13131
13172
|
const operations = [], aliases = {};
|
|
13132
13173
|
const touchedModules = /* @__PURE__ */ new Set();
|
|
13174
|
+
const explicitMessages = /* @__PURE__ */ new Set();
|
|
13133
13175
|
function fresh(label) {
|
|
13134
13176
|
return host.id(`${index}:${label}:${sequence++}`);
|
|
13135
13177
|
}
|
|
@@ -13439,6 +13481,7 @@ async function compileAuthoring(base, request, host) {
|
|
|
13439
13481
|
});
|
|
13440
13482
|
}
|
|
13441
13483
|
async function setInput(ref, input, value) {
|
|
13484
|
+
if (input == "message") explicitMessages.add(ref);
|
|
13442
13485
|
const node = nodeAt(content, ref);
|
|
13443
13486
|
if (node.kind == "condition") fail("input.unsupported", "Edit the branch condition operands through config.branches.", {
|
|
13444
13487
|
node: ref,
|
|
@@ -13615,11 +13658,8 @@ async function compileAuthoring(base, request, host) {
|
|
|
13615
13658
|
target: to,
|
|
13616
13659
|
...edit.branch == null ? {} : { sourceHandle: edit.branch }
|
|
13617
13660
|
};
|
|
13618
|
-
const
|
|
13619
|
-
|
|
13620
|
-
kind: edit.op == "edge.connect" ? "graph.edge.connect" : "graph.edge.disconnect",
|
|
13621
|
-
edge
|
|
13622
|
-
}]);
|
|
13661
|
+
const changes = edit.op == "edge.connect" ? connect(content, edge) : disconnect(content, edge);
|
|
13662
|
+
apply(explicitMessages.has(to) ? changes.filter((change) => change.kind != "graph.node.input.set") : changes);
|
|
13623
13663
|
break;
|
|
13624
13664
|
}
|
|
13625
13665
|
case "text.set":
|
|
@@ -12045,6 +12045,12 @@ function resolutionOutputPorts(node) {
|
|
|
12045
12045
|
pending: objectPort({
|
|
12046
12046
|
inputs,
|
|
12047
12047
|
prompt: { type: "string" },
|
|
12048
|
+
pageUrl: { type: "string" },
|
|
12049
|
+
message: {
|
|
12050
|
+
type: "string",
|
|
12051
|
+
minLength: 1,
|
|
12052
|
+
pattern: "\\S"
|
|
12053
|
+
},
|
|
12048
12054
|
...Object.fromEntries(actions.map((action) => [`${action}Url`, { type: "string" }])),
|
|
12049
12055
|
expiresAt: { type: "string" }
|
|
12050
12056
|
}),
|