borgmcp 0.9.55 → 0.9.56
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/regen-format.d.ts +19 -0
- package/dist/regen-format.d.ts.map +1 -1
- package/dist/regen-format.js +55 -1
- package/dist/regen-format.js.map +1 -1
- package/dist/role-section.d.ts +110 -0
- package/dist/role-section.d.ts.map +1 -0
- package/dist/role-section.js +207 -0
- package/dist/role-section.js.map +1 -0
- package/dist/templates.d.ts.map +1 -1
- package/dist/templates.js +17 -3
- package/dist/templates.js.map +1 -1
- package/package.json +1 -1
package/dist/regen-format.d.ts
CHANGED
|
@@ -58,6 +58,25 @@ export declare function parseRationalePointer(stub: string): {
|
|
|
58
58
|
role: string;
|
|
59
59
|
section: string;
|
|
60
60
|
} | null;
|
|
61
|
+
/**
|
|
62
|
+
* gh#496-A(b) — compress a role's `detailed_description` for rendering.
|
|
63
|
+
*
|
|
64
|
+
* Splits the role text into sections (via the client port of the worker's
|
|
65
|
+
* `parseRoleSections`, parity-guarded) and replaces each `… rationale:`
|
|
66
|
+
* plain-label section's BODY with a one-line on-demand stub
|
|
67
|
+
* (`formatRationalePointer(role, heading)` verbatim — heading sans colon).
|
|
68
|
+
* Every other section — preamble, operational-rule sections, and ALL woven
|
|
69
|
+
* safety-discipline text — is emitted INLINE, fetch-free. No content is lost:
|
|
70
|
+
* `getRoleRationale(role, heading)` serves the full section on demand, so
|
|
71
|
+
* core-inline + Σ(every stub resolved) reconstructs the stored text.
|
|
72
|
+
*
|
|
73
|
+
* ⛔ SAFETY-NEVER-COMPRESS: a section is stubbed ONLY when (a) its heading,
|
|
74
|
+
* sans-colon/trimmed/lowercased, ends with `rationale`, AND (b) its body
|
|
75
|
+
* contains NONE of `ALL_SAFETY_DISCIPLINES`. Any ambiguity (a safety string
|
|
76
|
+
* present, or simply not a `rationale:` heading) fails safe to INLINE — a
|
|
77
|
+
* wrongly-compressed LIVE rule is the catastrophic mode, so we over-include.
|
|
78
|
+
*/
|
|
79
|
+
export declare function compressRoleText(roleName: string, detailedDescription: string | null | undefined): string;
|
|
61
80
|
export declare function formatRegenMarkdown(result: {
|
|
62
81
|
cube: any & {
|
|
63
82
|
directive_hash?: string | null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"regen-format.d.ts","sourceRoot":"","sources":["../src/regen-format.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;
|
|
1
|
+
{"version":3,"file":"regen-format.d.ts","sourceRoot":"","sources":["../src/regen-format.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAQH;;;;;;;;;;;;;GAaG;AACH,wBAAgB,gBAAgB,IAAI,MAAM,CA0FzC;AAED;;;;GAIG;AACH,eAAO,MAAM,cAAc,QAAqB,CAAC;AAEjD;;GAEG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM,GAAG,MAAM,CAYpD;AAED;;;;;;;GAOG;AACH;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,eAAe,EAAE,OAAO,GAAG,MAAM,CAMhE;AAED,wBAAgB,uBAAuB,CACrC,MAAM,EAAE;IAAE,KAAK,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,CAAA;CAAE,EAC7C,gBAAgB,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAC1C,MAAM,GAAG,IAAI,CAEf;AAED,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG,MAAM,CAAC;AAMxC,wBAAgB,wBAAwB,IAAI,IAAI,CAI/C;AAUD,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAE5E;AAED,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAQ5F;AAWD;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,gBAAgB,CAC9B,QAAQ,EAAE,MAAM,EAChB,mBAAmB,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAC7C,MAAM,CAgBR;AAED,wBAAgB,mBAAmB,CACjC,MAAM,EAAE;IACN,IAAI,EAAE,GAAG,GAAG;QAAE,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,CAAC;IAC/C,IAAI,EAAE,GAAG,GAAG;QAAE,yBAAyB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,CAAC;IAC1D,KAAK,EAAE,GAAG,CAAC;IACX,KAAK,EAAE,GAAG,EAAE,CAAC;IACb,MAAM,EAAE,GAAG,EAAE,CAAC;IACd,SAAS,EAAE,GAAG,EAAE,CAAC;CAClB,EACD,IAAI,GAAE;IAAE,IAAI,CAAC,EAAE,SAAS,CAAA;CAAO,GAC9B,MAAM,CAkHR;AAED,wBAAgB,sBAAsB,CACpC,KAAK,EAAE,GAAG,EACV,SAAS,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,EAC3B,QAAQ,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,GACzB,MAAM,CASR"}
|
package/dist/regen-format.js
CHANGED
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
* index.ts's stdio MCP server bootstrap.
|
|
7
7
|
*/
|
|
8
8
|
import { ROLE_SCOPED_SAFETY_DISCIPLINES, UNIVERSAL_SAFETY_DISCIPLINES, } from './templates.js';
|
|
9
|
+
import { parseRoleSections } from './role-section.js';
|
|
9
10
|
/**
|
|
10
11
|
* Build the universal drone playbook.
|
|
11
12
|
*
|
|
@@ -189,6 +190,52 @@ export function parseRationalePointer(stub) {
|
|
|
189
190
|
return null;
|
|
190
191
|
}
|
|
191
192
|
}
|
|
193
|
+
/** The full safety-discipline corpus — a `… rationale:` section is NEVER
|
|
194
|
+
* compressed if its body contains ANY of these (⛔ safety-never-compress
|
|
195
|
+
* fail-safe). Over-inclusive on purpose: checks ALL role-scoped disciplines,
|
|
196
|
+
* not just the role's own, so a wrongly-placed LIVE rule can never be stubbed. */
|
|
197
|
+
const ALL_SAFETY_DISCIPLINES = [
|
|
198
|
+
...UNIVERSAL_SAFETY_DISCIPLINES,
|
|
199
|
+
...ROLE_SCOPED_SAFETY_DISCIPLINES,
|
|
200
|
+
];
|
|
201
|
+
/**
|
|
202
|
+
* gh#496-A(b) — compress a role's `detailed_description` for rendering.
|
|
203
|
+
*
|
|
204
|
+
* Splits the role text into sections (via the client port of the worker's
|
|
205
|
+
* `parseRoleSections`, parity-guarded) and replaces each `… rationale:`
|
|
206
|
+
* plain-label section's BODY with a one-line on-demand stub
|
|
207
|
+
* (`formatRationalePointer(role, heading)` verbatim — heading sans colon).
|
|
208
|
+
* Every other section — preamble, operational-rule sections, and ALL woven
|
|
209
|
+
* safety-discipline text — is emitted INLINE, fetch-free. No content is lost:
|
|
210
|
+
* `getRoleRationale(role, heading)` serves the full section on demand, so
|
|
211
|
+
* core-inline + Σ(every stub resolved) reconstructs the stored text.
|
|
212
|
+
*
|
|
213
|
+
* ⛔ SAFETY-NEVER-COMPRESS: a section is stubbed ONLY when (a) its heading,
|
|
214
|
+
* sans-colon/trimmed/lowercased, ends with `rationale`, AND (b) its body
|
|
215
|
+
* contains NONE of `ALL_SAFETY_DISCIPLINES`. Any ambiguity (a safety string
|
|
216
|
+
* present, or simply not a `rationale:` heading) fails safe to INLINE — a
|
|
217
|
+
* wrongly-compressed LIVE rule is the catastrophic mode, so we over-include.
|
|
218
|
+
*/
|
|
219
|
+
export function compressRoleText(roleName, detailedDescription) {
|
|
220
|
+
const text = detailedDescription ?? '';
|
|
221
|
+
const sections = parseRoleSections(text);
|
|
222
|
+
return sections
|
|
223
|
+
.map((section) => {
|
|
224
|
+
if (section.kind !== 'label' || section.heading == null)
|
|
225
|
+
return section.body;
|
|
226
|
+
const isRationale = section.heading.trim().toLowerCase().endsWith('rationale');
|
|
227
|
+
if (!isRationale)
|
|
228
|
+
return section.body;
|
|
229
|
+
// ⛔ fail-safe: never stub a section carrying any safety-discipline text.
|
|
230
|
+
if (ALL_SAFETY_DISCIPLINES.some((d) => section.body.includes(d)))
|
|
231
|
+
return section.body;
|
|
232
|
+
// Preserve the heading line verbatim; replace the rationale body with the stub.
|
|
233
|
+
const nlIdx = section.body.indexOf('\n');
|
|
234
|
+
const headingLine = nlIdx === -1 ? section.body + '\n' : section.body.slice(0, nlIdx + 1);
|
|
235
|
+
return headingLine + formatRationalePointer(roleName, section.heading) + '\n';
|
|
236
|
+
})
|
|
237
|
+
.join('');
|
|
238
|
+
}
|
|
192
239
|
export function formatRegenMarkdown(result, opts = {}) {
|
|
193
240
|
const mode = opts.mode ?? 'full';
|
|
194
241
|
const roleOverview = result.roles
|
|
@@ -226,7 +273,14 @@ export function formatRegenMarkdown(result, opts = {}) {
|
|
|
226
273
|
const taxonomyTip = nullTaxonomyTip(result.cube.message_taxonomy);
|
|
227
274
|
const roleTextHash = result.role.detailed_description_hash ?? null;
|
|
228
275
|
const directiveHash = result.cube.directive_hash ?? null;
|
|
229
|
-
|
|
276
|
+
// gh#496-A(b): full mode (and the lite emit-role-text branch) render the
|
|
277
|
+
// COMPRESSED-core role text — `… rationale:` sections become on-demand
|
|
278
|
+
// borg:role-rationale stubs; rules + all safety stay inline. The lite
|
|
279
|
+
// hash-gating path (shouldEmitRoleText, over the STORED detailed_description
|
|
280
|
+
// hash) and the lite-omitted safety set below are unchanged.
|
|
281
|
+
const roleText = result.role.detailed_description
|
|
282
|
+
? compressRoleText(result.role.name, result.role.detailed_description)
|
|
283
|
+
: '_(no detailed description set)_';
|
|
230
284
|
const directiveText = result.cube.cube_directive || '_(none)_';
|
|
231
285
|
const shouldEmitRoleText = mode === 'full' || roleTextHash == null || roleTextHash !== cachedRoleTextHash;
|
|
232
286
|
const shouldEmitDirective = mode === 'full' || directiveHash == null || directiveHash !== cachedDirectiveHash;
|
package/dist/regen-format.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"regen-format.js","sourceRoot":"","sources":["../src/regen-format.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EACL,8BAA8B,EAC9B,4BAA4B,GAC7B,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"regen-format.js","sourceRoot":"","sources":["../src/regen-format.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EACL,8BAA8B,EAC9B,4BAA4B,GAC7B,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAEtD;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,gBAAgB;IAC9B,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;isBAwFwrB,CAAC;AAClsB,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,gBAAgB,EAAE,CAAC;AAEjD;;GAEG;AACH,MAAM,UAAU,QAAQ,CAAC,IAAmB;IAC1C,MAAM,IAAI,GAAG,OAAO,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IAC9D,MAAM,EAAE,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,OAAO,EAAE,CAAC;IACvC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,GAAG,CAAC;QAAE,OAAO,UAAU,CAAC;IACtD,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,EAAE,GAAG,IAAI,CAAC,CAAC;IAClC,IAAI,GAAG,GAAG,EAAE;QAAE,OAAO,GAAG,GAAG,OAAO,CAAC;IACnC,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,GAA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;IACtD,MAAM,EAAE,GAAG,IAAI,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,WAAW,EAAE,CAAC;IACpD,MAAM,OAAO,GACX,OAAO,KAAK,CAAC,EAAE,KAAK,QAAQ,IAAI,KAAK,CAAC,EAAE,CAAC,MAAM,GAAG,CAAC;QACjD,CAAC,CAAC,eAAe,KAAK,CAAC,EAAE,GAAG;QAC5B,CAAC,CAAC,EAAE,CAAC;IACT,OAAO,MAAM,EAAE,MAAM,OAAO,IAAI,CAAC,EAAE,KAAK,IAAI,GAAG,KAAK,CAAC,EAAE,IAAI,IAAI,GAAG,MAAM,KAAK,CAAC,OAAO,EAAE,CAAC;AAC1F,CAAC"}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Role-text section parsing + granular section patching (gh#473 PR1).
|
|
3
|
+
*
|
|
4
|
+
* Platform-dependency-free, same shape as `message-taxonomy.ts`: pure
|
|
5
|
+
* string logic so the worker DB layer AND unit tests can both import it
|
|
6
|
+
* without dragging in Cloudflare / Neon types.
|
|
7
|
+
*
|
|
8
|
+
* ## Why not markdown `##` headings
|
|
9
|
+
*
|
|
10
|
+
* Real role `detailed_description` text (see `client/src/templates.ts`)
|
|
11
|
+
* does NOT use `##` headings. It is structured as:
|
|
12
|
+
*
|
|
13
|
+
* - a PREAMBLE — free prose before the first label line
|
|
14
|
+
* (e.g. "You implement changes to the codebase…");
|
|
15
|
+
* - one or more SECTIONS, each headed by a PLAIN-LABEL LINE — a line
|
|
16
|
+
* that is a short label terminated by a single trailing colon and
|
|
17
|
+
* nothing else (e.g. `Workflow:`, `Project conventions:`,
|
|
18
|
+
* `Your job:`, `Log conventions you use:`);
|
|
19
|
+
* - TRAILING inlined `${ESCALATION_DISCIPLINE}` / `${...}` constant
|
|
20
|
+
* text woven onto the end of the field. That text uses `**bold:**`
|
|
21
|
+
* markdown emphasis, NOT bare label lines, so it is NOT a section
|
|
22
|
+
* boundary — it falls into the last label section as literal text.
|
|
23
|
+
*
|
|
24
|
+
* A parser that splits on `##` finds ZERO sections in real role text.
|
|
25
|
+
* The label-line delimiter below matches the ACTUAL structure.
|
|
26
|
+
*
|
|
27
|
+
* ## Byte-identical round-trip invariant
|
|
28
|
+
*
|
|
29
|
+
* `serializeSections(parseRoleSections(text)) === text` for ANY input.
|
|
30
|
+
* The parser does not trim, normalize newlines, or otherwise rewrite
|
|
31
|
+
* bytes — each section's `body` retains the exact slice (including its
|
|
32
|
+
* heading line and the newline that terminates it) so concatenation
|
|
33
|
+
* reproduces the original field verbatim. The single named-fragment
|
|
34
|
+
* mutation is therefore the ONLY byte-level change a patch makes.
|
|
35
|
+
*/
|
|
36
|
+
/** What kind of label heads a section. */
|
|
37
|
+
export type RoleSectionKind = 'preamble' | 'label';
|
|
38
|
+
export interface RoleSection {
|
|
39
|
+
/**
|
|
40
|
+
* The section's label WITHOUT the trailing colon, trimmed
|
|
41
|
+
* (e.g. "Workflow", "Project conventions"). `null` for the preamble
|
|
42
|
+
* (the pre-first-label span). Used as the addressing key for patches.
|
|
43
|
+
*/
|
|
44
|
+
heading: string | null;
|
|
45
|
+
kind: RoleSectionKind;
|
|
46
|
+
/**
|
|
47
|
+
* The EXACT source slice for this section, including its heading line
|
|
48
|
+
* (for label sections) and every byte through to (but not including)
|
|
49
|
+
* the next section's heading line. Concatenating every section's
|
|
50
|
+
* `body` in order reproduces the original text byte-for-byte.
|
|
51
|
+
*/
|
|
52
|
+
body: string;
|
|
53
|
+
}
|
|
54
|
+
export type RoleSectionPatchOp = {
|
|
55
|
+
action: 'replace';
|
|
56
|
+
heading: string;
|
|
57
|
+
body: string;
|
|
58
|
+
} | {
|
|
59
|
+
action: 'insert';
|
|
60
|
+
heading: string;
|
|
61
|
+
body: string;
|
|
62
|
+
after?: string | null;
|
|
63
|
+
} | {
|
|
64
|
+
action: 'delete';
|
|
65
|
+
heading: string;
|
|
66
|
+
};
|
|
67
|
+
/**
|
|
68
|
+
* Test whether a single line is a plain-label section heading.
|
|
69
|
+
*
|
|
70
|
+
* Rules (deliberately narrow to avoid false positives against prose
|
|
71
|
+
* that merely contains a colon):
|
|
72
|
+
* - no leading whitespace (label lines start at column 0);
|
|
73
|
+
* - the line ends with exactly one `:`;
|
|
74
|
+
* - the text before the colon is non-empty, contains no other `:`,
|
|
75
|
+
* and is "short" (≤ 60 chars) — long colon-terminated prose lines
|
|
76
|
+
* are not labels;
|
|
77
|
+
* - the label is not a markdown emphasis run (does not start with
|
|
78
|
+
* `*`, `-`, `#`, `>` or backtick) — those are list/markdown lines,
|
|
79
|
+
* not plain labels (the woven `**Dense communication discipline:**`
|
|
80
|
+
* constant headings must NOT be treated as section boundaries).
|
|
81
|
+
*/
|
|
82
|
+
export declare function isLabelLine(line: string): boolean;
|
|
83
|
+
/**
|
|
84
|
+
* Parse role `detailed_description` text into ordered sections.
|
|
85
|
+
*
|
|
86
|
+
* The result always round-trips byte-identical through
|
|
87
|
+
* `serializeSections`. An empty string yields a single empty preamble
|
|
88
|
+
* section so callers always have a stable shape to address.
|
|
89
|
+
*/
|
|
90
|
+
export declare function parseRoleSections(text: string): RoleSection[];
|
|
91
|
+
/** Concatenate sections back into the original field text. */
|
|
92
|
+
export declare function serializeSections(sections: RoleSection[]): string;
|
|
93
|
+
/**
|
|
94
|
+
* Apply a single section-level patch to role text, returning the new
|
|
95
|
+
* full field text. Every other byte is preserved.
|
|
96
|
+
*
|
|
97
|
+
* - replace: overwrite the matched section's body with a re-rendered
|
|
98
|
+
* `<heading>:\n<body>` block. The heading match is case-insensitive
|
|
99
|
+
* on the label; the re-rendered heading uses the supplied casing.
|
|
100
|
+
* - insert: add a new label section. Placed after the section named by
|
|
101
|
+
* `after` (case-insensitive), or appended at the end when `after` is
|
|
102
|
+
* omitted/null. Rejects if a section with the same heading already
|
|
103
|
+
* exists (use replace instead).
|
|
104
|
+
* - delete: drop the matched section entirely.
|
|
105
|
+
*
|
|
106
|
+
* Throws when the target section is missing (replace/delete) or already
|
|
107
|
+
* present (insert), or when `after` does not resolve.
|
|
108
|
+
*/
|
|
109
|
+
export declare function patchRoleSectionText(text: string, op: RoleSectionPatchOp): string;
|
|
110
|
+
//# sourceMappingURL=role-section.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"role-section.d.ts","sourceRoot":"","sources":["../src/role-section.ts"],"names":[],"mappings":"AAcA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAEH,0CAA0C;AAC1C,MAAM,MAAM,eAAe,GAAG,UAAU,GAAG,OAAO,CAAC;AAEnD,MAAM,WAAW,WAAW;IAC1B;;;;OAIG;IACH,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,IAAI,EAAE,eAAe,CAAC;IACtB;;;;;OAKG;IACH,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,MAAM,kBAAkB,GAC1B;IAAE,MAAM,EAAE,SAAS,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GACpD;IAAE,MAAM,EAAE,QAAQ,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,GAC1E;IAAE,MAAM,EAAE,QAAQ,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC;AAE1C;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAYjD;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,WAAW,EAAE,CA4C7D;AAED,8DAA8D;AAC9D,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,WAAW,EAAE,GAAG,MAAM,CAEjE;AAiDD;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,kBAAkB,GAAG,MAAM,CA2DjF"}
|
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
// ⚠ gh#496-A(b) client/worker PARSER-AGREEMENT — this file MUST stay
|
|
2
|
+
// behavior-identical to `workers/role-section.ts`. The client render
|
|
3
|
+
// compression (`regen-format.ts`) splits role text with THIS parser to
|
|
4
|
+
// decide which `… rationale:` sections to stub; the worker's
|
|
5
|
+
// `getRoleRationale` resolves stub headings with the worker copy. They
|
|
6
|
+
// MUST derive section headings identically (sans-colon, isLabelLine rules)
|
|
7
|
+
// or a correctly-quoted stub won't resolve. Parity is enforced by
|
|
8
|
+
// `client/__tests__/role-section-parity.test.ts` (client parse == worker
|
|
9
|
+
// parse, section-for-section, on every shipped role). If you edit one,
|
|
10
|
+
// edit BOTH — or relocate to a shared module both packages import (tracked
|
|
11
|
+
// DRY follow-up). Verbatim port; zero logic change.
|
|
12
|
+
//
|
|
13
|
+
// ---- (verbatim copy of workers/role-section.ts below this line) ----
|
|
14
|
+
/**
|
|
15
|
+
* Test whether a single line is a plain-label section heading.
|
|
16
|
+
*
|
|
17
|
+
* Rules (deliberately narrow to avoid false positives against prose
|
|
18
|
+
* that merely contains a colon):
|
|
19
|
+
* - no leading whitespace (label lines start at column 0);
|
|
20
|
+
* - the line ends with exactly one `:`;
|
|
21
|
+
* - the text before the colon is non-empty, contains no other `:`,
|
|
22
|
+
* and is "short" (≤ 60 chars) — long colon-terminated prose lines
|
|
23
|
+
* are not labels;
|
|
24
|
+
* - the label is not a markdown emphasis run (does not start with
|
|
25
|
+
* `*`, `-`, `#`, `>` or backtick) — those are list/markdown lines,
|
|
26
|
+
* not plain labels (the woven `**Dense communication discipline:**`
|
|
27
|
+
* constant headings must NOT be treated as section boundaries).
|
|
28
|
+
*/
|
|
29
|
+
export function isLabelLine(line) {
|
|
30
|
+
// Leading whitespace disqualifies (label lines are flush-left).
|
|
31
|
+
if (/^\s/.test(line))
|
|
32
|
+
return false;
|
|
33
|
+
if (!line.endsWith(':'))
|
|
34
|
+
return false;
|
|
35
|
+
const label = line.slice(0, -1);
|
|
36
|
+
if (label.length === 0)
|
|
37
|
+
return false;
|
|
38
|
+
if (label.length > 60)
|
|
39
|
+
return false;
|
|
40
|
+
// Exactly one colon total (the trailing one).
|
|
41
|
+
if (label.includes(':'))
|
|
42
|
+
return false;
|
|
43
|
+
// Markdown/list/quote/code lead-ins are not plain labels.
|
|
44
|
+
if (/^[*\-#>`]/.test(label))
|
|
45
|
+
return false;
|
|
46
|
+
return true;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Parse role `detailed_description` text into ordered sections.
|
|
50
|
+
*
|
|
51
|
+
* The result always round-trips byte-identical through
|
|
52
|
+
* `serializeSections`. An empty string yields a single empty preamble
|
|
53
|
+
* section so callers always have a stable shape to address.
|
|
54
|
+
*/
|
|
55
|
+
export function parseRoleSections(text) {
|
|
56
|
+
const sections = [];
|
|
57
|
+
const lines = text.split('\n');
|
|
58
|
+
// Reconstruct each line WITH its terminating newline so that the
|
|
59
|
+
// concatenation is lossless. `split('\n')` drops the separators; we
|
|
60
|
+
// re-append '\n' to every line except the last (which had no trailing
|
|
61
|
+
// newline in the source unless the source ended with one — in which
|
|
62
|
+
// case the final split element is '' and contributes nothing).
|
|
63
|
+
const lineWithSep = (idx) => idx < lines.length - 1 ? lines[idx] + '\n' : lines[idx];
|
|
64
|
+
let currentHeading = null;
|
|
65
|
+
let currentKind = 'preamble';
|
|
66
|
+
let currentBody = '';
|
|
67
|
+
let started = false;
|
|
68
|
+
const flush = () => {
|
|
69
|
+
sections.push({ heading: currentHeading, kind: currentKind, body: currentBody });
|
|
70
|
+
};
|
|
71
|
+
for (let i = 0; i < lines.length; i++) {
|
|
72
|
+
const raw = lines[i];
|
|
73
|
+
if (isLabelLine(raw)) {
|
|
74
|
+
// Close the in-progress section (preamble or previous label) and
|
|
75
|
+
// open a new label section headed by this line.
|
|
76
|
+
flush();
|
|
77
|
+
currentHeading = raw.slice(0, -1).trim();
|
|
78
|
+
currentKind = 'label';
|
|
79
|
+
currentBody = lineWithSep(i);
|
|
80
|
+
started = true;
|
|
81
|
+
}
|
|
82
|
+
else {
|
|
83
|
+
currentBody += lineWithSep(i);
|
|
84
|
+
started = true;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
// Always emit the final in-progress section. For empty input this is a
|
|
88
|
+
// single empty preamble (started === false, currentBody === '').
|
|
89
|
+
if (started || sections.length === 0) {
|
|
90
|
+
flush();
|
|
91
|
+
}
|
|
92
|
+
return sections;
|
|
93
|
+
}
|
|
94
|
+
/** Concatenate sections back into the original field text. */
|
|
95
|
+
export function serializeSections(sections) {
|
|
96
|
+
return sections.map((s) => s.body).join('');
|
|
97
|
+
}
|
|
98
|
+
function normalizeHeading(value) {
|
|
99
|
+
return value.trim().toLowerCase();
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Build the body for a freshly inserted/replaced label section from a
|
|
103
|
+
* heading + caller-supplied body text.
|
|
104
|
+
*
|
|
105
|
+
* The heading line is rendered as `<heading>:` on its own line. The
|
|
106
|
+
* caller's `body` is the text BELOW the heading. We guarantee the
|
|
107
|
+
* section body ends with a single trailing newline so adjacent sections
|
|
108
|
+
* stay separated when re-serialized (matching how real role text
|
|
109
|
+
* separates label sections with blank lines is the caller's choice via
|
|
110
|
+
* their body text; we only ensure the structural newline).
|
|
111
|
+
*/
|
|
112
|
+
function renderLabelSection(heading, body) {
|
|
113
|
+
const headingLine = `${heading.trim()}:\n`;
|
|
114
|
+
if (body === '')
|
|
115
|
+
return headingLine;
|
|
116
|
+
// Ensure the body ends with a newline so the next section's heading
|
|
117
|
+
// starts on its own line.
|
|
118
|
+
const normalizedBody = body.endsWith('\n') ? body : body + '\n';
|
|
119
|
+
return headingLine + normalizedBody;
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Guarantee the section at `idx` ends in a newline before a new section
|
|
123
|
+
* heading is glued on after it.
|
|
124
|
+
*
|
|
125
|
+
* Real role `detailed_description` text (every template role) ends WITHOUT
|
|
126
|
+
* a trailing newline — it closes on the woven `${...DISCIPLINE}` constant.
|
|
127
|
+
* Appending a `<heading>:` line directly onto such text would fuse the
|
|
128
|
+
* heading onto the prior section's last line, so the heading is no longer
|
|
129
|
+
* a flush-left label and the inserted section is LOST on re-parse. Adding
|
|
130
|
+
* the structural newline here keeps the inserted heading on its own line.
|
|
131
|
+
*
|
|
132
|
+
* No-ops when the preceding body is empty (an empty preamble needs no
|
|
133
|
+
* separator) or already ends in '\n' (preserves the already-correct case
|
|
134
|
+
* byte-for-byte).
|
|
135
|
+
*/
|
|
136
|
+
function ensureTrailingNewline(sections, idx) {
|
|
137
|
+
if (idx < 0 || idx >= sections.length)
|
|
138
|
+
return;
|
|
139
|
+
const prev = sections[idx];
|
|
140
|
+
if (prev.body !== '' && !prev.body.endsWith('\n')) {
|
|
141
|
+
sections[idx] = { ...prev, body: prev.body + '\n' };
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Apply a single section-level patch to role text, returning the new
|
|
146
|
+
* full field text. Every other byte is preserved.
|
|
147
|
+
*
|
|
148
|
+
* - replace: overwrite the matched section's body with a re-rendered
|
|
149
|
+
* `<heading>:\n<body>` block. The heading match is case-insensitive
|
|
150
|
+
* on the label; the re-rendered heading uses the supplied casing.
|
|
151
|
+
* - insert: add a new label section. Placed after the section named by
|
|
152
|
+
* `after` (case-insensitive), or appended at the end when `after` is
|
|
153
|
+
* omitted/null. Rejects if a section with the same heading already
|
|
154
|
+
* exists (use replace instead).
|
|
155
|
+
* - delete: drop the matched section entirely.
|
|
156
|
+
*
|
|
157
|
+
* Throws when the target section is missing (replace/delete) or already
|
|
158
|
+
* present (insert), or when `after` does not resolve.
|
|
159
|
+
*/
|
|
160
|
+
export function patchRoleSectionText(text, op) {
|
|
161
|
+
const sections = parseRoleSections(text);
|
|
162
|
+
const targetKey = normalizeHeading(op.heading);
|
|
163
|
+
if (op.action === 'replace') {
|
|
164
|
+
const idx = sections.findIndex((s) => s.kind === 'label' && s.heading != null && normalizeHeading(s.heading) === targetKey);
|
|
165
|
+
if (idx === -1) {
|
|
166
|
+
throw new Error(`Role section "${op.heading}" not found. Use action="insert" to add it.`);
|
|
167
|
+
}
|
|
168
|
+
sections[idx] = {
|
|
169
|
+
heading: op.heading.trim(),
|
|
170
|
+
kind: 'label',
|
|
171
|
+
body: renderLabelSection(op.heading, op.body),
|
|
172
|
+
};
|
|
173
|
+
return serializeSections(sections);
|
|
174
|
+
}
|
|
175
|
+
if (op.action === 'delete') {
|
|
176
|
+
const idx = sections.findIndex((s) => s.kind === 'label' && s.heading != null && normalizeHeading(s.heading) === targetKey);
|
|
177
|
+
if (idx === -1) {
|
|
178
|
+
throw new Error(`Role section "${op.heading}" not found.`);
|
|
179
|
+
}
|
|
180
|
+
sections.splice(idx, 1);
|
|
181
|
+
return serializeSections(sections);
|
|
182
|
+
}
|
|
183
|
+
// insert
|
|
184
|
+
const exists = sections.some((s) => s.kind === 'label' && s.heading != null && normalizeHeading(s.heading) === targetKey);
|
|
185
|
+
if (exists) {
|
|
186
|
+
throw new Error(`Role section "${op.heading}" already exists. Use action="replace" to overwrite it.`);
|
|
187
|
+
}
|
|
188
|
+
const newSection = {
|
|
189
|
+
heading: op.heading.trim(),
|
|
190
|
+
kind: 'label',
|
|
191
|
+
body: renderLabelSection(op.heading, op.body),
|
|
192
|
+
};
|
|
193
|
+
if (op.after == null) {
|
|
194
|
+
ensureTrailingNewline(sections, sections.length - 1);
|
|
195
|
+
sections.push(newSection);
|
|
196
|
+
return serializeSections(sections);
|
|
197
|
+
}
|
|
198
|
+
const afterKey = normalizeHeading(op.after);
|
|
199
|
+
const afterIdx = sections.findIndex((s) => s.kind === 'label' && s.heading != null && normalizeHeading(s.heading) === afterKey);
|
|
200
|
+
if (afterIdx === -1) {
|
|
201
|
+
throw new Error(`Cannot insert after section "${op.after}" — it does not exist.`);
|
|
202
|
+
}
|
|
203
|
+
ensureTrailingNewline(sections, afterIdx);
|
|
204
|
+
sections.splice(afterIdx + 1, 0, newSection);
|
|
205
|
+
return serializeSections(sections);
|
|
206
|
+
}
|
|
207
|
+
//# sourceMappingURL=role-section.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"role-section.js","sourceRoot":"","sources":["../src/role-section.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,qEAAqE;AACrE,uEAAuE;AACvE,6DAA6D;AAC7D,uEAAuE;AACvE,2EAA2E;AAC3E,kEAAkE;AAClE,yEAAyE;AACzE,uEAAuE;AACvE,2EAA2E;AAC3E,oDAAoD;AACpD,EAAE;AACF,uEAAuE;AA+DvE;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,WAAW,CAAC,IAAY;IACtC,gEAAgE;IAChE,IAAI,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC;QAAE,OAAO,KAAK,CAAC;IACnC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC;QAAE,OAAO,KAAK,CAAC;IACtC,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IAChC,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC;IACrC,IAAI,KAAK,CAAC,MAAM,GAAG,EAAE;QAAE,OAAO,KAAK,CAAC;IACpC,8CAA8C;IAC9C,IAAI,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC;QAAE,OAAO,KAAK,CAAC;IACtC,0DAA0D;IAC1D,IAAI,WAAW,CAAC,IAAI,CAAC,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC;IAC1C,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,iBAAiB,CAAC,IAAY;IAC5C,MAAM,QAAQ,GAAkB,EAAE,CAAC;IACnC,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,C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CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,QAAQ,CAC3F,CAAC;IACF,IAAI,QAAQ,KAAK,CAAC,CAAC,EAAE,CAAC;QACpB,MAAM,IAAI,KAAK,CAAC,gCAAgC,EAAE,CAAC,KAAK,wBAAwB,CAAC,CAAC;IACpF,CAAC;IACD,qBAAqB,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;IAC1C,QAAQ,CAAC,MAAM,CAAC,QAAQ,GAAG,CAAC,EAAE,CAAC,EAAE,UAAU,CAAC,CAAC;IAC7C,OAAO,iBAAiB,CAAC,QAAQ,CAAC,CAAC;AACrC,CAAC"}
|
package/dist/templates.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"templates.d.ts","sourceRoot":"","sources":["../src/templates.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,iBAAiB,EAAE,MAAM,CAAC;IAC1B,oBAAoB,EAAE,MAAM,CAAC;IAC7B,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,mBAAmB,CAAC,EAAE,OAAO,CAAC;CAI/B;AAED,MAAM,WAAW,oBAAoB;IACnC,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,OAAO,EAAE,WAAW,GAAG,UAAU,CAAC;IAClC,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;CACvB;AAED,MAAM,MAAM,eAAe,GAAG,oBAAoB,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"templates.d.ts","sourceRoot":"","sources":["../src/templates.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,MAAM,WAAW,YAAY;IAC3B,IAAI,EAA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AgB,6BAA6B,CAC3C,gBAAgB,EAAE,MAAM,EACxB,QAAQ,EAAE,QAAQ,GAAG,IAAI,GACxB,MAAM,CAKR;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,4BAA4B,CAC1C,oBAAoB,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EAC/C,QAAQ,EAAE,QAAQ,GACjB,MAAM,GAAG,IAAI,CAQf;AAED,wBAAgB,+BAA+B,CAC7C,gBAAgB,EAAE,eAAe,GAAG,IAAI,GAAG,SAAS,EACpD,QAAQ,EAAE,QAAQ,GAAG,IAAI,GACxB,eAAe,GAAG,IAAI,CAExB"}
|
package/dist/templates.js
CHANGED
|
@@ -30,6 +30,19 @@
|
|
|
30
30
|
// descriptions weave these constants in so new cubes inherit the
|
|
31
31
|
// codified discipline automatically.
|
|
32
32
|
// ====================================================================
|
|
33
|
+
// gh#496-A(b) GO-FORWARD AUTHORING CONVENTION (role-text rationale-split):
|
|
34
|
+
// When authoring or refactoring a role's `detailed_description`, separate
|
|
35
|
+
// operational RULES from RATIONALE. Put WHY / background / case-study prose
|
|
36
|
+
// in dedicated `<topic> rationale:` PLAIN-LABEL sections — a flush-left line
|
|
37
|
+
// whose short label ends in "rationale" + a single trailing colon (e.g.
|
|
38
|
+
// `Deadlock-resolution rationale:`). The regen render (`compressRoleText` in
|
|
39
|
+
// regen-format.ts) auto-compresses each such section to an on-demand
|
|
40
|
+
// `borg:role-rationale` stub, keeping rules + ALL safety disciplines inline.
|
|
41
|
+
// ⛔ Operational rules and safety constants (WAKE_PATH_MONITOR_DISCIPLINE,
|
|
42
|
+
// GIT_OPERATIONAL_DISCIPLINE_*, PUSH_DISCIPLINE_*) MUST NEVER live inside a
|
|
43
|
+
// rationale section. Legacy dense role text is rule-WHY-interleaved and stays
|
|
44
|
+
// inline (correct); the compression value compounds as new/refactored roles
|
|
45
|
+
// adopt this convention. See docs/superpowers/specs/2026-06-01-gh496Ab-rationale-split.md.
|
|
33
46
|
const DENSE_COMMUNICATION_DISCIPLINE = `
|
|
34
47
|
|
|
35
48
|
**Dense communication discipline:**
|
|
@@ -159,8 +172,6 @@ When the cube is at risk of deadlock — any pattern where progress requires act
|
|
|
159
172
|
|
|
160
173
|
**Forcing function**: if you (Coordinator) see two posts that imply "someone should pick this up" without naming who, that's a deadlock-risk signal. Assign explicitly within one cadence-bucket (5-15 min per the cadence table). Escalate to Queen ONLY for Queen-class assignment decisions.
|
|
161
174
|
|
|
162
|
-
**Why high-priority**: Coordinator deadlock-resolution failures cascade — every minute the cube waits on an unowned action is a minute of multiple drones idling. The cost compounds with drone count + concurrent sprint activity. Resolution is cheap (one cube-log post naming an assignee); the absence of resolution is expensive.
|
|
163
|
-
|
|
164
175
|
**Companion bottom-up rule — idle drones may volunteer cross-role**: idle drones (capacity clean, no in-flight work) may volunteer to pick up unowned cross-role tasks even when the work doesn't match their primary role description, provided: (a) the work is visible in the cube log as unowned (REVIEW-READY without an explicit assignee for the gate-class they're volunteering for; OR a Coordinator post tagged with "needs cross-coverage"), (b) the volunteer drone posts \`VOLUNTEER: <task> — <lens-axis I'm covering>\` BEFORE doing the work so the Coordinator + cube see the claim, (c) the volunteer drone explicitly names which axis-lens they're applying (e.g., a CR-axis drone volunteering for QA-by-non-author posts \`VOLUNTEER: <branch> — QA-axis cross-coverage from CR-axis lens\` to make the cross-role framing explicit), (d) the volunteer drone's primary role doesn't have an in-flight obligation. The bottom-up rule is belt-and-suspenders with the Coordinator-explicit-assignment rule above — both can fire; whichever lands first owns the work.
|
|
165
176
|
|
|
166
177
|
**Reassignment authority (autonomous-mode scope):** the Coordinator-class seat (Queen-by-delegation included) has standing authority to reassign roles within the existing cube's role roster WITHOUT per-reassignment Queen authorization, provided: (a) the reassignment is to a confirmed-alive drone, (b) the previous drone is documented as unresponsive per Step 3, (c) the reassignment is announced in cube log. Reassignment is operational continuity, not a Queen-policy decision.`;
|
|
@@ -407,7 +418,10 @@ Log conventions you use:
|
|
|
407
418
|
|
|
408
419
|
Read the log first on every regen. Act only on actionable signals.
|
|
409
420
|
|
|
410
|
-
**Elevation to the Queen role (autonomous variant):** When the human Queen authorizes autonomous operation (a few hours, overnight, etc.), your role is reassigned to Queen via \`borg:reassign-drone\`. Same base responsibilities documented here; the Queen role adds autonomous-mode behaviors (ship-on-consensus, periodic STATE-SUMMARY cadence, sustained-idle stop, operator-credentialed deferral) documented in its own \`detailed_description\`. On the human Queen's return, you're reassigned back to this role. Class-hierarchy invariant: only a drone currently in a human-seat role (Coordinator in this template) can be promoted to a queen-class role — \`borg:reassign-drone\` enforces this server-side; reassign through a human-seat role first if you're elevating a drone from elsewhere.${ACTIVE_MOMENTUM_OWNERSHIP}${ANTI_PASSIVE_STANDING_DISCIPLINE}${ONE_SIGNAL_PER_POST_DISCIPLINE}${DENSE_COMMUNICATION_DISCIPLINE}${RELEASE_CYCLE_SHAPES}${CONDITIONAL_DISPATCH_ENFORCEMENT}${COORDINATOR_WORKFLOW_RULES}${GIT_OPERATIONAL_DISCIPLINE_COORDINATOR}${SCHEDULEWAKEUP_CADENCE}${PUSH_DISCIPLINE_COORDINATOR}${WAKE_PATH_MONITOR_DISCIPLINE}
|
|
421
|
+
**Elevation to the Queen role (autonomous variant):** When the human Queen authorizes autonomous operation (a few hours, overnight, etc.), your role is reassigned to Queen via \`borg:reassign-drone\`. Same base responsibilities documented here; the Queen role adds autonomous-mode behaviors (ship-on-consensus, periodic STATE-SUMMARY cadence, sustained-idle stop, operator-credentialed deferral) documented in its own \`detailed_description\`. On the human Queen's return, you're reassigned back to this role. Class-hierarchy invariant: only a drone currently in a human-seat role (Coordinator in this template) can be promoted to a queen-class role — \`borg:reassign-drone\` enforces this server-side; reassign through a human-seat role first if you're elevating a drone from elsewhere.${ACTIVE_MOMENTUM_OWNERSHIP}${ANTI_PASSIVE_STANDING_DISCIPLINE}${ONE_SIGNAL_PER_POST_DISCIPLINE}${DENSE_COMMUNICATION_DISCIPLINE}${RELEASE_CYCLE_SHAPES}${CONDITIONAL_DISPATCH_ENFORCEMENT}${COORDINATOR_WORKFLOW_RULES}${GIT_OPERATIONAL_DISCIPLINE_COORDINATOR}${SCHEDULEWAKEUP_CADENCE}${PUSH_DISCIPLINE_COORDINATOR}${WAKE_PATH_MONITOR_DISCIPLINE}
|
|
422
|
+
|
|
423
|
+
Deadlock-resolution rationale:
|
|
424
|
+
Coordinator deadlock-resolution failures cascade — every minute the cube waits on an unowned action is a minute of multiple drones idling. The cost compounds with drone count + concurrent sprint activity. Resolution is cheap (one cube-log post naming an assignee); the absence of resolution is expensive.`,
|
|
411
425
|
},
|
|
412
426
|
{
|
|
413
427
|
name: 'Builder',
|
package/dist/templates.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"templates.js","sourceRoot":"","sources":["../src/templates.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAwBH,uEAAuE;AACvE,gEAAgE;AAChE,iEAAiE;AACjE,qCAAqC;AACrC,uEAAuE;AAEvE,MAAM,8BAA8B,GAAG;;;;;;;;;;;;;;;;;;;;;+GAqBwE,CAAC;AAEhH,MAAM,8BAA8B,GAAG;;;;;;;;;;;;;;;;;;;;;;igBAsB0d,CAAC;AAElgB,MAAM,qBAAqB,GAAG;;;;;;;;gOAQkM,CAAC;AAEjO,MAAM,yBAAyB,GAAG;;;;;;;kNAOgL,CAAC;AAEnN,MAAM,gCAAgC,GAAG
|
|
1
|
+
{"version":3,"file":"templates.js","sourceRoot":"","sources":["../src/templates.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAwBH,uEAAuE;AACvE,gEAAgE;AAChE,iEAAiE;AACjE,qCAAqC;AACrC,uEAAuE;AAEvE,2EAA2E;AAC3E,0EAA0E;AAC1E,4EAA4E;AAC5E,6EAA6E;AAC7E,wEAAwE;AACxE,6EAA6E;AAC7E,qEAAqE;AACrE,6EAA6E;AAC7E,0EAA0E;AAC1E,4EAA4E;AAC5E,8E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AO,QAAQ,CAAC,cAAc,CAAC;AACjC,CAAC;AAED,MAAM,UAAU,+BAA+B,CAC7C,gBAAoD,EACpD,QAAyB;IAEzB,OAAO,gBAAgB,KAAK,SAAS,CAAC,CAAC,CAAC,QAAQ,EAAE,gBAAgB,IAAI,IAAI,CAAC,CAAC,CAAC,gBAAgB,CAAC;AAChG,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "borgmcp",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.56",
|
|
4
4
|
"description": "Coordinate AI coding agents in shared cubes. Works with Claude Code and Codex. Create projects, assign roles, and share a live activity log.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|