@codemation/core-nodes-ocr 0.2.0

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 (43) hide show
  1. package/CHANGELOG.md +62 -0
  2. package/LICENSE +37 -0
  3. package/README.md +67 -0
  4. package/codemation.plugin.ts +27 -0
  5. package/dist/analyzeInvoiceNode-BIw8j_Zb.cjs +360 -0
  6. package/dist/analyzeInvoiceNode-BIw8j_Zb.cjs.map +1 -0
  7. package/dist/analyzeInvoiceNode-uVwe3GHD.js +321 -0
  8. package/dist/analyzeInvoiceNode-uVwe3GHD.js.map +1 -0
  9. package/dist/chunk-BaqVhFee.cjs +46 -0
  10. package/dist/codemation.plugin.cjs +17891 -0
  11. package/dist/codemation.plugin.cjs.map +1 -0
  12. package/dist/codemation.plugin.d.cts +325 -0
  13. package/dist/codemation.plugin.d.ts +266 -0
  14. package/dist/codemation.plugin.js +17883 -0
  15. package/dist/codemation.plugin.js.map +1 -0
  16. package/dist/index-C2KJPzqN.d.ts +876 -0
  17. package/dist/index-DoHR1J8T.d.ts +880 -0
  18. package/dist/index-OvXJkNm1.d.ts +874 -0
  19. package/dist/index.cjs +8 -0
  20. package/dist/index.d.cts +199 -0
  21. package/dist/index.d.ts +147 -0
  22. package/dist/index.js +3 -0
  23. package/dist/metadata.json +72 -0
  24. package/dist/runtimeTypes-C6YqmQG-.d.cts +762 -0
  25. package/dist/runtimeTypes-ffl603pJ.d.cts +764 -0
  26. package/dist/token-CIu4PqRI.js +58 -0
  27. package/dist/token-CIu4PqRI.js.map +1 -0
  28. package/dist/token-CgF09kyP.cjs +62 -0
  29. package/dist/token-CgF09kyP.cjs.map +1 -0
  30. package/dist/token-util-B2kSJtEV.cjs +458 -0
  31. package/dist/token-util-B2kSJtEV.cjs.map +1 -0
  32. package/dist/token-util-BsR6OYHz.js +5 -0
  33. package/dist/token-util-EUxa8JtH.js +470 -0
  34. package/dist/token-util-EUxa8JtH.js.map +1 -0
  35. package/dist/token-util-Lr5foG4r.cjs +8 -0
  36. package/package.json +70 -0
  37. package/src/credentials/azureContentUnderstandingCredential.ts +76 -0
  38. package/src/index.ts +5 -0
  39. package/src/lib/analyzeWithAzure.ts +130 -0
  40. package/src/lib/readBinaryBody.ts +51 -0
  41. package/src/nodes/analyzeDocumentNode.ts +70 -0
  42. package/src/nodes/analyzeImageNode.ts +70 -0
  43. package/src/nodes/analyzeInvoiceNode.ts +61 -0
