@codemation/core 0.0.19 → 0.2.1

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.
Files changed (81) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/dist/EngineRuntimeRegistration.types-0sgV2XL2.d.ts +42 -0
  3. package/dist/EngineWorkflowRunnerService-Dx7bJsJR.d.cts +73 -0
  4. package/dist/InMemoryRunDataFactory-qIYQEar7.d.cts +94 -0
  5. package/dist/{InMemoryLiveWorkflowRepository-DxoualoC.d.ts → RunIntentService-BCvGdOSY.d.ts} +438 -9
  6. package/dist/{RunIntentService-C1nu_YwM.js → RunIntentService-BFA48UpH.js} +252 -67
  7. package/dist/RunIntentService-BFA48UpH.js.map +1 -0
  8. package/dist/{InMemoryLiveWorkflowRepository-orY1VsWG.d.cts → RunIntentService-CV8izV8t.d.cts} +214 -7
  9. package/dist/{RunIntentService-ZkjpY7MS.cjs → RunIntentService-DcxXf_AM.cjs} +262 -65
  10. package/dist/RunIntentService-DcxXf_AM.cjs.map +1 -0
  11. package/dist/bootstrap/index.cjs +14 -1135
  12. package/dist/bootstrap/index.d.cts +7 -60
  13. package/dist/bootstrap/index.d.ts +4 -40
  14. package/dist/bootstrap/index.js +3 -1122
  15. package/dist/bootstrap-D67Sf2BF.js +1136 -0
  16. package/dist/bootstrap-D67Sf2BF.js.map +1 -0
  17. package/dist/bootstrap-DoQHAEQJ.cjs +1203 -0
  18. package/dist/bootstrap-DoQHAEQJ.cjs.map +1 -0
  19. package/dist/{index-BIewO9-9.d.ts → index-CueSzHsf.d.ts} +37 -260
  20. package/dist/index.cjs +99 -223
  21. package/dist/index.cjs.map +1 -1
  22. package/dist/index.d.cts +201 -6
  23. package/dist/index.d.ts +3 -3
  24. package/dist/index.js +93 -218
  25. package/dist/index.js.map +1 -1
  26. package/dist/testing.cjs +329 -3
  27. package/dist/testing.cjs.map +1 -1
  28. package/dist/testing.d.cts +181 -4
  29. package/dist/testing.d.ts +181 -3
  30. package/dist/testing.js +319 -2
  31. package/dist/testing.js.map +1 -1
  32. package/dist/workflowActivationPolicy-B8HzTk3o.js +201 -0
  33. package/dist/workflowActivationPolicy-B8HzTk3o.js.map +1 -0
  34. package/dist/workflowActivationPolicy-BzyzXLa_.cjs +231 -0
  35. package/dist/workflowActivationPolicy-BzyzXLa_.cjs.map +1 -0
  36. package/package.json +1 -1
  37. package/src/ai/AgentConnectionNodeCollector.ts +99 -0
  38. package/src/ai/AgentToolFactory.ts +38 -2
  39. package/src/ai/AiHost.ts +1 -1
  40. package/src/authoring/defineNode.types.ts +6 -0
  41. package/src/browser.ts +11 -0
  42. package/src/contracts/executionPersistenceContracts.ts +186 -0
  43. package/src/contracts/index.ts +1 -0
  44. package/src/contracts/runFinishedAtFactory.ts +5 -2
  45. package/src/contracts/runTypes.ts +10 -0
  46. package/src/contracts/runtimeTypes.ts +6 -2
  47. package/src/contracts/workflowTypes.ts +3 -2
  48. package/src/events/EventPublishingWorkflowExecutionRepository.ts +5 -0
  49. package/src/execution/ActivationEnqueueService.ts +8 -8
  50. package/src/execution/PersistedRunStateTerminalBuilder.ts +3 -0
  51. package/src/index.ts +6 -0
  52. package/src/orchestration/NodeExecutionRequestHandlerService.ts +11 -6
  53. package/src/orchestration/RunContinuationService.ts +94 -24
  54. package/src/runStorage/InMemoryWorkflowExecutionRepository.ts +14 -1
  55. package/src/scheduler/DefaultDrivingScheduler.ts +21 -11
  56. package/src/scheduler/InlineDrivingScheduler.ts +17 -21
  57. package/src/testing/CapturingScheduler.ts +15 -0
  58. package/src/testing/EngineTestKitRunIdFactory.ts +24 -0
  59. package/src/testing/InMemoryTriggerSetupStateRepository.ts +21 -0
  60. package/src/testing/PrefixedSequentialIdGenerator.ts +17 -0
  61. package/src/testing/RegistrarEngineTestKit.types.ts +76 -0
  62. package/src/testing/RegistrarEngineTestKitFactory.ts +154 -0
  63. package/src/testing/SubWorkflowRunnerTestNode.ts +83 -0
  64. package/src/testing/WorkflowTestHarnessManualTrigger.ts +39 -0
  65. package/src/testing/WorkflowTestKit.types.ts +9 -0
  66. package/src/testing/WorkflowTestKitBuilder.ts +77 -0
  67. package/src/testing/WorkflowTestKitNodeRegistrationContextFactory.ts +17 -0
  68. package/src/testing/WorkflowTestKitRunNodeWorkflowFactory.ts +26 -0
  69. package/src/testing.ts +19 -0
  70. package/src/types/index.ts +1 -0
  71. package/src/workflow/definition/ConnectionNodeIdFactory.ts +28 -0
  72. package/dist/InMemoryLiveWorkflowRepository-BTzHpQ6e.cjs +0 -151
  73. package/dist/InMemoryLiveWorkflowRepository-BTzHpQ6e.cjs.map +0 -1
  74. package/dist/InMemoryLiveWorkflowRepository-BoLNnVLg.js +0 -139
  75. package/dist/InMemoryLiveWorkflowRepository-BoLNnVLg.js.map +0 -1
  76. package/dist/RunIntentService-C1nu_YwM.js.map +0 -1
  77. package/dist/RunIntentService-DjbxzBBP.d.cts +0 -288
  78. package/dist/RunIntentService-ZkjpY7MS.cjs.map +0 -1
  79. package/dist/WorkflowSnapshotCodec-DSEzKyt3.d.cts +0 -22
  80. package/dist/bootstrap/index.cjs.map +0 -1
  81. package/dist/bootstrap/index.js.map +0 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,27 @@
