@xyne/workflow-sdk 3.2.29 → 3.2.32

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 (109) hide show
  1. package/dist/agents/agent-step.d.ts +9 -3
  2. package/dist/agents/agent-step.d.ts.map +1 -1
  3. package/dist/agents/agent-step.js +11 -9
  4. package/dist/agents/agent-step.js.map +1 -1
  5. package/dist/agents/citation-resolve.d.ts.map +1 -1
  6. package/dist/agents/citation-resolve.js +2 -2
  7. package/dist/agents/citation-resolve.js.map +1 -1
  8. package/dist/client/index.d.ts +1 -1
  9. package/dist/client/index.d.ts.map +1 -1
  10. package/dist/client/types.d.ts +35 -17
  11. package/dist/client/types.d.ts.map +1 -1
  12. package/dist/client/workflow-client.d.ts.map +1 -1
  13. package/dist/client/workflow-client.js +24 -13
  14. package/dist/client/workflow-client.js.map +1 -1
  15. package/dist/common/citation-ref.d.ts +32 -21
  16. package/dist/common/citation-ref.d.ts.map +1 -1
  17. package/dist/common/citation-ref.js +40 -27
  18. package/dist/common/citation-ref.js.map +1 -1
  19. package/dist/common/credentials.d.ts +258 -0
  20. package/dist/common/credentials.d.ts.map +1 -0
  21. package/dist/common/credentials.js +176 -0
  22. package/dist/common/credentials.js.map +1 -0
  23. package/dist/common/expression-eval.d.ts +35 -0
  24. package/dist/common/expression-eval.d.ts.map +1 -0
  25. package/dist/common/expression-eval.js +214 -0
  26. package/dist/common/expression-eval.js.map +1 -0
  27. package/dist/common/index.d.ts +7 -1
  28. package/dist/common/index.d.ts.map +1 -1
  29. package/dist/common/index.js +19 -1
  30. package/dist/common/index.js.map +1 -1
  31. package/dist/common/principal.d.ts +45 -0
  32. package/dist/common/principal.d.ts.map +1 -0
  33. package/dist/common/principal.js +9 -0
  34. package/dist/common/principal.js.map +1 -0
  35. package/dist/engine/workflow-executor.d.ts.map +1 -1
  36. package/dist/engine/workflow-executor.js +24 -9
  37. package/dist/engine/workflow-executor.js.map +1 -1
  38. package/dist/index.d.ts +4 -2
  39. package/dist/index.d.ts.map +1 -1
  40. package/dist/index.js +2 -0
  41. package/dist/index.js.map +1 -1
  42. package/dist/persistence/in-memory-adapter.d.ts +93 -29
  43. package/dist/persistence/in-memory-adapter.d.ts.map +1 -1
  44. package/dist/persistence/in-memory-adapter.js +171 -52
  45. package/dist/persistence/in-memory-adapter.js.map +1 -1
  46. package/dist/persistence/types.d.ts +84 -26
  47. package/dist/persistence/types.d.ts.map +1 -1
  48. package/dist/router/workflow-router.d.ts +3 -1
  49. package/dist/router/workflow-router.d.ts.map +1 -1
  50. package/dist/router/workflow-router.js +218 -40
  51. package/dist/router/workflow-router.js.map +1 -1
  52. package/dist/runtime/workflow-runtime.d.ts +22 -30
  53. package/dist/runtime/workflow-runtime.d.ts.map +1 -1
  54. package/dist/runtime/workflow-runtime.js +46 -54
  55. package/dist/runtime/workflow-runtime.js.map +1 -1
  56. package/dist/steps/base-step.d.ts +12 -26
  57. package/dist/steps/base-step.d.ts.map +1 -1
  58. package/dist/steps/base-step.js +2 -4
  59. package/dist/steps/base-step.js.map +1 -1
  60. package/dist/steps/builtin/code.step.d.ts +7 -3
  61. package/dist/steps/builtin/code.step.d.ts.map +1 -1
  62. package/dist/steps/builtin/code.step.js +77 -47
  63. package/dist/steps/builtin/code.step.js.map +1 -1
  64. package/dist/steps/builtin/http-request.step.d.ts +18 -264
  65. package/dist/steps/builtin/http-request.step.d.ts.map +1 -1
  66. package/dist/steps/builtin/http-request.step.js +48 -157
  67. package/dist/steps/builtin/http-request.step.js.map +1 -1
  68. package/dist/steps/builtin/ssrf-guard.d.ts +9 -0
  69. package/dist/steps/builtin/ssrf-guard.d.ts.map +1 -0
  70. package/dist/steps/builtin/ssrf-guard.js +115 -0
  71. package/dist/steps/builtin/ssrf-guard.js.map +1 -0
  72. package/dist/steps/builtin/switch.step.d.ts +14 -14
  73. package/dist/steps/builtin/transform.step.d.ts +247 -0
  74. package/dist/steps/builtin/transform.step.d.ts.map +1 -0
  75. package/dist/steps/builtin/transform.step.js +135 -0
  76. package/dist/steps/builtin/transform.step.js.map +1 -0
  77. package/dist/steps/builtin/wait.step.d.ts +56 -56
  78. package/dist/steps/step-registry.d.ts +1 -3
  79. package/dist/steps/step-registry.d.ts.map +1 -1
  80. package/dist/steps/step-registry.js +0 -1
  81. package/dist/steps/step-registry.js.map +1 -1
  82. package/dist/testing/index.d.ts +1 -1
  83. package/dist/testing/index.d.ts.map +1 -1
  84. package/dist/testing/index.js +1 -1
  85. package/dist/testing/index.js.map +1 -1
  86. package/dist/testing/mock-step-context.d.ts +7 -2
  87. package/dist/testing/mock-step-context.d.ts.map +1 -1
  88. package/dist/testing/mock-step-context.js +9 -1
  89. package/dist/testing/mock-step-context.js.map +1 -1
  90. package/dist/triggers/webhook-trigger.d.ts +1 -5
  91. package/dist/triggers/webhook-trigger.d.ts.map +1 -1
  92. package/dist/triggers/webhook-trigger.js.map +1 -1
  93. package/dist/types/attachment.d.ts +23 -0
  94. package/dist/types/attachment.d.ts.map +1 -0
  95. package/dist/types/attachment.js +2 -0
  96. package/dist/types/attachment.js.map +1 -0
  97. package/dist/types/resume-payload.d.ts +34 -0
  98. package/dist/types/resume-payload.d.ts.map +1 -0
  99. package/dist/types/resume-payload.js +12 -0
  100. package/dist/types/resume-payload.js.map +1 -0
  101. package/dist/util/executable-check.d.ts +42 -0
  102. package/dist/util/executable-check.d.ts.map +1 -0
  103. package/dist/util/executable-check.js +115 -0
  104. package/dist/util/executable-check.js.map +1 -0
  105. package/package.json +2 -2
  106. package/dist/authz/principal-field.d.ts +0 -23
  107. package/dist/authz/principal-field.d.ts.map +0 -1
  108. package/dist/authz/principal-field.js +0 -34
  109. package/dist/authz/principal-field.js.map +0 -1
