@lsctech/polaris 0.3.29 → 0.4.1
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/agent-plugin/args.js +77 -0
- package/dist/agent-plugin/claude-generator.js +158 -0
- package/dist/agent-plugin/commands.js +73 -0
- package/dist/agent-plugin/help.js +69 -0
- package/dist/agent-plugin/sync.js +108 -0
- package/dist/autoresearch/dev-gate.js +51 -0
- package/dist/autoresearch/gates.js +310 -0
- package/dist/autoresearch/index.js +20 -0
- package/dist/autoresearch/proposal.js +121 -0
- package/dist/autoresearch/routing.js +180 -0
- package/dist/autoresearch/score.js +213 -0
- package/dist/cli/adopt-approve.js +124 -4
- package/dist/cli/adopt-assets.js +9 -1
- package/dist/cli/adopt-command.js +123 -11
- package/dist/cli/adopt-instructions.js +17 -2
- package/dist/cli/adopt-smartdocs.js +9 -0
- package/dist/cli/adoption-context.js +46 -0
- package/dist/cli/adoption-plan.js +105 -12
- package/dist/cli/agent-setup.js +47 -0
- package/dist/cli/autoresearch.js +96 -0
- package/dist/cli/index.js +2 -0
- package/dist/cli/init.js +69 -1
- package/dist/cli/setup-interview/generate.js +380 -0
- package/dist/cli/setup-interview/report.js +138 -0
- package/dist/cli/setup-interview/runner.js +105 -0
- package/dist/cli/setup-interview/schema.js +16 -0
- package/dist/cli/setup-interview/store.js +73 -0
- package/dist/cli/worker.js +18 -8
- package/dist/finalize/index.js +5 -4
- package/dist/loop/adapters/foreman-dispatch.js +65 -0
- package/dist/loop/adapters/index.js +3 -1
- package/dist/loop/bootstrap-packet.js +1 -1
- package/dist/loop/checkpoint.js +120 -1
- package/dist/loop/continue.js +13 -5
- package/dist/loop/parent.js +129 -1
- package/dist/loop/resume.js +14 -8
- package/dist/loop/worker-packet.js +1 -1
- package/dist/skill-packet/generator.js +149 -1
- package/dist/workspace/.polaris/skills/polaris-tools/tools.js +31 -22
- package/package.json +2 -2
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.SUPPORTED_SKILLS = exports.SKILL_ROLE_MAP = void 0;
|
|
4
|
+
exports.generateSetupBootstrapPacket = generateSetupBootstrapPacket;
|
|
4
5
|
exports.generateSkillPacket = generateSkillPacket;
|
|
5
6
|
const node_crypto_1 = require("node:crypto");
|
|
6
7
|
exports.SKILL_ROLE_MAP = {
|
|
@@ -10,6 +11,8 @@ exports.SKILL_ROLE_MAP = {
|
|
|
10
11
|
promote: "Librarian",
|
|
11
12
|
triage: "Librarian",
|
|
12
13
|
review: "Librarian",
|
|
14
|
+
catalog: "Librarian",
|
|
15
|
+
reconcile: "Librarian",
|
|
13
16
|
};
|
|
14
17
|
const ROLE_SUMMARIES = {
|
|
15
18
|
Analyst: "The Analyst gathers evidence, assesses feasibility, and produces implementation-ready plans. The Analyst shapes work but never executes it.",
|
|
@@ -258,6 +261,136 @@ function buildReviewPacket() {
|
|
|
258
261
|
],
|
|
259
262
|
};
|
|
260
263
|
}
|
|
264
|
+
const SETUP_BOOTSTRAP_CHECKPOINTS = [
|
|
265
|
+
"canon",
|
|
266
|
+
"doc-movement",
|
|
267
|
+
"instruction-files",
|
|
268
|
+
"graph-root",
|
|
269
|
+
"route-scaffold",
|
|
270
|
+
"source-mutation",
|
|
271
|
+
];
|
|
272
|
+
/**
|
|
273
|
+
* Builds the checkpoint gate that is embedded in every setup-bootstrap packet.
|
|
274
|
+
*
|
|
275
|
+
* Each checkpoint gate entry is a halt instruction — the Foreman MUST stop
|
|
276
|
+
* and surface the gate to the operator before proceeding. Self-approval is
|
|
277
|
+
* structurally impossible: `self_approval_prohibited` is typed as `true` and
|
|
278
|
+
* this function never sets it to anything else.
|
|
279
|
+
*/
|
|
280
|
+
function buildCheckpointGate() {
|
|
281
|
+
const gateInstruction = (name) => `HALT at checkpoint "${name}": stop, surface this gate to the operator, and wait for explicit approval before proceeding. You may not self-approve.`;
|
|
282
|
+
return {
|
|
283
|
+
gates: {
|
|
284
|
+
canon: gateInstruction("canon"),
|
|
285
|
+
"doc-movement": gateInstruction("doc-movement"),
|
|
286
|
+
"instruction-files": gateInstruction("instruction-files"),
|
|
287
|
+
"graph-root": gateInstruction("graph-root"),
|
|
288
|
+
"route-scaffold": gateInstruction("route-scaffold"),
|
|
289
|
+
"source-mutation": gateInstruction("source-mutation"),
|
|
290
|
+
},
|
|
291
|
+
self_approval_prohibited: true,
|
|
292
|
+
enforcement_note: "Checkpoint gates are non-optional. The Foreman must halt and surface each gate to the operator. " +
|
|
293
|
+
"Proceeding without explicit operator approval is a protocol violation.",
|
|
294
|
+
};
|
|
295
|
+
}
|
|
296
|
+
function generateSetupBootstrapPacket(mode) {
|
|
297
|
+
return {
|
|
298
|
+
packet_id: (0, node_crypto_1.randomUUID)(),
|
|
299
|
+
packet_kind: "setup-bootstrap",
|
|
300
|
+
active_role: "Foreman",
|
|
301
|
+
role_file: ".polaris/skills/polaris-run/SKILL.md",
|
|
302
|
+
mode,
|
|
303
|
+
authority_boundaries: [
|
|
304
|
+
"Read repository structure and existing configuration files",
|
|
305
|
+
"Create or update Polaris configuration and scaffold files",
|
|
306
|
+
"Dispatch Workers for bounded setup sub-tasks",
|
|
307
|
+
"Coordinate approval checkpoints before advancing to the next setup phase",
|
|
308
|
+
"Write to .polaris/ directories as part of init or adopt setup",
|
|
309
|
+
"Update POLARIS.md and SUMMARY.md within the project root",
|
|
310
|
+
],
|
|
311
|
+
prohibited_actions: [
|
|
312
|
+
"Mutate source files without an approved checkpoint (unapproved mutation is forbidden)",
|
|
313
|
+
"Implement features directly — all implementation must be delegated to a Worker",
|
|
314
|
+
"Advance past an approval checkpoint without explicit user confirmation",
|
|
315
|
+
"Self-approve any checkpoint — operator approval is mandatory and cannot be delegated to the Foreman",
|
|
316
|
+
"Modify tracker state or issue descriptions during setup",
|
|
317
|
+
],
|
|
318
|
+
approval_checkpoints: SETUP_BOOTSTRAP_CHECKPOINTS,
|
|
319
|
+
checkpoint_gate: buildCheckpointGate(),
|
|
320
|
+
stop_conditions: [
|
|
321
|
+
"All setup phases complete and scaffold is valid",
|
|
322
|
+
"An approval checkpoint is reached — pause and await user confirmation",
|
|
323
|
+
"A required configuration value is missing and cannot be inferred",
|
|
324
|
+
"A Worker returns a failure result during setup",
|
|
325
|
+
],
|
|
326
|
+
generated_at: new Date().toISOString(),
|
|
327
|
+
};
|
|
328
|
+
}
|
|
329
|
+
function buildCatalogPacket() {
|
|
330
|
+
return {
|
|
331
|
+
authority_boundaries: [
|
|
332
|
+
"Read packet-scoped POLARIS.md and SUMMARY.md files",
|
|
333
|
+
"Update cognition files only within packet-allowed write paths",
|
|
334
|
+
"Read smartdocs/raw/ and classify documents through supported Polaris CLI commands",
|
|
335
|
+
"Auto-place only high-confidence documents",
|
|
336
|
+
"Leave low-confidence documents in raw when unattended or request operator direction",
|
|
337
|
+
],
|
|
338
|
+
prohibited_actions: [
|
|
339
|
+
"Modify implementation source code, tests, or configuration",
|
|
340
|
+
"Write outside packet-allowed paths",
|
|
341
|
+
"Auto-place low-confidence documents",
|
|
342
|
+
"Move or copy SmartDocs directly instead of using supported CLI commands",
|
|
343
|
+
"Call polaris loop continue or polaris finalize",
|
|
344
|
+
"Git push or create a pull request",
|
|
345
|
+
],
|
|
346
|
+
allowed_outputs: [
|
|
347
|
+
"Updated POLARIS.md and SUMMARY.md files in packet-allowed paths",
|
|
348
|
+
"Classified documents placed through supported Polaris CLI commands",
|
|
349
|
+
"A sealed local cognition and document commit",
|
|
350
|
+
"A report of deferred low-confidence documents",
|
|
351
|
+
],
|
|
352
|
+
deliverables: [
|
|
353
|
+
"Packet-scoped cognition reconciled",
|
|
354
|
+
"Raw documents classified or explicitly deferred",
|
|
355
|
+
"All changes recorded in one sealed local commit",
|
|
356
|
+
],
|
|
357
|
+
stop_conditions: [
|
|
358
|
+
"All packet-scoped cognition and raw documents processed",
|
|
359
|
+
"A required command is unsupported by the installed CLI",
|
|
360
|
+
"A requested write falls outside packet-allowed paths",
|
|
361
|
+
"An unresolved conflict requires operator direction",
|
|
362
|
+
],
|
|
363
|
+
};
|
|
364
|
+
}
|
|
365
|
+
function buildReconcilePacket() {
|
|
366
|
+
return {
|
|
367
|
+
authority_boundaries: [
|
|
368
|
+
"Read packet-scoped folders and their POLARIS.md and SUMMARY.md files",
|
|
369
|
+
"Update cognition files only within packet-allowed write paths",
|
|
370
|
+
"Create one sealed local cognition commit",
|
|
371
|
+
],
|
|
372
|
+
prohibited_actions: [
|
|
373
|
+
"Modify implementation source code, tests, or configuration",
|
|
374
|
+
"Move, ingest, classify, or promote documents",
|
|
375
|
+
"Write outside packet-allowed paths",
|
|
376
|
+
"Call polaris loop continue or polaris finalize",
|
|
377
|
+
"Git push or create a pull request",
|
|
378
|
+
],
|
|
379
|
+
allowed_outputs: [
|
|
380
|
+
"Updated POLARIS.md and SUMMARY.md files in packet-allowed paths",
|
|
381
|
+
"A sealed local cognition commit",
|
|
382
|
+
],
|
|
383
|
+
deliverables: [
|
|
384
|
+
"Packet-scoped cognition reconciled with completed work",
|
|
385
|
+
"All cognition changes recorded in one sealed local commit",
|
|
386
|
+
],
|
|
387
|
+
stop_conditions: [
|
|
388
|
+
"All packet-scoped cognition reconciled",
|
|
389
|
+
"A requested write falls outside packet-allowed paths",
|
|
390
|
+
"Work evidence is missing or contradictory",
|
|
391
|
+
],
|
|
392
|
+
};
|
|
393
|
+
}
|
|
261
394
|
function generateSkillPacket(skillName, config) {
|
|
262
395
|
const active_role = exports.SKILL_ROLE_MAP[skillName];
|
|
263
396
|
const role_summary = ROLE_SUMMARIES[active_role];
|
|
@@ -288,6 +421,12 @@ function generateSkillPacket(skillName, config) {
|
|
|
288
421
|
case "review":
|
|
289
422
|
body = buildReviewPacket();
|
|
290
423
|
break;
|
|
424
|
+
case "catalog":
|
|
425
|
+
body = buildCatalogPacket();
|
|
426
|
+
break;
|
|
427
|
+
case "reconcile":
|
|
428
|
+
body = buildReconcilePacket();
|
|
429
|
+
break;
|
|
291
430
|
}
|
|
292
431
|
return {
|
|
293
432
|
packet_id,
|
|
@@ -299,4 +438,13 @@ function generateSkillPacket(skillName, config) {
|
|
|
299
438
|
generated_at,
|
|
300
439
|
};
|
|
301
440
|
}
|
|
302
|
-
exports.SUPPORTED_SKILLS = [
|
|
441
|
+
exports.SUPPORTED_SKILLS = [
|
|
442
|
+
"analyze",
|
|
443
|
+
"run",
|
|
444
|
+
"ingest",
|
|
445
|
+
"promote",
|
|
446
|
+
"triage",
|
|
447
|
+
"review",
|
|
448
|
+
"catalog",
|
|
449
|
+
"reconcile",
|
|
450
|
+
];
|
|
@@ -10,11 +10,9 @@
|
|
|
10
10
|
* node tools.js polaris_loop_status
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
const fs = require('fs');
|
|
17
|
-
const path = require('path');
|
|
13
|
+
let spawnSync;
|
|
14
|
+
let fs;
|
|
15
|
+
let path;
|
|
18
16
|
|
|
19
17
|
// ── binary resolution ──────────────────────────────────────────────────────
|
|
20
18
|
|
|
@@ -171,21 +169,32 @@ function unknownTool(tool) {
|
|
|
171
169
|
|
|
172
170
|
// ── dispatch ───────────────────────────────────────────────────────────────
|
|
173
171
|
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
172
|
+
async function main() {
|
|
173
|
+
({ spawnSync } = await import('node:child_process'));
|
|
174
|
+
fs = await import('node:fs');
|
|
175
|
+
path = await import('node:path');
|
|
176
|
+
|
|
177
|
+
const [, , tool] = process.argv;
|
|
178
|
+
|
|
179
|
+
switch (tool) {
|
|
180
|
+
case 'polaris_run':
|
|
181
|
+
operatorOnly('polaris_run', 'polaris run <issue_id>');
|
|
182
|
+
break;
|
|
183
|
+
case 'polaris_loop_continue':
|
|
184
|
+
operatorOnly('polaris_loop_continue', 'polaris loop continue');
|
|
185
|
+
break;
|
|
186
|
+
case 'polaris_status':
|
|
187
|
+
polarisStatus('polaris_status', ['status', '--json']);
|
|
188
|
+
break;
|
|
189
|
+
case 'polaris_loop_status':
|
|
190
|
+
polarisStatus('polaris_loop_status', ['loop', 'status', '--json']);
|
|
191
|
+
break;
|
|
192
|
+
default:
|
|
193
|
+
unknownTool(tool);
|
|
194
|
+
}
|
|
191
195
|
}
|
|
196
|
+
|
|
197
|
+
main().catch((error) => {
|
|
198
|
+
console.log(JSON.stringify({ error: error instanceof Error ? error.message : String(error) }));
|
|
199
|
+
process.exit(1);
|
|
200
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lsctech/polaris",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.1",
|
|
4
4
|
"description": "Polaris — standalone taskchain orchestration framework for governed AI agent workflows",
|
|
5
5
|
"bin": {
|
|
6
6
|
"polaris": "dist/cli/index.js",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"node": ">=22.0.0"
|
|
23
23
|
},
|
|
24
24
|
"scripts": {
|
|
25
|
-
"build": "tsc && rm -rf dist/workspace && cp -r src/workspace dist/workspace",
|
|
25
|
+
"build": "tsc && rm -rf dist/workspace && cp -r src/workspace dist/workspace && cp .codex/plugins/polaris/skills/polaris-tools/tools.js dist/workspace/.polaris/skills/polaris-tools/tools.js",
|
|
26
26
|
"lint": "tsc --noEmit",
|
|
27
27
|
"typecheck": "tsc --noEmit --project tsconfig.typecheck.json",
|
|
28
28
|
"test": "vitest run",
|