@keystrokehq/hosting 0.1.11 → 0.1.13

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.
package/dist/index.cjs CHANGED
@@ -5057,6 +5057,14 @@ const AppSlugSchema = ProjectSlugSchema;
5057
5057
  function resolveExplicitPublicPlatformOrigin(env = process.env) {
5058
5058
  return env.PUBLIC_PLATFORM_URL?.replace(/\/$/, "") || void 0;
5059
5059
  }
5060
+ function isValidIanaTimezone(value) {
5061
+ try {
5062
+ Intl.DateTimeFormat(void 0, { timeZone: value });
5063
+ return true;
5064
+ } catch {
5065
+ return false;
5066
+ }
5067
+ }
5060
5068
  /** How a credential instance is stored (`credential_instances.auth_kind`). */
5061
5069
  const CredentialAuthKindSchema = _enum([
5062
5070
  "api_key",
@@ -5314,6 +5322,7 @@ const storedRouteManifestEntryV2Schema = discriminatedUnion("kind", [
5314
5322
  name: requiredDisplayTextSchema,
5315
5323
  description: requiredDisplayTextSchema,
5316
5324
  model: string(),
5325
+ compactionModel: string().optional(),
5317
5326
  systemPrompt: string(),
5318
5327
  toolCount: number$1().int().nonnegative(),
5319
5328
  credentialCount: number$1().int().nonnegative(),
@@ -5347,7 +5356,9 @@ const storedRouteManifestEntryV2Schema = discriminatedUnion("kind", [
5347
5356
  /** Deterministic AST control-flow skeleton (deploy-time producer). */
5348
5357
  flowGraph: WorkflowCanvasGraphSchema.optional(),
5349
5358
  /** sha256 of the workflow source the `flowGraph` was produced from (staleness). */
5350
- flowGraphSourceHash: string().optional()
5359
+ flowGraphSourceHash: string().optional(),
5360
+ /** sha256 of `JSON.stringify(flowGraph)` — baked at build so canvas polls skip re-hashing. */
5361
+ flowGraphHash: string().optional()
5351
5362
  }),
5352
5363
  object({
5353
5364
  kind: literal("trigger-webhook"),
@@ -5383,6 +5394,8 @@ const storedRouteManifestEntryV2Schema = discriminatedUnion("kind", [
5383
5394
  moduleFile: string(),
5384
5395
  sourceHash: string().optional(),
5385
5396
  schedule: string(),
5397
+ /** Static cron payload from `defineCronSource({ payload })` — omitted when the source has none. */
5398
+ payload: unknown().optional(),
5386
5399
  name: requiredDisplayTextSchema,
5387
5400
  description: requiredDisplayTextSchema
5388
5401
  })
@@ -5517,6 +5530,47 @@ object({
5517
5530
  thresholdMicroCredits: number$1().int().positive().optional(),
5518
5531
  packId: string().optional()
5519
5532
  });
5533
+ const BillingUsageEventSourceSchema = _enum([
5534
+ "ai_gateway",
5535
+ "sandbox",
5536
+ "web_proxy",
5537
+ "storage",
5538
+ "dispatch",
5539
+ "poll"
5540
+ ]);
5541
+ const BillingUsageMeterKeySchema = _enum([
5542
+ "llm",
5543
+ "vm_second",
5544
+ "web_search",
5545
+ "web_fetch",
5546
+ "workflow_run",
5547
+ "agent_run",
5548
+ "poll_trigger",
5549
+ "tigris_storage"
5550
+ ]);
5551
+ const BillingUsageKeySourceSchema = _enum(["platform", "byok"]);
5552
+ const BillingUsageRunKindSchema = _enum(["agent", "workflow"]);
5553
+ object({ events: array(object({
5554
+ projectId: string().min(1).max(255).nullable().optional(),
5555
+ runId: string().min(1).max(255).nullable().optional(),
5556
+ runKind: BillingUsageRunKindSchema.nullable().optional(),
5557
+ source: BillingUsageEventSourceSchema,
5558
+ sourceEventId: string().min(1).max(512),
5559
+ meterKey: BillingUsageMeterKeySchema,
5560
+ quantity: number$1().finite().nonnegative(),
5561
+ unit: string().min(1).max(64),
5562
+ providerCostUsd: number$1().finite().nonnegative().nullable().optional(),
5563
+ keySource: BillingUsageKeySourceSchema.nullable().optional(),
5564
+ occurredAt: isoDateTime$6,
5565
+ metadata: record(string(), unknown()).nullable().optional()
5566
+ }).strict()).min(1).max(100) }).strict();
5567
+ object({
5568
+ accepted: number$1().int().nonnegative(),
5569
+ inserted: number$1().int().nonnegative(),
5570
+ duplicate: number$1().int().nonnegative(),
5571
+ settledLedgerId: string().nullable(),
5572
+ chargeMicroCredits: number$1().int().nonnegative()
5573
+ });
5520
5574
  /** Messaging platforms that support agent gateway bindings. */
5521
5575
  const ChannelPlatformKeySchema = _enum(["slack"]);
5522
5576
  const ChannelReactionSupportSchema = _enum([
@@ -5816,15 +5870,18 @@ object({
5816
5870
  integrationDescription: string().min(1),
5817
5871
  logo: string().url().nullable().optional(),
5818
5872
  authKind: AppAuthKindSchema,
5819
- oauthScopes: array(OAuthScopeOptionSchema),
5820
5873
  /** Where app metadata and execution are sourced (e.g. composio, custom). */
5821
5874
  source: AppSourceSchema,
5875
+ /** Endpoint URL for MCP, OpenAPI, or GraphQL custom apps. */
5876
+ url: string().url().nullable().optional(),
5877
+ /** True when the app has a non-empty credential field template. */
5878
+ hasCredentialFields: boolean().optional()
5879
+ }).extend({
5880
+ oauthScopes: array(OAuthScopeOptionSchema),
5822
5881
  /** Custom api_key apps — vault field template for connect UI and sync. */
5823
5882
  credentialFields: AppCredentialFieldsSchema.optional(),
5824
5883
  /** Composio auth scheme when credentialFields are present. */
5825
5884
  credentialScheme: AppCredentialSchemeSchema.optional(),
5826
- /** Endpoint URL for MCP, OpenAPI, or GraphQL custom apps. */
5827
- url: string().url().nullable().optional(),
5828
5885
  /** When present, the app supports agent gateway bindings (external channels). */
5829
5886
  gateway: AppGatewaySchema.optional()
5830
5887
  });
@@ -5946,7 +6003,11 @@ const AppCredentialConnectionKindSchema = _enum(["oauth", "manual"]);
5946
6003
  const OAuthPermissionModeSchema = _enum(["default", "restricted"]);
5947
6004
  const optionalTimestamp$1 = string().optional();
5948
6005
  const nullableOptionalTimestamp = string().nullable().optional();
5949
- object({
6006
+ /**
6007
+ * Summary row for the apps/credentials table and credential detail page.
6008
+ * Plaintext secrets are never returned — only masked `keyPreviews`.
6009
+ */
6010
+ const AppCredentialSummarySchema = object({
5950
6011
  id: string().min(1),
5951
6012
  appId: string().min(1),
5952
6013
  /** Stable per-scope identifier; pass to `--credential` to pin a specific instance. */
@@ -6037,6 +6098,14 @@ object({
6037
6098
  isDefault: boolean().optional(),
6038
6099
  value: credentialSecretValueSchema.optional()
6039
6100
  }).refine((input) => input.label !== void 0 || input.isDefault !== void 0 || input.value !== void 0, { message: "At least one field is required" });
6101
+ object({
6102
+ limit: number().int().min(1).max(200).optional(),
6103
+ cursor: string().min(1).optional()
6104
+ });
6105
+ object({
6106
+ items: array(AppCredentialSummarySchema),
6107
+ nextCursor: string().nullable()
6108
+ });
6040
6109
  const CredentialAssignmentTargetTypeSchema = _enum([
6041
6110
  "workflow",
6042
6111
  "agent",
@@ -6320,11 +6389,198 @@ object({
6320
6389
  attachmentId: string(),
6321
6390
  attachmentSlug: string()
6322
6391
  });
6392
+ const HistoryRunKindSchema = _enum(["workflow", "agent"]);
6393
+ const HistoryRunStatusSchema = _enum([
6394
+ "pending",
6395
+ "running",
6396
+ "sleeping",
6397
+ "waiting_hook",
6398
+ "waiting_children",
6399
+ "completed",
6400
+ "failed",
6401
+ "canceled"
6402
+ ]);
6403
+ const HistoryRunActorSchema = object({
6404
+ userId: string(),
6405
+ name: string(),
6406
+ avatarUrl: string().nullable().optional()
6407
+ });
6408
+ const HistoryRunUsageLineItemSchema = object({
6409
+ id: string(),
6410
+ label: string(),
6411
+ /** Amount debited from the org's Keystroke balance for this line. */
6412
+ billedUsd: number$1(),
6413
+ /** Provider cost for LLM usage on the org's API key (informational; not billed by Keystroke). */
6414
+ providerCostUsd: number$1().nullable().optional(),
6415
+ keySource: _enum(["byok", "platform"]).nullable().optional()
6416
+ });
6417
+ const HistoryRunUsageSchema = object({
6418
+ runDurationMs: number$1().nullable(),
6419
+ lineItems: array(HistoryRunUsageLineItemSchema),
6420
+ /** Sum of `billedUsd` — what Keystroke charged for this run. */
6421
+ totalBilledUsd: number$1().nullable(),
6422
+ /** Sum of BYOK LLM provider costs (billed externally by the org's provider). */
6423
+ externalProviderCostUsd: number$1().nullable().optional()
6424
+ });
6425
+ const HistoryRunSchema = object({
6426
+ id: string(),
6427
+ kind: HistoryRunKindSchema,
6428
+ traceId: string().nullable(),
6429
+ projectId: string(),
6430
+ projectName: string(),
6431
+ resourceKey: string(),
6432
+ resourceId: string(),
6433
+ resourceName: string(),
6434
+ status: HistoryRunStatusSchema,
6435
+ triggeredAt: string(),
6436
+ timeInQueueMs: number$1().nullable(),
6437
+ startedAt: string(),
6438
+ finishedAt: string().nullable(),
6439
+ durationMs: number$1().nullable(),
6440
+ triggerLabel: string(),
6441
+ triggerRaw: string(),
6442
+ ranAs: HistoryRunActorSchema.nullable(),
6443
+ modelsUsed: array(string()),
6444
+ otherServicesUsed: array(string()),
6445
+ totalCostUsd: number$1().nullable(),
6446
+ messageCount: number$1().optional(),
6447
+ stepCount: number$1().optional()
6448
+ });
6449
+ const HistoryTraceSpanSchema = object({
6450
+ id: string(),
6451
+ traceId: string(),
6452
+ parentSpanId: string().nullable(),
6453
+ kind: string(),
6454
+ refId: string(),
6455
+ name: string(),
6456
+ status: string(),
6457
+ startedAt: string(),
6458
+ finishedAt: string().nullable(),
6459
+ metadata: unknown().nullable(),
6460
+ error: unknown().nullable()
6461
+ });
6462
+ const HistoryTraceLogSchema = object({
6463
+ id: string(),
6464
+ traceId: string(),
6465
+ spanId: string(),
6466
+ seq: number$1(),
6467
+ level: string(),
6468
+ message: string(),
6469
+ data: unknown().nullable(),
6470
+ source: string(),
6471
+ createdAt: string()
6472
+ });
6473
+ const HistoryTraceTriggerSchema = object({
6474
+ triggerType: string(),
6475
+ triggerRunId: string(),
6476
+ workflowKey: string().optional(),
6477
+ agentKey: string().optional(),
6478
+ attachmentId: string().nullable().optional(),
6479
+ attachmentSlug: string().nullable().optional(),
6480
+ route: string().optional(),
6481
+ sourcePath: string().nullable().optional()
6482
+ }).nullable();
6483
+ const HistoryTraceGatewaySchema = object({
6484
+ gatewayAttachmentId: string(),
6485
+ gatewayAttachmentKey: string(),
6486
+ threadId: string().optional(),
6487
+ channelId: string().optional(),
6488
+ mode: string().optional()
6489
+ }).nullable();
6490
+ const HistoryTraceSchema = object({
6491
+ traceId: string(),
6492
+ trigger: HistoryTraceTriggerSchema,
6493
+ gateway: HistoryTraceGatewaySchema,
6494
+ spans: array(HistoryTraceSpanSchema),
6495
+ logs: array(HistoryTraceLogSchema)
6496
+ });
6497
+ const HistoryWorkflowStepSchema = object({
6498
+ id: string(),
6499
+ actionKey: string(),
6500
+ output: unknown(),
6501
+ completedAt: string()
6502
+ });
6503
+ const HistoryWorkflowRunDetailSchema = object({
6504
+ kind: literal("workflow"),
6505
+ run: object({
6506
+ id: string(),
6507
+ workflowKey: string(),
6508
+ status: HistoryRunStatusSchema,
6509
+ trigger: string(),
6510
+ triggeredAt: string(),
6511
+ startedAt: string().nullable(),
6512
+ finishedAt: string().nullable(),
6513
+ input: unknown().nullable(),
6514
+ output: unknown().nullable(),
6515
+ error: unknown().nullable()
6516
+ }),
6517
+ trigger: object({
6518
+ id: string(),
6519
+ attachmentSlug: string().nullable(),
6520
+ triggerType: string(),
6521
+ sourcePath: string().nullable(),
6522
+ payload: unknown().nullable(),
6523
+ triggeredAt: string()
6524
+ }).nullable(),
6525
+ steps: array(HistoryWorkflowStepSchema),
6526
+ trace: HistoryTraceSchema.nullable(),
6527
+ ranAs: HistoryRunActorSchema.nullable().optional(),
6528
+ usage: HistoryRunUsageSchema.nullable().optional()
6529
+ });
6530
+ const HistoryAgentCompactionEventSchema = object({
6531
+ seq: number$1(),
6532
+ createdAt: string(),
6533
+ compactionModel: string(),
6534
+ sourceModel: string(),
6535
+ estimatedBeforeTokens: number$1().optional(),
6536
+ retainedTailEstimate: number$1().optional(),
6537
+ durable: boolean()
6538
+ });
6539
+ const HistoryRunDetailSchema = discriminatedUnion("kind", [HistoryWorkflowRunDetailSchema, object({
6540
+ kind: literal("agent"),
6541
+ runId: string(),
6542
+ session: object({
6543
+ id: string(),
6544
+ agentKey: string(),
6545
+ status: HistoryRunStatusSchema,
6546
+ source: _enum([
6547
+ "api",
6548
+ "gateway",
6549
+ "trigger",
6550
+ "workflow",
6551
+ "agent"
6552
+ ]),
6553
+ sourceId: string().nullable(),
6554
+ createdAt: string(),
6555
+ updatedAt: string(),
6556
+ messageCount: number$1(),
6557
+ error: unknown().nullable()
6558
+ }),
6559
+ gateway: object({
6560
+ threadId: string(),
6561
+ attachmentSlug: string().nullable()
6562
+ }).nullable(),
6563
+ messages: array(record(string(), unknown())),
6564
+ /** Sanitized context-compaction markers for the conversation timeline. */
6565
+ compactionEvents: array(HistoryAgentCompactionEventSchema).default([]),
6566
+ trace: HistoryTraceSchema.nullable(),
6567
+ ranAs: HistoryRunActorSchema.nullable().optional(),
6568
+ usage: HistoryRunUsageSchema.nullable().optional()
6569
+ })]);
6570
+ object({
6571
+ project: string().min(1).optional(),
6572
+ status: HistoryRunStatusSchema.optional(),
6573
+ kind: HistoryRunKindSchema.optional(),
6574
+ limit: number().int().min(1).max(200).optional()
6575
+ });
6576
+ HistoryRunDetailSchema.nullable();
6577
+ HistoryRunSchema.nullable();
6323
6578
  const WorkflowRunStatusSchema = _enum([
6324
6579
  "pending",
6325
6580
  "running",
6326
6581
  "sleeping",
6327
6582
  "waiting_hook",
6583
+ "waiting_children",
6328
6584
  "completed",
6329
6585
  "failed",
6330
6586
  "canceled"
@@ -6345,6 +6601,7 @@ _enum([
6345
6601
  "sleep_completed",
6346
6602
  "hook_created",
6347
6603
  "hook_resumed",
6604
+ "child_dispatched",
6348
6605
  "run_completed",
6349
6606
  "run_failed",
6350
6607
  "run_canceled"
@@ -6501,6 +6758,7 @@ const AgentSessionRecordSchema = object({
6501
6758
  status: AgentSessionStatusSchema,
6502
6759
  source: RunSourceKindSchema,
6503
6760
  sourceId: string().nullable(),
6761
+ title: string().nullable(),
6504
6762
  createdAt: string(),
6505
6763
  updatedAt: string(),
6506
6764
  parentSpanId: string().nullable(),
@@ -6539,17 +6797,18 @@ const AgentEventSchema = object({
6539
6797
  });
6540
6798
  object({
6541
6799
  session: AgentSessionRecordSchema,
6800
+ activeRunId: string().nullable().default(null),
6542
6801
  gateway: GatewaySessionDetailSchema.nullable(),
6543
6802
  messages: array(record(string(), unknown())),
6544
6803
  events: array(AgentEventSchema),
6804
+ /**
6805
+ * Sanitized context-compaction markers, populated alongside `messages`.
6806
+ * A cheap indexed lookup (session_id + event_type) — never the full event
6807
+ * log. Defaulted so older servers remain compatible.
6808
+ */
6809
+ compactionEvents: array(HistoryAgentCompactionEventSchema).default([]),
6545
6810
  trace: TraceResponseSchema.nullable()
6546
6811
  });
6547
- object({ sinceSeq: number().int().min(0).optional() });
6548
- object({
6549
- status: AgentSessionStatusSchema,
6550
- messages: array(record(string(), unknown())),
6551
- live: record(string(), unknown()).nullable()
6552
- });
6553
6812
  const SlackGatewayModeSchema = _enum([
6554
6813
  "mention",
6555
6814
  "channel",
@@ -6584,179 +6843,6 @@ object({ agents: array(object({
6584
6843
  name: string().optional(),
6585
6844
  route: string()
6586
6845
  })) });
6587
- const HistoryRunKindSchema = _enum(["workflow", "agent"]);
6588
- const HistoryRunStatusSchema = _enum([
6589
- "pending",
6590
- "running",
6591
- "sleeping",
6592
- "waiting_hook",
6593
- "completed",
6594
- "failed",
6595
- "canceled"
6596
- ]);
6597
- const HistoryRunActorSchema = object({
6598
- userId: string(),
6599
- name: string(),
6600
- avatarUrl: string().nullable().optional()
6601
- });
6602
- const HistoryRunUsageLineItemSchema = object({
6603
- id: string(),
6604
- label: string(),
6605
- /** Amount debited from the org's Keystroke balance for this line. */
6606
- billedUsd: number$1(),
6607
- /** Provider cost for LLM usage on the org's API key (informational; not billed by Keystroke). */
6608
- providerCostUsd: number$1().nullable().optional(),
6609
- keySource: _enum(["byok", "platform"]).nullable().optional()
6610
- });
6611
- const HistoryRunUsageSchema = object({
6612
- runDurationMs: number$1().nullable(),
6613
- lineItems: array(HistoryRunUsageLineItemSchema),
6614
- /** Sum of `billedUsd` — what Keystroke charged for this run. */
6615
- totalBilledUsd: number$1().nullable(),
6616
- /** Sum of BYOK LLM provider costs (billed externally by the org's provider). */
6617
- externalProviderCostUsd: number$1().nullable().optional()
6618
- });
6619
- const HistoryRunSchema = object({
6620
- id: string(),
6621
- kind: HistoryRunKindSchema,
6622
- traceId: string().nullable(),
6623
- projectId: string(),
6624
- projectName: string(),
6625
- resourceKey: string(),
6626
- resourceId: string(),
6627
- resourceName: string(),
6628
- status: HistoryRunStatusSchema,
6629
- triggeredAt: string(),
6630
- timeInQueueMs: number$1().nullable(),
6631
- startedAt: string(),
6632
- finishedAt: string().nullable(),
6633
- durationMs: number$1().nullable(),
6634
- triggerLabel: string(),
6635
- triggerRaw: string(),
6636
- ranAs: HistoryRunActorSchema.nullable(),
6637
- modelsUsed: array(string()),
6638
- otherServicesUsed: array(string()),
6639
- totalCostUsd: number$1().nullable(),
6640
- messageCount: number$1().optional(),
6641
- stepCount: number$1().optional()
6642
- });
6643
- const HistoryTraceSpanSchema = object({
6644
- id: string(),
6645
- traceId: string(),
6646
- parentSpanId: string().nullable(),
6647
- kind: string(),
6648
- refId: string(),
6649
- name: string(),
6650
- status: string(),
6651
- startedAt: string(),
6652
- finishedAt: string().nullable(),
6653
- metadata: unknown().nullable(),
6654
- error: unknown().nullable()
6655
- });
6656
- const HistoryTraceLogSchema = object({
6657
- id: string(),
6658
- traceId: string(),
6659
- spanId: string(),
6660
- seq: number$1(),
6661
- level: string(),
6662
- message: string(),
6663
- data: unknown().nullable(),
6664
- source: string(),
6665
- createdAt: string()
6666
- });
6667
- const HistoryTraceTriggerSchema = object({
6668
- triggerType: string(),
6669
- triggerRunId: string(),
6670
- workflowKey: string().optional(),
6671
- agentKey: string().optional(),
6672
- attachmentId: string().nullable().optional(),
6673
- attachmentSlug: string().nullable().optional(),
6674
- route: string().optional(),
6675
- sourcePath: string().nullable().optional()
6676
- }).nullable();
6677
- const HistoryTraceGatewaySchema = object({
6678
- gatewayAttachmentId: string(),
6679
- gatewayAttachmentKey: string(),
6680
- threadId: string().optional(),
6681
- channelId: string().optional(),
6682
- mode: string().optional()
6683
- }).nullable();
6684
- const HistoryTraceSchema = object({
6685
- traceId: string(),
6686
- trigger: HistoryTraceTriggerSchema,
6687
- gateway: HistoryTraceGatewaySchema,
6688
- spans: array(HistoryTraceSpanSchema),
6689
- logs: array(HistoryTraceLogSchema)
6690
- });
6691
- const HistoryWorkflowStepSchema = object({
6692
- id: string(),
6693
- actionKey: string(),
6694
- output: unknown(),
6695
- completedAt: string()
6696
- });
6697
- const HistoryRunDetailSchema = discriminatedUnion("kind", [object({
6698
- kind: literal("workflow"),
6699
- run: object({
6700
- id: string(),
6701
- workflowKey: string(),
6702
- status: HistoryRunStatusSchema,
6703
- trigger: string(),
6704
- triggeredAt: string(),
6705
- startedAt: string().nullable(),
6706
- finishedAt: string().nullable(),
6707
- input: unknown().nullable(),
6708
- output: unknown().nullable(),
6709
- error: unknown().nullable()
6710
- }),
6711
- trigger: object({
6712
- id: string(),
6713
- attachmentSlug: string().nullable(),
6714
- triggerType: string(),
6715
- sourcePath: string().nullable(),
6716
- payload: unknown().nullable(),
6717
- triggeredAt: string()
6718
- }).nullable(),
6719
- steps: array(HistoryWorkflowStepSchema),
6720
- trace: HistoryTraceSchema.nullable(),
6721
- ranAs: HistoryRunActorSchema.nullable().optional(),
6722
- usage: HistoryRunUsageSchema.nullable().optional()
6723
- }), object({
6724
- kind: literal("agent"),
6725
- runId: string(),
6726
- session: object({
6727
- id: string(),
6728
- agentKey: string(),
6729
- status: HistoryRunStatusSchema,
6730
- source: _enum([
6731
- "api",
6732
- "gateway",
6733
- "trigger",
6734
- "workflow",
6735
- "agent"
6736
- ]),
6737
- sourceId: string().nullable(),
6738
- createdAt: string(),
6739
- updatedAt: string(),
6740
- messageCount: number$1(),
6741
- error: unknown().nullable()
6742
- }),
6743
- gateway: object({
6744
- threadId: string(),
6745
- attachmentSlug: string().nullable()
6746
- }).nullable(),
6747
- messages: array(record(string(), unknown())),
6748
- live: record(string(), unknown()).nullable().default(null),
6749
- trace: HistoryTraceSchema.nullable(),
6750
- ranAs: HistoryRunActorSchema.nullable().optional(),
6751
- usage: HistoryRunUsageSchema.nullable().optional()
6752
- })]);
6753
- object({
6754
- project: string().min(1).optional(),
6755
- status: HistoryRunStatusSchema.optional(),
6756
- kind: HistoryRunKindSchema.optional()
6757
- });
6758
- HistoryRunDetailSchema.nullable();
6759
- HistoryRunSchema.nullable();
6760
6846
  object({ subscriptions: array(object({
6761
6847
  id: string(),
6762
6848
  workflowKey: string(),
@@ -6851,7 +6937,8 @@ const TriggerRunRecordSchema = object({
6851
6937
  object({
6852
6938
  limit: number().int().min(1).max(100).optional().default(20),
6853
6939
  cursor: string().min(1).optional(),
6854
- triggerType: TriggerRunTypeSchema.optional()
6940
+ triggerType: TriggerRunTypeSchema.optional(),
6941
+ outcome: TriggerRunOutcomeSchema.optional()
6855
6942
  });
6856
6943
  object({
6857
6944
  items: array(TriggerRunSummarySchema),
@@ -6919,7 +7006,8 @@ const WorkspaceTriggerRunStatusSchema = _enum([
6919
7006
  const WorkspaceTriggerSkipReasonSchema = _enum([
6920
7007
  "filtered",
6921
7008
  "no_new_data",
6922
- "transform_undefined"
7009
+ "transform_undefined",
7010
+ "payload_mismatch"
6923
7011
  ]);
6924
7012
  /**
6925
7013
  * A single downstream run/session a dispatched fire produced. A fan-out fire can
@@ -6950,7 +7038,9 @@ const WorkspaceTriggerRunOutcomeSchema = discriminatedUnion("kind", [
6950
7038
  }),
6951
7039
  object({
6952
7040
  kind: literal("skipped"),
6953
- reason: WorkspaceTriggerSkipReasonSchema
7041
+ reason: WorkspaceTriggerSkipReasonSchema,
7042
+ /** One-line Zod issue summary when reason is payload_mismatch. */
7043
+ detail: string().nullable().optional()
6954
7044
  }),
6955
7045
  object({
6956
7046
  kind: literal("failed"),
@@ -7023,6 +7113,30 @@ object({
7023
7113
  input: TriggerOverviewInputSchema
7024
7114
  });
7025
7115
  object({ enabled: boolean() });
7116
+ object({
7117
+ input: unknown().optional(),
7118
+ workflow: string().min(1).optional(),
7119
+ agent: string().min(1).optional()
7120
+ });
7121
+ object({ runId: string().min(1) });
7122
+ object({
7123
+ type: TriggerTypeSchema,
7124
+ attachments: array(object({
7125
+ attachmentSlug: string().min(1),
7126
+ kind: TriggerTargetKindSchema,
7127
+ targetSlug: string().min(1),
7128
+ targetName: string().min(1),
7129
+ enabled: boolean(),
7130
+ /** Webhook attachment JSON Schema used to drive the invoke form. */
7131
+ requestSchema: record(string(), unknown()).optional()
7132
+ })),
7133
+ /** Cron source static payload — display only; never overridden on invoke. */
7134
+ staticPayload: unknown().optional()
7135
+ });
7136
+ object({
7137
+ manual: literal(true),
7138
+ attachments: array(string().min(1)).optional()
7139
+ });
7026
7140
  const OrganizationMemberRoleSchema = _enum([
7027
7141
  "owner",
7028
7142
  "admin",
@@ -7036,7 +7150,7 @@ const OrganizationMemberStatusSchema = _enum([
7036
7150
  ]);
7037
7151
  const InvitableOrganizationMemberRoleSchema = _enum(["admin", "builder"]);
7038
7152
  const isoDateTime$5 = string().datetime();
7039
- object({
7153
+ const OrganizationMemberSchema = object({
7040
7154
  id: string(),
7041
7155
  name: string(),
7042
7156
  email: string().email(),
@@ -7046,6 +7160,14 @@ object({
7046
7160
  joinedAt: isoDateTime$5.optional(),
7047
7161
  lastActiveAt: isoDateTime$5.nullable().optional()
7048
7162
  });
7163
+ object({
7164
+ limit: number().int().min(1).max(200).optional(),
7165
+ cursor: string().min(1).optional()
7166
+ });
7167
+ object({
7168
+ items: array(OrganizationMemberSchema),
7169
+ nextCursor: string().nullable()
7170
+ });
7049
7171
  object({
7050
7172
  emails: array(string().trim().email()).min(1),
7051
7173
  role: InvitableOrganizationMemberRoleSchema
@@ -7164,14 +7286,6 @@ object({
7164
7286
  uploadUrl: url(),
7165
7287
  storageKey: string().min(1)
7166
7288
  });
7167
- function isValidIanaTimezone(value) {
7168
- try {
7169
- Intl.DateTimeFormat(void 0, { timeZone: value });
7170
- return true;
7171
- } catch {
7172
- return false;
7173
- }
7174
- }
7175
7289
  const UserInterfaceThemeSchema = _enum([
7176
7290
  "system",
7177
7291
  "light",
@@ -7716,8 +7830,8 @@ function verifyOrgWorkerToken(secret, token) {
7716
7830
  }
7717
7831
  //#endregion
7718
7832
  //#region src/runtime-env.ts
7833
+ /** Non-secret runtime config forwarded into org workers. Never include platform secrets. */
7719
7834
  const RUNTIME_ENV_KEYS = [
7720
- "BETTER_AUTH_SECRET",
7721
7835
  "PUBLIC_PLATFORM_URL",
7722
7836
  "PUBLIC_PLATFORM_PROXY_URL",
7723
7837
  "PUBLIC_WEB_URL",
@@ -7725,6 +7839,15 @@ const RUNTIME_ENV_KEYS = [
7725
7839
  "REDIS_URL",
7726
7840
  "KEYSTROKE_QUEUE_PREFIX"
7727
7841
  ];
7842
+ /** Env keys that must never be forwarded into untrusted org workers. */
7843
+ const FORBIDDEN_WORKER_ENV_KEYS = [
7844
+ "BETTER_AUTH_SECRET",
7845
+ "DATABASE_URL",
7846
+ "POSTGRES_PASSWORD",
7847
+ "PLATFORM_WORKER_TOKEN",
7848
+ "STRIPE_SECRET_KEY",
7849
+ "CREDENTIAL_ENCRYPTION_KEY"
7850
+ ];
7728
7851
  /** Provider and gateway env forwarded from the platform into project servers. */
7729
7852
  const PROVIDER_ENV_KEYS = [
7730
7853
  "ANTHROPIC_API_KEY",
@@ -7771,6 +7894,7 @@ function buildRuntimeEnv(source, artifacts, database, extraEnv) {
7771
7894
  entries.set("PLATFORM_URL", worker.platformUrl);
7772
7895
  entries.set("WORKER_INTERNAL_TOKEN", mintOrgWorkerToken(worker.workerToken, database.organizationId));
7773
7896
  if (extraEnv) for (const [key, value] of Object.entries(extraEnv)) entries.set(key, value);
7897
+ for (const key of FORBIDDEN_WORKER_ENV_KEYS) entries.delete(key);
7774
7898
  return Object.fromEntries(entries);
7775
7899
  }
7776
7900
  function resolvePlatformWorkerToken(source = process.env) {
@@ -8022,6 +8146,7 @@ async function fetchDeployStatus(baseUrl, options = {}) {
8022
8146
  }
8023
8147
  //#endregion
8024
8148
  exports.DEV_PLATFORM_WORKER_TOKEN = DEV_PLATFORM_WORKER_TOKEN;
8149
+ exports.FORBIDDEN_WORKER_ENV_KEYS = FORBIDDEN_WORKER_ENV_KEYS;
8025
8150
  exports.PROJECT_SERVER_DEPLOY_STATUS = PROJECT_SERVER_DEPLOY_STATUS;
8026
8151
  exports.PROJECT_SERVER_FRAMEWORK_NODE_MODULES = PROJECT_SERVER_FRAMEWORK_NODE_MODULES;
8027
8152
  exports.PROJECT_SERVER_FRAMEWORK_ROOT = PROJECT_SERVER_FRAMEWORK_ROOT;