@@ -141,40 +141,53 @@ export const CitationRefSchema = z.discriminatedUnion('kind', [
141
141
  DerivedCitationSchema,
142
142
  ]);
143
143
  /**
144
- * The path segments under a step's output where a cited agent puts its answer:
145
- * `…output.response.value`, with the citation mirror as its sibling
146
- * `…output.response.citation`.
147
- *
148
- * Defined HERE, beside the schema that produces the shape, and imported by the
149
- * consumer that navigates it. The two used to agree only by coincidence — a
150
- * string literal in the UI matching what the agent step happened to emit — so a
151
- * rename would have broken resolution silently at runtime. Now it breaks the
152
- * build instead.
144
+ * The canonical (agent) cited-value shape and, above all, its DEPTH: a cited
145
+ * `{ value, citation }` pair sits directly inside a step's output envelope —
146
+ * `output.<envelope>.value`, three segments — with the citation mirror as its
147
+ * sibling `output.<envelope>.citation`.
148
+ *
149
+ * `'response'` is only the agent's envelope word; {@link splitCitedRef} matches
150
+ * the *shape*, not the word, so any executor's envelope qualifies (see there). The
151
+ * constant is retained for its LENGTH the envelope depth every consumer floors
152
+ * or slices against — and as the canonical example of the shape.
153
153
  */
154
154
  export const CITED_VALUE_SEGMENTS = ['output', 'response', 'value'];
