feat(discord): git verbs for the Discord Sage on the shared-signals root, seat identity through a package credential helper, vault record protocol (#1509)
Row 24. A writable root that is a git work tree may carry a git object in the binding; the seat then has git_status, git_commit (explicit paths, seat author, Requested-by trailer from the envelope requester, push at once per D6), git_pull (ff-only) and git_push (one branch, never force), plus reserve_id and per-write clone locks under protocol vault. Git children run with no host config and one credential helper, bin/git-credential.mjs, reading the 0600 seat token file named in the binding; the fleet helper serves only the Gitea hosts. Suite 58/58, node 143. rev-code-02 APPROVED round 1 (#1509 comment 26375, tree 82ab962f). Co-Authored-By: Claude Fable 5.1 <[email protected]>
This commit is contained in:
@@ -57,6 +57,30 @@ test("context: the envelope is one bracketed line then the text; names cannot br
|
||||
assert.equal(head, '[discord server="S x" channel="#c" thread="t" author=1 message=2]');
|
||||
assert.deepEqual(rest, ["hi", "there"]);
|
||||
assert.match(envelope({ guildName: "g", channelName: "c", authorId: "1", messageId: "2", text: "x" }), /thread=none/);
|
||||
// The requester is the author's server name; quotes and brackets cannot close it early.
|
||||
const r = envelope({ guildName: "g", channelName: "c", authorId: "1", requester: 'Ja "son" ]x', messageId: "2", text: "x" });
|
||||
assert.equal(r.split("\n")[0], '[discord server="g" channel="#c" thread=none author=1 requester="Ja son x" message=2]');
|
||||
});
|
||||
|
||||
test("context: a git root swaps the terminal-commit line for the git verbs, and a vault root adds the id protocol", () => {
|
||||
const tokenFile = join(makeRoot(), "token");
|
||||
writeFileSync(tokenFile, "not_a_real_token_just_a_test_value_x\n", { mode: 0o600 });
|
||||
const git = { branch: "main", identity: "sage", tokenFile, author: "Sage <s@x>" };
|
||||
const roots = [{ name: "stack-docs", path: "/r/docs", write: false }, { name: "shared-signals", path: "/r/ss", write: true, git }];
|
||||
const block = discordContextBlock(binding({ tools: { roots, maxCallsPerTurn: 12 } }));
|
||||
assert.match(block, /In "shared-signals" you also have git_status, git_commit, git_pull and git_push/);
|
||||
assert.match(block, /naming exactly the files you changed, and it pushes at once/);
|
||||
assert.match(block, /End the reply with the commit hash, and say plainly if the push failed/);
|
||||
assert.match(block, /Never commit files you did not change/);
|
||||
assert.doesNotMatch(block, /Jason commits it from the terminal/);
|
||||
assert.doesNotMatch(block, /reserve_id/);
|
||||
assert.ok(!block.includes(tokenFile), "the token path stays out of the prompt");
|
||||
assert.doesNotMatch(block, /sage@|<s@x>/, "the author email stays out of the prompt");
|
||||
const vault = discordContextBlock(binding({ tools: { roots: [roots[0], { ...roots[1], git: { ...git, protocol: "vault" } }], maxCallsPerTurn: 12 } }));
|
||||
assert.match(vault, /"shared-signals" follows a record protocol: before creating a new record, call reserve_id/);
|
||||
assert.match(vault, /commit docs\/ID-REGISTRY.txt together with the record/);
|
||||
assert.match(vault, /refused while the record validator fails/);
|
||||
assert.match(vault, /the author's name as this server knows them \(requester\)/);
|
||||
});
|
||||
|
||||
test("context: assembleContext concatenates files in launcher format and appends the block; sha256 is stable", () => {
|
||||
|
||||
Reference in New Issue
Block a user