@yemi33/minions 0.1.2406 → 0.1.2407
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/engine/comment-format.js +44 -5
- package/package.json +1 -1
package/engine/comment-format.js
CHANGED
|
@@ -57,7 +57,7 @@ function linkifyBrandTrailer(text) {
|
|
|
57
57
|
// - model concrete runtime execution model (optional)
|
|
58
58
|
// - no field may contain `--` (would close the HTML comment early)
|
|
59
59
|
|
|
60
|
-
const { normalizeExecutionModel } = require('./execution-model');
|
|
60
|
+
const { normalizeExecutionModel, UNKNOWN_MODEL } = require('./execution-model');
|
|
61
61
|
|
|
62
62
|
const AGENT_ID_RE = /^[a-z][a-z0-9-]{0,30}$/;
|
|
63
63
|
const KIND_RE = /^[a-z][a-z0-9-]{0,30}$/;
|
|
@@ -104,24 +104,63 @@ function _encodeMarkerModel(model) {
|
|
|
104
104
|
return encoded.includes('--') ? encoded.replace(/-/g, '%2D') : encoded;
|
|
105
105
|
}
|
|
106
106
|
|
|
107
|
+
// A genuinely-absent model must NOT be recorded in the hidden marker — the
|
|
108
|
+
// `unknown` sentinel is the signal that no runtime/model evidence exists, so we
|
|
109
|
+
// omit the segment entirely (W-mryk8hf1) rather than persisting `model=unknown`.
|
|
110
|
+
function _isKnownModel(model) {
|
|
111
|
+
return !!model && model !== UNKNOWN_MODEL;
|
|
112
|
+
}
|
|
113
|
+
|
|
107
114
|
function _buildMarker({ agentId, kind, workItemId, model }) {
|
|
108
115
|
_validateMarkerInputs({ agentId, kind, workItemId, model });
|
|
109
116
|
const wi = (workItemId !== undefined && workItemId !== null) ? ` wi=${workItemId}` : '';
|
|
110
|
-
const modelPart = model ? ` model=${_encodeMarkerModel(model)}` : '';
|
|
117
|
+
const modelPart = _isKnownModel(model) ? ` model=${_encodeMarkerModel(model)}` : '';
|
|
111
118
|
return `<!-- minions:agent=${agentId} kind=${kind}${wi}${modelPart} -->`;
|
|
112
119
|
}
|
|
113
120
|
|
|
114
121
|
const MODEL_SIGNOFF_RE =
|
|
115
122
|
/(\b(?:Review|Reviewed|Fixed|Verified|Rebased) by (?:Minions|\[Minions\]\([^)]+\)) \([^\r\n)]*? · )[^)\r\n]+(\))/g;
|
|
116
123
|
|
|
124
|
+
// Matches the visible sign-off when its model segment is the `unknown` sentinel,
|
|
125
|
+
// capturing everything up to (but excluding) the ` · unknown` so it can be
|
|
126
|
+
// dropped — turning `(Ripley — Explorer · unknown)` into `(Ripley — Explorer)`.
|
|
127
|
+
const UNKNOWN_MODEL_SIGNOFF_RE =
|
|
128
|
+
/(\b(?:Review|Reviewed|Fixed|Verified|Rebased) by (?:Minions|\[Minions\]\([^)]+\)) \([^\r\n)]*?) · unknown(\))/g;
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* Stamp the concrete runtime execution model into the visible sign-off.
|
|
132
|
+
*
|
|
133
|
+
* Three cases, mirroring the execution-model resolver's evidence outcomes:
|
|
134
|
+
* - known model → replace the model segment with it.
|
|
135
|
+
* - `unknown` sentinel → the resolver positively determined no runtime/
|
|
136
|
+
* model evidence exists, so omit the whole
|
|
137
|
+
* ` · <model>` segment rather than printing it
|
|
138
|
+
* (W-mryk8hf1). The footer degrades to
|
|
139
|
+
* `(<name> — <role>)`.
|
|
140
|
+
* - no opinion (falsy/null) → leave any concrete model the agent wrote
|
|
141
|
+
* intact, but still drop a bare ` · unknown`
|
|
142
|
+
* sentinel so the footer never advertises it.
|
|
143
|
+
*/
|
|
117
144
|
function stampExecutionModel(text, model) {
|
|
145
|
+
if (typeof text !== 'string') return text;
|
|
118
146
|
const normalized = normalizeExecutionModel(model);
|
|
119
|
-
if (
|
|
120
|
-
|
|
147
|
+
if (_isKnownModel(normalized)) {
|
|
148
|
+
return text.replace(MODEL_SIGNOFF_RE, (_match, prefix, suffix) => `${prefix}${normalized}${suffix}`);
|
|
149
|
+
}
|
|
150
|
+
if (normalized === UNKNOWN_MODEL) {
|
|
151
|
+
// prefix ends with " · " — drop that separator along with the model segment.
|
|
152
|
+
return text.replace(MODEL_SIGNOFF_RE, (_match, prefix, suffix) => `${prefix.replace(/ · $/, '')}${suffix}`);
|
|
153
|
+
}
|
|
154
|
+
return text.replace(UNKNOWN_MODEL_SIGNOFF_RE, (_match, prefix, suffix) => `${prefix}${suffix}`);
|
|
121
155
|
}
|
|
122
156
|
|
|
123
157
|
function _stampLeadingMarkerModel(text, model) {
|
|
124
|
-
if (
|
|
158
|
+
if (typeof text !== 'string') return text;
|
|
159
|
+
// Rewrite the leading marker whenever a model value is supplied. A known model
|
|
160
|
+
// is recorded; the `unknown` sentinel rebuilds the marker without `model=`
|
|
161
|
+
// (buildMarker omits it), stripping any pre-existing stale model=. A
|
|
162
|
+
// genuinely-absent (falsy/null) model leaves the marker untouched.
|
|
163
|
+
if (!normalizeExecutionModel(model)) return text;
|
|
125
164
|
return text.replace(MINIONS_COMMENT_MARKER_RE, (marker, agentId, kind, workItemId) => {
|
|
126
165
|
if (marker !== text.slice(0, marker.length)) return marker;
|
|
127
166
|
return _buildMarker({ agentId, kind, workItemId, model });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yemi33/minions",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2407",
|
|
4
4
|
"description": "Multi-agent AI dev team that runs from ~/.minions/ — five autonomous agents share a single engine, dashboard, and knowledge base",
|
|
5
5
|
"bin": {
|
|
6
6
|
"minions": "bin/minions.js"
|