1
1
  # @codemation/core
2
2
 
3
+ ## 0.2.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#44](https://github.com/MadeRelevant/codemation/pull/44) [`4989e9c`](https://github.com/MadeRelevant/codemation/commit/4989e9c7d97513c05904d47d2f85794ba716a4d3) Thanks [@cblokland90](https://github.com/cblokland90)! - Add optional `icon` to `defineNode(...)` so plugin nodes can set `NodeConfigBase.icon` for the workflow canvas (Lucide, `builtin:`, `si:`, or image URLs).
8
+
9
+ ## 0.2.0
10
+
11
+ ### Minor Changes
12
+
13
+ - [#41](https://github.com/MadeRelevant/codemation/pull/41) [`a72444e`](https://github.com/MadeRelevant/codemation/commit/a72444e25c4e744a9a90e231a59c93f8d90346e5) Thanks [@cblokland90](https://github.com/cblokland90)! - Add `WorkflowTestKit` and related engine test harness exports on `@codemation/core/testing`, with create-codemation templates and agent skills updated to document plugin unit tests.
14
+
15
+ ### Patch Changes
16
+
17
+ - [#41](https://github.com/MadeRelevant/codemation/pull/41) [`a72444e`](https://github.com/MadeRelevant/codemation/commit/a72444e25c4e744a9a90e231a59c93f8d90346e5) Thanks [@cblokland90](https://github.com/cblokland90)! - Normalize run persistence around work items, execution instances, and run slot projections, while aligning the HTTP/UI run detail flow to run-centric naming. This also fixes AI agent tool schema serialization, nested tool item propagation, and execution inspector/canvas status handling for inline scheduler workflows.
18
+
19
+ ## 0.1.0
20
+
21
+ ### Minor Changes
22
+
23
+ - [#39](https://github.com/MadeRelevant/codemation/pull/39) [`cbfe843`](https://github.com/MadeRelevant/codemation/commit/cbfe843ef2363e400a219f4d0bcd05b091ab83b4) Thanks [@cblokland90](https://github.com/cblokland90)! - Add `WorkflowTestKit` and related engine test harness exports on `@codemation/core/testing`, with create-codemation templates and agent skills updated to document plugin unit tests.
24
+
3
25
  ## 0.0.19
4
26
 
5
27
  ### Patch Changes
@@ -0,0 +1,42 @@
1
+ import { Ti as EngineExecutionLimitsPolicyConfig, ir as TriggerRuntimeDiagnostics, oi as DependencyContainer, xr as WebhookTriggerRoutingDiagnostics, yr as WebhookTriggerMatcher } from "./RunIntentService-BCvGdOSY.js";
2
+
3
+ //#region src/bootstrap/runtime/EngineRuntimeRegistration.types.d.ts
4
+
5
+ /**
6
+ * Creates the webhook route matcher used by {@link import("../api/Engine").Engine}.
7
+ * Hosts may supply logging/diagnostics; tests often use the default factory without diagnostics.
8
+ */
9
+ interface WebhookTriggerMatcherProvider {
10
+ createMatcher(container: DependencyContainer): WebhookTriggerMatcher;
11
+ }
12
+ /**
13
+ * Supplies optional trigger-runtime logging (inactive workflow skips, activation sync).
14
+ */
15
+ interface TriggerRuntimeDiagnosticsProvider {
16
+ create(container: DependencyContainer): TriggerRuntimeDiagnostics | undefined;
17
+ }
18
+ interface EngineRuntimeRegistrationOptions {
19
+ /**
20
+ * Static limits merged into the factory when the policy token is first resolved.
21
+ * Prefer {@link resolveEngineExecutionLimits} when limits can change after registration (e.g. host `useRuntimeConfig`).
22
+ */
23
+ engineExecutionLimits?: Partial<EngineExecutionLimitsPolicyConfig>;
24
+ /**
25
+ * Called when the limits policy is first resolved; overrides {@link engineExecutionLimits} when both are set.
26
+ * Use this for host wiring so `runtime.engineExecutionLimits` applied after `registerCoreInfrastructure` is honored.
27
+ */
28
+ resolveEngineExecutionLimits?: () => Partial<EngineExecutionLimitsPolicyConfig> | undefined;
29
+ /**
30
+ * When {@link webhookTriggerMatcherProvider} is omitted, the registrar builds
31
+ * {@link import("../../runtime/WorkflowRepositoryWebhookTriggerMatcher").WorkflowRepositoryWebhookTriggerMatcher}
32
+ * using this optional routing diagnostics surface.
33
+ */
34
+ webhookTriggerRoutingDiagnostics?: WebhookTriggerRoutingDiagnostics;
35
+ /** Overrides default webhook matcher construction (e.g. host-injected loggers). */
36
+ webhookTriggerMatcherProvider?: WebhookTriggerMatcherProvider;
37
+ /** Overrides default trigger diagnostics (undefined when omitted). */
38
+ triggerRuntimeDiagnosticsProvider?: TriggerRuntimeDiagnosticsProvider;
39
+ }
40
+ //#endregion
41
+ export { TriggerRuntimeDiagnosticsProvider as n, WebhookTriggerMatcherProvider as r, EngineRuntimeRegistrationOptions as t };
42
+ //# sourceMappingURL=EngineRuntimeRegistration.types-0sgV2XL2.d.ts.map
@@ -0,0 +1,73 @@
1
+ import { $n as PersistedWorkflowSnapshotNode, Ct as WorkflowId, I as Items, Lr as EngineExecutionLimitsPolicyConfig, Nn as WebhookTriggerRoutingDiagnostics, Qn as PersistedWorkflowSnapshot, Sn as WorkflowRepository, U as NodeConfigBase, Y as NodeId, _t as WorkflowDefinition, cr as RunResult, er as PersistedWorkflowTokenRegistryLike, gn as TriggerRuntimeDiagnostics, jn as WebhookTriggerMatcher, r as Engine, rt as ParentExecutionRef, vr as DependencyContainer } from "./RunIntentService-CV8izV8t.cjs";
2
+
3
+ //#region src/workflowSnapshots/WorkflowSnapshotCodec.d.ts
4
+ declare class WorkflowSnapshotCodec {
5
+ private readonly tokenRegistry;
6
+ constructor(tokenRegistry: PersistedWorkflowTokenRegistryLike);
7
+ create(workflow: WorkflowDefinition): PersistedWorkflowSnapshot;
8
+ hydrate(snapshotNode: PersistedWorkflowSnapshotNode, liveConfig: NodeConfigBase): NodeConfigBase;
9
+ private serializeConfig;
10
+ private injectTokenIds;
11
+ private mergeValue;
12
+ private mergeNestedValue;
13
+ private restoreNonSerializableProperties;
14
+ private restoreTypeProperty;
15
+ private resolveTokenId;
16
+ private resolveTokenName;
17
+ private asTypeToken;
18
+ private asRecord;
19
+ }
20
+ //#endregion
21
+ //#region src/bootstrap/runtime/EngineRuntimeRegistration.types.d.ts
22
+ /**
23
+ * Creates the webhook route matcher used by {@link import("../api/Engine").Engine}.
24
+ * Hosts may supply logging/diagnostics; tests often use the default factory without diagnostics.
25
+ */
26
+ interface WebhookTriggerMatcherProvider {
27
+ createMatcher(container: DependencyContainer): WebhookTriggerMatcher;
28
+ }
29
+ /**
30
+ * Supplies optional trigger-runtime logging (inactive workflow skips, activation sync).
31
+ */
32
+ interface TriggerRuntimeDiagnosticsProvider {
33
+ create(container: DependencyContainer): TriggerRuntimeDiagnostics | undefined;
34
+ }
35
+ interface EngineRuntimeRegistrationOptions {
36
+ /**
37
+ * Static limits merged into the factory when the policy token is first resolved.
38
+ * Prefer {@link resolveEngineExecutionLimits} when limits can change after registration (e.g. host `useRuntimeConfig`).
39
+ */
40
+ engineExecutionLimits?: Partial<EngineExecutionLimitsPolicyConfig>;
41
+ /**
42
+ * Called when the limits policy is first resolved; overrides {@link engineExecutionLimits} when both are set.
43
+ * Use this for host wiring so `runtime.engineExecutionLimits` applied after `registerCoreInfrastructure` is honored.
44
+ */
45
+ resolveEngineExecutionLimits?: () => Partial<EngineExecutionLimitsPolicyConfig> | undefined;
46
+ /**
47
+ * When {@link webhookTriggerMatcherProvider} is omitted, the registrar builds
48
+ * {@link import("../../runtime/WorkflowRepositoryWebhookTriggerMatcher").WorkflowRepositoryWebhookTriggerMatcher}
49
+ * using this optional routing diagnostics surface.
50
+ */
51
+ webhookTriggerRoutingDiagnostics?: WebhookTriggerRoutingDiagnostics;
52
+ /** Overrides default webhook matcher construction (e.g. host-injected loggers). */
53
+ webhookTriggerMatcherProvider?: WebhookTriggerMatcherProvider;
54
+ /** Overrides default trigger diagnostics (undefined when omitted). */
55
+ triggerRuntimeDiagnosticsProvider?: TriggerRuntimeDiagnosticsProvider;
56
+ }
57
+ //#endregion
58
+ //#region src/runtime/EngineWorkflowRunnerService.d.ts
59
+ declare class EngineWorkflowRunnerService {
60
+ private readonly engine;
61
+ private readonly workflowRepository;
62
+ constructor(engine: Engine, workflowRepository: WorkflowRepository);
63
+ runById(args: {
64
+ workflowId: WorkflowId;
65
+ startAt?: NodeId;
66
+ items: Items;
67
+ parent?: ParentExecutionRef;
68
+ }): Promise<RunResult>;
69
+ private findDefaultStartNodeId;
70
+ }
71
+ //#endregion
72
+ export { WorkflowSnapshotCodec as a, WebhookTriggerMatcherProvider as i, EngineRuntimeRegistrationOptions as n, TriggerRuntimeDiagnosticsProvider as r, EngineWorkflowRunnerService as t };
73
+ //# sourceMappingURL=EngineWorkflowRunnerService-Dx7bJsJR.d.cts.map
@@ -0,0 +1,94 @@
1
+ import { Bt as BinaryStorageStatResult, Ct as WorkflowId, H as NodeActivationId, Ht as BinaryStorageWriteResult, Jt as ExecutionContextFactory, Kt as ExecutionBinaryService, Lt as BinaryBody, Q as NodeOutputs, Rt as BinaryStorage, V as MutableRunData, Wr as RetryPolicySpec, Y as NodeId, b as CredentialSessionService, cn as NodeExecutionStatePublisher, ct as RunId, in as NodeExecutionContext, k as BinaryAttachment, ot as RunDataFactory, qt as ExecutionContext, rn as NodeBinaryAttachmentService, rt as ParentExecutionRef, st as RunDataSnapshot, zt as BinaryStorageReadResult } from "./RunIntentService-CV8izV8t.cjs";
2
+
3
+ //#region src/execution/CredentialResolverFactory.d.ts
4
+ declare class CredentialResolverFactory {
5
+ private readonly credentialSessions;
6
+ constructor(credentialSessions: CredentialSessionService);
7
+ create(workflowId: WorkflowId, nodeId: NodeId, config?: NodeExecutionContext["config"]): NodeExecutionContext["getCredential"];
8
+ }
9
+ //#endregion
10
+ //#region src/execution/asyncSleeper.types.d.ts
11
+ interface AsyncSleeper {
12
+ sleep(ms: number): Promise<void>;
13
+ }
14
+ //#endregion
15
+ //#region src/execution/DefaultAsyncSleeper.d.ts
16
+ declare class DefaultAsyncSleeper implements AsyncSleeper {
17
+ sleep(ms: number): Promise<void>;
18
+ }
19
+ //#endregion
20
+ //#region src/execution/DefaultExecutionContextFactory.d.ts
21
+ declare class DefaultExecutionContextFactory implements ExecutionContextFactory {
22
+ private readonly binaryStorage;
23
+ private readonly currentDate;
24
+ constructor(binaryStorage?: BinaryStorage, currentDate?: () => Date);
25
+ create(args: {
26
+ runId: RunId;
27
+ workflowId: WorkflowId;
28
+ parent?: ParentExecutionRef;
29
+ subworkflowDepth: number;
30
+ engineMaxNodeActivations: number;
31
+ engineMaxSubworkflowDepth: number;
32
+ data: RunDataSnapshot;
33
+ nodeState?: NodeExecutionStatePublisher;
34
+ getCredential<TSession = unknown>(slotKey: string): Promise<TSession>;
35
+ }): ExecutionContext;
36
+ }
37
+ //#endregion
38
+ //#region src/execution/InProcessRetryRunner.d.ts
39
+ declare class InProcessRetryRunner {
40
+ private readonly sleeper;
41
+ constructor(sleeper: AsyncSleeper);
42
+ run<T>(policy: RetryPolicySpec | undefined, work: () => Promise<T>): Promise<T>;
43
+ private static delayAfterFailureMs;
44
+ private static normalizePolicy;
45
+ private static assertPositiveInt;
46
+ private static assertNonNegativeFinite;
47
+ private static assertMultiplier;
48
+ }
49
+ //#endregion
50
+ //#region src/binaries/UnavailableBinaryStorage.d.ts
51
+ declare class UnavailableBinaryStorage implements BinaryStorage {
52
+ readonly driverName = "unavailable";
53
+ write(): Promise<never>;
54
+ openReadStream(): Promise<undefined>;
55
+ stat(): Promise<{
56
+ exists: false;
57
+ }>;
58
+ delete(): Promise<void>;
59
+ }
60
+ //#endregion
61
+ //#region src/binaries/DefaultExecutionBinaryServiceFactory.d.ts
62
+ declare class DefaultExecutionBinaryService implements ExecutionBinaryService {
63
+ private readonly storage;
64
+ private readonly workflowId;
65
+ private readonly runId;
66
+ private readonly now;
67
+ constructor(storage: BinaryStorage, workflowId: WorkflowId, runId: RunId, now: () => Date);
68
+ forNode(args: {
69
+ nodeId: NodeId;
70
+ activationId: NodeActivationId;
71
+ }): NodeBinaryAttachmentService;
72
+ openReadStream(attachment: BinaryAttachment): Promise<BinaryStorageReadResult | undefined>;
73
+ }
74
+ //#endregion
75
+ //#region src/runStorage/InMemoryBinaryStorageRegistry.d.ts
76
+ declare class InMemoryBinaryStorage implements BinaryStorage {
77
+ readonly driverName = "memory";
78
+ private readonly values;
79
+ write(args: {
80
+ storageKey: string;
81
+ body: BinaryBody;
82
+ }): Promise<BinaryStorageWriteResult>;
83
+ openReadStream(storageKey: string): Promise<BinaryStorageReadResult | undefined>;
84
+ stat(storageKey: string): Promise<BinaryStorageStatResult>;
85
+ delete(storageKey: string): Promise<void>;
86
+ }
87
+ //#endregion
88
+ //#region src/runStorage/InMemoryRunDataFactory.d.ts
89
+ declare class InMemoryRunDataFactory implements RunDataFactory {
90
+ create(initial?: Record<NodeId, NodeOutputs>): MutableRunData;
91
+ }
92
+ //#endregion
93
+ export { InProcessRetryRunner as a, AsyncSleeper as c, UnavailableBinaryStorage as i, CredentialResolverFactory as l, InMemoryBinaryStorage as n, DefaultExecutionContextFactory as o, DefaultExecutionBinaryService as r, DefaultAsyncSleeper as s, InMemoryRunDataFactory as t };
94
+ //# sourceMappingURL=InMemoryRunDataFactory-qIYQEar7.d.cts.map