@open-mercato/shared 0.4.5-develop-811deeb983 → 0.4.5-develop-3ea31128bb

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.
@@ -1,4 +1,4 @@
1
- const APP_VERSION = "0.4.5-develop-811deeb983";
1
+ const APP_VERSION = "0.4.5-develop-3ea31128bb";
2
2
  const appVersion = APP_VERSION;
3
3
  export {
4
4
  APP_VERSION,
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/lib/version.ts"],
4
- "sourcesContent": ["// Build-time generated version\nexport const APP_VERSION = '0.4.5-develop-811deeb983'\nexport const appVersion = APP_VERSION\n"],
4
+ "sourcesContent": ["// Build-time generated version\nexport const APP_VERSION = '0.4.5-develop-3ea31128bb'\nexport const appVersion = APP_VERSION\n"],
5
5
  "mappings": "AACO,MAAM,cAAc;AACpB,MAAM,aAAa;",
6
6
  "names": []
7
7
  }
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=inbox-actions.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": [],
4
+ "sourcesContent": [],
5
+ "mappings": "",
6
+ "names": []
7
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@open-mercato/shared",
3
- "version": "0.4.5-develop-811deeb983",
3
+ "version": "0.4.5-develop-3ea31128bb",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "scripts": {
@@ -0,0 +1,53 @@
1
+ import type { z } from 'zod'
2
+
3
+ /**
4
+ * Context passed to inbox action handlers during execution.
5
+ * Uses unknown for ORM/DI types to avoid domain dependencies in shared.
6
+ */
7
+ export interface InboxActionExecutionContext {
8
+ em: unknown
9
+ userId: string
10
+ tenantId: string
11
+ organizationId: string
12
+ eventBus?: unknown
13
+ container: unknown
14
+ auth?: unknown
15
+ executeCommand: <TInput, TResult>(commandId: string, input: TInput) => Promise<TResult>
16
+ resolveEntityClass: <T>(key: string) => (new (...args: unknown[]) => T) | null
17
+ }
18
+
19
+ export interface InboxActionExecutionResult {
20
+ createdEntityId?: string | null
21
+ createdEntityType?: string | null
22
+ matchedEntityId?: string | null
23
+ matchedEntityType?: string | null
24
+ }
25
+
26
+ export interface InboxActionDefinition {
27
+ /** Unique action type ID, e.g. 'create_order' */
28
+ type: string
29
+ /** RBAC feature required to execute this action */
30
+ requiredFeature: string
31
+ /** Zod schema for payload validation */
32
+ payloadSchema: z.ZodType
33
+ /** Human-readable label for UI */
34
+ label?: string
35
+ /** LLM prompt schema description (included in extraction prompt) */
36
+ promptSchema: string
37
+ /** LLM extraction rules specific to this action type */
38
+ promptRules?: string[]
39
+ /** Normalize LLM-generated payload before Zod validation */
40
+ normalizePayload?: (
41
+ payload: Record<string, unknown>,
42
+ ctx: InboxActionExecutionContext,
43
+ ) => Promise<Record<string, unknown>> | Record<string, unknown>
44
+ /** Execute the action after payload validation */
45
+ execute: (
46
+ action: { id: string; proposalId: string; payload: unknown },
47
+ ctx: InboxActionExecutionContext,
48
+ ) => Promise<InboxActionExecutionResult>
49
+ }
50
+
51
+ export interface InboxActionsModuleConfig {
52
+ actions: InboxActionDefinition[]
53
+ }