@augurworks/augur 0.15.4 → 0.15.6
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/agents/README.md +5 -3
- package/package.json +1 -1
- package/scripts/connect.mjs +9 -2
- package/scripts/lib/store.mjs +21 -1
- package/src/_worker.js +11 -6
package/agents/README.md
CHANGED
|
@@ -32,9 +32,11 @@ signed in to and types the code; the token lands in `~/.config/augur/tokens.json
|
|
|
32
32
|
`augur ship` / `augur publish` use it from then on. `publish` runs the pairing itself when
|
|
33
33
|
it finds no token, so inside a workspace tree nothing has to be done first. On a workspace
|
|
34
34
|
that serves drafts (`/.well-known/augur.json` says `drafts.enabled`), the everyday verbs
|
|
35
|
-
are `augur open` and `augur land` instead — see [drafts.md](./drafts.md).
|
|
36
|
-
|
|
37
|
-
|
|
35
|
+
are `augur open` and `augur land` instead — see [drafts.md](./drafts.md). Where drafts
|
|
36
|
+
are served you need no tree at all: `augur open <opportunity>/<prototype>` fetches that one
|
|
37
|
+
prototype into a folder of its own (a cold agent that cloned a large workspace first spent
|
|
38
|
+
most of its first turn waiting). Elsewhere, `npx @augurworks/augur clone --space <id>` fetches
|
|
39
|
+
the tree — it reads the origin from the pairing.
|
|
38
40
|
|
|
39
41
|
The instance says all of this itself at `GET /llms.txt` (and as data at
|
|
40
42
|
`/.well-known/augur.json`); a signed-out request for an engine path answers `401` with
|
package/package.json
CHANGED
package/scripts/connect.mjs
CHANGED
|
@@ -112,8 +112,15 @@ if (NO_WAIT) {
|
|
|
112
112
|
process.exit(0);
|
|
113
113
|
}
|
|
114
114
|
console.log(` ${C.dim}You can stop waiting (Ctrl-C) and run \`augur connect\` again after they approve —`);
|
|
115
|
-
console.log(` it collects the token for this same code.
|
|
116
|
-
console.log(
|
|
115
|
+
console.log(` it collects the token for this same code.${C.off}`);
|
|
116
|
+
console.log("");
|
|
117
|
+
// Addressed to an agent, in the second person, because the polite version above was
|
|
118
|
+
// read and ignored: an agent whose person only sees its messages once it finishes its
|
|
119
|
+
// turn kept polling here for the code's whole life, twice, and nobody ever saw the code.
|
|
120
|
+
console.log(` ${C.warn}AGENTS: if your person reads your messages only after you finish, do not wait here.`);
|
|
121
|
+
console.log(` Stop now, send them the first line above, and run \`augur connect\` again once they say`);
|
|
122
|
+
console.log(` they have approved — it collects the token then. (\`augur connect --no-wait\` does`);
|
|
123
|
+
console.log(` exactly that in one step.)${C.off}`);
|
|
117
124
|
console.log("");
|
|
118
125
|
|
|
119
126
|
const deadline = Date.now() + (expiresInMs || 300000);
|
package/scripts/lib/store.mjs
CHANGED
|
@@ -39,10 +39,30 @@ export function resolveOrigin(root = ENGINE_ROOT) {
|
|
|
39
39
|
cwdSpaceOrigin = JSON.parse(readFileSync(path.join(process.cwd(), "space.json"), "utf8")).siteOrigin || "";
|
|
40
40
|
} catch (e) {}
|
|
41
41
|
return (process.env.AUGUR_ORIGIN || env.AUGUR_ORIGIN ||
|
|
42
|
-
deployConfig(root, originHost(cwdSpaceOrigin)).siteOrigin || cwdSpaceOrigin || "")
|
|
42
|
+
deployConfig(root, originHost(cwdSpaceOrigin)).siteOrigin || cwdSpaceOrigin || pairedOrigin() || "")
|
|
43
43
|
.replace(/\/+$/, "");
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
+
/**
|
|
47
|
+
* The origin this machine last paired with, when nothing else names one. A cold agent
|
|
48
|
+
* in an empty folder has just run `augur connect --origin X` and holds a token for X and
|
|
49
|
+
* nothing else — and `clone`/`open` then refused with "no target origin" until it typed
|
|
50
|
+
* AUGUR_ORIGIN, which the front door had told it the pairing would carry. One saved
|
|
51
|
+
* pairing is the answer; several is the most recent, said on stderr so a wrong guess is
|
|
52
|
+
* visible before anything is written.
|
|
53
|
+
*/
|
|
54
|
+
export function pairedOrigin() {
|
|
55
|
+
try {
|
|
56
|
+
const saved = JSON.parse(readFileSync(path.join(os.homedir(), ".config", "augur", "tokens.json"), "utf8"));
|
|
57
|
+
const hosts = Object.entries(saved).filter(([h, v]) => h && v && v.token);
|
|
58
|
+
if (!hosts.length) return "";
|
|
59
|
+
hosts.sort((a, b) => String(b[1].at || "").localeCompare(String(a[1].at || "")));
|
|
60
|
+
const [host] = hosts[0];
|
|
61
|
+
if (hosts.length > 1) console.error(`[augur] no origin named — using the last pairing, https://${host} (set AUGUR_ORIGIN to pick another)`);
|
|
62
|
+
return `https://${host}`;
|
|
63
|
+
} catch (e) { return ""; }
|
|
64
|
+
}
|
|
65
|
+
|
|
46
66
|
export function resolveToken(origin, root = ENGINE_ROOT) {
|
|
47
67
|
const env = readEnvFile(path.join(root, ".env.deploy"));
|
|
48
68
|
let token = process.env.AUGUR_TOKEN || env.AUGUR_TOKEN || "";
|
package/src/_worker.js
CHANGED
|
@@ -9133,12 +9133,17 @@ function doorText(f) {
|
|
|
9133
9133
|
+ ` ${f.connect}\n\n`
|
|
9134
9134
|
+ `It prints a link and a code. The owner of this workspace opens the link in a\n`
|
|
9135
9135
|
+ `browser they are already signed in to and enters the code. The token lands on\n`
|
|
9136
|
-
+ `that machine, and every verb below uses it from then on
|
|
9137
|
-
+ `
|
|
9138
|
-
+ `
|
|
9139
|
-
+ `
|
|
9140
|
-
+ `
|
|
9141
|
-
+ `the
|
|
9136
|
+
+ `that machine, and every verb below uses it from then on.\n\n`
|
|
9137
|
+
+ `AGENTS: if your person reads your messages only after you finish your turn, run\n`
|
|
9138
|
+
+ `it with --no-wait. It prints the line and exits; send them that line, end your\n`
|
|
9139
|
+
+ `turn, and run the same command again once they say they approved — the token is\n`
|
|
9140
|
+
+ `collected then, for that same code. Do not poll for the approval in one turn:\n`
|
|
9141
|
+
+ `the code lives five minutes and nobody sees it until you stop.\n\n`
|
|
9142
|
+
+ (f.drafts && f.drafts.enabled
|
|
9143
|
+
? `You need no source tree here: \`augur open <opportunity>/<prototype>\` fetches that one\n`
|
|
9144
|
+
+ `prototype into a folder of its own (see below). Do not clone the workspace first.\n\n`
|
|
9145
|
+
: `With no source tree yet, \`npx @augurworks/augur clone --space ${f.workspace}\` then fetches\n`
|
|
9146
|
+
+ `one (it reads the origin from the pairing).\n\n`)
|
|
9142
9147
|
: `Device pairing is switched off on this workspace. Ask an admin for an invite;\n`
|
|
9143
9148
|
+ `once you have signed in, \`augur login\` (email and password, meant for CI)\n`
|
|
9144
9149
|
+ `trades that for a publish token.\n\n`;
|