@keystrokehq/cli 0.0.138 → 0.0.139
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/{dist-CqVk9JsS.mjs → dist-B27Z3YpE.mjs} +171 -3
- package/dist/dist-B27Z3YpE.mjs.map +1 -0
- package/dist/{dist-QMg0gSzo.mjs → dist-CSolAKQe.mjs} +2 -2
- package/dist/{dist-QMg0gSzo.mjs.map → dist-CSolAKQe.mjs.map} +1 -1
- package/dist/{dist-CmCvzhNH.mjs → dist-Efdscyea.mjs} +2 -2
- package/dist/{dist-CmCvzhNH.mjs.map → dist-Efdscyea.mjs.map} +1 -1
- package/dist/index.mjs +172 -721
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/dist/dist-CqVk9JsS.mjs.map +0 -1
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { $ as
|
|
2
|
+
import { $ as QueuedRunResponseSchema, A as ListOrganizationInvitationsResponseSchema, B as PollRunResponseSchema, C as HealthResponseSchema, Ct as listenPortFromPublicUrl, D as HistoryRunListResponseSchema, E as HistoryRunListQuerySchema, Et as parseErrorResponse, F as ListProjectMetricsResponseSchema, G as PresignUserAvatarRequestSchema, H as PresignOrgLogoResponseSchema, I as ListProjectsResponseSchema, J as ProjectResponseSchema, K as PresignUserAvatarResponseSchema, L as OrganizationSidebarBrandingPatchSchema, M as ListOrganizationsResponseSchema, N as ListProjectDeploymentsResponseSchema, O as InviteOrganizationMembersRequestSchema, P as ListProjectFilesResponseSchema, Q as QueuedAgentPromptResponseSchema, R as OrganizationSidebarBrandingSchema, S as GatewayAttachmentRecordSchema, St as WorkflowSummaryListResponseSchema, T as HistoryRunDetailResponseSchema, Tt as originFromPublicUrl, U as PresignProjectSourceRequestSchema, V as PresignOrgLogoRequestSchema, W as PresignProjectSourceResponseSchema, X as PromptInputSchema, Y as ProjectSlugAvailabilityResponseSchema, Z as PromptResponseSchema, _ as CreateProjectResponseSchema, _t as UserAvatarPatchSchema, a as AgentSessionDetailResponseSchema, at as TriggerDetailResponseSchema, b as DeclineOrganizationInvitationResponseSchema, bt as WorkflowRunListResponseSchema, c as AgentSummaryListResponseSchema, ct as TriggerRunListResponseSchema, d as ConnectProvidersResponseSchema, dt as UpdateOrganizationMemberResponseSchema, et as ROUTE_MANIFEST_REL_PATH, f as CreateCredentialInstanceBodySchema, ft as UpdateOrganizationRequestSchema, g as CreateProjectRequestSchema, gt as UpsertGatewayAttachmentBodySchema, h as CreateProjectArtifactResponseSchema, ht as UploadProjectSourceResponseSchema, i as AgentListResponseSchema, it as SlugAvailabilityResponseSchema, j as ListOrganizationMembersResponseSchema, k as InviteOrganizationMembersResponseSchema, l as CompleteProjectArtifactResponseSchema, lt as UpdateCredentialInstanceBodySchema, m as CreateOrganizationResponseSchema, mt as UploadProjectSourceManifestRequestSchema, n as AcceptOrganizationInvitationResponseSchema, nt as SkillSummaryDetailResponseSchema, o as AgentSessionListResponseSchema, ot as TriggerListResponseSchema, p as CreateOrganizationRequestSchema, pt as UpdateProjectRequestSchema, q as ProjectReachabilityResponseSchema, r as ActiveOrganizationResponseSchema, rt as SkillSummaryListResponseSchema, s as AgentSummaryDetailResponseSchema, st as TriggerRunDetailResponseSchema, t as ACTIVE_ORG_HEADER, tt as RecentResourceListResponseSchema, u as ConnectAuthorizeUrlResponseSchema, ut as UpdateOrganizationMemberRequestSchema, v as CredentialInstanceListResponseSchema, vt as UserAvatarSchema, w as HistoryRunCancelResponseSchema, x as ErrorResponseSchema, xt as WorkflowSummaryDetailResponseSchema, y as CredentialInstanceRecordSchema, yt as WorkflowRunDetailResponseSchema, z as PROJECT_REACHABILITY_REQUEST_TIMEOUT_MS } from "./dist-B27Z3YpE.mjs";
|
|
3
3
|
import { t as walkProject } from "./walk-project-171B4cvO-DJy3qZKd.mjs";
|
|
4
4
|
import { a as installPlaygroundDependencies, i as installDependencies, n as buildPlaygroundWorkspace, o as resolvePackageManager, s as resolveCliRoot, t as readCliVersion } from "./version-DESgLEkE.mjs";
|
|
5
5
|
import { createRequire } from "node:module";
|
|
@@ -5265,50 +5265,6 @@ const credentialSeed = [
|
|
|
5265
5265
|
ownerName: "Nate Wells"
|
|
5266
5266
|
}
|
|
5267
5267
|
];
|
|
5268
|
-
const agentSeed = [{
|
|
5269
|
-
id: "agent-support",
|
|
5270
|
-
slug: "support-agent",
|
|
5271
|
-
name: "Support Agent",
|
|
5272
|
-
projectId: "project_personal_repo",
|
|
5273
|
-
updatedAt: "2026-06-02T14:20:00Z",
|
|
5274
|
-
description: "Triage support requests and draft helpful replies.",
|
|
5275
|
-
sourcePath: "src/agents/support-agent.ts",
|
|
5276
|
-
model: "claude-4-sonnet",
|
|
5277
|
-
toolCount: 4,
|
|
5278
|
-
credentialCount: 2,
|
|
5279
|
-
lastRunAt: "2026-06-02T14:20:00Z"
|
|
5280
|
-
}, {
|
|
5281
|
-
id: "agent-research",
|
|
5282
|
-
slug: "research-agent",
|
|
5283
|
-
name: "Research Agent",
|
|
5284
|
-
projectId: "project_personal_repo",
|
|
5285
|
-
updatedAt: "2026-06-01T09:15:00Z",
|
|
5286
|
-
description: "Summarize docs and pull answers from connected sources.",
|
|
5287
|
-
sourcePath: "src/agents/research-agent.ts",
|
|
5288
|
-
model: "claude-4-sonnet",
|
|
5289
|
-
toolCount: 6,
|
|
5290
|
-
credentialCount: 3,
|
|
5291
|
-
lastRunAt: "2026-06-01T09:15:00Z"
|
|
5292
|
-
}];
|
|
5293
|
-
const workflowSeed = [{
|
|
5294
|
-
id: "workflow-daily-digest",
|
|
5295
|
-
slug: "daily-digest",
|
|
5296
|
-
name: "Daily Digest",
|
|
5297
|
-
projectId: "project_personal_repo",
|
|
5298
|
-
updatedAt: "2026-06-02T11:05:00Z",
|
|
5299
|
-
description: "Collect project updates and send a daily summary.",
|
|
5300
|
-
sourcePath: "src/workflows/daily-digest.ts",
|
|
5301
|
-
lastRunAt: "2026-06-02T11:05:00Z"
|
|
5302
|
-
}, {
|
|
5303
|
-
id: "workflow-email-triage",
|
|
5304
|
-
slug: "email-triage",
|
|
5305
|
-
name: "Email Triage",
|
|
5306
|
-
projectId: "project_personal_repo",
|
|
5307
|
-
updatedAt: "2026-05-31T16:40:00Z",
|
|
5308
|
-
description: "Label, prioritize, and draft replies for inbound email.",
|
|
5309
|
-
sourcePath: "src/workflows/email-triage.ts",
|
|
5310
|
-
lastRunAt: "2026-05-31T16:40:00Z"
|
|
5311
|
-
}];
|
|
5312
5268
|
/** Review personas for mocked project members and API key authors (not org membership). */
|
|
5313
5269
|
const mockPersonaSeed = [
|
|
5314
5270
|
{
|
|
@@ -5587,616 +5543,45 @@ function createApiKeysResource() {
|
|
|
5587
5543
|
})
|
|
5588
5544
|
};
|
|
5589
5545
|
}
|
|
5590
|
-
|
|
5591
|
-
const MOCK_ACTOR = {
|
|
5592
|
-
userId: "user_blake",
|
|
5593
|
-
name: "Blake Rouse",
|
|
5594
|
-
avatarUrl: null
|
|
5595
|
-
};
|
|
5596
|
-
function buildCompletedUsage(durationMs) {
|
|
5546
|
+
function createHistoryResource(http) {
|
|
5597
5547
|
return {
|
|
5598
|
-
|
|
5599
|
-
|
|
5600
|
-
{
|
|
5601
|
-
|
|
5602
|
-
|
|
5603
|
-
|
|
5604
|
-
|
|
5605
|
-
|
|
5606
|
-
|
|
5607
|
-
|
|
5608
|
-
|
|
5609
|
-
}
|
|
5610
|
-
|
|
5611
|
-
id: "daytona",
|
|
5612
|
-
label: "Daytona Sandbox",
|
|
5613
|
-
amountUsd: .188
|
|
5548
|
+
/** Runs across projects the current user can access in the active org. */
|
|
5549
|
+
async list(filters) {
|
|
5550
|
+
try {
|
|
5551
|
+
const parsedFilters = filters ? HistoryRunListQuerySchema.parse(filters) : void 0;
|
|
5552
|
+
const searchParams = new URLSearchParams();
|
|
5553
|
+
if (parsedFilters?.project) searchParams.set("project", parsedFilters.project);
|
|
5554
|
+
if (parsedFilters?.status) searchParams.set("status", parsedFilters.status);
|
|
5555
|
+
if (parsedFilters?.kind) searchParams.set("kind", parsedFilters.kind);
|
|
5556
|
+
const query = searchParams.toString();
|
|
5557
|
+
const data = await http.get(query ? `api/history?${query}` : "api/history").json();
|
|
5558
|
+
return HistoryRunListResponseSchema.parse(data);
|
|
5559
|
+
} catch (error) {
|
|
5560
|
+
throw await toPlatformError(error);
|
|
5614
5561
|
}
|
|
5615
|
-
],
|
|
5616
|
-
totalExcludingDurationUsd: .603
|
|
5617
|
-
};
|
|
5618
|
-
}
|
|
5619
|
-
function buildRunningUsage() {
|
|
5620
|
-
return {
|
|
5621
|
-
runDurationMs: null,
|
|
5622
|
-
lineItems: [],
|
|
5623
|
-
totalExcludingDurationUsd: null
|
|
5624
|
-
};
|
|
5625
|
-
}
|
|
5626
|
-
function buildFailedUsage(durationMs) {
|
|
5627
|
-
if (durationMs == null) return {
|
|
5628
|
-
runDurationMs: null,
|
|
5629
|
-
lineItems: [],
|
|
5630
|
-
totalExcludingDurationUsd: null
|
|
5631
|
-
};
|
|
5632
|
-
return {
|
|
5633
|
-
runDurationMs: durationMs,
|
|
5634
|
-
lineItems: [{
|
|
5635
|
-
id: "claude-opus",
|
|
5636
|
-
label: "Claude Opus 4.8",
|
|
5637
|
-
amountUsd: .021
|
|
5638
|
-
}],
|
|
5639
|
-
totalExcludingDurationUsd: .021
|
|
5640
|
-
};
|
|
5641
|
-
}
|
|
5642
|
-
function workflowSlugFromId(workflowId) {
|
|
5643
|
-
return workflowSeed.find((workflow) => workflow.id === workflowId)?.slug ?? workflowId;
|
|
5644
|
-
}
|
|
5645
|
-
function agentSlugFromId(agentId) {
|
|
5646
|
-
return agentSeed.find((agent) => agent.id === agentId)?.slug ?? agentId;
|
|
5647
|
-
}
|
|
5648
|
-
const historyRunSeed = [
|
|
5649
|
-
{
|
|
5650
|
-
id: "run-support-agent-001",
|
|
5651
|
-
kind: "agent",
|
|
5652
|
-
traceId: "run-support-agent-001",
|
|
5653
|
-
projectId: "project_personal_repo",
|
|
5654
|
-
projectName: historyProjectNameById.project_personal_repo ?? "Project",
|
|
5655
|
-
resourceKey: agentSlugFromId("agent-support"),
|
|
5656
|
-
resourceId: "agent-support",
|
|
5657
|
-
resourceName: "Support Agent",
|
|
5658
|
-
status: "completed",
|
|
5659
|
-
triggeredAt: "2026-04-20T15:44:00Z",
|
|
5660
|
-
timeInQueueMs: 85,
|
|
5661
|
-
startedAt: "2026-04-20T15:44:00Z",
|
|
5662
|
-
finishedAt: "2026-04-20T15:44:42Z",
|
|
5663
|
-
durationMs: 42e3,
|
|
5664
|
-
triggerLabel: "Gateway",
|
|
5665
|
-
triggerRaw: "gateway",
|
|
5666
|
-
ranAs: MOCK_ACTOR,
|
|
5667
|
-
modelsUsed: ["Claude Opus 4.8", "Gemini Flash 3.5"],
|
|
5668
|
-
otherServicesUsed: ["Slack", "Daytona Sandbox"],
|
|
5669
|
-
totalCostUsd: .603,
|
|
5670
|
-
messageCount: 8
|
|
5671
|
-
},
|
|
5672
|
-
{
|
|
5673
|
-
id: "run-daily-digest-001",
|
|
5674
|
-
kind: "workflow",
|
|
5675
|
-
traceId: "run-daily-digest-001",
|
|
5676
|
-
projectId: "project_personal_repo",
|
|
5677
|
-
projectName: historyProjectNameById.project_personal_repo ?? "Project",
|
|
5678
|
-
resourceKey: workflowSlugFromId("workflow-daily-digest"),
|
|
5679
|
-
resourceId: "workflow-daily-digest",
|
|
5680
|
-
resourceName: "Daily Digest",
|
|
5681
|
-
status: "running",
|
|
5682
|
-
triggeredAt: "2026-04-20T15:12:00Z",
|
|
5683
|
-
timeInQueueMs: null,
|
|
5684
|
-
startedAt: "2026-04-20T15:12:00Z",
|
|
5685
|
-
finishedAt: null,
|
|
5686
|
-
durationMs: null,
|
|
5687
|
-
triggerLabel: "Cron",
|
|
5688
|
-
triggerRaw: "cron",
|
|
5689
|
-
ranAs: MOCK_ACTOR,
|
|
5690
|
-
modelsUsed: [],
|
|
5691
|
-
otherServicesUsed: [],
|
|
5692
|
-
totalCostUsd: null,
|
|
5693
|
-
stepCount: 1
|
|
5694
|
-
},
|
|
5695
|
-
{
|
|
5696
|
-
id: "run-support-agent-000",
|
|
5697
|
-
kind: "agent",
|
|
5698
|
-
traceId: "run-support-agent-000",
|
|
5699
|
-
projectId: "project_personal_repo",
|
|
5700
|
-
projectName: historyProjectNameById.project_personal_repo ?? "Project",
|
|
5701
|
-
resourceKey: agentSlugFromId("agent-support"),
|
|
5702
|
-
resourceId: "agent-support",
|
|
5703
|
-
resourceName: "Support Agent",
|
|
5704
|
-
status: "failed",
|
|
5705
|
-
triggeredAt: "2026-04-19T18:22:00Z",
|
|
5706
|
-
timeInQueueMs: 45,
|
|
5707
|
-
startedAt: "2026-04-19T18:22:00Z",
|
|
5708
|
-
finishedAt: "2026-04-19T18:22:12Z",
|
|
5709
|
-
durationMs: 12e3,
|
|
5710
|
-
triggerLabel: "Gateway",
|
|
5711
|
-
triggerRaw: "gateway",
|
|
5712
|
-
ranAs: MOCK_ACTOR,
|
|
5713
|
-
modelsUsed: ["Claude Opus 4.8"],
|
|
5714
|
-
otherServicesUsed: ["Slack"],
|
|
5715
|
-
totalCostUsd: .021,
|
|
5716
|
-
messageCount: 2
|
|
5717
|
-
},
|
|
5718
|
-
{
|
|
5719
|
-
id: "run-email-triage-002",
|
|
5720
|
-
kind: "workflow",
|
|
5721
|
-
traceId: "run-email-triage-002",
|
|
5722
|
-
projectId: "project_personal_repo",
|
|
5723
|
-
projectName: historyProjectNameById.project_personal_repo ?? "Project",
|
|
5724
|
-
resourceKey: workflowSlugFromId("workflow-email-triage"),
|
|
5725
|
-
resourceId: "workflow-email-triage",
|
|
5726
|
-
resourceName: "Email Triage",
|
|
5727
|
-
status: "failed",
|
|
5728
|
-
triggeredAt: "2026-05-31T16:40:05Z",
|
|
5729
|
-
timeInQueueMs: 120,
|
|
5730
|
-
startedAt: "2026-05-31T16:40:05Z",
|
|
5731
|
-
finishedAt: "2026-05-31T16:40:18Z",
|
|
5732
|
-
durationMs: 13e3,
|
|
5733
|
-
triggerLabel: "Webhook",
|
|
5734
|
-
triggerRaw: "webhook",
|
|
5735
|
-
ranAs: MOCK_ACTOR,
|
|
5736
|
-
modelsUsed: ["Claude Opus 4.8"],
|
|
5737
|
-
otherServicesUsed: ["Gmail"],
|
|
5738
|
-
totalCostUsd: .021,
|
|
5739
|
-
stepCount: 2
|
|
5740
|
-
},
|
|
5741
|
-
{
|
|
5742
|
-
id: "run-research-agent-003",
|
|
5743
|
-
kind: "agent",
|
|
5744
|
-
traceId: "run-research-agent-003",
|
|
5745
|
-
projectId: "project_personal_repo",
|
|
5746
|
-
projectName: historyProjectNameById.project_personal_repo ?? "Project",
|
|
5747
|
-
resourceKey: agentSlugFromId("agent-research"),
|
|
5748
|
-
resourceId: "agent-research",
|
|
5749
|
-
resourceName: "Research Agent",
|
|
5750
|
-
status: "completed",
|
|
5751
|
-
triggeredAt: "2026-06-01T09:15:00Z",
|
|
5752
|
-
timeInQueueMs: 210,
|
|
5753
|
-
startedAt: "2026-06-01T09:15:00Z",
|
|
5754
|
-
finishedAt: "2026-06-01T09:16:24Z",
|
|
5755
|
-
durationMs: 84e3,
|
|
5756
|
-
triggerLabel: "API",
|
|
5757
|
-
triggerRaw: "api",
|
|
5758
|
-
ranAs: MOCK_ACTOR,
|
|
5759
|
-
modelsUsed: ["Claude Opus 4.8"],
|
|
5760
|
-
otherServicesUsed: ["Exa"],
|
|
5761
|
-
totalCostUsd: .603,
|
|
5762
|
-
messageCount: 12
|
|
5763
|
-
}
|
|
5764
|
-
];
|
|
5765
|
-
const historyRunById = Object.fromEntries(historyRunSeed.map((run) => [run.id, run]));
|
|
5766
|
-
/** Resolve a seed run by id so fixtures stay consistent if the seed is reordered. */
|
|
5767
|
-
function runById(id) {
|
|
5768
|
-
const run = historyRunById[id];
|
|
5769
|
-
if (!run) throw new Error(`Unknown history run: ${id}`);
|
|
5770
|
-
return run;
|
|
5771
|
-
}
|
|
5772
|
-
let historyRuns = historyRunSeed.map((run) => ({ ...run }));
|
|
5773
|
-
const historyRunStatusOverrides = /* @__PURE__ */ new Map();
|
|
5774
|
-
function listHistoryRuns() {
|
|
5775
|
-
return historyRuns;
|
|
5776
|
-
}
|
|
5777
|
-
/**
|
|
5778
|
-
* Cancel a running/queued run. Terminal runs are returned unchanged. Updates the
|
|
5779
|
-
* list row and records an override so {@link getHistoryRunDetail} stays in sync.
|
|
5780
|
-
*/
|
|
5781
|
-
function cancelHistoryRun(runId) {
|
|
5782
|
-
const run = historyRuns.find((entry) => entry.id === runId);
|
|
5783
|
-
if (!run) return null;
|
|
5784
|
-
if (run.status !== "running" && run.status !== "pending") return run;
|
|
5785
|
-
const finishedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
5786
|
-
const durationMs = run.startedAt ? Math.max(0, new Date(finishedAt).getTime() - new Date(run.startedAt).getTime()) : run.durationMs;
|
|
5787
|
-
const canceled = {
|
|
5788
|
-
...run,
|
|
5789
|
-
status: "canceled",
|
|
5790
|
-
finishedAt,
|
|
5791
|
-
durationMs
|
|
5792
|
-
};
|
|
5793
|
-
historyRuns = historyRuns.map((entry) => entry.id === runId ? canceled : entry);
|
|
5794
|
-
historyRunStatusOverrides.set(runId, {
|
|
5795
|
-
status: "canceled",
|
|
5796
|
-
finishedAt
|
|
5797
|
-
});
|
|
5798
|
-
return canceled;
|
|
5799
|
-
}
|
|
5800
|
-
function buildSupportAgentTrace(runId, failed) {
|
|
5801
|
-
const run = runById(runId);
|
|
5802
|
-
const startedAt = run.startedAt;
|
|
5803
|
-
const finishedAt = run.finishedAt ?? run.startedAt;
|
|
5804
|
-
const sessionSpanId = `span-session-${runId}`;
|
|
5805
|
-
return {
|
|
5806
|
-
traceId: runId,
|
|
5807
|
-
trigger: {
|
|
5808
|
-
triggerType: "gateway",
|
|
5809
|
-
triggerRunId: `trigger-${runId}`,
|
|
5810
|
-
agentKey: "support-agent",
|
|
5811
|
-
attachmentId: "attach-slack-incoming",
|
|
5812
|
-
attachmentKey: "slack-incoming",
|
|
5813
|
-
route: "/agents/support-agent",
|
|
5814
|
-
sourcePath: "src/triggers/slack-message.ts"
|
|
5815
|
-
},
|
|
5816
|
-
gateway: {
|
|
5817
|
-
gatewayAttachmentId: "attach-slack-incoming",
|
|
5818
|
-
gatewayAttachmentKey: "slack-incoming",
|
|
5819
|
-
threadId: "C01234567",
|
|
5820
|
-
channelId: "support-escalations",
|
|
5821
|
-
mode: "thread"
|
|
5822
|
-
},
|
|
5823
|
-
spans: [{
|
|
5824
|
-
id: sessionSpanId,
|
|
5825
|
-
traceId: runId,
|
|
5826
|
-
parentSpanId: null,
|
|
5827
|
-
kind: "agent_session",
|
|
5828
|
-
refId: runId,
|
|
5829
|
-
name: "Support Agent",
|
|
5830
|
-
status: failed ? "error" : "ok",
|
|
5831
|
-
startedAt,
|
|
5832
|
-
finishedAt,
|
|
5833
|
-
metadata: { messageCount: failed ? 2 : 8 },
|
|
5834
|
-
error: failed ? { message: "Credential expired" } : null
|
|
5835
|
-
}, {
|
|
5836
|
-
id: `span-tool-${runId}`,
|
|
5837
|
-
traceId: runId,
|
|
5838
|
-
parentSpanId: sessionSpanId,
|
|
5839
|
-
kind: "tool_call",
|
|
5840
|
-
refId: `tool-${runId}`,
|
|
5841
|
-
name: "post_slack_reply",
|
|
5842
|
-
status: failed ? "error" : "ok",
|
|
5843
|
-
startedAt,
|
|
5844
|
-
finishedAt,
|
|
5845
|
-
metadata: null,
|
|
5846
|
-
error: failed ? { message: "oauth_token_expired" } : null
|
|
5847
|
-
}],
|
|
5848
|
-
logs: [{
|
|
5849
|
-
id: `log-${runId}-1`,
|
|
5850
|
-
traceId: runId,
|
|
5851
|
-
spanId: sessionSpanId,
|
|
5852
|
-
seq: 1,
|
|
5853
|
-
level: "info",
|
|
5854
|
-
message: failed ? "Received Slack message" : "Session started from gateway thread",
|
|
5855
|
-
data: null,
|
|
5856
|
-
source: "system",
|
|
5857
|
-
createdAt: startedAt
|
|
5858
|
-
}, {
|
|
5859
|
-
id: `log-${runId}-2`,
|
|
5860
|
-
traceId: runId,
|
|
5861
|
-
spanId: sessionSpanId,
|
|
5862
|
-
seq: 2,
|
|
5863
|
-
level: failed ? "error" : "info",
|
|
5864
|
-
message: failed ? "Credential expired before response could be posted." : "Drafted three support replies.",
|
|
5865
|
-
data: null,
|
|
5866
|
-
source: "system",
|
|
5867
|
-
createdAt: finishedAt
|
|
5868
|
-
}]
|
|
5869
|
-
};
|
|
5870
|
-
}
|
|
5871
|
-
function buildDailyDigestTrace() {
|
|
5872
|
-
return {
|
|
5873
|
-
traceId: "run-daily-digest-001",
|
|
5874
|
-
trigger: {
|
|
5875
|
-
triggerType: "cron",
|
|
5876
|
-
triggerRunId: "trigger-daily-digest-001",
|
|
5877
|
-
workflowKey: "daily-digest",
|
|
5878
|
-
attachmentId: "attach-schedule-daily",
|
|
5879
|
-
attachmentKey: "schedule-daily",
|
|
5880
|
-
route: "/workflows/daily-digest",
|
|
5881
|
-
sourcePath: "src/triggers/daily-digest.ts"
|
|
5882
|
-
},
|
|
5883
|
-
gateway: null,
|
|
5884
|
-
spans: [{
|
|
5885
|
-
id: "span-wf-daily-001",
|
|
5886
|
-
traceId: "run-daily-digest-001",
|
|
5887
|
-
parentSpanId: null,
|
|
5888
|
-
kind: "workflow_run",
|
|
5889
|
-
refId: "run-daily-digest-001",
|
|
5890
|
-
name: "Daily Digest",
|
|
5891
|
-
status: "running",
|
|
5892
|
-
startedAt: "2026-04-20T15:12:00Z",
|
|
5893
|
-
finishedAt: null,
|
|
5894
|
-
metadata: null,
|
|
5895
|
-
error: null
|
|
5896
|
-
}, {
|
|
5897
|
-
id: "span-action-collect",
|
|
5898
|
-
traceId: "run-daily-digest-001",
|
|
5899
|
-
parentSpanId: "span-wf-daily-001",
|
|
5900
|
-
kind: "action",
|
|
5901
|
-
refId: "step-collect",
|
|
5902
|
-
name: "collect_updates",
|
|
5903
|
-
status: "ok",
|
|
5904
|
-
startedAt: "2026-04-20T15:12:02Z",
|
|
5905
|
-
finishedAt: "2026-04-20T15:12:45Z",
|
|
5906
|
-
metadata: {
|
|
5907
|
-
runId: "run-daily-digest-001",
|
|
5908
|
-
actionKey: "collect_updates"
|
|
5909
|
-
},
|
|
5910
|
-
error: null
|
|
5911
|
-
}],
|
|
5912
|
-
logs: [{
|
|
5913
|
-
id: "log-daily-1",
|
|
5914
|
-
traceId: "run-daily-digest-001",
|
|
5915
|
-
spanId: "span-wf-daily-001",
|
|
5916
|
-
seq: 1,
|
|
5917
|
-
level: "info",
|
|
5918
|
-
message: "Cron tick fired",
|
|
5919
|
-
data: null,
|
|
5920
|
-
source: "system",
|
|
5921
|
-
createdAt: "2026-04-20T15:12:00Z"
|
|
5922
|
-
}, {
|
|
5923
|
-
id: "log-daily-2",
|
|
5924
|
-
traceId: "run-daily-digest-001",
|
|
5925
|
-
spanId: "span-wf-daily-001",
|
|
5926
|
-
seq: 2,
|
|
5927
|
-
level: "info",
|
|
5928
|
-
message: "Collecting project updates.",
|
|
5929
|
-
data: null,
|
|
5930
|
-
source: "console",
|
|
5931
|
-
createdAt: "2026-04-20T15:12:46Z"
|
|
5932
|
-
}]
|
|
5933
|
-
};
|
|
5934
|
-
}
|
|
5935
|
-
function buildEmailTriageDetail() {
|
|
5936
|
-
return {
|
|
5937
|
-
kind: "workflow",
|
|
5938
|
-
run: {
|
|
5939
|
-
id: "run-email-triage-002",
|
|
5940
|
-
workflowKey: "email-triage",
|
|
5941
|
-
status: "failed",
|
|
5942
|
-
trigger: "webhook",
|
|
5943
|
-
triggeredAt: "2026-05-31T16:40:05Z",
|
|
5944
|
-
startedAt: "2026-05-31T16:40:05Z",
|
|
5945
|
-
finishedAt: "2026-05-31T16:40:18Z",
|
|
5946
|
-
input: { messageId: "msg_abc123" },
|
|
5947
|
-
output: null,
|
|
5948
|
-
error: { message: "Step classify failed: missing Gmail scope." }
|
|
5949
|
-
},
|
|
5950
|
-
trigger: {
|
|
5951
|
-
id: "trigger-email-002",
|
|
5952
|
-
attachmentKey: "gmail-new-message",
|
|
5953
|
-
triggerType: "webhook",
|
|
5954
|
-
sourcePath: "src/triggers/gmail-new-message.ts",
|
|
5955
|
-
payload: { messageId: "msg_abc123" },
|
|
5956
|
-
triggeredAt: "2026-05-31T16:40:05Z"
|
|
5957
|
-
},
|
|
5958
|
-
steps: [{
|
|
5959
|
-
id: "step-ingest-002",
|
|
5960
|
-
actionKey: "ingest",
|
|
5961
|
-
output: { ok: true },
|
|
5962
|
-
completedAt: "2026-05-31T16:40:10Z"
|
|
5963
|
-
}, {
|
|
5964
|
-
id: "step-classify-002",
|
|
5965
|
-
actionKey: "classify",
|
|
5966
|
-
output: { error: "missing_scope" },
|
|
5967
|
-
completedAt: "2026-05-31T16:40:18Z"
|
|
5968
|
-
}],
|
|
5969
|
-
trace: {
|
|
5970
|
-
traceId: "run-email-triage-002",
|
|
5971
|
-
trigger: {
|
|
5972
|
-
triggerType: "webhook",
|
|
5973
|
-
triggerRunId: "trigger-email-002",
|
|
5974
|
-
workflowKey: "email-triage",
|
|
5975
|
-
attachmentId: "attach-gmail-new-message",
|
|
5976
|
-
attachmentKey: "gmail-new-message",
|
|
5977
|
-
route: "/workflows/email-triage"
|
|
5978
|
-
},
|
|
5979
|
-
gateway: null,
|
|
5980
|
-
spans: [{
|
|
5981
|
-
id: "span-wf-email-002",
|
|
5982
|
-
traceId: "run-email-triage-002",
|
|
5983
|
-
parentSpanId: null,
|
|
5984
|
-
kind: "workflow_run",
|
|
5985
|
-
refId: "run-email-triage-002",
|
|
5986
|
-
name: "Email Triage",
|
|
5987
|
-
status: "error",
|
|
5988
|
-
startedAt: "2026-05-31T16:40:05Z",
|
|
5989
|
-
finishedAt: "2026-05-31T16:40:18Z",
|
|
5990
|
-
metadata: null,
|
|
5991
|
-
error: { message: "Step classify failed" }
|
|
5992
|
-
}],
|
|
5993
|
-
logs: [{
|
|
5994
|
-
id: "log-email-1",
|
|
5995
|
-
traceId: "run-email-triage-002",
|
|
5996
|
-
spanId: "span-wf-email-002",
|
|
5997
|
-
seq: 1,
|
|
5998
|
-
level: "error",
|
|
5999
|
-
message: "Step classify failed: missing Gmail scope.",
|
|
6000
|
-
data: { step: "classify" },
|
|
6001
|
-
source: "system",
|
|
6002
|
-
createdAt: "2026-05-31T16:40:18Z"
|
|
6003
|
-
}]
|
|
6004
5562
|
},
|
|
6005
|
-
|
|
6006
|
-
|
|
6007
|
-
|
|
6008
|
-
|
|
6009
|
-
const
|
|
6010
|
-
|
|
6011
|
-
|
|
6012
|
-
|
|
6013
|
-
|
|
6014
|
-
agentKey: "support-agent",
|
|
6015
|
-
status: "completed",
|
|
6016
|
-
source: "gateway",
|
|
6017
|
-
sourceId: "gw-slack-incoming",
|
|
6018
|
-
createdAt: "2026-04-20T15:44:00Z",
|
|
6019
|
-
updatedAt: "2026-04-20T15:44:42Z",
|
|
6020
|
-
messageCount: 8,
|
|
6021
|
-
error: null
|
|
6022
|
-
},
|
|
6023
|
-
gateway: {
|
|
6024
|
-
threadId: "C01234567",
|
|
6025
|
-
attachmentKey: "slack-incoming"
|
|
6026
|
-
},
|
|
6027
|
-
messages: [{
|
|
6028
|
-
role: "user",
|
|
6029
|
-
content: "Customer asked about billing cycle."
|
|
6030
|
-
}, {
|
|
6031
|
-
role: "assistant",
|
|
6032
|
-
content: "Drafted reply with prorated credit explanation."
|
|
6033
|
-
}],
|
|
6034
|
-
trace: buildSupportAgentTrace("run-support-agent-001", false),
|
|
6035
|
-
ranAs: MOCK_ACTOR,
|
|
6036
|
-
usage: buildCompletedUsage(42e3)
|
|
6037
|
-
},
|
|
6038
|
-
"run-support-agent-000": {
|
|
6039
|
-
kind: "agent",
|
|
6040
|
-
session: {
|
|
6041
|
-
id: "run-support-agent-000",
|
|
6042
|
-
agentKey: "support-agent",
|
|
6043
|
-
status: "failed",
|
|
6044
|
-
source: "gateway",
|
|
6045
|
-
sourceId: "gw-slack-incoming",
|
|
6046
|
-
createdAt: "2026-04-19T18:22:00Z",
|
|
6047
|
-
updatedAt: "2026-04-19T18:22:12Z",
|
|
6048
|
-
messageCount: 2,
|
|
6049
|
-
error: { message: "Credential expired" }
|
|
6050
|
-
},
|
|
6051
|
-
gateway: {
|
|
6052
|
-
threadId: "C09876543",
|
|
6053
|
-
attachmentKey: "slack-incoming"
|
|
6054
|
-
},
|
|
6055
|
-
messages: [{
|
|
6056
|
-
role: "user",
|
|
6057
|
-
content: "Urgent refund request in #support."
|
|
6058
|
-
}],
|
|
6059
|
-
trace: buildSupportAgentTrace("run-support-agent-000", true),
|
|
6060
|
-
ranAs: MOCK_ACTOR,
|
|
6061
|
-
usage: buildFailedUsage(12e3)
|
|
6062
|
-
},
|
|
6063
|
-
"run-daily-digest-001": {
|
|
6064
|
-
kind: "workflow",
|
|
6065
|
-
run: {
|
|
6066
|
-
id: "run-daily-digest-001",
|
|
6067
|
-
workflowKey: "daily-digest",
|
|
6068
|
-
status: "running",
|
|
6069
|
-
trigger: "cron",
|
|
6070
|
-
triggeredAt: "2026-04-20T15:12:00Z",
|
|
6071
|
-
startedAt: "2026-04-20T15:12:00Z",
|
|
6072
|
-
finishedAt: null,
|
|
6073
|
-
input: { date: "2026-04-20" },
|
|
6074
|
-
output: null,
|
|
6075
|
-
error: null
|
|
6076
|
-
},
|
|
6077
|
-
trigger: {
|
|
6078
|
-
id: "trigger-daily-digest-001",
|
|
6079
|
-
attachmentKey: "schedule-daily",
|
|
6080
|
-
triggerType: "cron",
|
|
6081
|
-
sourcePath: "src/triggers/daily-digest.ts",
|
|
6082
|
-
payload: { schedule: "0 8 * * *" },
|
|
6083
|
-
triggeredAt: "2026-04-20T15:12:00Z"
|
|
6084
|
-
},
|
|
6085
|
-
steps: [{
|
|
6086
|
-
id: "step-collect-001",
|
|
6087
|
-
actionKey: "collect_updates",
|
|
6088
|
-
output: { projects: 3 },
|
|
6089
|
-
completedAt: "2026-04-20T15:12:45Z"
|
|
6090
|
-
}],
|
|
6091
|
-
trace: buildDailyDigestTrace(),
|
|
6092
|
-
ranAs: MOCK_ACTOR,
|
|
6093
|
-
usage: buildRunningUsage()
|
|
6094
|
-
},
|
|
6095
|
-
"run-email-triage-002": buildEmailTriageDetail(),
|
|
6096
|
-
"run-research-agent-003": {
|
|
6097
|
-
kind: "agent",
|
|
6098
|
-
session: {
|
|
6099
|
-
id: "run-research-agent-003",
|
|
6100
|
-
agentKey: "research-agent",
|
|
6101
|
-
status: "completed",
|
|
6102
|
-
source: "api",
|
|
6103
|
-
sourceId: null,
|
|
6104
|
-
createdAt: "2026-06-01T09:15:00Z",
|
|
6105
|
-
updatedAt: "2026-06-01T09:16:24Z",
|
|
6106
|
-
messageCount: 12,
|
|
6107
|
-
error: null
|
|
6108
|
-
},
|
|
6109
|
-
gateway: null,
|
|
6110
|
-
messages: [{
|
|
6111
|
-
role: "user",
|
|
6112
|
-
content: "Summarize the Q2 roadmap doc."
|
|
6113
|
-
}, {
|
|
6114
|
-
role: "assistant",
|
|
6115
|
-
content: "Found 4 themes: platform, agents, billing, design."
|
|
6116
|
-
}],
|
|
6117
|
-
trace: {
|
|
6118
|
-
traceId: "run-research-agent-003",
|
|
6119
|
-
trigger: {
|
|
6120
|
-
triggerType: "api",
|
|
6121
|
-
triggerRunId: "trigger-research-003",
|
|
6122
|
-
agentKey: "research-agent",
|
|
6123
|
-
route: "/agents/research-agent"
|
|
6124
|
-
},
|
|
6125
|
-
gateway: null,
|
|
6126
|
-
spans: [{
|
|
6127
|
-
id: "span-research-003",
|
|
6128
|
-
traceId: "run-research-agent-003",
|
|
6129
|
-
parentSpanId: null,
|
|
6130
|
-
kind: "agent_session",
|
|
6131
|
-
refId: "run-research-agent-003",
|
|
6132
|
-
name: "Research Agent",
|
|
6133
|
-
status: "ok",
|
|
6134
|
-
startedAt: "2026-06-01T09:15:00Z",
|
|
6135
|
-
finishedAt: "2026-06-01T09:16:24Z",
|
|
6136
|
-
metadata: { messageCount: 12 },
|
|
6137
|
-
error: null
|
|
6138
|
-
}],
|
|
6139
|
-
logs: [{
|
|
6140
|
-
id: "log-research-1",
|
|
6141
|
-
traceId: "run-research-agent-003",
|
|
6142
|
-
spanId: "span-research-003",
|
|
6143
|
-
seq: 1,
|
|
6144
|
-
level: "info",
|
|
6145
|
-
message: "Summarized 4 documents and returned citations.",
|
|
6146
|
-
data: null,
|
|
6147
|
-
source: "system",
|
|
6148
|
-
createdAt: "2026-06-01T09:16:24Z"
|
|
6149
|
-
}]
|
|
5563
|
+
async get(runId) {
|
|
5564
|
+
try {
|
|
5565
|
+
const response = await http.get(`api/history/${encodeURIComponent(runId)}`);
|
|
5566
|
+
if (response.status === 404) return null;
|
|
5567
|
+
const data = await response.json();
|
|
5568
|
+
return HistoryRunDetailResponseSchema.parse(data);
|
|
5569
|
+
} catch (error) {
|
|
5570
|
+
throw await toPlatformError(error);
|
|
5571
|
+
}
|
|
6150
5572
|
},
|
|
6151
|
-
|
|
6152
|
-
|
|
6153
|
-
|
|
6154
|
-
|
|
6155
|
-
|
|
6156
|
-
|
|
6157
|
-
|
|
6158
|
-
|
|
6159
|
-
|
|
6160
|
-
status: override.status,
|
|
6161
|
-
finishedAt: override.finishedAt
|
|
6162
|
-
}
|
|
6163
|
-
};
|
|
6164
|
-
return {
|
|
6165
|
-
...detail,
|
|
6166
|
-
session: {
|
|
6167
|
-
...detail.session,
|
|
6168
|
-
status: override.status,
|
|
6169
|
-
updatedAt: override.finishedAt ?? detail.session.updatedAt
|
|
5573
|
+
async cancel(runId) {
|
|
5574
|
+
try {
|
|
5575
|
+
const response = await http.post(`api/history/${encodeURIComponent(runId)}/cancel`);
|
|
5576
|
+
if (response.status === 404) return null;
|
|
5577
|
+
const data = await response.json();
|
|
5578
|
+
return HistoryRunCancelResponseSchema.parse(data);
|
|
5579
|
+
} catch (error) {
|
|
5580
|
+
throw await toPlatformError(error);
|
|
5581
|
+
}
|
|
6170
5582
|
}
|
|
6171
5583
|
};
|
|
6172
5584
|
}
|
|
6173
|
-
function getHistoryRunDetail(runId) {
|
|
6174
|
-
const detail = historyDetailById[runId];
|
|
6175
|
-
if (!detail) return null;
|
|
6176
|
-
const override = historyRunStatusOverrides.get(runId);
|
|
6177
|
-
return override ? applyRunStatusOverride(detail, override) : detail;
|
|
6178
|
-
}
|
|
6179
|
-
function createHistoryResource() {
|
|
6180
|
-
return {
|
|
6181
|
-
/** Runs across projects the current user can access in the active org. */
|
|
6182
|
-
list: mock({
|
|
6183
|
-
domain: "history",
|
|
6184
|
-
method: "list",
|
|
6185
|
-
plannedEndpoint: "GET /api/orgs/:orgSlug/history"
|
|
6186
|
-
}, async () => [...listHistoryRuns()].sort((a, b) => new Date(b.startedAt).getTime() - new Date(a.startedAt).getTime())),
|
|
6187
|
-
get: mock({
|
|
6188
|
-
domain: "history",
|
|
6189
|
-
method: "get",
|
|
6190
|
-
plannedEndpoint: "GET /api/orgs/:orgSlug/history/:runId"
|
|
6191
|
-
}, async (runId) => getHistoryRunDetail(runId)),
|
|
6192
|
-
/** Cancel a running/queued run. Returns the updated run (or null if unknown). */
|
|
6193
|
-
cancel: mock({
|
|
6194
|
-
domain: "history",
|
|
6195
|
-
method: "cancel",
|
|
6196
|
-
plannedEndpoint: "POST /api/orgs/:orgSlug/history/:runId/cancel"
|
|
6197
|
-
}, async (runId) => cancelHistoryRun(runId))
|
|
6198
|
-
};
|
|
6199
|
-
}
|
|
6200
5585
|
async function presignPutAndFinalize(input) {
|
|
6201
5586
|
const contentType = input.file.type?.trim() || "application/octet-stream";
|
|
6202
5587
|
const uploadFailedMessage = input.uploadFailedMessage ?? "Upload failed";
|
|
@@ -7062,7 +6447,7 @@ function createPlatformClient(options) {
|
|
|
7062
6447
|
skills: createSkillsResource(http),
|
|
7063
6448
|
apps: createAppsResource(),
|
|
7064
6449
|
credentials: createCredentialsResource(),
|
|
7065
|
-
history: createHistoryResource(),
|
|
6450
|
+
history: createHistoryResource(http),
|
|
7066
6451
|
deployments: createDeploymentsResource(http),
|
|
7067
6452
|
gatewayAttachments: createGatewayAttachmentsResource(http),
|
|
7068
6453
|
projectMetrics: createProjectMetricsResource(http),
|
|
@@ -7885,7 +7270,7 @@ function registerBuildCommand(program) {
|
|
|
7885
7270
|
program.command("build").description("Build the keystroke project for production").option("--dir <path>", "Project directory", process.cwd()).action(async (options) => {
|
|
7886
7271
|
try {
|
|
7887
7272
|
const root = resolveProjectRoot(options.dir);
|
|
7888
|
-
const { buildApp } = await import("./dist-
|
|
7273
|
+
const { buildApp } = await import("./dist-CSolAKQe.mjs");
|
|
7889
7274
|
await buildApp({ root });
|
|
7890
7275
|
process.stdout.write(`Built ${root}\n`);
|
|
7891
7276
|
} catch (error) {
|
|
@@ -7982,7 +7367,7 @@ async function runDeploy(options) {
|
|
|
7982
7367
|
const client = createCliPlatformClient(config);
|
|
7983
7368
|
let source;
|
|
7984
7369
|
if (!options.skipBuild) {
|
|
7985
|
-
const { buildApp } = await import("./dist-
|
|
7370
|
+
const { buildApp } = await import("./dist-CSolAKQe.mjs");
|
|
7986
7371
|
source = { files: (await buildApp({
|
|
7987
7372
|
root,
|
|
7988
7373
|
collectSources: true,
|
|
@@ -8082,7 +7467,7 @@ function runtimeChildEnv(parentEnv, overrides) {
|
|
|
8082
7467
|
//#region src/project/bootstrap-run.ts
|
|
8083
7468
|
/** Node args + env for `@keystrokehq/build` bootstrap (shared by start + dev). */
|
|
8084
7469
|
async function resolveBootstrapRun(options) {
|
|
8085
|
-
const { resolveRuntimeBuildArtifact } = await import("./dist-
|
|
7470
|
+
const { resolveRuntimeBuildArtifact } = await import("./dist-CSolAKQe.mjs");
|
|
8086
7471
|
const loader = pathToFileURL(resolveRuntimeBuildArtifact(options.runtimeNodeModules, "dist/runtime-loader.mjs")).href;
|
|
8087
7472
|
const bootstrap = resolveRuntimeBuildArtifact(options.runtimeNodeModules, "dist/bootstrap.mjs");
|
|
8088
7473
|
const args = [`--import=${loader}`];
|
|
@@ -8232,7 +7617,7 @@ async function runDev(options) {
|
|
|
8232
7617
|
process.on("SIGINT", shutdown);
|
|
8233
7618
|
process.on("SIGTERM", shutdown);
|
|
8234
7619
|
try {
|
|
8235
|
-
const { watchApp } = await import("./dist-
|
|
7620
|
+
const { watchApp } = await import("./dist-CSolAKQe.mjs");
|
|
8236
7621
|
await watchApp({
|
|
8237
7622
|
root,
|
|
8238
7623
|
clean: false,
|
|
@@ -8260,6 +7645,138 @@ function registerDevCommand(program) {
|
|
|
8260
7645
|
});
|
|
8261
7646
|
}
|
|
8262
7647
|
//#endregion
|
|
7648
|
+
//#region src/commands/project/run-project.ts
|
|
7649
|
+
async function withActivePlatformClient(config, fn) {
|
|
7650
|
+
const platform = createCliPlatformClient(config);
|
|
7651
|
+
let active = await platform.organizations.getActive();
|
|
7652
|
+
if (!active) active = await selectActiveOrganization(config);
|
|
7653
|
+
platform.setActiveOrganizationId(active.organization.id);
|
|
7654
|
+
await fn(platform);
|
|
7655
|
+
}
|
|
7656
|
+
function writeInactiveDeployHints(projects) {
|
|
7657
|
+
const bin = cliBinaryName();
|
|
7658
|
+
for (const project of projects) {
|
|
7659
|
+
if (project.status !== "inactive") continue;
|
|
7660
|
+
process.stderr.write(`Project ${formatProjectLabel(project)} is inactive. Deploy with: ${bin} deploy --project ${formatProjectLabel(project)}\n`);
|
|
7661
|
+
}
|
|
7662
|
+
}
|
|
7663
|
+
async function runProjectList(config) {
|
|
7664
|
+
await withActivePlatformClient(config, async (platform) => {
|
|
7665
|
+
const projects = await platform.projects.list();
|
|
7666
|
+
process.stdout.write(`${JSON.stringify({ projects }, null, 2)}\n`);
|
|
7667
|
+
if (projects.length === 0) {
|
|
7668
|
+
const bin = cliBinaryName();
|
|
7669
|
+
process.stderr.write(`No projects yet. Create one with: ${bin} project create --name "My project"\n`);
|
|
7670
|
+
return;
|
|
7671
|
+
}
|
|
7672
|
+
writeInactiveDeployHints(projects);
|
|
7673
|
+
});
|
|
7674
|
+
}
|
|
7675
|
+
async function runProjectMetrics(config, options) {
|
|
7676
|
+
await withActivePlatformClient(config, async (platform) => {
|
|
7677
|
+
const metrics = await platform.projectMetrics.list();
|
|
7678
|
+
if (options.projectRef === void 0) {
|
|
7679
|
+
process.stdout.write(`${JSON.stringify(metrics, null, 2)}\n`);
|
|
7680
|
+
return;
|
|
7681
|
+
}
|
|
7682
|
+
const project = await resolveProjectRef(platform, options.projectRef);
|
|
7683
|
+
const output = Object.fromEntries(Object.entries(metrics).filter(([projectId]) => projectId === project.id));
|
|
7684
|
+
process.stdout.write(`${JSON.stringify(output, null, 2)}\n`);
|
|
7685
|
+
});
|
|
7686
|
+
}
|
|
7687
|
+
async function runProjectDeploymentsList(config, options) {
|
|
7688
|
+
await withActivePlatformClient(config, async (platform) => {
|
|
7689
|
+
const project = await resolveProjectRef(platform, options.projectRef);
|
|
7690
|
+
const deployments = await platform.deployments.listForProject(project.id);
|
|
7691
|
+
process.stdout.write(`${JSON.stringify({ deployments }, null, 2)}\n`);
|
|
7692
|
+
});
|
|
7693
|
+
}
|
|
7694
|
+
async function runProjectCreate(config, input) {
|
|
7695
|
+
await withActivePlatformClient(config, async (platform) => {
|
|
7696
|
+
const project = await platform.projects.create(input);
|
|
7697
|
+
process.stdout.write(`${JSON.stringify({ project }, null, 2)}\n`);
|
|
7698
|
+
writeInactiveDeployHints([project]);
|
|
7699
|
+
});
|
|
7700
|
+
}
|
|
7701
|
+
async function runProjectUpdate(config, input) {
|
|
7702
|
+
await withActivePlatformClient(config, async (platform) => {
|
|
7703
|
+
const { projectId, ...patch } = input;
|
|
7704
|
+
const project = await platform.projects.update(projectId, patch);
|
|
7705
|
+
process.stdout.write(`${JSON.stringify({ project }, null, 2)}\n`);
|
|
7706
|
+
});
|
|
7707
|
+
}
|
|
7708
|
+
async function runProjectDelete(config, projectId) {
|
|
7709
|
+
await withActivePlatformClient(config, async (platform) => {
|
|
7710
|
+
await platform.projects.delete(projectId);
|
|
7711
|
+
process.stdout.write(`${JSON.stringify({ deleted: projectId }, null, 2)}\n`);
|
|
7712
|
+
});
|
|
7713
|
+
}
|
|
7714
|
+
//#endregion
|
|
7715
|
+
//#region src/commands/history/run-history.ts
|
|
7716
|
+
async function runHistoryList(config, filters) {
|
|
7717
|
+
await withActivePlatformClient(config, async (platform) => {
|
|
7718
|
+
const runs = await platform.history.list(filters);
|
|
7719
|
+
process.stdout.write(`${JSON.stringify(runs, null, 2)}\n`);
|
|
7720
|
+
});
|
|
7721
|
+
}
|
|
7722
|
+
async function runHistoryGet(config, runId) {
|
|
7723
|
+
await withActivePlatformClient(config, async (platform) => {
|
|
7724
|
+
const run = await platform.history.get(runId);
|
|
7725
|
+
process.stdout.write(`${JSON.stringify(run, null, 2)}\n`);
|
|
7726
|
+
});
|
|
7727
|
+
}
|
|
7728
|
+
async function runHistoryCancel(config, runId) {
|
|
7729
|
+
await withActivePlatformClient(config, async (platform) => {
|
|
7730
|
+
const run = await platform.history.cancel(runId);
|
|
7731
|
+
process.stdout.write(`${JSON.stringify(run, null, 2)}\n`);
|
|
7732
|
+
});
|
|
7733
|
+
}
|
|
7734
|
+
//#endregion
|
|
7735
|
+
//#region src/commands/history/index.ts
|
|
7736
|
+
function registerHistoryCommand(program) {
|
|
7737
|
+
const history = program.command("history").description("List, inspect, and cancel platform run history");
|
|
7738
|
+
history.command("list").description("List runs across projects in the active organization").option("--project <id>", "Filter by project id").option("--status <status>", "Filter by status (pending, running, sleeping, waiting_hook, completed, failed, canceled)").option("--kind <kind>", "Filter by kind (workflow or agent)").action(async (options) => {
|
|
7739
|
+
const config = createCliConfig();
|
|
7740
|
+
try {
|
|
7741
|
+
await runHistoryList(config, {
|
|
7742
|
+
...options.project ? { project: options.project } : {},
|
|
7743
|
+
...options.status ? { status: options.status } : {},
|
|
7744
|
+
...options.kind ? { kind: options.kind } : {}
|
|
7745
|
+
});
|
|
7746
|
+
} catch (error) {
|
|
7747
|
+
process.stderr.write(`${formatCliError(error, "List history failed", {
|
|
7748
|
+
serverUrl: getPlatformUrl(config),
|
|
7749
|
+
webUrl: getWebUrl(config)
|
|
7750
|
+
})}\n`);
|
|
7751
|
+
process.exitCode = 1;
|
|
7752
|
+
}
|
|
7753
|
+
});
|
|
7754
|
+
history.command("get").description("Get run details").argument("<runId>", "Run id").action(async (runId) => {
|
|
7755
|
+
const config = createCliConfig();
|
|
7756
|
+
try {
|
|
7757
|
+
await runHistoryGet(config, runId);
|
|
7758
|
+
} catch (error) {
|
|
7759
|
+
process.stderr.write(`${formatCliError(error, "Get history run failed", {
|
|
7760
|
+
serverUrl: getPlatformUrl(config),
|
|
7761
|
+
webUrl: getWebUrl(config)
|
|
7762
|
+
})}\n`);
|
|
7763
|
+
process.exitCode = 1;
|
|
7764
|
+
}
|
|
7765
|
+
});
|
|
7766
|
+
history.command("cancel").description("Cancel a pending workflow run").argument("<runId>", "Run id").action(async (runId) => {
|
|
7767
|
+
const config = createCliConfig();
|
|
7768
|
+
try {
|
|
7769
|
+
await runHistoryCancel(config, runId);
|
|
7770
|
+
} catch (error) {
|
|
7771
|
+
process.stderr.write(`${formatCliError(error, "Cancel history run failed", {
|
|
7772
|
+
serverUrl: getPlatformUrl(config),
|
|
7773
|
+
webUrl: getWebUrl(config)
|
|
7774
|
+
})}\n`);
|
|
7775
|
+
process.exitCode = 1;
|
|
7776
|
+
}
|
|
7777
|
+
});
|
|
7778
|
+
}
|
|
7779
|
+
//#endregion
|
|
8263
7780
|
//#region src/commands/health.ts
|
|
8264
7781
|
function registerHealthCommand(program) {
|
|
8265
7782
|
program.command("health").description("Check connectivity to the keystroke API").action(() => runCliCommand("Health check failed", async ({ client }) => {
|
|
@@ -8575,73 +8092,6 @@ function registerInitCommand(program) {
|
|
|
8575
8092
|
});
|
|
8576
8093
|
}
|
|
8577
8094
|
//#endregion
|
|
8578
|
-
//#region src/commands/project/run-project.ts
|
|
8579
|
-
async function withActivePlatformClient(config, fn) {
|
|
8580
|
-
const platform = createCliPlatformClient(config);
|
|
8581
|
-
let active = await platform.organizations.getActive();
|
|
8582
|
-
if (!active) active = await selectActiveOrganization(config);
|
|
8583
|
-
platform.setActiveOrganizationId(active.organization.id);
|
|
8584
|
-
await fn(platform);
|
|
8585
|
-
}
|
|
8586
|
-
function writeInactiveDeployHints(projects) {
|
|
8587
|
-
const bin = cliBinaryName();
|
|
8588
|
-
for (const project of projects) {
|
|
8589
|
-
if (project.status !== "inactive") continue;
|
|
8590
|
-
process.stderr.write(`Project ${formatProjectLabel(project)} is inactive. Deploy with: ${bin} deploy --project ${formatProjectLabel(project)}\n`);
|
|
8591
|
-
}
|
|
8592
|
-
}
|
|
8593
|
-
async function runProjectList(config) {
|
|
8594
|
-
await withActivePlatformClient(config, async (platform) => {
|
|
8595
|
-
const projects = await platform.projects.list();
|
|
8596
|
-
process.stdout.write(`${JSON.stringify({ projects }, null, 2)}\n`);
|
|
8597
|
-
if (projects.length === 0) {
|
|
8598
|
-
const bin = cliBinaryName();
|
|
8599
|
-
process.stderr.write(`No projects yet. Create one with: ${bin} project create --name "My project"\n`);
|
|
8600
|
-
return;
|
|
8601
|
-
}
|
|
8602
|
-
writeInactiveDeployHints(projects);
|
|
8603
|
-
});
|
|
8604
|
-
}
|
|
8605
|
-
async function runProjectMetrics(config, options) {
|
|
8606
|
-
await withActivePlatformClient(config, async (platform) => {
|
|
8607
|
-
const metrics = await platform.projectMetrics.list();
|
|
8608
|
-
if (options.projectRef === void 0) {
|
|
8609
|
-
process.stdout.write(`${JSON.stringify(metrics, null, 2)}\n`);
|
|
8610
|
-
return;
|
|
8611
|
-
}
|
|
8612
|
-
const project = await resolveProjectRef(platform, options.projectRef);
|
|
8613
|
-
const output = Object.fromEntries(Object.entries(metrics).filter(([projectId]) => projectId === project.id));
|
|
8614
|
-
process.stdout.write(`${JSON.stringify(output, null, 2)}\n`);
|
|
8615
|
-
});
|
|
8616
|
-
}
|
|
8617
|
-
async function runProjectDeploymentsList(config, options) {
|
|
8618
|
-
await withActivePlatformClient(config, async (platform) => {
|
|
8619
|
-
const project = await resolveProjectRef(platform, options.projectRef);
|
|
8620
|
-
const deployments = await platform.deployments.listForProject(project.id);
|
|
8621
|
-
process.stdout.write(`${JSON.stringify({ deployments }, null, 2)}\n`);
|
|
8622
|
-
});
|
|
8623
|
-
}
|
|
8624
|
-
async function runProjectCreate(config, input) {
|
|
8625
|
-
await withActivePlatformClient(config, async (platform) => {
|
|
8626
|
-
const project = await platform.projects.create(input);
|
|
8627
|
-
process.stdout.write(`${JSON.stringify({ project }, null, 2)}\n`);
|
|
8628
|
-
writeInactiveDeployHints([project]);
|
|
8629
|
-
});
|
|
8630
|
-
}
|
|
8631
|
-
async function runProjectUpdate(config, input) {
|
|
8632
|
-
await withActivePlatformClient(config, async (platform) => {
|
|
8633
|
-
const { projectId, ...patch } = input;
|
|
8634
|
-
const project = await platform.projects.update(projectId, patch);
|
|
8635
|
-
process.stdout.write(`${JSON.stringify({ project }, null, 2)}\n`);
|
|
8636
|
-
});
|
|
8637
|
-
}
|
|
8638
|
-
async function runProjectDelete(config, projectId) {
|
|
8639
|
-
await withActivePlatformClient(config, async (platform) => {
|
|
8640
|
-
await platform.projects.delete(projectId);
|
|
8641
|
-
process.stdout.write(`${JSON.stringify({ deleted: projectId }, null, 2)}\n`);
|
|
8642
|
-
});
|
|
8643
|
-
}
|
|
8644
|
-
//#endregion
|
|
8645
8095
|
//#region src/commands/organization/run-organization.ts
|
|
8646
8096
|
async function runOrganizationUpdate(config, input) {
|
|
8647
8097
|
await withActivePlatformClient(config, async (platform) => {
|
|
@@ -8770,7 +8220,7 @@ async function runStart(options) {
|
|
|
8770
8220
|
const apiPort = Number(new URL(serverUrl).port || 80);
|
|
8771
8221
|
const runtimeNodeModules = resolveCliRuntimeNodeModules(resolveCliRoot(import.meta.url));
|
|
8772
8222
|
ensureNativeDeps(runtimeNodeModules);
|
|
8773
|
-
const { buildApp } = await import("./dist-
|
|
8223
|
+
const { buildApp } = await import("./dist-CSolAKQe.mjs");
|
|
8774
8224
|
await buildApp({
|
|
8775
8225
|
root,
|
|
8776
8226
|
clean: false
|
|
@@ -9075,6 +8525,7 @@ function createProgram() {
|
|
|
9075
8525
|
registerConfigCommand(program);
|
|
9076
8526
|
registerOrganizationCommand(program);
|
|
9077
8527
|
registerProjectCommand(program);
|
|
8528
|
+
registerHistoryCommand(program);
|
|
9078
8529
|
registerCredentialsCommand(program);
|
|
9079
8530
|
registerHealthCommand(program);
|
|
9080
8531
|
registerInitCommand(program);
|