155
155
  /**
156
- * Split a ref at the boundary between "which cited response" and "which field
157
- * inside it": `a.b.output.response.value.x.y` → `{ base:'a.b', field:['x','y'] }`.
158
- *
159
- * The invariant this expresses is *relative* a citation mirror is always the
160
- * value's sibling, at whatever depth the value sits. Earlier code encoded it as an
161
- * absolute pattern (`steps.<id>.output.response.value`), which silently stopped
162
- * matching the moment a step lived inside a PARALLEL and its output moved to
163
- * `steps.<container>.output.branches.<b>.steps.<id>.output.…`. Matching the
164
- * boundary wherever it occurs keeps this working at any nesting depth, so no
165
- * future control-flow shape can break it.
166
- *
167
- * Matched segment-wise rather than by substring, so a field genuinely named
168
- * `valueX` or any path that merely contains these words — cannot false-match.
169
- * The LAST occurrence wins: with nesting, the innermost cited response is the one
170
- * that owns the field.
156
+ * Split a ref at the boundary between "which cited value" and "which field inside
157
+ * it": `a.b.output.result.value.x.y` → `{ base:'a.b', envelope:'result', field:['x','y'] }`.
158
+ *
159
+ * Two invariants, both *relative* so no control-flow shape can break them:
160
+ *
161
+ * 1. A citation mirror is always the value's sibling, at whatever depth the value
162
+ * sits. Encoding this as an absolute pattern (`steps.<id>.output.response.value`)
163
+ * silently stopped matching the moment a step lived inside a PARALLEL, whose
164
+ * output moved to `steps.<container>.output.branches.<b>.steps.<id>.output.…`.
165
+ *
166
+ * 2. The envelope word is the PRODUCING EXECUTOR's, not a fixed literal: a
167
+ * RUN_AGENT emits `output.response.value`, a CODE step (e.g. a merge that
168
+ * returns `{ value, citation }`) emits `output.result.value`, and a future
169
+ * executor may emit another word. So we match the SHAPE `output.<one
170
+ * segment>.value` and report which envelope was found. Whitelisting words
171
+ * (`response`, then `result`, then …) would be an endless list; keying on the
172
+ * pair is the actual convention.
173
+ *
174
+ * Anchoring on `output` (rather than a bare `.value`) keeps a data field genuinely
175
+ * named `value` from matching. The real gate, though, is the caller: it looks up
176
+ * the sibling `output.<envelope>.citation` and bails when it does not resolve — so
177
+ * a value that isn't a cited pair self-rejects, wildcard envelope notwithstanding.
178
+ *
179
+ * Matched segment-wise, never by substring, so `valueX` cannot false-match. The
180
+ * LAST occurrence wins: with nesting, the innermost cited value owns the field.
171
181
  */
