@eigenpal/cli 0.10.20 → 0.10.22

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 (2) hide show
  1. package/dist/cli.js +241 -1
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -66042,6 +66042,216 @@ var init_sample_rank = __esm(() => {
66042
66042
  UNIT_INTERVAL_DENOMINATOR = BigInt(1) << BigInt(53);
66043
66043
  });
66044
66044
 
66045
+ // ../types/src/webhooks.ts
66046
+ function serializeWebhookEvent(event) {
66047
+ return JSON.stringify(WebhookEventEnvelopeSchema.parse(event));
66048
+ }
66049
+ function boundWebhookEventOutput(event, maxBytes) {
66050
+ const parsed = WebhookEventEnvelopeSchema.parse(event);
66051
+ if (new TextEncoder().encode(JSON.stringify(parsed)).byteLength <= maxBytes)
66052
+ return parsed;
66053
+ const run = { ...parsed.data.run };
66054
+ delete run.output;
66055
+ run.outputOmitted = true;
66056
+ const bounded = { ...parsed, data: { ...parsed.data, run } };
66057
+ const serialized = JSON.stringify(bounded);
66058
+ if (new TextEncoder().encode(serialized).byteLength > maxBytes) {
66059
+ throw new Error("Webhook envelope exceeds payload limit without output");
66060
+ }
66061
+ return WebhookEventEnvelopeSchema.parse(bounded);
66062
+ }
66063
+ function getWebhookDestinationUrlError(raw) {
66064
+ const trimmed = raw.trim();
66065
+ if (!trimmed)
66066
+ return "Enter a valid HTTPS URL.";
66067
+ const result = WebhookDestinationUrlSchema.safeParse(trimmed);
66068
+ if (result.success)
66069
+ return null;
66070
+ return result.error.issues[0]?.message ?? "Enter a valid HTTPS URL.";
66071
+ }
66072
+ function validateWebhookHeaderCollection(input, ctx) {
66073
+ if (input.customHeaders) {
66074
+ const seen = new Set;
66075
+ let bytes = 0;
66076
+ input.customHeaders.forEach((header, index) => {
66077
+ const normalized = header.name.toLowerCase();
66078
+ if (seen.has(normalized)) {
66079
+ ctx.addIssue({
66080
+ code: "custom",
66081
+ path: ["customHeaders", index, "name"],
66082
+ message: "Duplicate webhook header"
66083
+ });
66084
+ }
66085
+ seen.add(normalized);
66086
+ bytes += new TextEncoder().encode(header.name + ("value" in header ? header.value : "")).byteLength;
66087
+ });
66088
+ if (bytes > WEBHOOK_MAX_HEADER_BYTES) {
66089
+ ctx.addIssue({
66090
+ code: "custom",
66091
+ path: ["customHeaders"],
66092
+ message: "Custom webhook headers are too large"
66093
+ });
66094
+ }
66095
+ }
66096
+ }
66097
+ var WEBHOOK_API_VERSION = "2026-07-01", WEBHOOK_NOTIFY_CHANNEL = "eigenpal:webhooks", WEBHOOK_MAX_PAYLOAD_BYTES, WEBHOOK_MAX_HEADERS = 20, WEBHOOK_MAX_HEADER_BYTES, WEBHOOK_EVENT_TYPES, WEBHOOK_DELIVERY_STATES, WEBHOOK_RESERVED_HEADERS, RESERVED_HEADER_SET, WebhookEventTypeSchema, WebhookDeliveryStateSchema, WebhookEndpointIdSchema, WebhookEventIdSchema, WebhookDeliveryIdSchema, WebhookAttemptIdSchema, HeaderNameSchema, WebhookCustomHeaderSchema, RetainedWebhookCustomHeaderSchema, RedactedWebhookCustomHeaderSchema, PublicWebhookRunSchema, EnvelopeBaseSchema, RunCreatedWebhookEventSchema, RunStatusChangedWebhookEventSchema, WebhookEventEnvelopeSchema, WebhookEndpointSchema, WebhookDestinationUrlSchema, CreateWebhookEndpointSchema, UpdateWebhookEndpointSchema, CreateWebhookEndpointResponseSchema, WebhookDeliverySchema, WebhookDeliveryAttemptSchema;
66098
+ var init_webhooks = __esm(() => {
66099
+ init_zod();
66100
+ init_execution_row();
66101
+ WEBHOOK_MAX_PAYLOAD_BYTES = 1024 * 1024;
66102
+ WEBHOOK_MAX_HEADER_BYTES = 16 * 1024;
66103
+ WEBHOOK_EVENT_TYPES = ["run.created", "run.status_changed"];
66104
+ WEBHOOK_DELIVERY_STATES = [
66105
+ "pending",
66106
+ "processing",
66107
+ "succeeded",
66108
+ "failed",
66109
+ "cancelled"
66110
+ ];
66111
+ WEBHOOK_RESERVED_HEADERS = [
66112
+ "connection",
66113
+ "content-length",
66114
+ "content-type",
66115
+ "host",
66116
+ "keep-alive",
66117
+ "proxy-authenticate",
66118
+ "proxy-authorization",
66119
+ "te",
66120
+ "trailer",
66121
+ "transfer-encoding",
66122
+ "upgrade",
66123
+ "user-agent",
66124
+ "webhook-id",
66125
+ "webhook-signature",
66126
+ "webhook-timestamp"
66127
+ ];
66128
+ RESERVED_HEADER_SET = new Set(WEBHOOK_RESERVED_HEADERS);
66129
+ WebhookEventTypeSchema = exports_external.enum(WEBHOOK_EVENT_TYPES);
66130
+ WebhookDeliveryStateSchema = exports_external.enum(WEBHOOK_DELIVERY_STATES);
66131
+ WebhookEndpointIdSchema = exports_external.string().regex(/^whep_[A-Za-z0-9_-]+$/);
66132
+ WebhookEventIdSchema = exports_external.string().regex(/^whev_[A-Za-z0-9_-]+$/);
66133
+ WebhookDeliveryIdSchema = exports_external.string().regex(/^whdl_[A-Za-z0-9_-]+$/);
66134
+ WebhookAttemptIdSchema = exports_external.string().regex(/^what_[A-Za-z0-9_-]+$/);
66135
+ HeaderNameSchema = exports_external.string().min(1).max(128).regex(/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/);
66136
+ WebhookCustomHeaderSchema = exports_external.object({
66137
+ name: HeaderNameSchema.refine((name) => !RESERVED_HEADER_SET.has(name.toLowerCase()) && !name.toLowerCase().startsWith("webhook-"), { message: "Reserved webhook header" }),
66138
+ value: exports_external.string().min(1).max(8192).refine((value) => !/[\r\n]/.test(value), {
66139
+ message: "Header values cannot contain CR or LF"
66140
+ })
66141
+ });
66142
+ RetainedWebhookCustomHeaderSchema = exports_external.object({
66143
+ name: WebhookCustomHeaderSchema.shape.name,
66144
+ retained: exports_external.literal(true)
66145
+ });
66146
+ RedactedWebhookCustomHeaderSchema = exports_external.object({
66147
+ name: HeaderNameSchema,
66148
+ configured: exports_external.literal(true)
66149
+ });
66150
+ PublicWebhookRunSchema = exports_external.object({
66151
+ id: exports_external.string().min(1),
66152
+ automationId: exports_external.string().min(1),
66153
+ type: exports_external.enum(["workflow", "agent"]),
66154
+ status: exports_external.enum(EXECUTION_STATUSES),
66155
+ triggerType: exports_external.string(),
66156
+ createdAt: exports_external.string().datetime(),
66157
+ startedAt: exports_external.string().datetime().nullable(),
66158
+ completedAt: exports_external.string().datetime().nullable(),
66159
+ output: exports_external.unknown().optional(),
66160
+ outputOmitted: exports_external.boolean().optional()
66161
+ });
66162
+ EnvelopeBaseSchema = exports_external.object({
66163
+ id: WebhookEventIdSchema,
66164
+ apiVersion: exports_external.literal(WEBHOOK_API_VERSION),
66165
+ createdAt: exports_external.string().datetime(),
66166
+ test: exports_external.boolean().default(false)
66167
+ });
66168
+ RunCreatedWebhookEventSchema = EnvelopeBaseSchema.extend({
66169
+ type: exports_external.literal("run.created"),
66170
+ data: exports_external.object({ run: PublicWebhookRunSchema })
66171
+ });
66172
+ RunStatusChangedWebhookEventSchema = EnvelopeBaseSchema.extend({
66173
+ type: exports_external.literal("run.status_changed"),
66174
+ data: exports_external.object({
66175
+ run: PublicWebhookRunSchema,
66176
+ previousStatus: exports_external.enum(EXECUTION_STATUSES),
66177
+ currentStatus: exports_external.enum(EXECUTION_STATUSES)
66178
+ })
66179
+ });
66180
+ WebhookEventEnvelopeSchema = exports_external.discriminatedUnion("type", [
66181
+ RunCreatedWebhookEventSchema,
66182
+ RunStatusChangedWebhookEventSchema
66183
+ ]);
66184
+ WebhookEndpointSchema = exports_external.object({
66185
+ id: WebhookEndpointIdSchema,
66186
+ tenantId: exports_external.string(),
66187
+ name: exports_external.string().min(1).max(200),
66188
+ url: exports_external.string().url(),
66189
+ eventTypes: exports_external.array(WebhookEventTypeSchema).min(1),
66190
+ enabled: exports_external.boolean(),
66191
+ signingConfigured: exports_external.literal(true),
66192
+ customHeaders: exports_external.array(RedactedWebhookCustomHeaderSchema),
66193
+ createdBy: exports_external.string().nullable(),
66194
+ createdAt: exports_external.coerce.date(),
66195
+ updatedAt: exports_external.coerce.date(),
66196
+ deletedAt: exports_external.coerce.date().nullable()
66197
+ });
66198
+ WebhookDestinationUrlSchema = exports_external.string().url().superRefine((raw, ctx) => {
66199
+ if (!URL.canParse(raw))
66200
+ return;
66201
+ const url2 = new URL(raw);
66202
+ if (url2.protocol !== "https:") {
66203
+ ctx.addIssue({ code: "custom", message: "Webhook URLs must use HTTPS" });
66204
+ }
66205
+ if (url2.username || url2.password) {
66206
+ ctx.addIssue({ code: "custom", message: "Webhook URLs cannot contain credentials" });
66207
+ }
66208
+ if (url2.hash) {
66209
+ ctx.addIssue({ code: "custom", message: "Webhook URLs cannot contain fragments" });
66210
+ }
66211
+ });
66212
+ CreateWebhookEndpointSchema = exports_external.object({
66213
+ name: exports_external.string().trim().min(1).max(200),
66214
+ url: WebhookDestinationUrlSchema,
66215
+ eventTypes: exports_external.array(WebhookEventTypeSchema).min(1),
66216
+ customHeaders: exports_external.array(WebhookCustomHeaderSchema).max(WEBHOOK_MAX_HEADERS).default([])
66217
+ }).superRefine(validateWebhookHeaderCollection);
66218
+ UpdateWebhookEndpointSchema = exports_external.object({
66219
+ name: exports_external.string().trim().min(1).max(200).optional(),
66220
+ url: WebhookDestinationUrlSchema.optional(),
66221
+ eventTypes: exports_external.array(WebhookEventTypeSchema).min(1).optional(),
66222
+ customHeaders: exports_external.array(exports_external.union([WebhookCustomHeaderSchema, RetainedWebhookCustomHeaderSchema])).max(WEBHOOK_MAX_HEADERS).optional(),
66223
+ enabled: exports_external.boolean().optional()
66224
+ }).superRefine(validateWebhookHeaderCollection);
66225
+ CreateWebhookEndpointResponseSchema = exports_external.object({
66226
+ endpoint: WebhookEndpointSchema,
66227
+ signingSecret: exports_external.string().regex(/^whsec_[A-Za-z0-9_-]+$/)
66228
+ });
66229
+ WebhookDeliverySchema = exports_external.object({
66230
+ id: WebhookDeliveryIdSchema,
66231
+ tenantId: exports_external.string(),
66232
+ endpointId: WebhookEndpointIdSchema,
66233
+ eventId: WebhookEventIdSchema,
66234
+ state: WebhookDeliveryStateSchema,
66235
+ attemptCount: exports_external.number().int().nonnegative(),
66236
+ nextAttemptAt: exports_external.coerce.date().nullable(),
66237
+ latestStatusCode: exports_external.number().int().nullable(),
66238
+ latestErrorCategory: exports_external.string().nullable(),
66239
+ createdAt: exports_external.coerce.date(),
66240
+ completedAt: exports_external.coerce.date().nullable()
66241
+ });
66242
+ WebhookDeliveryAttemptSchema = exports_external.object({
66243
+ id: WebhookAttemptIdSchema,
66244
+ deliveryId: WebhookDeliveryIdSchema,
66245
+ attemptNumber: exports_external.number().int().positive(),
66246
+ startedAt: exports_external.coerce.date(),
66247
+ completedAt: exports_external.coerce.date(),
66248
+ latencyMs: exports_external.number().int().nonnegative(),
66249
+ statusCode: exports_external.number().int().nullable(),
66250
+ errorCategory: exports_external.string().nullable(),
66251
+ responseExcerpt: exports_external.string().nullable()
66252
+ });
66253
+ });
66254
+
66045
66255
  // ../types/src/storage/s3-paths.ts
