@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 +319 -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 +319 -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,6 +6365,191 @@ 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
|
+
"completed",
|
|
6375
|
+
"failed",
|
|
6376
|
+
"canceled"
|
|
6377
|
+
]);
|
|
6378
|
+
const HistoryRunActorSchema = object({
|
|
6379
|
+
userId: string(),
|
|
6380
|
+
name: string(),
|
|
6381
|
+
avatarUrl: string().nullable().optional()
|
|
6382
|
+
});
|
|
6383
|
+
const HistoryRunUsageLineItemSchema = object({
|
|
6384
|
+
id: string(),
|
|
6385
|
+
label: string(),
|
|
6386
|
+
/** Amount debited from the org's Keystroke balance for this line. */
|
|
6387
|
+
billedUsd: number$1(),
|
|
6388
|
+
/** Provider cost for LLM usage on the org's API key (informational; not billed by Keystroke). */
|
|
6389
|
+
providerCostUsd: number$1().nullable().optional(),
|
|
6390
|
+
keySource: _enum(["byok", "platform"]).nullable().optional()
|
|
6391
|
+
});
|
|
6392
|
+
const HistoryRunUsageSchema = object({
|
|
6393
|
+
runDurationMs: number$1().nullable(),
|
|
6394
|
+
lineItems: array(HistoryRunUsageLineItemSchema),
|
|
6395
|
+
/** Sum of `billedUsd` — what Keystroke charged for this run. */
|
|
6396
|
+
totalBilledUsd: number$1().nullable(),
|
|
6397
|
+
/** Sum of BYOK LLM provider costs (billed externally by the org's provider). */
|
|
6398
|
+
externalProviderCostUsd: number$1().nullable().optional()
|
|
6399
|
+
});
|
|
6400
|
+
const HistoryRunSchema = object({
|
|
6401
|
+
id: string(),
|
|
6402
|
+
kind: HistoryRunKindSchema,
|
|
6403
|
+
traceId: string().nullable(),
|
|
6404
|
+
projectId: string(),
|
|
6405
|
+
projectName: string(),
|
|
6406
|
+
resourceKey: string(),
|
|
6407
|
+
resourceId: string(),
|
|
6408
|
+
resourceName: string(),
|
|
6409
|
+
status: HistoryRunStatusSchema,
|
|
6410
|
+
triggeredAt: string(),
|
|
6411
|
+
timeInQueueMs: number$1().nullable(),
|
|
6412
|
+
startedAt: string(),
|
|
6413
|
+
finishedAt: string().nullable(),
|
|
6414
|
+
durationMs: number$1().nullable(),
|
|
6415
|
+
triggerLabel: string(),
|
|
6416
|
+
triggerRaw: string(),
|
|
6417
|
+
ranAs: HistoryRunActorSchema.nullable(),
|
|
6418
|
+
modelsUsed: array(string()),
|
|
6419
|
+
otherServicesUsed: array(string()),
|
|
6420
|
+
totalCostUsd: number$1().nullable(),
|
|
6421
|
+
messageCount: number$1().optional(),
|
|
6422
|
+
stepCount: number$1().optional()
|
|
6423
|
+
});
|
|
6424
|
+
const HistoryTraceSpanSchema = object({
|
|
6425
|
+
id: string(),
|
|
6426
|
+
traceId: string(),
|
|
6427
|
+
parentSpanId: string().nullable(),
|
|
6428
|
+
kind: string(),
|
|
6429
|
+
refId: string(),
|
|
6430
|
+
name: string(),
|
|
6431
|
+
status: string(),
|
|
6432
|
+
startedAt: string(),
|
|
6433
|
+
finishedAt: string().nullable(),
|
|
6434
|
+
metadata: unknown().nullable(),
|
|
6435
|
+
error: unknown().nullable()
|
|
6436
|
+
});
|
|
6437
|
+
const HistoryTraceLogSchema = object({
|
|
6438
|
+
id: string(),
|
|
6439
|
+
traceId: string(),
|
|
6440
|
+
spanId: string(),
|
|
6441
|
+
seq: number$1(),
|
|
6442
|
+
level: string(),
|
|
6443
|
+
message: string(),
|
|
6444
|
+
data: unknown().nullable(),
|
|
6445
|
+
source: string(),
|
|
6446
|
+
createdAt: string()
|
|
6447
|
+
});
|
|
6448
|
+
const HistoryTraceTriggerSchema = object({
|
|
6449
|
+
triggerType: string(),
|
|
6450
|
+
triggerRunId: string(),
|
|
6451
|
+
workflowKey: string().optional(),
|
|
6452
|
+
agentKey: string().optional(),
|
|
6453
|
+
attachmentId: string().nullable().optional(),
|
|
6454
|
+
attachmentSlug: string().nullable().optional(),
|
|
6455
|
+
route: string().optional(),
|
|
6456
|
+
sourcePath: string().nullable().optional()
|
|
6457
|
+
}).nullable();
|
|
6458
|
+
const HistoryTraceGatewaySchema = object({
|
|
6459
|
+
gatewayAttachmentId: string(),
|
|
6460
|
+
gatewayAttachmentKey: string(),
|
|
6461
|
+
threadId: string().optional(),
|
|
6462
|
+
channelId: string().optional(),
|
|
6463
|
+
mode: string().optional()
|
|
6464
|
+
}).nullable();
|
|
6465
|
+
const HistoryTraceSchema = object({
|
|
6466
|
+
traceId: string(),
|
|
6467
|
+
trigger: HistoryTraceTriggerSchema,
|
|
6468
|
+
gateway: HistoryTraceGatewaySchema,
|
|
6469
|
+
spans: array(HistoryTraceSpanSchema),
|
|
6470
|
+
logs: array(HistoryTraceLogSchema)
|
|
6471
|
+
});
|
|
6472
|
+
const HistoryWorkflowStepSchema = object({
|
|
6473
|
+
id: string(),
|
|
6474
|
+
actionKey: string(),
|
|
6475
|
+
output: unknown(),
|
|
6476
|
+
completedAt: string()
|
|
6477
|
+
});
|
|
6478
|
+
const HistoryWorkflowRunDetailSchema = object({
|
|
6479
|
+
kind: literal("workflow"),
|
|
6480
|
+
run: object({
|
|
6481
|
+
id: string(),
|
|
6482
|
+
workflowKey: string(),
|
|
6483
|
+
status: HistoryRunStatusSchema,
|
|
6484
|
+
trigger: string(),
|
|
6485
|
+
triggeredAt: string(),
|
|
6486
|
+
startedAt: string().nullable(),
|
|
6487
|
+
finishedAt: string().nullable(),
|
|
6488
|
+
input: unknown().nullable(),
|
|
6489
|
+
output: unknown().nullable(),
|
|
6490
|
+
error: unknown().nullable()
|
|
6491
|
+
}),
|
|
6492
|
+
trigger: object({
|
|
6493
|
+
id: string(),
|
|
6494
|
+
attachmentSlug: string().nullable(),
|
|
6495
|
+
triggerType: string(),
|
|
6496
|
+
sourcePath: string().nullable(),
|
|
6497
|
+
payload: unknown().nullable(),
|
|
6498
|
+
triggeredAt: string()
|
|
6499
|
+
}).nullable(),
|
|
6500
|
+
steps: array(HistoryWorkflowStepSchema),
|
|
6501
|
+
trace: HistoryTraceSchema.nullable(),
|
|
6502
|
+
ranAs: HistoryRunActorSchema.nullable().optional(),
|
|
6503
|
+
usage: HistoryRunUsageSchema.nullable().optional()
|
|
6504
|
+
});
|
|
6505
|
+
const HistoryAgentCompactionEventSchema = object({
|
|
6506
|
+
seq: number$1(),
|
|
6507
|
+
createdAt: string(),
|
|
6508
|
+
compactionModel: string(),
|
|
6509
|
+
sourceModel: string(),
|
|
6510
|
+
estimatedBeforeTokens: number$1().optional(),
|
|
6511
|
+
retainedTailEstimate: number$1().optional(),
|
|
6512
|
+
durable: boolean()
|
|
6513
|
+
});
|
|
6514
|
+
const HistoryRunDetailSchema = discriminatedUnion("kind", [HistoryWorkflowRunDetailSchema, object({
|
|
6515
|
+
kind: literal("agent"),
|
|
6516
|
+
runId: string(),
|
|
6517
|
+
session: object({
|
|
6518
|
+
id: string(),
|
|
6519
|
+
agentKey: string(),
|
|
6520
|
+
status: HistoryRunStatusSchema,
|
|
6521
|
+
source: _enum([
|
|
6522
|
+
"api",
|
|
6523
|
+
"gateway",
|
|
6524
|
+
"trigger",
|
|
6525
|
+
"workflow",
|
|
6526
|
+
"agent"
|
|
6527
|
+
]),
|
|
6528
|
+
sourceId: string().nullable(),
|
|
6529
|
+
createdAt: string(),
|
|
6530
|
+
updatedAt: string(),
|
|
6531
|
+
messageCount: number$1(),
|
|
6532
|
+
error: unknown().nullable()
|
|
6533
|
+
}),
|
|
6534
|
+
gateway: object({
|
|
6535
|
+
threadId: string(),
|
|
6536
|
+
attachmentSlug: string().nullable()
|
|
6537
|
+
}).nullable(),
|
|
6538
|
+
messages: array(record(string(), unknown())),
|
|
6539
|
+
/** Sanitized context-compaction markers for the conversation timeline. */
|
|
6540
|
+
compactionEvents: array(HistoryAgentCompactionEventSchema).default([]),
|
|
6541
|
+
trace: HistoryTraceSchema.nullable(),
|
|
6542
|
+
ranAs: HistoryRunActorSchema.nullable().optional(),
|
|
6543
|
+
usage: HistoryRunUsageSchema.nullable().optional()
|
|
6544
|
+
})]);
|
|
6545
|
+
object({
|
|
6546
|
+
project: string().min(1).optional(),
|
|
6547
|
+
status: HistoryRunStatusSchema.optional(),
|
|
6548
|
+
kind: HistoryRunKindSchema.optional(),
|
|
6549
|
+
limit: number().int().min(1).max(200).optional()
|
|
6550
|
+
});
|
|
6551
|
+
HistoryRunDetailSchema.nullable();
|
|
6552
|
+
HistoryRunSchema.nullable();
|
|
6299
6553
|
const WorkflowRunStatusSchema = _enum([
|
|
6300
6554
|
"pending",
|
|
6301
6555
|
"running",
|
|
@@ -6477,6 +6731,7 @@ const AgentSessionRecordSchema = object({
|
|
|
6477
6731
|
status: AgentSessionStatusSchema,
|
|
6478
6732
|
source: RunSourceKindSchema,
|
|
6479
6733
|
sourceId: string().nullable(),
|
|
6734
|
+
title: string().nullable(),
|
|
6480
6735
|
createdAt: string(),
|
|
6481
6736
|
updatedAt: string(),
|
|
6482
6737
|
parentSpanId: string().nullable(),
|
|
@@ -6515,17 +6770,18 @@ const AgentEventSchema = object({
|
|
|
6515
6770
|
});
|
|
6516
6771
|
object({
|
|
6517
6772
|
session: AgentSessionRecordSchema,
|
|
6773
|
+
activeRunId: string().nullable().default(null),
|
|
6518
6774
|
gateway: GatewaySessionDetailSchema.nullable(),
|
|
6519
6775
|
messages: array(record(string(), unknown())),
|
|
6520
6776
|
events: array(AgentEventSchema),
|
|
6777
|
+
/**
|
|
6778
|
+
* Sanitized context-compaction markers, populated alongside `messages`.
|
|
6779
|
+
* A cheap indexed lookup (session_id + event_type) — never the full event
|
|
6780
|
+
* log. Defaulted so older servers remain compatible.
|
|
6781
|
+
*/
|
|
6782
|
+
compactionEvents: array(HistoryAgentCompactionEventSchema).default([]),
|
|
6521
6783
|
trace: TraceResponseSchema.nullable()
|
|
6522
6784
|
});
|
|
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
6785
|
const SlackGatewayModeSchema = _enum([
|
|
6530
6786
|
"mention",
|
|
6531
6787
|
"channel",
|
|
@@ -6560,179 +6816,6 @@ object({ agents: array(object({
|
|
|
6560
6816
|
name: string().optional(),
|
|
6561
6817
|
route: string()
|
|
6562
6818
|
})) });
|
|
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
6819
|
object({ subscriptions: array(object({
|
|
6737
6820
|
id: string(),
|
|
6738
6821
|
workflowKey: string(),
|
|
@@ -6827,7 +6910,8 @@ const TriggerRunRecordSchema = object({
|
|
|
6827
6910
|
object({
|
|
6828
6911
|
limit: number().int().min(1).max(100).optional().default(20),
|
|
6829
6912
|
cursor: string().min(1).optional(),
|
|
6830
|
-
triggerType: TriggerRunTypeSchema.optional()
|
|
6913
|
+
triggerType: TriggerRunTypeSchema.optional(),
|
|
6914
|
+
outcome: TriggerRunOutcomeSchema.optional()
|
|
6831
6915
|
});
|
|
6832
6916
|
object({
|
|
6833
6917
|
items: array(TriggerRunSummarySchema),
|
|
@@ -6895,7 +6979,8 @@ const WorkspaceTriggerRunStatusSchema = _enum([
|
|
|
6895
6979
|
const WorkspaceTriggerSkipReasonSchema = _enum([
|
|
6896
6980
|
"filtered",
|
|
6897
6981
|
"no_new_data",
|
|
6898
|
-
"transform_undefined"
|
|
6982
|
+
"transform_undefined",
|
|
6983
|
+
"payload_mismatch"
|
|
6899
6984
|
]);
|
|
6900
6985
|
/**
|
|
6901
6986
|
* A single downstream run/session a dispatched fire produced. A fan-out fire can
|
|
@@ -6926,7 +7011,9 @@ const WorkspaceTriggerRunOutcomeSchema = discriminatedUnion("kind", [
|
|
|
6926
7011
|
}),
|
|
6927
7012
|
object({
|
|
6928
7013
|
kind: literal("skipped"),
|
|
6929
|
-
reason: WorkspaceTriggerSkipReasonSchema
|
|
7014
|
+
reason: WorkspaceTriggerSkipReasonSchema,
|
|
7015
|
+
/** One-line Zod issue summary when reason is payload_mismatch. */
|
|
7016
|
+
detail: string().nullable().optional()
|
|
6930
7017
|
}),
|
|
6931
7018
|
object({
|
|
6932
7019
|
kind: literal("failed"),
|
|
@@ -6999,6 +7086,30 @@ object({
|
|
|
6999
7086
|
input: TriggerOverviewInputSchema
|
|
7000
7087
|
});
|
|
7001
7088
|
object({ enabled: boolean() });
|
|
7089
|
+
object({
|
|
7090
|
+
input: unknown().optional(),
|
|
7091
|
+
workflow: string().min(1).optional(),
|
|
7092
|
+
agent: string().min(1).optional()
|
|
7093
|
+
});
|
|
7094
|
+
object({ runId: string().min(1) });
|
|
7095
|
+
object({
|
|
7096
|
+
type: TriggerTypeSchema,
|
|
7097
|
+
attachments: array(object({
|
|
7098
|
+
attachmentSlug: string().min(1),
|
|
7099
|
+
kind: TriggerTargetKindSchema,
|
|
7100
|
+
targetSlug: string().min(1),
|
|
7101
|
+
targetName: string().min(1),
|
|
7102
|
+
enabled: boolean(),
|
|
7103
|
+
/** Webhook attachment JSON Schema used to drive the invoke form. */
|
|
7104
|
+
requestSchema: record(string(), unknown()).optional()
|
|
7105
|
+
})),
|
|
7106
|
+
/** Cron source static payload — display only; never overridden on invoke. */
|
|
7107
|
+
staticPayload: unknown().optional()
|
|
7108
|
+
});
|
|
7109
|
+
object({
|
|
7110
|
+
manual: literal(true),
|
|
7111
|
+
attachments: array(string().min(1)).optional()
|
|
7112
|
+
});
|
|
7002
7113
|
const OrganizationMemberRoleSchema = _enum([
|
|
7003
7114
|
"owner",
|
|
7004
7115
|
"admin",
|
|
@@ -7012,7 +7123,7 @@ const OrganizationMemberStatusSchema = _enum([
|
|
|
7012
7123
|
]);
|
|
7013
7124
|
const InvitableOrganizationMemberRoleSchema = _enum(["admin", "builder"]);
|
|
7014
7125
|
const isoDateTime$5 = string().datetime();
|
|
7015
|
-
object({
|
|
7126
|
+
const OrganizationMemberSchema = object({
|
|
7016
7127
|
id: string(),
|
|
7017
7128
|
name: string(),
|
|
7018
7129
|
email: string().email(),
|
|
@@ -7022,6 +7133,14 @@ object({
|
|
|
7022
7133
|
joinedAt: isoDateTime$5.optional(),
|
|
7023
7134
|
lastActiveAt: isoDateTime$5.nullable().optional()
|
|
7024
7135
|
});
|
|
7136
|
+
object({
|
|
7137
|
+
limit: number().int().min(1).max(200).optional(),
|
|
7138
|
+
cursor: string().min(1).optional()
|
|
7139
|
+
});
|
|
7140
|
+
object({
|
|
7141
|
+
items: array(OrganizationMemberSchema),
|
|
7142
|
+
nextCursor: string().nullable()
|
|
7143
|
+
});
|
|
7025
7144
|
object({
|
|
7026
7145
|
emails: array(string().trim().email()).min(1),
|
|
7027
7146
|
role: InvitableOrganizationMemberRoleSchema
|
|
@@ -7140,14 +7259,6 @@ object({
|
|
|
7140
7259
|
uploadUrl: url(),
|
|
7141
7260
|
storageKey: string().min(1)
|
|
7142
7261
|
});
|
|
7143
|
-
function isValidIanaTimezone(value) {
|
|
7144
|
-
try {
|
|
7145
|
-
Intl.DateTimeFormat(void 0, { timeZone: value });
|
|
7146
|
-
return true;
|
|
7147
|
-
} catch {
|
|
7148
|
-
return false;
|
|
7149
|
-
}
|
|
7150
|
-
}
|
|
7151
7262
|
const UserInterfaceThemeSchema = _enum([
|
|
7152
7263
|
"system",
|
|
7153
7264
|
"light",
|
|
@@ -7692,8 +7803,8 @@ function verifyOrgWorkerToken(secret, token) {
|
|
|
7692
7803
|
}
|
|
7693
7804
|
//#endregion
|
|
7694
7805
|
//#region src/runtime-env.ts
|
|
7806
|
+
/** Non-secret runtime config forwarded into org workers. Never include platform secrets. */
|
|
7695
7807
|
const RUNTIME_ENV_KEYS = [
|
|
7696
|
-
"BETTER_AUTH_SECRET",
|
|
7697
7808
|
"PUBLIC_PLATFORM_URL",
|
|
7698
7809
|
"PUBLIC_PLATFORM_PROXY_URL",
|
|
7699
7810
|
"PUBLIC_WEB_URL",
|
|
@@ -7701,6 +7812,15 @@ const RUNTIME_ENV_KEYS = [
|
|
|
7701
7812
|
"REDIS_URL",
|
|
7702
7813
|
"KEYSTROKE_QUEUE_PREFIX"
|
|
7703
7814
|
];
|
|
7815
|
+
/** Env keys that must never be forwarded into untrusted org workers. */
|
|
7816
|
+
const FORBIDDEN_WORKER_ENV_KEYS = [
|
|
7817
|
+
"BETTER_AUTH_SECRET",
|
|
7818
|
+
"DATABASE_URL",
|
|
7819
|
+
"POSTGRES_PASSWORD",
|
|
7820
|
+
"PLATFORM_WORKER_TOKEN",
|
|
7821
|
+
"STRIPE_SECRET_KEY",
|
|
7822
|
+
"CREDENTIAL_ENCRYPTION_KEY"
|
|
7823
|
+
];
|
|
7704
7824
|
/** Provider and gateway env forwarded from the platform into project servers. */
|
|
7705
7825
|
const PROVIDER_ENV_KEYS = [
|
|
7706
7826
|
"ANTHROPIC_API_KEY",
|
|
@@ -7747,6 +7867,7 @@ function buildRuntimeEnv(source, artifacts, database, extraEnv) {
|
|
|
7747
7867
|
entries.set("PLATFORM_URL", worker.platformUrl);
|
|
7748
7868
|
entries.set("WORKER_INTERNAL_TOKEN", mintOrgWorkerToken(worker.workerToken, database.organizationId));
|
|
7749
7869
|
if (extraEnv) for (const [key, value] of Object.entries(extraEnv)) entries.set(key, value);
|
|
7870
|
+
for (const key of FORBIDDEN_WORKER_ENV_KEYS) entries.delete(key);
|
|
7750
7871
|
return Object.fromEntries(entries);
|
|
7751
7872
|
}
|
|
7752
7873
|
function resolvePlatformWorkerToken(source = process.env) {
|
|
@@ -7997,6 +8118,6 @@ async function fetchDeployStatus(baseUrl, options = {}) {
|
|
|
7997
8118
|
}
|
|
7998
8119
|
}
|
|
7999
8120
|
//#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 };
|
|
8121
|
+
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
8122
|
|
|
8002
8123
|
//# sourceMappingURL=index.mjs.map
|