@carrieros/cli 0.4.0 → 0.4.1
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 +55 -2
- package/dist/commands/chat.js +3 -3
- package/dist/commands/doctor.js +10 -5
- package/dist/commands/logout.js +1 -0
- package/dist/commands/permissions.js +1 -0
- package/dist/commands/settings.js +76 -10
- package/dist/commands/update.js +102 -46
- package/dist/commands/usage.js +5 -3
- package/dist/commands/version.js +1 -3
- package/dist/ide/ide-session.js +20 -11
- package/dist/ide/tool-host.js +4 -4
- package/dist/main.js +10 -1
- package/dist/services/api.js +5 -3
- package/dist/services/auto-update.js +221 -0
- package/dist/services/client-tools.js +17 -13
- package/dist/services/coding-workflow.js +2 -2
- package/dist/services/config.js +31 -8
- package/dist/services/context.js +53 -8
- package/dist/services/device-auth.js +3 -1
- package/dist/services/login-flow.js +3 -3
- package/dist/services/meta.js +27 -0
- package/dist/services/permission-mode.js +20 -2
- package/dist/services/session-resolver.js +2 -0
- package/dist/services/update.js +420 -1
- package/dist/shell/shell-chat.js +27 -8
- package/dist/shell/shell-commands.js +1 -1
- package/dist/shell/shell.js +44 -19
- package/dist/ui/agent-presentation.js +1 -1
- package/dist/ui/command-registry.js +2 -2
- package/package.json +2 -1
|
@@ -188,7 +188,7 @@ export async function handleSlash(ctx, program, client, input) {
|
|
|
188
188
|
return STAY;
|
|
189
189
|
// One command: checks, and offers to install when something newer exists.
|
|
190
190
|
case "update":
|
|
191
|
-
await runUpdate();
|
|
191
|
+
await runUpdate({ config: ctx.config, busy: ctx.mainTurnRunning === true });
|
|
192
192
|
return STAY;
|
|
193
193
|
case "sources":
|
|
194
194
|
showSources(ctx);
|
package/dist/shell/shell.js
CHANGED
|
@@ -14,7 +14,8 @@ import { setCommandScope } from "../ui/command-item.js";
|
|
|
14
14
|
import { startScreen, stopScreen, screenScrollToBottom } from "../ui/screen.js";
|
|
15
15
|
import { ensureWorkspaceTrust } from "../ui/trust.js";
|
|
16
16
|
import { activeRepository, inWorkspaceMode, listRepositories } from "../services/workspace-registry.js";
|
|
17
|
-
import { cachedUpdateNotice,
|
|
17
|
+
import { cachedUpdateNotice, shouldRefreshCheck } from "../services/update.js";
|
|
18
|
+
import { AutoUpdater } from "../services/auto-update.js";
|
|
18
19
|
import { chatTypeLabel, loadModels, loadModes, showCarrierMaintenance, syncChatAvailability, loadFastModel } from "./shell-chat.js";
|
|
19
20
|
import { CARET, buildFooter } from "./shell-prompt.js";
|
|
20
21
|
import { dispatchLine, isMainTurn } from "./shell-router.js";
|
|
@@ -65,7 +66,9 @@ export async function runShell(ctx, program) {
|
|
|
65
66
|
// startScreen() has since switched to the alternate buffer, which hides them.
|
|
66
67
|
// Update notice comes from the PREVIOUS check — reading the cache is a
|
|
67
68
|
// property lookup, so the banner is never waiting on npm.
|
|
68
|
-
|
|
69
|
+
// The installed .exe keeps its banner notice; npm installs are announced by
|
|
70
|
+
// the AutoUpdater instead, once per version, between turns.
|
|
71
|
+
const notice = isPackaged() ? cachedUpdateNotice(ctx.config) : null;
|
|
69
72
|
renderWelcomeBanner(ctx, notice ? { notices: [notice] } : undefined);
|
|
70
73
|
if (inWorkspaceMode()) {
|
|
71
74
|
line(" " +
|
|
@@ -111,23 +114,33 @@ export async function runShell(ctx, program) {
|
|
|
111
114
|
// what was being done, as context only. No approval, mutation or command is
|
|
112
115
|
// restored — anything still needed is proposed and approved again.
|
|
113
116
|
await showTaskContext(client, ctx.config.get("sessionId"));
|
|
114
|
-
//
|
|
115
|
-
//
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
117
|
+
// Update notices wait until no turn is running, so a check that finishes
|
|
118
|
+
// mid-answer never prints into the middle of it.
|
|
119
|
+
const updateNotices = [];
|
|
120
|
+
let mainRunningForNotices = () => false;
|
|
121
|
+
const flushUpdateNotices = () => {
|
|
122
|
+
if (mainRunningForNotices())
|
|
123
|
+
return;
|
|
124
|
+
while (updateNotices.length)
|
|
125
|
+
line(" " + c.dim("ⓘ " + updateNotices.shift()));
|
|
126
|
+
};
|
|
127
|
+
// The installed .exe has no npm: it reads the release manifest, once a day,
|
|
128
|
+
// asynchronously. npm installs use the AutoUpdater: an async check at startup
|
|
129
|
+
// (when due) and on its interval, and a background install on exit.
|
|
130
|
+
let autoUpdater = null;
|
|
131
|
+
if (isPackaged()) {
|
|
132
|
+
if (shouldRefreshCheck(ctx.config)) {
|
|
133
|
+
setImmediate(() => void refreshPackagedUpdateCache(ctx.config).catch(() => undefined));
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
else {
|
|
137
|
+
try {
|
|
138
|
+
autoUpdater = new AutoUpdater({ config: ctx.config, dir: ctx.config.dir, notify: (m) => { updateNotices.push(m); flushUpdateNotices(); } });
|
|
139
|
+
autoUpdater.start();
|
|
140
|
+
}
|
|
141
|
+
catch {
|
|
142
|
+
autoUpdater = null; /* never let updates affect the session */
|
|
143
|
+
}
|
|
131
144
|
}
|
|
132
145
|
// Interactive loop driven by the composer/reader. Each iteration reads one
|
|
133
146
|
// line (with the slash palette overlay, the dim status footer, and a
|
|
@@ -147,6 +160,7 @@ export async function runShell(ctx, program) {
|
|
|
147
160
|
let mainTask = null;
|
|
148
161
|
let mainAbort = null;
|
|
149
162
|
const mainRunning = () => mainTask !== null;
|
|
163
|
+
mainRunningForNotices = mainRunning;
|
|
150
164
|
/**
|
|
151
165
|
* One message typed while a turn is still answering.
|
|
152
166
|
*
|
|
@@ -172,6 +186,7 @@ export async function runShell(ctx, program) {
|
|
|
172
186
|
mainTask = null;
|
|
173
187
|
mainAbort = null;
|
|
174
188
|
ctx.mainTurnRunning = false;
|
|
189
|
+
flushUpdateNotices();
|
|
175
190
|
if (queued !== null) {
|
|
176
191
|
const next = queued;
|
|
177
192
|
queued = null;
|
|
@@ -207,11 +222,21 @@ export async function runShell(ctx, program) {
|
|
|
207
222
|
if (process.stdout.isTTY && process.env.TERM !== "dumb")
|
|
208
223
|
process.stdout.write("\x1b[?25h");
|
|
209
224
|
renderExit(ctx.config.get("sessionId"));
|
|
225
|
+
// A release found during the session installs now, detached, after this
|
|
226
|
+
// process (and every other CLI window) has gone.
|
|
227
|
+
try {
|
|
228
|
+
if (autoUpdater?.onExit())
|
|
229
|
+
line(" " + c.dim("Installing CarrierOS CLI " + autoUpdater.pendingVersion + " in the background — it will be ready next time."));
|
|
230
|
+
}
|
|
231
|
+
catch {
|
|
232
|
+
/* never block leaving */
|
|
233
|
+
}
|
|
210
234
|
process.stdin.removeAllListeners("keypress");
|
|
211
235
|
process.stdin.removeAllListeners("data");
|
|
212
236
|
process.stdin.pause();
|
|
213
237
|
};
|
|
214
238
|
for (;;) {
|
|
239
|
+
flushUpdateNotices();
|
|
215
240
|
const placeholder = ctx.chatType === "carrier" && ctx.carrierMaintenance !== false
|
|
216
241
|
? ctx.carrierMaintenance === true
|
|
217
242
|
? "Carrier Chat is under maintenance · /switch standard"
|
|
@@ -20,7 +20,7 @@ export function workflowActivity(snapshot) {
|
|
|
20
20
|
return correction ? 'Applying correction' : 'Applying changes';
|
|
21
21
|
}
|
|
22
22
|
const names = { TASK_RECEIVED: 'Thinking', INSPECTING: 'Inspecting repository', PLANNING: 'Creating plan', CAPABILITY_CHECK: 'Checking execution capability', READING: correction ? 'Preparing correction' : 'Preparing changes', PROPOSING: 'Change proposed', AWAITING_APPROVAL: 'Waiting for change approval', APPLYING: correction ? 'Applying correction' : 'Applying changes', TESTING: 'Running validation', ANALYZING_FAILURE: 'Analyzing failure', CORRECTIVE_PROPOSAL: 'Correction proposed', CORRECTIVE_APPROVAL: 'Waiting for correction approval', REAPPLYING: 'Applying correction', RETESTING: 'Retesting', COMPLETED: 'Completed', FAILED: 'Failed', CANCELLED: 'Cancelled', UNRESOLVED: 'Unresolved' };
|
|
23
|
-
return names[state] ?? '
|
|
23
|
+
return names[state] ?? 'Thinking';
|
|
24
24
|
}
|
|
25
25
|
const commandLabel = (t) => typeof t.program === 'string' ? `${displayCommand(t.program, Array.isArray(t.args) ? t.args.map(String) : [])}${t.cwd && t.cwd !== '.' ? ` · ${t.cwd}` : ''}` : '';
|
|
26
26
|
/** The recorded analysis text, from the workflow's own "Failure analysis (…): …" line. */
|
|
@@ -78,7 +78,7 @@ export const COMMANDS = [
|
|
|
78
78
|
{ name: "/repos", desc: "Repositories in this workspace", group: "Context", rank: 4 },
|
|
79
79
|
{ name: "/whoami", desc: "Your signed-in account", group: "Account", rank: 1 },
|
|
80
80
|
{ name: "/usage", desc: "View API usage", group: "Account", rank: 2 },
|
|
81
|
-
{ name: "/settings", desc: "CLI settings —
|
|
81
|
+
{ name: "/settings", desc: "CLI settings — commands, updates, channel, update-interval", group: "Account", rank: 3, arg: "commands" },
|
|
82
82
|
{ name: "/login", desc: "Sign in via your browser", group: "Account", rank: 3 },
|
|
83
83
|
{ name: "/logout", desc: "Remove saved credentials", group: "Account", rank: 4 },
|
|
84
84
|
{ name: "/help", desc: "Show available commands", group: "Developer", rank: 1 },
|
|
@@ -87,7 +87,7 @@ export const COMMANDS = [
|
|
|
87
87
|
{ name: "/version", desc: "Show CLI version", group: "Developer", rank: 4 },
|
|
88
88
|
{
|
|
89
89
|
name: "/update",
|
|
90
|
-
desc: "Check for and install the latest CLI version",
|
|
90
|
+
desc: "Check for and install the latest CLI version (your update channel)",
|
|
91
91
|
group: "Developer",
|
|
92
92
|
rank: 5
|
|
93
93
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@carrieros/cli",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Carrier OS command-line interface — an interactive shell plus commands for the Carrier OS developer platform (chat, sessions, files, usage) over the public /v1 API.",
|
|
6
6
|
"type": "module",
|
|
@@ -24,6 +24,7 @@
|
|
|
24
24
|
"typecheck": "tsc --noEmit",
|
|
25
25
|
"test": "npm run build && node --test \"test/*.test.mjs\"",
|
|
26
26
|
"prepack": "npm run build",
|
|
27
|
+
"package:staging": "npm run build && node scripts/package-staging.mjs",
|
|
27
28
|
"test:pty": "npm run build && node test/acceptance/pty-selftest.mjs",
|
|
28
29
|
"test:execution": "npm run build && node scripts/validate-execution.mjs",
|
|
29
30
|
"test:acceptance": "npm run build && node test/acceptance/live-acceptance.mjs",
|