@keystrokehq/hosting 0.1.11 → 0.1.12

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,6 +6389,191 @@ 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
+ "completed",
6399
+ "failed",
6400
+ "canceled"
6401
+ ]);
6402
+ const HistoryRunActorSchema = object({
6403
+ userId: string(),
6404
+ name: string(),
6405
+ avatarUrl: string().nullable().optional()
6406
+ });
6407
+ const HistoryRunUsageLineItemSchema = object({
6408
+ id: string(),
6409
+ label: string(),
6410
+ /** Amount debited from the org's Keystroke balance for this line. */
6411
+ billedUsd: number$1(),
6412
+ /** Provider cost for LLM usage on the org's API key (informational; not billed by Keystroke). */
6413
+ providerCostUsd: number$1().nullable().optional(),
6414
+ keySource: _enum(["byok", "platform"]).nullable().optional()
6415
+ });
6416
+ const HistoryRunUsageSchema = object({
6417
+ runDurationMs: number$1().nullable(),
6418
+ lineItems: array(HistoryRunUsageLineItemSchema),
6419
+ /** Sum of `billedUsd` — what Keystroke charged for this run. */
6420
+ totalBilledUsd: number$1().nullable(),
6421
+ /** Sum of BYOK LLM provider costs (billed externally by the org's provider). */
6422
+ externalProviderCostUsd: number$1().nullable().optional()
6423
+ });
6424
+ const HistoryRunSchema = object({
6425
+ id: string(),
6426
+ kind: HistoryRunKindSchema,
6427
+ traceId: string().nullable(),
6428
+ projectId: string(),
6429
+ projectName: string(),
6430
+ resourceKey: string(),
6431
+ resourceId: string(),
6432
+ resourceName: string(),
6433
+ status: HistoryRunStatusSchema,
6434
+ triggeredAt: string(),
6435
+ timeInQueueMs: number$1().nullable(),
6436
+ startedAt: string(),
6437
+ finishedAt: string().nullable(),
6438
+ durationMs: number$1().nullable(),
6439
+ triggerLabel: string(),
6440
+ triggerRaw: string(),
6441
+ ranAs: HistoryRunActorSchema.nullable(),
6442
+ modelsUsed: array(string()),
6443
+ otherServicesUsed: array(string()),
6444
+ totalCostUsd: number$1().nullable(),
6445
+ messageCount: number$1().optional(),
6446
+ stepCount: number$1().optional()
6447
+ });
6448
+ const HistoryTraceSpanSchema = object({
6449
+ id: string(),
6450
+ traceId: string(),
6451
+ parentSpanId: string().nullable(),
6452
+ kind: string(),
6453
+ refId: string(),
6454
+ name: string(),
6455
+ status: string(),
6456
+ startedAt: string(),
6457
+ finishedAt: string().nullable(),
6458
+ metadata: unknown().nullable(),
6459
+ error: unknown().nullable()
6460
+ });
6461
+ const HistoryTraceLogSchema = object({
6462
+ id: string(),
6463
+ traceId: string(),
6464
+ spanId: string(),
6465
+ seq: number$1(),
6466
+ level: string(),
6467
+ message: string(),
6468
+ data: unknown().nullable(),
6469
+ source: string(),
6470
+ createdAt: string()
6471
+ });
6472
+ const HistoryTraceTriggerSchema = object({
6473
+ triggerType: string(),
6474
+ triggerRunId: string(),
6475
+ workflowKey: string().optional(),
6476
+ agentKey: string().optional(),
6477
+ attachmentId: string().nullable().optional(),
6478
+ attachmentSlug: string().nullable().optional(),
6479
+ route: string().optional(),
6480
+ sourcePath: string().nullable().optional()
6481
+ }).nullable();
6482
+ const HistoryTraceGatewaySchema = object({
6483
+ gatewayAttachmentId: string(),
6484
+ gatewayAttachmentKey: string(),
6485
+ threadId: string().optional(),
6486
+ channelId: string().optional(),
6487
+ mode: string().optional()
6488
+ }).nullable();
6489
+ const HistoryTraceSchema = object({
6490
+ traceId: string(),
6491
+ trigger: HistoryTraceTriggerSchema,
6492
+ gateway: HistoryTraceGatewaySchema,
6493
+ spans: array(HistoryTraceSpanSchema),
6494
+ logs: array(HistoryTraceLogSchema)
6495
+ });
6496
+ const HistoryWorkflowStepSchema = object({
6497
+ id: string(),
6498
+ actionKey: string(),
6499
+ output: unknown(),
6500
+ completedAt: string()
6501
+ });
6502
+ const HistoryWorkflowRunDetailSchema = object({
6503
+ kind: literal("workflow"),
6504
+ run: object({
6505
+ id: string(),
6506
+ workflowKey: string(),
6507
+ status: HistoryRunStatusSchema,
6508
+ trigger: string(),
6509
+ triggeredAt: string(),
6510
+ startedAt: string().nullable(),
6511
+ finishedAt: string().nullable(),
6512
+ input: unknown().nullable(),
6513
+ output: unknown().nullable(),
6514
+ error: unknown().nullable()
6515
+ }),
6516
+ trigger: object({
6517
+ id: string(),
6518
+ attachmentSlug: string().nullable(),
6519
+ triggerType: string(),
6520
+ sourcePath: string().nullable(),
6521
+ payload: unknown().nullable(),
6522
+ triggeredAt: string()
6523
+ }).nullable(),
6524
+ steps: array(HistoryWorkflowStepSchema),
6525
+ trace: HistoryTraceSchema.nullable(),
6526
+ ranAs: HistoryRunActorSchema.nullable().optional(),
6527
+ usage: HistoryRunUsageSchema.nullable().optional()
6528
+ });
6529
+ const HistoryAgentCompactionEventSchema = object({
6530
+ seq: number$1(),
6531
+ createdAt: string(),
6532
+ compactionModel: string(),
6533
+ sourceModel: string(),
6534
+ estimatedBeforeTokens: number$1().optional(),
6535
+ retainedTailEstimate: number$1().optional(),
6536
+ durable: boolean()
6537
+ });
6538
+ const HistoryRunDetailSchema = discriminatedUnion("kind", [HistoryWorkflowRunDetailSchema, object({
6539
+ kind: literal("agent"),
6540
+ runId: string(),
6541
+ session: object({
6542
+ id: string(),
6543
+ agentKey: string(),
6544
+ status: HistoryRunStatusSchema,
6545
+ source: _enum([
6546
+ "api",
6547
+ "gateway",
6548
+ "trigger",
6549
+ "workflow",
6550
+ "agent"
6551
+ ]),
6552
+ sourceId: string().nullable(),
6553
+ createdAt: string(),
6554
+ updatedAt: string(),
6555
+ messageCount: number$1(),
6556
+ error: unknown().nullable()
6557
+ }),
6558
+ gateway: object({
6559
+ threadId: string(),
6560
+ attachmentSlug: string().nullable()
6561
+ }).nullable(),
6562
+ messages: array(record(string(), unknown())),
6563
+ /** Sanitized context-compaction markers for the conversation timeline. */
6564
+ compactionEvents: array(HistoryAgentCompactionEventSchema).default([]),
6565
+ trace: HistoryTraceSchema.nullable(),
6566
+ ranAs: HistoryRunActorSchema.nullable().optional(),
6567
+ usage: HistoryRunUsageSchema.nullable().optional()
6568
+ })]);
6569
+ object({
6570
+ project: string().min(1).optional(),
6571
+ status: HistoryRunStatusSchema.optional(),
6572
+ kind: HistoryRunKindSchema.optional(),
6573
+ limit: number().int().min(1).max(200).optional()
6574
+ });
6575
+ HistoryRunDetailSchema.nullable();
6576
+ HistoryRunSchema.nullable();
6323
6577
  const WorkflowRunStatusSchema = _enum([
6324
6578
  "pending",
6325
6579
  "running",
@@ -6501,6 +6755,7 @@ const AgentSessionRecordSchema = object({
6501
6755
  status: AgentSessionStatusSchema,
6502
6756
  source: RunSourceKindSchema,
6503
6757
  sourceId: string().nullable(),
6758
+ title: string().nullable(),
6504
6759
  createdAt: string(),
6505
6760
  updatedAt: string(),
6506
6761
  parentSpanId: string().nullable(),
@@ -6539,17 +6794,18 @@ const AgentEventSchema = object({
6539
6794
  });
6540
6795
  object({
6541
6796
  session: AgentSessionRecordSchema,
6797
+ activeRunId: string().nullable().default(null),
6542
6798
  gateway: GatewaySessionDetailSchema.nullable(),
6543
6799
  messages: array(record(string(), unknown())),
6544
6800
  events: array(AgentEventSchema),
6801
+ /**
6802
+ * Sanitized context-compaction markers, populated alongside `messages`.
6803
+ * A cheap indexed lookup (session_id + event_type) — never the full event
6804
+ * log. Defaulted so older servers remain compatible.
6805
+ */
6806
+ compactionEvents: array(HistoryAgentCompactionEventSchema).default([]),
6545
6807
  trace: TraceResponseSchema.nullable()
6546
6808
  });
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
6809
  const SlackGatewayModeSchema = _enum([
6554
6810
  "mention",
6555
6811
  "channel",
@@ -6584,179 +6840,6 @@ object({ agents: array(object({
6584
6840
  name: string().optional(),
6585
6841
  route: string()
6586
6842
  })) });
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
6843
  object({ subscriptions: array(object({
6761
6844
  id: string(),
6762
6845
  workflowKey: string(),
@@ -6851,7 +6934,8 @@ const TriggerRunRecordSchema = object({
6851
6934
  object({
6852
6935
  limit: number().int().min(1).max(100).optional().default(20),
6853
6936
  cursor: string().min(1).optional(),
6854
- triggerType: TriggerRunTypeSchema.optional()
6937
+ triggerType: TriggerRunTypeSchema.optional(),
6938
+ outcome: TriggerRunOutcomeSchema.optional()
6855
6939
  });
6856
6940
  object({
6857
6941
  items: array(TriggerRunSummarySchema),
@@ -6919,7 +7003,8 @@ const WorkspaceTriggerRunStatusSchema = _enum([
6919
7003
  const WorkspaceTriggerSkipReasonSchema = _enum([
6920
7004
  "filtered",
6921
7005
  "no_new_data",
6922
- "transform_undefined"
7006
+ "transform_undefined",
7007
+ "payload_mismatch"
6923
7008
  ]);
6924
7009
  /**
6925
7010
  * A single downstream run/session a dispatched fire produced. A fan-out fire can
@@ -6950,7 +7035,9 @@ const WorkspaceTriggerRunOutcomeSchema = discriminatedUnion("kind", [
6950
7035
  }),
6951
7036
  object({
6952
7037
  kind: literal("skipped"),
6953
- reason: WorkspaceTriggerSkipReasonSchema
7038
+ reason: WorkspaceTriggerSkipReasonSchema,
7039
+ /** One-line Zod issue summary when reason is payload_mismatch. */
7040
+ detail: string().nullable().optional()
6954
7041
  }),
6955
7042
  object({
6956
7043
  kind: literal("failed"),
@@ -7023,6 +7110,30 @@ object({
7023
7110
  input: TriggerOverviewInputSchema
7024
7111
  });
7025
7112
  object({ enabled: boolean() });
7113
+ object({
7114
+ input: unknown().optional(),
7115
+ workflow: string().min(1).optional(),
7116
+ agent: string().min(1).optional()
7117
+ });
7118
+ object({ runId: string().min(1) });
7119
+ object({
7120
+ type: TriggerTypeSchema,
7121
+ attachments: array(object({
7122
+ attachmentSlug: string().min(1),
7123
+ kind: TriggerTargetKindSchema,
7124
+ targetSlug: string().min(1),
7125
+ targetName: string().min(1),
7126
+ enabled: boolean(),
7127
+ /** Webhook attachment JSON Schema used to drive the invoke form. */
7128
+ requestSchema: record(string(), unknown()).optional()
7129
+ })),
7130
+ /** Cron source static payload — display only; never overridden on invoke. */
7131
+ staticPayload: unknown().optional()
7132
+ });
7133
+ object({
7134
+ manual: literal(true),
7135
+ attachments: array(string().min(1)).optional()
7136
+ });
7026
7137
  const OrganizationMemberRoleSchema = _enum([
7027
7138
  "owner",
7028
7139
  "admin",
@@ -7036,7 +7147,7 @@ const OrganizationMemberStatusSchema = _enum([
7036
7147
  ]);
7037
7148
  const InvitableOrganizationMemberRoleSchema = _enum(["admin", "builder"]);
7038
7149
  const isoDateTime$5 = string().datetime();
7039
- object({
7150
+ const OrganizationMemberSchema = object({
7040
7151
  id: string(),
7041
7152
  name: string(),
7042
7153
  email: string().email(),
@@ -7046,6 +7157,14 @@ object({
7046
7157
  joinedAt: isoDateTime$5.optional(),
7047
7158
  lastActiveAt: isoDateTime$5.nullable().optional()
7048
7159
  });
7160
+ object({
7161
+ limit: number().int().min(1).max(200).optional(),
7162
+ cursor: string().min(1).optional()
7163
+ });
7164
+ object({
7165
+ items: array(OrganizationMemberSchema),
7166
+ nextCursor: string().nullable()
7167
+ });
7049
7168
  object({
7050
7169
  emails: array(string().trim().email()).min(1),
7051
7170
  role: InvitableOrganizationMemberRoleSchema
@@ -7164,14 +7283,6 @@ object({
7164
7283
  uploadUrl: url(),
7165
7284
  storageKey: string().min(1)
7166
7285
  });
7167
- function isValidIanaTimezone(value) {
7168
- try {
7169
- Intl.DateTimeFormat(void 0, { timeZone: value });
7170
- return true;
7171
- } catch {
7172
- return false;
7173
- }
7174
- }
7175
7286
  const UserInterfaceThemeSchema = _enum([
7176
7287
  "system",
7177
7288
  "light",
@@ -7716,8 +7827,8 @@ function verifyOrgWorkerToken(secret, token) {
7716
7827
  }
7717
7828
  //#endregion
7718
7829
  //#region src/runtime-env.ts
7830
+ /** Non-secret runtime config forwarded into org workers. Never include platform secrets. */
7719
7831
  const RUNTIME_ENV_KEYS = [
7720
- "BETTER_AUTH_SECRET",
7721
7832
  "PUBLIC_PLATFORM_URL",
7722
7833
  "PUBLIC_PLATFORM_PROXY_URL",
7723
7834
  "PUBLIC_WEB_URL",
@@ -7725,6 +7836,15 @@ const RUNTIME_ENV_KEYS = [
7725
7836
  "REDIS_URL",
7726
7837
  "KEYSTROKE_QUEUE_PREFIX"
7727
7838
  ];
7839
+ /** Env keys that must never be forwarded into untrusted org workers. */
7840
+ const FORBIDDEN_WORKER_ENV_KEYS = [
7841
+ "BETTER_AUTH_SECRET",
7842
+ "DATABASE_URL",
7843
+ "POSTGRES_PASSWORD",
7844
+ "PLATFORM_WORKER_TOKEN",
7845
+ "STRIPE_SECRET_KEY",
7846
+ "CREDENTIAL_ENCRYPTION_KEY"
7847
+ ];
7728
7848
  /** Provider and gateway env forwarded from the platform into project servers. */
7729
7849
  const PROVIDER_ENV_KEYS = [
7730
7850
  "ANTHROPIC_API_KEY",
@@ -7771,6 +7891,7 @@ function buildRuntimeEnv(source, artifacts, database, extraEnv) {
7771
7891
  entries.set("PLATFORM_URL", worker.platformUrl);
7772
7892
  entries.set("WORKER_INTERNAL_TOKEN", mintOrgWorkerToken(worker.workerToken, database.organizationId));
7773
7893
  if (extraEnv) for (const [key, value] of Object.entries(extraEnv)) entries.set(key, value);
7894
+ for (const key of FORBIDDEN_WORKER_ENV_KEYS) entries.delete(key);
7774
7895
  return Object.fromEntries(entries);
7775
7896
  }
7776
7897
  function resolvePlatformWorkerToken(source = process.env) {
@@ -8022,6 +8143,7 @@ async function fetchDeployStatus(baseUrl, options = {}) {
8022
8143
  }
8023
8144
  //#endregion
8024
8145
  exports.DEV_PLATFORM_WORKER_TOKEN = DEV_PLATFORM_WORKER_TOKEN;
8146
+ exports.FORBIDDEN_WORKER_ENV_KEYS = FORBIDDEN_WORKER_ENV_KEYS;
8025
8147
  exports.PROJECT_SERVER_DEPLOY_STATUS = PROJECT_SERVER_DEPLOY_STATUS;
8026
8148
  exports.PROJECT_SERVER_FRAMEWORK_NODE_MODULES = PROJECT_SERVER_FRAMEWORK_NODE_MODULES;
8027
8149
  exports.PROJECT_SERVER_FRAMEWORK_ROOT = PROJECT_SERVER_FRAMEWORK_ROOT;