terse-cli 0.9.19 → 0.9.21
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/README.md +2 -2
- package/dist/cliUi.d.ts +3 -1
- package/dist/cliUi.d.ts.map +1 -1
- package/dist/cliUi.js +3 -2
- package/dist/cliUi.js.map +1 -1
- package/dist/commands/actor.d.ts.map +1 -1
- package/dist/commands/actor.js +32 -5
- package/dist/commands/actor.js.map +1 -1
- package/dist/commands/actorGenerate.d.ts.map +1 -1
- package/dist/commands/actorGenerate.js +22 -86
- package/dist/commands/actorGenerate.js.map +1 -1
- package/dist/commands/attach.d.ts +0 -7
- package/dist/commands/attach.d.ts.map +1 -1
- package/dist/commands/attach.js +220 -189
- package/dist/commands/attach.js.map +1 -1
- package/dist/commands/deploy.d.ts.map +1 -1
- package/dist/commands/deploy.js +15 -3
- package/dist/commands/deploy.js.map +1 -1
- package/dist/commands/generate.d.ts +0 -4
- package/dist/commands/generate.d.ts.map +1 -1
- package/dist/commands/generate.js +161 -127
- package/dist/commands/generate.js.map +1 -1
- package/dist/commands/history.d.ts +0 -15
- package/dist/commands/history.d.ts.map +1 -1
- package/dist/commands/history.js +139 -105
- package/dist/commands/history.js.map +1 -1
- package/dist/commands/install.d.ts.map +1 -1
- package/dist/commands/install.js +6 -4
- package/dist/commands/install.js.map +1 -1
- package/dist/commands/integrate.d.ts +0 -48
- package/dist/commands/integrate.d.ts.map +1 -1
- package/dist/commands/integrate.js +897 -699
- package/dist/commands/integrate.js.map +1 -1
- package/dist/commands/integrateUse.d.ts +0 -12
- package/dist/commands/integrateUse.d.ts.map +1 -1
- package/dist/commands/integrateUse.js +132 -98
- package/dist/commands/integrateUse.js.map +1 -1
- package/dist/commands/listen.d.ts +0 -7
- package/dist/commands/listen.d.ts.map +1 -1
- package/dist/commands/listen.js +98 -81
- package/dist/commands/listen.js.map +1 -1
- package/dist/commands/memory.d.ts +0 -21
- package/dist/commands/memory.d.ts.map +1 -1
- package/dist/commands/memory.js +147 -128
- package/dist/commands/memory.js.map +1 -1
- package/dist/commands/replay.d.ts +0 -2
- package/dist/commands/replay.d.ts.map +1 -1
- package/dist/commands/replay.js +37 -28
- package/dist/commands/replay.js.map +1 -1
- package/dist/commands/resume.d.ts +0 -4
- package/dist/commands/resume.d.ts.map +1 -1
- package/dist/commands/resume.js +34 -28
- package/dist/commands/resume.js.map +1 -1
- package/dist/commands/run.d.ts +0 -2
- package/dist/commands/run.d.ts.map +1 -1
- package/dist/commands/run.js +78 -70
- package/dist/commands/run.js.map +1 -1
- package/dist/commands/state.d.ts +0 -18
- package/dist/commands/state.d.ts.map +1 -1
- package/dist/commands/state.js +129 -108
- package/dist/commands/state.js.map +1 -1
- package/dist/commands/test.d.ts +0 -28
- package/dist/commands/test.d.ts.map +1 -1
- package/dist/commands/test.js +509 -403
- package/dist/commands/test.js.map +1 -1
- package/dist/commands/toolRun.d.ts +0 -6
- package/dist/commands/toolRun.d.ts.map +1 -1
- package/dist/commands/toolRun.js +149 -134
- package/dist/commands/toolRun.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/integrationApi.d.ts +0 -15
- package/dist/integrationApi.d.ts.map +1 -1
- package/dist/integrationApi.js +75 -49
- package/dist/integrationApi.js.map +1 -1
- package/dist/loadJob.d.ts +0 -11
- package/dist/loadJob.d.ts.map +1 -1
- package/dist/loadJob.js +54 -46
- package/dist/loadJob.js.map +1 -1
- package/dist/providers/LanguageProvider.d.ts +0 -29
- package/dist/providers/LanguageProvider.d.ts.map +1 -1
- package/dist/providers/LanguageProvider.js +3 -0
- package/dist/providers/LanguageProvider.js.map +1 -1
- package/dist/providers/typescript/TypeScriptProvider.d.ts +0 -24
- package/dist/providers/typescript/TypeScriptProvider.d.ts.map +1 -1
- package/dist/providers/typescript/TypeScriptProvider.js +113 -113
- package/dist/providers/typescript/TypeScriptProvider.js.map +1 -1
- package/dist/providers/typescript/runtimes/JobRuntime.d.ts +0 -26
- package/dist/providers/typescript/runtimes/JobRuntime.d.ts.map +1 -1
- package/dist/providers/typescript/runtimes/JobRuntime.js +51 -18
- package/dist/providers/typescript/runtimes/JobRuntime.js.map +1 -1
- package/dist/providers/typescript/runtimes/directJobRuntime.d.ts +0 -2
- package/dist/providers/typescript/runtimes/directJobRuntime.d.ts.map +1 -1
- package/dist/providers/typescript/runtimes/directJobRuntime.js +60 -49
- package/dist/providers/typescript/runtimes/directJobRuntime.js.map +1 -1
- package/dist/providers/typescript/runtimes/durableJobRuntime.d.ts +0 -2
- package/dist/providers/typescript/runtimes/durableJobRuntime.d.ts.map +1 -1
- package/dist/providers/typescript/runtimes/durableJobRuntime.js +168 -146
- package/dist/providers/typescript/runtimes/durableJobRuntime.js.map +1 -1
- package/dist/providers/typescript/runtimes/index.d.ts +0 -3
- package/dist/providers/typescript/runtimes/index.d.ts.map +1 -1
- package/dist/providers/typescript/runtimes/index.js +5 -2
- package/dist/providers/typescript/runtimes/index.js.map +1 -1
- package/dist/providers/typescript/runtimes/session.d.ts +0 -4
- package/dist/providers/typescript/runtimes/session.d.ts.map +1 -1
- package/dist/providers/typescript/runtimes/session.js +78 -64
- package/dist/providers/typescript/runtimes/session.js.map +1 -1
- package/dist/providers/typescript/terseWorkflow.d.ts +0 -7
- package/dist/providers/typescript/terseWorkflow.d.ts.map +1 -1
- package/dist/providers/typescript/terseWorkflow.js +12 -7
- package/dist/providers/typescript/terseWorkflow.js.map +1 -1
- package/dist/runLocalTestJob.d.ts +0 -19
- package/dist/runLocalTestJob.d.ts.map +1 -1
- package/dist/runLocalTestJob.js +55 -29
- package/dist/runLocalTestJob.js.map +1 -1
- package/dist/setup.js +1 -1
- package/dist/setup.js.map +1 -1
- package/dist/sourceArchive.d.ts +1 -1
- package/dist/sourceArchive.d.ts.map +1 -1
- package/dist/sourceArchive.js +1 -0
- package/dist/sourceArchive.js.map +1 -1
- package/package.json +3 -4
- package/templates/typescript/init/package.json.hbs +1 -2
- package/templates/typescript/terse-transport.d.ts +25 -0
- package/templates/typescript/terse-transport.js +117 -0
- package/templates/typescript/tsconfig.json +13 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate.d.ts","sourceRoot":"","sources":["../../src/commands/generate.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"generate.d.ts","sourceRoot":"","sources":["../../src/commands/generate.ts"],"names":[],"mappings":""}
|
|
@@ -1,128 +1,162 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
//
|
|
14
|
-
//
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
// LEGACY-JOBS: Commented out while Terse is actors-only. Uncomment to restore; see the note in terse-sdk/src/index.ts.
|
|
3
|
+
// import { intro, log, outro } from "@clack/prompts"
|
|
4
|
+
// import chalk from "chalk"
|
|
5
|
+
// import fs from "node:fs"
|
|
6
|
+
// import path from "node:path"
|
|
7
|
+
// import { ApiRoutes, IntegrationType, type ToolDefinition, isValidToolName, toolDefinitionsResponseSchema } from "terse-types"
|
|
8
|
+
//
|
|
9
|
+
// import { ApiError, fetchWithAuth, readApiKeyOrBail } from "../api.js"
|
|
10
|
+
// import { assertProjectRoot } from "../assertProjectRoot.js"
|
|
11
|
+
// import { CliError, ErrorCode } from "../cliError.js"
|
|
12
|
+
// import { createSpinner, formatSummaryList } from "../cliUi.js"
|
|
13
|
+
// import { fetchIntegrations } from "../integrationApi.js"
|
|
14
|
+
// import { readProjectConfig } from "../projectConfig.js"
|
|
15
|
+
// import type { GeneratedFile, LanguageProvider } from "../providers/LanguageProvider.js"
|
|
16
|
+
// import type { CodegenResult } from "../providers/codegenTypes.js"
|
|
17
|
+
// import { resolveProvider } from "../providers/resolveProvider.js"
|
|
18
|
+
//
|
|
19
|
+
// // Platform-native integrations have no connected instance, so they never appear in the org's active
|
|
20
|
+
// // integrations. Their tools are always generated; availability is still gated by skills at runtime.
|
|
21
|
+
// const PLATFORM_NATIVE_INTEGRATIONS = new Set<string>([IntegrationType.TERSE])
|
|
22
|
+
//
|
|
23
|
+
// export async function generate(provider: LanguageProvider = resolveProvider(), opts?: { apiKey?: string }): Promise<void> {
|
|
24
|
+
// intro("terse generate")
|
|
25
|
+
// assertProjectRoot(provider, provider.detectionMarkers)
|
|
26
|
+
//
|
|
27
|
+
// const totalStart = performance.now()
|
|
28
|
+
// const s = createSpinner()
|
|
29
|
+
//
|
|
30
|
+
// s.start("Checking authentication")
|
|
31
|
+
// try {
|
|
32
|
+
// await generateFiles(provider, opts, s, totalStart)
|
|
33
|
+
// } catch (error) {
|
|
34
|
+
// s.stop(error instanceof CliError && error.code === "pinned_connection_missing" ? "Pinned connection missing" : "Code generation failed")
|
|
35
|
+
// throw error
|
|
36
|
+
// }
|
|
37
|
+
// }
|
|
38
|
+
//
|
|
39
|
+
// async function generateFiles(provider: LanguageProvider, opts: { apiKey?: string } | undefined, s: ReturnType<typeof createSpinner>, totalStart: number): Promise<void> {
|
|
40
|
+
// const apiKey =
|
|
41
|
+
// opts?.apiKey?.trim() ||
|
|
42
|
+
// readApiKeyOrBail({
|
|
43
|
+
// title: "\n Not authenticated.\n",
|
|
44
|
+
// detail: " Run `terse auth login` to authenticate, or set TERSE_API_KEY in your environment.\n"
|
|
45
|
+
// })
|
|
46
|
+
//
|
|
47
|
+
// s.message("Fetching integrations")
|
|
48
|
+
//
|
|
49
|
+
// let activeTypes: IntegrationType[]
|
|
50
|
+
// try {
|
|
51
|
+
// activeTypes = await fetchWithAuth<IntegrationType[]>(ApiRoutes.INTEGRATIONS.ACTIVE, apiKey)
|
|
52
|
+
// } catch (error: any) {
|
|
53
|
+
// const message = String(error?.message || "")
|
|
54
|
+
// const isAuthError =
|
|
55
|
+
// (error instanceof ApiError && (error.status === 401 || error.status === 403)) ||
|
|
56
|
+
// message.includes("401") ||
|
|
57
|
+
// message.includes("403") ||
|
|
58
|
+
// message.toLowerCase().includes("authentication failed") ||
|
|
59
|
+
// message.toLowerCase().includes("unauthorized") ||
|
|
60
|
+
// message.toLowerCase().includes("forbidden")
|
|
61
|
+
//
|
|
62
|
+
// if (isAuthError) {
|
|
63
|
+
// throw new CliError("not_authenticated", "Authentication failed: your TERSE_API_KEY was rejected.", {
|
|
64
|
+
// detail: "Run `terse auth login` to refresh your credentials and try again.",
|
|
65
|
+
// actionRequired: true,
|
|
66
|
+
// exitCode: ErrorCode.BAD_ARGUMENTS
|
|
67
|
+
// })
|
|
68
|
+
// }
|
|
69
|
+
//
|
|
70
|
+
// throw new CliError("fetch_integrations_failed", message || "Failed to fetch integrations.")
|
|
71
|
+
// }
|
|
72
|
+
//
|
|
73
|
+
// s.message("Fetching integration catalog")
|
|
74
|
+
//
|
|
75
|
+
// let availableIntegrations: string[] = []
|
|
76
|
+
// try {
|
|
77
|
+
// const catalog = await fetchIntegrations(apiKey)
|
|
78
|
+
// availableIntegrations = [...new Set(catalog.map(entry => entry.integrationType))].sort()
|
|
79
|
+
// } catch {
|
|
80
|
+
// log.warn("Skipped integration catalog fetch; proceeding without the available-integrations list")
|
|
81
|
+
// }
|
|
82
|
+
//
|
|
83
|
+
// s.message("Fetching tool definitions")
|
|
84
|
+
//
|
|
85
|
+
// let toolDefs: ToolDefinition[] = []
|
|
86
|
+
// try {
|
|
87
|
+
// const raw = await fetchWithAuth<unknown>(ApiRoutes.SDK.TOOL_DEFINITIONS, apiKey)
|
|
88
|
+
// const resp = toolDefinitionsResponseSchema.parse(raw)
|
|
89
|
+
// const activeSet = new Set(activeTypes as string[])
|
|
90
|
+
// toolDefs = resp.tools.filter(t => activeSet.has(t.integration) || PLATFORM_NATIVE_INTEGRATIONS.has(t.integration))
|
|
91
|
+
// const skippedToolNames = [...new Set(toolDefs.filter(t => !isValidToolName(t.name)).map(t => t.name))].sort()
|
|
92
|
+
// toolDefs = toolDefs.filter(t => isValidToolName(t.name))
|
|
93
|
+
// if (skippedToolNames.length > 0) {
|
|
94
|
+
// log.warn(`Skipped ${skippedToolNames.length} tool(s) absent from terse-types ToolDefinitions: ${skippedToolNames.join(", ")}`)
|
|
95
|
+
// }
|
|
96
|
+
// } catch {
|
|
97
|
+
// log.warn("Skipped tool definitions fetch; proceeding without typed tool wrappers")
|
|
98
|
+
// }
|
|
99
|
+
//
|
|
100
|
+
// s.message("Fetching integration details")
|
|
101
|
+
//
|
|
102
|
+
// const codegenTimer = { start: performance.now() }
|
|
103
|
+
// const result: CodegenResult = await provider.renderGeneratedFiles(
|
|
104
|
+
// {
|
|
105
|
+
// apiKey,
|
|
106
|
+
// activeTypes,
|
|
107
|
+
// availableIntegrations,
|
|
108
|
+
// tools: toolDefs,
|
|
109
|
+
// activeConnections: readProjectConfig()?.connections ?? {}
|
|
110
|
+
// },
|
|
111
|
+
// {
|
|
112
|
+
// onFetchComplete: () => {
|
|
113
|
+
// s.message("Generating code")
|
|
114
|
+
// codegenTimer.start = performance.now()
|
|
115
|
+
// }
|
|
116
|
+
// }
|
|
117
|
+
// )
|
|
118
|
+
// const codegenMs = performance.now() - codegenTimer.start
|
|
119
|
+
//
|
|
120
|
+
// s.message("Writing generated files")
|
|
121
|
+
// writeOutput(result.files, provider)
|
|
122
|
+
//
|
|
123
|
+
// const integrationCount = result.integrationSummaries.reduce((sum, summary) => sum + summary.instanceCount, 0)
|
|
124
|
+
// s.stop(`Fetched ${integrationCount} integration(s)`)
|
|
125
|
+
//
|
|
126
|
+
// const totalMs = performance.now() - totalStart
|
|
127
|
+
// const integrationSummary = formatSummaryList(
|
|
128
|
+
// result.integrationSummaries.map(summary => labelWithCount(summary.label, summary.instanceCount)),
|
|
129
|
+
// 10
|
|
130
|
+
// )
|
|
131
|
+
//
|
|
132
|
+
// if (integrationSummary) {
|
|
133
|
+
// console.log(chalk.dim(`Integrations: ${integrationSummary}`))
|
|
134
|
+
// }
|
|
135
|
+
// if (toolDefs.length > 0) {
|
|
136
|
+
// console.log(chalk.dim(`Generated types for ${toolDefs.length} ${toolDefs.length === 1 ? "tool" : "tools"}`))
|
|
137
|
+
// }
|
|
138
|
+
// const generatedPath = path.relative(process.cwd(), provider.resolveGeneratedCodePath(process.cwd()))
|
|
139
|
+
// console.log(
|
|
140
|
+
// chalk.dim(
|
|
141
|
+
// result.files.length > 1
|
|
142
|
+
// ? `Generated ${generatedPath} + ${result.files.length - 1} file(s) under ${path.join(path.dirname(generatedPath), "terse.generated")}/`
|
|
143
|
+
// : `Generated ${generatedPath}`
|
|
144
|
+
// )
|
|
145
|
+
// )
|
|
146
|
+
// console.log(chalk.dim(`Codegen: ${codegenMs.toFixed(0)}ms | Total: ${totalMs.toFixed(0)}ms`))
|
|
147
|
+
// }
|
|
148
|
+
//
|
|
149
|
+
// function writeOutput(files: GeneratedFile[], provider: LanguageProvider): void {
|
|
150
|
+
// const outputDir = path.dirname(provider.resolveGeneratedCodePath(process.cwd()))
|
|
151
|
+
// fs.rmSync(path.join(outputDir, "terse.generated"), { recursive: true, force: true })
|
|
152
|
+
// for (const file of files) {
|
|
153
|
+
// const target = path.join(outputDir, file.fileName)
|
|
154
|
+
// fs.mkdirSync(path.dirname(target), { recursive: true })
|
|
155
|
+
// fs.writeFileSync(target, file.code)
|
|
156
|
+
// }
|
|
157
|
+
// }
|
|
158
|
+
//
|
|
159
|
+
// function labelWithCount(label: string, count: number): string {
|
|
160
|
+
// return count === 1 ? label : `${label} (${count})`
|
|
161
|
+
// }
|
|
128
162
|
//# sourceMappingURL=generate.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate.js","sourceRoot":"","sources":["../../src/commands/generate.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"generate.js","sourceRoot":"","sources":["../../src/commands/generate.ts"],"names":[],"mappings":";AAAA,uHAAuH;AACvH,qDAAqD;AACrD,4BAA4B;AAC5B,2BAA2B;AAC3B,+BAA+B;AAC/B,gIAAgI;AAChI,EAAE;AACF,wEAAwE;AACxE,8DAA8D;AAC9D,uDAAuD;AACvD,iEAAiE;AACjE,2DAA2D;AAC3D,0DAA0D;AAC1D,0FAA0F;AAC1F,oEAAoE;AACpE,oEAAoE;AACpE,EAAE;AACF,uGAAuG;AACvG,uGAAuG;AACvG,gFAAgF;AAChF,EAAE;AACF,8HAA8H;AAC9H,8BAA8B;AAC9B,6DAA6D;AAC7D,EAAE;AACF,2CAA2C;AAC3C,gCAAgC;AAChC,EAAE;AACF,yCAAyC;AACzC,YAAY;AACZ,6DAA6D;AAC7D,wBAAwB;AACxB,mJAAmJ;AACnJ,sBAAsB;AACtB,QAAQ;AACR,IAAI;AACJ,EAAE;AACF,4KAA4K;AAC5K,qBAAqB;AACrB,kCAAkC;AAClC,6BAA6B;AAC7B,iDAAiD;AACjD,8GAA8G;AAC9G,aAAa;AACb,EAAE;AACF,yCAAyC;AACzC,EAAE;AACF,yCAAyC;AACzC,YAAY;AACZ,sGAAsG;AACtG,6BAA6B;AAC7B,uDAAuD;AACvD,8BAA8B;AAC9B,+FAA+F;AAC/F,yCAAyC;AACzC,yCAAyC;AACzC,yEAAyE;AACzE,gEAAgE;AAChE,0DAA0D;AAC1D,EAAE;AACF,6BAA6B;AAC7B,mHAAmH;AACnH,+FAA+F;AAC/F,wCAAwC;AACxC,oDAAoD;AACpD,iBAAiB;AACjB,YAAY;AACZ,EAAE;AACF,sGAAsG;AACtG,QAAQ;AACR,EAAE;AACF,gDAAgD;AAChD,EAAE;AACF,+CAA+C;AAC/C,YAAY;AACZ,0DAA0D;AAC1D,mGAAmG;AACnG,gBAAgB;AAChB,4GAA4G;AAC5G,QAAQ;AACR,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,0CAA0C;AAC1C,YAAY;AACZ,2FAA2F;AAC3F,gEAAgE;AAChE,6DAA6D;AAC7D,6HAA6H;AAC7H,wHAAwH;AACxH,mEAAmE;AACnE,6CAA6C;AAC7C,6IAA6I;AAC7I,YAAY;AACZ,gBAAgB;AAChB,6FAA6F;AAC7F,QAAQ;AACR,EAAE;AACF,gDAAgD;AAChD,EAAE;AACF,wDAAwD;AACxD,yEAAyE;AACzE,YAAY;AACZ,sBAAsB;AACtB,2BAA2B;AAC3B,qCAAqC;AACrC,+BAA+B;AAC/B,wEAAwE;AACxE,aAAa;AACb,YAAY;AACZ,uCAAuC;AACvC,+CAA+C;AAC/C,yDAAyD;AACzD,gBAAgB;AAChB,YAAY;AACZ,QAAQ;AACR,+DAA+D;AAC/D,EAAE;AACF,2CAA2C;AAC3C,0CAA0C;AAC1C,EAAE;AACF,oHAAoH;AACpH,2DAA2D;AAC3D,EAAE;AACF,qDAAqD;AACrD,oDAAoD;AACpD,4GAA4G;AAC5G,aAAa;AACb,QAAQ;AACR,EAAE;AACF,gCAAgC;AAChC,wEAAwE;AACxE,QAAQ;AACR,iCAAiC;AACjC,uHAAuH;AACvH,QAAQ;AACR,2GAA2G;AAC3G,mBAAmB;AACnB,qBAAqB;AACrB,sCAAsC;AACtC,0JAA0J;AAC1J,iDAAiD;AACjD,YAAY;AACZ,QAAQ;AACR,oGAAoG;AACpG,IAAI;AACJ,EAAE;AACF,mFAAmF;AACnF,uFAAuF;AACvF,2FAA2F;AAC3F,kCAAkC;AAClC,6DAA6D;AAC7D,kEAAkE;AAClE,8CAA8C;AAC9C,QAAQ;AACR,IAAI;AACJ,EAAE;AACF,kEAAkE;AAClE,yDAAyD;AACzD,IAAI"}
|
|
@@ -1,16 +1 @@
|
|
|
1
|
-
import { LanguageProvider } from "../providers/LanguageProvider.js";
|
|
2
|
-
export declare function history(jobName?: string, options?: HistoryOptions, provider?: LanguageProvider): Promise<void>;
|
|
3
|
-
export type HistoryOptions = {
|
|
4
|
-
json?: boolean;
|
|
5
|
-
limit?: number;
|
|
6
|
-
page?: number;
|
|
7
|
-
status?: string;
|
|
8
|
-
since?: string;
|
|
9
|
-
until?: string;
|
|
10
|
-
query?: string;
|
|
11
|
-
triggers?: boolean;
|
|
12
|
-
events?: boolean;
|
|
13
|
-
runId?: string;
|
|
14
|
-
includeTest?: boolean;
|
|
15
|
-
};
|
|
16
1
|
//# sourceMappingURL=history.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"history.d.ts","sourceRoot":"","sources":["../../src/commands/history.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"history.d.ts","sourceRoot":"","sources":["../../src/commands/history.ts"],"names":[],"mappings":""}
|
package/dist/commands/history.js
CHANGED
|
@@ -1,106 +1,140 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
// LEGACY-JOBS: Commented out while Terse is actors-only. Uncomment to restore; see the note in terse-sdk/src/index.ts.
|
|
3
|
+
// import chalk from "chalk"
|
|
4
|
+
// import ora from "ora"
|
|
5
|
+
// import { RunHistoryStatus } from "terse-types"
|
|
6
|
+
// import type { GetRunHistoryParams, RunHistoryStatus as RunHistoryStatusType } from "terse-types"
|
|
7
|
+
//
|
|
8
|
+
// import { fetchRunChatHistory, fetchRunHistory, readApiKeyOrBail, resolveAgentIdByJobName, resolveEventFromRunId } from "../api.js"
|
|
9
|
+
// import { CliError } from "../cliError.js"
|
|
10
|
+
// import { loadJob } from "../loadJob.js"
|
|
11
|
+
// import { LanguageProvider } from "../providers/LanguageProvider.js"
|
|
12
|
+
// import { resolveProvider } from "../providers/resolveProvider.js"
|
|
13
|
+
//
|
|
14
|
+
// import { type RunWithEvents, printRunChat, printRuns } from "./historyPrinters.js"
|
|
15
|
+
//
|
|
16
|
+
// const VALID_STATUSES = new Set<RunHistoryStatusType>(Object.values(RunHistoryStatus) as RunHistoryStatusType[])
|
|
17
|
+
// const MAX_PAGE_SIZE = 100
|
|
18
|
+
//
|
|
19
|
+
// export async function history(jobName?: string, options: HistoryOptions = {}, provider: LanguageProvider = resolveProvider()): Promise<void> {
|
|
20
|
+
// const apiKey = readApiKeyOrBail()
|
|
21
|
+
//
|
|
22
|
+
// // Single-run mode bypasses job/agent resolution.
|
|
23
|
+
// if (options.runId) {
|
|
24
|
+
// const chat = await fetchRunChatHistory(options.runId, apiKey)
|
|
25
|
+
// if (options.json) {
|
|
26
|
+
// process.stdout.write(JSON.stringify({ runId: options.runId, ...chat }, null, 2) + "\n")
|
|
27
|
+
// return
|
|
28
|
+
// }
|
|
29
|
+
// printRunChat(options.runId, chat)
|
|
30
|
+
// return
|
|
31
|
+
// }
|
|
32
|
+
//
|
|
33
|
+
// const { job } = await loadJob(provider, jobName)
|
|
34
|
+
//
|
|
35
|
+
// const spinner = options.json ? null : ora(`Fetching run history for ${job.name}`).start()
|
|
36
|
+
// let agentId: string | null
|
|
37
|
+
// try {
|
|
38
|
+
// agentId = await resolveAgentIdByJobName(job.name, apiKey)
|
|
39
|
+
// } catch (error) {
|
|
40
|
+
// spinner?.fail(chalk.red("Failed to look up job"))
|
|
41
|
+
// throw error
|
|
42
|
+
// }
|
|
43
|
+
//
|
|
44
|
+
// if (!agentId) {
|
|
45
|
+
// spinner?.fail(chalk.red(`Job "${job.name}" is not deployed`))
|
|
46
|
+
// throw new CliError("no_deployed_agent", `Job "${job.name}" is not deployed`, {
|
|
47
|
+
// detail: "Have you run `terse deploy` for this job?"
|
|
48
|
+
// })
|
|
49
|
+
// }
|
|
50
|
+
//
|
|
51
|
+
// const params = buildParams(options)
|
|
52
|
+
//
|
|
53
|
+
// const response = await fetchRunHistory(agentId, apiKey, params)
|
|
54
|
+
// let items: RunWithEvents[] = response.items
|
|
55
|
+
//
|
|
56
|
+
// // --triggers: cheap per-run fetch of just the input event JSON via /sdk/runs/:runId/trigger-event.
|
|
57
|
+
// // Implied by --events (which fetches the full chat history including the trigger payload).
|
|
58
|
+
// if (options.triggers && !options.events && items.length > 0) {
|
|
59
|
+
// if (spinner) spinner.text = `Fetching trigger events for ${items.length} run${items.length === 1 ? "" : "s"}`
|
|
60
|
+
// items = await Promise.all(
|
|
61
|
+
// items.map(async run => {
|
|
62
|
+
// const triggerEvent = await resolveEventFromRunId(run.id, apiKey)
|
|
63
|
+
// return triggerEvent ? { ...run, triggerEvent: triggerEvent.event } : run
|
|
64
|
+
// })
|
|
65
|
+
// )
|
|
66
|
+
// }
|
|
67
|
+
//
|
|
68
|
+
// // --events: full chat history per run (model events + trigger event). Heavier than --triggers.
|
|
69
|
+
// if (options.events && items.length > 0) {
|
|
70
|
+
// if (spinner) spinner.text = `Fetching chat events for ${items.length} run${items.length === 1 ? "" : "s"}`
|
|
71
|
+
// items = await Promise.all(
|
|
72
|
+
// items.map(async run => {
|
|
73
|
+
// try {
|
|
74
|
+
// const chat = await fetchRunChatHistory(run.id, apiKey)
|
|
75
|
+
// return { ...run, chat }
|
|
76
|
+
// } catch {
|
|
77
|
+
// return run
|
|
78
|
+
// }
|
|
79
|
+
// })
|
|
80
|
+
// )
|
|
81
|
+
// }
|
|
82
|
+
//
|
|
83
|
+
// spinner?.succeed(`Fetched ${items.length} of ${response.total} run${response.total === 1 ? "" : "s"} for ${job.name}`)
|
|
84
|
+
//
|
|
85
|
+
// if (options.json) {
|
|
86
|
+
// const payload = {
|
|
87
|
+
// jobName: job.name,
|
|
88
|
+
// agentId,
|
|
89
|
+
// page: response.page,
|
|
90
|
+
// pageSize: response.pageSize,
|
|
91
|
+
// total: response.total,
|
|
92
|
+
// items
|
|
93
|
+
// }
|
|
94
|
+
// process.stdout.write(JSON.stringify(payload, null, 2) + "\n")
|
|
95
|
+
// return
|
|
96
|
+
// }
|
|
97
|
+
//
|
|
98
|
+
// printRuns(job.name, agentId, items, response.total)
|
|
99
|
+
// }
|
|
100
|
+
//
|
|
101
|
+
// function buildParams(options: HistoryOptions): GetRunHistoryParams {
|
|
102
|
+
// const params: GetRunHistoryParams = {}
|
|
103
|
+
//
|
|
104
|
+
// if (options.query) params.q = options.query
|
|
105
|
+
// if (options.since) params.start = options.since
|
|
106
|
+
// if (options.until) params.end = options.until
|
|
107
|
+
// if (options.page && options.page > 0) params.page = options.page
|
|
108
|
+
// if (options.includeTest) params.includeTest = true
|
|
109
|
+
//
|
|
110
|
+
// if (options.limit && options.limit > 0) {
|
|
111
|
+
// params.pageSize = Math.min(options.limit, MAX_PAGE_SIZE)
|
|
112
|
+
// }
|
|
113
|
+
//
|
|
114
|
+
// if (options.status) {
|
|
115
|
+
// const statuses = options.status
|
|
116
|
+
// .split(",")
|
|
117
|
+
// .map(s => s.trim())
|
|
118
|
+
// .filter((s): s is RunHistoryStatusType => VALID_STATUSES.has(s as RunHistoryStatusType))
|
|
119
|
+
// if (statuses.length > 0) params.status = statuses
|
|
120
|
+
// }
|
|
121
|
+
//
|
|
122
|
+
// return params
|
|
123
|
+
// }
|
|
124
|
+
//
|
|
125
|
+
// // Types
|
|
126
|
+
//
|
|
127
|
+
// export type HistoryOptions = {
|
|
128
|
+
// json?: boolean
|
|
129
|
+
// limit?: number
|
|
130
|
+
// page?: number
|
|
131
|
+
// status?: string
|
|
132
|
+
// since?: string
|
|
133
|
+
// until?: string
|
|
134
|
+
// query?: string
|
|
135
|
+
// triggers?: boolean
|
|
136
|
+
// events?: boolean
|
|
137
|
+
// runId?: string
|
|
138
|
+
// includeTest?: boolean
|
|
139
|
+
// }
|
|
106
140
|
//# sourceMappingURL=history.js.map
|