@kenkyou/supekku 0.1.0-alpha.7 → 0.1.0-alpha.8
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-reply-CKqbCSJ6.mjs → agent-reply-BVO6qcmJ.mjs} +1 -1
- package/dist/archive-CpcY2BcO.mjs +1 -0
- package/dist/{journal-CletC1o_.mjs → archive-YanRypPH.mjs} +5 -269
- package/dist/{archive-BHJlkQjL.mjs → archive-fnLRBLHD.mjs} +6 -5
- package/dist/artifact-CQOFviqq.mjs +2 -0
- package/dist/{artifact-ht-_ab-q.mjs → artifact-DyPzfc7L.mjs} +5 -5
- package/dist/{browser-DsFc6whG.mjs → browser-GAOPQH9h.mjs} +1 -1
- package/dist/{challenge-brief-ByEEcHIp.mjs → challenge-brief--2-bDO8A.mjs} +3 -3
- package/dist/change-Crv0O1j3.mjs +1 -0
- package/dist/{change-BSCac-hT.mjs → change-DNLxzdWK.mjs} +2 -1
- package/dist/change-archive.md +3 -1
- package/dist/cli-publication.md +4 -0
- package/dist/{connection-DxmpUdAJ.mjs → connection-DxigvTHW.mjs} +15 -1
- package/dist/{doctor-BH9O3U_5.mjs → doctor-CK0Ny6ct.mjs} +1 -1
- package/dist/doctor-CdPqyaCC.mjs +1 -0
- package/dist/{feedback-4XuusCbH.mjs → feedback-Bd4AuswE.mjs} +1 -1
- package/dist/{feedback-PKiTi5qD.mjs → feedback-DIHPDle4.mjs} +4 -4
- package/dist/index.mjs +45 -19
- package/dist/{init-CL2fItAc.mjs → init-BJ9BXQf-.mjs} +2 -2
- package/dist/journal-Da95Qqey.mjs +271 -0
- package/dist/{local-A2AY5rQ1.mjs → local-DyZAVffW.mjs} +1 -1
- package/dist/{local-xRU7p3F-.mjs → local-PdPue5jY.mjs} +1 -1
- package/dist/{maintenance-B4ZLnUbx.mjs → maintenance-BHKtYJIT.mjs} +2 -2
- package/dist/{project-lfHLrk6Y.mjs → project-BKg9kde5.mjs} +2 -2
- package/dist/{project-YQvOlymW.mjs → project-BMl3DPyE.mjs} +1 -1
- package/dist/{project-bb7Dgih2.mjs → project-CTKghH7_.mjs} +1 -1
- package/dist/{project-DJzuN18W.mjs → project-CWpJQSO5.mjs} +1 -1
- package/dist/{project-connection-vkvxD1dF.mjs → project-connection-C0nYGopT.mjs} +3 -3
- package/dist/{publish-Mcse7Ibn.mjs → publish-DZAod5L7.mjs} +5 -3
- package/dist/records-D3wvkIuV.mjs +62 -0
- package/dist/records-DzVfCcPk.mjs +625 -0
- package/dist/{review-status-DHcOnJs-.mjs → review-status-OBrm3vzd.mjs} +1 -1
- package/dist/skills/supekku-development/SKILL.md +2 -0
- package/dist/skills/supekku-development/references/change-archive.md +3 -1
- package/dist/skills/supekku-development/references/workflow-records.md +77 -0
- package/dist/{status-BdIQMftm.mjs → status-B7GWMROT.mjs} +2 -2
- package/dist/{status-CZ07SyAP.mjs → status-DSbw584b.mjs} +5 -5
- package/dist/status-TcuF2Pd0.mjs +1 -0
- package/dist/{task-CUY_fL1e.mjs → task-C7oNTNC3.mjs} +5 -4
- package/dist/task-DfJ5t8aZ.mjs +1 -0
- package/dist/{task-snapshot-B40rnvav.mjs → task-snapshot-CNi4Yswc.mjs} +1 -1
- package/dist/viewer/assets/{core-XryUEwrO.js → core-BD2tv9Os.js} +1 -1
- package/dist/viewer/assets/{local-B7NmMY2e.js → local-Ba8cpiuE.js} +1 -1
- package/dist/viewer/assets/{local-B1h-m5xi.css → local-CvVckSDM.css} +1 -1
- package/dist/viewer/local.html +2 -2
- package/dist/workflow-records.md +77 -0
- package/package.json +1 -1
- package/dist/archive-DJg-0nGZ.mjs +0 -1
- package/dist/artifact--xKIG-w-.mjs +0 -2
- package/dist/change-CZfMqVRR.mjs +0 -1
- package/dist/doctor-qnCXeloq.mjs +0 -1
- package/dist/status-BRrn3Blu.mjs +0 -1
- package/dist/task-BJ7JFYIc.mjs +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { l as Check, t as CoreError, u as Type } from "./src-CRhxwFAN.mjs";
|
|
2
2
|
import { a as artifactId, r as LocalId } from "./artifact-local-Bfy69a9H.mjs";
|
|
3
3
|
import { t as Uuid } from "./api-C2o9bca2.mjs";
|
|
4
|
-
import { i as readBinding } from "./project-
|
|
4
|
+
import { i as readBinding } from "./project-BKg9kde5.mjs";
|
|
5
5
|
import { a as response, t as CommentView } from "./collaboration-Dw4ikptb.mjs";
|
|
6
6
|
import "./review-submissions-CY4IQpkU.mjs";
|
|
7
7
|
// ../../packages/contracts/src/agent-replies.ts
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { t as archiveCommand } from "./archive-fnLRBLHD.mjs";
|
|
@@ -1,12 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { l as Check, n as Hash, t as CoreError, u as Type } from "./src-CRhxwFAN.mjs";
|
|
2
|
+
import { t as hash } from "./src-DeDtBfdV.mjs";
|
|
3
|
+
import { t as WorkflowId } from "./change-DgUPVNsm.mjs";
|
|
4
4
|
import { n as inspectWorkflow, r as workflowMarkdown, t as validateVerification } from "./verification-B4QMPPeA.mjs";
|
|
5
|
-
import { randomUUID } from "node:crypto";
|
|
6
|
-
import { dirname, join } from "node:path";
|
|
7
|
-
import { chmodSync, existsSync, lstatSync, readFileSync, realpathSync } from "node:fs";
|
|
8
5
|
import { isDeepStrictEqual } from "node:util";
|
|
9
|
-
import Database from "better-sqlite3";
|
|
10
6
|
// ../../packages/contracts/src/archive.ts
|
|
11
7
|
const strict$1 = { additionalProperties: false };
|
|
12
8
|
const markdown = Type.String({ maxLength: 1024 ** 2 });
|
|
@@ -633,270 +629,10 @@ function archiveReceipt(plan, operationId, preparedAt) {
|
|
|
633
629
|
attemptId: events[start].operationId,
|
|
634
630
|
sourceHash: t.sourceHash,
|
|
635
631
|
eventHash: t.eventHash,
|
|
632
|
+
roundsWithFindings: events.filter((e) => e.kind === "challenge" && e.findings.length).length,
|
|
636
633
|
evidence: events.slice(start + 1)
|
|
637
634
|
};
|
|
638
635
|
})
|
|
639
636
|
};
|
|
640
637
|
}
|
|
641
|
-
|
|
642
|
-
function validatePlan(input) {
|
|
643
|
-
const value = structuredClone(planPayload(input));
|
|
644
|
-
const rebuilt = plan(value.base, value.revision);
|
|
645
|
-
const legacyId = hash(JSON.stringify({
|
|
646
|
-
revision: value.revision,
|
|
647
|
-
baseHash: value.baseHash,
|
|
648
|
-
targetHash: value.targetHash
|
|
649
|
-
}));
|
|
650
|
-
if (rebuilt.planId !== value.planId && legacyId !== value.planId || rebuilt.baseHash !== value.baseHash || rebuilt.targetHash !== value.targetHash || rebuilt.target !== value.target) throw new CoreError("PLAN_INVALID", "Plan content has been modified");
|
|
651
|
-
return freeze(value);
|
|
652
|
-
}
|
|
653
|
-
const CLI_VERSION = "0.0.0";
|
|
654
|
-
const migrationFiles = [
|
|
655
|
-
"0001_initial.sql",
|
|
656
|
-
"0002_identity.sql",
|
|
657
|
-
"0003_task_events.sql",
|
|
658
|
-
"0004_archive_operations.sql"
|
|
659
|
-
];
|
|
660
|
-
const migrations = () => migrationFiles.map((name, i) => ({
|
|
661
|
-
version: i + 1,
|
|
662
|
-
name,
|
|
663
|
-
sql: readFileSync(new URL("./migrations/" + name, import.meta.url), "utf8")
|
|
664
|
-
}));
|
|
665
|
-
function assertRegular(path) {
|
|
666
|
-
const stat = lstatSync(path);
|
|
667
|
-
if (!stat.isFile() || stat.isSymbolicLink()) throw new CoreError("INVALID_PATH", "Expected a regular file: " + path);
|
|
668
|
-
}
|
|
669
|
-
function assertNoRestore(path) {
|
|
670
|
-
if (existsSync(join(dirname(path), "restore-intent.json"))) throw new CoreError("RESTORE_INTERRUPTED", "Complete local db restore --resume before opening the journal");
|
|
671
|
-
}
|
|
672
|
-
function connect(path, readonly = false) {
|
|
673
|
-
if (!existsSync(path)) throw new CoreError("NOT_INITIALIZED", "Journal file does not exist");
|
|
674
|
-
assertRegular(path);
|
|
675
|
-
for (const suffix of [
|
|
676
|
-
"-wal",
|
|
677
|
-
"-shm",
|
|
678
|
-
"-journal"
|
|
679
|
-
]) if (existsSync(path + suffix)) assertRegular(path + suffix);
|
|
680
|
-
return new Database(path, {
|
|
681
|
-
readonly,
|
|
682
|
-
fileMustExist: true,
|
|
683
|
-
timeout: 5e3
|
|
684
|
-
});
|
|
685
|
-
}
|
|
686
|
-
function meta(db) {
|
|
687
|
-
return Number(db.pragma("user_version", { simple: true })) >= 2 ? db.prepare("SELECT * FROM journal_meta WHERE singleton=1").get() : void 0;
|
|
688
|
-
}
|
|
689
|
-
function inspectDatabase(db) {
|
|
690
|
-
const version = db.pragma("user_version", { simple: true });
|
|
691
|
-
if (version > 4) throw new CoreError("SCHEMA_TOO_NEW", "Update the CLI; journal schema is newer");
|
|
692
|
-
if (version < 1) throw new CoreError("MIGRATION_REQUIRED", "Unknown schema; refusing to reinitialize");
|
|
693
|
-
const rows = db.prepare("SELECT version,checksum FROM migrations ORDER BY version").all();
|
|
694
|
-
const available = migrations();
|
|
695
|
-
if (rows.length !== version || rows.some((r, i) => r.version !== i + 1 || r.checksum !== hash(available[i].sql))) throw new CoreError("MIGRATION_MISMATCH", "Migration ledger or checksum does not match");
|
|
696
|
-
const checks = db.pragma("integrity_check");
|
|
697
|
-
if (checks.length !== 1 || checks[0].integrity_check !== "ok" || db.pragma("foreign_key_check").length) throw new CoreError("JOURNAL_CORRUPT", "Database integrity check failed");
|
|
698
|
-
const operations = db.prepare("SELECT * FROM operations ORDER BY id").all();
|
|
699
|
-
for (const row of operations) try {
|
|
700
|
-
if (typeof row.id !== "string" || !row.id || typeof row.path !== "string" || typeof row.plan !== "string" || !["prepared", "written"].includes(String(row.write_state)) || ![
|
|
701
|
-
"not_run",
|
|
702
|
-
"running",
|
|
703
|
-
"passed",
|
|
704
|
-
"failed",
|
|
705
|
-
"interrupted"
|
|
706
|
-
].includes(String(row.verification)) || ![
|
|
707
|
-
"pending",
|
|
708
|
-
"sending",
|
|
709
|
-
"acknowledged",
|
|
710
|
-
"unknown"
|
|
711
|
-
].includes(String(row.report)) || version >= 2 && row.payload_version !== 1) throw new Error("Unsupported operation");
|
|
712
|
-
validatePlan(JSON.parse(row.plan));
|
|
713
|
-
} catch {
|
|
714
|
-
throw new CoreError("PAYLOAD_UNSUPPORTED", "Invalid or unsupported operation payload: " + String(row.id));
|
|
715
|
-
}
|
|
716
|
-
if (version >= 3) {
|
|
717
|
-
const rows = db.prepare("SELECT * FROM task_events ORDER BY sequence").all();
|
|
718
|
-
for (const row of rows) try {
|
|
719
|
-
workflowId(row.change_id);
|
|
720
|
-
const request = taskEvidence(JSON.parse(row.request)), event = JSON.parse(row.event);
|
|
721
|
-
if (!/^TASK-[0-9]{3,}$/.test(row.task_id) || row.task_id.length > 64 || row.operation_id !== request.operationId || !/^[a-f0-9]{64}$/.test(event.inputHash) || !/^[a-f0-9]{64}$/.test(event.sourceHash) || typeof event.createdAt !== "string" || !Number.isFinite(Date.parse(event.createdAt))) throw new Error();
|
|
722
|
-
const expected = {
|
|
723
|
-
...request,
|
|
724
|
-
inputHash: event.inputHash,
|
|
725
|
-
sourceHash: event.sourceHash,
|
|
726
|
-
createdAt: event.createdAt
|
|
727
|
-
};
|
|
728
|
-
if (Object.keys(event).length !== Object.keys(expected).length || Object.entries(expected).some(([k, v]) => !isDeepStrictEqual(event[k], v))) throw new Error();
|
|
729
|
-
if (request.kind !== "start" && (request.inputHash !== event.inputHash || request.sourceHash !== event.sourceHash)) throw new Error();
|
|
730
|
-
} catch {
|
|
731
|
-
throw new CoreError("PAYLOAD_UNSUPPORTED", "Invalid or unsupported task event payload");
|
|
732
|
-
}
|
|
733
|
-
}
|
|
734
|
-
const identity = meta(db);
|
|
735
|
-
if (version >= 2 && (!identity || !identity.database_id || !identity.checkout || ![0, 1].includes(identity.reconcile_required))) throw new CoreError("JOURNAL_CORRUPT", "Missing or invalid journal identity");
|
|
736
|
-
const archives = version >= 4 ? db.prepare("SELECT * FROM archive_operations ORDER BY operation_id").all() : [];
|
|
737
|
-
for (const row of archives) try {
|
|
738
|
-
const plan = checkedArchivePlan(JSON.parse(row.plan));
|
|
739
|
-
if (!/^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/.test(row.operation_id) || row.change_id !== plan.changeId || !["prepared", "completed"].includes(row.state) || !Number.isFinite(Date.parse(row.prepared_at))) throw new Error();
|
|
740
|
-
} catch {
|
|
741
|
-
throw new CoreError("PAYLOAD_UNSUPPORTED", "Invalid archive operation payload");
|
|
742
|
-
}
|
|
743
|
-
return {
|
|
744
|
-
schemaVersion: version,
|
|
745
|
-
identity,
|
|
746
|
-
operations,
|
|
747
|
-
archives
|
|
748
|
-
};
|
|
749
|
-
}
|
|
750
|
-
function migrate(db, identity, steps = migrations()) {
|
|
751
|
-
const from = db.pragma("user_version", { simple: true });
|
|
752
|
-
db.transaction(() => {
|
|
753
|
-
if (from === 0) db.exec("CREATE TABLE migrations (version INTEGER PRIMARY KEY, checksum TEXT NOT NULL)");
|
|
754
|
-
for (const step of steps.filter((s) => s.version > from)) {
|
|
755
|
-
const before = db.pragma("user_version", { simple: true });
|
|
756
|
-
if (step.version !== before + 1) throw new CoreError("MIGRATION_GAP", "Migration sequence is incomplete");
|
|
757
|
-
db.exec(step.sql);
|
|
758
|
-
if (step.version === 1) db.prepare("INSERT INTO migrations(version,checksum) VALUES (?,?)").run(step.version, hash(step.sql));
|
|
759
|
-
else db.prepare("INSERT INTO migrations(version,checksum,name,applied_at,cli_version) VALUES (?,?,?,?,?)").run(step.version, hash(step.sql), step.name, (/* @__PURE__ */ new Date()).toISOString(), CLI_VERSION);
|
|
760
|
-
db.pragma("user_version=" + step.version);
|
|
761
|
-
}
|
|
762
|
-
if (Number(db.pragma("user_version", { simple: true })) >= 2) {
|
|
763
|
-
db.prepare("INSERT OR IGNORE INTO journal_meta(singleton,database_id,checkout) VALUES (1,?,?)").run(identity.databaseId, identity.checkout);
|
|
764
|
-
db.prepare("UPDATE migrations SET name=? WHERE version=1 AND name='legacy'").run(migrationFiles[0]);
|
|
765
|
-
}
|
|
766
|
-
inspectDatabase(db);
|
|
767
|
-
}).immediate();
|
|
768
|
-
}
|
|
769
|
-
function newIdentity(checkout) {
|
|
770
|
-
return {
|
|
771
|
-
databaseId: randomUUID(),
|
|
772
|
-
checkout
|
|
773
|
-
};
|
|
774
|
-
}
|
|
775
|
-
function assertNoArchiveIntent(local) {
|
|
776
|
-
try {
|
|
777
|
-
lstatSync(join(local, "archive-intent.json"));
|
|
778
|
-
} catch (e) {
|
|
779
|
-
if (e.code === "ENOENT") return;
|
|
780
|
-
throw e;
|
|
781
|
-
}
|
|
782
|
-
throw new CoreError("RECOVERY_REQUIRED", "Resume archive before mutating or restoring local state");
|
|
783
|
-
}
|
|
784
|
-
// src/local/journal/index.ts
|
|
785
|
-
function openJournal(path, initialize = false) {
|
|
786
|
-
assertNoRestore(path);
|
|
787
|
-
if (!initialize && !existsSync(path)) throw new CoreError("NOT_INITIALIZED", "Run local init first");
|
|
788
|
-
const creating = !existsSync(path);
|
|
789
|
-
if (!creating) assertRegular(path);
|
|
790
|
-
const db = creating ? new Database(path, { timeout: 5e3 }) : connect(path);
|
|
791
|
-
try {
|
|
792
|
-
chmodSync(path, 384);
|
|
793
|
-
db.pragma("foreign_keys = ON");
|
|
794
|
-
db.pragma("synchronous = FULL");
|
|
795
|
-
if (creating) {
|
|
796
|
-
db.pragma("journal_mode = WAL");
|
|
797
|
-
migrate(db, newIdentity(realpathSync(dirname(path))));
|
|
798
|
-
}
|
|
799
|
-
const info = inspectDatabase(db);
|
|
800
|
-
if (info.schemaVersion < 4) throw new CoreError("MIGRATION_REQUIRED", "Run local db upgrade explicitly");
|
|
801
|
-
if (info.identity?.checkout !== realpathSync(dirname(path))) throw new CoreError("CHECKOUT_MISMATCH", "Journal belongs to another checkout");
|
|
802
|
-
if (db.pragma("journal_mode", { simple: true }) !== "wal") throw new CoreError("JOURNAL_MODE_INVALID", "Expected WAL journal");
|
|
803
|
-
function assertWritable(allowArchive = false) {
|
|
804
|
-
if (!allowArchive) assertNoArchiveIntent(dirname(path));
|
|
805
|
-
if (!allowArchive && db.prepare("SELECT 1 FROM archive_operations WHERE state='prepared'").get()) throw new CoreError("RECOVERY_REQUIRED", "Resume the pending archive before mutating local state");
|
|
806
|
-
if (meta(db)?.reconcile_required) throw new CoreError("RECONCILE_REQUIRED", "Reconcile restored data before any operation mutation");
|
|
807
|
-
}
|
|
808
|
-
return {
|
|
809
|
-
archiveGet(id) {
|
|
810
|
-
return db.prepare("SELECT * FROM archive_operations WHERE operation_id=?").get(id);
|
|
811
|
-
},
|
|
812
|
-
archiveForChange(id) {
|
|
813
|
-
return db.prepare("SELECT * FROM archive_operations WHERE change_id=?").get(id);
|
|
814
|
-
},
|
|
815
|
-
archivePrepare(row) {
|
|
816
|
-
assertWritable();
|
|
817
|
-
if (db.prepare("SELECT 1 FROM operations WHERE write_state='prepared'").get()) throw new CoreError("RECOVERY_REQUIRED", "Resume pending local operation first");
|
|
818
|
-
db.transaction(() => db.prepare("INSERT INTO archive_operations(operation_id,change_id,plan,prepared_at,state) VALUES (?,?,?,?,?)").run(row.operation_id, row.change_id, row.plan, row.prepared_at, row.state)).immediate();
|
|
819
|
-
},
|
|
820
|
-
archiveComplete(id) {
|
|
821
|
-
assertWritable(true);
|
|
822
|
-
db.prepare("UPDATE archive_operations SET state='completed' WHERE operation_id=?").run(id);
|
|
823
|
-
},
|
|
824
|
-
taskEvents(changeId, taskId) {
|
|
825
|
-
return db.prepare("SELECT event FROM task_events WHERE change_id=? AND task_id=? ORDER BY sequence").all(changeId, taskId).map((r) => JSON.parse(r.event));
|
|
826
|
-
},
|
|
827
|
-
taskRetry(operationId, changeId, taskId, request) {
|
|
828
|
-
const row = db.prepare("SELECT * FROM task_events WHERE operation_id=?").get(operationId);
|
|
829
|
-
if (!row) return null;
|
|
830
|
-
if (row.change_id !== changeId || row.task_id !== taskId || row.request !== request) throw new CoreError("IDEMPOTENCY_CONFLICT", "Operation ID belongs to different task evidence");
|
|
831
|
-
return JSON.parse(row.event);
|
|
832
|
-
},
|
|
833
|
-
appendTask(changeId, taskId, request, event) {
|
|
834
|
-
assertWritable();
|
|
835
|
-
db.transaction(() => db.prepare("INSERT INTO task_events(operation_id,change_id,task_id,request,event) VALUES (?,?,?,?,?)").run(event.operationId, changeId, taskId, request, JSON.stringify(event))).immediate();
|
|
836
|
-
return event;
|
|
837
|
-
},
|
|
838
|
-
settings() {
|
|
839
|
-
return {
|
|
840
|
-
journalMode: db.pragma("journal_mode", { simple: true }),
|
|
841
|
-
synchronous: db.pragma("synchronous", { simple: true }),
|
|
842
|
-
busyTimeout: db.pragma("busy_timeout", { simple: true }),
|
|
843
|
-
foreignKeys: db.pragma("foreign_keys", { simple: true })
|
|
844
|
-
};
|
|
845
|
-
},
|
|
846
|
-
assertWritable,
|
|
847
|
-
prepare(id, path, p) {
|
|
848
|
-
p = validatePlan(p);
|
|
849
|
-
assertWritable();
|
|
850
|
-
db.transaction(() => {
|
|
851
|
-
const old = db.prepare("SELECT * FROM operations WHERE id=?").get(id);
|
|
852
|
-
if (old) {
|
|
853
|
-
if (old.path !== path || JSON.parse(old.plan).planId !== p.planId) throw new CoreError("IDEMPOTENCY_CONFLICT", "Operation ID belongs to different content");
|
|
854
|
-
return;
|
|
855
|
-
}
|
|
856
|
-
if (db.prepare("SELECT id FROM operations WHERE write_state='prepared'").get()) throw new CoreError("RECOVERY_REQUIRED", "Resume the pending operation first");
|
|
857
|
-
db.prepare("INSERT INTO operations(id,path,plan,write_state) VALUES (?,?,?,'prepared')").run(id, path, JSON.stringify(p));
|
|
858
|
-
}).immediate();
|
|
859
|
-
},
|
|
860
|
-
list() {
|
|
861
|
-
return db.prepare("SELECT id,path,write_state,verification,report FROM operations ORDER BY id").all();
|
|
862
|
-
},
|
|
863
|
-
get(id) {
|
|
864
|
-
const row = db.prepare("SELECT * FROM operations WHERE id=?").get(id);
|
|
865
|
-
if (!row) throw new CoreError("NOT_FOUND", "Operation not found");
|
|
866
|
-
return row;
|
|
867
|
-
},
|
|
868
|
-
written(id) {
|
|
869
|
-
assertWritable();
|
|
870
|
-
db.prepare("UPDATE operations SET write_state='written' WHERE id=?").run(id);
|
|
871
|
-
},
|
|
872
|
-
close() {
|
|
873
|
-
db.close();
|
|
874
|
-
},
|
|
875
|
-
async backup(path) {
|
|
876
|
-
await db.backup(path);
|
|
877
|
-
}
|
|
878
|
-
};
|
|
879
|
-
} catch (e) {
|
|
880
|
-
db.close();
|
|
881
|
-
throw e;
|
|
882
|
-
}
|
|
883
|
-
}
|
|
884
|
-
/** Public discovery returns metadata only; never opens the normal writable journal adapter. */
|
|
885
|
-
function listArchiveOperations(path, all) {
|
|
886
|
-
assertNoRestore(path);
|
|
887
|
-
const db = connect(path, true);
|
|
888
|
-
try {
|
|
889
|
-
return db.transaction(() => {
|
|
890
|
-
const info = inspectDatabase(db);
|
|
891
|
-
if (info.schemaVersion < 4) throw new CoreError("MIGRATION_REQUIRED", "Run local db upgrade explicitly");
|
|
892
|
-
if (info.identity?.checkout !== realpathSync(dirname(path))) throw new CoreError("CHECKOUT_MISMATCH", "Journal belongs to another checkout");
|
|
893
|
-
if (db.pragma("journal_mode", { simple: true }) !== "wal") throw new CoreError("JOURNAL_MODE_INVALID", "Expected WAL journal");
|
|
894
|
-
return db.prepare(`SELECT operation_id AS operationId, change_id AS changeId,
|
|
895
|
-
state, prepared_at AS preparedAt FROM archive_operations
|
|
896
|
-
${all ? "" : "WHERE state='prepared'"} ORDER BY prepared_at DESC, operation_id ASC`).all();
|
|
897
|
-
})();
|
|
898
|
-
} finally {
|
|
899
|
-
db.close();
|
|
900
|
-
}
|
|
901
|
-
}
|
|
902
|
-
export { validateChange as _, assertNoRestore as a, taskState as b, inspectDatabase as c, newIdentity as d, archiveReceipt as f, validScopePath as g, deniedScopeName as h, assertNoArchiveIntent as i, meta as l, mergeFormal as m, openJournal as n, assertRegular as o, checkedArchivePlan as p, CLI_VERSION as r, connect as s, listArchiveOperations as t, migrate as u, acceptTaskEvent as v, taskEvidence as x, challengePolicy as y };
|
|
638
|
+
export { validScopePath as a, challengePolicy as c, deniedScopeName as i, taskState as l, checkedArchivePlan as n, validateChange as o, mergeFormal as r, acceptTaskEvent as s, archiveReceipt as t, taskEvidence as u };
|
|
@@ -3,15 +3,16 @@ import { t as hash } from "./src-DeDtBfdV.mjs";
|
|
|
3
3
|
import { i as syncDocument, t as atomicReplace } from "./files-DphxaLNK.mjs";
|
|
4
4
|
import { n as workflowId } from "./change-DgUPVNsm.mjs";
|
|
5
5
|
import { n as inspectWorkflow } from "./verification-B4QMPPeA.mjs";
|
|
6
|
-
import {
|
|
6
|
+
import { n as checkedArchivePlan, r as mergeFormal, t as archiveReceipt } from "./archive-YanRypPH.mjs";
|
|
7
7
|
import { t as readBounded } from "./files-Ca24RKdp.mjs";
|
|
8
8
|
import { n as withLocks } from "./locks-C4XYFwbg.mjs";
|
|
9
9
|
import { t as findProject } from "./project-directory-w_ITkI7O.mjs";
|
|
10
|
-
import { t as
|
|
10
|
+
import { n as openJournal, t as listArchiveOperations } from "./journal-Da95Qqey.mjs";
|
|
11
|
+
import { t as context } from "./local-DyZAVffW.mjs";
|
|
11
12
|
import { t as readVerification } from "./verification-cEb-1z2d.mjs";
|
|
12
|
-
import { t as bundle } from "./change-
|
|
13
|
-
import { t as sourceFingerprint } from "./task-snapshot-
|
|
14
|
-
import { n as taskCommand } from "./task-
|
|
13
|
+
import { t as bundle } from "./change-DNLxzdWK.mjs";
|
|
14
|
+
import { t as sourceFingerprint } from "./task-snapshot-CNi4Yswc.mjs";
|
|
15
|
+
import { n as taskCommand } from "./task-C7oNTNC3.mjs";
|
|
15
16
|
import { randomUUID } from "node:crypto";
|
|
16
17
|
import { dirname, join } from "node:path";
|
|
17
18
|
import { link, lstat, mkdir, open, readdir, rename, unlink } from "node:fs/promises";
|
|
@@ -136,9 +136,9 @@ async function artifactCommand(action, args, project) {
|
|
|
136
136
|
if (action === "template") return artifactTemplate(args[0], args[1]);
|
|
137
137
|
const root = await findProject(project);
|
|
138
138
|
if (action === "status") {
|
|
139
|
-
const { artifactStatus } = await import("./status-
|
|
139
|
+
const { artifactStatus } = await import("./status-TcuF2Pd0.mjs");
|
|
140
140
|
if (!args.includes("--remote")) return artifactStatus(root, args[0]);
|
|
141
|
-
const { boundConnection } = await import("./project-connection-
|
|
141
|
+
const { boundConnection } = await import("./project-connection-C0nYGopT.mjs");
|
|
142
142
|
return artifactStatus(root, args[0], await boundConnection(root));
|
|
143
143
|
}
|
|
144
144
|
if ([
|
|
@@ -146,8 +146,8 @@ async function artifactCommand(action, args, project) {
|
|
|
146
146
|
"publish-status",
|
|
147
147
|
"publish-resume"
|
|
148
148
|
].includes(action)) {
|
|
149
|
-
const { publishArtifact, resumePublication } = await import("./publish-
|
|
150
|
-
const { boundConnection } = await import("./project-connection-
|
|
149
|
+
const { publishArtifact, resumePublication } = await import("./publish-DZAod5L7.mjs");
|
|
150
|
+
const { boundConnection } = await import("./project-connection-C0nYGopT.mjs");
|
|
151
151
|
const remote = await boundConnection(root);
|
|
152
152
|
return action === "publish" ? publishArtifact(root, args[0], args[2], args.includes("--dry-run"), remote, (operationId) => {
|
|
153
153
|
process.stderr.write(JSON.stringify({
|
|
@@ -227,7 +227,7 @@ async function artifactCommand(action, args, project) {
|
|
|
227
227
|
return { artifacts };
|
|
228
228
|
}
|
|
229
229
|
if (action === "feedback") {
|
|
230
|
-
const { feedback } = await import("./feedback-
|
|
230
|
+
const { feedback } = await import("./feedback-DIHPDle4.mjs");
|
|
231
231
|
return feedback(root, args);
|
|
232
232
|
}
|
|
233
233
|
if (action === "serve") {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as CoreError } from "./src-CRhxwFAN.mjs";
|
|
2
|
-
import { n as serverOrigin } from "./connection-
|
|
2
|
+
import { n as serverOrigin } from "./connection-DxigvTHW.mjs";
|
|
3
3
|
import { spawn } from "node:child_process";
|
|
4
4
|
// src/remote/browser.ts
|
|
5
5
|
function browserCommand(platform, url) {
|
|
@@ -2,10 +2,10 @@ import { t as CoreError } from "./src-CRhxwFAN.mjs";
|
|
|
2
2
|
import { t as hash } from "./src-DeDtBfdV.mjs";
|
|
3
3
|
import { n as workflowId } from "./change-DgUPVNsm.mjs";
|
|
4
4
|
import { n as inspectWorkflow } from "./verification-B4QMPPeA.mjs";
|
|
5
|
-
import {
|
|
5
|
+
import { c as challengePolicy, o as validateChange } from "./archive-YanRypPH.mjs";
|
|
6
6
|
import { t as findProject } from "./project-directory-w_ITkI7O.mjs";
|
|
7
|
-
import { t as bundle } from "./change-
|
|
8
|
-
import { t as sourceFingerprint } from "./task-snapshot-
|
|
7
|
+
import { t as bundle } from "./change-DNLxzdWK.mjs";
|
|
8
|
+
import { t as sourceFingerprint } from "./task-snapshot-CNi4Yswc.mjs";
|
|
9
9
|
import { join } from "node:path";
|
|
10
10
|
// src/commands/challenge-brief.ts
|
|
11
11
|
const rules = [
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { n as changeCommand } from "./change-DNLxzdWK.mjs";
|
|
@@ -2,10 +2,11 @@ import { t as CoreError } from "./src-CRhxwFAN.mjs";
|
|
|
2
2
|
import { t as hash } from "./src-DeDtBfdV.mjs";
|
|
3
3
|
import { n as workflowId } from "./change-DgUPVNsm.mjs";
|
|
4
4
|
import { n as inspectWorkflow, r as workflowMarkdown } from "./verification-B4QMPPeA.mjs";
|
|
5
|
-
import {
|
|
5
|
+
import { o as validateChange } from "./archive-YanRypPH.mjs";
|
|
6
6
|
import { t as readBounded } from "./files-Ca24RKdp.mjs";
|
|
7
7
|
import { n as withLocks } from "./locks-C4XYFwbg.mjs";
|
|
8
8
|
import { t as findProject } from "./project-directory-w_ITkI7O.mjs";
|
|
9
|
+
import { i as assertNoArchiveIntent, n as openJournal } from "./journal-Da95Qqey.mjs";
|
|
9
10
|
import { t as readVerification } from "./verification-cEb-1z2d.mjs";
|
|
10
11
|
import { randomUUID } from "node:crypto";
|
|
11
12
|
import { join } from "node:path";
|
package/dist/change-archive.md
CHANGED
|
@@ -39,11 +39,13 @@ completion.json 的 receiptVersion 為1,包含:
|
|
|
39
39
|
|
|
40
40
|
- operationId、changeId、preparedAt(操作準備時間)、planHash、inputHash。
|
|
41
41
|
- 每份正式檔案的相對路徑、beforeHash(新檔為null)與 afterHash。
|
|
42
|
-
- 每個任務的 taskId、attemptId、sourceHash、eventHash
|
|
42
|
+
- 每個任務的 taskId、attemptId、sourceHash、eventHash、roundsWithFindings(這個任務所有 attempt 中含有確認發現的挑戰輪數)與該 attempt 的 TDD/Verify/Challenge/Review/finish 事件。較早版本寫下的完成紀錄沒有 roundsWithFindings。
|
|
43
43
|
- attestationOnly=true:這是當時 Agent 陳述與內容對應的歷史紀錄,不是防偽憑證或新 checkout 的執行權限。
|
|
44
44
|
|
|
45
45
|
此檔可進 Git;不包含 start 的授權文字,但其他事件的 command、summary、reviewer 與 findings 會保存,Agent 提交時必須去除敏感資訊。完整凍結計畫與事件仍保存在 `.supekku/.local/operations.sqlite`,不進 Git。
|
|
46
46
|
|
|
47
|
+
封存不會把紀錄送到任何地方。要讓專案管理者在 Web 上看到,需要另外、明確地執行 `supekku records publish`,見 [規格紀錄上傳與檢視](workflow-records.md);封存目錄中的文字會原樣上傳。
|
|
48
|
+
|
|
47
49
|
## 查詢封存操作
|
|
48
50
|
|
|
49
51
|
```sh
|
package/dist/cli-publication.md
CHANGED
|
@@ -47,6 +47,10 @@ HTML 使用獨立來源的既有隔離預覽,且須啟用既有互動政策;
|
|
|
47
47
|
|
|
48
48
|
開發驗證可執行 `pnpm test:publication:package`;它會建立臨時 PostgreSQL、loopback API、合成帳號與獨立 Keychain 項目,再從 npm tarball 驗證 connect 自動綁定、重跑與混合素材發布,最後清除測試憑證。此驗證不使用本機環境檔或真實專案。
|
|
49
49
|
|
|
50
|
+
## 規格紀錄
|
|
51
|
+
|
|
52
|
+
`supekku records publish --operation-id <UUID>` 把正式規格與已封存變更的完成紀錄上傳到已連線的專案,供管理者在 Web 逐條檢視。它沿用發布的授權(管理者的裝置),不需要重新連線;它是對外發布,需要使用者同意,不會隨封存自動執行。送出與不送出的內容、檢查與限制見 [規格紀錄上傳與檢視](workflow-records.md)。
|
|
53
|
+
|
|
50
54
|
## Web 評論唯讀存取
|
|
51
55
|
|
|
52
56
|
先執行新版 API migration(0018),再啟動新版 API/Web。裝置新增 feedback:read 權限,授權頁會說明評論與原文上下文讀取。既有裝置不會因 migration 或 token refresh 取得新權限;需要使用者執行:
|
|
@@ -40,6 +40,8 @@ function requestLimit(response, data) {
|
|
|
40
40
|
const seconds = parseRetryAfter(response.headers.get("retry-after") ?? response.headers.get("x-retry-after"));
|
|
41
41
|
return new LimitedRequest(seconds === void 0 ? "Request rate limit reached; retry manually later. No request was automatically resent." : `Request rate limit reached; retry manually after ${seconds} seconds. No request was automatically resent.`, seconds, body?.error === "slow_down" && body.code === "RATE_LIMITED");
|
|
42
42
|
}
|
|
43
|
+
const unchecked = documentCheckRefusal(response, code);
|
|
44
|
+
if (unchecked) return unchecked;
|
|
43
45
|
const messages = {
|
|
44
46
|
PUBLICATION_CONCURRENCY_LIMIT: "Publication concurrency limit reached; finish or cancel existing publication operations before retrying manually.",
|
|
45
47
|
UPLOAD_CONCURRENCY_LIMIT: "Upload concurrency limit reached; finish or cancel existing uploads before retrying manually.",
|
|
@@ -51,6 +53,18 @@ function requestLimit(response, data) {
|
|
|
51
53
|
};
|
|
52
54
|
if (!response.ok && code && messages[code]) return new CoreError(code, messages[code]);
|
|
53
55
|
}
|
|
56
|
+
/**
|
|
57
|
+
* The server did not check what it was sent: it gave up on the check, or had no room to start
|
|
58
|
+
* one. Neither says the content is unfit. Nothing was stored, the server names a wait, and the
|
|
59
|
+
* request is never sent again by itself.
|
|
60
|
+
*/
|
|
61
|
+
function documentCheckRefusal(response, code) {
|
|
62
|
+
if (response.status !== 503) return void 0;
|
|
63
|
+
if (code !== "DOCUMENT_CHECK_ABANDONED" && code !== "DOCUMENT_CHECK_BUSY") return void 0;
|
|
64
|
+
const seconds = parseRetryAfter(response.headers.get("retry-after") ?? response.headers.get("x-retry-after"));
|
|
65
|
+
const wait = seconds === void 0 ? "later" : `after ${seconds} seconds`;
|
|
66
|
+
return new CoreError(code, (code === "DOCUMENT_CHECK_ABANDONED" ? "The server gave up checking the content before it finished (its time or memory limit for one check); nothing was stored. This does not say the content is unfit, but very large or unusually dense Markdown can exceed the limit every time." : "The server's document checks are busy, or this device is waiting after an abandoned check; nothing was stored.") + ` Retry manually ${wait} with the same operation ID. No request was automatically resent.`, seconds);
|
|
67
|
+
}
|
|
54
68
|
// src/remote/connection.ts
|
|
55
69
|
function serverOrigin(input) {
|
|
56
70
|
let u;
|
|
@@ -273,4 +287,4 @@ function createConnection(options) {
|
|
|
273
287
|
}
|
|
274
288
|
};
|
|
275
289
|
}
|
|
276
|
-
export { serverOrigin as n,
|
|
290
|
+
export { requestLimit as i, serverOrigin as n, documentCheckRefusal as r, createConnection as t };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as CoreError } from "./src-CRhxwFAN.mjs";
|
|
2
|
-
import { n as directoryPresence, s as projectObservation } from "./project-
|
|
2
|
+
import { n as directoryPresence, s as projectObservation } from "./project-CTKghH7_.mjs";
|
|
3
3
|
import { t as nodeSupported } from "./package-Ci4aNmkW.mjs";
|
|
4
4
|
import { a as targetPath, i as skillStatus } from "./skills-DcxDoyH7.mjs";
|
|
5
5
|
import { join } from "node:path";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { t as doctor } from "./doctor-CK0Ny6ct.mjs";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { l as Check, n as Hash, r as SnapshotSchema, t as CoreError, u as Type } from "./src-CRhxwFAN.mjs";
|
|
2
2
|
import { a as artifactId, r as LocalId } from "./artifact-local-Bfy69a9H.mjs";
|
|
3
3
|
import { t as Uuid } from "./api-C2o9bca2.mjs";
|
|
4
|
-
import { i as readBinding } from "./project-
|
|
4
|
+
import { i as readBinding } from "./project-BKg9kde5.mjs";
|
|
5
5
|
import { a as response, i as ThreadView, n as PageQuery, r as StatusAgent, t as CommentView } from "./collaboration-Dw4ikptb.mjs";
|
|
6
6
|
// ../../packages/contracts/src/artboard-comments.ts
|
|
7
7
|
const strict$1 = { additionalProperties: false };
|
|
@@ -3,17 +3,17 @@ import { i as resolveFeedback, n as listFeedback, r as replyFeedback } from "./f
|
|
|
3
3
|
// src/commands/artifact/feedback.ts
|
|
4
4
|
/** `connect` yields the project's authorized connection and `read` the reply text from standard
|
|
5
5
|
* input; tests supply stand-ins for both. */
|
|
6
|
-
async function feedback(root, args, connect = async (start) => (await import("./project-connection-
|
|
6
|
+
async function feedback(root, args, connect = async (start) => (await import("./project-connection-C0nYGopT.mjs")).boundConnection(start), read = readStdin) {
|
|
7
7
|
if (args.includes("--remote")) {
|
|
8
8
|
if (args[0] === "status") {
|
|
9
|
-
const { readRemoteReviewStatus } = await import("./review-status-
|
|
9
|
+
const { readRemoteReviewStatus } = await import("./review-status-OBrm3vzd.mjs");
|
|
10
10
|
return readRemoteReviewStatus(root, args, await connect(root));
|
|
11
11
|
}
|
|
12
12
|
if (args[0] === "reply" || args[0] === "resolve") {
|
|
13
|
-
const { writeRemoteFeedback } = await import("./agent-reply-
|
|
13
|
+
const { writeRemoteFeedback } = await import("./agent-reply-BVO6qcmJ.mjs");
|
|
14
14
|
return writeRemoteFeedback(root, args, await connect(root), read);
|
|
15
15
|
}
|
|
16
|
-
const { readRemoteFeedback } = await import("./feedback-
|
|
16
|
+
const { readRemoteFeedback } = await import("./feedback-Bd4AuswE.mjs");
|
|
17
17
|
return readRemoteFeedback(root, args, await connect(root));
|
|
18
18
|
}
|
|
19
19
|
const [action, id, ...rest] = args;
|