172
182
  export function splitCitedRef(ref) {
173
183
  const s = ref.split('.');
174
- const [a, b, c] = CITED_VALUE_SEGMENTS;
175
184
  for (let i = s.length - CITED_VALUE_SEGMENTS.length; i >= 0; i--) {
176
- if (s[i] === a && s[i + 1] === b && s[i + 2] === c) {
177
- return { base: s.slice(0, i).join('.'), field: s.slice(i + CITED_VALUE_SEGMENTS.length) };
185
+ if (s[i] === 'output' && s[i + 2] === 'value') {
186
+ return {
187
+ base: s.slice(0, i).join('.'),
188
+ envelope: s[i + 1],
189
+ field: s.slice(i + CITED_VALUE_SEGMENTS.length),
190
+ };
178
191
  }
179
192
  }
180
193
  return undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"citation-ref.js","sourceRoot":"","sources":["../../src/common/citation-ref.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAElE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG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F,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,CAAU,CAAC"}
@@ -0,0 +1,258 @@
1
+ import { z } from 'zod';
2
+ import type { Action } from '../authz/types.js';
3
+ import type { ResourceAttributes } from '../authz/attributes.js';
4
+ export declare const CredentialStatusSchema: z.ZodEnum<["ACTIVE", "REVOKED"]>;
5
+ export type CredentialStatus = z.infer<typeof CredentialStatusSchema>;
6
+ export type CredentialFieldControl = 'password' | 'text' | 'url';
7
+ export interface CredentialRegistryInputField {
8
+ readonly key: string;
9
+ readonly label: string;
10
+ readonly control: CredentialFieldControl;
11
+ /** Optional example hint shown as the input's placeholder. */
12
+ readonly placeholder?: string;
13
+ }
14
+ export type CredentialRegistryEntryField = CredentialRegistryInputField;
15
+ interface CredentialRegistryEntryBase {
16
+ readonly label: string;
17
+ readonly fields: readonly CredentialRegistryEntryField[];
18
+ }
19
+ /**
20
+ * Bearer token values.
21
+ *
22
+ * Runtime: `Authorization: Bearer <token>` is added to the request.
23
+ */
24
+ export declare const BearerValuesSchema: z.ZodObject<{
25
+ token: z.ZodString;
26
+ }, "strict", z.ZodTypeAny, {
27
+ token: string;
28
+ }, {
29
+ token: string;
30
+ }>;
31
+ export type BearerValues = z.infer<typeof BearerValuesSchema>;
32
+ /**
33
+ * HTTP Basic authentication values.
34
+ *
35
+ * Runtime: `Authorization: Basic base64(username:password)` is added.
36
+ */
37
+ export declare const BasicValuesSchema: z.ZodObject<{
38
+ username: z.ZodString;
39
+ password: z.ZodString;
40
+ }, "strict", z.ZodTypeAny, {
41
+ password: string;
42
+ username: string;
43
+ }, {
44
+ password: string;
45
+ username: string;
46
+ }>;
47
+ export type BasicValues = z.infer<typeof BasicValuesSchema>;
48
+ /**
49
+ * Custom header values.
50
+ *
51
+ * Runtime: a single header `<name>: <value>` is added to the request.
52
+ */
53
+ export declare const CustomHeaderValuesSchema: z.ZodObject<{
54
+ name: z.ZodString;
55
+ value: z.ZodString;
56
+ }, "strict", z.ZodTypeAny, {
57
+ value: string;
58
+ name: string;
59
+ }, {
60
+ value: string;
61
+ name: string;
62
+ }>;
63
+ export type CustomHeaderValues = z.infer<typeof CustomHeaderValuesSchema>;
64
+ /**
65
+ * OAuth 2.0 client credentials values.
66
+ */
67
+ export declare const OAuth2ClientCredentialsValuesSchema: z.ZodObject<{
68
+ tokenUrl: z.ZodString;
69
+ clientId: z.ZodString;
70
+ clientSecret: z.ZodString;
71
+ }, "strict", z.ZodTypeAny, {
72
+ tokenUrl: string;
73
+ clientId: string;
74
+ clientSecret: string;
75
+ }, {
76
+ tokenUrl: string;
77
+ clientId: string;
78
+ clientSecret: string;
79
+ }>;
80
+ export type OAuth2ClientCredentialsValues = z.infer<typeof OAuth2ClientCredentialsValuesSchema>;
81
+ /**
82
+ * Credential authentication is discriminated by `authType`, keeping each
83
+ * authentication type paired with its exact values shape.
84
+ */
85
+ export declare const CredentialAuthSchema: z.ZodDiscriminatedUnion<"authType", [z.ZodObject<{
86
+ authType: z.ZodLiteral<"bearer">;
87
+ values: z.ZodObject<{
88
+ token: z.ZodString;
89
+ }, "strict", z.ZodTypeAny, {
90
+ token: string;
91
+ }, {
92
+ token: string;
93
+ }>;
94
+ }, "strict", z.ZodTypeAny, {
95
+ values: {
96
+ token: string;
97
+ };
98
+ authType: "bearer";
99
+ }, {
100
+ values: {
101
+ token: string;
102
+ };
103
+ authType: "bearer";
104
+ }>, z.ZodObject<{
105
+ authType: z.ZodLiteral<"basic">;
106
+ values: z.ZodObject<{
107
+ username: z.ZodString;
108
+ password: z.ZodString;
109
+ }, "strict", z.ZodTypeAny, {
110
+ password: string;
111
+ username: string;
112
+ }, {
113
+ password: string;
114
+ username: string;
115
+ }>;
116
+ }, "strict", z.ZodTypeAny, {
117
+ values: {
118
+ password: string;
119
+ username: string;
120
+ };
121
+ authType: "basic";
122
+ }, {
123
+ values: {
124
+ password: string;
125
+ username: string;
126
+ };
127
+ authType: "basic";
128
+ }>, z.ZodObject<{
129
+ authType: z.ZodLiteral<"custom_header">;
130
+ values: z.ZodObject<{
131
+ name: z.ZodString;
132
+ value: z.ZodString;
133
+ }, "strict", z.ZodTypeAny, {
134
+ value: string;
135
+ name: string;
136
+ }, {
137
+ value: string;
138
+ name: string;
139
+ }>;
140
+ }, "strict", z.ZodTypeAny, {
141
+ values: {
142
+ value: string;
143
+ name: string;
144
+ };
145
+ authType: "custom_header";
146
+ }, {
147
+ values: {
148
+ value: string;
149
+ name: string;
150
+ };
151
+ authType: "custom_header";
152
+ }>, z.ZodObject<{
153
+ authType: z.ZodLiteral<"oauth2_client_credentials">;
154
+ values: z.ZodObject<{
155
+ tokenUrl: z.ZodString;
156
+ clientId: z.ZodString;
157
+ clientSecret: z.ZodString;
158
+ }, "strict", z.ZodTypeAny, {
159
+ tokenUrl: string;
160
+ clientId: string;
161
+ clientSecret: string;
162
+ }, {
163
+ tokenUrl: string;
164
+ clientId: string;
165
+ clientSecret: string;
166
+ }>;
167
+ }, "strict", z.ZodTypeAny, {
168
+ values: {
169
+ tokenUrl: string;
170
+ clientId: string;
171
+ clientSecret: string;
172
+ };
173
+ authType: "oauth2_client_credentials";
174
+ }, {
175
+ values: {
176
+ tokenUrl: string;
177
+ clientId: string;
178
+ clientSecret: string;
179
+ };
180
+ authType: "oauth2_client_credentials";
181
+ }>]>;
182
+ export type CredentialAuth = z.infer<typeof CredentialAuthSchema>;
183
+ export type CredentialAuthType = CredentialAuth['authType'];
184
+ export type AuthSpecificValues = CredentialAuth['values'];
185
+ /**
186
+ * Per-auth-type value schemas, extracted from the discriminated union.
187
+ */
188
+ export declare const CREDENTIAL_VALUE_SCHEMAS: Record<CredentialAuthType, z.ZodTypeAny>;
189
+ export declare function validateCredentialAuth(authType: CredentialAuthType, values: unknown): CredentialAuth;
190
+ export declare function validateCredentialValues(authType: CredentialAuthType, values: unknown): AuthSpecificValues;
191
+ export declare const CredentialNameSchema: z.ZodString;
192
+ export interface CredentialSummary {
193
+ readonly name: string;
194
+ readonly authType: CredentialAuthType;
195
+ readonly status: CredentialStatus;
196
+ readonly createdAt: number;
197
+ readonly updatedAt: number;
198
+ }
199
+ export type ResolvedCredential = Readonly<{
200
+ name: string;
201
+ status: CredentialStatus;
202
+ }> & Readonly<CredentialAuth>;
203
+ /**
204
+ * Apply an already-resolved credential to HTTP request headers.
205
+ *
206
+ * Credential resolution belongs to the executor/runtime. This shared helper
207
+ * only translates the validated credential value into its HTTP representation,
208
+ * so workflow steps and server-side credential testing use identical logic.
209
+ */
210
+ export declare function applyResolvedCredentialAuth(headers: Headers, credential: ResolvedCredential): void;
211
+ export type CreateCredentialInput = Readonly<{
212
+ name: string;
213
+ }> & Readonly<CredentialAuth>;
214
+ export interface ReplaceCredentialValuesInput {
215
+ readonly values: AuthSpecificValues;
216
+ }
217
+ /**
218
+ * One safe credential row returned by list operations.
219
+ *
220
+ * `summary` is the SDK-owned credential shape. `attributes` is the host-owned,
221
+ * typed metadata carried opaquely by the SDK. `permittedActions` is projected
222
+ * by the runtime so UIs can gate row actions without knowing host policy.
223
+ */
224
+ export interface CredentialListItem {
225
+ readonly summary: CredentialSummary;
226
+ readonly attributes?: ResourceAttributes<'credential'>;
227
+ readonly permittedActions?: readonly Action[];
228
+ }
229
+ export interface CredentialListResponse {
230
+ readonly credentials: CredentialListItem[];
231
+ }
232
+ /** Safe request shape for testing a stored credential against an HTTP endpoint. */
233
+ export interface TestCredentialInput {
234
+ readonly url: string;
235
+ readonly method?: string;
236
+ readonly headers?: Record<string, string>;
237
+ readonly body?: string;
238
+ }
239
+ /** Redacted result of a server-side credential test. Secret values are never returned. */
240
+ export interface TestCredentialResult {
241
+ readonly ok: boolean;
242
+ readonly status?: number;
243
+ readonly statusText?: string;
244
+ readonly durationMs?: number;
245
+ readonly headers?: Record<string, string>;
246
+ readonly bodyText?: string;
247
+ readonly error?: string;
248
+ }
249
+ export interface CredentialRegistryEntry extends CredentialRegistryEntryBase {
250
+ readonly type: CredentialAuthType;
251
+ }
252
+ /**
253
+ * Minimal registry for host-rendered credential forms. Entries and field keys
254
+ * are extracted from CredentialAuthSchema; Zod remains the source of truth.
255
+ */
256
+ export declare const CREDENTIAL_AUTH_REGISTRY: readonly CredentialRegistryEntry[];
257
+ export {};
258
+ //# sourceMappingURL=credentials.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"credentials.d.ts","sourceRoot":"","sources":["../../src/common/credentials.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAEjE,eAAO,MAAM,sBAAsB,kCAAgC,CAAC;AACpE,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAEtE,MAAM,MAAM,sBAAsB,GAAG,UAAU,GAAG,MAAM,GAAG,KAAK,CAAC;AAEjE,MAAM,WAAW,4BAA4B;IAC3C,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,OAAO,EAAE,sBAAsB,CAAC;IACzC,8DAA8D;IAC9D,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;CAC/B;AAED,MAAM,MAAM,4BAA4B,GAAG,4BAA4B,CAAC;AAExE,UAAU,2BAA2B;IACnC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAE,SAAS,4BAA4B,EAAE,CAAC;CAC1D;AAgBD;;;;GAIG;AACH,eAAO,MAAM,kBAAkB;;;;;;EAOpB,CAAC;AAEZ,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAE9D;;;;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AA0F;AAC1F,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,EAAE,EAAE,OAAO,CAAC;IACrB,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC1C,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,uBAAwB,SAAQ,2BAA2B;IAC1E,QAAQ,CAAC,IAAI,EAAE,kBAAkB,CAAC;CACnC;AAcD;;;GAGG;AACH,eAAO,MAAM,wBAAwB,EAAE,SAAS,uBAAuB,EAKlE,CAAC"}
@@ -0,0 +1,176 @@
1
+ import { z } from 'zod';
2
+ export const CredentialStatusSchema = z.enum(['ACTIVE', 'REVOKED']);
3
+ const credentialFieldMetadata = new WeakMap();
4
+ function credentialField(schema, metadata) {
5
+ const describedSchema = schema.describe(metadata.label);
6
+ credentialFieldMetadata.set(describedSchema, metadata);
7
+ return describedSchema;
8
+ }
9
+ /**
10
+ * Bearer token values.
11
+ *
12
+ * Runtime: `Authorization: Bearer <token>` is added to the request.
13
+ */
14
+ export const BearerValuesSchema = z
15
+ .object({
16
+ token: credentialField(z.string().min(1), {
17
+ label: 'Token',
18
+ control: 'password',
19
+ }),
20
+ })
21
+ .strict();
22
+ /**
23
+ * HTTP Basic authentication values.
24
+ *
25
+ * Runtime: `Authorization: Basic base64(username:password)` is added.
26
+ */
27
+ export const BasicValuesSchema = z
28
+ .object({
29
+ username: credentialField(z.string().min(1), {
30
+ label: 'Username',
31
+ control: 'text',
32
+ }),
33
+ password: credentialField(z.string().min(1), {
34
+ label: 'Password',
35
+ control: 'password',
36
+ }),
37
+ })
38
+ .strict();
39
+ /**
40
+ * Custom header values.
41
+ *
42
+ * Runtime: a single header `<name>: <value>` is added to the request.
43
+ */
44
+ export const CustomHeaderValuesSchema = z
45
+ .object({
46
+ name: credentialField(z.string().min(1), {
47
+ label: 'Header name',
48
+ control: 'text',
49
+ placeholder: 'e.g. X-Custom-Token',
50
+ }),
51
+ value: credentialField(z.string().min(1), {
52
+ label: 'Header value',
53
+ control: 'password',
54
+ placeholder: 'The header value to send',
55
+ }),
56
+ })
57
+ .strict();
58
+ /**
59
+ * OAuth 2.0 client credentials values.
60
+ */
61
+ export const OAuth2ClientCredentialsValuesSchema = z
62
+ .object({
63
+ tokenUrl: credentialField(z.string().url(), {
64
+ label: 'Token URL',
65
+ control: 'url',
66
+ }),
67
+ clientId: credentialField(z.string().min(1), {
68
+ label: 'Client ID',
69
+ control: 'text',
70
+ }),
71
+ clientSecret: credentialField(z.string().min(1), {
72
+ label: 'Client Secret',
73
+ control: 'password',
74
+ }),
75
+ })
76
+ .strict();
77
+ const BearerCredentialAuthSchema = z
78
+ .object({
79
+ authType: z.literal('bearer'),
80
+ values: BearerValuesSchema,
81
+ })
82
+ .strict()
83
+ .describe('Bearer Token');
84
+ const BasicCredentialAuthSchema = z
85
+ .object({
86
+ authType: z.literal('basic'),
87
+ values: BasicValuesSchema,
88
+ })
89
+ .strict()
90
+ .describe('Basic Auth');
91
+ const CustomHeaderCredentialAuthSchema = z
92
+ .object({
93
+ authType: z.literal('custom_header'),
94
+ values: CustomHeaderValuesSchema,
95
+ })
96
+ .strict()
97
+ .describe('Custom Header');
98
+ const OAuth2ClientCredentialsCredentialAuthSchema = z
99
+ .object({
100
+ authType: z.literal('oauth2_client_credentials'),
101
+ values: OAuth2ClientCredentialsValuesSchema,
102
+ })
103
+ .strict()
104
+ .describe('OAuth 2.0 Client Credentials');
105
+ /**
106
+ * Credential authentication is discriminated by `authType`, keeping each
107
+ * authentication type paired with its exact values shape.
108
+ */
109
+ export const CredentialAuthSchema = z.discriminatedUnion('authType', [
110
+ BearerCredentialAuthSchema,
111
+ BasicCredentialAuthSchema,
112
+ CustomHeaderCredentialAuthSchema,
113
+ OAuth2ClientCredentialsCredentialAuthSchema,
114
+ ]);
115
+ /**
116
+ * Per-auth-type value schemas, extracted from the discriminated union.
117
+ */
118
+ export const CREDENTIAL_VALUE_SCHEMAS = Object.fromEntries(CredentialAuthSchema.options.map((option) => [
119
+ option.shape.authType.value,
120
+ option.shape.values,
121
+ ]));
122
+ export function validateCredentialAuth(authType, values) {
123
+ return CredentialAuthSchema.parse({ authType, values });
124
+ }
125
+ export function validateCredentialValues(authType, values) {
126
+ return validateCredentialAuth(authType, values).values;
127
+ }
128
+ export const CredentialNameSchema = z.string().min(1).max(255);
129
+ /**
130
+ * Apply an already-resolved credential to HTTP request headers.
131
+ *
132
+ * Credential resolution belongs to the executor/runtime. This shared helper
133
+ * only translates the validated credential value into its HTTP representation,
134
+ * so workflow steps and server-side credential testing use identical logic.
135
+ */
136
+ export function applyResolvedCredentialAuth(headers, credential) {
137
+ switch (credential.authType) {
138
+ case 'bearer': {
139
+ const { token } = credential.values;
140
+ headers.set('authorization', `Bearer ${token}`);
141
+ break;
142
+ }
143
+ case 'basic': {
144
+ const { username, password } = credential.values;
145
+ headers.set('authorization', `Basic ${btoa(`${username}:${password}`)}`);
146
+ break;
147
+ }
148
+ case 'custom_header': {
149
+ const { name, value } = credential.values;
150
+ headers.set(name, value);
151
+ break;
152
+ }
153
+ case 'oauth2_client_credentials': {
154
+ throw new Error('oauth2_client_credentials is not yet supported for HTTP requests');
155
+ }
156
+ }
157
+ }
158
+ function extractRegistryFields(schema) {
159
+ return Object.entries(schema.shape).map(([key, fieldSchema]) => {
160
+ const metadata = credentialFieldMetadata.get(fieldSchema);
161
+ if (!metadata) {
162
+ throw new Error(`Credential field "${key}" is missing UI metadata`);
163
+ }
164
+ return { key, ...metadata };
165
+ });
166
+ }
167
+ /**
168
+ * Minimal registry for host-rendered credential forms. Entries and field keys
169
+ * are extracted from CredentialAuthSchema; Zod remains the source of truth.
170
+ */
171
+ export const CREDENTIAL_AUTH_REGISTRY = CredentialAuthSchema.options.map((option) => ({
172
+ type: option.shape.authType.value,
173
+ label: option.description ?? option.shape.authType.value,
174
+ fields: extractRegistryFields(option.shape.values),
175
+ }));
176
+ //# sourceMappingURL=credentials.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"credentials.js","sourceRoot":"","sources":["../../src/common/credentials.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC,CAAC;AAoBpE,MAAM,uBAAuB,GAAG,IAAI,OAAO,EAGxC,CAAC;AAEJ,SAAS,eAAe,CACtB,MAAe,EACf,QAAmD;IAEnD,MAAM,eAAe,GAAG,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IACxD,uBAAuB,CAAC,GAAG,CAAC,eAAe,EAAE,QAAQ,CAAC,CAAC;IACvD,OAAO,eAAe,CAAC;AACzB,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC;KAChC,MAAM,CAAC;IACN,KAAK,EAAE,eAAe,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE;QACxC,KAAK,EAAE,OAAO;QACd,OAAO,EAAE,UAAU;KACpB,CAAC;CACH,CAAC;KACD,MAAM,EAAE,CAAC;AAIZ;;;;GAIG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC;KAC/B,MAAM,CAAC;IACN,QAAQ,EAAE,eAAe,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE;QAC3C,KAAK,EAAE,UAAU;QACjB,OAAO,EAAE,MAAM;KAChB,CAAC;IACF,QAAQ,E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,SAAS,qBAAqB,CAC5B,MAAsB;IAEtB,OAAO,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,WAAW,CAAC,EAAE,EAAE;QAC7D,MAAM,QAAQ,GAAG,uBAAuB,CAAC,GAAG,CAAC,WAA2B,CAAC,CAAC;QAC1E,IAAI,CAAC,QAAQ,EAAE,CAAC;YACd,MAAM,IAAI,KAAK,CAAC,qBAAqB,GAAG,0BAA0B,CAAC,CAAC;QACtE,CAAC;QACD,OAAO,EAAE,GAAG,EAAE,GAAG,QAAQ,EAAE,CAAC;IAC9B,CAAC,CAAC,CAAC;AACL,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,MAAM,wBAAwB,GACnC,oBAAoB,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IAC5C,IAAI,EAAE,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,KAAK;IACjC,KAAK,EAAE,MAAM,CAAC,WAAW,IAAI,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,KAAK;IACxD,MAAM,EAAE,qBAAqB,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC;CACnD,CAAC,CAAC,CAAC"}
@@ -0,0 +1,35 @@
1
+ /**
2
+ * Recomputing an agent's arithmetic, safely.
3
+ *
4
+ * A derived value (a growth rate, a ratio, a total) appears **nowhere** in the
5
+ * source, so there is no passage to quote and no page to open — the only honest
6
+ * provenance is *these inputs, combined this way*. Given both, the arithmetic
7
+ * stops being a claim and becomes checkable: the reader is shown a ✓ when the
8
+ * numbers reproduce and a ⚠ when they don't. LLM arithmetic is the least reliable
9
+ * step in the pipeline, and this makes it the most verified.
10
+ *
11
+ * Inputs are referenced **positionally** (`#1`, `#2`) rather than by name or cell.
12
+ * That is the security property, not a convenience: the grammar then contains no
13
+ * identifiers at all, so an expression *cannot* name anything outside the inputs
14
+ * array. No `eval`, no `Function`, no scope to escape into — the worst a
15
+ * malformed expression can do is fail to parse.
16
+ */
17
+ /**
18
+ * Evaluate `expr` over `inputs`, or `undefined` when it cannot be evaluated
19
+ * with certainty.
20
+ *
21
+ * `undefined` is deliberately indistinguishable between "malformed" and
22
+ * "unsupported": in either case the UI shows the expression without a verdict.
23
+ * Showing a wrong ✓ would be worse than showing none.
24
+ */
25
+ export declare function evaluateExpression(expr: string, inputs: number[]): number | undefined;
26
+ /**
27
+ * Parse a number out of a cited value as it appears in a document —
28
+ * `"₹36,816.00"`, `"1 234,5"`, `"(1,200)"` (accounting negative), `"12%"`.
29
+ *
30
+ * Needed because an input's value arrives as source text, not a number, and a
31
+ * verification that only worked on already-clean numbers would rarely fire on
32
+ * real documents. Returns `undefined` when there is no unambiguous number.
33
+ */
34
+ export declare function parseNumericValue(value: unknown): number | undefined;
35
+ //# sourceMappingURL=expression-eval.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"expression-eval.d.ts","sourceRoot":"","sources":["../../src/common/expression-eval.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAwHH;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,GAAG,SAAS,CAIrF;AAED;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAyCpE"}