66046
66256
  function assertSegment(name, value) {
66047
66257
  if (!value || !SEGMENT_RX.test(value)) {
@@ -66413,6 +66623,7 @@ __export(exports_src, {
66413
66623
  stripTenantPrefix: () => stripTenantPrefix,
66414
66624
  stringToUnitInterval: () => stringToUnitInterval,
66415
66625
  sourceLockfileInputHash: () => sourceLockfileInputHash,
66626
+ serializeWebhookEvent: () => serializeWebhookEvent,
66416
66627
  scriptParamTypeAlias: () => scriptParamTypeAlias,
66417
66628
  schemaFileUploadMatchesField: () => schemaFileUploadMatchesField,
66418
66629
  s3PathFilename: () => s3PathFilename,
@@ -66482,6 +66693,7 @@ __export(exports_src, {
66482
66693
  hasTriggerMethod: () => hasTriggerMethod,
66483
66694
  hasDeclaredOutput: () => hasDeclaredOutput,
66484
66695
  goldenFileSatisfiedInResult: () => goldenFileSatisfiedInResult,
66696
+ getWebhookDestinationUrlError: () => getWebhookDestinationUrlError,
66485
66697
  getTriggerMethods: () => getTriggerMethods,
66486
66698
  getSupportedFormatsLabel: () => getSupportedFormatsLabel,
66487
66699
  getStepSchema: () => getStepSchema,
@@ -66539,6 +66751,7 @@ __export(exports_src, {
66539
66751
  buildS3Path: () => buildS3Path,
66540
66752
  buildDiscreteJudgeSystemPrompt: () => buildDiscreteJudgeSystemPrompt,
66541
66753
  buildContinuousJudgeSystemPrompt: () => buildContinuousJudgeSystemPrompt,
66754
+ boundWebhookEventOutput: () => boundWebhookEventOutput,
66542
66755
  assertS3PathSegment: () => assertS3PathSegment,
66543
66756
  aliasReplyConfigSchema: () => aliasReplyConfigSchema,
66544
66757
  aggregateEvaluatorCompositionScore: () => aggregateEvaluatorCompositionScore,
@@ -66561,11 +66774,31 @@ __export(exports_src, {
66561
66774
  WorkflowExecutionStatusSchema: () => WorkflowExecutionStatusSchema,
66562
66775
  WorkflowExecutionSchema: () => WorkflowExecutionSchema,
66563
66776
  WorkflowDefinitionSchema: () => WorkflowDefinitionSchema,
66777
+ WebhookEventTypeSchema: () => WebhookEventTypeSchema,
66778
+ WebhookEventIdSchema: () => WebhookEventIdSchema,
66779
+ WebhookEventEnvelopeSchema: () => WebhookEventEnvelopeSchema,
66780
+ WebhookEndpointSchema: () => WebhookEndpointSchema,
66781
+ WebhookEndpointIdSchema: () => WebhookEndpointIdSchema,
66782
+ WebhookDeliveryStateSchema: () => WebhookDeliveryStateSchema,
66783
+ WebhookDeliverySchema: () => WebhookDeliverySchema,
66784
+ WebhookDeliveryIdSchema: () => WebhookDeliveryIdSchema,
66785
+ WebhookDeliveryAttemptSchema: () => WebhookDeliveryAttemptSchema,
66786
+ WebhookCustomHeaderSchema: () => WebhookCustomHeaderSchema,
66787
+ WebhookAttemptIdSchema: () => WebhookAttemptIdSchema,
66564
66788
  WaitStepSchema: () => WaitStepSchema,
66565
66789
  WORKFLOW_TOOL_METADATA: () => WORKFLOW_TOOL_METADATA,
66566
66790
  WORKFLOW_NAME_PATTERN: () => WORKFLOW_NAME_PATTERN,
66567
66791
  WORKFLOW_FILE_REF_JSON_SCHEMA: () => WORKFLOW_FILE_REF_JSON_SCHEMA,
66568
66792
  WORKFLOW_EXECUTION_STATUSES: () => WORKFLOW_EXECUTION_STATUSES,
66793
+ WEBHOOK_RESERVED_HEADERS: () => WEBHOOK_RESERVED_HEADERS,
66794
+ WEBHOOK_NOTIFY_CHANNEL: () => WEBHOOK_NOTIFY_CHANNEL,
66795
+ WEBHOOK_MAX_PAYLOAD_BYTES: () => WEBHOOK_MAX_PAYLOAD_BYTES,
66796
+ WEBHOOK_MAX_HEADER_BYTES: () => WEBHOOK_MAX_HEADER_BYTES,
66797
+ WEBHOOK_MAX_HEADERS: () => WEBHOOK_MAX_HEADERS,
66798
+ WEBHOOK_EVENT_TYPES: () => WEBHOOK_EVENT_TYPES,
66799
+ WEBHOOK_DELIVERY_STATES: () => WEBHOOK_DELIVERY_STATES,
66800
+ WEBHOOK_API_VERSION: () => WEBHOOK_API_VERSION,
66801
+ UpdateWebhookEndpointSchema: () => UpdateWebhookEndpointSchema,
66569
66802
  UNSUPPORTED_SOURCE_MANIFEST_FILENAME: () => UNSUPPORTED_SOURCE_MANIFEST_FILENAME,
66570
66803
  TriggerTypeValue: () => TriggerTypeValue,
66571
66804
  TriggerTypeSchema: () => TriggerTypeSchema,
@@ -66658,6 +66891,8 @@ __export(exports_src, {
66658
66891
  RunTargetStringSchema: () => RunTargetStringSchema,
66659
66892
  RunTargetSchema: () => RunTargetSchema,
66660
66893
  RunTargetObjectSchema: () => RunTargetObjectSchema,
66894
+ RunStatusChangedWebhookEventSchema: () => RunStatusChangedWebhookEventSchema,
66895
+ RunCreatedWebhookEventSchema: () => RunCreatedWebhookEventSchema,
66661
66896
  RootSourceManifestSchema: () => RootSourceManifestSchema,
66662
66897
  RetryTerminalReasonSchema: () => RetryTerminalReasonSchema,
66663
66898
  RetryPolicySourceSchema: () => RetryPolicySourceSchema,
@@ -66666,11 +66901,13 @@ __export(exports_src, {
66666
66901
  ResolvedRetryPolicySchema: () => ResolvedRetryPolicySchema,
66667
66902
  ResolvedProcessorFileSchema: () => ResolvedProcessorFileSchema,
66668
66903
  ReleaseTagSchema: () => ReleaseTagSchema,
66904
+ RedactedWebhookCustomHeaderSchema: () => RedactedWebhookCustomHeaderSchema,
66669
66905
  RUN_TARGET_SEGMENT_PATTERN: () => RUN_TARGET_SEGMENT_PATTERN,
66670
66906
  RUN_EXPAND_SECTIONS: () => RUN_EXPAND_SECTIONS,
66671
66907
  RUN_DETAIL_EXPAND_PRESET: () => RUN_DETAIL_EXPAND_PRESET,
66672
66908
  RUNS_TRIGGERED_BY_SYSTEM: () => RUNS_TRIGGERED_BY_SYSTEM,
66673
66909
  RERUN_ORIGINAL_VERSION: () => RERUN_ORIGINAL_VERSION,
66910
+ PublicWebhookRunSchema: () => PublicWebhookRunSchema,
66674
66911
  ProcessorPortSchema: () => ProcessorPortSchema,
66675
66912
  ProcessorExecutionContextSchema: () => ProcessorExecutionContextSchema,
66676
66913
  ProcessorDefinitionSchema: () => ProcessorDefinitionSchema,
@@ -66803,6 +67040,8 @@ __export(exports_src, {
66803
67040
  DATASET_NAME_PATTERN: () => DATASET_NAME_PATTERN,
66804
67041
  CustomScriptConfigSchema: () => CustomScriptConfigSchema,
66805
67042
  CreateWorkflowDefinitionSchema: () => CreateWorkflowDefinitionSchema,
67043
+ CreateWebhookEndpointSchema: () => CreateWebhookEndpointSchema,
67044
+ CreateWebhookEndpointResponseSchema: () => CreateWebhookEndpointResponseSchema,
66806
67045
  CoordinateUnitSchema: () => CoordinateUnitSchema,
66807
67046
  ControlWaitOutputSchema: () => ControlWaitOutputSchema,
66808
67047
  ControlWaitConfigSchema: () => ControlWaitConfigSchema,
@@ -66864,6 +67103,7 @@ var init_src = __esm(() => {
66864
67103
  init_eval();
66865
67104
  init_git_source();
66866
67105
  init_triggers();
67106
+ init_webhooks();
66867
67107
  init_typed_script();
66868
67108
  });
66869
67109
 
@@ -181580,7 +181820,7 @@ import { fileURLToPath as fileURLToPath8 } from "url";
181580
181820
  // package.json
181581
181821
  var package_default = {
181582
181822
  name: "@eigenpal/cli",
181583
- version: "0.10.20",
181823
+ version: "0.10.22",
181584
181824
  description: "Eigenpal CLI — author and run document workflows from your terminal. Agent-ready.",
181585
181825
  keywords: [
181586
181826
  "eigenpal",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eigenpal/cli",
3
- "version": "0.10.20",
3
+ "version": "0.10.22",
4
4
  "description": "Eigenpal CLI — author and run document workflows from your terminal. Agent-ready.",
5
5
  "keywords": [
6
6
  "eigenpal",