@standardagents/code 0.2.0 → 0.3.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 +6 -5
- package/dist/index.js +22 -7
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -91,14 +91,15 @@ standardcode --endpoint https://your-instance.example.com <dir>
|
|
|
91
91
|
standardcode -e -- <dir> # prompt for the endpoint for this run
|
|
92
92
|
```
|
|
93
93
|
|
|
94
|
-
On first run it
|
|
95
|
-
|
|
94
|
+
On first run it connects to the hosted Standard Code instance
|
|
95
|
+
(`https://api.standardcode.ai`) and walks you through a one-time browser sign-in — press
|
|
96
|
+
Enter, approve in the browser, and your key is stored in `~/.standardagents/credentials`.
|
|
97
|
+
You only do this once per machine. It then offers to **resume** a session tagged for this
|
|
96
98
|
project + machine, or **start a new one**.
|
|
97
99
|
|
|
98
100
|
Use `--endpoint [url]` or `-e [url]` to point a single CLI run at a different Standard Agents
|
|
99
|
-
instance. If you omit the URL, the CLI prompts for it. Tokens are
|
|
100
|
-
but this override does not change the saved default endpoint.
|
|
101
|
-
default endpoint or be prompted for one.
|
|
101
|
+
instance (local dev, self-hosted). If you omit the URL, the CLI prompts for it. Tokens are
|
|
102
|
+
remembered per endpoint, but this override does not change the saved default endpoint.
|
|
102
103
|
|
|
103
104
|
### Requirements
|
|
104
105
|
|
package/dist/index.js
CHANGED
|
@@ -3856,6 +3856,7 @@ function saveDefaultEndpoint(endpoint) {
|
|
|
3856
3856
|
// src/index.ts
|
|
3857
3857
|
var AGENT_ID = "standard_code_agent";
|
|
3858
3858
|
var AGENT_ID_VARIANTS = [AGENT_ID, "standard_code_high_agent"];
|
|
3859
|
+
var PRODUCTION_ENDPOINT = "https://api.standardcode.ai";
|
|
3859
3860
|
var c = {
|
|
3860
3861
|
reset: "\x1B[0m",
|
|
3861
3862
|
dim: "\x1B[2m",
|
|
@@ -3889,7 +3890,8 @@ function printUsage() {
|
|
|
3889
3890
|
" standardcode [options] [dir]",
|
|
3890
3891
|
"",
|
|
3891
3892
|
`${c.bold}Options${c.reset}`,
|
|
3892
|
-
" -e, --endpoint [url] Use a Standard Agents instance for this run
|
|
3893
|
+
" -e, --endpoint [url] Use a different Standard Agents instance for this run",
|
|
3894
|
+
" (default: https://api.standardcode.ai).",
|
|
3893
3895
|
" If url is omitted, prompt for it.",
|
|
3894
3896
|
" Credentials are remembered for that endpoint, but",
|
|
3895
3897
|
" the saved default endpoint is not changed.",
|
|
@@ -4103,7 +4105,7 @@ ${c.dim}Press Control-C again to exit${c.reset}
|
|
|
4103
4105
|
};
|
|
4104
4106
|
process.on("SIGINT", onPreflightSigint);
|
|
4105
4107
|
let endpointPrompted = false;
|
|
4106
|
-
let endpoint = endpointArg || (cliArgs.promptEndpoint ? "" : defaultEndpoint() ||
|
|
4108
|
+
let endpoint = endpointArg || (cliArgs.promptEndpoint ? "" : defaultEndpoint() || PRODUCTION_ENDPOINT);
|
|
4107
4109
|
if (!endpoint) {
|
|
4108
4110
|
endpoint = await askEndpoint();
|
|
4109
4111
|
endpointPrompted = true;
|
|
@@ -4134,17 +4136,24 @@ ${c.dim}Press Control-C again to exit${c.reset}
|
|
|
4134
4136
|
if (result.hint) stdout.write(` ${c.dim}${result.hint}${c.reset}
|
|
4135
4137
|
`);
|
|
4136
4138
|
};
|
|
4139
|
+
stdout.write(`${c.bold}${gradientText("Sign in to Standard Code")}${c.reset}
|
|
4140
|
+
`);
|
|
4141
|
+
if (`https://${host}` !== PRODUCTION_ENDPOINT) {
|
|
4142
|
+
stdout.write(`${c.dim}Connecting to${c.reset} ${c.teal}${host}${c.reset}
|
|
4143
|
+
`);
|
|
4144
|
+
}
|
|
4137
4145
|
stdout.write(
|
|
4138
|
-
`${c.
|
|
4146
|
+
`${c.dim}You'll only need to do this once on this machine.${c.reset}
|
|
4147
|
+
|
|
4139
4148
|
`
|
|
4140
4149
|
);
|
|
4141
4150
|
stdout.write(
|
|
4142
|
-
`${c.
|
|
4151
|
+
`${c.white}Press ${c.bold}Enter${c.reset}${c.white} to open your browser and sign in.${c.reset} ${c.dim}(or paste an API token)${c.reset}
|
|
4143
4152
|
|
|
4144
4153
|
`
|
|
4145
4154
|
);
|
|
4146
4155
|
for (; ; ) {
|
|
4147
|
-
const token = (await ask(`${c.teal}\u276F${c.reset}
|
|
4156
|
+
const token = (await ask(`${c.teal}\u276F${c.reset} `)).trim();
|
|
4148
4157
|
if (!token) {
|
|
4149
4158
|
const got = await deviceLogin(endpoint).catch((e) => {
|
|
4150
4159
|
stdout.write(`${c.red}\u2717${c.reset} ${c.dim}${e instanceof Error ? e.message : String(e)}${c.reset}
|
|
@@ -4250,9 +4259,13 @@ async function deviceLogin(endpoint) {
|
|
|
4250
4259
|
const start = await fetch(`${endpoint}/api/auth/device/start`, { method: "POST" });
|
|
4251
4260
|
if (!start.ok) throw new Error(`This instance does not support browser sign-in (HTTP ${start.status}). Paste an API token instead.`);
|
|
4252
4261
|
const info = await start.json();
|
|
4253
|
-
stdout.write(`${c.dim}Opening your browser to
|
|
4262
|
+
stdout.write(`${c.dim}Opening your browser to sign in. If it doesn't open, visit:${c.reset}
|
|
4254
4263
|
`);
|
|
4255
|
-
stdout.write(
|
|
4264
|
+
stdout.write(`
|
|
4265
|
+
${c.teal}${info.verify_url}${c.reset}
|
|
4266
|
+
|
|
4267
|
+
`);
|
|
4268
|
+
stdout.write(`${c.dim}Waiting for sign-in to complete\u2026 (Ctrl-C to cancel)${c.reset}
|
|
4256
4269
|
`);
|
|
4257
4270
|
openUrl(info.verify_url);
|
|
4258
4271
|
const deadline = Date.now() + (info.expires_in ?? 600) * 1e3;
|
|
@@ -4352,6 +4365,8 @@ async function runInteractive(tui, api, threadId, projectDir, machine, resumed,
|
|
|
4352
4365
|
saveApprovals(api, threadId, perm);
|
|
4353
4366
|
});
|
|
4354
4367
|
saveApprovals(api, threadId, perm);
|
|
4368
|
+
void api.kvSet(threadId, "session_info", { cwd: projectDir, machine }).catch(() => {
|
|
4369
|
+
});
|
|
4355
4370
|
let busy = false;
|
|
4356
4371
|
let interrupting = false;
|
|
4357
4372
|
const queued = [];
|