daftari 3.19.0 → 3.20.0
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/CHANGELOG.md +21 -0
- package/dist/access/locks.d.ts +1 -0
- package/dist/access/locks.d.ts.map +1 -1
- package/dist/access/locks.js +49 -17
- package/dist/access/locks.js.map +1 -1
- package/dist/curation/consumes.d.ts +4 -0
- package/dist/curation/consumes.d.ts.map +1 -1
- package/dist/curation/consumes.js +43 -9
- package/dist/curation/consumes.js.map +1 -1
- package/dist/curation/edge-staleness.d.ts +5 -3
- package/dist/curation/edge-staleness.d.ts.map +1 -1
- package/dist/curation/edge-staleness.js +56 -9
- package/dist/curation/edge-staleness.js.map +1 -1
- package/dist/curation/staged-actions.d.ts.map +1 -1
- package/dist/curation/staged-actions.js +4 -3
- package/dist/curation/staged-actions.js.map +1 -1
- package/dist/distill/cli.d.ts.map +1 -1
- package/dist/distill/cli.js +157 -126
- package/dist/distill/cli.js.map +1 -1
- package/dist/tools/edge-staleness.d.ts.map +1 -1
- package/dist/tools/edge-staleness.js +4 -3
- package/dist/tools/edge-staleness.js.map +1 -1
- package/dist/tools/read.d.ts.map +1 -1
- package/dist/tools/read.js +16 -7
- package/dist/tools/read.js.map +1 -1
- package/dist/tools/receipt.d.ts.map +1 -1
- package/dist/tools/receipt.js +2 -1
- package/dist/tools/receipt.js.map +1 -1
- package/dist/tools/search.d.ts.map +1 -1
- package/dist/tools/search.js +6 -4
- package/dist/tools/search.js.map +1 -1
- package/dist/tools/staged-actions.d.ts.map +1 -1
- package/dist/tools/staged-actions.js +126 -5
- package/dist/tools/staged-actions.js.map +1 -1
- package/dist/tools/write.d.ts.map +1 -1
- package/dist/tools/write.js +37 -8
- package/dist/tools/write.js.map +1 -1
- package/dist/utils/git.d.ts +1 -1
- package/dist/utils/git.d.ts.map +1 -1
- package/dist/utils/git.js +5 -2
- package/dist/utils/git.js.map +1 -1
- package/dist/utils/vault-gitignore.d.ts +1 -1
- package/dist/utils/vault-gitignore.d.ts.map +1 -1
- package/dist/utils/vault-gitignore.js +7 -0
- package/dist/utils/vault-gitignore.js.map +1 -1
- package/package.json +6 -6
package/dist/tools/write.js
CHANGED
|
@@ -528,13 +528,26 @@ export function requireWriteAccess(access, collection) {
|
|
|
528
528
|
// counts. Editing an already-canonical doc without changing its status is not
|
|
529
529
|
// a transition and stays open to writers. No access context (operator) passes.
|
|
530
530
|
// Under vault_ratify, `access` is the ratifier's, so the ratifier needs it.
|
|
531
|
+
//
|
|
532
|
+
// The rule is symmetric (bead w3wy): moving a document OUT of canonical —
|
|
533
|
+
// vault_deprecate, vault_supersede, a vault_merge that supersedes a canonical
|
|
534
|
+
// source or rewrites a canonical target's status, or a vault_write status
|
|
535
|
+
// change — withdraws the vault's vouching and needs the same grant, mirroring
|
|
536
|
+
// vault_unsupersede. Retiring a non-canonical document needs only `write`.
|
|
531
537
|
function requireCanonicalAuthority(access, oldStatus, newStatus, tool) {
|
|
532
|
-
if (!access ||
|
|
533
|
-
return ok(undefined);
|
|
534
|
-
if (canPromote(access.role))
|
|
538
|
+
if (!access || canPromote(access.role))
|
|
535
539
|
return ok(undefined);
|
|
536
|
-
|
|
537
|
-
|
|
540
|
+
if (newStatus === "canonical" && oldStatus !== "canonical") {
|
|
541
|
+
return err(new Error(`access denied: role '${access.roleName}' cannot promote documents — ` +
|
|
542
|
+
`${tool} cannot set status 'canonical'; write it as draft and use vault_promote`));
|
|
543
|
+
}
|
|
544
|
+
if (oldStatus === "canonical" && newStatus !== "canonical") {
|
|
545
|
+
return err(new Error(`access denied: role '${access.roleName}' cannot retire canonical documents — ` +
|
|
546
|
+
`${tool} would move a canonical document to '${String(newStatus ?? "draft")}', ` +
|
|
547
|
+
`which needs the 'promote' grant. Stage it with vault_stage_action for a ` +
|
|
548
|
+
`ratifier with promote, or ask a role with promote to apply it`));
|
|
549
|
+
}
|
|
550
|
+
return ok(undefined);
|
|
538
551
|
}
|
|
539
552
|
// Git history is the attribution layer, and the caller-supplied `agent`
|
|
540
553
|
// string is advisory — any authenticated principal could claim any agent.
|
|
@@ -1834,6 +1847,9 @@ export async function vaultDeprecate(vaultRoot, args, access) {
|
|
|
1834
1847
|
const rbac = requireWriteAccess(access, collectionOf(path.value, oldFrontmatter));
|
|
1835
1848
|
if (!rbac.ok)
|
|
1836
1849
|
return rbac;
|
|
1850
|
+
const retireGate = requireCanonicalAuthority(access, oldFrontmatter.status, "deprecated", "vault_deprecate");
|
|
1851
|
+
if (!retireGate.ok)
|
|
1852
|
+
return retireGate;
|
|
1837
1853
|
// Same predecessor-only handoff as vault_supersede: this writes exactly
|
|
1838
1854
|
// the document being deprecated, which it already locks and commits.
|
|
1839
1855
|
let validUntil = null;
|
|
@@ -2133,6 +2149,9 @@ export async function vaultSupersede(vaultRoot, args, access) {
|
|
|
2133
2149
|
const rbac = requireWriteAccess(access, collectionOf(oldPath.value, oldFrontmatter));
|
|
2134
2150
|
if (!rbac.ok)
|
|
2135
2151
|
return rbac;
|
|
2152
|
+
const retireGate = requireCanonicalAuthority(access, oldFrontmatter.status, "superseded", "vault_supersede");
|
|
2153
|
+
if (!retireGate.ok)
|
|
2154
|
+
return retireGate;
|
|
2136
2155
|
// Valid-time handoff, opt-in. Predecessor only — see the boundary helpers.
|
|
2137
2156
|
let validUntil = null;
|
|
2138
2157
|
if (boundary.value !== null) {
|
|
@@ -2477,6 +2496,8 @@ export async function vaultMerge(vaultRoot, args, access) {
|
|
|
2477
2496
|
// canonical — whether the status comes from an override or is inherited from
|
|
2478
2497
|
// path_a into a new target. Merging into an already-canonical target is
|
|
2479
2498
|
// allowed, matching vault_write: a writer may already edit canonical content.
|
|
2499
|
+
// The same gate refuses a result that moves a canonical target OUT of
|
|
2500
|
+
// canonical; superseded sources are gated in the write-set loop below.
|
|
2480
2501
|
const canonicalGate = requireCanonicalAuthority(access, targetOldFrontmatter?.status ?? null, targetRaw.status, "vault_merge");
|
|
2481
2502
|
if (!canonicalGate.ok)
|
|
2482
2503
|
return canonicalGate;
|
|
@@ -2608,6 +2629,11 @@ export async function vaultMerge(vaultRoot, args, access) {
|
|
|
2608
2629
|
// miss it and clobber the merged body with the superseded write (#127/#128).
|
|
2609
2630
|
if (source.rel === resolvedTarget.value.relPath)
|
|
2610
2631
|
continue;
|
|
2632
|
+
// Merging a canonical source away retires it (w3wy). Checked before any
|
|
2633
|
+
// file I/O, so a refusal leaves all three documents untouched.
|
|
2634
|
+
const retireGate = requireCanonicalAuthority(access, source.parsed.frontmatter.status, "superseded", "vault_merge");
|
|
2635
|
+
if (!retireGate.ok)
|
|
2636
|
+
return retireGate;
|
|
2611
2637
|
// Valid-time handoff on BOTH sources. A conflict on either one refuses the
|
|
2612
2638
|
// whole merge: a merge is already all-or-nothing, and a partial validity
|
|
2613
2639
|
// write would leave the vault in a state no single call could produce.
|
|
@@ -3390,7 +3416,8 @@ export const writeTools = [
|
|
|
3390
3416
|
title: "Deprecate a document",
|
|
3391
3417
|
annotations: { destructiveHint: true },
|
|
3392
3418
|
description: "Mark a document deprecated. A reason is required; optionally record " +
|
|
3393
|
-
"the document that supersedes it.
|
|
3419
|
+
"the document that supersedes it. Deprecating a canonical document " +
|
|
3420
|
+
"requires the promote grant. Auto-commits." +
|
|
3394
3421
|
staleRetryNote +
|
|
3395
3422
|
shadowNote,
|
|
3396
3423
|
inputSchema: {
|
|
@@ -3511,7 +3538,8 @@ export const writeTools = [
|
|
|
3511
3538
|
title: "Supersede a document",
|
|
3512
3539
|
annotations: { destructiveHint: true },
|
|
3513
3540
|
description: "Mark a document superseded by a named successor. Sets status=superseded " +
|
|
3514
|
-
"and superseded_by; the successor must already exist.
|
|
3541
|
+
"and superseded_by; the successor must already exist. Superseding a " +
|
|
3542
|
+
"canonical document requires the promote grant. Refuses a write " +
|
|
3515
3543
|
"that would close a superseded_by loop; a successor that is itself " +
|
|
3516
3544
|
"superseded or deprecated returns a successor_warning. Distinct from " +
|
|
3517
3545
|
"vault_deprecate (which sets status=deprecated with an optional " +
|
|
@@ -3607,7 +3635,8 @@ export const writeTools = [
|
|
|
3607
3635
|
"point at it, all in one commit. The merged body is supplied by the caller " +
|
|
3608
3636
|
"— vault_merge does not synthesize prose. target_path may equal path_a (to " +
|
|
3609
3637
|
"fold B into A) or be a new path. The target's frontmatter inherits " +
|
|
3610
|
-
"path_a's (provenance becomes 'synthesized') unless overridden.
|
|
3638
|
+
"path_a's (provenance becomes 'synthesized') unless overridden. Merging " +
|
|
3639
|
+
"a canonical source away requires the promote grant. Auto-commits." +
|
|
3611
3640
|
shadowNote,
|
|
3612
3641
|
inputSchema: {
|
|
3613
3642
|
type: "object",
|