@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 +322 -197
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -1
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +3 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +322 -198
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -3
package/dist/index.mjs
CHANGED
|
@@ -5033,6 +5033,14 @@ const AppSlugSchema = ProjectSlugSchema;
|
|
|
5033
5033
|
function resolveExplicitPublicPlatformOrigin(env = process.env) {
|
|
5034
5034
|
return env.PUBLIC_PLATFORM_URL?.replace(/\/$/, "") || void 0;
|
|
5035
5035
|
}
|
|
5036
|
+
function isValidIanaTimezone(value) {
|
|
5037
|
+
try {
|
|
5038
|
+
Intl.DateTimeFormat(void 0, { timeZone: value });
|
|
5039
|
+
return true;
|
|
5040
|
+
} catch {
|
|
5041
|
+
return false;
|
|
5042
|
+
}
|
|
5043
|
+
}
|
|
5036
5044
|
/** How a credential instance is stored (`credential_instances.auth_kind`). */
|
|
5037
5045
|
const CredentialAuthKindSchema = _enum([
|
|
5038
5046
|
"api_key",
|
|
@@ -5290,6 +5298,7 @@ const storedRouteManifestEntryV2Schema = discriminatedUnion("kind", [
|
|
|
5290
5298
|
name: requiredDisplayTextSchema,
|
|
5291
5299
|
description: requiredDisplayTextSchema,
|
|
5292
5300
|
model: string(),
|
|
5301
|
+
compactionModel: string().optional(),
|
|
5293
5302
|
systemPrompt: string(),
|
|
5294
5303
|
toolCount: number$1().int().nonnegative(),
|
|
5295
5304
|
credentialCount: number$1().int().nonnegative(),
|
|
@@ -5323,7 +5332,9 @@ const storedRouteManifestEntryV2Schema = discriminatedUnion("kind", [
|
|
|
5323
5332
|
/** Deterministic AST control-flow skeleton (deploy-time producer). */
|
|
5324
5333
|
flowGraph: WorkflowCanvasGraphSchema.optional(),
|
|
5325
5334
|
/** sha256 of the workflow source the `flowGraph` was produced from (staleness). */
|
|
5326
|
-
flowGraphSourceHash: string().optional()
|
|
5335
|
+
flowGraphSourceHash: string().optional(),
|
|
5336
|
+
/** sha256 of `JSON.stringify(flowGraph)` — baked at build so canvas polls skip re-hashing. */
|
|
5337
|
+
flowGraphHash: string().optional()
|
|
5327
5338
|
}),
|
|
5328
5339
|
object({
|
|
5329
5340
|
kind: literal("trigger-webhook"),
|
|
@@ -5359,6 +5370,8 @@ const storedRouteManifestEntryV2Schema = discriminatedUnion("kind", [
|
|
|
5359
5370
|
moduleFile: string(),
|
|
5360
5371
|
sourceHash: string().optional(),
|
|
5361
5372
|
schedule: string(),
|
|
5373
|
+
/** Static cron payload from `defineCronSource({ payload })` — omitted when the source has none. */
|
|
5374
|
+
payload: unknown().optional(),
|
|
5362
5375
|
name: requiredDisplayTextSchema,
|
|
5363
5376
|
description: requiredDisplayTextSchema
|
|
5364
5377
|
})
|
|
@@ -5493,6 +5506,47 @@ object({
|
|
|
5493
5506
|
thresholdMicroCredits: number$1().int().positive().optional(),
|
|
5494
5507
|
packId: string().optional()
|
|
5495
5508
|
});
|
|
5509
|
+
const BillingUsageEventSourceSchema = _enum([
|
|
5510
|
+
"ai_gateway",
|
|
5511
|
+
"sandbox",
|
|
5512
|
+
"web_proxy",
|
|
5513
|
+
"storage",
|
|
5514
|
+
"dispatch",
|
|
5515
|
+
"poll"
|
|
5516
|
+
]);
|
|
5517
|
+
const BillingUsageMeterKeySchema = _enum([
|
|
5518
|
+
"llm",
|
|
5519
|
+
"vm_second",
|
|
5520
|
+
"web_search",
|
|
5521
|
+
"web_fetch",
|
|
5522
|
+
"workflow_run",
|
|
5523
|
+
"agent_run",
|
|
5524
|
+
"poll_trigger",
|
|
5525
|
+
"tigris_storage"
|
|
5526
|
+
]);
|
|
5527
|
+
const BillingUsageKeySourceSchema = _enum(["platform", "byok"]);
|
|
5528
|
+
const BillingUsageRunKindSchema = _enum(["agent", "workflow"]);
|
|
5529
|
+
object({ events: array(object({
|
|
5530
|
+
projectId: string().min(1).max(255).nullable().optional(),
|
|
5531
|
+
runId: string().min(1).max(255).nullable().optional(),
|
|
5532
|
+
runKind: BillingUsageRunKindSchema.nullable().optional(),
|
|
5533
|
+
source: BillingUsageEventSourceSchema,
|
|
5534
|
+
sourceEventId: string().min(1).max(512),
|
|
5535
|
+
meterKey: BillingUsageMeterKeySchema,
|
|
5536
|
+
quantity: number$1().finite().nonnegative(),
|
|
5537
|
+
unit: string().min(1).max(64),
|
|
5538
|
+
providerCostUsd: number$1().finite().nonnegative().nullable().optional(),
|
|
5539
|
+
keySource: BillingUsageKeySourceSchema.nullable().optional(),
|
|
5540
|
+
occurredAt: isoDateTime$6,
|
|
5541
|
+
metadata: record(string(), unknown()).nullable().optional()
|
|
5542
|
+
}).strict()).min(1).max(100) }).strict();
|
|
5543
|
+
object({
|
|
5544
|
+
accepted: number$1().int().nonnegative(),
|
|
5545
|
+
inserted: number$1().int().nonnegative(),
|
|
5546
|
+
duplicate: number$1().int().nonnegative(),
|
|
5547
|
+
settledLedgerId: string().nullable(),
|
|
5548
|
+
chargeMicroCredits: number$1().int().nonnegative()
|
|
5549
|
+
});
|
|
5496
5550
|
/** Messaging platforms that support agent gateway bindings. */
|
|
5497
5551
|
const ChannelPlatformKeySchema = _enum(["slack"]);
|
|
5498
5552
|
const ChannelReactionSupportSchema = _enum([
|
|
@@ -5792,15 +5846,18 @@ object({
|
|
|
5792
5846
|
integrationDescription: string().min(1),
|
|
5793
5847
|
logo: string().url().nullable().optional(),
|
|
5794
5848
|
authKind: AppAuthKindSchema,
|
|
5795
|
-
oauthScopes: array(OAuthScopeOptionSchema),
|
|
5796
5849
|
/** Where app metadata and execution are sourced (e.g. composio, custom). */
|
|
5797
5850
|
source: AppSourceSchema,
|
|
5851
|
+
/** Endpoint URL for MCP, OpenAPI, or GraphQL custom apps. */
|
|
5852
|
+
url: string().url().nullable().optional(),
|
|
5853
|
+
/** True when the app has a non-empty credential field template. */
|
|
5854
|
+
hasCredentialFields: boolean().optional()
|
|
5855
|
+
}).extend({
|
|
5856
|
+
oauthScopes: array(OAuthScopeOptionSchema),
|
|
5798
5857
|
/** Custom api_key apps — vault field template for connect UI and sync. */
|
|
5799
5858
|
credentialFields: AppCredentialFieldsSchema.optional(),
|
|
5800
5859
|
/** Composio auth scheme when credentialFields are present. */
|
|
5801
5860
|
credentialScheme: AppCredentialSchemeSchema.optional(),
|
|
5802
|
-
/** Endpoint URL for MCP, OpenAPI, or GraphQL custom apps. */
|
|
5803
|
-
url: string().url().nullable().optional(),
|
|
5804
5861
|
/** When present, the app supports agent gateway bindings (external channels). */
|
|
5805
5862
|
gateway: AppGatewaySchema.optional()
|
|
5806
5863
|
});
|
|
@@ -5922,7 +5979,11 @@ const AppCredentialConnectionKindSchema = _enum(["oauth", "manual"]);
|
|
|
5922
5979
|
const OAuthPermissionModeSchema = _enum(["default", "restricted"]);
|
|
5923
5980
|
const optionalTimestamp$1 = string().optional();
|
|
5924
5981
|
const nullableOptionalTimestamp = string().nullable().optional();
|
|
5925
|
-
|
|
5982
|
+
/**
|
|
5983
|
+
* Summary row for the apps/credentials table and credential detail page.
|
|
5984
|
+
* Plaintext secrets are never returned — only masked `keyPreviews`.
|
|
5985
|
+
*/
|
|
5986
|
+
const AppCredentialSummarySchema = object({
|
|
5926
5987
|
id: string().min(1),
|
|
5927
5988
|
appId: string().min(1),
|
|
5928
5989
|
/** Stable per-scope identifier; pass to `--credential` to pin a specific instance. */
|
|
@@ -6013,6 +6074,14 @@ object({
|
|
|
6013
6074
|
isDefault: boolean().optional(),
|
|
6014
6075
|
value: credentialSecretValueSchema.optional()
|
|
6015
6076
|
}).refine((input) => input.label !== void 0 || input.isDefault !== void 0 || input.value !== void 0, { message: "At least one field is required" });
|
|
6077
|
+
object({
|
|
6078
|
+
limit: number().int().min(1).max(200).optional(),
|
|
6079
|
+
cursor: string().min(1).optional()
|
|
6080
|
+
});
|
|
6081
|
+
object({
|
|
6082
|
+
items: array(AppCredentialSummarySchema),
|
|
6083
|
+
nextCursor: string().nullable()
|
|
6084
|
+
});
|
|
6016
6085
|
const CredentialAssignmentTargetTypeSchema = _enum([
|
|
6017
6086
|
"workflow",
|
|
6018
6087
|
"agent",
|
|
@@ -6296,11 +6365,198 @@ object({
|
|
|
6296
6365
|
attachmentId: string(),
|
|
6297
6366
|
attachmentSlug: string()
|
|
6298
6367
|
});
|
|
6368
|
+
const HistoryRunKindSchema = _enum(["workflow", "agent"]);
|
|
6369
|
+
const HistoryRunStatusSchema = _enum([
|
|
6370
|
+
"pending",
|
|
6371
|
+
"running",
|
|
6372
|
+
"sleeping",
|
|
6373
|
+
"waiting_hook",
|
|
6374
|
+
"waiting_children",
|
|
6375
|
+
"completed",
|
|
6376
|
+
"failed",
|
|
6377
|
+
"canceled"
|
|
6378
|
+
]);
|
|
6379
|
+
const HistoryRunActorSchema = object({
|
|
6380
|
+
userId: string(),
|
|
6381
|
+
name: string(),
|
|
6382
|
+
avatarUrl: string().nullable().optional()
|
|
6383
|
+
});
|
|
6384
|
+
const HistoryRunUsageLineItemSchema = object({
|
|
6385
|
+
id: string(),
|
|
6386
|
+
label: string(),
|
|
6387
|
+
/** Amount debited from the org's Keystroke balance for this line. */
|
|
6388
|
+
billedUsd: number$1(),
|
|
6389
|
+
/** Provider cost for LLM usage on the org's API key (informational; not billed by Keystroke). */
|
|
6390
|
+
providerCostUsd: number$1().nullable().optional(),
|
|
6391
|
+
keySource: _enum(["byok", "platform"]).nullable().optional()
|
|
6392
|
+
});
|
|
6393
|
+
const HistoryRunUsageSchema = object({
|
|
6394
|
+
runDurationMs: number$1().nullable(),
|
|
6395
|
+
lineItems: array(HistoryRunUsageLineItemSchema),
|
|
6396
|
+
/** Sum of `billedUsd` — what Keystroke charged for this run. */
|
|
6397
|
+
totalBilledUsd: number$1().nullable(),
|
|
6398
|
+
/** Sum of BYOK LLM provider costs (billed externally by the org's provider). */
|
|
6399
|
+
externalProviderCostUsd: number$1().nullable().optional()
|
|
6400
|
+
});
|
|
6401
|
+
const HistoryRunSchema = object({
|
|
6402
|
+
id: string(),
|
|
6403
|
+
kind: HistoryRunKindSchema,
|
|
6404
|
+
traceId: string().nullable(),
|
|
6405
|
+
projectId: string(),
|
|
6406
|
+
projectName: string(),
|
|
6407
|
+
resourceKey: string(),
|
|
6408
|
+
resourceId: string(),
|
|
6409
|
+
resourceName: string(),
|
|
6410
|
+
status: HistoryRunStatusSchema,
|
|
6411
|
+
triggeredAt: string(),
|
|
6412
|
+
timeInQueueMs: number$1().nullable(),
|
|
6413
|
+
startedAt: string(),
|
|
6414
|
+
finishedAt: string().nullable(),
|
|
6415
|
+
durationMs: number$1().nullable(),
|
|
6416
|
+
triggerLabel: string(),
|
|
6417
|
+
triggerRaw: string(),
|
|
6418
|
+
ranAs: HistoryRunActorSchema.nullable(),
|
|
6419
|
+
modelsUsed: array(string()),
|
|
6420
|
+
otherServicesUsed: array(string()),
|
|
6421
|
+
totalCostUsd: number$1().nullable(),
|
|
6422
|
+
messageCount: number$1().optional(),
|
|
6423
|
+
stepCount: number$1().optional()
|
|
6424
|
+
});
|
|
6425
|
+
const HistoryTraceSpanSchema = object({
|
|
6426
|
+
id: string(),
|
|
6427
|
+
traceId: string(),
|
|
6428
|
+
parentSpanId: string().nullable(),
|
|
6429
|
+
kind: string(),
|
|
6430
|
+
refId: string(),
|
|
6431
|
+
name: string(),
|
|
6432
|
+
status: string(),
|
|
6433
|
+
startedAt: string(),
|
|
6434
|
+
finishedAt: string().nullable(),
|
|
6435
|
+
metadata: unknown().nullable(),
|
|
6436
|
+
error: unknown().nullable()
|
|
6437
|
+
});
|
|
6438
|
+
const HistoryTraceLogSchema = object({
|
|
6439
|
+
id: string(),
|
|
6440
|
+
traceId: string(),
|
|
6441
|
+
spanId: string(),
|
|
6442
|
+
seq: number$1(),
|
|
6443
|
+
level: string(),
|
|
6444
|
+
message: string(),
|
|
6445
|
+
data: unknown().nullable(),
|
|
6446
|
+
source: string(),
|
|
6447
|
+
createdAt: string()
|
|
6448
|
+
});
|
|
6449
|
+
const HistoryTraceTriggerSchema = object({
|
|
6450
|
+
triggerType: string(),
|
|
6451
|
+
triggerRunId: string(),
|
|
6452
|
+
workflowKey: string().optional(),
|
|
6453
|
+
agentKey: string().optional(),
|
|
6454
|
+
attachmentId: string().nullable().optional(),
|
|
6455
|
+
attachmentSlug: string().nullable().optional(),
|
|
6456
|
+
route: string().optional(),
|
|
6457
|
+
sourcePath: string().nullable().optional()
|
|
6458
|
+
}).nullable();
|
|
6459
|
+
const HistoryTraceGatewaySchema = object({
|
|
6460
|
+
gatewayAttachmentId: string(),
|
|
6461
|
+
gatewayAttachmentKey: string(),
|
|
6462
|
+
threadId: string().optional(),
|
|
6463
|
+
channelId: string().optional(),
|
|
6464
|
+
mode: string().optional()
|
|
6465
|
+
}).nullable();
|
|
6466
|
+
const HistoryTraceSchema = object({
|
|
6467
|
+
traceId: string(),
|
|
6468
|
+
trigger: HistoryTraceTriggerSchema,
|
|
6469
|
+
gateway: HistoryTraceGatewaySchema,
|
|
6470
|
+
spans: array(HistoryTraceSpanSchema),
|
|
6471
|
+
logs: array(HistoryTraceLogSchema)
|
|
6472
|
+
});
|
|
6473
|
+
const HistoryWorkflowStepSchema = object({
|
|
6474
|
+
id: string(),
|
|
6475
|
+
actionKey: string(),
|
|
6476
|
+
output: unknown(),
|
|
6477
|
+
completedAt: string()
|
|
6478
|
+
});
|
|
6479
|
+
const HistoryWorkflowRunDetailSchema = object({
|
|
6480
|
+
kind: literal("workflow"),
|
|
6481
|
+
run: object({
|
|
6482
|
+
id: string(),
|
|
6483
|
+
workflowKey: string(),
|
|
6484
|
+
status: HistoryRunStatusSchema,
|
|
6485
|
+
trigger: string(),
|
|
6486
|
+
triggeredAt: string(),
|
|
6487
|
+
startedAt: string().nullable(),
|
|
6488
|
+
finishedAt: string().nullable(),
|
|
6489
|
+
input: unknown().nullable(),
|
|
6490
|
+
output: unknown().nullable(),
|
|
6491
|
+
error: unknown().nullable()
|
|
6492
|
+
}),
|
|
6493
|
+
trigger: object({
|
|
6494
|
+
id: string(),
|
|
6495
|
+
attachmentSlug: string().nullable(),
|
|
6496
|
+
triggerType: string(),
|
|
6497
|
+
sourcePath: string().nullable(),
|
|
6498
|
+
payload: unknown().nullable(),
|
|
6499
|
+
triggeredAt: string()
|
|
6500
|
+
}).nullable(),
|
|
6501
|
+
steps: array(HistoryWorkflowStepSchema),
|
|
6502
|
+
trace: HistoryTraceSchema.nullable(),
|
|
6503
|
+
ranAs: HistoryRunActorSchema.nullable().optional(),
|
|
6504
|
+
usage: HistoryRunUsageSchema.nullable().optional()
|
|
6505
|
+
});
|
|
6506
|
+
const HistoryAgentCompactionEventSchema = object({
|
|
6507
|
+
seq: number$1(),
|
|
6508
|
+
createdAt: string(),
|
|
6509
|
+
compactionModel: string(),
|
|
6510
|
+
sourceModel: string(),
|
|
6511
|
+
estimatedBeforeTokens: number$1().optional(),
|
|
6512
|
+
retainedTailEstimate: number$1().optional(),
|
|
6513
|
+
durable: boolean()
|
|
6514
|
+
});
|
|
6515
|
+
const HistoryRunDetailSchema = discriminatedUnion("kind", [HistoryWorkflowRunDetailSchema, object({
|
|
6516
|
+
kind: literal("agent"),
|
|
6517
|
+
runId: string(),
|
|
6518
|
+
session: object({
|
|
6519
|
+
id: string(),
|
|
6520
|
+
agentKey: string(),
|
|
6521
|
+
status: HistoryRunStatusSchema,
|
|
6522
|
+
source: _enum([
|
|
6523
|
+
"api",
|
|
6524
|
+
"gateway",
|
|
6525
|
+
"trigger",
|
|
6526
|
+
"workflow",
|
|
6527
|
+
"agent"
|
|
6528
|
+
]),
|
|
6529
|
+
sourceId: string().nullable(),
|
|
6530
|
+
createdAt: string(),
|
|
6531
|
+
updatedAt: string(),
|
|
6532
|
+
messageCount: number$1(),
|
|
6533
|
+
error: unknown().nullable()
|
|
6534
|
+
}),
|
|
6535
|
+
gateway: object({
|
|
6536
|
+
threadId: string(),
|
|
6537
|
+
attachmentSlug: string().nullable()
|
|
6538
|
+
}).nullable(),
|
|
6539
|
+
messages: array(record(string(), unknown())),
|
|
6540
|
+
/** Sanitized context-compaction markers for the conversation timeline. */
|
|
6541
|
+
compactionEvents: array(HistoryAgentCompactionEventSchema).default([]),
|
|
6542
|
+
trace: HistoryTraceSchema.nullable(),
|
|
6543
|
+
ranAs: HistoryRunActorSchema.nullable().optional(),
|
|
6544
|
+
usage: HistoryRunUsageSchema.nullable().optional()
|
|
6545
|
+
})]);
|
|
6546
|
+
object({
|
|
6547
|
+
project: string().min(1).optional(),
|
|
6548
|
+
status: HistoryRunStatusSchema.optional(),
|
|
6549
|
+
kind: HistoryRunKindSchema.optional(),
|
|
6550
|
+
limit: number().int().min(1).max(200).optional()
|
|
6551
|
+
});
|
|
6552
|
+
HistoryRunDetailSchema.nullable();
|
|
6553
|
+
HistoryRunSchema.nullable();
|
|
6299
6554
|
const WorkflowRunStatusSchema = _enum([
|
|
6300
6555
|
"pending",
|
|
6301
6556
|
"running",
|
|
6302
6557
|
"sleeping",
|
|
6303
6558
|
"waiting_hook",
|
|
6559
|
+
"waiting_children",
|
|
6304
6560
|
"completed",
|
|
6305
6561
|
"failed",
|
|
6306
6562
|
"canceled"
|
|
@@ -6321,6 +6577,7 @@ _enum([
|
|
|
6321
6577
|
"sleep_completed",
|
|
6322
6578
|
"hook_created",
|
|
6323
6579
|
"hook_resumed",
|
|
6580
|
+
"child_dispatched",
|
|
6324
6581
|
"run_completed",
|
|
6325
6582
|
"run_failed",
|
|
6326
6583
|
"run_canceled"
|
|
@@ -6477,6 +6734,7 @@ const AgentSessionRecordSchema = object({
|
|
|
6477
6734
|
status: AgentSessionStatusSchema,
|
|
6478
6735
|
source: RunSourceKindSchema,
|
|
6479
6736
|
sourceId: string().nullable(),
|
|
6737
|
+
title: string().nullable(),
|
|
6480
6738
|
createdAt: string(),
|
|
6481
6739
|
updatedAt: string(),
|
|
6482
6740
|
parentSpanId: string().nullable(),
|
|
@@ -6515,17 +6773,18 @@ const AgentEventSchema = object({
|
|
|
6515
6773
|
});
|
|
6516
6774
|
object({
|
|
6517
6775
|
session: AgentSessionRecordSchema,
|
|
6776
|
+
activeRunId: string().nullable().default(null),
|
|
6518
6777
|
gateway: GatewaySessionDetailSchema.nullable(),
|
|
6519
6778
|
messages: array(record(string(), unknown())),
|
|
6520
6779
|
events: array(AgentEventSchema),
|
|
6780
|
+
/**
|
|
6781
|
+
* Sanitized context-compaction markers, populated alongside `messages`.
|
|
6782
|
+
* A cheap indexed lookup (session_id + event_type) — never the full event
|
|
6783
|
+
* log. Defaulted so older servers remain compatible.
|
|
6784
|
+
*/
|
|
6785
|
+
compactionEvents: array(HistoryAgentCompactionEventSchema).default([]),
|
|
6521
6786
|
trace: TraceResponseSchema.nullable()
|
|
6522
6787
|
});
|
|
6523
|
-
object({ sinceSeq: number().int().min(0).optional() });
|
|
6524
|
-
object({
|
|
6525
|
-
status: AgentSessionStatusSchema,
|
|
6526
|
-
messages: array(record(string(), unknown())),
|
|
6527
|
-
live: record(string(), unknown()).nullable()
|
|
6528
|
-
});
|
|
6529
6788
|
const SlackGatewayModeSchema = _enum([
|
|
6530
6789
|
"mention",
|
|
6531
6790
|
"channel",
|
|
@@ -6560,179 +6819,6 @@ object({ agents: array(object({
|
|
|
6560
6819
|
name: string().optional(),
|
|
6561
6820
|
route: string()
|
|
6562
6821
|
})) });
|
|
6563
|
-
const HistoryRunKindSchema = _enum(["workflow", "agent"]);
|
|
6564
|
-
const HistoryRunStatusSchema = _enum([
|
|
6565
|
-
"pending",
|
|
6566
|
-
"running",
|
|
6567
|
-
"sleeping",
|
|
6568
|
-
"waiting_hook",
|
|
6569
|
-
"completed",
|
|
6570
|
-
"failed",
|
|
6571
|
-
"canceled"
|
|
6572
|
-
]);
|
|
6573
|
-
const HistoryRunActorSchema = object({
|
|
6574
|
-
userId: string(),
|
|
6575
|
-
name: string(),
|
|
6576
|
-
avatarUrl: string().nullable().optional()
|
|
6577
|
-
});
|
|
6578
|
-
const HistoryRunUsageLineItemSchema = object({
|
|
6579
|
-
id: string(),
|
|
6580
|
-
label: string(),
|
|
6581
|
-
/** Amount debited from the org's Keystroke balance for this line. */
|
|
6582
|
-
billedUsd: number$1(),
|
|
6583
|
-
/** Provider cost for LLM usage on the org's API key (informational; not billed by Keystroke). */
|
|
6584
|
-
providerCostUsd: number$1().nullable().optional(),
|
|
6585
|
-
keySource: _enum(["byok", "platform"]).nullable().optional()
|
|
6586
|
-
});
|
|
6587
|
-
const HistoryRunUsageSchema = object({
|
|
6588
|
-
runDurationMs: number$1().nullable(),
|
|
6589
|
-
lineItems: array(HistoryRunUsageLineItemSchema),
|
|
6590
|
-
/** Sum of `billedUsd` — what Keystroke charged for this run. */
|
|
6591
|
-
totalBilledUsd: number$1().nullable(),
|
|
6592
|
-
/** Sum of BYOK LLM provider costs (billed externally by the org's provider). */
|
|
6593
|
-
externalProviderCostUsd: number$1().nullable().optional()
|
|
6594
|
-
});
|
|
6595
|
-
const HistoryRunSchema = object({
|
|
6596
|
-
id: string(),
|
|
6597
|
-
kind: HistoryRunKindSchema,
|
|
6598
|
-
traceId: string().nullable(),
|
|
6599
|
-
projectId: string(),
|
|
6600
|
-
projectName: string(),
|
|
6601
|
-
resourceKey: string(),
|
|
6602
|
-
resourceId: string(),
|
|
6603
|
-
resourceName: string(),
|
|
6604
|
-
status: HistoryRunStatusSchema,
|
|
6605
|
-
triggeredAt: string(),
|
|
6606
|
-
timeInQueueMs: number$1().nullable(),
|
|
6607
|
-
startedAt: string(),
|
|
6608
|
-
finishedAt: string().nullable(),
|
|
6609
|
-
durationMs: number$1().nullable(),
|
|
6610
|
-
triggerLabel: string(),
|
|
6611
|
-
triggerRaw: string(),
|
|
6612
|
-
ranAs: HistoryRunActorSchema.nullable(),
|
|
6613
|
-
modelsUsed: array(string()),
|
|
6614
|
-
otherServicesUsed: array(string()),
|
|
6615
|
-
totalCostUsd: number$1().nullable(),
|
|
6616
|
-
messageCount: number$1().optional(),
|
|
6617
|
-
stepCount: number$1().optional()
|
|
6618
|
-
});
|
|
6619
|
-
const HistoryTraceSpanSchema = object({
|
|
6620
|
-
id: string(),
|
|
6621
|
-
traceId: string(),
|
|
6622
|
-
parentSpanId: string().nullable(),
|
|
6623
|
-
kind: string(),
|
|
6624
|
-
refId: string(),
|
|
6625
|
-
name: string(),
|
|
6626
|
-
status: string(),
|
|
6627
|
-
startedAt: string(),
|
|
6628
|
-
finishedAt: string().nullable(),
|
|
6629
|
-
metadata: unknown().nullable(),
|
|
6630
|
-
error: unknown().nullable()
|
|
6631
|
-
});
|
|
6632
|
-
const HistoryTraceLogSchema = object({
|
|
6633
|
-
id: string(),
|
|
6634
|
-
traceId: string(),
|
|
6635
|
-
spanId: string(),
|
|
6636
|
-
seq: number$1(),
|
|
6637
|
-
level: string(),
|
|
6638
|
-
message: string(),
|
|
6639
|
-
data: unknown().nullable(),
|
|
6640
|
-
source: string(),
|
|
6641
|
-
createdAt: string()
|
|
6642
|
-
});
|
|
6643
|
-
const HistoryTraceTriggerSchema = object({
|
|
6644
|
-
triggerType: string(),
|
|
6645
|
-
triggerRunId: string(),
|
|
6646
|
-
workflowKey: string().optional(),
|
|
6647
|
-
agentKey: string().optional(),
|
|
6648
|
-
attachmentId: string().nullable().optional(),
|
|
6649
|
-
attachmentSlug: string().nullable().optional(),
|
|
6650
|
-
route: string().optional(),
|
|
6651
|
-
sourcePath: string().nullable().optional()
|
|
6652
|
-
}).nullable();
|
|
6653
|
-
const HistoryTraceGatewaySchema = object({
|
|
6654
|
-
gatewayAttachmentId: string(),
|
|
6655
|
-
gatewayAttachmentKey: string(),
|
|
6656
|
-
threadId: string().optional(),
|
|
6657
|
-
channelId: string().optional(),
|
|
6658
|
-
mode: string().optional()
|
|
6659
|
-
}).nullable();
|
|
6660
|
-
const HistoryTraceSchema = object({
|
|
6661
|
-
traceId: string(),
|
|
6662
|
-
trigger: HistoryTraceTriggerSchema,
|
|
6663
|
-
gateway: HistoryTraceGatewaySchema,
|
|
6664
|
-
spans: array(HistoryTraceSpanSchema),
|
|
6665
|
-
logs: array(HistoryTraceLogSchema)
|
|
6666
|
-
});
|
|
6667
|
-
const HistoryWorkflowStepSchema = object({
|
|
6668
|
-
id: string(),
|
|
6669
|
-
actionKey: string(),
|
|
6670
|
-
output: unknown(),
|
|
6671
|
-
completedAt: string()
|
|
6672
|
-
});
|
|
6673
|
-
const HistoryRunDetailSchema = discriminatedUnion("kind", [object({
|
|
6674
|
-
kind: literal("workflow"),
|
|
6675
|
-
run: object({
|
|
6676
|
-
id: string(),
|
|
6677
|
-
workflowKey: string(),
|
|
6678
|
-
status: HistoryRunStatusSchema,
|
|
6679
|
-
trigger: string(),
|
|
6680
|
-
triggeredAt: string(),
|
|
6681
|
-
startedAt: string().nullable(),
|
|
6682
|
-
finishedAt: string().nullable(),
|
|
6683
|
-
input: unknown().nullable(),
|
|
6684
|
-
output: unknown().nullable(),
|
|
6685
|
-
error: unknown().nullable()
|
|
6686
|
-
}),
|
|
6687
|
-
trigger: object({
|
|
6688
|
-
id: string(),
|
|
6689
|
-
attachmentSlug: string().nullable(),
|
|
6690
|
-
triggerType: string(),
|
|
6691
|
-
sourcePath: string().nullable(),
|
|
6692
|
-
payload: unknown().nullable(),
|
|
6693
|
-
triggeredAt: string()
|
|
6694
|
-
}).nullable(),
|
|
6695
|
-
steps: array(HistoryWorkflowStepSchema),
|
|
6696
|
-
trace: HistoryTraceSchema.nullable(),
|
|
6697
|
-
ranAs: HistoryRunActorSchema.nullable().optional(),
|
|
6698
|
-
usage: HistoryRunUsageSchema.nullable().optional()
|
|
6699
|
-
}), object({
|
|
6700
|
-
kind: literal("agent"),
|
|
6701
|
-
runId: string(),
|
|
6702
|
-
session: object({
|
|
6703
|
-
id: string(),
|
|
6704
|
-
agentKey: string(),
|
|
6705
|
-
status: HistoryRunStatusSchema,
|
|
6706
|
-
source: _enum([
|
|
6707
|
-
"api",
|
|
6708
|
-
"gateway",
|
|
6709
|
-
"trigger",
|
|
6710
|
-
"workflow",
|
|
6711
|
-
"agent"
|
|
6712
|
-
]),
|
|
6713
|
-
sourceId: string().nullable(),
|
|
6714
|
-
createdAt: string(),
|
|
6715
|
-
updatedAt: string(),
|
|
6716
|
-
messageCount: number$1(),
|
|
6717
|
-
error: unknown().nullable()
|
|
6718
|
-
}),
|
|
6719
|
-
gateway: object({
|
|
6720
|
-
threadId: string(),
|
|
6721
|
-
attachmentSlug: string().nullable()
|
|
6722
|
-
}).nullable(),
|
|
6723
|
-
messages: array(record(string(), unknown())),
|
|
6724
|
-
live: record(string(), unknown()).nullable().default(null),
|
|
6725
|
-
trace: HistoryTraceSchema.nullable(),
|
|
6726
|
-
ranAs: HistoryRunActorSchema.nullable().optional(),
|
|
6727
|
-
usage: HistoryRunUsageSchema.nullable().optional()
|
|
6728
|
-
})]);
|
|
6729
|
-
object({
|
|
6730
|
-
project: string().min(1).optional(),
|
|
6731
|
-
status: HistoryRunStatusSchema.optional(),
|
|
6732
|
-
kind: HistoryRunKindSchema.optional()
|
|
6733
|
-
});
|
|
6734
|
-
HistoryRunDetailSchema.nullable();
|
|
6735
|
-
HistoryRunSchema.nullable();
|
|
6736
6822
|
object({ subscriptions: array(object({
|
|
6737
6823
|
id: string(),
|
|
6738
6824
|
workflowKey: string(),
|
|
@@ -6827,7 +6913,8 @@ const TriggerRunRecordSchema = object({
|
|
|
6827
6913
|
object({
|
|
6828
6914
|
limit: number().int().min(1).max(100).optional().default(20),
|
|
6829
6915
|
cursor: string().min(1).optional(),
|
|
6830
|
-
triggerType: TriggerRunTypeSchema.optional()
|
|
6916
|
+
triggerType: TriggerRunTypeSchema.optional(),
|
|
6917
|
+
outcome: TriggerRunOutcomeSchema.optional()
|
|
6831
6918
|
});
|
|
6832
6919
|
object({
|
|
6833
6920
|
items: array(TriggerRunSummarySchema),
|
|
@@ -6895,7 +6982,8 @@ const WorkspaceTriggerRunStatusSchema = _enum([
|
|
|
6895
6982
|
const WorkspaceTriggerSkipReasonSchema = _enum([
|
|
6896
6983
|
"filtered",
|
|
6897
6984
|
"no_new_data",
|
|
6898
|
-
"transform_undefined"
|
|
6985
|
+
"transform_undefined",
|
|
6986
|
+
"payload_mismatch"
|
|
6899
6987
|
]);
|
|
6900
6988
|
/**
|
|
6901
6989
|
* A single downstream run/session a dispatched fire produced. A fan-out fire can
|
|
@@ -6926,7 +7014,9 @@ const WorkspaceTriggerRunOutcomeSchema = discriminatedUnion("kind", [
|
|
|
6926
7014
|
}),
|
|
6927
7015
|
object({
|
|
6928
7016
|
kind: literal("skipped"),
|
|
6929
|
-
reason: WorkspaceTriggerSkipReasonSchema
|
|
7017
|
+
reason: WorkspaceTriggerSkipReasonSchema,
|
|
7018
|
+
/** One-line Zod issue summary when reason is payload_mismatch. */
|
|
7019
|
+
detail: string().nullable().optional()
|
|
6930
7020
|
}),
|
|
6931
7021
|
object({
|
|
6932
7022
|
kind: literal("failed"),
|
|
@@ -6999,6 +7089,30 @@ object({
|
|
|
6999
7089
|
input: TriggerOverviewInputSchema
|
|
7000
7090
|
});
|
|
7001
7091
|
object({ enabled: boolean() });
|
|
7092
|
+
object({
|
|
7093
|
+
input: unknown().optional(),
|
|
7094
|
+
workflow: string().min(1).optional(),
|
|
7095
|
+
agent: string().min(1).optional()
|
|
7096
|
+
});
|
|
7097
|
+
object({ runId: string().min(1) });
|
|
7098
|
+
object({
|
|
7099
|
+
type: TriggerTypeSchema,
|
|
7100
|
+
attachments: array(object({
|
|
7101
|
+
attachmentSlug: string().min(1),
|
|
7102
|
+
kind: TriggerTargetKindSchema,
|
|
7103
|
+
targetSlug: string().min(1),
|
|
7104
|
+
targetName: string().min(1),
|
|
7105
|
+
enabled: boolean(),
|
|
7106
|
+
/** Webhook attachment JSON Schema used to drive the invoke form. */
|
|
7107
|
+
requestSchema: record(string(), unknown()).optional()
|
|
7108
|
+
})),
|
|
7109
|
+
/** Cron source static payload — display only; never overridden on invoke. */
|
|
7110
|
+
staticPayload: unknown().optional()
|
|
7111
|
+
});
|
|
7112
|
+
object({
|
|
7113
|
+
manual: literal(true),
|
|
7114
|
+
attachments: array(string().min(1)).optional()
|
|
7115
|
+
});
|
|
7002
7116
|
const OrganizationMemberRoleSchema = _enum([
|
|
7003
7117
|
"owner",
|
|
7004
7118
|
"admin",
|
|
@@ -7012,7 +7126,7 @@ const OrganizationMemberStatusSchema = _enum([
|
|
|
7012
7126
|
]);
|
|
7013
7127
|
const InvitableOrganizationMemberRoleSchema = _enum(["admin", "builder"]);
|
|
7014
7128
|
const isoDateTime$5 = string().datetime();
|
|
7015
|
-
object({
|
|
7129
|
+
const OrganizationMemberSchema = object({
|
|
7016
7130
|
id: string(),
|
|
7017
7131
|
name: string(),
|
|
7018
7132
|
email: string().email(),
|
|
@@ -7022,6 +7136,14 @@ object({
|
|
|
7022
7136
|
joinedAt: isoDateTime$5.optional(),
|
|
7023
7137
|
lastActiveAt: isoDateTime$5.nullable().optional()
|
|
7024
7138
|
});
|
|
7139
|
+
object({
|
|
7140
|
+
limit: number().int().min(1).max(200).optional(),
|
|
7141
|
+
cursor: string().min(1).optional()
|
|
7142
|
+
});
|
|
7143
|
+
object({
|
|
7144
|
+
items: array(OrganizationMemberSchema),
|
|
7145
|
+
nextCursor: string().nullable()
|
|
7146
|
+
});
|
|
7025
7147
|
object({
|
|
7026
7148
|
emails: array(string().trim().email()).min(1),
|
|
7027
7149
|
role: InvitableOrganizationMemberRoleSchema
|
|
@@ -7140,14 +7262,6 @@ object({
|
|
|
7140
7262
|
uploadUrl: url(),
|
|
7141
7263
|
storageKey: string().min(1)
|
|
7142
7264
|
});
|
|
7143
|
-
function isValidIanaTimezone(value) {
|
|
7144
|
-
try {
|
|
7145
|
-
Intl.DateTimeFormat(void 0, { timeZone: value });
|
|
7146
|
-
return true;
|
|
7147
|
-
} catch {
|
|
7148
|
-
return false;
|
|
7149
|
-
}
|
|
7150
|
-
}
|
|
7151
7265
|
const UserInterfaceThemeSchema = _enum([
|
|
7152
7266
|
"system",
|
|
7153
7267
|
"light",
|
|
@@ -7692,8 +7806,8 @@ function verifyOrgWorkerToken(secret, token) {
|
|
|
7692
7806
|
}
|
|
7693
7807
|
//#endregion
|
|
7694
7808
|
//#region src/runtime-env.ts
|
|
7809
|
+
/** Non-secret runtime config forwarded into org workers. Never include platform secrets. */
|
|
7695
7810
|
const RUNTIME_ENV_KEYS = [
|
|
7696
|
-
"BETTER_AUTH_SECRET",
|
|
7697
7811
|
"PUBLIC_PLATFORM_URL",
|
|
7698
7812
|
"PUBLIC_PLATFORM_PROXY_URL",
|
|
7699
7813
|
"PUBLIC_WEB_URL",
|
|
@@ -7701,6 +7815,15 @@ const RUNTIME_ENV_KEYS = [
|
|
|
7701
7815
|
"REDIS_URL",
|
|
7702
7816
|
"KEYSTROKE_QUEUE_PREFIX"
|
|
7703
7817
|
];
|
|
7818
|
+
/** Env keys that must never be forwarded into untrusted org workers. */
|
|
7819
|
+
const FORBIDDEN_WORKER_ENV_KEYS = [
|
|
7820
|
+
"BETTER_AUTH_SECRET",
|
|
7821
|
+
"DATABASE_URL",
|
|
7822
|
+
"POSTGRES_PASSWORD",
|
|
7823
|
+
"PLATFORM_WORKER_TOKEN",
|
|
7824
|
+
"STRIPE_SECRET_KEY",
|
|
7825
|
+
"CREDENTIAL_ENCRYPTION_KEY"
|
|
7826
|
+
];
|
|
7704
7827
|
/** Provider and gateway env forwarded from the platform into project servers. */
|
|
7705
7828
|
const PROVIDER_ENV_KEYS = [
|
|
7706
7829
|
"ANTHROPIC_API_KEY",
|
|
@@ -7747,6 +7870,7 @@ function buildRuntimeEnv(source, artifacts, database, extraEnv) {
|
|
|
7747
7870
|
entries.set("PLATFORM_URL", worker.platformUrl);
|
|
7748
7871
|
entries.set("WORKER_INTERNAL_TOKEN", mintOrgWorkerToken(worker.workerToken, database.organizationId));
|
|
7749
7872
|
if (extraEnv) for (const [key, value] of Object.entries(extraEnv)) entries.set(key, value);
|
|
7873
|
+
for (const key of FORBIDDEN_WORKER_ENV_KEYS) entries.delete(key);
|
|
7750
7874
|
return Object.fromEntries(entries);
|
|
7751
7875
|
}
|
|
7752
7876
|
function resolvePlatformWorkerToken(source = process.env) {
|
|
@@ -7997,6 +8121,6 @@ async function fetchDeployStatus(baseUrl, options = {}) {
|
|
|
7997
8121
|
}
|
|
7998
8122
|
}
|
|
7999
8123
|
//#endregion
|
|
8000
|
-
export { DEV_PLATFORM_WORKER_TOKEN, PROJECT_SERVER_DEPLOY_STATUS, PROJECT_SERVER_FRAMEWORK_NODE_MODULES, PROJECT_SERVER_FRAMEWORK_ROOT, PROJECT_SERVER_HEALTH, PROJECT_SERVER_IMAGE, PROJECT_SERVER_PORT, PROJECT_SERVER_ROOT, RUNTIME_PING_TIMEOUT_MS, WorkerRuntimeConfigError, buildRuntimeEnv, canPingProjectTarget, defaultHostingPlugin, dockerPlugin, encodeOrgArtifacts, fetchDeployStatus, formatDockerEnv, mintOrgWorkerToken, parseOrgArtifactsFromEnv, pingProject, pingProjectTarget, resolvePlatformWorkerToken, resolveProjectServerImage, resolveRuntimeLaunch, resolveWorkerPlatformUrl, resolveWorkerRuntimeConfig, rewriteLoopbackHost, rewriteLoopbackUrl, verifyOrgWorkerToken, waitForHealth };
|
|
8124
|
+
export { DEV_PLATFORM_WORKER_TOKEN, FORBIDDEN_WORKER_ENV_KEYS, PROJECT_SERVER_DEPLOY_STATUS, PROJECT_SERVER_FRAMEWORK_NODE_MODULES, PROJECT_SERVER_FRAMEWORK_ROOT, PROJECT_SERVER_HEALTH, PROJECT_SERVER_IMAGE, PROJECT_SERVER_PORT, PROJECT_SERVER_ROOT, RUNTIME_PING_TIMEOUT_MS, WorkerRuntimeConfigError, buildRuntimeEnv, canPingProjectTarget, defaultHostingPlugin, dockerPlugin, encodeOrgArtifacts, fetchDeployStatus, formatDockerEnv, mintOrgWorkerToken, parseOrgArtifactsFromEnv, pingProject, pingProjectTarget, resolvePlatformWorkerToken, resolveProjectServerImage, resolveRuntimeLaunch, resolveWorkerPlatformUrl, resolveWorkerRuntimeConfig, rewriteLoopbackHost, rewriteLoopbackUrl, verifyOrgWorkerToken, waitForHealth };
|
|
8001
8125
|
|
|
8002
8126
|
//# sourceMappingURL=index.mjs.map
|