agent-coord-mcp 0.26.17 → 0.26.18
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/package.json +1 -1
- package/src/server.ts +2 -2
- package/src/tools/admin.ts +8 -1
- package/src/tools/away.ts +48 -4
- package/src/tools/records.ts +274 -18
- package/src/tools/rooms.ts +2 -1
- package/src/tools/shared.ts +18 -0
- package/src/tools/stall.ts +29 -1
- package/src/tools/transport.ts +12 -4
- package/src/tools/work.ts +70 -4
- package/src/tools/worktrees.ts +64 -2
- package/src/work.ts +4 -0
- package/dist/build.js +0 -113
- package/dist/build.js.map +0 -1
- package/dist/capabilities.js +0 -158
- package/dist/capabilities.js.map +0 -1
- package/dist/prefix.js +0 -64
- package/dist/prefix.js.map +0 -1
- package/dist/roles.js +0 -132
- package/dist/roles.js.map +0 -1
- package/dist/server-identity.js +0 -82
- package/dist/server-identity.js.map +0 -1
- package/dist/server.js +0 -646
- package/dist/server.js.map +0 -1
- package/dist/store.js +0 -553
- package/dist/store.js.map +0 -1
- package/dist/tools/admin.js +0 -317
- package/dist/tools/admin.js.map +0 -1
- package/dist/tools/attention.js +0 -73
- package/dist/tools/attention.js.map +0 -1
- package/dist/tools/away.js +0 -243
- package/dist/tools/away.js.map +0 -1
- package/dist/tools/board-ref.js +0 -208
- package/dist/tools/board-ref.js.map +0 -1
- package/dist/tools/event-kinds.js +0 -39
- package/dist/tools/event-kinds.js.map +0 -1
- package/dist/tools/events.js +0 -234
- package/dist/tools/events.js.map +0 -1
- package/dist/tools/index.js +0 -14
- package/dist/tools/index.js.map +0 -1
- package/dist/tools/logwatch.js +0 -85
- package/dist/tools/logwatch.js.map +0 -1
- package/dist/tools/messaging.js +0 -706
- package/dist/tools/messaging.js.map +0 -1
- package/dist/tools/record-events.js +0 -380
- package/dist/tools/record-events.js.map +0 -1
- package/dist/tools/records.js +0 -778
- package/dist/tools/records.js.map +0 -1
- package/dist/tools/registry.js +0 -500
- package/dist/tools/registry.js.map +0 -1
- package/dist/tools/render.js +0 -2
- package/dist/tools/render.js.map +0 -1
- package/dist/tools/rooms.js +0 -210
- package/dist/tools/rooms.js.map +0 -1
- package/dist/tools/rotate.js +0 -143
- package/dist/tools/rotate.js.map +0 -1
- package/dist/tools/scopes.js +0 -126
- package/dist/tools/scopes.js.map +0 -1
- package/dist/tools/shared.js +0 -86
- package/dist/tools/shared.js.map +0 -1
- package/dist/tools/stall.js +0 -387
- package/dist/tools/stall.js.map +0 -1
- package/dist/tools/transport.js +0 -1871
- package/dist/tools/transport.js.map +0 -1
- package/dist/tools/work.js +0 -319
- package/dist/tools/work.js.map +0 -1
- package/dist/tools/worktrees.js +0 -339
- package/dist/tools/worktrees.js.map +0 -1
- package/dist/typed-records.js +0 -174
- package/dist/typed-records.js.map +0 -1
- package/dist/work.js +0 -2
- package/dist/work.js.map +0 -1
package/dist/roles.js
DELETED
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
// Canonical role identity, server side (Phase 8 Task 4).
|
|
2
|
-
//
|
|
3
|
-
// MIRROR of hooks/roles.mjs — tsconfig's rootDir is `src`, so this cannot
|
|
4
|
-
// import the hook copy, and the hook copy must stay build-free (the pusher
|
|
5
|
-
// loads it from a bare checkout). test/roles.test.mjs asserts the two agree;
|
|
6
|
-
// change one, change the other.
|
|
7
|
-
//
|
|
8
|
-
// See hooks/roles.mjs for the rationale behind `explicit` and the word-match
|
|
9
|
-
// fallback.
|
|
10
|
-
import { z } from "zod";
|
|
11
|
-
export function slugifyRole(role) {
|
|
12
|
-
return String(role ?? "")
|
|
13
|
-
.trim()
|
|
14
|
-
.toLowerCase()
|
|
15
|
-
.replace(/[^a-z0-9]+/g, "-")
|
|
16
|
-
.replace(/^-+|-+$/g, "");
|
|
17
|
-
}
|
|
18
|
-
export const GATE_RUNNER_ROLE_IDS = new Set(["qa", "quality", "coordinator", "gate"]);
|
|
19
|
-
export const COORDINATOR_ROLE_IDS = new Set(["coordinator"]);
|
|
20
|
-
// CI receives express-lane DONE: wake. Not a gate-runner — must not grant verdict.
|
|
21
|
-
export const CI_ROLE_IDS = new Set(["ci"]);
|
|
22
|
-
// Console / watchers. May send prefixed messages. Not a gate-runner.
|
|
23
|
-
export const AUTOMATION_ROLE_IDS = new Set(["automation"]);
|
|
24
|
-
// A HUMAN READER. The one carve-out in the typed-record rule (Phase 5.1 Task
|
|
25
|
-
// 12.3): canon already rules "David-facing messages may use normal prose", and
|
|
26
|
-
// a blanket requirement would break the single channel whose reader is a
|
|
27
|
-
// person. `david` is here as well as `human` because the registry entry that
|
|
28
|
-
// exists on this bus today declares role "David" — the id derives to `david`,
|
|
29
|
-
// and a rule that only recognised the canonical spelling would have refused
|
|
30
|
-
// the exact traffic it is written to protect.
|
|
31
|
-
export const HUMAN_ROLE_IDS = new Set(["human", "david"]);
|
|
32
|
-
export function resolveRole(role) {
|
|
33
|
-
if (role === null || role === undefined)
|
|
34
|
-
return undefined;
|
|
35
|
-
if (typeof role === "string") {
|
|
36
|
-
const roleId = slugifyRole(role);
|
|
37
|
-
return roleId ? { roleId, displayName: role, explicit: false } : undefined;
|
|
38
|
-
}
|
|
39
|
-
if (typeof role === "object") {
|
|
40
|
-
const declared = typeof role.roleId === "string" ? slugifyRole(role.roleId) : "";
|
|
41
|
-
const name = typeof role.displayName === "string" && role.displayName
|
|
42
|
-
? role.displayName
|
|
43
|
-
: typeof role.role === "string" && role.role
|
|
44
|
-
? role.role
|
|
45
|
-
: undefined;
|
|
46
|
-
if (declared)
|
|
47
|
-
return { roleId: declared, displayName: name ?? declared, explicit: true };
|
|
48
|
-
if (name)
|
|
49
|
-
return resolveRole(name);
|
|
50
|
-
}
|
|
51
|
-
return undefined;
|
|
52
|
-
}
|
|
53
|
-
export function roleMatches(role, allowedIds) {
|
|
54
|
-
const resolved = resolveRole(role);
|
|
55
|
-
if (!resolved)
|
|
56
|
-
return false;
|
|
57
|
-
if (allowedIds.has(resolved.roleId))
|
|
58
|
-
return true;
|
|
59
|
-
// Word-split applies to DECLARED ids too. It used to be derived-only ("frozen
|
|
60
|
-
// ids match exactly"), which made precision cost authority: {roleId:"coord-qa"}
|
|
61
|
-
// was refused `verdict` while the vaguer bare string "coord-qa" passed via the
|
|
62
|
-
// split — a consumer fleet's QA verdicts were never machine-authorized (2026-08-21).
|
|
63
|
-
// Freezing still governs identity (the id cannot change); it must never grant
|
|
64
|
-
// LESS than the derived twin of the same spelling.
|
|
65
|
-
return resolved.roleId.split("-").some((word) => allowedIds.has(word));
|
|
66
|
-
}
|
|
67
|
-
// The canonical role vocabulary — every authority set plus the classes the
|
|
68
|
-
// cards register. Not an allowlist: any roleId may register; a non-canonical
|
|
69
|
-
// one gets a warning naming this set so the next card uses the exact spelling.
|
|
70
|
-
export const CANONICAL_ROLE_IDS = new Set([
|
|
71
|
-
"coordinator",
|
|
72
|
-
"worker",
|
|
73
|
-
"aide",
|
|
74
|
-
"qa",
|
|
75
|
-
"quality",
|
|
76
|
-
"gate",
|
|
77
|
-
"ci",
|
|
78
|
-
"audit",
|
|
79
|
-
"automation",
|
|
80
|
-
"human",
|
|
81
|
-
]);
|
|
82
|
-
export function isGateRunner(role) {
|
|
83
|
-
return roleMatches(role, GATE_RUNNER_ROLE_IDS);
|
|
84
|
-
}
|
|
85
|
-
export function isCoordinator(role) {
|
|
86
|
-
return roleMatches(role, COORDINATOR_ROLE_IDS);
|
|
87
|
-
}
|
|
88
|
-
export function isCi(role) {
|
|
89
|
-
return roleMatches(role, CI_ROLE_IDS);
|
|
90
|
-
}
|
|
91
|
-
export function isAutomation(role) {
|
|
92
|
-
return roleMatches(role, AUTOMATION_ROLE_IDS);
|
|
93
|
-
}
|
|
94
|
-
export function isHuman(role) {
|
|
95
|
-
return roleMatches(role, HUMAN_ROLE_IDS);
|
|
96
|
-
}
|
|
97
|
-
// Which roles may emit which record.type at the send path. Enforcement lives
|
|
98
|
-
// in messaging.ts (checkRecordAuthority); the table lives here so register/join
|
|
99
|
-
// can ECHO the consequence back at onboarding — a role that cannot emit `go`
|
|
100
|
-
// should learn it when it registers, not when it sends its first work order.
|
|
101
|
-
//
|
|
102
|
-
// NOT A TRUST BOUNDARY — roles are self-declared. See checkRecordAuthority.
|
|
103
|
-
export const RECORD_AUTHORITY = {
|
|
104
|
-
verdict: { roles: GATE_RUNNER_ROLE_IDS, label: "gate-runner" },
|
|
105
|
-
go: { roles: COORDINATOR_ROLE_IDS, label: "coordinator" },
|
|
106
|
-
scope: { roles: COORDINATOR_ROLE_IDS, label: "coordinator" },
|
|
107
|
-
};
|
|
108
|
-
// Split the restricted record types into what this role may and may not emit.
|
|
109
|
-
// Unrestricted types are omitted from both lists — they are nobody's business.
|
|
110
|
-
export function recordAuthorityFor(role) {
|
|
111
|
-
const mayEmit = [];
|
|
112
|
-
const mayNotEmit = [];
|
|
113
|
-
for (const [type, rule] of Object.entries(RECORD_AUTHORITY)) {
|
|
114
|
-
(roleMatches(role, rule.roles) ? mayEmit : mayNotEmit).push(type);
|
|
115
|
-
}
|
|
116
|
-
return { mayEmit, mayNotEmit };
|
|
117
|
-
}
|
|
118
|
-
// Wire shape for `role` on register/join. Either free text (v1: `role: "qa
|
|
119
|
-
// lead"`) or a declared identity (`{roleId: "qa", displayName: "QA gate"}`).
|
|
120
|
-
// Both are supported forever — the string form is not deprecated, it just
|
|
121
|
-
// leaves the id derived rather than frozen.
|
|
122
|
-
//
|
|
123
|
-
// Lives here rather than in tools/ because registry.ts and transport.ts import
|
|
124
|
-
// each other; a schema in either would be a temporal-dead-zone hazard.
|
|
125
|
-
export const roleInputSchema = z.union([
|
|
126
|
-
z.string(),
|
|
127
|
-
z.object({
|
|
128
|
-
roleId: z.string().min(1).optional(),
|
|
129
|
-
displayName: z.string().min(1).optional(),
|
|
130
|
-
}),
|
|
131
|
-
]);
|
|
132
|
-
//# sourceMappingURL=roles.js.map
|
package/dist/roles.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"roles.js","sourceRoot":"","sources":["../src/roles.ts"],"names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;CAC7D,CAAC;AAEF,8EAA8E;AAC9E,+EAA+E;AAC/E,MAAM,UAAU,kBAAkB,CAAC,IAAe;IAChD,MAAM,OAAO,GAAa,EAAE,CAAC;IAC7B,MAAM,UAAU,GAAa,EAAE,CAAC;IAChC,KAAK,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,gBAAgB,CAAC,EAAE,CAAC;QAC5D,CAAC,WAAW,CAAC,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACpE,CAAC;IACD,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,CAAC;AACjC,CAAC;AAED,2EAA2E;AAC3E,6EAA6E;AAC7E,0EAA0E;AAC1E,4CAA4C;AAC5C,EAAE;AACF,+EAA+E;AAC/E,uEAAuE;AACvE,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC;IACrC,CAAC,CAAC,MAAM,EAAE;IACV,CAAC,CAAC,MAAM,CAAC;QACP,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;QACpC,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;KAC1C,CAAC;CACH,CAAC,CAAC"}
|
package/dist/server-identity.js
DELETED
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* WHICH SERVER PACKAGE IS RUNNING — a LEAF module, importing nothing from
|
|
3
|
-
* `tools/`.
|
|
4
|
-
*
|
|
5
|
-
* It lived in `transport.ts`, and `capabilities.ts` imported it from there. The
|
|
6
|
-
* moment `status` needs to REPORT capabilities, that becomes
|
|
7
|
-
* transport -> capabilities -> transport: a cycle, and the same one Task 9
|
|
8
|
-
* produced when the kind registry sat inside `record-events.ts`. That one only
|
|
9
|
-
* worked because `tools/index.ts` happened to import in the surviving order —
|
|
10
|
-
* a load-ORDER dependency, invisible until something imported a module
|
|
11
|
-
* directly, which is what a consumer or a test does.
|
|
12
|
-
*
|
|
13
|
-
* A cycle that works by luck is not a working cycle, so the shared fact moves
|
|
14
|
-
* out rather than the edge being added on top of it.
|
|
15
|
-
*
|
|
16
|
-
* NOTE WHAT THIS REPORTS AND WHAT IT DOES NOT. `version` is the label in the
|
|
17
|
-
* package.json this process loaded from — CONTEXT for a reader, never evidence
|
|
18
|
-
* of a capability. A published tarball has already been observed carrying a
|
|
19
|
-
* change its version said it could not. Capability questions are answered by
|
|
20
|
-
* `capabilities`, which CALLS the code.
|
|
21
|
-
*/
|
|
22
|
-
import { existsSync, readFileSync } from "node:fs";
|
|
23
|
-
import { spawnSync } from "node:child_process";
|
|
24
|
-
import path from "node:path";
|
|
25
|
-
import { fileURLToPath } from "node:url";
|
|
26
|
-
import { isGitRepo } from "./tools/scopes.js";
|
|
27
|
-
/** Running server package + optional git identity. `fromDir` is a test seam. */
|
|
28
|
-
export function resolveServerIdentity(fromDir) {
|
|
29
|
-
const start = fromDir ?? path.dirname(fileURLToPath(import.meta.url));
|
|
30
|
-
let dir = start;
|
|
31
|
-
let pkgFile;
|
|
32
|
-
for (let i = 0; i < 8; i++) {
|
|
33
|
-
const candidate = path.join(dir, "package.json");
|
|
34
|
-
if (existsSync(candidate)) {
|
|
35
|
-
pkgFile = candidate;
|
|
36
|
-
break;
|
|
37
|
-
}
|
|
38
|
-
const parent = path.dirname(dir);
|
|
39
|
-
if (parent === dir)
|
|
40
|
-
break;
|
|
41
|
-
dir = parent;
|
|
42
|
-
}
|
|
43
|
-
const pkgPath = pkgFile ?? path.resolve(start, "..", "..", "package.json");
|
|
44
|
-
const pkgDir = path.dirname(pkgPath);
|
|
45
|
-
let version = "unknown";
|
|
46
|
-
try {
|
|
47
|
-
const raw = JSON.parse(readFileSync(pkgPath, "utf8"));
|
|
48
|
-
if (typeof raw.version === "string" && raw.version)
|
|
49
|
-
version = raw.version;
|
|
50
|
-
}
|
|
51
|
-
catch {
|
|
52
|
-
/* leave unknown — never invent a version */
|
|
53
|
-
}
|
|
54
|
-
const out = {
|
|
55
|
-
path: pkgDir,
|
|
56
|
-
version,
|
|
57
|
-
};
|
|
58
|
-
dir = pkgDir;
|
|
59
|
-
let gitRoot;
|
|
60
|
-
for (let i = 0; i < 10; i++) {
|
|
61
|
-
if (existsSync(path.join(dir, ".git"))) {
|
|
62
|
-
gitRoot = dir;
|
|
63
|
-
break;
|
|
64
|
-
}
|
|
65
|
-
const parent = path.dirname(dir);
|
|
66
|
-
if (parent === dir)
|
|
67
|
-
break;
|
|
68
|
-
dir = parent;
|
|
69
|
-
}
|
|
70
|
-
if (gitRoot && isGitRepo(gitRoot)) {
|
|
71
|
-
const branch = spawnSync("git", ["-C", gitRoot, "rev-parse", "--abbrev-ref", "HEAD"], { encoding: "utf8" });
|
|
72
|
-
const sha = spawnSync("git", ["-C", gitRoot, "rev-parse", "HEAD"], { encoding: "utf8" });
|
|
73
|
-
const b = branch.status === 0 ? String(branch.stdout).trim() : "";
|
|
74
|
-
const s = sha.status === 0 ? String(sha.stdout).trim() : "";
|
|
75
|
-
if (b)
|
|
76
|
-
out.branch = b;
|
|
77
|
-
if (s)
|
|
78
|
-
out.sha = s;
|
|
79
|
-
}
|
|
80
|
-
return out;
|
|
81
|
-
}
|
|
82
|
-
//# sourceMappingURL=server-identity.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"server-identity.js","sourceRoot":"","sources":["../src/server-identity.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,a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