@fragno-dev/backoffice-api 0.0.0-stage → 0.0.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 (135) hide show
  1. package/LICENSE.md +16 -0
  2. package/README.md +90 -2
  3. package/dist/api.d.ts +35 -0
  4. package/dist/api.d.ts.map +1 -0
  5. package/dist/api.js +10 -0
  6. package/dist/api.js.map +1 -0
  7. package/dist/errors.d.ts +45 -0
  8. package/dist/errors.d.ts.map +1 -0
  9. package/dist/errors.js +35 -0
  10. package/dist/errors.js.map +1 -0
  11. package/dist/openapi.d.ts +46 -0
  12. package/dist/openapi.d.ts.map +1 -0
  13. package/dist/openapi.js +205 -0
  14. package/dist/openapi.js.map +1 -0
  15. package/dist/v0/account.d.ts +171 -0
  16. package/dist/v0/account.d.ts.map +1 -0
  17. package/dist/v0/account.js +78 -0
  18. package/dist/v0/account.js.map +1 -0
  19. package/dist/v0/api.d.ts +3437 -0
  20. package/dist/v0/api.d.ts.map +1 -0
  21. package/dist/v0/api.js +52 -0
  22. package/dist/v0/api.js.map +1 -0
  23. package/dist/v0/app-actions.d.ts +105 -0
  24. package/dist/v0/app-actions.d.ts.map +1 -0
  25. package/dist/v0/app-actions.js +100 -0
  26. package/dist/v0/app-actions.js.map +1 -0
  27. package/dist/v0/apps.d.ts +417 -0
  28. package/dist/v0/apps.d.ts.map +1 -0
  29. package/dist/v0/apps.js +163 -0
  30. package/dist/v0/apps.js.map +1 -0
  31. package/dist/v0/automation.d.ts +730 -0
  32. package/dist/v0/automation.d.ts.map +1 -0
  33. package/dist/v0/automation.js +355 -0
  34. package/dist/v0/automation.js.map +1 -0
  35. package/dist/v0/capabilities.d.ts +97 -0
  36. package/dist/v0/capabilities.d.ts.map +1 -0
  37. package/dist/v0/capabilities.js +41 -0
  38. package/dist/v0/capabilities.js.map +1 -0
  39. package/dist/v0/client.d.ts +39 -0
  40. package/dist/v0/client.d.ts.map +1 -0
  41. package/dist/v0/client.js +61 -0
  42. package/dist/v0/client.js.map +1 -0
  43. package/dist/v0/events.d.ts +789 -0
  44. package/dist/v0/events.d.ts.map +1 -0
  45. package/dist/v0/events.js +153 -0
  46. package/dist/v0/events.js.map +1 -0
  47. package/dist/v0/forms.d.ts +172 -0
  48. package/dist/v0/forms.d.ts.map +1 -0
  49. package/dist/v0/forms.js +88 -0
  50. package/dist/v0/forms.js.map +1 -0
  51. package/dist/v0/hooks.d.ts +61 -0
  52. package/dist/v0/hooks.d.ts.map +1 -0
  53. package/dist/v0/hooks.js +49 -0
  54. package/dist/v0/hooks.js.map +1 -0
  55. package/dist/v0/identity.d.ts +73 -0
  56. package/dist/v0/identity.d.ts.map +1 -0
  57. package/dist/v0/identity.js +46 -0
  58. package/dist/v0/identity.js.map +1 -0
  59. package/dist/v0/integrations.d.ts +847 -0
  60. package/dist/v0/integrations.d.ts.map +1 -0
  61. package/dist/v0/integrations.js +255 -0
  62. package/dist/v0/integrations.js.map +1 -0
  63. package/dist/v0/javascript.d.ts +160 -0
  64. package/dist/v0/javascript.d.ts.map +1 -0
  65. package/dist/v0/javascript.js +123 -0
  66. package/dist/v0/javascript.js.map +1 -0
  67. package/dist/v0/marketplace.d.ts +825 -0
  68. package/dist/v0/marketplace.d.ts.map +1 -0
  69. package/dist/v0/marketplace.js +284 -0
  70. package/dist/v0/marketplace.js.map +1 -0
  71. package/dist/v0/organization.d.ts +182 -0
  72. package/dist/v0/organization.d.ts.map +1 -0
  73. package/dist/v0/organization.js +88 -0
  74. package/dist/v0/organization.js.map +1 -0
  75. package/dist/v0/otp.d.ts +37 -0
  76. package/dist/v0/otp.d.ts.map +1 -0
  77. package/dist/v0/otp.js +29 -0
  78. package/dist/v0/otp.js.map +1 -0
  79. package/dist/v0/pi.d.ts +322 -0
  80. package/dist/v0/pi.d.ts.map +1 -0
  81. package/dist/v0/pi.js +146 -0
  82. package/dist/v0/pi.js.map +1 -0
  83. package/dist/v0/sandbox.d.ts +173 -0
  84. package/dist/v0/sandbox.d.ts.map +1 -0
  85. package/dist/v0/sandbox.js +97 -0
  86. package/dist/v0/sandbox.js.map +1 -0
  87. package/dist/v0/shared/bytes.d.ts +12 -0
  88. package/dist/v0/shared/bytes.d.ts.map +1 -0
  89. package/dist/v0/shared/bytes.js +16 -0
  90. package/dist/v0/shared/bytes.js.map +1 -0
  91. package/dist/v0/shared/datetime.d.ts +10 -0
  92. package/dist/v0/shared/datetime.d.ts.map +1 -0
  93. package/dist/v0/shared/datetime.js +14 -0
  94. package/dist/v0/shared/datetime.js.map +1 -0
  95. package/dist/v0/shared/json.d.ts +9 -0
  96. package/dist/v0/shared/json.d.ts.map +1 -0
  97. package/dist/v0/shared/json.js +14 -0
  98. package/dist/v0/shared/json.js.map +1 -0
  99. package/dist/v0/shared/pagination.d.ts +11 -0
  100. package/dist/v0/shared/pagination.d.ts.map +1 -0
  101. package/dist/v0/shared/pagination.js +11 -0
  102. package/dist/v0/shared/pagination.js.map +1 -0
  103. package/dist/v0/shared/permissions.d.ts +279 -0
  104. package/dist/v0/shared/permissions.d.ts.map +1 -0
  105. package/dist/v0/shared/permissions.js +285 -0
  106. package/dist/v0/shared/permissions.js.map +1 -0
  107. package/dist/v0/shared/pi-agent-name.d.ts +10 -0
  108. package/dist/v0/shared/pi-agent-name.d.ts.map +1 -0
  109. package/dist/v0/shared/pi-agent-name.js +11 -0
  110. package/dist/v0/shared/pi-agent-name.js.map +1 -0
  111. package/dist/v0/shared/scope.d.ts +305 -0
  112. package/dist/v0/shared/scope.d.ts.map +1 -0
  113. package/dist/v0/shared/scope.js +279 -0
  114. package/dist/v0/shared/scope.js.map +1 -0
  115. package/dist/v0/state.d.ts +512 -0
  116. package/dist/v0/state.d.ts.map +1 -0
  117. package/dist/v0/state.js +267 -0
  118. package/dist/v0/state.js.map +1 -0
  119. package/dist/v0/store.d.ts +138 -0
  120. package/dist/v0/store.d.ts.map +1 -0
  121. package/dist/v0/store.js +83 -0
  122. package/dist/v0/store.js.map +1 -0
  123. package/dist/v0/upload.d.ts +568 -0
  124. package/dist/v0/upload.d.ts.map +1 -0
  125. package/dist/v0/upload.js +109 -0
  126. package/dist/v0/upload.js.map +1 -0
  127. package/dist/v0/web.d.ts +47 -0
  128. package/dist/v0/web.d.ts.map +1 -0
  129. package/dist/v0/web.js +31 -0
  130. package/dist/v0/web.js.map +1 -0
  131. package/dist/v0/workflow.d.ts +267 -0
  132. package/dist/v0/workflow.d.ts.map +1 -0
  133. package/dist/v0/workflow.js +116 -0
  134. package/dist/v0/workflow.js.map +1 -0
  135. package/package.json +64 -3
