@standardagents/code 0.6.2 → 0.6.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +53 -19
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -305,6 +305,20 @@ var ApiClient = class {
|
|
|
305
305
|
} catch {
|
|
306
306
|
}
|
|
307
307
|
}
|
|
308
|
+
/** Mint a pre-authed standardcode.ai account-dashboard URL for this thread's
|
|
309
|
+
* user. Returns null when the chain is unavailable — the caller falls back
|
|
310
|
+
* to the plain dashboard URL (sign-in by inbox link). */
|
|
311
|
+
async accountLink(threadId) {
|
|
312
|
+
try {
|
|
313
|
+
const res = await this.json(
|
|
314
|
+
`/api/threads/${threadId}/account_link`,
|
|
315
|
+
{ method: "POST" }
|
|
316
|
+
);
|
|
317
|
+
return res?.url ? { url: res.url, preauthed: res.preauthed === true } : null;
|
|
318
|
+
} catch {
|
|
319
|
+
return null;
|
|
320
|
+
}
|
|
321
|
+
}
|
|
308
322
|
// ── skills (instance-global Agent Skills library) ─────────────────────────
|
|
309
323
|
/** Installed skills — metadata only. Includes disabled skills. */
|
|
310
324
|
async listSkills() {
|
|
@@ -3185,27 +3199,32 @@ var Tui = class _Tui {
|
|
|
3185
3199
|
const cols2 = Math.max(20, process.stdout.columns || 80);
|
|
3186
3200
|
const bg = "\x1B[48;5;238m";
|
|
3187
3201
|
const limit = Math.max(8, cols2 - 6);
|
|
3188
|
-
const
|
|
3189
|
-
|
|
3190
|
-
|
|
3191
|
-
|
|
3192
|
-
|
|
3193
|
-
|
|
3194
|
-
|
|
3195
|
-
cur
|
|
3202
|
+
const wrapLine = (logical) => {
|
|
3203
|
+
const words = logical.replace(/[^\S\n]+/g, " ").trim().split(" ").filter(Boolean);
|
|
3204
|
+
if (!words.length) return [""];
|
|
3205
|
+
const out = [];
|
|
3206
|
+
let cur = "";
|
|
3207
|
+
for (let w of words) {
|
|
3208
|
+
while (w.length > limit) {
|
|
3209
|
+
if (cur) {
|
|
3210
|
+
out.push(cur);
|
|
3211
|
+
cur = "";
|
|
3212
|
+
}
|
|
3213
|
+
out.push(w.slice(0, limit));
|
|
3214
|
+
w = w.slice(limit);
|
|
3215
|
+
}
|
|
3216
|
+
if (!cur) cur = w;
|
|
3217
|
+
else if (cur.length + 1 + w.length <= limit) cur += " " + w;
|
|
3218
|
+
else {
|
|
3219
|
+
out.push(cur);
|
|
3220
|
+
cur = w;
|
|
3196
3221
|
}
|
|
3197
|
-
lines.push(w.slice(0, limit));
|
|
3198
|
-
w = w.slice(limit);
|
|
3199
|
-
}
|
|
3200
|
-
if (!cur) cur = w;
|
|
3201
|
-
else if (cur.length + 1 + w.length <= limit) cur += " " + w;
|
|
3202
|
-
else {
|
|
3203
|
-
lines.push(cur);
|
|
3204
|
-
cur = w;
|
|
3205
3222
|
}
|
|
3206
|
-
|
|
3207
|
-
|
|
3208
|
-
|
|
3223
|
+
if (cur || !out.length) out.push(cur);
|
|
3224
|
+
return out;
|
|
3225
|
+
};
|
|
3226
|
+
const lines = text.replace(/\r\n?/g, "\n").split("\n").flatMap(wrapLine);
|
|
3227
|
+
const innerW = 2 + Math.max(1, ...lines.map((l) => l.length));
|
|
3209
3228
|
this.print("");
|
|
3210
3229
|
lines.forEach((line, i) => {
|
|
3211
3230
|
const rowText = (i === 0 ? "\u276F " : " ") + line;
|
|
@@ -5129,6 +5148,15 @@ ${c.bold}why: ${req.requestPermission}${c.reset}` : ""}`,
|
|
|
5129
5148
|
tui.print(`${c.red}\u2717${c.reset} couldn't start compaction: ${err.message}`);
|
|
5130
5149
|
}
|
|
5131
5150
|
};
|
|
5151
|
+
const runAccountCommand = async () => {
|
|
5152
|
+
tui.print(`${c.gray}Opening your account\u2026${c.reset}`);
|
|
5153
|
+
const link = await api.accountLink(threadId).catch(() => null);
|
|
5154
|
+
const target = link?.url ?? "https://standardcode.ai/account";
|
|
5155
|
+
openUrl(target);
|
|
5156
|
+
tui.print(
|
|
5157
|
+
link?.preauthed ? `${c.gray}\u2192 account dashboard opened in your browser (signed in)${c.reset}` : `${c.gray}\u2192 opened ${target} \u2014 sign in with your account email${c.reset}`
|
|
5158
|
+
);
|
|
5159
|
+
};
|
|
5132
5160
|
const skillsCtl = {
|
|
5133
5161
|
list: () => api.listSkills(),
|
|
5134
5162
|
setEnabled: (name, enabled) => api.setSkillEnabled(name, enabled),
|
|
@@ -5180,6 +5208,12 @@ ${c.bold}why: ${req.requestPermission}${c.reset}` : ""}`,
|
|
|
5180
5208
|
hint: "list / install / manage",
|
|
5181
5209
|
run: () => runSkillsMenu(tui, skillsCtl)
|
|
5182
5210
|
},
|
|
5211
|
+
{
|
|
5212
|
+
name: "account",
|
|
5213
|
+
label: "Manage your account",
|
|
5214
|
+
hint: "billing & sessions, opens in browser",
|
|
5215
|
+
run: () => runAccountCommand()
|
|
5216
|
+
},
|
|
5183
5217
|
{ name: "background", label: "Background processes", hint: "list / stop", run: () => runProcessMenu(tui, bgMgr) },
|
|
5184
5218
|
{ name: "keybindings", label: "Keyboard shortcuts", run: () => showKeybindings(tui) },
|
|
5185
5219
|
{ name: "update", label: "Check for updates", hint: "check for a newer version", run: () => runUpdateCommand(tui) },
|