@oomol-lab/open-flow 0.1.0-beta.67 → 0.1.0-beta.68

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.
@@ -11111,6 +11111,21 @@ function workflowIdentity(value) {
11111
11111
  executionId: string(ref.executionId)
11112
11112
  };
11113
11113
  }
11114
+ function runInitiator(value) {
11115
+ const source = record$1(value);
11116
+ if (![
11117
+ "workbench",
11118
+ "cli",
11119
+ "mcp",
11120
+ "api",
11121
+ "trigger",
11122
+ "workflow"
11123
+ ].includes(source.channel)) return invalidResponse();
11124
+ return {
11125
+ channel: source.channel,
11126
+ ...source.actorId === void 0 ? {} : { actorId: string(source.actorId) }
11127
+ };
11128
+ }
11114
11129
  function runDetails(value) {
11115
11130
  const source = record$1(value);
11116
11131
  const summary = run(source);
@@ -11132,6 +11147,7 @@ function runDetails(value) {
11132
11147
  if (source.calls !== void 0 && !Array.isArray(source.calls)) return invalidResponse();
11133
11148
  const details = {
11134
11149
  ...summary,
11150
+ ...source.initiator === void 0 ? {} : { initiator: runInitiator(source.initiator) },
11135
11151
  ...errorHandling(source),
11136
11152
  ...source.triggerNodeId === void 0 ? {} : { triggerNodeId: string(source.triggerNodeId) },
11137
11153
  ...source.caller === void 0 ? {} : { caller: workflowIdentity(source.caller) },
@@ -11509,7 +11525,8 @@ function operationKey(operation) {
11509
11525
  return `${operation}-${randomId()}`;
11510
11526
  }
11511
11527
  var ControlClient = class {
11512
- constructor(requestControl) {
11528
+ constructor(requestControl, channel = "api") {
11529
+ this.channel = channel;
11513
11530
  this.requestControl = requestControl;
11514
11531
  }
11515
11532
  async loadOpenApiDocument(url, signal) {
@@ -12029,7 +12046,10 @@ var ControlClient = class {
12029
12046
  trigger: options.trigger,
12030
12047
  version: 2
12031
12048
  }),
12032
- headers: { "idempotency-key": options.idempotencyKey ?? operationKey("run") },
12049
+ headers: {
12050
+ "idempotency-key": options.idempotencyKey ?? operationKey("run"),
12051
+ "x-open-flow-client": this.channel
12052
+ },
12033
12053
  method: "POST"
12034
12054
  }));
12035
12055
  return created.source == "draft" ? created : invalidResponse();
@@ -12042,7 +12062,10 @@ var ControlClient = class {
12042
12062
  publicationId,
12043
12063
  version: 2
12044
12064
  }),
12045
- headers: { "idempotency-key": options.idempotencyKey ?? operationKey("run") },
12065
+ headers: {
12066
+ "idempotency-key": options.idempotencyKey ?? operationKey("run"),
12067
+ "x-open-flow-client": this.channel
12068
+ },
12046
12069
  method: "POST"
12047
12070
  }));
12048
12071
  return created.source == "live" ? created : invalidResponse();
@@ -381,6 +381,11 @@ export interface PublicationPage {
381
381
  readonly total?: number;
382
382
  readonly version: 1;
383
383
  }
