@unbrained/pm-cli 2026.9.26 → 2026.9.27
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/.claude-plugin/marketplace.json +2 -2
- package/CHANGELOG.md +16 -0
- package/dist/cli/commander-usage.js +2 -2
- package/dist/cli/error-guidance.js +1 -1
- package/dist/cli/main.js +2 -2
- package/dist/cli/register-setup.js +1 -1
- package/dist/cli/runtime/selection.d.ts +3 -1
- package/dist/cli/runtime/selection.js +1 -1
- package/dist/cli-bundle/bundle-manifest.json +160 -152
- package/dist/cli-bundle/chunks/{chunk-IYN4MJ2C.js → chunk-3BTJ66CB.js} +56 -56
- package/dist/cli-bundle/chunks/{chunk-FOTXRNY6.js → chunk-4SLLCDFL.js} +39 -39
- package/dist/cli-bundle/chunks/{chunk-GRWPZR7F.js → chunk-4UPZLUT2.js} +7 -7
- package/dist/cli-bundle/chunks/{chunk-U55RYT3I.js → chunk-6OJVQ7SW.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-TYJXMT3Q.js → chunk-7TAGYNFP.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-QQD3VRMZ.js → chunk-AUS6USO4.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-4ODHIX7N.js → chunk-IEP3VAT5.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-HTHTX6E6.js → chunk-JX6WCCHL.js} +2 -2
- package/dist/cli-bundle/chunks/chunk-LC6WEA5U.js +2 -0
- package/dist/cli-bundle/chunks/{chunk-VMO4P5MX.js → chunk-LKGQUZ5M.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-TC74K7SS.js → chunk-OKVDVERQ.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-SZQCHJI4.js → chunk-TSF2LPIH.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-MJWKR7YA.js → chunk-V5UGBYHN.js} +3 -3
- package/dist/cli-bundle/chunks/{register-list-query-426QTRET.js → register-list-query-6PAJ4PBU.js} +2 -2
- package/dist/cli-bundle/chunks/{register-mutation-FLI3HHMP.js → register-mutation-RZCXZXYS.js} +2 -2
- package/dist/cli-bundle/chunks/{register-operations-TP7ZG4MK.js → register-operations-GK6VU2H2.js} +2 -2
- package/dist/cli-bundle/chunks/register-setup-ASEMNMBF.js +2 -0
- package/dist/cli-bundle/focused-chunks/{chunk-H3BI4EDO.js → chunk-6J2YCGSN.js} +3 -3
- package/dist/cli-bundle/focused-chunks/{chunk-XKH2FC5D.js → chunk-6UNKK3UH.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-NRHTXBTI.js → chunk-DQ3MB7BO.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-PMPFLA6X.js → chunk-E7LYK7V5.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-25BBHWMH.js → chunk-GZD4ZYIB.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-KMPKKSA6.js +2 -0
- package/dist/cli-bundle/focused-chunks/{chunk-TLF6N56J.js → chunk-LBDWUHQD.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-UIFVIE5F.js → chunk-MILJCOFJ.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-MK5AKKHK.js → chunk-NETVXIH5.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-Q355NPLH.js → chunk-NWRVNHAD.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-XVBWZTU2.js → chunk-NZAG7OKB.js} +12 -12
- package/dist/cli-bundle/focused-chunks/{chunk-OY3VHCTX.js → chunk-OJKJFDIG.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-OJRX6G22.js +2 -0
- package/dist/cli-bundle/focused-chunks/{chunk-NVVB2HJC.js → chunk-PDVL7QYU.js} +16 -16
- package/dist/cli-bundle/focused-chunks/{chunk-O7MIBEMK.js → chunk-QO4MTAEA.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-ABA3KRPY.js → chunk-SMADBUPL.js} +2 -2
- package/dist/cli-bundle/main.js +21 -21
- package/dist/cli-bundle/sdk-authoring.js +1 -1
- package/dist/cli-bundle/sdk-contracts.js +1 -1
- package/dist/cli-bundle/sdk-core.js +2 -2
- package/dist/cli-bundle/sdk-governance.js +1 -1
- package/dist/cli-bundle/sdk-graph.js +1 -1
- package/dist/cli-bundle/sdk-merge.js +23 -23
- package/dist/cli-bundle/sdk-query.js +1 -1
- package/dist/cli-bundle/sdk-runtime.js +1 -1
- package/dist/cli-bundle/sdk-testing.js +1 -1
- package/dist/cli-bundle/sdk.js +8 -8
- package/dist/sdk/agent-capability-contracts.js +1 -1
- package/dist/sdk/cli-contracts/command-aliases.js +1 -1
- package/dist/sdk/cli-contracts/grammar-contracts.js +1 -1
- package/dist/sdk/completion/shared.d.ts +1 -1
- package/dist/sdk/completion/shared.js +1 -1
- package/dist/sdk/extension/static-inventory.d.ts +54 -0
- package/dist/sdk/extension/static-inventory.js +2 -0
- package/dist/sdk/generated/generated-error-code-catalog-part-1.js +1 -1
- package/dist/sdk/generated/generated-error-code-catalog-part-2.js +1 -1
- package/dist/sdk/guide-topics.js +1 -1
- package/dist/sdk/index.d.ts +1 -0
- package/dist/sdk/index.js +1 -1
- package/dist/sdk/public-surface.json +1 -1
- package/dist/sdk/query/complete-list.js +1 -1
- package/dist/sdk/read-output/provenance.d.ts +20 -0
- package/dist/sdk/read-output/provenance.js +2 -0
- package/dist/sdk/read-output-contracts.js +1 -1
- package/dist/sdk/runtime-input.js +1 -1
- package/docs/CLI_GRAMMAR.md +31 -0
- package/docs/CODEX_PLUGIN.md +8 -0
- package/docs/EXTENSION_LIFECYCLE.md +18 -0
- package/docs/RELEASING.md +46 -1
- package/docs/agent-task-token-baseline.json +4 -4
- package/docs/generated/AGENT_CAPABILITY_ROUTING.md +1 -1
- package/docs/generated/AGENT_COMMAND_SURFACE.md +5 -1
- package/docs/generated/FLAG_LEXICON_BUDGETS.md +4 -0
- package/docs/generated/REFUSAL_CLOSURE_CENSUS.md +14 -7
- package/marketplace.json +2 -2
- package/package.json +2 -2
- package/packages/pm-beads/package.json +1 -1
- package/packages/pm-calendar/package.json +1 -1
- package/packages/pm-command-kit/package.json +1 -1
- package/packages/pm-digital-twin/package.json +1 -1
- package/packages/pm-governance-audit/package.json +1 -1
- package/packages/pm-guide-shell/package.json +1 -1
- package/packages/pm-kanban/package.json +1 -1
- package/packages/pm-lifecycle-hooks/package.json +1 -1
- package/packages/pm-linked-test-adapters/package.json +1 -1
- package/packages/pm-search-advanced/package.json +1 -1
- package/packages/pm-templates/package.json +1 -1
- package/packages/pm-todos/package.json +1 -1
- package/packages/pm-vcs/package.json +1 -1
- package/plugins/pm-claude/.claude-plugin/plugin.json +1 -1
- package/plugins/pm-claude/README.md +5 -1
- package/plugins/pm-claude/package.json +2 -2
- package/plugins/pm-claude/skills/pm-audit/SKILL.md +14 -103
- package/plugins/pm-claude/skills/pm-audit/agents/openai.yaml +4 -0
- package/plugins/pm-claude/skills/pm-developer/SKILL.md +20 -143
- package/plugins/pm-claude/skills/pm-developer/agents/openai.yaml +4 -0
- package/plugins/pm-claude/skills/pm-planner/SKILL.md +16 -167
- package/plugins/pm-claude/skills/pm-planner/agents/openai.yaml +4 -0
- package/plugins/pm-claude/skills/pm-release/SKILL.md +18 -102
- package/plugins/pm-claude/skills/pm-release/agents/openai.yaml +4 -0
- package/plugins/pm-claude/skills/pm-workflow/SKILL.md +25 -156
- package/plugins/pm-claude/skills/pm-workflow/agents/openai.yaml +4 -0
- package/plugins/pm-codex/.codex-plugin/plugin.json +1 -1
- package/plugins/pm-codex/README.md +10 -2
- package/plugins/pm-codex/mcp.json +11 -0
- package/plugins/pm-codex/package.json +2 -2
- package/plugins/pm-codex/plugin.json +45 -0
- package/plugins/pm-codex/skills/pm-audit/SKILL.md +21 -0
- package/plugins/pm-codex/skills/pm-audit/agents/openai.yaml +4 -0
- package/plugins/pm-codex/skills/pm-auditor/SKILL.md +5 -40
- package/plugins/pm-codex/skills/pm-auditor/agents/openai.yaml +3 -5
- package/plugins/pm-codex/skills/pm-developer/SKILL.md +26 -0
- package/plugins/pm-codex/skills/pm-developer/agents/openai.yaml +4 -0
- package/plugins/pm-codex/skills/pm-native/SKILL.md +7 -87
- package/plugins/pm-codex/skills/pm-native/agents/openai.yaml +3 -5
- package/plugins/pm-codex/skills/pm-planner/SKILL.md +22 -0
- package/plugins/pm-codex/skills/pm-planner/agents/openai.yaml +4 -0
- package/plugins/pm-codex/skills/pm-release/SKILL.md +17 -38
- package/plugins/pm-codex/skills/pm-release/agents/openai.yaml +2 -4
- package/plugins/pm-codex/skills/pm-workflow/SKILL.md +39 -0
- package/plugins/pm-codex/skills/pm-workflow/agents/openai.yaml +4 -0
- package/dist/cli-bundle/chunks/register-setup-574SIVQZ.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-HNHMK5JI.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-HQPTDJLF.js +0 -2
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{e as d}from"./chunk-
|
|
1
|
+
import{e as d}from"./chunk-LBDWUHQD.js";import{Qa as w,Ra as m,o as c}from"./chunk-PDVL7QYU.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="24688724-53cd-5375-ae7e-cfe098cd0dc8")}catch{}})();var _=new Map(c.map(e=>[e.toLowerCase(),e])),$=/^[A-Za-z][A-Za-z0-9_-]*$/;function g(e,t){if(!$.test(e))throw new Error(`${t} "${e}" is not a valid identifier. Use a single letter-led token of letters, digits, hyphen, or underscore with no spaces or punctuation (e.g. "Spike" or "code-review").`)}function y(e){return _.get(e.trim().toLowerCase())}function A(e){return Array.isArray(e)?e.filter(t=>typeof t=="string"):[]}function I(e){return e.replace(/[\\"`$]/g,t=>`\\${t}`)}function b(e){let t=new Map;for(let o of e){let n=o.trim();if(n.length===0)continue;let i=n.toLowerCase();t.has(i)||t.set(i,n)}return[...t.values()].sort((o,n)=>o.localeCompare(n))}function S(e){let t=(e.name??"").trim();if(t.length===0)throw new Error("Type name must not be empty.");g(t,"Type name");let o=y(t);if(o)throw new Error(`Cannot redefine built-in item type "${o}". Built-in types are reserved: ${c.join(", ")}.`);let n=e.description?.trim(),i=e.defaultStatus?.trim(),a=e.folder?.trim(),r=a&&a.length>0?m(a):void 0,s=b(e.aliases??[]);for(let l of s){g(l,"Alias");let f=y(l);if(f)throw new Error(`Alias "${l}" collides with built-in item type "${f}". Built-in types are reserved: ${c.join(", ")}.`)}return{name:t,description:n&&n.length>0?n:void 0,defaultStatus:i&&i.length>0?i:void 0,folder:r,aliases:s}}function x(e,t){let o=e.name.toLowerCase(),n=new Map;for(let a of t.definitions){if(typeof a.name!="string")continue;let r=a.name.trim();if(!(r.length===0||r.toLowerCase()===o)){n.set(r.toLowerCase(),r);for(let s of A(a.aliases))s.trim().length>0&&n.set(s.trim().toLowerCase(),r)}}let i=n.get(o);if(i)throw new Error(`Type name "${e.name}" collides with an alias of existing item type "${i}".`);for(let a of e.aliases){let r=n.get(a.toLowerCase());if(r)throw new Error(`Alias "${a}" already maps to existing item type "${r}".`)}}function h(e,t){return typeof t=="string"&&t.trim().length>0?m(t).toLowerCase():w(e).toLowerCase()}function D(e,t,o){let n=e.name.toLowerCase(),i=h(e.name,e.folder),a=s=>{throw new Error(`Item type "${e.name}" would store items in folder "${i}", which already belongs to existing item type "${s}". Pass a distinct --folder to keep their storage separate.`)};for(let s of t.definitions){if(typeof s.name!="string")continue;let l=s.name.trim();l.length===0||l.toLowerCase()===n||h(l,s.folder)===i&&a(l)}let r=o?.get(i);r!==void 0&&r.toLowerCase()!==n&&a(r)}function j(e){if(e==null||e.trim().length===0)return{definitions:[]};let t;try{t=JSON.parse(e)}catch{throw new Error("schema/types.json contains invalid JSON.")}return{definitions:L(t)}}function L(e){let t=C(e);if(!t)return[];let o=[];for(let n of t){if(typeof n!="object"||n===null||Array.isArray(n))continue;let i=n;typeof i.name!="string"||i.name.trim().length===0||o.push(i)}return o}function C(e){if(Array.isArray(e))return e;if(typeof e!="object"||e===null)return;let t=e;if(Array.isArray(t.definitions))return t.definitions;if(typeof t.item_types=="object"&&t.item_types!==null){let o=t.item_types;if(Array.isArray(o.definitions))return o.definitions}}function z(e,t){let o=t.name.toLowerCase(),n=e.definitions.slice(),i=n.findIndex(l=>typeof l.name=="string"&&l.name.trim().toLowerCase()===o),a=i>=0?n[i]:void 0,r=b([...A(a?.aliases),...t.aliases]),s={...a,name:t.name};return t.folder!==void 0&&(s.folder=t.folder),r.length>0?s.aliases=r:s.aliases!==void 0&&delete s.aliases,T(s,"description",t.description),T(s,"default_status",t.defaultStatus),i>=0?n[i]=s:n.push(s),n.sort((l,f)=>l.name.localeCompare(f.name)),{file:{definitions:n},definition:s,replaced:i>=0,...a&&typeof a.name=="string"?{previousName:a.name}:{}}}function F(e,t){let o=(t??"").trim();if(o.length===0)throw new Error("Type name must not be empty.");let n=y(o);if(n)throw new Error(`Cannot remove built-in item type "${n}". Built-in types are reserved: ${c.join(", ")}.`);let i=o.toLowerCase(),a=e.definitions.slice(),r=a.findIndex(l=>typeof l.name=="string"&&l.name.trim().toLowerCase()===i);if(r<0)return{file:{definitions:a},removed:!1};let[s]=a.splice(r,1);return{file:{definitions:a},removed:!0,definition:s}}function T(e,t,o){let n=e;o!==void 0&&(n[t]=o)}function M(e){return`${JSON.stringify({definitions:e.definitions},null,2)}
|
|
2
2
|
`}function E(e,t){let o=e.trim().length>0?e.trim():e,n=t?.trim()||".agents/pm/schema/types.json";return`To register a custom type, run: pm schema add-type "${I(o)}" (writes ${n}).`}function O(e,t,o){return`Invalid type value "${e}". Allowed: ${t.join(", ")}. ${E(e,o)}`}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="ef20c613-623c-5a11-8384-ccf4ee3addde")}catch{}})();function v(e){return typeof e=="string"?e.trim().toLowerCase():""}function u(e,t){let o=d(e);return o.length===0?"":t?.alias_to_id?.get(o)??o}function U(e){let t=Array.isArray(e?.type_workflows)?e.type_workflows:[],o=new Map;for(let n of t){let i=v(n?.type);if(i.length===0||!Array.isArray(n?.allowed_transitions))continue;let a=n.allowed_transitions,r=o.get(i)??{pairs:[],denyAll:!1};a.length===0&&(r.denyAll=!0);for(let s of a){if(!Array.isArray(s)||s.length!==2)continue;let l=d(s[0]),f=d(s[1]);l.length===0||f.length===0||r.pairs.some(p=>p[0]===l&&p[1]===f)||r.pairs.push([l,f])}o.set(i,r)}return[...o.entries()].filter(([,n])=>n.pairs.length>0||n.denyAll).map(([n,i])=>({type:n,allowed_transitions:i.pairs})).sort((n,i)=>n.type.localeCompare(i.type))}function J(e){let t=v(e.typeName),o=e.typeWorkflows.find(r=>r.type===t);if(!o)return{allowed:!0,hasRule:!1,allowedTransitions:[]};let n=u(e.fromStatus,e.statusRegistry),i=u(e.toStatus,e.statusRegistry);return n.length>0&&n===i?{allowed:!0,hasRule:!0,allowedTransitions:o.allowed_transitions}:{allowed:o.allowed_transitions.some(r=>{let s=u(r[0],e.statusRegistry),l=u(r[1],e.statusRegistry);return s===n&&l===i}),hasRule:!0,allowedTransitions:o.allowed_transitions}}function W(e){return e.length===0?"(no transitions allowed)":e.map(t=>`${t[0]} -> ${t[1]}`).join(", ")}export{y as a,I as b,S as c,x as d,D as e,j as f,z as g,F as h,M as i,O as j,U as k,J as l,W as m};
|
|
3
|
-
//# sourceMappingURL=chunk-
|
|
3
|
+
//# sourceMappingURL=chunk-QO4MTAEA.js.map
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import{r as D,s as q}from"./chunk-
|
|
1
|
+
import{r as D,s as q}from"./chunk-6UNKK3UH.js";import{$b as _,Tb as N,Zb as z}from"./chunk-NWRVNHAD.js";import{ae as x,cd as C,fd as L,id as j,ka as k,pa as m,qb as O,ua as b,wa as S}from"./chunk-PDVL7QYU.js";import{constants as p}from"node:fs";import{lstat as M,mkdir as $,open as F}from"node:fs/promises";import h from"node:path";(function(){try{var n=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new n.Error().stack;e&&(n._sentryDebugIds=n._sentryDebugIds||{},n._sentryDebugIds[e]="e57a9bca-1190-5ffd-bb7d-d76a22fc9e57")}catch{}})();function E(n,e){if(typeof n!="string"||n.trim().length===0)throw new TypeError(`Relationship event ${e} must be non-empty`);return n.trim()}function I(n,e){let t=e.require(n.kind),i=t.direction==="undirected"?[n.source,n.target].sort().join("\0"):`${n.source}\0${n.target}`;return`${t.kind}\0${i}`}function H(n){return Object.freeze({...n,...n.payload===void 0?{}:{payload:Object.freeze(structuredClone(n.payload))}})}function J(n,e,t,i){let r=t.require(n.kind),o=i.outgoingOne.get(`${r.kind}\0${n.source}`);if(o!==void 0&&o!==e)throw new TypeError(`Relationship outgoing cardinality exceeded for ${r.kind}`);let s=i.incomingOne.get(`${r.kind}\0${n.target}`);if(s!==void 0&&s!==e)throw new TypeError(`Relationship incoming cardinality exceeded for ${r.kind}`);let c=I(n,t),d=i.identities.get(c);if(d!==void 0&&d!==e)throw new TypeError(`Relationship edge already active: ${c}`)}function K(n){let e=new Map;for(let t of n)t.action==="remove"?e.delete(t.relationshipId):e.set(t.relationshipId,t.edge);return e}function G(n,e,t){if(n.expectedVersion!==void 0&&n.expectedVersion!==e)throw new TypeError(`Relationship event version conflict: expected ${n.expectedVersion}, current ${e}`);let i=E(n.eventId,"eventId");if(t.has(i))throw new TypeError(`Relationship event already exists: ${i}`);if(n.action!=="add"&&n.action!=="remove"&&n.action!=="supersede")throw new TypeError(`Unknown relationship event action: ${n.action}`);if(!Number.isFinite(Date.parse(n.timestamp)))throw new TypeError("Relationship event timestamp must be valid");return{eventId:i,relationshipId:E(n.relationshipId,"relationshipId"),author:E(n.author,"author"),timestamp:new Date(n.timestamp).toISOString()}}function Q(n,e,t,i,r,o){let s=t.has(e);if(n.action==="add"&&s)throw new TypeError(`Relationship is already active: ${e}`);if(n.action!=="add"&&!s)throw new TypeError(`Relationship is not active: ${e}`);if(n.action==="remove")return;if(!n.edge)throw new TypeError(`Relationship ${n.action} event requires an edge`);let c=typeof n.edge.source=="string"?n.edge.source.trim():"",d=typeof n.edge.target=="string"?n.edge.target.trim():"";if(!i.has(c)||!i.has(d))throw new TypeError(`Relationship endpoint not found: ${c} -> ${d}`);let a=new m([c,d],[n.edge],r).edges()[0];return J(a,e,r,o),H(a)}var T=class{#t;#i;#n=[];#o=new Set;#e=new Map;#r={identities:new Map,outgoingOne:new Map,incomingOne:new Map};constructor(e,t={}){this.#t=new Set([...e].filter(i=>typeof i=="string").map(i=>i.trim()).filter(Boolean)),this.#i=t.registry??k()}get version(){return this.#n.length}events(){return Object.freeze([...this.#n])}*stream(e={}){let t=e.fromVersion??1,i=e.toVersion??this.version,r=e.batchSize??100;if(!Number.isInteger(t)||t<1)throw new TypeError("Relationship event stream fromVersion must be positive");if(!Number.isInteger(i)||i<0||i>this.version)throw new TypeError(`Relationship event stream toVersion out of range: ${i}`);if(!Number.isInteger(r)||r<1)throw new TypeError("Relationship event stream batchSize must be positive");if(t>i+1)throw new TypeError("Relationship event stream fromVersion exceeds the selected prefix");for(let o=t-1;o<i;o+=r)yield Object.freeze(this.#n.slice(o,Math.min(o+r,i)))}project(e,t,i={}){if(typeof t!="function")throw new TypeError("Relationship event projection requires a reducer");let r=e,o=0,s;for(let c of this.stream({...i,batchSize:256}))for(let d of c)r=t(r,d),o+=1,s=d;return Object.freeze({state:r,version:s?.sequence??Math.max(0,(i.fromVersion??1)-1),processed:o,...s===void 0?{}:{asOf:s.timestamp}})}#s(e,t){let i=this.#i.require(t.kind);this.#r.identities.set(I(t,this.#i),e),i.outgoing==="one"&&this.#r.outgoingOne.set(`${i.kind}\0${t.source}`,e),i.incoming==="one"&&this.#r.incomingOne.set(`${i.kind}\0${t.target}`,e)}#a(e){let t=this.#i.require(e.kind);this.#r.identities.delete(I(e,this.#i)),t.outgoing==="one"&&this.#r.outgoingOne.delete(`${t.kind}\0${e.source}`),t.incoming==="one"&&this.#r.incomingOne.delete(`${t.kind}\0${e.target}`)}append(e){let t=G(e,this.version,this.#o),i=this.#e.get(t.relationshipId),r=Q(e,t.relationshipId,this.#e,this.#t,this.#i,this.#r),o=Object.freeze({eventId:t.eventId,relationshipId:t.relationshipId,action:e.action,...r===void 0?{}:{edge:r},author:t.author,timestamp:t.timestamp,...e.reason?.trim()?{reason:e.reason.trim()}:{},sequence:this.version+1});return this.#n.push(o),this.#o.add(t.eventId),i&&this.#a(i),e.action==="remove"?this.#e.delete(t.relationshipId):(this.#e.set(t.relationshipId,r),this.#s(t.relationshipId,r)),o}snapshot(e={}){if(e.atVersion!==void 0&&e.atTimestamp!==void 0)throw new TypeError("Relationship snapshot accepts one target");let t;if(e.atTimestamp!==void 0){let o=Date.parse(e.atTimestamp);if(!Number.isFinite(o))throw new TypeError("Relationship snapshot timestamp must be valid");t=this.#n.filter(s=>Date.parse(s.timestamp)<=o)}else{let o=e.atVersion??this.version;if(!Number.isInteger(o)||o<0||o>this.version)throw new TypeError(`Relationship snapshot version out of range: ${o}`);t=this.#n.slice(0,o)}let i=K(t),r=new m(this.#t,i.values(),this.#i);return Object.freeze({version:t.at(-1)?.sequence??0,...t.at(-1)?{asOf:t.at(-1).timestamp}:{},edges:r.edges(),graph:r})}page(e){if(!Number.isInteger(e.limit)||e.limit<1)throw new TypeError("Relationship event page limit must be positive");let t=C("relationship-events",{order:"append-sequence"}),i=e.cursor===void 0?this.version:Number(L(e.cursor,t).snapshot);if(!Number.isSafeInteger(i)||i<0||i>this.version)throw new TypeError("Relationship event cursor snapshot version is invalid");let r=j(this.#n.slice(0,i),{cursor:e.cursor,fingerprint:t,limit:e.limit,readId:o=>o.eventId,snapshot:String(i)});return{version:i,events:r.rows,hasMore:r.has_more,...r.next_cursor?{nextCursor:r.next_cursor}:{}}}},Y="relationship-event-store",A=p.O_NOFOLLOW;function g(n){return x(n,Y,30,`relationship-store:${process.pid}`,!1,!1,3e3)}async function f(n,e="relationships/events.jsonl"){let t=h.resolve(n),i=h.resolve(t,e),r=h.relative(t,i);if(r.length===0)throw new TypeError("Relationship event path must name a file within the tracker root");if(r===".."||r.startsWith(`..${h.sep}`)||h.isAbsolute(r))throw new TypeError("Relationship event path must stay within the tracker root");if(await $(t,{recursive:!0}),(await M(t)).isSymbolicLink())throw new TypeError("Relationship event tracker root must not be a symbolic link");let s=t;for(let c of r.split(h.sep)){s=h.join(s,c);try{if((await M(s)).isSymbolicLink())throw new TypeError("Relationship event path must not contain symbolic links")}catch(d){if(b(d))break;throw d}}return i}async function w(n,e,t){let i=new T(e,{registry:t}),r,o;try{o=await F(n,p.O_RDONLY|A),r=await o.readFile("utf8")}catch(c){if(b(c))return{log:i,raw:""};throw c}finally{await o?.close()}let s=r.split(`
|
|
2
2
|
`);for(let c=0;c<s.length;c+=1){let d=s[c].trim();if(!d)continue;let a;try{a=JSON.parse(d)}catch{throw new TypeError(`Invalid relationship event JSONL at line ${c+1}`)}if(a.sequence!==i.version+1)throw new TypeError(`Invalid relationship event sequence at line ${c+1}`);i.append({eventId:a.eventId,relationshipId:a.relationshipId,action:a.action,...a.edge===void 0?{}:{edge:a.edge},author:a.author,timestamp:a.timestamp,...a.reason===void 0?{}:{reason:a.reason},expectedVersion:i.version})}return{log:i,raw:r}}function U(n,e,t,i){let r=Date.parse(e.timestamp),o;return e.action!=="remove"&&e.edge!==void 0&&(o=new m(t,[e.edge],i).edges()[0]),n.eventId===e.eventId.trim()&&n.relationshipId===e.relationshipId.trim()&&n.action===e.action&&n.author===e.author.trim()&&Number.isFinite(r)&&n.timestamp===new Date(r).toISOString()&&n.reason===(e.reason?.trim()||void 0)&&O(n.edge)===O(o)}var V=class n{#t;#i;#n;#o;#e;constructor(e,t,i,r){this.#t=e.pmRoot,this.#i=t,this.#n=e.registry,this.#o=i,this.#e=r}static async open(e){let t=Object.freeze([...e.nodes]),i=await f(e.pmRoot,e.relativePath),r=await g(e.pmRoot);try{await f(e.pmRoot,i);let{log:o}=await w(i,t,e.registry);return new n(e,t,i,o)}finally{await r()}}get path(){return this.#o}async currentVersion(){return this.#e=await this.#r(),this.#e.version}async append(e){let t=await g(this.#t);try{let i=await f(this.#t,this.#o),{log:r}=await w(i,this.#i,this.#n),o=r.append(e);await $(h.dirname(i),{recursive:!0}),await f(this.#t,i);let s=await F(i,p.O_APPEND|p.O_CREAT|p.O_WRONLY|A);try{await s.appendFile(`${JSON.stringify(o)}
|
|
3
3
|
`,"utf8")}finally{await s.close()}return this.#e=r,o}finally{await t()}}async appendBatch(e,t={}){let i=await g(this.#t);try{let r=await f(this.#t,this.#o),{log:o,raw:s}=await w(r,this.#i,this.#n),c=o.version,d=new Map(o.events().map(l=>[l.eventId,l])),a=[],R=[];for(let l of e){let u=l.eventId.trim(),v=d.get(u);if(v!==void 0){if(t.existingEventPolicy==="skip_identical"&&U(v,l,this.#i,this.#n)){R.push(v.eventId);continue}if(t.existingEventPolicy==="skip_identical")throw new TypeError(`Relationship event id collision with different content: ${u}`)}let y=o.append(l);d.set(y.eventId,y),a.push(y)}if(a.length>0){let l=s.length===0||s.endsWith(`
|
|
4
4
|
`)?s:`${s}
|
|
5
5
|
`;await $(h.dirname(r),{recursive:!0}),await f(this.#t,r),await S(r,`${l}${a.map(u=>JSON.stringify(u)).join(`
|
|
6
6
|
`)}
|
|
7
7
|
`)}return this.#e=o,Object.freeze({version_before:c,version_after:o.version,appended:Object.freeze(a),skipped_event_ids:Object.freeze(R)})}finally{await i()}}async snapshot(e={}){return this.#e=await this.#r(),this.#e.snapshot(e)}async page(e){return this.#e=await this.#r(),this.#e.page(e)}async*stream(e={}){this.#e=await this.#r(),yield*this.#e.stream(e)}async project(e,t,i={}){return this.#e=await this.#r(),this.#e.project(e,t,i)}async#r(){let e=await g(this.#t);try{let t=await f(this.#t,this.#o);return(await w(t,this.#i,this.#n)).log}finally{await e()}}};(function(){try{var n=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new n.Error().stack;e&&(n._sentryDebugIds=n._sentryDebugIds||{},n._sentryDebugIds[e]="874a21db-ed3b-5b4f-a913-bf87103172e7")}catch{}})();function P(n){return[...n].sort().join("\0")}function X(n,e,t){let i=n.successors.get(e);i?i.push(t):n.successors.set(e,[t]);let r=n.predecessors.get(t);r?r.push(e):n.predecessors.set(t,[e])}function W(n,e,t,i,r){let o=e.resolve(r);if(o?.ordering!==!0)return;let s=z(i),c=s===void 0?void 0:n.canonicalIds.get(s.toLowerCase());if(c===void 0)return;let d=(o.precedence??"source_before_target")==="source_before_target";X(n,d?t:c,d?c:t)}function Z(n,e){let t={successors:new Map,predecessors:new Map,canonicalIds:new Map},i=n.filter(r=>typeof r?.id=="string"&&r.id.trim().length>0);for(let r of i){let o=r.id.trim();t.canonicalIds.set(o.toLowerCase(),o)}for(let r of i){let o=r.id.trim();W(t,e,o,r.blocked_by,"blocked_by");for(let s of r.dependencies??[])typeof s!="object"||s===null||W(t,e,o,s.id,typeof s.kind=="string"?s.kind:"related")}for(let r of[t.successors,t.predecessors])for(let o of r.values())o.sort();return t}function ee(n,e){let t=new Set([e]),i=[e];for(;i.length>0;){let r=i.pop();for(let o of[n.successors,n.predecessors])for(let s of o.get(r)??[])t.has(s)||(t.add(s),i.push(s))}return t}function te(n,e){let t=new Map;for(let i of e){let r=(n.successors.get(i)??[]).filter(o=>e.has(o));r.length>0&&t.set(i,r)}return t}function B(n,e,t){let i=Z(n,e),r=i.canonicalIds.get(t.trim().toLowerCase());if(r===void 0)return{cycles:[],successors:new Map,canonical:t};let o=te(i,ee(i,r));return{cycles:D(o).filter(s=>s.includes(r)),successors:o,canonical:r}}function ie(n,e,t){let i=new Set(e),r=i.has(t)?t:e[0];if(n.get(r)?.includes(r))return[r,r];for(let o of n.get(r)??[]){if(!i.has(o))continue;let s=ne(n,i,r,o);if(s)return s}return[...e,e[0]]}function ne(n,e,t,i){let r=[[i]],o=new Set([t,i]);for(;r.length>0;){let s=r.shift(),c=s.at(-1);for(let d of n.get(c)??[]){if(d===t)return[t,...s,t];!e.has(d)||o.has(d)||(o.add(d),r.push([...s,d]))}}}function me(n,e,t){let i=N(),r=B(n,i,t),o=B(e,i,t),s=new Set(r.cycles.map(P)),c=new Set(_(n,void 0,i).map(a=>`${a.holder_id.toLowerCase()}\0${a.target_id.toLowerCase()}\0${a.dependency_kind}`));return[..._(e,void 0,i).filter(a=>a.holder_id.toLowerCase()===t.trim().toLowerCase()&&!c.has(`${a.holder_id.toLowerCase()}\0${a.target_id.toLowerCase()}\0${a.dependency_kind}`)).map(a=>`ordering_storage_contradiction_created:${q(a)}:remove_contradicting_dependency_row:run_pm_graph_audit`),...o.cycles.filter(a=>!s.has(P(a))).map(a=>`ordering_cycle_created:${ie(o.successors,a,o.canonical).join(" -> ")}:items_will_not_be_ready:run_pm_graph_audit`)]}export{T as a,V as b,me as c};
|
|
8
|
-
//# sourceMappingURL=chunk-
|
|
8
|
+
//# sourceMappingURL=chunk-SMADBUPL.js.map
|