@@ -0,0 +1 @@
1
+ {"version":3,"file":"integrations.d.ts","names":[],"sources":["../../src/v0/integrations.ts"],"mappings":";;;cAOa;;;;cAKA,oCAAkC,EAAA,QAAA,EAAA,uBAAA,EAAA;;;;;;;;;;;;;;;cAoBlC,sCAAoC,EAAA,QAAA,EAAA,uBAAA,EAAA;;;;;;cASpC,sCAAoC,EAAA,QAAA,EAAA,uBAAA,EAAA;;;;;;;;;;;cAkBpC,kCAAgC,EAAA,QAAA,EAAA;;;;;cAYhC,+BAA6B,EAAA,QAAA,EAAA;cAW7B;gBAAA,EAAA,QAAA,EAAA;;cAIA,6BAA2B,EAAA,QAAA,EAAA;;;cAQ3B,6BAA2B,EAAA,QAAA,EAAA,mBAAA,EAAA,YAAA,EAAA,UAAA,EAAA,WAAA,EAAA;cAU3B,6BAA2B,EAAA,QAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAc5B,wBAAwB,EAAE,cAAc;cAEvC,qBAAmB,EAAA,QAAA,EAAA;cAWnB,wCAAsC,EAAA,QAAA,EAAA;;;;cAMtC,6BAA2B,EAAA,QAAA,EAAA;;;;;;;;;;;KAoB5B,wBAAwB,EAAE,cAAc;;KAGxC,wBAAwB,EAAE,cAAc;;cAGvC,6BAA2B,EAAA,QAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAe3B,qCAAmC,EAAA,Q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MISSION } from "./shared/permissions.js";
2
+ import { isoDateTimeOutputSchema } from "./shared/datetime.js";
3
+ import { jsonValueSchema } from "./shared/json.js";
4
+ import { z } from "zod";
5
+ //#region src/v0/integrations.ts
6
+ const integrationVerificationCheckShape = {
7
+ id: z.lazy(() => z.string().min(1)),
8
+ label: z.lazy(() => z.string())
9
+ };
10
+ const integrationVerificationCheckSchema = z.lazy(() => z.discriminatedUnion("status", [z.strictObject({
11
+ ...integrationVerificationCheckShape,
12
+ status: z.literal("not-checked"),
13
+ reason: z.string()
14
+ }), z.strictObject({
15
+ ...integrationVerificationCheckShape,
16
+ status: z.enum(["passed", "failed"]),
17
+ checkedAt: isoDateTimeOutputSchema.describe("Time of the actual check, not configuration storage."),
18
+ message: z.string()
19
+ })])).meta({ id: "IntegrationVerificationCheck" });
20
+ const integrationConfigurationStatusSchema = z.lazy(() => z.discriminatedUnion("status", [z.strictObject({
21
+ status: z.literal("missing"),
22
+ missingFields: z.array(z.string())
23
+ }), z.strictObject({ status: z.literal("configured") })])).meta({ id: "IntegrationConfigurationStatus" });
24
+ const integrationAuthorizationStatusSchema = z.lazy(() => z.discriminatedUnion("status", [
25
+ z.strictObject({ status: z.literal("not-required") }),
26
+ z.strictObject({ status: z.literal("not-checked") }),
27
+ z.strictObject({ status: z.literal("missing") }),
28
+ z.strictObject({ status: z.literal("available").describe("Credentials or confirmed consent exist; this does not prove live service access.") }),
29
+ z.strictObject({ status: z.literal("expired") })
30
+ ])).meta({ id: "IntegrationAuthorizationStatus" });
31
+ const integrationSetupSubmissionSchema = z.lazy(() => z.strictObject({
32
+ kind: z.literal("input"),
33
+ input: jsonValueSchema.describe("Direct JSON setup input validated against the source's current requirements. Null is a submitted value, never a check sentinel.").meta({ codemodeType: "JsonValue" })
34
+ }));
35
+ /** Connection IDs preserve source identity and resolve only within the selected execution scope. */
36
+ const integrationConnectionIdSchema = z.lazy(() => z.string().regex(/^[a-z][a-z0-9-]*#[\s\S]+$/, "Integration connection ID must be namespace#local-id.").describe("Deterministic scoped address such as backoffice#reson8, not a credential or a separately revocable binding. The suffix preserves the source's identity.")).meta({ id: "IntegrationConnectionId" });
37
+ const integrationSetupProgressShape = { connectionId: integrationConnectionIdSchema };
38
+ const integrationSetupCheckSchema = z.lazy(() => z.strictObject({ kind: z.literal("check").describe("Read authoritative setup state; user confirmation is not proof of consent.") }));
39
+ const integrationJsonSchemaSchema = z.lazy(() => z.union([z.boolean(), z.record(z.string(), z.unknown())]).describe("Authoritative JSON Schema supplied by the integration, never inferred from an action ID.")).meta({ id: "IntegrationJsonSchema" });
40
+ const integrationInspectionSchema = z.lazy(() => z.strictObject({
41
+ configuration: integrationConfigurationStatusSchema,
42
+ authorization: integrationAuthorizationStatusSchema,
43
+ checks: z.array(integrationVerificationCheckSchema).describe("Supported checks distinguish missing evidence from actual timestamped results; saved configuration alone proves no live health."),
44
+ nextSteps: z.array(z.string())
45
+ }));
46
+ const integrationIdSchema = z.lazy(() => z.string().min(1).describe("Service identity returned by discover; it does not identify an integration mechanism.")).meta({ id: "IntegrationId" });
47
+ const integrationConnectionSetupTargetSchema = z.lazy(() => z.strictObject({
48
+ kind: z.literal("connection"),
49
+ connectionId: integrationConnectionIdSchema
50
+ })).meta({ id: "IntegrationConnectionSetupTarget" });
51
+ const integrationAuthMethodSchema = z.lazy(() => z.enum([
52
+ "none",
53
+ "api-key",
54
+ "bearer",
55
+ "basic",
56
+ "client-credentials",
57
+ "oauth",
58
+ "signature",
59
+ "app-installation"
60
+ ]).describe("How the connection authenticates to its provider; for inbound webhooks, how deliveries authenticate. Signature means an HMAC-signed body.")).meta({ id: "IntegrationAuthMethod" });
61
+ /** Integration connection identity is supplied by the runtime, not by private adapter inspection. */
62
+ const integrationConnectionSchema = z.lazy(() => integrationInspectionSchema._zod.innerType.extend({
63
+ connectionId: integrationConnectionIdSchema,
64
+ integrationId: integrationIdSchema,
65
+ name: z.string(),
66
+ authMethod: integrationAuthMethodSchema.nullable().describe("Null while nothing stored at the address chooses a method, such as before API setup.")
67
+ })).meta({ id: "IntegrationConnection" });
68
+ const integrationConnectionSettingsSchema = z.lazy(() => z.record(z.string(), jsonValueSchema).nullable()).meta({ id: "IntegrationConnectionSettings" });
69
+ const inspectedIntegrationConnectionSchema = z.lazy(() => integrationConnectionSchema._zod.innerType.extend({ settings: integrationConnectionSettingsSchema.describe("Stored values that are not secret, shaped like this connection's reconfigure input. Start a replacement from them, change what was asked, and supply secrets and omitted fields again. Null when the source takes no replacement or nothing is stored.") })).meta({ id: "InspectedIntegrationConnection" });
70
+ const configuredIntegrationSchema = z.lazy(() => integrationConnectionSchema._zod.innerType.extend({ configuration: z.strictObject({ status: z.literal("configured") }) })).meta({ id: "ConfiguredIntegrationConnection" });
71
+ /** Public integration setup progress never exposes private continuation state or binding data. */
72
+ const integrationSetupProgressSchema = z.lazy(() => z.discriminatedUnion("status", [
73
+ z.strictObject({
74
+ ...integrationSetupProgressShape,
75
+ status: z.literal("needs-input"),
76
+ instructions: z.string(),
77
+ inputSchema: integrationJsonSchemaSchema,
78
+ secretFields: z.array(z.string()).describe("Secret property names for input controls, as dot-separated paths when nested; never secret values.")
79
+ }),
80
+ z.strictObject({
81
+ ...integrationSetupProgressShape,
82
+ status: z.literal("needs-authorization"),
83
+ instructions: z.string(),
84
+ authorizationUrl: z.url()
85
+ }),
86
+ z.strictObject({
87
+ ...integrationSetupProgressShape,
88
+ status: z.literal("pending"),
89
+ message: z.string()
90
+ }),
91
+ z.strictObject({
92
+ ...integrationSetupProgressShape,
93
+ status: z.literal("ready")
94
+ }),
95
+ z.strictObject({
96
+ ...integrationSetupProgressShape,
97
+ status: z.literal("blocked"),
98
+ reason: z.string()
99
+ }),
100
+ z.strictObject({
101
+ ...integrationSetupProgressShape,
102
+ status: z.literal("expired"),
103
+ reason: z.string()
104
+ })
105
+ ])).meta({ id: "IntegrationSetupProgress" });
106
+ /** Connection operations select an address, never a caller-supplied owner scope. */
107
+ const integrationConnectionInputSchema = z.lazy(() => z.strictObject({ connectionId: integrationConnectionIdSchema }));
108
+ /** Named setup distinguishes checking source-owned state from submitting any JSON value, including null. */
109
+ const integrationSetupInputSchema = z.lazy(() => z.discriminatedUnion("kind", [integrationSetupCheckSchema._zod.innerType.extend(integrationConnectionInputSchema._zod.innerType.shape), integrationSetupSubmissionSchema._zod.innerType.extend(integrationConnectionInputSchema._zod.innerType.shape)]));
110
+ /** Disconnecting repeats the address, so removal is never a side effect of an edited command. */
111
+ const integrationDisconnectInputSchema = z.lazy(() => integrationConnectionInputSchema._zod.innerType.extend({ confirm: integrationConnectionIdSchema.describe("Repeat connectionId to confirm removing its source-owned configuration and credentials.") }).refine((input) => input.confirm === input.connectionId, {
112
+ message: "Integration disconnect confirmation must repeat the connection ID.",
113
+ path: ["confirm"]
114
+ }));
115
+ /** Disconnect results report source state; the address stays valid for a later setup. */
116
+ const integrationDisconnectResultSchema = z.lazy(() => z.strictObject({
117
+ connectionId: integrationConnectionIdSchema,
118
+ status: z.enum(["disconnected", "not-configured"]).describe("Not-configured means nothing was stored at this address in the selected scope.")
119
+ })).meta({ id: "IntegrationDisconnectResult" });
120
+ const integrationConnectionEventsBackfillResultSchema = z.lazy(() => z.strictObject({ connections: z.array(z.strictObject({
121
+ connectionId: integrationConnectionIdSchema,
122
+ service: integrationIdSchema,
123
+ state: z.enum(["ready", "unavailable"])
124
+ })) })).meta({ id: "IntegrationConnectionEventsBackfillResult" });
125
+ /** Integration discovery reports service availability in the selected scope, not live health. */
126
+ const integrationOverviewSchema = z.lazy(() => z.strictObject({
127
+ id: integrationIdSchema,
128
+ label: z.string(),
129
+ description: z.string(),
130
+ connectionCardinality: z.enum(["singleton", "multiple"]).describe("Singleton means one scoped configuration; multiple means separately selectable connections. Credentials remain in their existing service-owned stores."),
131
+ availability: z.discriminatedUnion("status", [z.strictObject({ status: z.literal("available") }), z.strictObject({
132
+ status: z.literal("unavailable"),
133
+ reason: z.string()
134
+ })]).describe("Whether this service's configuration store is available in the selected scope, not whether credentials are present or live service access works.").meta({ id: "IntegrationAvailability" }),
135
+ setupTargets: z.array(integrationConnectionSetupTargetSchema).describe("Known named setup targets, including unconfigured fixed slots; never invented account or attempt IDs."),
136
+ automationEvents: z.array(z.strictObject({
137
+ source: z.string(),
138
+ eventType: z.string()
139
+ })).describe("Source-specific activity events; declared identities do not prove live event delivery. Connection state changes arrive for every service as source integrations, keyed by subject.connectionId.")
140
+ })).meta({ id: "IntegrationOverview" });
141
+ /** Integration list pages project existing configured connections, not independent binding records. */
142
+ const integrationListOutputSchema = z.lazy(() => z.strictObject({
143
+ connections: z.array(configuredIntegrationSchema),
144
+ unavailableSources: z.array(z.strictObject({
145
+ source: z.string().describe("Addresses the source owns: `namespace#` for a whole namespace, or one exact connection ID."),
146
+ reason: z.string()
147
+ })).describe("Sources that failed to list in this page. Their connections are missing from the listing, not removed; list again later."),
148
+ cursor: z.string().nullable().describe("Null means all configured integrations in this scope have been listed.")
149
+ }));
150
+ /** Integration listing starts with a null cursor and never selects an adapter. */
151
+ const integrationListInputSchema = z.lazy(() => z.strictObject({ cursor: z.string().nullable().describe("Null starts the scoped listing; use the returned next cursor.") }));
152
+ /** Action values are JSON; action-specific validation still precedes service side effects. */
153
+ const integrationExecuteInputSchema = z.lazy(() => integrationConnectionInputSchema._zod.innerType.extend({
154
+ actionId: z.string().min(1),
155
+ input: jsonValueSchema.describe("JSON action input, validated against the live action schema before dispatch. Binary inputs use schema-declared byte arrays of integers 0–255, never ArrayBuffer or typed arrays; implementations convert them privately.").meta({ codemodeType: "JsonValue" }),
156
+ unchecked: z.boolean().default(false).describe("Required to run an action whose validation is unchecked: its input and output skip validation and the service alone rejects bad input. Checked actions validate regardless.")
157
+ }));
158
+ /**
159
+ * Whether execution validates an action against its schemas. Unchecked actions publish contracts
160
+ * that cannot be validated faithfully, so callers must opt in to running them.
161
+ */
162
+ const integrationActionValidationSchema = z.lazy(() => z.discriminatedUnion("kind", [z.strictObject({ kind: z.literal("checked") }), z.strictObject({
163
+ kind: z.literal("unchecked"),
164
+ reason: z.string().describe("Why the published schemas cannot be validated.")
165
+ })])).meta({ id: "IntegrationActionValidation" });
166
+ /** Integration action schemas describe the operation's own result, including asynchronous job handles. */
167
+ const integrationActionSchema = z.lazy(() => z.strictObject({
168
+ id: z.string().min(1).describe("Action identity returned by actions for this connection."),
169
+ label: z.string(),
170
+ description: z.string(),
171
+ validation: integrationActionValidationSchema,
172
+ inputSchema: integrationJsonSchemaSchema,
173
+ outputSchema: integrationJsonSchemaSchema.describe("Describes the action's own result, including any asynchronous job handle.")
174
+ })).meta({ id: "IntegrationAction" });
175
+ const integrationGenerateClientInputSchema = z.lazy(() => integrationConnectionInputSchema._zod.innerType.extend({ out: z.string().trim().min(1).describe("Absolute path of the .js module to write under /workspace. Only a module this operation generated is replaced.") }));
176
+ /** Generated clients are snapshots of the connection's action contracts. */
177
+ const integrationClientSchema = z.lazy(() => z.strictObject({
178
+ path: z.string(),
179
+ exports: z.array(z.strictObject({
180
+ name: z.string().describe("Exported function name."),
181
+ actionId: z.string().describe("Action the function executes.")
182
+ }))
183
+ })).meta({ id: "IntegrationClient" });
184
+ const integrationsOperations = {
185
+ "integrations.discover": {
186
+ description: "Discover available services and unconfigured services in the selected scope. Service availability does not prove live health.",
187
+ permissions: [BACKOFFICE_PERMISSION.integrations.read],
188
+ input: z.void(),
189
+ output: z.lazy(() => z.array(integrationOverviewSchema))
190
+ },
191
+ "integrations.list": {
192
+ description: "List existing configured connections in the selected scope, one cursor page at a time. Deterministic IDs reuse source-owned identities; configuration does not imply live access.",
193
+ permissions: [BACKOFFICE_PERMISSION.integrations.read],
194
+ input: integrationListInputSchema,
195
+ output: integrationListOutputSchema
196
+ },
197
+ "integrations.get": {
198
+ description: "Inspect source-owned connection configuration, its stored non-secret settings, and available evidence without performing a live health check. The connection ID resolves only within the selected scope.",
199
+ permissions: [BACKOFFICE_PERMISSION.integrations.read],
200
+ input: integrationConnectionInputSchema,
201
+ output: inspectedIntegrationConnectionSchema
202
+ },
203
+ "integrations.setup": {
204
+ description: "Read current requirements or submit input for a deterministic connection address. Setup is source-owned; this operation retains no attempt state or independent binding. Ready connections keep their configuration and credentials; reconfigure replaces them.",
205
+ permissions: [BACKOFFICE_PERMISSION.integrations.manage],
206
+ input: integrationSetupInputSchema,
207
+ output: integrationSetupProgressSchema
208
+ },
209
+ "integrations.reconfigure": {
210
+ description: "Read replacement requirements or submit replacement configuration or credentials for an existing connection. Build the replacement from integrations.get settings so unchanged values carry over. Submission replaces source-owned state; continue with setup checks until ready. A missing connection needs setup.",
211
+ permissions: [BACKOFFICE_PERMISSION.integrations.manage],
212
+ input: integrationSetupInputSchema,
213
+ output: integrationSetupProgressSchema
214
+ },
215
+ "integrations.disconnect": {
216
+ description: "Remove a connection's source-owned configuration and credentials in the selected scope. The address stays valid for a later setup. Requires confirm to repeat the connection ID.",
217
+ permissions: [BACKOFFICE_PERMISSION.integrations.manage],
218
+ input: integrationDisconnectInputSchema,
219
+ output: integrationDisconnectResultSchema
220
+ },
221
+ "integrations.backfillConnectionEvents": {
222
+ description: "Record every configured connection's current state in the selected scope as an integrations.connection.ready or connection.unavailable event, for connections that existed before those events were recorded. Routes on those events run for each new event. Events carry each connection's name and auth method. A rerun records a connection again only when its state, name, or auth method differs from every earlier backfill of it, so a rerun adds names to connections recorded before events carried them.",
223
+ permissions: [BACKOFFICE_PERMISSION.integrations.manage],
224
+ input: z.void(),
225
+ output: integrationConnectionEventsBackfillResultSchema
226
+ },
227
+ "integrations.actions": {
228
+ description: "Discover the selected connection's supported actions and authoritative input/output contracts without executing them. Never infer schemas from action IDs.",
229
+ permissions: [BACKOFFICE_PERMISSION.integrations.read],
230
+ input: integrationConnectionInputSchema,
231
+ output: z.lazy(() => z.array(integrationActionSchema))
232
+ },
233
+ "integrations.execute": {
234
+ description: "Execute an explicit connection action with JSON input/output, validated against its live contracts and service permissions. Unchecked actions run only with unchecked: true. Binary inputs are schema-declared byte arrays; results retain the action's domain and asynchronous semantics.",
235
+ permissions: [BACKOFFICE_PERMISSION.integrations.execute],
236
+ input: integrationExecuteInputSchema,
237
+ output: jsonValueSchema.meta({ codemodeType: "JsonValue" })
238
+ },
239
+ "integrations.generateClient": {
240
+ description: "Write a JavaScript module with one typed async function per action of the selected connection, for codemode and saved modules to import. Each function calls integrations.execute; its JSDoc types snapshot the action contracts, so regenerate after the connection's actions change.",
241
+ permissions: [BACKOFFICE_PERMISSION.integrations.read, BACKOFFICE_PERMISSION.upload.modify],
242
+ input: integrationGenerateClientInputSchema,
243
+ output: integrationClientSchema
244
+ },
245
+ "integrations.verify": {
246
+ description: "Perform explicit supported live checks without authorizing the connection or executing service actions. Return timestamped evidence, not blanket health or retained verification state.",
247
+ permissions: [BACKOFFICE_PERMISSION.integrations.manage],
248
+ input: integrationConnectionInputSchema,
249
+ output: integrationConnectionSchema
250
+ }
251
+ };
252
+ //#endregion
253
+ export { configuredIntegrationSchema, inspectedIntegrationConnectionSchema, integrationActionSchema, integrationActionValidationSchema, integrationAuthMethodSchema, integrationAuthorizationStatusSchema, integrationClientSchema, integrationConfigurationStatusSchema, integrationConnectionEventsBackfillResultSchema, integrationConnectionIdSchema, integrationConnectionInputSchema, integrationConnectionSchema, integrationConnectionSettingsSchema, integrationConnectionSetupTargetSchema, integrationDisconnectInputSchema, integrationDisconnectResultSchema, integrationExecuteInputSchema, integrationGenerateClientInputSchema, integrationIdSchema, integrationInspectionSchema, integrationJsonSchemaSchema, integrationListInputSchema, integrationListOutputSchema, integrationOverviewSchema, integrationSetupCheckSchema, integrationSetupInputSchema, integrationSetupProgressSchema, integrationSetupProgressShape, integrationSetupSubmissionSchema, integrationVerificationCheckSchema, integrationVerificationCheckShape, integrationsOperations };
254
+
255
+ //# sourceMappingURL=integrations.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"integrations.js","names":[],"sources":["../../src/v0/integrations.ts"],"sourcesContent":["import { z } from \"zod\";\n\nimport type { BackofficeApiOperation } from \"../api\";\nimport { isoDateTimeOutputSchema } from \"./shared/datetime\";\nimport { jsonValueSchema } from \"./shared/json\";\nimport { BACKOFFICE_PERMISSION } from \"./shared/permissions\";\n\nexport const integrationVerificationCheckShape = {\n id: z.lazy(() => z.string().min(1)),\n label: z.lazy(() => z.string()),\n};\n\nexport const integrationVerificationCheckSchema = z\n .lazy(() =>\n z.discriminatedUnion(\"status\", [\n z.strictObject({\n ...integrationVerificationCheckShape,\n status: z.literal(\"not-checked\"),\n reason: z.string(),\n }),\n z.strictObject({\n ...integrationVerificationCheckShape,\n status: z.enum([\"passed\", \"failed\"]),\n checkedAt: isoDateTimeOutputSchema.describe(\n \"Time of the actual check, not configuration storage.\",\n ),\n message: z.string(),\n }),\n ]),\n )\n .meta({ id: \"IntegrationVerificationCheck\" });\n\nexport const integrationConfigurationStatusSchema = z\n .lazy(() =>\n z.discriminatedUnion(\"status\", [\n z.strictObject({ status: z.literal(\"missing\"), missingFields: z.array(z.string()) }),\n z.strictObject({ status: z.literal(\"configured\") }),\n ]),\n )\n .meta({ id: \"IntegrationConfigurationStatus\" });\n\nexport const integrationAuthorizationStatusSchema = z\n .lazy(() =>\n z.discriminatedUnion(\"status\", [\n z.strictObject({ status: z.literal(\"not-required\") }),\n z.strictObject({ status: z.literal(\"not-checked\") }),\n z.strictObject({ status: z.literal(\"missing\") }),\n z.strictObject({\n status: z\n .literal(\"available\")\n .describe(\n \"Credentials or confirmed consent exist; this does not prove live service access.\",\n ),\n }),\n z.strictObject({ status: z.literal(\"expired\") }),\n ]),\n )\n .meta({ id: \"IntegrationAuthorizationStatus\" });\n\nexport const integrationSetupSubmissionSchema = z.lazy(() =>\n z.strictObject({\n kind: z.literal(\"input\"),\n input: jsonValueSchema\n .describe(\n \"Direct JSON setup input validated against the source's current requirements. Null is a submitted value, never a check sentinel.\",\n )\n .meta({ codemodeType: \"JsonValue\" }),\n }),\n);\n\n/** Connection IDs preserve source identity and resolve only within the selected execution scope. */\nexport const integrationConnectionIdSchema = z\n .lazy(() =>\n z\n .string()\n .regex(/^[a-z][a-z0-9-]*#[\\s\\S]+$/, \"Integration connection ID must be namespace#local-id.\")\n .describe(\n \"Deterministic scoped address such as backoffice#reson8, not a credential or a separately revocable binding. The suffix preserves the source's identity.\",\n ),\n )\n .meta({ id: \"IntegrationConnectionId\" });\n\nexport const integrationSetupProgressShape = {\n connectionId: integrationConnectionIdSchema,\n};\n\nexport const integrationSetupCheckSchema = z.lazy(() =>\n z.strictObject({\n kind: z\n .literal(\"check\")\n .describe(\"Read authoritative setup state; user confirmation is not proof of consent.\"),\n }),\n);\n\nexport const integrationJsonSchemaSchema = z\n .lazy(() =>\n z\n .union([z.boolean(), z.record(z.string(), z.unknown())])\n .describe(\n \"Authoritative JSON Schema supplied by the integration, never inferred from an action ID.\",\n ),\n )\n .meta({ id: \"IntegrationJsonSchema\" });\n\nexport const integrationInspectionSchema = z.lazy(() =>\n z.strictObject({\n configuration: integrationConfigurationStatusSchema,\n authorization: integrationAuthorizationStatusSchema,\n checks: z\n .array(integrationVerificationCheckSchema)\n .describe(\n \"Supported checks distinguish missing evidence from actual timestamped results; saved configuration alone proves no live health.\",\n ),\n nextSteps: z.array(z.string()),\n }),\n);\n\n/** Integration inspection excludes connection identity, which the runtime attaches separately. */\nexport type IntegrationInspection = z.output<typeof integrationInspectionSchema>;\n\nexport const integrationIdSchema = z\n .lazy(() =>\n z\n .string()\n .min(1)\n .describe(\n \"Service identity returned by discover; it does not identify an integration mechanism.\",\n ),\n )\n .meta({ id: \"IntegrationId\" });\n\nexport const integrationConnectionSetupTargetSchema = z\n .lazy(() =>\n z.strictObject({ kind: z.literal(\"connection\"), connectionId: integrationConnectionIdSchema }),\n )\n .meta({ id: \"IntegrationConnectionSetupTarget\" });\n\nexport const integrationAuthMethodSchema = z\n .lazy(() =>\n z\n .enum([\n \"none\",\n \"api-key\",\n \"bearer\",\n \"basic\",\n \"client-credentials\",\n \"oauth\",\n \"signature\",\n \"app-installation\",\n ])\n .describe(\n \"How the connection authenticates to its provider; for inbound webhooks, how deliveries authenticate. Signature means an HMAC-signed body.\",\n ),\n )\n .meta({ id: \"IntegrationAuthMethod\" });\n\n/** One vocabulary for every source's own auth configuration. */\nexport type IntegrationAuthMethod = z.output<typeof integrationAuthMethodSchema>;\n\n/** Public connection records describe source-owned configuration, never a facade-owned binding. */\nexport type IntegrationConnection = z.output<typeof integrationConnectionSchema>;\n\n/** Integration connection identity is supplied by the runtime, not by private adapter inspection. */\nexport const integrationConnectionSchema = z\n .lazy(() =>\n integrationInspectionSchema._zod.innerType.extend({\n connectionId: integrationConnectionIdSchema,\n integrationId: integrationIdSchema,\n name: z.string(),\n authMethod: integrationAuthMethodSchema\n .nullable()\n .describe(\n \"Null while nothing stored at the address chooses a method, such as before API setup.\",\n ),\n }),\n )\n .meta({ id: \"IntegrationConnection\" });\n\nexport const integrationConnectionSettingsSchema = z\n .lazy(() => z.record(z.string(), jsonValueSchema).nullable())\n .meta({ id: \"IntegrationConnectionSettings\" });\n\n/** Source-owned settings a replacement can start from; they never contain secrets. */\nexport type IntegrationConnectionSettings = z.output<typeof integrationConnectionSettingsSchema>;\n\nexport const inspectedIntegrationConnectionSchema = z\n .lazy(() =>\n integrationConnectionSchema._zod.innerType.extend({\n settings: integrationConnectionSettingsSchema.describe(\n \"Stored values that are not secret, shaped like this connection's reconfigure input. Start a replacement from them, change what was asked, and supply secrets and omitted fields again. Null when the source takes no replacement or nothing is stored.\",\n ),\n }),\n )\n .meta({ id: \"InspectedIntegrationConnection\" });\n\nexport const configuredIntegrationSchema = z\n .lazy(() =>\n integrationConnectionSchema._zod.innerType.extend({\n configuration: z.strictObject({ status: z.literal(\"configured\") }),\n }),\n )\n .meta({ id: \"ConfiguredIntegrationConnection\" });\n\n/** Public integration setup progress never exposes private continuation state or binding data. */\nexport const integrationSetupProgressSchema = z\n .lazy(() =>\n z.discriminatedUnion(\"status\", [\n z.strictObject({\n ...integrationSetupProgressShape,\n status: z.literal(\"needs-input\"),\n instructions: z.string(),\n inputSchema: integrationJsonSchemaSchema,\n secretFields: z\n .array(z.string())\n .describe(\n \"Secret property names for input controls, as dot-separated paths when nested; never secret values.\",\n ),\n }),\n z.strictObject({\n ...integrationSetupProgressShape,\n status: z.literal(\"needs-authorization\"),\n instructions: z.string(),\n authorizationUrl: z.url(),\n }),\n z.strictObject({\n ...integrationSetupProgressShape,\n status: z.literal(\"pending\"),\n message: z.string(),\n }),\n z.strictObject({\n ...integrationSetupProgressShape,\n status: z.literal(\"ready\"),\n }),\n z.strictObject({\n ...integrationSetupProgressShape,\n status: z.literal(\"blocked\"),\n reason: z.string(),\n }),\n z.strictObject({\n ...integrationSetupProgressShape,\n status: z.literal(\"expired\"),\n reason: z.string(),\n }),\n ]),\n )\n .meta({ id: \"IntegrationSetupProgress\" });\n\n/** Integration setup progress describes current requirements without exposing private continuation data. */\nexport type IntegrationSetupProgress = z.output<typeof integrationSetupProgressSchema>;\n\n/** Connection operations select an address, never a caller-supplied owner scope. */\nexport const integrationConnectionInputSchema = z.lazy(() =>\n z.strictObject({\n connectionId: integrationConnectionIdSchema,\n }),\n);\n\n/** Named setup distinguishes checking source-owned state from submitting any JSON value, including null. */\nexport const integrationSetupInputSchema = z.lazy(() =>\n z.discriminatedUnion(\"kind\", [\n integrationSetupCheckSchema._zod.innerType.extend(\n integrationConnectionInputSchema._zod.innerType.shape,\n ),\n integrationSetupSubmissionSchema._zod.innerType.extend(\n integrationConnectionInputSchema._zod.innerType.shape,\n ),\n ]),\n);\n\n/** Setup requests select a scoped address and carry one explicit operation, without private continuation data. */\nexport type IntegrationSetupInput = z.output<typeof integrationSetupInputSchema>;\n\n/** Disconnecting repeats the address, so removal is never a side effect of an edited command. */\nexport const integrationDisconnectInputSchema = z.lazy(() =>\n integrationConnectionInputSchema._zod.innerType\n .extend({\n confirm: integrationConnectionIdSchema.describe(\n \"Repeat connectionId to confirm removing its source-owned configuration and credentials.\",\n ),\n })\n .refine((input) => input.confirm === input.connectionId, {\n message: \"Integration disconnect confirmation must repeat the connection ID.\",\n path: [\"confirm\"],\n }),\n);\n\n/** Disconnect results report source state; the address stays valid for a later setup. */\nexport const integrationDisconnectResultSchema = z\n .lazy(() =>\n z.strictObject({\n connectionId: integrationConnectionIdSchema,\n status: z\n .enum([\"disconnected\", \"not-configured\"])\n .describe(\"Not-configured means nothing was stored at this address in the selected scope.\"),\n }),\n )\n .meta({ id: \"IntegrationDisconnectResult\" });\n\n/** Disconnect results never retain a removed connection's configuration. */\nexport type IntegrationDisconnectResult = z.output<typeof integrationDisconnectResultSchema>;\n\nexport const integrationConnectionEventsBackfillResultSchema = z\n .lazy(() =>\n z.strictObject({\n connections: z.array(\n z.strictObject({\n connectionId: integrationConnectionIdSchema,\n service: integrationIdSchema,\n state: z.enum([\"ready\", \"unavailable\"]),\n }),\n ),\n }),\n )\n .meta({ id: \"IntegrationConnectionEventsBackfillResult\" });\n\n/** Integration discovery reports service availability in the selected scope, not live health. */\nexport const integrationOverviewSchema = z\n .lazy(() =>\n z.strictObject({\n id: integrationIdSchema,\n label: z.string(),\n description: z.string(),\n connectionCardinality: z\n .enum([\"singleton\", \"multiple\"])\n .describe(\n \"Singleton means one scoped configuration; multiple means separately selectable connections. Credentials remain in their existing service-owned stores.\",\n ),\n availability: z\n .discriminatedUnion(\"status\", [\n z.strictObject({ status: z.literal(\"available\") }),\n z.strictObject({ status: z.literal(\"unavailable\"), reason: z.string() }),\n ])\n .describe(\n \"Whether this service's configuration store is available in the selected scope, not whether credentials are present or live service access works.\",\n )\n .meta({ id: \"IntegrationAvailability\" }),\n setupTargets: z\n .array(integrationConnectionSetupTargetSchema)\n .describe(\n \"Known named setup targets, including unconfigured fixed slots; never invented account or attempt IDs.\",\n ),\n automationEvents: z\n .array(z.strictObject({ source: z.string(), eventType: z.string() }))\n .describe(\n \"Source-specific activity events; declared identities do not prove live event delivery. Connection state changes arrive for every service as source integrations, keyed by subject.connectionId.\",\n ),\n }),\n )\n .meta({ id: \"IntegrationOverview\" });\n\n/** Integration discovery metadata has one canonical schema shared by tools and implementations. */\nexport type IntegrationOverview = z.output<typeof integrationOverviewSchema>;\n\n/** Integration list pages project existing configured connections, not independent binding records. */\nexport const integrationListOutputSchema = z.lazy(() =>\n z.strictObject({\n connections: z.array(configuredIntegrationSchema),\n unavailableSources: z\n .array(\n z.strictObject({\n source: z\n .string()\n .describe(\n \"Addresses the source owns: `namespace#` for a whole namespace, or one exact connection ID.\",\n ),\n reason: z.string(),\n }),\n )\n .describe(\n \"Sources that failed to list in this page. Their connections are missing from the listing, not removed; list again later.\",\n ),\n cursor: z\n .string()\n .nullable()\n .describe(\"Null means all configured integrations in this scope have been listed.\"),\n }),\n);\n\n/** Connection pages retain source pagination without allocating new connection identities. */\nexport type IntegrationConnectionPage = z.output<typeof integrationListOutputSchema>;\n\n/** Integration listing starts with a null cursor and never selects an adapter. */\nexport const integrationListInputSchema = z.lazy(() =>\n z.strictObject({\n cursor: z\n .string()\n .nullable()\n .describe(\"Null starts the scoped listing; use the returned next cursor.\"),\n }),\n);\n\n/** Action values are JSON; action-specific validation still precedes service side effects. */\nexport const integrationExecuteInputSchema = z.lazy(() =>\n integrationConnectionInputSchema._zod.innerType.extend({\n actionId: z.string().min(1),\n input: jsonValueSchema\n .describe(\n \"JSON action input, validated against the live action schema before dispatch. Binary inputs use schema-declared byte arrays of integers 0–255, never ArrayBuffer or typed arrays; implementations convert them privately.\",\n )\n .meta({ codemodeType: \"JsonValue\" }),\n unchecked: z\n .boolean()\n .default(false)\n .describe(\n \"Required to run an action whose validation is unchecked: its input and output skip validation and the service alone rejects bad input. Checked actions validate regardless.\",\n ),\n }),\n);\n\n/**\n * Whether execution validates an action against its schemas. Unchecked actions publish contracts\n * that cannot be validated faithfully, so callers must opt in to running them.\n */\nexport const integrationActionValidationSchema = z\n .lazy(() =>\n z.discriminatedUnion(\"kind\", [\n z.strictObject({ kind: z.literal(\"checked\") }),\n z.strictObject({\n kind: z.literal(\"unchecked\"),\n reason: z.string().describe(\"Why the published schemas cannot be validated.\"),\n }),\n ]),\n )\n .meta({ id: \"IntegrationActionValidation\" });\n\n/** Integration action schemas describe the operation's own result, including asynchronous job handles. */\nexport const integrationActionSchema = z\n .lazy(() =>\n z.strictObject({\n id: z.string().min(1).describe(\"Action identity returned by actions for this connection.\"),\n label: z.string(),\n description: z.string(),\n validation: integrationActionValidationSchema,\n inputSchema: integrationJsonSchemaSchema,\n outputSchema: integrationJsonSchemaSchema.describe(\n \"Describes the action's own result, including any asynchronous job handle.\",\n ),\n }),\n )\n .meta({ id: \"IntegrationAction\" });\n\n/** Integration action metadata contains contracts but no executable handler. */\nexport type IntegrationAction = z.output<typeof integrationActionSchema>;\n\nexport const integrationGenerateClientInputSchema = z.lazy(() =>\n integrationConnectionInputSchema._zod.innerType.extend({\n out: z\n .string()\n .trim()\n .min(1)\n .describe(\n \"Absolute path of the .js module to write under /workspace. Only a module this operation generated is replaced.\",\n ),\n }),\n);\n\n/** Generated clients are snapshots of the connection's action contracts. */\nexport const integrationClientSchema = z\n .lazy(() =>\n z.strictObject({\n path: z.string(),\n exports: z.array(\n z.strictObject({\n name: z.string().describe(\"Exported function name.\"),\n actionId: z.string().describe(\"Action the function executes.\"),\n }),\n ),\n }),\n )\n .meta({ id: \"IntegrationClient\" });\n\nexport const integrationsOperations = {\n \"integrations.discover\": {\n description:\n \"Discover available services and unconfigured services in the selected scope. Service availability does not prove live health.\",\n permissions: [BACKOFFICE_PERMISSION.integrations.read],\n input: z.void(),\n output: z.lazy(() => z.array(integrationOverviewSchema)),\n },\n \"integrations.list\": {\n description:\n \"List existing configured connections in the selected scope, one cursor page at a time. Deterministic IDs reuse source-owned identities; configuration does not imply live access.\",\n permissions: [BACKOFFICE_PERMISSION.integrations.read],\n input: integrationListInputSchema,\n output: integrationListOutputSchema,\n },\n \"integrations.get\": {\n description:\n \"Inspect source-owned connection configuration, its stored non-secret settings, and available evidence without performing a live health check. The connection ID resolves only within the selected scope.\",\n permissions: [BACKOFFICE_PERMISSION.integrations.read],\n input: integrationConnectionInputSchema,\n output: inspectedIntegrationConnectionSchema,\n },\n \"integrations.setup\": {\n description:\n \"Read current requirements or submit input for a deterministic connection address. Setup is source-owned; this operation retains no attempt state or independent binding. Ready connections keep their configuration and credentials; reconfigure replaces them.\",\n permissions: [BACKOFFICE_PERMISSION.integrations.manage],\n input: integrationSetupInputSchema,\n output: integrationSetupProgressSchema,\n },\n \"integrations.reconfigure\": {\n description:\n \"Read replacement requirements or submit replacement configuration or credentials for an existing connection. Build the replacement from integrations.get settings so unchanged values carry over. Submission replaces source-owned state; continue with setup checks until ready. A missing connection needs setup.\",\n permissions: [BACKOFFICE_PERMISSION.integrations.manage],\n input: integrationSetupInputSchema,\n output: integrationSetupProgressSchema,\n },\n \"integrations.disconnect\": {\n description:\n \"Remove a connection's source-owned configuration and credentials in the selected scope. The address stays valid for a later setup. Requires confirm to repeat the connection ID.\",\n permissions: [BACKOFFICE_PERMISSION.integrations.manage],\n input: integrationDisconnectInputSchema,\n output: integrationDisconnectResultSchema,\n },\n \"integrations.backfillConnectionEvents\": {\n description:\n \"Record every configured connection's current state in the selected scope as an integrations.connection.ready or connection.unavailable event, for connections that existed before those events were recorded. Routes on those events run for each new event. Events carry each connection's name and auth method. A rerun records a connection again only when its state, name, or auth method differs from every earlier backfill of it, so a rerun adds names to connections recorded before events carried them.\",\n permissions: [BACKOFFICE_PERMISSION.integrations.manage],\n input: z.void(),\n output: integrationConnectionEventsBackfillResultSchema,\n },\n \"integrations.actions\": {\n description:\n \"Discover the selected connection's supported actions and authoritative input/output contracts without executing them. Never infer schemas from action IDs.\",\n permissions: [BACKOFFICE_PERMISSION.integrations.read],\n input: integrationConnectionInputSchema,\n output: z.lazy(() => z.array(integrationActionSchema)),\n },\n \"integrations.execute\": {\n description:\n \"Execute an explicit connection action with JSON input/output, validated against its live contracts and service permissions. Unchecked actions run only with unchecked: true. Binary inputs are schema-declared byte arrays; results retain the action's domain and asynchronous semantics.\",\n permissions: [BACKOFFICE_PERMISSION.integrations.execute],\n input: integrationExecuteInputSchema,\n output: jsonValueSchema.meta({ codemodeType: \"JsonValue\" }),\n },\n \"integrations.generateClient\": {\n description:\n \"Write a JavaScript module with one typed async function per action of the selected connection, for codemode and saved modules to import. Each function calls integrations.execute; its JSDoc types snapshot the action contracts, so regenerate after the connection's actions change.\",\n permissions: [BACKOFFICE_PERMISSION.integrations.read, BACKOFFICE_PERMISSION.upload.modify],\n input: integrationGenerateClientInputSchema,\n output: integrationClientSchema,\n },\n \"integrations.verify\": {\n description:\n \"Perform explicit supported live checks without authorizing the connection or executing service actions. Return timestamped evidence, not blanket health or retained verification state.\",\n permissions: [BACKOFFICE_PERMISSION.integrations.manage],\n input: integrationConnectionInputSchema,\n output: integrationConnectionSchema,\n },\n} satisfies Record<string, BackofficeApiOperation>;\n"],"mappings":";;;;;AAOA,MAAa,oCAAoC;CAC/C,IAAI,EAAE,WAAW,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC;CAClC,OAAO,EAAE,WAAW,EAAE,OAAO,CAAC;AAChC;AAEA,MAAa,qCAAqC,EAC/C,WACC,EAAE,mBAAmB,UAAU,CAC7B,EAAE,aAAa;CACb,GAAG;CACH,QAAQ,EAAE,QAAQ,aAAa;CAC/B,QAAQ,EAAE,OAAO;AACnB,CAAC,GACD,EAAE,aAAa;CACb,GAAG;CACH,QAAQ,EAAE,KAAK,CAAC,UAAU,QAAQ,CAAC;CACnC,WAAW,wBAAwB,SACjC,sDACF;CACA,SAAS,EAAE,OAAO;AACpB,CAAC,CACH,CAAC,CACH,CAAC,CACA,KAAK,EAAE,IAAI,+BAA+B,CAAC;AAE9C,MAAa,uCAAuC,EACjD,WACC,EAAE,mBAAmB,UAAU,CAC7B,EAAE,aAAa;CAAE,QAAQ,EAAE,QAAQ,SAAS;CAAG,eAAe,EAAE,MAAM,EAAE,OAAO,CAAC;AAAE,CAAC,GACnF,EAAE,aAAa,EAAE,QAAQ,EAAE,QAAQ,YAAY,EAAE,CAAC,CACpD,CAAC,CACH,CAAC,CACA,KAAK,EAAE,IAAI,iCAAiC,CAAC;A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a,CAAC,sBAAsB,aAAa,OAAO;EACxD,OAAO;EACP,QAAQ,gBAAgB,KAAK,EAAE,cAAc,YAAY,CAAC;CAC5D;CACA,+BAA+B;EAC7B,aACE;EACF,aAAa,CAAC,sBAAsB,aAAa,MAAM,sBAAsB,OAAO,MAAM;EAC1F,OAAO;EACP,QAAQ;CACV;CACA,uBAAuB;EACrB,aACE;EACF,aAAa,CAAC,sBAAsB,aAAa,MAAM;EACvD,OAAO;EACP,QAAQ;CACV;AACF"}
@@ -0,0 +1,160 @@
1
+ import { z } from "zod";
2
+ //#region src/v0/javascript.d.ts
3
+ declare const javaScriptBuildInputSchema: z.ZodLazy<z.ZodObject<{
4
+ path: z.ZodString;
5
+ out: z.ZodString;
6
+ }, z.core.$strict>>;
7
+ declare const javaScriptLogsInputSchema: z.ZodLazy<z.ZodObject<{
8
+ runId: z.ZodString;
9
+ }, z.core.$strict>>;
10
+ declare const javascriptOperations: {
11
+ "js.build": {
12
+ description: string;
13
+ permissions: ({
14
+ readonly namespace: "upload";
15
+ readonly permission: "modify";
16
+ } | {
17
+ readonly namespace: "upload";
18
+ readonly permission: "read";
19
+ })[];
20
+ input: z.ZodLazy<z.ZodObject<{
21
+ path: z.ZodString;
22
+ out: z.ZodString;
23
+ }, z.core.$strict>>;
24
+ output: z.ZodLazy<z.ZodDiscriminatedUnion<[z.ZodObject<{
25
+ status: z.ZodLiteral<"success">;
26
+ path: z.ZodString;
27
+ artifactPath: z.ZodString;
28
+ runId: z.ZodString;
29
+ warnings: z.ZodArray<z.ZodString>;
30
+ }, z.core.$strict>, z.ZodObject<{
31
+ status: z.ZodLiteral<"error">;
32
+ path: z.ZodString;
33
+ artifactPath: z.ZodString;
34
+ runId: z.ZodString;
35
+ error: z.ZodString;
36
+ }, z.core.$strict>, z.ZodObject<{
37
+ status: z.ZodLiteral<"rejected">;
38
+ path: z.ZodString;
39
+ artifactPath: z.ZodString;
40
+ error: z.ZodString;
41
+ }, z.core.$strict>], "status">>;
42
+ };
43
+ "js.check": {
44
+ description: string;
45
+ permissions: {
46
+ readonly namespace: "upload";
47
+ readonly permission: "read";
48
+ }[];
49
+ input: z.ZodLazy<z.ZodObject<{
50
+ path: z.ZodString;
51
+ }, z.core.$strip>>;
52
+ output: z.ZodLazy<z.ZodObject<{
53
+ path: z.ZodString;
54
+ valid: z.ZodBoolean;
55
+ diagnostics: z.ZodArray<z.ZodLazy<z.ZodObject<{
56
+ code: z.ZodNumber;
57
+ path: z.ZodNullable<z.ZodString>;
58
+ line: z.ZodNullable<z.ZodNumber>;
59
+ column: z.ZodNullable<z.ZodNumber>;
60
+ message: z.ZodString;
61
+ }, z.core.$strip>>>;
62
+ }, z.core.$strip>>;
63
+ };
64
+ "js.logs": {
65
+ description: string;
66
+ permissions: {
67
+ readonly namespace: "upload";
68
+ readonly permission: "read";
69
+ }[];
70
+ input: z.ZodLazy<z.ZodObject<{
71
+ runId: z.ZodString;
72
+ }, z.core.$strict>>;
73
+ output: z.ZodLazy<z.ZodDiscriminatedUnion<[z.ZodObject<{
74
+ runId: z.ZodString;
75
+ status: z.ZodLiteral<"running">;
76
+ }, z.core.$strip>, z.ZodObject<{
77
+ runId: z.ZodString;
78
+ status: z.ZodLiteral<"completed">;
79
+ logs: z.ZodArray<z.ZodLazy<z.ZodObject<{
80
+ at: z.ZodNumber;
81
+ channel: z.ZodEnum<{
82
+ error: "error";
83
+ log: "log";
84
+ info: "info";
85
+ debug: "debug";
86
+ warn: "warn";
87
+ codemode: "codemode";
88
+ }>;
89
+ text: z.ZodString;
90
+ }, z.core.$strip>>>;
91
+ }, z.core.$strip>, z.ZodObject<{
92
+ runId: z.ZodString;
93
+ status: z.ZodLiteral<"failed">;
94
+ logs: z.ZodArray<z.ZodLazy<z.ZodObject<{
95
+ at: z.ZodNumber;
96
+ channel: z.ZodEnum<{
97
+ error: "error";
98
+ log: "log";
99
+ info: "info";
100
+ debug: "debug";
101
+ warn: "warn";
102
+ codemode: "codemode";
103
+ }>;
104
+ text: z.ZodString;
105
+ }, z.core.$strip>>>;
106
+ error: z.ZodString;
107
+ }, z.core.$strip>], "status">>;
108
+ };
109
+ "js.run": {
110
+ description: string;
111
+ permissions: {
112
+ readonly namespace: "upload";
113
+ readonly permission: "read";
114
+ }[];
115
+ input: z.ZodLazy<z.ZodObject<{
116
+ path: z.ZodString;
117
+ }, z.core.$strip>>;
118
+ output: z.ZodLazy<z.ZodDiscriminatedUnion<[z.ZodObject<{
119
+ status: z.ZodLiteral<"success">;
120
+ path: z.ZodString;
121
+ runId: z.ZodString;
122
+ logs: z.ZodArray<z.ZodLazy<z.ZodObject<{
123
+ at: z.ZodNumber;
124
+ channel: z.ZodEnum<{
125
+ error: "error";
126
+ log: "log";
127
+ info: "info";
128
+ debug: "debug";
129
+ warn: "warn";
130
+ codemode: "codemode";
131
+ }>;
132
+ text: z.ZodString;
133
+ }, z.core.$strip>>>;
134
+ }, z.core.$strip>, z.ZodObject<{
135
+ status: z.ZodLiteral<"error">;
136
+ path: z.ZodString;
137
+ runId: z.ZodString;
138
+ error: z.ZodString;
139
+ logs: z.ZodArray<z.ZodLazy<z.ZodObject<{
140
+ at: z.ZodNumber;
141
+ channel: z.ZodEnum<{
142
+ error: "error";
143
+ log: "log";
144
+ info: "info";
145
+ debug: "debug";
146
+ warn: "warn";
147
+ codemode: "codemode";
148
+ }>;
149
+ text: z.ZodString;
150
+ }, z.core.$strip>>>;
151
+ }, z.core.$strip>, z.ZodObject<{
152
+ status: z.ZodLiteral<"rejected">;
153
+ path: z.ZodString;
154
+ error: z.ZodString;
155
+ }, z.core.$strip>], "status">>;
156
+ };
157
+ };
158
+ //#endregion
159
+ export { javaScriptBuildInputSchema, javaScriptLogsInputSchema, javascriptOperations };
160
+ //# sourceMappingURL=javascript.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"javascript.d.ts","names":[],"sources":["../../src/v0/javascript.ts"],"mappings":";;cAwBa,4BAA0B,EAAA,QAAA,EAAA;;;;cAuE1B,2BAAyB,EAAA,QAAA,EAAA;;;cAwBzB"}
@@ -0,0 +1,123 @@
1
+ import { BACKOFFICE_PERMISSION } from "./shared/permissions.js";
2
+ import { z } from "zod";
3
+ //#region src/v0/javascript.ts
4
+ /** One console call, unprefixed; `codemode` lines come from the runtime rather than the guest. */
5
+ const javaScriptLogLineSchema = z.lazy(() => z.object({
6
+ at: z.number().int(),
7
+ channel: z.enum([
8
+ "log",
9
+ "info",
10
+ "debug",
11
+ "warn",
12
+ "error",
13
+ "codemode"
14
+ ]),
15
+ text: z.string()
16
+ }));
17
+ const javaScriptCheckDiagnosticSchema = z.lazy(() => z.object({
18
+ code: z.number().int(),
19
+ path: z.string().nullable(),
20
+ line: z.number().int().positive().nullable(),
21
+ column: z.number().int().positive().nullable(),
22
+ message: z.string()
23
+ }));
24
+ const javaScriptBuildInputSchema = z.lazy(() => z.strictObject({
25
+ path: z.string().trim().min(1),
26
+ out: z.string().trim().min(1)
27
+ }));
28
+ const javaScriptBuildOutputSchema = z.lazy(() => z.discriminatedUnion("status", [
29
+ z.strictObject({
30
+ status: z.literal("success"),
31
+ path: z.string(),
32
+ artifactPath: z.string(),
33
+ runId: z.string(),
34
+ warnings: z.array(z.string())
35
+ }),
36
+ z.strictObject({
37
+ status: z.literal("error"),
38
+ path: z.string(),
39
+ artifactPath: z.string(),
40
+ runId: z.string(),
41
+ error: z.string()
42
+ }),
43
+ z.strictObject({
44
+ status: z.literal("rejected"),
45
+ path: z.string(),
46
+ artifactPath: z.string(),
47
+ error: z.string()
48
+ })
49
+ ]));
50
+ const javaScriptCheckOutputSchema = z.lazy(() => z.object({
51
+ path: z.string(),
52
+ valid: z.boolean(),
53
+ diagnostics: z.array(javaScriptCheckDiagnosticSchema)
54
+ }));
55
+ const javaScriptFileInputSchema = z.lazy(() => z.object({ path: z.string().trim().min(1) }));
56
+ const javaScriptRunOutputSchema = z.lazy(() => z.discriminatedUnion("status", [
57
+ z.object({
58
+ status: z.literal("success"),
59
+ path: z.string(),
60
+ runId: z.string(),
61
+ logs: z.array(javaScriptLogLineSchema)
62
+ }),
63
+ z.object({
64
+ status: z.literal("error"),
65
+ path: z.string(),
66
+ runId: z.string(),
67
+ error: z.string(),
68
+ logs: z.array(javaScriptLogLineSchema)
69
+ }),
70
+ z.object({
71
+ status: z.literal("rejected"),
72
+ path: z.string(),
73
+ error: z.string()
74
+ })
75
+ ]));
76
+ const javaScriptLogsInputSchema = z.lazy(() => z.strictObject({ runId: z.string().trim().min(1) }));
77
+ const javaScriptLogsOutputSchema = z.lazy(() => z.discriminatedUnion("status", [
78
+ z.object({
79
+ runId: z.string(),
80
+ status: z.literal("running")
81
+ }),
82
+ z.object({
83
+ runId: z.string(),
84
+ status: z.literal("completed"),
85
+ logs: z.array(javaScriptLogLineSchema)
86
+ }),
87
+ z.object({
88
+ runId: z.string(),
89
+ status: z.literal("failed"),
90
+ logs: z.array(javaScriptLogLineSchema),
91
+ error: z.string()
92
+ })
93
+ ]));
94
+ const javascriptOperations = {
95
+ "js.build": {
96
+ description: "Compile a saved JavaScript ES module into a reusable JSON artifact under /workspace without executing or activating it. Consumers validate exports.",
97
+ permissions: [BACKOFFICE_PERMISSION.upload.read, BACKOFFICE_PERMISSION.upload.modify],
98
+ input: javaScriptBuildInputSchema,
99
+ output: javaScriptBuildOutputSchema
100
+ },
101
+ "js.check": {
102
+ description: "Type check a standalone JavaScript file under /static or /workspace against static declarations.",
103
+ permissions: [BACKOFFICE_PERMISSION.upload.read],
104
+ input: javaScriptFileInputSchema,
105
+ output: javaScriptCheckOutputSchema
106
+ },
107
+ "js.logs": {
108
+ description: "Show the console logs and outcome of a codemode run in the current scope, by run ID. Readable only with at least the authority the run had: same principal, no extra delegation, no narrower scope restriction. Codemode run events carry run IDs; runs are kept for 7 days.",
109
+ permissions: [BACKOFFICE_PERMISSION.upload.read],
110
+ input: javaScriptLogsInputSchema,
111
+ output: javaScriptLogsOutputSchema
112
+ },
113
+ "js.run": {
114
+ description: "Run top-level statements in a saved .js source file or a built .json module artifact under /static or /workspace. Ignores exports; artifacts run without compilation and startup errors are returned.",
115
+ permissions: [BACKOFFICE_PERMISSION.upload.read],
116
+ input: javaScriptFileInputSchema,
117
+ output: javaScriptRunOutputSchema
118
+ }
119
+ };
120
+ //#endregion
121
+ export { javaScriptBuildInputSchema, javaScriptLogsInputSchema, javascriptOperations };
122
+
123
+ //# sourceMappingURL=javascript.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"javascript.js","names":[],"sources":["../../src/v0/javascript.ts"],"sourcesContent":["import { z } from \"zod\";\n\nimport type { BackofficeApiOperation } from \"../api\";\nimport { BACKOFFICE_PERMISSION } from \"./shared/permissions\";\n\n/** One console call, unprefixed; `codemode` lines come from the runtime rather than the guest. */\nconst javaScriptLogLineSchema = z.lazy(() =>\n z.object({\n at: z.number().int(),\n channel: z.enum([\"log\", \"info\", \"debug\", \"warn\", \"error\", \"codemode\"]),\n text: z.string(),\n }),\n);\n\nconst javaScriptCheckDiagnosticSchema = z.lazy(() =>\n z.object({\n code: z.number().int(),\n path: z.string().nullable(),\n line: z.number().int().positive().nullable(),\n column: z.number().int().positive().nullable(),\n message: z.string(),\n }),\n);\n\nexport const javaScriptBuildInputSchema = z.lazy(() =>\n z.strictObject({\n path: z.string().trim().min(1),\n out: z.string().trim().min(1),\n }),\n);\n\n// `rejected` means no build run was recorded; the other outcomes name their run for js.logs.\nconst javaScriptBuildOutputSchema = z.lazy(() =>\n z.discriminatedUnion(\"status\", [\n z.strictObject({\n status: z.literal(\"success\"),\n path: z.string(),\n artifactPath: z.string(),\n runId: z.string(),\n warnings: z.array(z.string()),\n }),\n z.strictObject({\n status: z.literal(\"error\"),\n path: z.string(),\n artifactPath: z.string(),\n runId: z.string(),\n error: z.string(),\n }),\n z.strictObject({\n status: z.literal(\"rejected\"),\n path: z.string(),\n artifactPath: z.string(),\n error: z.string(),\n }),\n ]),\n);\n\nconst javaScriptCheckOutputSchema = z.lazy(() =>\n z.object({\n path: z.string(),\n valid: z.boolean(),\n diagnostics: z.array(javaScriptCheckDiagnosticSchema),\n }),\n);\n\nconst javaScriptFileInputSchema = z.lazy(() =>\n z.object({\n path: z.string().trim().min(1),\n }),\n);\n\n// `rejected` means no run result: the file was refused or execution could not start or report.\nconst javaScriptRunOutputSchema = z.lazy(() =>\n z.discriminatedUnion(\"status\", [\n z.object({\n status: z.literal(\"success\"),\n path: z.string(),\n runId: z.string(),\n logs: z.array(javaScriptLogLineSchema),\n }),\n z.object({\n status: z.literal(\"error\"),\n path: z.string(),\n runId: z.string(),\n error: z.string(),\n logs: z.array(javaScriptLogLineSchema),\n }),\n z.object({\n status: z.literal(\"rejected\"),\n path: z.string(),\n error: z.string(),\n }),\n ]),\n);\n\nexport const javaScriptLogsInputSchema = z.lazy(() =>\n z.strictObject({\n runId: z.string().trim().min(1),\n }),\n);\n\n// A running run has no logs yet: they are stored with its outcome.\nconst javaScriptLogsOutputSchema = z.lazy(() =>\n z.discriminatedUnion(\"status\", [\n z.object({ runId: z.string(), status: z.literal(\"running\") }),\n z.object({\n runId: z.string(),\n status: z.literal(\"completed\"),\n logs: z.array(javaScriptLogLineSchema),\n }),\n z.object({\n runId: z.string(),\n status: z.literal(\"failed\"),\n logs: z.array(javaScriptLogLineSchema),\n error: z.string(),\n }),\n ]),\n);\n\nexport const javascriptOperations = {\n \"js.build\": {\n description:\n \"Compile a saved JavaScript ES module into a reusable JSON artifact under /workspace without executing or activating it. Consumers validate exports.\",\n permissions: [BACKOFFICE_PERMISSION.upload.read, BACKOFFICE_PERMISSION.upload.modify],\n input: javaScriptBuildInputSchema,\n output: javaScriptBuildOutputSchema,\n },\n \"js.check\": {\n description:\n \"Type check a standalone JavaScript file under /static or /workspace against static declarations.\",\n permissions: [BACKOFFICE_PERMISSION.upload.read],\n input: javaScriptFileInputSchema,\n output: javaScriptCheckOutputSchema,\n },\n \"js.logs\": {\n description:\n \"Show the console logs and outcome of a codemode run in the current scope, by run ID. Readable only with at least the authority the run had: same principal, no extra delegation, no narrower scope restriction. Codemode run events carry run IDs; runs are kept for 7 days.\",\n // The runtime also requires the reader to hold at least the run's authority.\n permissions: [BACKOFFICE_PERMISSION.upload.read],\n input: javaScriptLogsInputSchema,\n output: javaScriptLogsOutputSchema,\n },\n \"js.run\": {\n description:\n \"Run top-level statements in a saved .js source file or a built .json module artifact under /static or /workspace. Ignores exports; artifacts run without compilation and startup errors are returned.\",\n permissions: [BACKOFFICE_PERMISSION.upload.read],\n input: javaScriptFileInputSchema,\n output: javaScriptRunOutputSchema,\n },\n} satisfies Record<string, BackofficeApiOperation>;\n"],"mappings":";;;;AAMA,MAAM,0BAA0B,EAAE,WAChC,EAAE,OAAO;CACP,IAAI,EAAE,OAAO,CAAC,CAAC,IAAI;CACnB,SAAS,EAAE,KAAK;EAAC;EAAO;EAAQ;EAAS;EAAQ;EAAS;CAAU,CAAC;CACrE,MAAM,EAAE,OAAO;AACjB,CAAC,CACH;AAEA,MAAM,kCAAkC,EAAE,WACxC,EAAE,OAAO;CACP,MAAM,EAAE,OAAO,CAAC,CAAC,IAAI;CACrB,MAAM,EAAE,OAAO,CAAC,CAAC,SAAS;CAC1B,MAAM,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,SAAS,CAAC,CAAC,SAAS;CAC3C,QAAQ,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,SAAS,CAAC,CAAC,SAAS;CAC7C,SAAS,EAAE,OAAO;AACpB,CAAC,CACH;AAEA,MAAa,6BAA6B,EAAE,WAC1C,EAAE,aAAa;CACb,MAAM,EAAE,OAAO,CAAC,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC;CAC7B,KAAK,EAAE,OAAO,CAAC,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC;AAC9B,CAAC,CACH;AAGA,MAAM,8BAA8B,EAAE,WACpC,EAAE,mBAAmB,UAAU;CAC7B,EAAE,aAAa;EACb,QAAQ,EAAE,QAAQ,SAAS;EAC3B,MAAM,EAAE,OAAO;EACf,cAAc,EAAE,OAAO;E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