384
+ export type RunChannel = 'workbench' | 'cli' | 'mcp' | 'api' | 'trigger' | 'workflow';
385
+ export interface RunInitiator {
386
+ readonly actorId?: string;
387
+ readonly channel: RunChannel;
388
+ }
384
389
  export interface Run {
385
390
  readonly createdAt: string;
386
391
  readonly finishedAt?: string;
@@ -422,6 +427,7 @@ export interface WorkflowRunCall extends WorkflowCaller {
422
427
  readonly status: RunStatus | null;
423
428
  }
424
429
  type RunDetailsBase = Run & {
430
+ readonly initiator?: RunInitiator;
425
431
  readonly caller?: WorkflowCaller;
426
432
  readonly calls?: readonly WorkflowRunCall[];
427
433
  readonly triggerNodeId?: string;
@@ -788,7 +794,8 @@ export type ConditionalResult<T> = {
788
794
  };
789
795
  export declare class ControlClient {
790
796
  private readonly requestControl;
791
- constructor(requestControl: ControlRequest);
797
+ private readonly channel;
798
+ constructor(requestControl: ControlRequest, channel?: 'workbench' | 'cli' | 'api');
792
799
  loadOpenApiDocument(url: string, signal?: AbortSignal): Promise<JsonValue>;
793
800
  listFlows(options?: {
794
801
  readonly cursor?: string;
@@ -11758,6 +11758,21 @@ function workflowIdentity(value) {
11758
11758
  executionId: string(ref.executionId)
11759
11759
  };
11760
11760
  }
11761
+ function runInitiator(value) {
11762
+ const source = record(value);
11763
+ if (![
11764
+ "workbench",
11765
+ "cli",
11766
+ "mcp",
11767
+ "api",
11768
+ "trigger",
11769
+ "workflow"
11770
+ ].includes(source.channel)) return invalidResponse();
11771
+ return {
11772
+ channel: source.channel,
11773
+ ...source.actorId === void 0 ? {} : { actorId: string(source.actorId) }
11774
+ };
11775
+ }
11761
11776
  function runDetails(value) {
11762
11777
  const source = record(value);
11763
11778
  const summary = run(source);
@@ -11779,6 +11794,7 @@ function runDetails(value) {
11779
11794
  if (source.calls !== void 0 && !Array.isArray(source.calls)) return invalidResponse();
11780
11795
  const details = {
11781
11796
  ...summary,
11797
+ ...source.initiator === void 0 ? {} : { initiator: runInitiator(source.initiator) },
11782
11798
  ...errorHandling(source),
11783
11799
  ...source.triggerNodeId === void 0 ? {} : { triggerNodeId: string(source.triggerNodeId) },
11784
11800
  ...source.caller === void 0 ? {} : { caller: workflowIdentity(source.caller) },
@@ -12159,7 +12175,8 @@ function operationKey(operation) {
12159
12175
  return `${operation}-${randomId()}`;
12160
12176
  }
12161
12177
  var ControlClient = class {
12162
- constructor(requestControl) {
12178
+ constructor(requestControl, channel = "api") {
12179
+ this.channel = channel;
12163
12180
  this.requestControl = requestControl;
12164
12181
  }
12165
12182
  async loadOpenApiDocument(url, signal) {
@@ -12679,7 +12696,10 @@ var ControlClient = class {
12679
12696
  trigger: options.trigger,
12680
12697
  version: 2
12681
12698
  }),
12682
- headers: { "idempotency-key": options.idempotencyKey ?? operationKey("run") },
12699
+ headers: {
12700
+ "idempotency-key": options.idempotencyKey ?? operationKey("run"),
12701
+ "x-open-flow-client": this.channel
12702
+ },
12683
12703
  method: "POST"
12684
12704
  }));
12685
12705
  return created.source == "draft" ? created : invalidResponse();
@@ -12692,7 +12712,10 @@ var ControlClient = class {
12692
12712
  publicationId,
12693
12713
  version: 2
12694
12714
  }),
12695
- headers: { "idempotency-key": options.idempotencyKey ?? operationKey("run") },
12715
+ headers: {
12716
+ "idempotency-key": options.idempotencyKey ?? operationKey("run"),
12717
+ "x-open-flow-client": this.channel
12718
+ },
12696
12719
  method: "POST"
12697
12720
  }));
12698
12721
  return created.source == "live" ? created : invalidResponse();
@@ -11302,6 +11302,21 @@ function workflowIdentity(value) {
11302
11302
  executionId: string(ref.executionId)
11303
11303
  };
11304
11304
  }
11305
+ function runInitiator(value) {
11306
+ const source = record(value);
11307
+ if (![
11308
+ "workbench",
11309
+ "cli",
11310
+ "mcp",
11311
+ "api",
11312
+ "trigger",
11313
+ "workflow"
11314
+ ].includes(source.channel)) return invalidResponse();
11315
+ return {
11316
+ channel: source.channel,
11317
+ ...source.actorId === void 0 ? {} : { actorId: string(source.actorId) }
11318
+ };
11319
+ }
11305
11320
  function runDetails(value) {
11306
11321
  const source = record(value);
11307
11322
  const summary = run$1(source);
@@ -11323,6 +11338,7 @@ function runDetails(value) {
11323
11338
  if (source.calls !== void 0 && !Array.isArray(source.calls)) return invalidResponse();
11324
11339
  const details = {
11325
11340
  ...summary,
11341
+ ...source.initiator === void 0 ? {} : { initiator: runInitiator(source.initiator) },
11326
11342
  ...errorHandling(source),
11327
11343
  ...source.triggerNodeId === void 0 ? {} : { triggerNodeId: string(source.triggerNodeId) },
11328
11344
  ...source.caller === void 0 ? {} : { caller: workflowIdentity(source.caller) },
@@ -11700,7 +11716,8 @@ function operationKey(operation) {
11700
11716
  return `${operation}-${randomId()}`;
11701
11717
  }
11702
11718
  var ControlClient = class {
11703
- constructor(requestControl) {
11719
+ constructor(requestControl, channel = "api") {
11720
+ this.channel = channel;
11704
11721
  this.requestControl = requestControl;
11705
11722
  }
11706
11723
  async loadOpenApiDocument(url, signal) {
@@ -12220,7 +12237,10 @@ var ControlClient = class {
12220
12237
  trigger: options.trigger,
12221
12238
  version: 2
12222
12239
  }),
12223
- headers: { "idempotency-key": options.idempotencyKey ?? operationKey("run") },
12240
+ headers: {
12241
+ "idempotency-key": options.idempotencyKey ?? operationKey("run"),
12242
+ "x-open-flow-client": this.channel
12243
+ },
12224
12244
  method: "POST"
12225
12245
  }));
12226
12246
  return created.source == "draft" ? created : invalidResponse();
@@ -12233,7 +12253,10 @@ var ControlClient = class {
12233
12253
  publicationId,
12234
12254
  version: 2
12235
12255
  }),
12236
- headers: { "idempotency-key": options.idempotencyKey ?? operationKey("run") },
12256
+ headers: {
12257
+ "idempotency-key": options.idempotencyKey ?? operationKey("run"),
12258
+ "x-open-flow-client": this.channel
12259
+ },
12237
12260
  method: "POST"
12238
12261
  }));
12239
12262
  return created.source == "live" ? created : invalidResponse();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oomol-lab/open-flow",
3
- "version": "0.1.0-beta.67",
3
+ "version": "0.1.0-beta.68",
4
4
  "description": "TypeScript contracts and Browser runtime for Open Flow.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {