@aui.io/apollo 0.1.60 → 0.1.65
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/node_modules/@aui.io/apollo-cli/dist/src/commands/bundles.js +236 -93
- package/node_modules/@aui.io/apollo-cli/dist/src/commands/bundles.js.map +1 -1
- package/node_modules/@aui.io/apollo-cli/dist/src/commands/operate.js +4 -1
- package/node_modules/@aui.io/apollo-cli/dist/src/commands/operate.js.map +1 -1
- package/node_modules/@aui.io/apollo-cli/dist/src/commands/runtime-version.js +22 -1
- package/node_modules/@aui.io/apollo-cli/dist/src/commands/runtime-version.js.map +1 -1
- package/node_modules/@aui.io/apollo-cli/dist/src/commands/status.js +19 -1
- package/node_modules/@aui.io/apollo-cli/dist/src/commands/status.js.map +1 -1
- package/node_modules/@aui.io/apollo-cli/package.json +3 -3
- package/node_modules/@aui.io/apollo-core/dist/src/api/agent-settings.d.ts +1 -1
- package/node_modules/@aui.io/apollo-core/dist/src/api/builder-api.d.ts +117 -41
- package/node_modules/@aui.io/apollo-core/dist/src/api/builder-api.js +26 -25
- package/node_modules/@aui.io/apollo-core/dist/src/api/builder-api.js.map +1 -1
- package/node_modules/@aui.io/apollo-core/dist/src/api/runtime-api.d.ts +0 -18
- package/node_modules/@aui.io/apollo-core/dist/src/api/runtime-api.js +0 -8
- package/node_modules/@aui.io/apollo-core/dist/src/api/runtime-api.js.map +1 -1
- package/node_modules/@aui.io/apollo-core/dist/src/config/types.d.ts +1 -1
- package/node_modules/@aui.io/apollo-core/dist/src/errors/index.d.ts +30 -0
- package/node_modules/@aui.io/apollo-core/dist/src/errors/index.js +47 -0
- package/node_modules/@aui.io/apollo-core/dist/src/errors/index.js.map +1 -1
- package/node_modules/@aui.io/apollo-core/dist/src/index.d.ts +4 -3
- package/node_modules/@aui.io/apollo-core/dist/src/index.js +3 -2
- package/node_modules/@aui.io/apollo-core/dist/src/index.js.map +1 -1
- package/node_modules/@aui.io/apollo-core/dist/src/output/index.d.ts +4 -0
- package/node_modules/@aui.io/apollo-core/dist/src/output/index.js +8 -0
- package/node_modules/@aui.io/apollo-core/dist/src/output/index.js.map +1 -1
- package/node_modules/@aui.io/apollo-core/dist/src/runtime-version/availability.d.ts +81 -0
- package/node_modules/@aui.io/apollo-core/dist/src/runtime-version/availability.js +260 -0
- package/node_modules/@aui.io/apollo-core/dist/src/runtime-version/availability.js.map +1 -0
- package/node_modules/@aui.io/apollo-core/dist/src/runtime-version/index.d.ts +7 -0
- package/node_modules/@aui.io/apollo-core/dist/src/runtime-version/index.js +2 -1
- package/node_modules/@aui.io/apollo-core/dist/src/runtime-version/index.js.map +1 -1
- package/node_modules/@aui.io/apollo-core/dist/src/services/builds.d.ts +5 -8
- package/node_modules/@aui.io/apollo-core/dist/src/services/builds.js +5 -7
- package/node_modules/@aui.io/apollo-core/dist/src/services/builds.js.map +1 -1
- package/node_modules/@aui.io/apollo-core/dist/src/services/bundles.d.ts +7 -11
- package/node_modules/@aui.io/apollo-core/dist/src/services/bundles.js +22 -18
- package/node_modules/@aui.io/apollo-core/dist/src/services/bundles.js.map +1 -1
- package/node_modules/@aui.io/apollo-core/dist/src/services/clients.d.ts +1 -1
- package/node_modules/@aui.io/apollo-core/dist/src/services/doctor.js +64 -2
- package/node_modules/@aui.io/apollo-core/dist/src/services/doctor.js.map +1 -1
- package/node_modules/@aui.io/apollo-core/dist/src/services/runs.d.ts +84 -0
- package/node_modules/@aui.io/apollo-core/dist/src/services/runs.js +186 -0
- package/node_modules/@aui.io/apollo-core/dist/src/services/runs.js.map +1 -0
- package/node_modules/@aui.io/apollo-core/dist/src/services/status.service.d.ts +8 -0
- package/node_modules/@aui.io/apollo-core/dist/src/services/status.service.js +15 -0
- package/node_modules/@aui.io/apollo-core/dist/src/services/status.service.js.map +1 -1
- package/node_modules/@aui.io/apollo-core/package.json +1 -1
- package/node_modules/@aui.io/apollo-tui/dist/src/lib/actions.d.ts +10 -1
- package/node_modules/@aui.io/apollo-tui/dist/src/lib/actions.js +42 -5
- package/node_modules/@aui.io/apollo-tui/dist/src/lib/actions.js.map +1 -1
- package/node_modules/@aui.io/apollo-tui/dist/src/lib/commands.d.ts +3 -1
- package/node_modules/@aui.io/apollo-tui/dist/src/lib/commands.js +2 -2
- package/node_modules/@aui.io/apollo-tui/dist/src/lib/commands.js.map +1 -1
- package/node_modules/@aui.io/apollo-tui/package.json +2 -2
- package/package.json +4 -4
- package/node_modules/@aui.io/apollo-core/dist/src/services/evaluations.d.ts +0 -42
- package/node_modules/@aui.io/apollo-core/dist/src/services/evaluations.js +0 -106
- package/node_modules/@aui.io/apollo-core/dist/src/services/evaluations.js.map +0 -1
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
import { mkdir, readFile, writeFile } from "node:fs/promises";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { readBuildFiles } from "../bundle/build-area.js";
|
|
4
|
+
import { CliError, ConfigError } from "../errors/index.js";
|
|
5
|
+
import { agentRoot, readCheckoutTree, requireAgent } from "./bundles.js";
|
|
6
|
+
/**
|
|
7
|
+
* The two proving lanes' console half
|
|
8
|
+
* (builder/flow/regressions-and-evaluations-plan.md phase 5): ship the
|
|
9
|
+
* checkout's current tree — the program under `src/**`, the records under
|
|
10
|
+
* `build/**` — and the server runs it against the shipped snapshot. A
|
|
11
|
+
* REGRESSION drives `build/scenarios.yaml` through the simulator, nobody
|
|
12
|
+
* improvising; an EVALUATION plans improvising callers from guidelines and
|
|
13
|
+
* ends on a macro verdict. No session exists; polling IS the progress
|
|
14
|
+
* surface. The last run's id per lane is a LOCAL fact in the checkout's
|
|
15
|
+
* `.apollo/<kind>.json`, so `--status`, `--cancel`, `--pull` and
|
|
16
|
+
* `--annotate` name nothing and still find their run.
|
|
17
|
+
*/
|
|
18
|
+
/** Run statuses that are still moving — everything else is the verdict. */
|
|
19
|
+
const RUN_LIVE = new Set(["queued", "running", "cancelling"]);
|
|
20
|
+
/** A run is real conversations plus judge calls — hours-scale like a
|
|
21
|
+
* build, so the poll loop's own deadline is generous; each poll request
|
|
22
|
+
* stays cheap. */
|
|
23
|
+
export const RUN_DEADLINE_MS = 2 * 3600_000;
|
|
24
|
+
const RUN_POLL_MS = 5_000;
|
|
25
|
+
function runStateFile(root, kind) {
|
|
26
|
+
return path.join(root, ".apollo", `${kind}.json`);
|
|
27
|
+
}
|
|
28
|
+
/** The saved run handle, or nothing — a missing or corrupt file simply
|
|
29
|
+
* means there is no run to name. The pre-phase-5 evaluation file carried
|
|
30
|
+
* `evaluation_id`; it still reads. */
|
|
31
|
+
export async function readRunState(root, kind) {
|
|
32
|
+
try {
|
|
33
|
+
const parsed = JSON.parse(await readFile(runStateFile(root, kind), "utf8"));
|
|
34
|
+
const id = typeof parsed.run_id === "string" ? parsed.run_id : parsed.evaluation_id;
|
|
35
|
+
return typeof id === "string" ? { run_id: id, kind } : undefined;
|
|
36
|
+
}
|
|
37
|
+
catch {
|
|
38
|
+
return undefined;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
export async function writeRunState(root, state) {
|
|
42
|
+
const file = runStateFile(root, state.kind);
|
|
43
|
+
await mkdir(path.dirname(file), { recursive: true });
|
|
44
|
+
await writeFile(file, `${JSON.stringify(state, null, 2)}\n`, "utf8");
|
|
45
|
+
}
|
|
46
|
+
/** The id a receipt carries — an evaluation's `evaluation_id`, a
|
|
47
|
+
* regression's `regression_id`. */
|
|
48
|
+
export function receiptId(receipt) {
|
|
49
|
+
const id = receipt.regression_id ?? receipt.evaluation_id;
|
|
50
|
+
if (!id)
|
|
51
|
+
throw new CliError("The server's receipt named no run.");
|
|
52
|
+
return id;
|
|
53
|
+
}
|
|
54
|
+
/** Every file under `<root>/bundle/build/**` as `build/**` wire paths.
|
|
55
|
+
* Absent directory reads as an empty map: the server names the missing
|
|
56
|
+
* file (422), which teaches more than a local guess. */
|
|
57
|
+
async function readBuildTree(buildDir) {
|
|
58
|
+
const { files } = await readBuildFiles(buildDir);
|
|
59
|
+
return Object.fromEntries(Object.entries(files).map(([relativePath, content]) => [
|
|
60
|
+
`build/${relativePath}`,
|
|
61
|
+
content.toString("utf8"),
|
|
62
|
+
]));
|
|
63
|
+
}
|
|
64
|
+
async function checkoutTree(root) {
|
|
65
|
+
return {
|
|
66
|
+
...(await readCheckoutTree(path.join(root, "bundle", "src"))),
|
|
67
|
+
...(await readBuildTree(path.join(root, "bundle", "build"))),
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Start one detached evaluation over this checkout and save its id. The
|
|
72
|
+
* tree is frozen at accept — keep editing, the run's bytes do not move.
|
|
73
|
+
*/
|
|
74
|
+
export async function startEvaluation(context, builder, options) {
|
|
75
|
+
const root = options.root ?? agentRoot(context);
|
|
76
|
+
const guidelines = options.guidelines.trim();
|
|
77
|
+
if (!guidelines) {
|
|
78
|
+
throw new ConfigError("An evaluation needs guidelines — what to evaluate, in plain words.", 'Example: apollo evaluate "the refund refusal path after this change".');
|
|
79
|
+
}
|
|
80
|
+
const versionTag = options.versionTag ?? context.versionTag;
|
|
81
|
+
const receipt = await builder.startEvaluation({
|
|
82
|
+
agent_id: requireAgent(context),
|
|
83
|
+
files: await checkoutTree(root),
|
|
84
|
+
guidelines,
|
|
85
|
+
...(options.config && Object.keys(options.config).length ? { config: options.config } : {}),
|
|
86
|
+
...(options.message ? { message: options.message } : {}),
|
|
87
|
+
...(versionTag ? { version_tag: versionTag } : {}),
|
|
88
|
+
});
|
|
89
|
+
await writeRunState(root, { run_id: receiptId(receipt), kind: "evaluation" });
|
|
90
|
+
return receipt;
|
|
91
|
+
}
|
|
92
|
+
/** Start one detached regression over this checkout and save its id. */
|
|
93
|
+
export async function startRegression(context, builder, options = {}) {
|
|
94
|
+
const root = options.root ?? agentRoot(context);
|
|
95
|
+
const versionTag = options.versionTag ?? context.versionTag;
|
|
96
|
+
const receipt = await builder.startRegression({
|
|
97
|
+
agent_id: requireAgent(context),
|
|
98
|
+
files: await checkoutTree(root),
|
|
99
|
+
...(options.scenarios?.length ? { scenarios: options.scenarios } : {}),
|
|
100
|
+
...(options.judge ? { judge: true } : {}),
|
|
101
|
+
...(options.message ? { message: options.message } : {}),
|
|
102
|
+
...(versionTag ? { version_tag: versionTag } : {}),
|
|
103
|
+
});
|
|
104
|
+
await writeRunState(root, { run_id: receiptId(receipt), kind: "regression" });
|
|
105
|
+
return receipt;
|
|
106
|
+
}
|
|
107
|
+
/** Poll one run to its terminal view (completed, failed or cancelled). */
|
|
108
|
+
export async function awaitRun(builder, kind, runId, options = {}) {
|
|
109
|
+
const sleep = options.sleep ?? ((ms) => new Promise((resolve) => setTimeout(resolve, ms)));
|
|
110
|
+
const interval = options.pollIntervalMs ?? RUN_POLL_MS;
|
|
111
|
+
const deadline = Date.now() + (options.deadlineMs ?? RUN_DEADLINE_MS);
|
|
112
|
+
for (;;) {
|
|
113
|
+
const view = await builder.runView(kind, runId);
|
|
114
|
+
if (!RUN_LIVE.has(view.status))
|
|
115
|
+
return view;
|
|
116
|
+
if (Date.now() >= deadline) {
|
|
117
|
+
// The run keeps executing server-side; the saved id still names it.
|
|
118
|
+
throw new CliError(`The ${kind} is still running (${runId}).`, {
|
|
119
|
+
suggestion: `\`apollo ${verb(kind)} --status\` picks the report up later.`,
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
await sleep(interval);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
/** The CLI verb per lane. */
|
|
126
|
+
export function verb(kind) {
|
|
127
|
+
return kind === "regression" ? "regress" : "evaluate";
|
|
128
|
+
}
|
|
129
|
+
/** The run the caller means: the explicit id, else the checkout's saved
|
|
130
|
+
* last run of that lane — no run at all is a config story, not a 404. */
|
|
131
|
+
export async function resolveRunId(context, kind, explicit, root) {
|
|
132
|
+
if (explicit)
|
|
133
|
+
return explicit;
|
|
134
|
+
const saved = await readRunState(root ?? agentRoot(context), kind);
|
|
135
|
+
if (!saved) {
|
|
136
|
+
throw new ConfigError(`No ${kind} to name — this checkout has not started one.`, `Run \`apollo ${verb(kind)}\` first, or pass --id.`);
|
|
137
|
+
}
|
|
138
|
+
return saved.run_id;
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Fetch a settled run's evidence and write it under the checkout —
|
|
142
|
+
* `tmp/regressions/<id>/` or `tmp/evaluations/<id>/`, the layout the
|
|
143
|
+
* builder writes in a session, so a CLI author and a builder session read
|
|
144
|
+
* the same files. `tmp/**` never ships; a re-pull overwrites.
|
|
145
|
+
*/
|
|
146
|
+
export async function pullRun(context, builder, kind, runId, options = {}) {
|
|
147
|
+
const root = path.resolve(options.root ?? agentRoot(context));
|
|
148
|
+
const artifacts = await builder.runArtifacts(kind, runId, options.all ?? true);
|
|
149
|
+
const written = [];
|
|
150
|
+
for (const [relativePath, content] of Object.entries(artifacts.files)) {
|
|
151
|
+
const target = insideTmp(root, relativePath);
|
|
152
|
+
await mkdir(path.dirname(target), { recursive: true });
|
|
153
|
+
await writeFile(target, content, "utf8");
|
|
154
|
+
written.push(relativePath);
|
|
155
|
+
}
|
|
156
|
+
return {
|
|
157
|
+
directory: insideTmp(root, artifacts.root),
|
|
158
|
+
files: written.sort(),
|
|
159
|
+
note: artifacts.note,
|
|
160
|
+
};
|
|
161
|
+
}
|
|
162
|
+
/** A server-named artifact path must live under `tmp/` inside the
|
|
163
|
+
* checkout — anything else is refused before a byte is written. */
|
|
164
|
+
function insideTmp(root, relativePath) {
|
|
165
|
+
const normalized = relativePath.split("\\").join("/");
|
|
166
|
+
if (!normalized.startsWith("tmp/") || normalized.split("/").includes("..")) {
|
|
167
|
+
throw new CliError(`Refusing to write outside tmp/: ${relativePath}`);
|
|
168
|
+
}
|
|
169
|
+
const target = path.resolve(root, normalized);
|
|
170
|
+
if (!target.startsWith(`${path.join(root, "tmp")}${path.sep}`)) {
|
|
171
|
+
throw new CliError(`Refusing to write outside tmp/: ${relativePath}`);
|
|
172
|
+
}
|
|
173
|
+
return target;
|
|
174
|
+
}
|
|
175
|
+
/** Append one reading to a settled run; the server answers the run as it
|
|
176
|
+
* now reads. */
|
|
177
|
+
export function annotateRun(builder, kind, runId, annotation) {
|
|
178
|
+
const text = annotation.text.trim();
|
|
179
|
+
if (!text)
|
|
180
|
+
throw new ConfigError("An annotation needs some text.");
|
|
181
|
+
return builder.annotateRun(kind, runId, {
|
|
182
|
+
text,
|
|
183
|
+
...(annotation.verdict ? { verdict: annotation.verdict } : {}),
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
//# sourceMappingURL=runs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runs.js","sourceRoot":"","sources":["../../../src/services/runs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC9D,OAAO,IAAI,MAAM,WAAW,CAAC;AAW7B,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAEzD,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAEzE;;;;;;;;;;;GAWG;AAEH,2EAA2E;AAC3E,MAAM,QAAQ,GAAG,IAAI,GAAG,CAAC,CAAC,QAAQ,EAAE,SAAS,EAAE,YAAY,CAAC,CAAC,CAAC;AAE9D;;mBAEmB;AACnB,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,GAAG,QAAQ,CAAC;AAE5C,MAAM,WAAW,GAAG,KAAK,CAAC;AAO1B,SAAS,YAAY,CAAC,IAAY,EAAE,IAAa;IAC/C,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,SAAS,EAAE,GAAG,IAAI,OAAO,CAAC,CAAC;AACpD,CAAC;AAED;;uCAEuC;AACvC,MAAM,CAAC,KAAK,UAAU,YAAY,CAAC,IAAY,EAAE,IAAa;IAC5D,IAAI,CAAC;QACH,MAAM,MAAM,GAA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C,IAAI;QAAE,MAAM,IAAI,WAAW,CAAC,gCAAgC,CAAC,CAAC;IACnE,OAAO,OAAO,CAAC,WAAW,CAAC,IAAI,EAAE,KAAK,EAAE;QACtC,IAAI;QACJ,GAAG,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,UAAU,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KAC/D,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Context } from "../config/index.js";
|
|
2
|
+
import { type RuntimePinCheck } from "../runtime-version/availability.js";
|
|
2
3
|
export interface ServiceCheck {
|
|
3
4
|
service: "identity" | "management" | "runtime";
|
|
4
5
|
reachable: boolean;
|
|
@@ -20,8 +21,15 @@ export interface StatusResult {
|
|
|
20
21
|
bindingPath: string | null;
|
|
21
22
|
agentRoot: string | null;
|
|
22
23
|
checks?: ServiceCheck[];
|
|
24
|
+
/**
|
|
25
|
+
* With `--check` on a pinned checkout: whether the pinned runtime is still
|
|
26
|
+
* served (the family may be retired, or the gateway may route the pin to
|
|
27
|
+
* a different engine). Absent when unpinned or without `--check`.
|
|
28
|
+
*/
|
|
29
|
+
runtimePinned?: RuntimePinCheck;
|
|
23
30
|
}
|
|
24
31
|
export declare function getStatus(context: Context, options?: {
|
|
25
32
|
check?: boolean;
|
|
26
33
|
fetch?: typeof globalThis.fetch;
|
|
34
|
+
homeDir?: string;
|
|
27
35
|
}): Promise<StatusResult>;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { Transport } from "../api/transport.js";
|
|
2
2
|
import { ApiError, AuthError } from "../errors/index.js";
|
|
3
|
+
import { checkRuntimeAvailability, } from "../runtime-version/availability.js";
|
|
3
4
|
import { RUNTIME_VERSION_HEADER } from "../runtime-version/index.js";
|
|
5
|
+
import { createClients } from "./clients.js";
|
|
4
6
|
export async function getStatus(context, options = {}) {
|
|
5
7
|
const result = {
|
|
6
8
|
environment: context.environment,
|
|
@@ -22,6 +24,19 @@ export async function getStatus(context, options = {}) {
|
|
|
22
24
|
checkManagement(context, options.fetch),
|
|
23
25
|
checkRuntime(context, options.fetch),
|
|
24
26
|
]);
|
|
27
|
+
if (context.runtimeVersion) {
|
|
28
|
+
const clients = createClients(context, {
|
|
29
|
+
...(options.homeDir ? { homeDir: options.homeDir } : {}),
|
|
30
|
+
...(options.fetch ? { fetch: options.fetch } : {}),
|
|
31
|
+
});
|
|
32
|
+
const pinned = await checkRuntimeAvailability(context, clients, {
|
|
33
|
+
...(options.fetch ? { fetch: options.fetch } : {}),
|
|
34
|
+
...(options.homeDir ? { homeDir: options.homeDir } : {}),
|
|
35
|
+
withoutCatalog: "probe",
|
|
36
|
+
});
|
|
37
|
+
if (pinned)
|
|
38
|
+
result.runtimePinned = pinned;
|
|
39
|
+
}
|
|
25
40
|
}
|
|
26
41
|
return result;
|
|
27
42
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"status.service.js","sourceRoot":"","sources":["../../../src/services/status.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAEhD,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"status.service.js","sourceRoot":"","sources":["../../../src/services/status.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAEhD,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,EACL,wBAAwB,GAEzB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AACrE,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAgC7C,MAAM,CAAC,KAAK,UAAU,SAAS,CAC7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M,EAAE,KAAK,CAAC,OAAO;aACtB,CAAC;QACJ,CAAC;QACD,IAAI,KAAK,YAAY,SAAS,EAAE,CAAC;YAC/B,OAAO;gBACL,OAAO;gBACP,SAAS,EAAE,KAAK;gBAChB,aAAa,EAAE,KAAK;gBACpB,MAAM,EAAE,KAAK,CAAC,OAAO;aACtB,CAAC;QACJ,CAAC;QACD,OAAO;YACL,OAAO;YACP,SAAS,EAAE,KAAK;YAChB,aAAa,EAAE,IAAI;YACnB,MAAM,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,eAAe;SACjE,CAAC;IACJ,CAAC;AACH,CAAC;AAED,SAAS,WAAW,CAAC,KAAyB;IAC5C,MAAM,OAAO,GAAG,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;IACrC,IAAI,OAAO,KAAK,SAAS;QAAE,OAAO,IAAI,CAAC;IACvC,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CACvB,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,CAC9B,CAAC;QACvB,OAAO,OAAO,MAAM,CAAC,GAAG,KAAK,QAAQ;YACnC,CAAC,CAAC,IAAI,IAAI,CAAC,MAAM,CAAC,GAAG,GAAG,IAAI,CAAC,CAAC,WAAW,EAAE;YAC3C,CAAC,CAAC,IAAI,CAAC;IACX,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type Agent, type AgentVersion } from "@aui.io/apollo-core/api/management.js";
|
|
1
|
+
import { type Agent, type AgentVersion, type ManagementClient } from "@aui.io/apollo-core/api/management.js";
|
|
2
2
|
import { type Context } from "@aui.io/apollo-core/config/index.js";
|
|
3
3
|
import type { CommandField } from "./commands.js";
|
|
4
4
|
import type { PickerItem } from "./picker.js";
|
|
@@ -51,6 +51,15 @@ export interface ActionResult {
|
|
|
51
51
|
}
|
|
52
52
|
/** Label prefix for the live row in the import version picker (UI keys off it). */
|
|
53
53
|
export declare const IMPORT_LIVE_PREFIX = "live \u2014 ";
|
|
54
|
+
/**
|
|
55
|
+
* The pull sheet's tag row → what `pullCheckout` is asked for. "bound" (the
|
|
56
|
+
* default) is a bare `apollo pull`: no tag, so core pulls the checkout's
|
|
57
|
+
* `.apollorc` pin and follows it to the tip of its major line. "latest
|
|
58
|
+
* (live)" is the published version, resolved to its real tag the way
|
|
59
|
+
* version-use does — the literal word used to fall through to the bound
|
|
60
|
+
* pin, so the row did not do what it said. Anything else is a tag as typed.
|
|
61
|
+
*/
|
|
62
|
+
export declare function pullTagFor(selected: string, context: Context, management: Pick<ManagementClient, "getAgent" | "listVersions">): Promise<string | undefined>;
|
|
54
63
|
/**
|
|
55
64
|
* Version rows for the import picker: the live version first (row 0 = the
|
|
56
65
|
* picker default) when one exists, else just the tags — the caller shows
|
|
@@ -70,6 +70,27 @@ function orgIdOf(org) {
|
|
|
70
70
|
}
|
|
71
71
|
/** Label prefix for the live row in the import version picker (UI keys off it). */
|
|
72
72
|
export const IMPORT_LIVE_PREFIX = "live — ";
|
|
73
|
+
/**
|
|
74
|
+
* The pull sheet's tag row → what `pullCheckout` is asked for. "bound" (the
|
|
75
|
+
* default) is a bare `apollo pull`: no tag, so core pulls the checkout's
|
|
76
|
+
* `.apollorc` pin and follows it to the tip of its major line. "latest
|
|
77
|
+
* (live)" is the published version, resolved to its real tag the way
|
|
78
|
+
* version-use does — the literal word used to fall through to the bound
|
|
79
|
+
* pin, so the row did not do what it said. Anything else is a tag as typed.
|
|
80
|
+
*/
|
|
81
|
+
export async function pullTagFor(selected, context, management) {
|
|
82
|
+
if (!selected || selected === "bound")
|
|
83
|
+
return undefined;
|
|
84
|
+
if (selected !== "latest")
|
|
85
|
+
return selected;
|
|
86
|
+
if (!context.agentId)
|
|
87
|
+
throw new ConfigError("Select an agent first.");
|
|
88
|
+
const agent = await management.getAgent(context.agentId);
|
|
89
|
+
const live = findLiveVersion(agent, (await management.listVersions(context.agentId)).results);
|
|
90
|
+
if (!live)
|
|
91
|
+
throw new ConfigError("No live version — pick a tag.");
|
|
92
|
+
return live.version_tag;
|
|
93
|
+
}
|
|
73
94
|
/**
|
|
74
95
|
* Version rows for the import picker: the live version first (row 0 = the
|
|
75
96
|
* picker default) when one exists, else just the tags — the caller shows
|
|
@@ -174,6 +195,20 @@ export async function loadPickerCatalog(kind, context) {
|
|
|
174
195
|
...page.results.map((v) => item(v.version_tag, v.version_tag, v.status)),
|
|
175
196
|
];
|
|
176
197
|
}
|
|
198
|
+
case "pull-version": {
|
|
199
|
+
// What a bare `apollo pull` does, spelled out: the checkout's pin,
|
|
200
|
+
// which core follows to the tip of its major line when it is stale.
|
|
201
|
+
// The bound tag is what the CLI would print in `status`; the row's
|
|
202
|
+
// detail says where the pull actually lands.
|
|
203
|
+
const rows = [];
|
|
204
|
+
if (context.versionTag) {
|
|
205
|
+
rows.push(item("bound", `bound · ${context.versionTag}`, "follows .apollorc · default"));
|
|
206
|
+
}
|
|
207
|
+
rows.push(item("latest", "latest (live)", "the published version"));
|
|
208
|
+
const page = await listVersions(context, clients.management);
|
|
209
|
+
rows.push(...page.results.map((v) => item(v.version_tag, v.version_tag, v.status)));
|
|
210
|
+
return rows;
|
|
211
|
+
}
|
|
177
212
|
case "runtime": {
|
|
178
213
|
const resolved = await resolveRuntimeVersion(clients.agentSettings);
|
|
179
214
|
return resolved.options.map((option) => item(option.latest_version, `${option.display_name} · ${option.latest_version}`, option.latest_version === context.runtimeVersion
|
|
@@ -880,12 +915,12 @@ export async function runSheetAction(commandName, values, context) {
|
|
|
880
915
|
};
|
|
881
916
|
}
|
|
882
917
|
case "pull": {
|
|
883
|
-
const tag = text("tag");
|
|
918
|
+
const tag = await pullTagFor(text("tag"), context, clients.management);
|
|
884
919
|
const dir = text("dir");
|
|
885
920
|
const force = values.force === true;
|
|
886
921
|
try {
|
|
887
922
|
const result = await pullCheckout(context, clients, {
|
|
888
|
-
...(tag
|
|
923
|
+
...(tag ? { tag } : {}),
|
|
889
924
|
...(dir ? { destination: dir } : {}),
|
|
890
925
|
force,
|
|
891
926
|
});
|
|
@@ -895,7 +930,7 @@ export async function runSheetAction(commandName, values, context) {
|
|
|
895
930
|
const on = result.runtimeVersion ? ` on ${result.runtimeVersion}` : "";
|
|
896
931
|
return {
|
|
897
932
|
jumpTab: "bundle",
|
|
898
|
-
toast: `Pulled ${Object.keys(result.files).length} file(s)${on}${removed}`,
|
|
933
|
+
toast: `Pulled ${Object.keys(result.files).length} file(s) @ ${result.pull.version_tag}${on}${removed}`,
|
|
899
934
|
refreshScope: true,
|
|
900
935
|
};
|
|
901
936
|
}
|
|
@@ -1284,10 +1319,12 @@ export async function runDestructive(action, context, args = {}) {
|
|
|
1284
1319
|
return { jumpTab: "mockdb", toast: "Deleted mock DB" };
|
|
1285
1320
|
}
|
|
1286
1321
|
case "pull-force": {
|
|
1322
|
+
// `args.tag` is the tag the pull sheet already resolved (a picked row
|
|
1323
|
+
// or the live tag); absent means the bound pin, as in the first try.
|
|
1287
1324
|
const tag = args.tag ?? "";
|
|
1288
1325
|
const dir = args.dir ?? "";
|
|
1289
1326
|
const result = await pullCheckout(context, clients, {
|
|
1290
|
-
...(tag
|
|
1327
|
+
...(tag ? { tag } : {}),
|
|
1291
1328
|
...(dir ? { destination: dir } : {}),
|
|
1292
1329
|
force: true,
|
|
1293
1330
|
});
|
|
@@ -1297,7 +1334,7 @@ export async function runDestructive(action, context, args = {}) {
|
|
|
1297
1334
|
const on = result.runtimeVersion ? ` on ${result.runtimeVersion}` : "";
|
|
1298
1335
|
return {
|
|
1299
1336
|
jumpTab: "bundle",
|
|
1300
|
-
toast: `Force-pulled ${Object.keys(result.files).length} file(s)${on}${removed}`,
|
|
1337
|
+
toast: `Force-pulled ${Object.keys(result.files).length} file(s) @ ${result.pull.version_tag}${on}${removed}`,
|
|
1301
1338
|
refreshScope: true,
|
|
1302
1339
|
};
|
|
1303
1340
|
}
|