@@ -0,0 +1,325 @@
1
+ import { l as WorkflowDefinition, n as TypeToken, t as Container, u as AnyCredentialType } from "./runtimeTypes-ffl603pJ.cjs";
2
+ import { BetterAuthOptions } from "better-auth";
3
+
4
+ //#region ../core/src/contracts/mcpTypes.d.ts
5
+ type McpServerTransport = "http";
6
+ interface McpServerDeclaration {
7
+ /** Globally unique slug, e.g. "gmail". Workflow authors reference this. */
8
+ id: string;
9
+ displayName: string;
10
+ description: string;
11
+ transport: McpServerTransport;
12
+ url: string;
13
+ /**
14
+ * Credential types accepted by this MCP server, matching CredentialRequirement.acceptedTypes.
15
+ * Absent or empty means no credential is required.
16
+ */
17
+ acceptedCredentialTypes?: ReadonlyArray<string>;
18
+ /**
19
+ * Documentation only in MVP. The bind-time validator checks
20
+ * requiredScopes ⊆ CredentialInstance.scopesGranted.
21
+ */
22
+ requiredScopes?: string[];
23
+ /** Non-secret static headers merged onto every MCP request. */
24
+ staticHeaders?: Record<string, string>;
25
+ /**
26
+ * Overrides for tool descriptions advertised by the MCP server.
27
+ * Applied by the connection pool after tools/list.
28
+ * Key: exact tool name as returned by the server.
29
+ */
30
+ toolDescriptionOverrides?: Record<string, string>;
31
+ }
32
+ //#endregion
33
+ //#region ../core/src/policies/executionLimits/EngineExecutionLimitsPolicy.d.ts
34
+ interface EngineExecutionLimitsPolicyConfig {
35
+ readonly defaultMaxNodeActivations: number;
36
+ readonly hardMaxNodeActivations: number;
37
+ readonly defaultMaxSubworkflowDepth: number;
38
+ readonly hardMaxSubworkflowDepth: number;
39
+ }
40
+ //#endregion
41
+ //#region ../core/src/authoring/defineCollection.types.d.ts
42
+ type CollectionFieldType = "text" | "int" | "bigint" | "double" | "bool" | "timestamptz" | "jsonb" | "uuid";
43
+ interface CollectionFieldDefinition {
44
+ readonly type: CollectionFieldType;
45
+ readonly nullable: boolean;
46
+ readonly default?: unknown;
47
+ }
48
+ interface CollectionIndexDefinition {
49
+ readonly on: ReadonlyArray<string>;
50
+ readonly unique?: boolean;
51
+ }
52
+ interface CollectionDefinition {
53
+ readonly name: string;
54
+ readonly fields: Readonly<Record<string, CollectionFieldDefinition>>;
55
+ readonly indexes: ReadonlyArray<CollectionIndexDefinition>;
56
+ }
57
+ interface DefinedCollection<TDefinition extends CollectionDefinition = CollectionDefinition> {
58
+ readonly kind: "defined-collection";
59
+ readonly definition: TDefinition;
60
+ register(context: {
61
+ registerCollection(d: CollectionDefinition): void;
62
+ }): void;
63
+ }
64
+ //#endregion
65
+ //#region ../host/src/presentation/config/CodemationClassToken.d.ts
66
+ type CodemationClassToken<TValue> = TypeToken<TValue> & (new (...args: never[]) => TValue);
67
+ //#endregion
68
+ //#region ../host/src/bootstrap/CodemationContainerRegistration.d.ts
69
+ interface CodemationContainerRegistrationBase<TValue> {
70
+ readonly token: TypeToken<TValue>;
71
+ }
72
+ interface CodemationValueRegistration<TValue> extends CodemationContainerRegistrationBase<TValue> {
73
+ readonly useValue: TValue;
74
+ }
75
+ interface CodemationClassRegistration<TValue> extends CodemationContainerRegistrationBase<TValue> {
76
+ readonly useClass: CodemationClassToken<TValue>;
77
+ }
78
+ interface CodemationFactoryRegistration<TValue> extends CodemationContainerRegistrationBase<TValue> {
79
+ readonly useFactory: (container: Container) => TValue;
80
+ }
81
+ type CodemationContainerRegistration<TValue = unknown> = CodemationValueRegistration<TValue> | CodemationClassRegistration<TValue> | CodemationFactoryRegistration<TValue>;
82
+ //#endregion
83
+ //#region ../host/src/application/logging/Logger.d.ts
84
+ interface Logger {
85
+ info(message: string, exception?: Error): void;
86
+ warn(message: string, exception?: Error): void;
87
+ error(message: string, exception?: Error): void;
88
+ debug(message: string, exception?: Error): void;
89
+ }
90
+ interface LoggerFactory {
91
+ create(scope: string): Logger;
92
+ }
93
+ //#endregion
94
+ //#region ../host/src/presentation/config/CodemationAuthConfig.d.ts
95
+ /**
96
+ * Consumer-declared authentication profile for the hosted UI + HTTP API.
97
+ * Social provider ids intentionally match Better Auth's provider ids so config stays 1:1 with the auth runtime.
98
+ */
99
+ type CodemationAuthKind = "local" | "oauth" | "oidc" | "managed";
100
+ type CodemationAuthOAuthProviderId = Extract<keyof NonNullable<BetterAuthOptions["socialProviders"]>, "github" | "google" | "microsoft">;
101
+ interface CodemationAuthOAuthProviderConfig {
102
+ readonly provider: CodemationAuthOAuthProviderId;
103
+ readonly clientIdEnv: string;
104
+ readonly clientSecretEnv: string;
105
+ /** Microsoft tenant; environment variable name whose value is the tenant ID. */
106
+ readonly tenantIdEnv?: string;
107
+ }
108
+ interface CodemationAuthOidcProviderConfig {
109
+ readonly id: string;
110
+ readonly issuer: string;
111
+ readonly clientIdEnv: string;
112
+ readonly clientSecretEnv: string;
113
+ }
114
+ interface CodemationAuthConfig {
115
+ readonly kind: CodemationAuthKind;
116
+ /**
117
+ * When true and NODE_ENV is not production, the API accepts requests without a real session
118
+ * (synthetic principal only — never honored in production).
119
+ */
120
+ readonly allowUnauthenticatedInDevelopment?: boolean;
121
+ readonly oauth?: ReadonlyArray<CodemationAuthOAuthProviderConfig>;
122
+ readonly oidc?: ReadonlyArray<CodemationAuthOidcProviderConfig>;
123
+ }
124
+ //#endregion
125
+ //#region ../host/src/presentation/config/CodemationLogConfig.d.ts
126
+ /**
127
+ * Minimum level for namespaces matched by {@link CodemationLogRule.filter}.
128
+ * `silent` suppresses all log lines for matching namespaces.
129
+ */
130
+ type CodemationLogLevelName = "debug" | "info" | "warn" | "error" | "silent";
131
+ /**
132
+ * One rule: {@link filter} is one glob or several (`*` = any substring; a lone `*` matches all namespaces).
133
+ * If multiple patterns are given, **any** match applies this rule’s level.
134
+ * Rules are evaluated in order; the **first** rule whose filter set matches wins.
135
+ */
136
+ type CodemationLogRule = Readonly<{
137
+ filter: string | ReadonlyArray<string>;
138
+ level: CodemationLogLevelName;
139
+ }>;
140
+ /**
141
+ * Either a single rule (`{ filter, level }`) or multiple `{ rules: [...] }`.
142
+ * Put broader patterns last, e.g. `{ filter: "codemation.webhooks.*", level: "info" }` then `{ filter: "*", level: "warn" }`.
143
+ * Use an array for `filter` to match several namespaces with the same level, e.g. `filter: ["codemation.webhooks.*", "codemation.engine.triggers"]`.
144
+ */
145
+ type CodemationLogConfig = Readonly<{
146
+ rules: ReadonlyArray<CodemationLogRule>;
147
+ }> | CodemationLogRule;
148
+ //#endregion
149
+ //#region ../host/src/presentation/config/CodemationWhitelabelConfig.d.ts
150
+ /**
151
+ * Optional host shell whitelabeling (sidebar, login, document title).
152
+ * `logoPath` is resolved relative to the consumer project root.
153
+ */
154
+ interface CodemationWhitelabelConfig {
155
+ readonly productName?: string;
156
+ /** Relative to consumer project root, e.g. `branding/logo.svg`. */
157
+ readonly logoPath?: string;
158
+ }
159
+ //#endregion
160
+ //#region ../host/src/presentation/config/CodemationWorkflowDiscovery.d.ts
161
+ interface CodemationWorkflowDiscovery {
162
+ readonly directories?: ReadonlyArray<string>;
163
+ }
164
+ //#endregion
165
+ //#region ../host/src/presentation/config/CodemationConfig.d.ts
166
+ type CodemationEventBusKind = "memory" | "redis";
167
+ type CodemationSchedulerKind = "local" | "bullmq";
168
+ type CodemationDatabaseKind = "postgresql" | "sqlite";
169
+ interface CodemationDatabaseConfig {
170
+ readonly kind?: CodemationDatabaseKind;
171
+ /** TCP PostgreSQL URL when `kind` is `postgresql` (or omitted with a postgres URL). */
172
+ readonly url?: string;
173
+ /** SQLite database file path when `kind` is `sqlite`. Relative paths resolve from the consumer app root. */
174
+ readonly sqliteFilePath?: string;
175
+ }
176
+ interface CodemationEventBusConfig {
177
+ readonly kind?: CodemationEventBusKind;
178
+ readonly redisUrl?: string;
179
+ readonly queuePrefix?: string;
180
+ }
181
+ interface CodemationSchedulerConfig {
182
+ readonly kind?: CodemationSchedulerKind;
183
+ readonly queuePrefix?: string;
184
+ readonly workerQueues?: ReadonlyArray<string>;
185
+ }
186
+ type CodemationAppSchedulerKind = "inline" | "queue";
187
+ interface CodemationAppSchedulerConfig {
188
+ readonly kind?: CodemationAppSchedulerKind;
189
+ readonly queuePrefix?: string;
190
+ readonly workerQueues?: ReadonlyArray<string>;
191
+ readonly redisUrl?: string;
192
+ }
193
+ /**
194
+ * Optional overrides for engine execution limits (activation budget and subworkflow depth caps).
195
+ * Omitted fields keep framework defaults. Advanced users can bind `CoreTokens.EngineExecutionLimitsPolicy` for full control.
196
+ */
197
+ type CodemationEngineExecutionLimitsConfig = Readonly<Partial<EngineExecutionLimitsPolicyConfig>>;
198
+ interface CodemationAppDefinition {
199
+ readonly frontendPort?: number;
200
+ readonly databaseUrl?: string;
201
+ readonly database?: CodemationDatabaseConfig;
202
+ readonly scheduler?: CodemationAppSchedulerConfig;
203
+ readonly auth?: CodemationAuthConfig;
204
+ readonly whitelabel?: CodemationWhitelabelConfig;
205
+ readonly log?: CodemationLogConfig;
206
+ readonly engineExecutionLimits?: CodemationEngineExecutionLimitsConfig;
207
+ }
208
+ interface CodemationApplicationRuntimeConfig {
209
+ readonly frontendPort?: number;
210
+ readonly database?: CodemationDatabaseConfig;
211
+ readonly eventBus?: CodemationEventBusConfig;
212
+ readonly scheduler?: CodemationSchedulerConfig;
213
+ /** Merged with engine defaults when building the execution limits policy (API + workers). */
214
+ readonly engineExecutionLimits?: CodemationEngineExecutionLimitsConfig;
215
+ }
216
+ interface CodemationConfig {
217
+ readonly app?: CodemationAppDefinition;
218
+ readonly register?: (context: CodemationAppContext) => void;
219
+ readonly runtime?: CodemationApplicationRuntimeConfig;
220
+ readonly workflows?: ReadonlyArray<WorkflowDefinition>;
221
+ readonly workflowDiscovery?: CodemationWorkflowDiscovery;
222
+ readonly plugins?: ReadonlyArray<CodemationPlugin>;
223
+ /** Consumer-defined `CredentialType` entries (see `@codemation/core`), applied when the host loads config. */
224
+ readonly credentialTypes?: ReadonlyArray<AnyCredentialType>;
225
+ /** MCP server declarations from this config file (merged with plugin and control-plane sources at startup). */
226
+ readonly mcpServers?: ReadonlyArray<McpServerDeclaration>;
227
+ /** Declared collections available at runtime via `ctx.collections`. Accepts either raw `CollectionDefinition` or `DefinedCollection` (the result of `defineCollection(...)`). */
228
+ readonly collections?: ReadonlyArray<CollectionDefinition | DefinedCollection>;
229
+ /** Optional shell whitelabel (product name, logo path). */
230
+ readonly whitelabel?: CodemationWhitelabelConfig;
231
+ /** Required for production hosts; optional only when using development bypass (never in production). */
232
+ readonly auth?: CodemationAuthConfig;
233
+ /**
234
+ * Namespace-level log filters (first matching rule wins). Unmatched namespaces use `CODEMATION_LOG_LEVEL` / defaults.
235
+ * Omit to keep env-only behavior.
236
+ */
237
+ readonly log?: CodemationLogConfig;
238
+ }
239
+ //#endregion
240
+ //#region ../host/src/presentation/config/CodemationPlugin.d.ts
241
+ interface CodemationPluginContext extends CodemationRegistrationContextBase {
242
+ readonly container: Container;
243
+ readonly appConfig: AppConfig;
244
+ readonly loggerFactory: LoggerFactory;
245
+ }
246
+ interface CodemationPluginConfig {
247
+ readonly pluginPackageId?: string;
248
+ readonly credentialTypes?: ReadonlyArray<AnyCredentialType>;
249
+ readonly mcpServers?: ReadonlyArray<McpServerDeclaration>;
250
+ readonly register?: (context: CodemationPluginContext) => void | Promise<void>;
251
+ readonly sandbox?: CodemationConfig;
252
+ }
253
+ type CodemationPlugin = CodemationPluginConfig;
254
+ //#endregion
255
+ //#region ../host/src/presentation/config/AppConfig.d.ts
256
+ type AppPersistenceConfig = Readonly<{
257
+ kind: "none";
258
+ }> | Readonly<{
259
+ kind: "postgresql";
260
+ databaseUrl: string;
261
+ }> | Readonly<{
262
+ kind: "sqlite";
263
+ databaseFilePath: string;
264
+ }>;
265
+ type AppPluginLoadSummary = Readonly<{
266
+ packageName: string;
267
+ source: "configured" | "discovered";
268
+ }>;
269
+ interface AppConfig {
270
+ readonly consumerRoot: string;
271
+ readonly repoRoot: string;
272
+ readonly env: Readonly<NodeJS.ProcessEnv>;
273
+ readonly workflowSources: ReadonlyArray<string>;
274
+ readonly workflows: ReadonlyArray<WorkflowDefinition>;
275
+ readonly containerRegistrations: ReadonlyArray<CodemationContainerRegistration<unknown>>;
276
+ readonly credentialTypes: ReadonlyArray<AnyCredentialType>;
277
+ readonly collections: ReadonlyArray<CollectionDefinition>;
278
+ readonly plugins: ReadonlyArray<CodemationPlugin>;
279
+ readonly pluginLoadSummary?: ReadonlyArray<AppPluginLoadSummary>;
280
+ readonly mcpServers: ReadonlyArray<McpServerDeclaration>;
281
+ readonly hasConfiguredCredentialSessionServiceRegistration: boolean;
282
+ readonly log?: CodemationLogConfig;
283
+ readonly engineExecutionLimits?: CodemationEngineExecutionLimitsConfig;
284
+ readonly databaseUrl?: string;
285
+ readonly database?: CodemationDatabaseConfig;
286
+ readonly persistence: AppPersistenceConfig;
287
+ readonly scheduler: Readonly<{
288
+ kind: CodemationSchedulerKind;
289
+ queuePrefix?: string;
290
+ workerQueues: ReadonlyArray<string>;
291
+ redisUrl?: string;
292
+ }>;
293
+ readonly eventing: Readonly<{
294
+ kind: CodemationEventBusKind;
295
+ queuePrefix?: string;
296
+ redisUrl?: string;
297
+ }>;
298
+ readonly auth?: CodemationAuthConfig;
299
+ readonly whitelabel: CodemationWhitelabelConfig;
300
+ readonly webSocketPort: number;
301
+ readonly webSocketBindHost: string;
302
+ }
303
+ //#endregion
304
+ //#region ../host/src/presentation/config/CodemationAppContext.d.ts
305
+ interface CodemationRegistrationContextBase {
306
+ readonly appConfig?: AppConfig;
307
+ registerCredentialType(type: AnyCredentialType): void;
308
+ registerCollection(definition: CollectionDefinition): void;
309
+ registerNode<TValue>(token: TypeToken<TValue>, implementation?: CodemationClassToken<TValue>): void;
310
+ registerValue<TValue>(token: TypeToken<TValue>, value: TValue): void;
311
+ registerClass<TValue>(token: TypeToken<TValue>, implementation: CodemationClassToken<TValue>): void;
312
+ registerFactory<TValue>(token: TypeToken<TValue>, factory: (container: Container) => TValue): void;
313
+ }
314
+ interface CodemationAppContext extends CodemationRegistrationContextBase {
315
+ registerWorkflow(workflow: WorkflowDefinition): void;
316
+ registerWorkflows(workflows: ReadonlyArray<WorkflowDefinition>): void;
317
+ discoverWorkflows(...directories: ReadonlyArray<string>): void;
318
+ }
319
+ //#endregion
320
+ //#region codemation.plugin.d.ts
321
+ declare const plugin: CodemationPluginConfig & Readonly<{
322
+ sandbox?: CodemationConfig;
323
+ }>;
324
+ export = plugin;
325
+ //# sourceMappingURL=codemation.plugin.d.cts.map
@@ -0,0 +1,266 @@
1
+ import { a as TypeToken, c as WorkflowDefinition, i as Container, l as AnyCredentialType, n as DefinedCollection, o as EngineExecutionLimitsPolicyConfig, s as McpServerDeclaration, t as CollectionDefinition } from "./index-C2KJPzqN.js";
2
+ import { ZodType, z } from "zod";
3
+ import { BetterAuthOptions } from "better-auth";
4
+
5
+ //#region ../host/src/presentation/config/CodemationClassToken.d.ts
6
+ type CodemationClassToken<TValue> = TypeToken<TValue> & (new (...args: never[]) => TValue);
7
+ //#endregion
8
+ //#region ../host/src/bootstrap/CodemationContainerRegistration.d.ts
9
+ interface CodemationContainerRegistrationBase<TValue> {
10
+ readonly token: TypeToken<TValue>;
11
+ }
12
+ interface CodemationValueRegistration<TValue> extends CodemationContainerRegistrationBase<TValue> {
13
+ readonly useValue: TValue;
14
+ }
15
+ interface CodemationClassRegistration<TValue> extends CodemationContainerRegistrationBase<TValue> {
16
+ readonly useClass: CodemationClassToken<TValue>;
17
+ }
18
+ interface CodemationFactoryRegistration<TValue> extends CodemationContainerRegistrationBase<TValue> {
19
+ readonly useFactory: (container: Container) => TValue;
20
+ }
21
+ type CodemationContainerRegistration<TValue = unknown> = CodemationValueRegistration<TValue> | CodemationClassRegistration<TValue> | CodemationFactoryRegistration<TValue>;
22
+ //#endregion
23
+ //#region ../host/src/application/logging/Logger.d.ts
24
+ interface Logger {
25
+ info(message: string, exception?: Error): void;
26
+ warn(message: string, exception?: Error): void;
27
+ error(message: string, exception?: Error): void;
28
+ debug(message: string, exception?: Error): void;
29
+ }
30
+ interface LoggerFactory {
31
+ create(scope: string): Logger;
32
+ }
33
+ //#endregion
34
+ //#region ../host/src/presentation/config/CodemationAuthConfig.d.ts
35
+ /**
36
+ * Consumer-declared authentication profile for the hosted UI + HTTP API.
37
+ * Social provider ids intentionally match Better Auth's provider ids so config stays 1:1 with the auth runtime.
38
+ */
39
+ type CodemationAuthKind = "local" | "oauth" | "oidc" | "managed";
40
+ type CodemationAuthOAuthProviderId = Extract<keyof NonNullable<BetterAuthOptions["socialProviders"]>, "github" | "google" | "microsoft">;
41
+ interface CodemationAuthOAuthProviderConfig {
42
+ readonly provider: CodemationAuthOAuthProviderId;
43
+ readonly clientIdEnv: string;
44
+ readonly clientSecretEnv: string;
45
+ /** Microsoft tenant; environment variable name whose value is the tenant ID. */
46
+ readonly tenantIdEnv?: string;
47
+ }
48
+ interface CodemationAuthOidcProviderConfig {
49
+ readonly id: string;
50
+ readonly issuer: string;
51
+ readonly clientIdEnv: string;
52
+ readonly clientSecretEnv: string;
53
+ }
54
+ interface CodemationAuthConfig {
55
+ readonly kind: CodemationAuthKind;
56
+ /**
57
+ * When true and NODE_ENV is not production, the API accepts requests without a real session
58
+ * (synthetic principal only — never honored in production).
59
+ */
60
+ readonly allowUnauthenticatedInDevelopment?: boolean;
61
+ readonly oauth?: ReadonlyArray<CodemationAuthOAuthProviderConfig>;
62
+ readonly oidc?: ReadonlyArray<CodemationAuthOidcProviderConfig>;
63
+ }
64
+ //#endregion
65
+ //#region ../host/src/presentation/config/CodemationLogConfig.d.ts
66
+ /**
67
+ * Minimum level for namespaces matched by {@link CodemationLogRule.filter}.
68
+ * `silent` suppresses all log lines for matching namespaces.
69
+ */
70
+ type CodemationLogLevelName = "debug" | "info" | "warn" | "error" | "silent";
71
+ /**
72
+ * One rule: {@link filter} is one glob or several (`*` = any substring; a lone `*` matches all namespaces).
73
+ * If multiple patterns are given, **any** match applies this rule’s level.
74
+ * Rules are evaluated in order; the **first** rule whose filter set matches wins.
75
+ */
76
+ type CodemationLogRule = Readonly<{
77
+ filter: string | ReadonlyArray<string>;
78
+ level: CodemationLogLevelName;
79
+ }>;
80
+ /**
81
+ * Either a single rule (`{ filter, level }`) or multiple `{ rules: [...] }`.
82
+ * Put broader patterns last, e.g. `{ filter: "codemation.webhooks.*", level: "info" }` then `{ filter: "*", level: "warn" }`.
83
+ * Use an array for `filter` to match several namespaces with the same level, e.g. `filter: ["codemation.webhooks.*", "codemation.engine.triggers"]`.
84
+ */
85
+ type CodemationLogConfig = Readonly<{
86
+ rules: ReadonlyArray<CodemationLogRule>;
87
+ }> | CodemationLogRule;
88
+ //#endregion
89
+ //#region ../host/src/presentation/config/CodemationWhitelabelConfig.d.ts
90
+ /**
91
+ * Optional host shell whitelabeling (sidebar, login, document title).
92
+ * `logoPath` is resolved relative to the consumer project root.
93
+ */
94
+ interface CodemationWhitelabelConfig {
95
+ readonly productName?: string;
96
+ /** Relative to consumer project root, e.g. `branding/logo.svg`. */
97
+ readonly logoPath?: string;
98
+ }
99
+ //#endregion
100
+ //#region ../host/src/presentation/config/CodemationWorkflowDiscovery.d.ts
101
+ interface CodemationWorkflowDiscovery {
102
+ readonly directories?: ReadonlyArray<string>;
103
+ }
104
+ //#endregion
105
+ //#region ../host/src/presentation/config/CodemationConfig.d.ts
106
+ type CodemationEventBusKind = "memory" | "redis";
107
+ type CodemationSchedulerKind = "local" | "bullmq";
108
+ type CodemationDatabaseKind = "postgresql" | "sqlite";
109
+ interface CodemationDatabaseConfig {
110
+ readonly kind?: CodemationDatabaseKind;
111
+ /** TCP PostgreSQL URL when `kind` is `postgresql` (or omitted with a postgres URL). */
112
+ readonly url?: string;
113
+ /** SQLite database file path when `kind` is `sqlite`. Relative paths resolve from the consumer app root. */
114
+ readonly sqliteFilePath?: string;
115
+ }
116
+ interface CodemationEventBusConfig {
117
+ readonly kind?: CodemationEventBusKind;
118
+ readonly redisUrl?: string;
119
+ readonly queuePrefix?: string;
120
+ }
121
+ interface CodemationSchedulerConfig {
122
+ readonly kind?: CodemationSchedulerKind;
123
+ readonly queuePrefix?: string;
124
+ readonly workerQueues?: ReadonlyArray<string>;
125
+ }
126
+ type CodemationAppSchedulerKind = "inline" | "queue";
127
+ interface CodemationAppSchedulerConfig {
128
+ readonly kind?: CodemationAppSchedulerKind;
129
+ readonly queuePrefix?: string;
130
+ readonly workerQueues?: ReadonlyArray<string>;
131
+ readonly redisUrl?: string;
132
+ }
133
+ /**
134
+ * Optional overrides for engine execution limits (activation budget and subworkflow depth caps).
135
+ * Omitted fields keep framework defaults. Advanced users can bind `CoreTokens.EngineExecutionLimitsPolicy` for full control.
136
+ */
137
+ type CodemationEngineExecutionLimitsConfig = Readonly<Partial<EngineExecutionLimitsPolicyConfig>>;
138
+ interface CodemationAppDefinition {
139
+ readonly frontendPort?: number;
140
+ readonly databaseUrl?: string;
141
+ readonly database?: CodemationDatabaseConfig;
142
+ readonly scheduler?: CodemationAppSchedulerConfig;
143
+ readonly auth?: CodemationAuthConfig;
144
+ readonly whitelabel?: CodemationWhitelabelConfig;
145
+ readonly log?: CodemationLogConfig;
146
+ readonly engineExecutionLimits?: CodemationEngineExecutionLimitsConfig;
147
+ }
148
+ interface CodemationApplicationRuntimeConfig {
149
+ readonly frontendPort?: number;
150
+ readonly database?: CodemationDatabaseConfig;
151
+ readonly eventBus?: CodemationEventBusConfig;
152
+ readonly scheduler?: CodemationSchedulerConfig;
153
+ /** Merged with engine defaults when building the execution limits policy (API + workers). */
154
+ readonly engineExecutionLimits?: CodemationEngineExecutionLimitsConfig;
155
+ }
156
+ interface CodemationConfig {
157
+ readonly app?: CodemationAppDefinition;
158
+ readonly register?: (context: CodemationAppContext) => void;
159
+ readonly runtime?: CodemationApplicationRuntimeConfig;
160
+ readonly workflows?: ReadonlyArray<WorkflowDefinition>;
161
+ readonly workflowDiscovery?: CodemationWorkflowDiscovery;
162
+ readonly plugins?: ReadonlyArray<CodemationPlugin>;
163
+ /** Consumer-defined `CredentialType` entries (see `@codemation/core`), applied when the host loads config. */
164
+ readonly credentialTypes?: ReadonlyArray<AnyCredentialType>;
165
+ /** MCP server declarations from this config file (merged with plugin and control-plane sources at startup). */
166
+ readonly mcpServers?: ReadonlyArray<McpServerDeclaration>;
167
+ /** Declared collections available at runtime via `ctx.collections`. Accepts either raw `CollectionDefinition` or `DefinedCollection` (the result of `defineCollection(...)`). */
168
+ readonly collections?: ReadonlyArray<CollectionDefinition | DefinedCollection>;
169
+ /** Optional shell whitelabel (product name, logo path). */
170
+ readonly whitelabel?: CodemationWhitelabelConfig;
171
+ /** Required for production hosts; optional only when using development bypass (never in production). */
172
+ readonly auth?: CodemationAuthConfig;
173
+ /**
174
+ * Namespace-level log filters (first matching rule wins). Unmatched namespaces use `CODEMATION_LOG_LEVEL` / defaults.
175
+ * Omit to keep env-only behavior.
176
+ */
177
+ readonly log?: CodemationLogConfig;
178
+ }
179
+ //#endregion
180
+ //#region ../host/src/presentation/config/CodemationPlugin.d.ts
181
+ interface CodemationPluginContext extends CodemationRegistrationContextBase {
182
+ readonly container: Container;
183
+ readonly appConfig: AppConfig;
184
+ readonly loggerFactory: LoggerFactory;
185
+ }
186
+ interface CodemationPluginConfig {
187
+ readonly pluginPackageId?: string;
188
+ readonly credentialTypes?: ReadonlyArray<AnyCredentialType>;
189
+ readonly mcpServers?: ReadonlyArray<McpServerDeclaration>;
190
+ readonly register?: (context: CodemationPluginContext) => void | Promise<void>;
191
+ readonly sandbox?: CodemationConfig;
192
+ }
193
+ type CodemationPlugin = CodemationPluginConfig;
194
+ //#endregion
195
+ //#region ../host/src/presentation/config/AppConfig.d.ts
196
+ type AppPersistenceConfig = Readonly<{
197
+ kind: "none";
198
+ }> | Readonly<{
199
+ kind: "postgresql";
200
+ databaseUrl: string;
201
+ }> | Readonly<{
202
+ kind: "sqlite";
203
+ databaseFilePath: string;
204
+ }>;
205
+ type AppPluginLoadSummary = Readonly<{
206
+ packageName: string;
207
+ source: "configured" | "discovered";
208
+ }>;
209
+ interface AppConfig {
210
+ readonly consumerRoot: string;
211
+ readonly repoRoot: string;
212
+ readonly env: Readonly<NodeJS.ProcessEnv>;
213
+ readonly workflowSources: ReadonlyArray<string>;
214
+ readonly workflows: ReadonlyArray<WorkflowDefinition>;
215
+ readonly containerRegistrations: ReadonlyArray<CodemationContainerRegistration<unknown>>;
216
+ readonly credentialTypes: ReadonlyArray<AnyCredentialType>;
217
+ readonly collections: ReadonlyArray<CollectionDefinition>;
218
+ readonly plugins: ReadonlyArray<CodemationPlugin>;
219
+ readonly pluginLoadSummary?: ReadonlyArray<AppPluginLoadSummary>;
220
+ readonly mcpServers: ReadonlyArray<McpServerDeclaration>;
221
+ readonly hasConfiguredCredentialSessionServiceRegistration: boolean;
222
+ readonly log?: CodemationLogConfig;
223
+ readonly engineExecutionLimits?: CodemationEngineExecutionLimitsConfig;
224
+ readonly databaseUrl?: string;
225
+ readonly database?: CodemationDatabaseConfig;
226
+ readonly persistence: AppPersistenceConfig;
227
+ readonly scheduler: Readonly<{
228
+ kind: CodemationSchedulerKind;
229
+ queuePrefix?: string;
230
+ workerQueues: ReadonlyArray<string>;
231
+ redisUrl?: string;
232
+ }>;
233
+ readonly eventing: Readonly<{
234
+ kind: CodemationEventBusKind;
235
+ queuePrefix?: string;
236
+ redisUrl?: string;
237
+ }>;
238
+ readonly auth?: CodemationAuthConfig;
239
+ readonly whitelabel: CodemationWhitelabelConfig;
240
+ readonly webSocketPort: number;
241
+ readonly webSocketBindHost: string;
242
+ }
243
+ //#endregion
244
+ //#region ../host/src/presentation/config/CodemationAppContext.d.ts
245
+ interface CodemationRegistrationContextBase {
246
+ readonly appConfig?: AppConfig;
247
+ registerCredentialType(type: AnyCredentialType): void;
248
+ registerCollection(definition: CollectionDefinition): void;
249
+ registerNode<TValue>(token: TypeToken<TValue>, implementation?: CodemationClassToken<TValue>): void;
250
+ registerValue<TValue>(token: TypeToken<TValue>, value: TValue): void;
251
+ registerClass<TValue>(token: TypeToken<TValue>, implementation: CodemationClassToken<TValue>): void;
252
+ registerFactory<TValue>(token: TypeToken<TValue>, factory: (container: Container) => TValue): void;
253
+ }
254
+ interface CodemationAppContext extends CodemationRegistrationContextBase {
255
+ registerWorkflow(workflow: WorkflowDefinition): void;
256
+ registerWorkflows(workflows: ReadonlyArray<WorkflowDefinition>): void;
257
+ discoverWorkflows(...directories: ReadonlyArray<string>): void;
258
+ }
259
+ //#endregion
260
+ //#region codemation.plugin.d.ts
261
+ declare const plugin: CodemationPluginConfig & Readonly<{
262
+ sandbox?: CodemationConfig;
263
+ }>;
264
+ //#endregion
265
+ export { plugin as default };
266
+ //# sourceMappingURL=codemation.plugin.d.ts.map