openplanr 2.6.0 → 2.6.2
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 +24 -0
- package/CONTRIBUTING.md +2 -31
- package/dist/dashboard/.vite/manifest.json +1 -1
- package/dist/dashboard/assets/{index-BaARCc1f.js → index-AeydhSKa.js} +2 -2
- package/dist/dashboard/assets/{index-BaARCc1f.js.map → index-AeydhSKa.js.map} +1 -1
- package/dist/dashboard/dashboard-manifest.json +8 -8
- package/dist/dashboard/index.html +1 -1
- package/dist/services/codex-plugin-service.d.ts +2 -2
- package/dist/services/codex-plugin-service.d.ts.map +1 -1
- package/dist/services/codex-plugin-service.js +7 -7
- package/dist/services/codex-plugin-service.js.map +1 -1
- package/dist/services/diagram-artifact-service.d.ts +20 -0
- package/dist/services/diagram-artifact-service.d.ts.map +1 -1
- package/dist/services/diagram-artifact-service.js +10 -0
- package/dist/services/diagram-artifact-service.js.map +1 -1
- package/lib/host-packages/adapter-registry.json +5 -5
- package/lib/host-packages/capability-map.json +1 -1
- package/lib/host-packages/claude/.claude-plugin/marketplace.json +2 -2
- package/lib/host-packages/claude/openplanr/.claude-plugin/plugin.json +1 -1
- package/lib/host-packages/claude/openplanr/.openplanr-content.json +10 -10
- package/lib/host-packages/claude/openplanr/skills/design/scripts/design.mjs +66 -1
- package/lib/host-packages/claude/openplanr/skills/design/scripts/runtime/packages/protocol/package.json +5 -1
- package/lib/host-packages/claude/openplanr/skills/design-loop/scripts/design.mjs +66 -1
- package/lib/host-packages/claude/openplanr/skills/design-loop/scripts/runtime/packages/protocol/package.json +5 -1
- package/lib/host-packages/claude/openplanr/skills/design-review/scripts/design.mjs +66 -1
- package/lib/host-packages/claude/openplanr/skills/design-review/scripts/runtime/packages/protocol/package.json +5 -1
- package/lib/host-packages/claude/openplanr/skills/plan/scripts/design.mjs +66 -1
- package/lib/host-packages/claude/openplanr/skills/plan/scripts/runtime/packages/protocol/package.json +5 -1
- package/lib/host-packages/cursor/openplanr/.openplanr-content.json +10 -10
- package/lib/host-packages/cursor/openplanr/manifest.json +1 -1
- package/lib/host-packages/cursor/openplanr/rules/planr-design/scripts/design.mjs +66 -1
- package/lib/host-packages/cursor/openplanr/rules/planr-design/scripts/runtime/packages/protocol/package.json +5 -1
- package/lib/host-packages/cursor/openplanr/rules/planr-design-loop/scripts/design.mjs +66 -1
- package/lib/host-packages/cursor/openplanr/rules/planr-design-loop/scripts/runtime/packages/protocol/package.json +5 -1
- package/lib/host-packages/cursor/openplanr/rules/planr-design-review/scripts/design.mjs +66 -1
- package/lib/host-packages/cursor/openplanr/rules/planr-design-review/scripts/runtime/packages/protocol/package.json +5 -1
- package/lib/host-packages/cursor/openplanr/rules/planr-plan/scripts/design.mjs +66 -1
- package/lib/host-packages/cursor/openplanr/rules/planr-plan/scripts/runtime/packages/protocol/package.json +5 -1
- package/lib/host-packages/openai/.claude-plugin/marketplace.json +2 -2
- package/lib/host-packages/openai/openplanr/.codex-plugin/plugin.json +1 -1
- package/lib/host-packages/openai/openplanr/.openplanr-content.json +10 -10
- package/lib/host-packages/openai/openplanr/skills/design/scripts/design.mjs +66 -1
- package/lib/host-packages/openai/openplanr/skills/design/scripts/runtime/packages/protocol/package.json +5 -1
- package/lib/host-packages/openai/openplanr/skills/design-loop/scripts/design.mjs +66 -1
- package/lib/host-packages/openai/openplanr/skills/design-loop/scripts/runtime/packages/protocol/package.json +5 -1
- package/lib/host-packages/openai/openplanr/skills/design-review/scripts/design.mjs +66 -1
- package/lib/host-packages/openai/openplanr/skills/design-review/scripts/runtime/packages/protocol/package.json +5 -1
- package/lib/host-packages/openai/openplanr/skills/plan/scripts/design.mjs +66 -1
- package/lib/host-packages/openai/openplanr/skills/plan/scripts/runtime/packages/protocol/package.json +5 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,29 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 2.6.2
|
|
4
|
+
### Patch Changes
|
|
5
|
+
|
|
6
|
+
- 4ae7379: Save complete authored diagram bundles with durable retries and recovery, render persisted geometry through a shared portable scene, and export immutable SVG, PNG and review HTML snapshots. Add explicit selected-layout previews and read-only legacy migration inspection without changing legacy sources.
|
|
7
|
+
- f3958c5: Add a portable diagram editor session with atomic gesture previews, conditional undo,
|
|
8
|
+
indexed hit testing, bounded clipboard data and refresh recovery. A separate local
|
|
9
|
+
owner transport saves complete authored bundles through the existing durable store
|
|
10
|
+
without granting review sessions access to drafts. Editor controls and authoring CLI
|
|
11
|
+
commands remain separate upcoming work.
|
|
12
|
+
- d314fa2: Add portable editable diagram contracts and a shared deterministic edit kernel.
|
|
13
|
+
|
|
14
|
+
Protocol 1.13 pairs semantic content, authored presentation, original source and source correspondence in one validated bundle. The new `planr-pipeline/diagram-authoring` API compiles explicit commands, previews atomic transactions, separates semantic and presentation changes, reports affected dependencies, and constructs conditional undo/redo without overwriting unrelated edits. IDs are supplied by callers; copy, deletion, containment, geometry locks and connector attachments use the same rules in Node, browsers and Workers.
|
|
15
|
+
|
|
16
|
+
This is an additive foundation for editor and adapter implementations. Existing diagram rendering and review APIs remain supported. It does not add a canvas editor, persistence, company authorization or live collaboration. The CLI update carries the matching pipeline dependency.
|
|
17
|
+
|
|
18
|
+
## 2.6.1
|
|
19
|
+
### Patch Changes
|
|
20
|
+
|
|
21
|
+
- f1493eb: Correct Codex inspection errors to identify the CLI's bundled host package and the setup repair command.
|
|
22
|
+
|
|
23
|
+
Make professional-skill catalog reads work in an isolated pipeline installation by defaulting to its bundled compatibility snapshots. Current-source inspection and evaluation now require an explicit source root instead of reading retired package host trees.
|
|
24
|
+
|
|
25
|
+
Build pipeline compatibility projections from canonical workspace sources during packaging, preserving the self-contained published package. Validate generated archive contents against the existing projection manifests.
|
|
26
|
+
|
|
3
27
|
## 2.6.0
|
|
4
28
|
### Minor Changes
|
|
5
29
|
|
package/CONTRIBUTING.md
CHANGED
|
@@ -1,33 +1,4 @@
|
|
|
1
1
|
# Contributing to the OpenPlanr CLI
|
|
2
2
|
|
|
3
|
-
The
|
|
4
|
-
|
|
5
|
-
[root contribution guide](https://github.com/openplanr/OpenPlanr/blob/main/CONTRIBUTING.md)
|
|
6
|
-
and [Code of Conduct](https://github.com/openplanr/OpenPlanr/blob/main/CODE_OF_CONDUCT.md).
|
|
7
|
-
|
|
8
|
-
Clone the full repository and run these commands from its root:
|
|
9
|
-
|
|
10
|
-
```bash
|
|
11
|
-
npm ci
|
|
12
|
-
npm run generate
|
|
13
|
-
npm run build
|
|
14
|
-
npm run test:focused
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
Do not treat an installed npm package as a standalone development checkout.
|
|
18
|
-
CLI command registration lives under `packages/cli/src/cli/`; services and
|
|
19
|
-
package tests live under `packages/cli/src/services/` and `packages/cli/tests/`.
|
|
20
|
-
Canonical Protocol, domain, and skill sources live in their owning workspaces.
|
|
21
|
-
Edit those sources before regenerating their compatibility projections.
|
|
22
|
-
|
|
23
|
-
For a CLI change, run the relevant focused checks, then package tests and lint:
|
|
24
|
-
|
|
25
|
-
```bash
|
|
26
|
-
npm run test --workspace=openplanr
|
|
27
|
-
npm run lint --workspace=openplanr
|
|
28
|
-
```
|
|
29
|
-
|
|
30
|
-
The root guide describes command-catalog regeneration, full workspace checks,
|
|
31
|
-
and isolated packed-package verification. Submit a focused pull request with the
|
|
32
|
-
behavior change, regression coverage, and any limitations. Report vulnerabilities
|
|
33
|
-
using the [security policy](https://github.com/openplanr/OpenPlanr/blob/main/SECURITY.md).
|
|
3
|
+
The OpenPlanr repository [contribution guide](https://github.com/openplanr/OpenPlanr/blob/main/CONTRIBUTING.md)
|
|
4
|
+
applies to this package. Follow that document for the current policy and instructions.
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"src": "../../../node_modules/@fontsource-variable/geist/files/geist-vietnamese-wght-normal.woff2"
|
|
45
45
|
},
|
|
46
46
|
"index.html": {
|
|
47
|
-
"file": "assets/index-
|
|
47
|
+
"file": "assets/index-AeydhSKa.js",
|
|
48
48
|
"name": "index",
|
|
49
49
|
"src": "index.html",
|
|
50
50
|
"isEntry": true,
|
|
@@ -553,5 +553,5 @@ Error generating stack: `+d.message+`
|
|
|
553
553
|
`),C=(b=I.find(S=>S.startsWith("event:")))==null?void 0:b.slice(6).trim(),O=I.filter(S=>S.startsWith("data:")).map(S=>S.slice(5).trimStart()).join(`
|
|
554
554
|
`);O&&e.reconciler.ingestSseFrame(O,C),x=m.indexOf(`
|
|
555
555
|
|
|
556
|
-
`)}if(w.done){if(m.trim())return he("$","Planning live response ended mid-frame");break}}}finally{A.releaseLock()}})().catch(h=>{if(!t.signal.aborted)throw h instanceof ee?h:new ee("$","Planning live response failed safely")}).finally(()=>{var h;return(h=e.signal)==null?void 0:h.removeEventListener("abort",a)});return Object.freeze({completion:l,close:()=>{var h;t.abort(),e.reconciler.dispose(),(h=e.signal)==null||h.removeEventListener("abort",a)}})}const y4=Object.freeze({connectSse:m4,createSseReconciler:f4,encodeCheckpoint:A4,fetchGraph:h4,parseGraphEnvelope:Cu}),E4=Object.freeze(Object.defineProperty({__proto__:null,planningRuntime:y4},Symbol.toStringTag,{value:"Module"})),B4=Object.freeze({create:Ve}),v4=Object.freeze({ValidationError:ee,isValidatedState:Pe,parseSafeError:$w,parseState:so,statePolicy:oo}),b4=Object.freeze({parse:Ha}),w4=Object.freeze({connectSse:tI,createSseReconciler:eI}),x4=Object.freeze({identity:B4,projection:v4,routing:b4,transport:w4}),j4=Object.freeze(Object.defineProperty({__proto__:null,dashboardRuntime:x4},Symbol.toStringTag,{value:"Module"})),{operateRuntime:Xe}=qP,{planningRuntime:Hc}=E4,{dashboardRuntime:Ne}=j4,ZI=new Set(["ready","read-only","stale","partial","blocked","offline"]),Pr=Ne.projection.parseState({kind:"booting",binding:null,data:null,reasonCodes:[],error:null,mutationEnabled:!1,policy:Ne.projection.statePolicy("booting")}),XI=Ne.routing.parse("#/overview");function WI(e){return`DASHBOARD_${e.toUpperCase().replace("-","_")}`}function pr(e){return Ne.projection.parseState({kind:"loading",binding:e,data:null,reasonCodes:[],error:null,mutationEnabled:!1,policy:Ne.projection.statePolicy("loading")},{currentBinding:e})}function e0(e,t=null){return Ne.projection.parseState({kind:"unavailable",binding:e,data:null,reasonCodes:["DASHBOARD_UNAVAILABLE"],error:t,mutationEnabled:!1,policy:Ne.projection.statePolicy("unavailable")},{currentBinding:e})}function yr(e,t=!1){const s=(e!==null&&typeof e=="object"&&!Array.isArray(e)?e:{}).code==="DASHBOARD_RESPONSE_INVALID"||e instanceof Ne.projection.ValidationError;return Ne.projection.parseSafeError({code:t||!s?"DASHBOARD_READ_FAILED":"DASHBOARD_RESPONSE_INVALID",retryable:!1,context:{operation:"dashboard.projection.read"}})}function Ya(e,t){const a=t??yr(void 0);if(a.code!=="DASHBOARD_RESPONSE_INVALID")return e0(e,a);const s=Ne.projection.parseSafeError({code:"DASHBOARD_RESPONSE_INVALID",retryable:!1,context:{}});return Ne.projection.parseState({kind:"corrupt",binding:null,data:null,reasonCodes:["DASHBOARD_CORRUPT"],error:s,mutationEnabled:!1,policy:Ne.projection.statePolicy("corrupt")})}function Q4(e,t,a,s,c=!1,l=null){if(!ZI.has(e))throw new Error("Unsupported owner presentation state.");return Ne.projection.parseState({kind:e,binding:t,data:a,reasonCodes:e==="ready"?[]:[WI(e)],error:l,mutationEnabled:e==="ready"&&c,policy:Ne.projection.statePolicy(e)},{currentBinding:t,validateData:s})}function I4(e,t){return!Ne.projection.isValidatedState(e)||e.binding===null||e.data===null?e:Ne.projection.parseState({kind:"stale",binding:e.binding,data:e.data,reasonCodes:["DASHBOARD_STALE"],error:t,mutationEnabled:!1,policy:Ne.projection.statePolicy("stale")},{currentBinding:e.binding,validateData:a=>a!==null})}function C4(e,t){return Ne.projection.parseState({kind:e,binding:t,data:null,reasonCodes:[WI(e)],error:null,mutationEnabled:!1,policy:Ne.projection.statePolicy(e)},{currentBinding:t})}function Fr(e,t){const a=B.useRef(t);a.current=t;const s=B.useRef(e);s.current=e;const c=B.useRef(null),l=B.useRef(null),[u,f]=B.useState(0),[h,A]=B.useState(()=>Object.freeze({key:null,revision:0,phase:"idle",data:null,error:null})),y=B.useCallback(()=>f(j=>j+1),[]),m=B.useCallback(()=>{var O;if(c.current!==null)return c.current;const j=s.current;if(j===null)return Promise.reject(new Error("Owner read is unavailable."));const I=new AbortController;(O=l.current)==null||O.abort(),l.current=I,A(S=>Object.freeze({key:j,revision:S.revision,phase:"loading",data:S.key===j?S.data:null,error:null}));const C=a.current(I.signal).then(S=>{if(I.signal.aborted||s.current!==j)throw new DOMException("Cancelled","AbortError");return A(_=>Object.freeze({key:j,revision:_.revision,phase:"ready",data:S,error:null})),S}).catch(S=>{throw!I.signal.aborted&&s.current===j&&A(_=>Object.freeze({key:j,revision:_.revision,phase:"failed",data:_.key===j?_.data:null,error:yr(S,_.key===j&&_.data!==null)})),S}).finally(()=>{c.current===C&&(c.current=null),l.current===I&&(l.current=null)});return c.current=C,C},[]);B.useEffect(()=>{var I;if((I=l.current)==null||I.abort(),l.current=null,c.current=null,e===null){A(Object.freeze({key:null,revision:u,phase:"idle",data:null,error:null}));return}const j=new AbortController;return A(C=>Object.freeze({key:e,revision:u,phase:"loading",data:C.key===e?C.data:null,error:null})),a.current(j.signal).then(C=>{j.signal.aborted||A(Object.freeze({key:e,revision:u,phase:"ready",data:C,error:null}))}).catch(C=>{j.signal.aborted||A(O=>Object.freeze({key:e,revision:u,phase:"failed",data:O.key===e?O.data:null,error:yr(C,O.key===e&&O.data!==null)}))}),()=>j.abort()},[e,u]);const E=h.key===e&&h.revision===u,b=E?h.phase:e===null?"idle":"loading",w=E?h.data:null,x=E?h.error:null;return B.useMemo(()=>Object.freeze({phase:b,data:w,error:x,refetch:y,reconcile:m}),[w,x,b,m,y])}function S4(e){return e===null?null:JSON.stringify(e)}function O4(e){return e.product==="planning"?e:XI}function _4(e){return e.kind==="operate.evidence"||e.kind==="operate.evidence-item"?"evidence":e.kind==="operate.outcomes"?"outcomes":e.kind==="operate.outcome"?"outcome":e.kind==="operate.history"?"history":null}function eu(e){return e.kind==="operate.actions"||e.kind==="operate.action"||e.kind==="operate.action-planning"||e.kind==="operate.inbox"||e.kind==="operate.inbox-item"||e.kind==="operate.recovery"}function N4(e){return e.kind==="operate.action-planning"?{kind:"operate.action",product:"operate",subjectId:e.subjectId}:e}function Vr(e){return Object.freeze({eventHead:e.payload.eventHead,viewHash:e.payload.viewHash})}function Io(e){const t=e.payload.status;if(!ZI.has(t))throw new Ne.projection.ValidationError("$.payload.status","contains an unsupported display status");return t}function R4(e){return e.payload.status==="terminal"?"read-only":Io(e)}function yw(e,t){if(e.data===null)return e.phase==="loading"||e.phase==="idle"?pr(t):Ya(t,e.error);const a=Ne.identity.create({...t,eventHead:e.data.payload.sourceEventHead,viewHash:e.data.payload.sourceViewHash});return Ei(e,a,e.data,Xe.review.createValidator(a),R4(e.data),e.data.payload.mutationEnabled)}function Ei(e,t,a,s,c,l=!1){const u=e.phase==="failed"?"stale":e.phase==="loading"||e.phase==="idle"?"refreshing":c;try{return Q4(u,t,a,s,l,u==="stale"?e.error??yr(void 0,!0):null)}catch(f){return Ya(t,yr(f))}}function Ew(e,t){if(e.data===null)return e.phase==="loading"||e.phase==="idle"?pr(t):Ya(t,e.error);const a=Ne.identity.create({...t,eventHead:e.data.cursor.eventHead,viewHash:e.data.cursor.viewHash});return Ei(e,a,e.data,s=>{try{return Hc.parseGraphEnvelope(s,t),!0}catch{return!1}},"ready")}function Bw(e,t,a,s){var u;if(e.data===null)return e.phase==="loading"||e.phase==="idle"?pr(t):Ya(t,e.error);const c=Ne.identity.create({...t,...Vr(e.data)}),l=a==="today"?Xe.today.createValidator(c):Xe.cycles.createListValidator(c);return e.phase!=="ready"?Ei(e,c,e.data,l,Io(e.data),e.data.payload.mutationEnabled):a==="today"&&e.data.payload.surface==="today"&&e.data.payload.status==="ready"&&e.data.payload.data.activeCycle===null?l(e.data)?s?s.phase==="loading"||s.phase==="idle"?Ei(Object.freeze({...e,phase:"loading",error:null}),c,e.data,l,"ready"):s.phase==="failed"?Ei(Object.freeze({...e,phase:"failed",error:s.error}),c,e.data,l,"ready"):((u=s.data)==null?void 0:u.payload.surface)!=="cycles"?Ya(c,yr(new Ne.projection.ValidationError("$.payload.surface","does not contain the required cycles display"))):C4(s.data.payload.data.cycles.length===0?"first-use":"empty",c):pr(c):Ya(c,yr(new Ne.projection.ValidationError("$.data","failed its owner-boundary contract"))):Ei(e,c,e.data,l,Io(e.data),e.data.payload.mutationEnabled)}function D4(e){if(e.subjectId===null)throw new Error("Action display identity requires a subject.");return Ne.identity.create({...e,route:`#/operate/actions/${encodeURIComponent(e.subjectId)}`})}function vw(e,t,a){if(e.data===null)return e.phase==="loading"||e.phase==="idle"?pr(t):Ya(t,e.error);const s=Ne.identity.create({...t,...Vr(e.data)});let c;if(a.kind==="operate.actions")c=Xe.actions.createListValidator(s);else if(a.kind==="operate.action"||a.kind==="operate.action-planning"){const l=a.kind==="operate.action-planning"?D4(s):s;c=Xe.actions.createDetailValidator(l)}else if(a.kind==="operate.inbox"||a.kind==="operate.inbox-item")c=Xe.actions.createInboxValidator(s);else if(a.kind==="operate.recovery")c=Xe.actions.createRecoveryValidator(s);else return e0(s);return Ei(e,s,e.data,c,Io(e.data),a.kind==="operate.action-planning"?!1:e.data.payload.mutationEnabled)}function T4(e,t){var ye,Ee;const a=(e==null?void 0:e.origin)??null,s=JSON.stringify(t),[c,l]=B.useState(null),u=(e==null?void 0:e.queryRoots.planning)??null,f=(e==null?void 0:e.queryRoots.operate)??null,h=B.useMemo(()=>O4(t),[t]),A=B.useMemo(()=>u?Xe.transport.identityFromRoot(u,XI):null,[u]),y=B.useMemo(()=>u?Xe.transport.identityFromRoot(u,h):null,[u,h]),m=Fr(A?JSON.stringify(A):null,R=>{if(!a||!A)throw new Error("Planning query root is unavailable.");return Hc.fetchGraph({origin:a,identity:A,signal:R})}),E=S4(f),b=Fr(E,R=>{if(!a||!f)throw new Error("Operate query root is unavailable.");return Xe.transport.fetchRootDisplay({origin:a,root:f,surface:"today",signal:R})}),w=Fr(E,R=>{if(!a||!f)throw new Error("Operate query root is unavailable.");return Xe.transport.fetchRootDisplay({origin:a,root:f,surface:"cycles",signal:R})}),x=((ye=b.data)==null?void 0:ye.payload.surface)==="today"?b.data:null,j=(x==null?void 0:x.payload.surface)==="today"?((Ee=x.payload.data.activeCycle)==null?void 0:Ee.cycleId)??null:null,I=t.kind==="operate.cycle"?t.subjectId:t.kind==="operate.review"?t.cycleId:j,C=x?Vr(x):null,O=B.useMemo(()=>f&&t.product==="operate"&&I&&C?Xe.transport.identityFromRoot(f,t,{cycleId:I,eventHead:C.eventHead,viewHash:C.viewHash}):null,[C,f,t,I]),S=a&&f&&O?JSON.stringify({root:f,binding:O}):null,_=B.useMemo(()=>f&&t.kind==="operate.review"?Xe.transport.identityFromRoot(f,t,{cycleId:t.cycleId}):null,[f,t]),k=a&&_?JSON.stringify({root:f,route:_.route}):null,N=Fr(k,R=>{if(!a||!f||t.kind!=="operate.review")throw new Error("Operate Review query custody is incomplete.");return Xe.review.fetch({origin:a,root:f,cycleId:t.cycleId,reviewId:t.subjectId,signal:R})}),z=B.useMemo(()=>N4(t),[t]),M=B.useMemo(()=>f&&eu(t)&&I&&C?Xe.transport.identityFromRoot(f,z,{cycleId:I,eventHead:C.eventHead,viewHash:C.viewHash}):null,[z,C,f,t,I]),L=a&&f&&M?JSON.stringify({root:f,binding:M}):null,Z=_4(t),F=Fr(Z?S:null,R=>{if(!a||!f||!I||!Z)throw new Error("Operate audit query custody is incomplete.");return Xe.transport.fetchAuditDisplay({origin:a,root:f,route:t,surface:Z,cycleId:I,signal:R})}),oe=Fr(t.kind==="operate.cycle"?S:null,R=>{if(!a||!f||t.kind!=="operate.cycle")throw new Error("Operate Cycle query custody is incomplete.");return Xe.transport.fetchCycleDisplay({origin:a,root:f,cycleId:t.subjectId,signal:R})}),re=Fr(eu(t)?L:null,R=>{if(!a||!M)throw new Error("Operate route display custody is incomplete.");if(t.kind==="operate.actions")return Xe.actions.fetchList({origin:a,identity:M,signal:R});if(t.kind==="operate.action"||t.kind==="operate.action-planning")return Xe.actions.fetchDetail({origin:a,identity:M,signal:R});if(t.kind==="operate.inbox"||t.kind==="operate.inbox-item")return Xe.actions.fetchInbox({origin:a,identity:M,signal:R});if(t.kind==="operate.recovery")return Xe.actions.fetchRecovery({origin:a,identity:M,signal:R});throw new Error("Operate route does not own a bound display read.")}),pe=B.useMemo(()=>y?Ew(m,y):Pr,[y,m]),Y=B.useMemo(()=>{if(!f)return null;const R=Ne.routing.parse("#/operate/today");return Xe.transport.identityFromRoot(f,R,{cycleId:j})},[j,f]),V=B.useMemo(()=>Y?Bw(b,Y,"today",w):Pr,[w,Y,b]),te=B.useMemo(()=>{if(!V.binding||!I)return null;const R=Xe.today.resolveModel({current:V},V.binding);return(R==null?void 0:R.kind)==="surface"?Xe.review.uniqueNavigationForCycle(R,I):null},[I,V]),le=B.useMemo(()=>f?Xe.transport.identityFromRoot(f,Ne.routing.parse("#/operate/cycles")):null,[f]),fe=B.useMemo(()=>le?Bw(w,le,"cycles"):Pr,[le,w]),T=B.useMemo(()=>{var ne;if(!f||((ne=w.data)==null?void 0:ne.payload.surface)!=="cycles")return Object.freeze([]);const R=Vr(w.data),J=Ne.routing.parse("#/operate/cycles");return Object.freeze(w.data.payload.data.cycles.map(Ae=>Xe.transport.identityFromRoot(f,J,{cycleId:Ae.cycleId,eventHead:R.eventHead,viewHash:R.viewHash})))},[w,f]),X=B.useMemo(()=>{if(t.product==="planning")return Object.freeze({binding:pe.binding,projection:pe});if(t.product!=="operate"||!f)return Object.freeze({binding:null,projection:Pr});if(t.kind==="operate.today")return Object.freeze({binding:V.binding,projection:V});if(t.kind==="operate.cycles")return Object.freeze({binding:fe.binding,projection:fe});if(t.kind==="operate.review"){if(!_)return Object.freeze({binding:null,projection:Pr});const J=yw(N,_);return Object.freeze({binding:J.binding,projection:J})}if(!C||!I)return Object.freeze({binding:null,projection:Pr});const R=O;if(!R)return Object.freeze({binding:null,projection:Pr});if(t.kind==="operate.cycle"){if(oe.data===null){const ne=oe.phase==="loading"||oe.phase==="idle"?pr(R):Ya(R,oe.error);return Object.freeze({binding:ne.binding,projection:ne})}const J=Ne.identity.create({...R,...Vr(oe.data)});return Object.freeze({binding:J,projection:Ei(oe,J,oe.data,Xe.cycles.createDetailValidator(J),Io(oe.data),oe.data.payload.mutationEnabled)})}if(Z){if(F.data===null){const Ae=F.phase==="loading"||F.phase==="idle"?pr(R):Ya(R,F.error);return Object.freeze({binding:Ae.binding,projection:Ae})}const J=Ne.identity.create({...R,...Vr(F.data)}),ne=Z==="evidence"?Xe.audit.createEvidenceValidator(J):Z==="outcomes"||Z==="outcome"?Xe.audit.createOutcomeValidator(J):Xe.audit.createHistoryValidator(J);return Object.freeze({binding:J,projection:Ei(F,J,F.data,ne,Io(F.data),!1)})}return eu(t)?Object.freeze({binding:R,projection:vw(re,R,t)}):Object.freeze({binding:R,projection:pr(R)})},[F,Z,re,O,oe,C,fe,f,pe,N,_,t,I,V]);B.useEffect(()=>{l(R=>R!==null&&R.routeKey!==s?null:R)},[s]);const se=B.useMemo(()=>c!==null&&c.routeKey===s&&(!Ne.projection.isValidatedState(X.projection)||X.projection.data===null)?Object.freeze({binding:c.binding,projection:c.projection}):X,[c,X,s]);B.useEffect(()=>{if(!a||!m.data||m.phase!=="ready"||!A)return;const R=Ne.identity.create({...A,eventHead:m.data.cursor.eventHead,viewHash:m.data.cursor.viewHash});let J=!0;const ne=Hc.createSseReconciler({identity:R,initial:m.data,isCurrent:()=>J,onSnapshot:()=>{},onPatch:()=>m.refetch(),onRefetch:()=>m.refetch(),onStale:()=>m.refetch()}),Ae=Hc.connectSse({origin:a,identity:R,reconciler:ne,lastEventId:Hc.encodeCheckpoint(m.data.cursor)});return Ae.completion.catch(()=>{}),()=>{J=!1,Ae.close()}},[a,A,m]),B.useEffect(()=>{if(!a||!f||!x||!Y)return;const R=Vr(x),J=Ne.identity.create({...Y,...R});let ne=!0;const Ae=Ne.transport.createSseReconciler({identity:J,isCurrent:()=>ne,onSnapshot:(xe,Ze)=>{var Ie,ce;(Ze.eventHead.sequence!==((Ie=R.eventHead)==null?void 0:Ie.sequence)||Ze.eventHead.hash!==((ce=R.eventHead)==null?void 0:ce.hash)||Ze.viewHash!==R.viewHash)&&(b.refetch(),w.refetch())},onPatch:()=>{b.refetch(),w.refetch()},onRefetch:()=>{b.refetch(),w.refetch()},onStale:()=>{b.refetch(),w.refetch()}}),we=Ne.transport.connectSse({origin:a,identity:J,reconciler:Ae});return we.completion.catch(()=>{}),()=>{ne=!1,we.close()}},[w,a,f,x,Y,b]);const de=B.useCallback(async()=>{const R=se;R.binding!==null&&Ne.projection.isValidatedState(R.projection)&&R.projection.data!==null&&l(Object.freeze({routeKey:s,binding:R.binding,projection:R.projection}));try{let J;if(t.kind==="operate.review"&&_){const ne=await N.reconcile();J=yw(Object.freeze({phase:"ready",data:ne,error:null,refetch:N.refetch,reconcile:N.reconcile}),_)}else if(eu(t)&&O){const ne=await re.reconcile();J=vw(Object.freeze({phase:"ready",data:ne,error:null,refetch:re.refetch,reconcile:re.reconcile}),O,t)}else if(t.product==="planning"&&y){const ne=await m.reconcile();J=Ew(Object.freeze({phase:"ready",data:ne,error:null,refetch:m.refetch,reconcile:m.reconcile}),y)}else throw new Ne.projection.ValidationError("$.route","does not own an exact reconciliation read");if(!Ne.projection.isValidatedState(J)||J.data===null)throw new Ne.projection.ValidationError("$.projection","did not return a verified projection");return l(null),J}catch(J){const ne=R.binding!==null&&Ne.projection.isValidatedState(R.projection)&&R.projection.data!==null,Ae=yr(J,ne),we=ne?I4(R.projection,Ae):R.binding===null?R.projection:Ya(R.binding,Ae);return ne&&R.binding!==null&&l(Object.freeze({routeKey:s,binding:R.binding,projection:we})),we}},[re,O,se,y,m,N,_,t,s]);return Object.freeze({binding:se.binding,projection:se.projection,planningProjection:pe,operateCyclesProjection:fe,operateSearchBindings:T,operateReviewNavigation:te,refetchCurrent:de})}function bw(e){return e!==void 0?e:typeof window>"u"?"":window.location.hash}function k4(e,t){return e!==void 0||typeof window>"u"?()=>{}:(window.addEventListener("hashchange",t),()=>window.removeEventListener("hashchange",t))}function M4({buildId:e,initialHash:t,identity:a,connection:s,bootstrap:c,bootPhase:l,bootDetail:u}){const f=B.useSyncExternalStore(S=>k4(t,S),()=>bw(t),()=>bw(t)),h=c===void 0&&s===void 0,[A,y]=B.useState(c??null),[m,E]=B.useState(l??(h?"checking":"compatible")),[b,w]=B.useState(u??null);B.useEffect(()=>{if(!h)return;const S=new AbortController;return E("checking"),w("Waiting for OpenPlanr to return a validated bootstrap envelope."),BP(e,{signal:S.signal}).then(_=>{y(_.bootstrap),E(_.phase==="compatible"?"compatible":_.phase),w(_.detail)}).catch(()=>{}),()=>S.abort()},[e,h]);const x=B.useMemo(()=>s??x1(A,e,b),[A,b,e,s]),j=B.useMemo(()=>a??j1(A),[A,a]),I=B.useMemo(()=>Ha(f),[f]),C=I.kind==="system.diagnostics"||m==="incompatible"||x.state==="incompatible",O=T4(m==="compatible"&&x.state!=="incompatible"&&I.product!==null?A:null,I);return r.jsxs(y1,{buildId:e,initialHash:C?Pa(kw):t,identity:j,connection:x,bootstrap:A,bootPhase:m,bootDetail:b,binding:O.binding,projection:O.projection,planningProjection:O.planningProjection,operateCyclesProjection:O.operateCyclesProjection,operateSearchBindings:O.operateSearchBindings,operateReviewNavigation:O.operateReviewNavigation,refetchCurrent:O.refetchCurrent,children:[r.jsx(B1,{}),r.jsx(pP,{})]})}const t0=document.querySelector("#root");if(!t0)throw new Error("OpenPlanr dashboard root element is missing.");DS.createRoot(t0).render(r.jsx(B.StrictMode,{children:r.jsx(M4,{buildId:"dashboard-0.1.4-20b68709bc139f8b"})}));
|
|
557
|
-
//# sourceMappingURL=index-
|
|
556
|
+
`)}if(w.done){if(m.trim())return he("$","Planning live response ended mid-frame");break}}}finally{A.releaseLock()}})().catch(h=>{if(!t.signal.aborted)throw h instanceof ee?h:new ee("$","Planning live response failed safely")}).finally(()=>{var h;return(h=e.signal)==null?void 0:h.removeEventListener("abort",a)});return Object.freeze({completion:l,close:()=>{var h;t.abort(),e.reconciler.dispose(),(h=e.signal)==null||h.removeEventListener("abort",a)}})}const y4=Object.freeze({connectSse:m4,createSseReconciler:f4,encodeCheckpoint:A4,fetchGraph:h4,parseGraphEnvelope:Cu}),E4=Object.freeze(Object.defineProperty({__proto__:null,planningRuntime:y4},Symbol.toStringTag,{value:"Module"})),B4=Object.freeze({create:Ve}),v4=Object.freeze({ValidationError:ee,isValidatedState:Pe,parseSafeError:$w,parseState:so,statePolicy:oo}),b4=Object.freeze({parse:Ha}),w4=Object.freeze({connectSse:tI,createSseReconciler:eI}),x4=Object.freeze({identity:B4,projection:v4,routing:b4,transport:w4}),j4=Object.freeze(Object.defineProperty({__proto__:null,dashboardRuntime:x4},Symbol.toStringTag,{value:"Module"})),{operateRuntime:Xe}=qP,{planningRuntime:Hc}=E4,{dashboardRuntime:Ne}=j4,ZI=new Set(["ready","read-only","stale","partial","blocked","offline"]),Pr=Ne.projection.parseState({kind:"booting",binding:null,data:null,reasonCodes:[],error:null,mutationEnabled:!1,policy:Ne.projection.statePolicy("booting")}),XI=Ne.routing.parse("#/overview");function WI(e){return`DASHBOARD_${e.toUpperCase().replace("-","_")}`}function pr(e){return Ne.projection.parseState({kind:"loading",binding:e,data:null,reasonCodes:[],error:null,mutationEnabled:!1,policy:Ne.projection.statePolicy("loading")},{currentBinding:e})}function e0(e,t=null){return Ne.projection.parseState({kind:"unavailable",binding:e,data:null,reasonCodes:["DASHBOARD_UNAVAILABLE"],error:t,mutationEnabled:!1,policy:Ne.projection.statePolicy("unavailable")},{currentBinding:e})}function yr(e,t=!1){const s=(e!==null&&typeof e=="object"&&!Array.isArray(e)?e:{}).code==="DASHBOARD_RESPONSE_INVALID"||e instanceof Ne.projection.ValidationError;return Ne.projection.parseSafeError({code:t||!s?"DASHBOARD_READ_FAILED":"DASHBOARD_RESPONSE_INVALID",retryable:!1,context:{operation:"dashboard.projection.read"}})}function Ya(e,t){const a=t??yr(void 0);if(a.code!=="DASHBOARD_RESPONSE_INVALID")return e0(e,a);const s=Ne.projection.parseSafeError({code:"DASHBOARD_RESPONSE_INVALID",retryable:!1,context:{}});return Ne.projection.parseState({kind:"corrupt",binding:null,data:null,reasonCodes:["DASHBOARD_CORRUPT"],error:s,mutationEnabled:!1,policy:Ne.projection.statePolicy("corrupt")})}function Q4(e,t,a,s,c=!1,l=null){if(!ZI.has(e))throw new Error("Unsupported owner presentation state.");return Ne.projection.parseState({kind:e,binding:t,data:a,reasonCodes:e==="ready"?[]:[WI(e)],error:l,mutationEnabled:e==="ready"&&c,policy:Ne.projection.statePolicy(e)},{currentBinding:t,validateData:s})}function I4(e,t){return!Ne.projection.isValidatedState(e)||e.binding===null||e.data===null?e:Ne.projection.parseState({kind:"stale",binding:e.binding,data:e.data,reasonCodes:["DASHBOARD_STALE"],error:t,mutationEnabled:!1,policy:Ne.projection.statePolicy("stale")},{currentBinding:e.binding,validateData:a=>a!==null})}function C4(e,t){return Ne.projection.parseState({kind:e,binding:t,data:null,reasonCodes:[WI(e)],error:null,mutationEnabled:!1,policy:Ne.projection.statePolicy(e)},{currentBinding:t})}function Fr(e,t){const a=B.useRef(t);a.current=t;const s=B.useRef(e);s.current=e;const c=B.useRef(null),l=B.useRef(null),[u,f]=B.useState(0),[h,A]=B.useState(()=>Object.freeze({key:null,revision:0,phase:"idle",data:null,error:null})),y=B.useCallback(()=>f(j=>j+1),[]),m=B.useCallback(()=>{var O;if(c.current!==null)return c.current;const j=s.current;if(j===null)return Promise.reject(new Error("Owner read is unavailable."));const I=new AbortController;(O=l.current)==null||O.abort(),l.current=I,A(S=>Object.freeze({key:j,revision:S.revision,phase:"loading",data:S.key===j?S.data:null,error:null}));const C=a.current(I.signal).then(S=>{if(I.signal.aborted||s.current!==j)throw new DOMException("Cancelled","AbortError");return A(_=>Object.freeze({key:j,revision:_.revision,phase:"ready",data:S,error:null})),S}).catch(S=>{throw!I.signal.aborted&&s.current===j&&A(_=>Object.freeze({key:j,revision:_.revision,phase:"failed",data:_.key===j?_.data:null,error:yr(S,_.key===j&&_.data!==null)})),S}).finally(()=>{c.current===C&&(c.current=null),l.current===I&&(l.current=null)});return c.current=C,C},[]);B.useEffect(()=>{var I;if((I=l.current)==null||I.abort(),l.current=null,c.current=null,e===null){A(Object.freeze({key:null,revision:u,phase:"idle",data:null,error:null}));return}const j=new AbortController;return A(C=>Object.freeze({key:e,revision:u,phase:"loading",data:C.key===e?C.data:null,error:null})),a.current(j.signal).then(C=>{j.signal.aborted||A(Object.freeze({key:e,revision:u,phase:"ready",data:C,error:null}))}).catch(C=>{j.signal.aborted||A(O=>Object.freeze({key:e,revision:u,phase:"failed",data:O.key===e?O.data:null,error:yr(C,O.key===e&&O.data!==null)}))}),()=>j.abort()},[e,u]);const E=h.key===e&&h.revision===u,b=E?h.phase:e===null?"idle":"loading",w=E?h.data:null,x=E?h.error:null;return B.useMemo(()=>Object.freeze({phase:b,data:w,error:x,refetch:y,reconcile:m}),[w,x,b,m,y])}function S4(e){return e===null?null:JSON.stringify(e)}function O4(e){return e.product==="planning"?e:XI}function _4(e){return e.kind==="operate.evidence"||e.kind==="operate.evidence-item"?"evidence":e.kind==="operate.outcomes"?"outcomes":e.kind==="operate.outcome"?"outcome":e.kind==="operate.history"?"history":null}function eu(e){return e.kind==="operate.actions"||e.kind==="operate.action"||e.kind==="operate.action-planning"||e.kind==="operate.inbox"||e.kind==="operate.inbox-item"||e.kind==="operate.recovery"}function N4(e){return e.kind==="operate.action-planning"?{kind:"operate.action",product:"operate",subjectId:e.subjectId}:e}function Vr(e){return Object.freeze({eventHead:e.payload.eventHead,viewHash:e.payload.viewHash})}function Io(e){const t=e.payload.status;if(!ZI.has(t))throw new Ne.projection.ValidationError("$.payload.status","contains an unsupported display status");return t}function R4(e){return e.payload.status==="terminal"?"read-only":Io(e)}function yw(e,t){if(e.data===null)return e.phase==="loading"||e.phase==="idle"?pr(t):Ya(t,e.error);const a=Ne.identity.create({...t,eventHead:e.data.payload.sourceEventHead,viewHash:e.data.payload.sourceViewHash});return Ei(e,a,e.data,Xe.review.createValidator(a),R4(e.data),e.data.payload.mutationEnabled)}function Ei(e,t,a,s,c,l=!1){const u=e.phase==="failed"?"stale":e.phase==="loading"||e.phase==="idle"?"refreshing":c;try{return Q4(u,t,a,s,l,u==="stale"?e.error??yr(void 0,!0):null)}catch(f){return Ya(t,yr(f))}}function Ew(e,t){if(e.data===null)return e.phase==="loading"||e.phase==="idle"?pr(t):Ya(t,e.error);const a=Ne.identity.create({...t,eventHead:e.data.cursor.eventHead,viewHash:e.data.cursor.viewHash});return Ei(e,a,e.data,s=>{try{return Hc.parseGraphEnvelope(s,t),!0}catch{return!1}},"ready")}function Bw(e,t,a,s){var u;if(e.data===null)return e.phase==="loading"||e.phase==="idle"?pr(t):Ya(t,e.error);const c=Ne.identity.create({...t,...Vr(e.data)}),l=a==="today"?Xe.today.createValidator(c):Xe.cycles.createListValidator(c);return e.phase!=="ready"?Ei(e,c,e.data,l,Io(e.data),e.data.payload.mutationEnabled):a==="today"&&e.data.payload.surface==="today"&&e.data.payload.status==="ready"&&e.data.payload.data.activeCycle===null?l(e.data)?s?s.phase==="loading"||s.phase==="idle"?Ei(Object.freeze({...e,phase:"loading",error:null}),c,e.data,l,"ready"):s.phase==="failed"?Ei(Object.freeze({...e,phase:"failed",error:s.error}),c,e.data,l,"ready"):((u=s.data)==null?void 0:u.payload.surface)!=="cycles"?Ya(c,yr(new Ne.projection.ValidationError("$.payload.surface","does not contain the required cycles display"))):C4(s.data.payload.data.cycles.length===0?"first-use":"empty",c):pr(c):Ya(c,yr(new Ne.projection.ValidationError("$.data","failed its owner-boundary contract"))):Ei(e,c,e.data,l,Io(e.data),e.data.payload.mutationEnabled)}function D4(e){if(e.subjectId===null)throw new Error("Action display identity requires a subject.");return Ne.identity.create({...e,route:`#/operate/actions/${encodeURIComponent(e.subjectId)}`})}function vw(e,t,a){if(e.data===null)return e.phase==="loading"||e.phase==="idle"?pr(t):Ya(t,e.error);const s=Ne.identity.create({...t,...Vr(e.data)});let c;if(a.kind==="operate.actions")c=Xe.actions.createListValidator(s);else if(a.kind==="operate.action"||a.kind==="operate.action-planning"){const l=a.kind==="operate.action-planning"?D4(s):s;c=Xe.actions.createDetailValidator(l)}else if(a.kind==="operate.inbox"||a.kind==="operate.inbox-item")c=Xe.actions.createInboxValidator(s);else if(a.kind==="operate.recovery")c=Xe.actions.createRecoveryValidator(s);else return e0(s);return Ei(e,s,e.data,c,Io(e.data),a.kind==="operate.action-planning"?!1:e.data.payload.mutationEnabled)}function T4(e,t){var ye,Ee;const a=(e==null?void 0:e.origin)??null,s=JSON.stringify(t),[c,l]=B.useState(null),u=(e==null?void 0:e.queryRoots.planning)??null,f=(e==null?void 0:e.queryRoots.operate)??null,h=B.useMemo(()=>O4(t),[t]),A=B.useMemo(()=>u?Xe.transport.identityFromRoot(u,XI):null,[u]),y=B.useMemo(()=>u?Xe.transport.identityFromRoot(u,h):null,[u,h]),m=Fr(A?JSON.stringify(A):null,R=>{if(!a||!A)throw new Error("Planning query root is unavailable.");return Hc.fetchGraph({origin:a,identity:A,signal:R})}),E=S4(f),b=Fr(E,R=>{if(!a||!f)throw new Error("Operate query root is unavailable.");return Xe.transport.fetchRootDisplay({origin:a,root:f,surface:"today",signal:R})}),w=Fr(E,R=>{if(!a||!f)throw new Error("Operate query root is unavailable.");return Xe.transport.fetchRootDisplay({origin:a,root:f,surface:"cycles",signal:R})}),x=((ye=b.data)==null?void 0:ye.payload.surface)==="today"?b.data:null,j=(x==null?void 0:x.payload.surface)==="today"?((Ee=x.payload.data.activeCycle)==null?void 0:Ee.cycleId)??null:null,I=t.kind==="operate.cycle"?t.subjectId:t.kind==="operate.review"?t.cycleId:j,C=x?Vr(x):null,O=B.useMemo(()=>f&&t.product==="operate"&&I&&C?Xe.transport.identityFromRoot(f,t,{cycleId:I,eventHead:C.eventHead,viewHash:C.viewHash}):null,[C,f,t,I]),S=a&&f&&O?JSON.stringify({root:f,binding:O}):null,_=B.useMemo(()=>f&&t.kind==="operate.review"?Xe.transport.identityFromRoot(f,t,{cycleId:t.cycleId}):null,[f,t]),k=a&&_?JSON.stringify({root:f,route:_.route}):null,N=Fr(k,R=>{if(!a||!f||t.kind!=="operate.review")throw new Error("Operate Review query custody is incomplete.");return Xe.review.fetch({origin:a,root:f,cycleId:t.cycleId,reviewId:t.subjectId,signal:R})}),z=B.useMemo(()=>N4(t),[t]),M=B.useMemo(()=>f&&eu(t)&&I&&C?Xe.transport.identityFromRoot(f,z,{cycleId:I,eventHead:C.eventHead,viewHash:C.viewHash}):null,[z,C,f,t,I]),L=a&&f&&M?JSON.stringify({root:f,binding:M}):null,Z=_4(t),F=Fr(Z?S:null,R=>{if(!a||!f||!I||!Z)throw new Error("Operate audit query custody is incomplete.");return Xe.transport.fetchAuditDisplay({origin:a,root:f,route:t,surface:Z,cycleId:I,signal:R})}),oe=Fr(t.kind==="operate.cycle"?S:null,R=>{if(!a||!f||t.kind!=="operate.cycle")throw new Error("Operate Cycle query custody is incomplete.");return Xe.transport.fetchCycleDisplay({origin:a,root:f,cycleId:t.subjectId,signal:R})}),re=Fr(eu(t)?L:null,R=>{if(!a||!M)throw new Error("Operate route display custody is incomplete.");if(t.kind==="operate.actions")return Xe.actions.fetchList({origin:a,identity:M,signal:R});if(t.kind==="operate.action"||t.kind==="operate.action-planning")return Xe.actions.fetchDetail({origin:a,identity:M,signal:R});if(t.kind==="operate.inbox"||t.kind==="operate.inbox-item")return Xe.actions.fetchInbox({origin:a,identity:M,signal:R});if(t.kind==="operate.recovery")return Xe.actions.fetchRecovery({origin:a,identity:M,signal:R});throw new Error("Operate route does not own a bound display read.")}),pe=B.useMemo(()=>y?Ew(m,y):Pr,[y,m]),Y=B.useMemo(()=>{if(!f)return null;const R=Ne.routing.parse("#/operate/today");return Xe.transport.identityFromRoot(f,R,{cycleId:j})},[j,f]),V=B.useMemo(()=>Y?Bw(b,Y,"today",w):Pr,[w,Y,b]),te=B.useMemo(()=>{if(!V.binding||!I)return null;const R=Xe.today.resolveModel({current:V},V.binding);return(R==null?void 0:R.kind)==="surface"?Xe.review.uniqueNavigationForCycle(R,I):null},[I,V]),le=B.useMemo(()=>f?Xe.transport.identityFromRoot(f,Ne.routing.parse("#/operate/cycles")):null,[f]),fe=B.useMemo(()=>le?Bw(w,le,"cycles"):Pr,[le,w]),T=B.useMemo(()=>{var ne;if(!f||((ne=w.data)==null?void 0:ne.payload.surface)!=="cycles")return Object.freeze([]);const R=Vr(w.data),J=Ne.routing.parse("#/operate/cycles");return Object.freeze(w.data.payload.data.cycles.map(Ae=>Xe.transport.identityFromRoot(f,J,{cycleId:Ae.cycleId,eventHead:R.eventHead,viewHash:R.viewHash})))},[w,f]),X=B.useMemo(()=>{if(t.product==="planning")return Object.freeze({binding:pe.binding,projection:pe});if(t.product!=="operate"||!f)return Object.freeze({binding:null,projection:Pr});if(t.kind==="operate.today")return Object.freeze({binding:V.binding,projection:V});if(t.kind==="operate.cycles")return Object.freeze({binding:fe.binding,projection:fe});if(t.kind==="operate.review"){if(!_)return Object.freeze({binding:null,projection:Pr});const J=yw(N,_);return Object.freeze({binding:J.binding,projection:J})}if(!C||!I)return Object.freeze({binding:null,projection:Pr});const R=O;if(!R)return Object.freeze({binding:null,projection:Pr});if(t.kind==="operate.cycle"){if(oe.data===null){const ne=oe.phase==="loading"||oe.phase==="idle"?pr(R):Ya(R,oe.error);return Object.freeze({binding:ne.binding,projection:ne})}const J=Ne.identity.create({...R,...Vr(oe.data)});return Object.freeze({binding:J,projection:Ei(oe,J,oe.data,Xe.cycles.createDetailValidator(J),Io(oe.data),oe.data.payload.mutationEnabled)})}if(Z){if(F.data===null){const Ae=F.phase==="loading"||F.phase==="idle"?pr(R):Ya(R,F.error);return Object.freeze({binding:Ae.binding,projection:Ae})}const J=Ne.identity.create({...R,...Vr(F.data)}),ne=Z==="evidence"?Xe.audit.createEvidenceValidator(J):Z==="outcomes"||Z==="outcome"?Xe.audit.createOutcomeValidator(J):Xe.audit.createHistoryValidator(J);return Object.freeze({binding:J,projection:Ei(F,J,F.data,ne,Io(F.data),!1)})}return eu(t)?Object.freeze({binding:R,projection:vw(re,R,t)}):Object.freeze({binding:R,projection:pr(R)})},[F,Z,re,O,oe,C,fe,f,pe,N,_,t,I,V]);B.useEffect(()=>{l(R=>R!==null&&R.routeKey!==s?null:R)},[s]);const se=B.useMemo(()=>c!==null&&c.routeKey===s&&(!Ne.projection.isValidatedState(X.projection)||X.projection.data===null)?Object.freeze({binding:c.binding,projection:c.projection}):X,[c,X,s]);B.useEffect(()=>{if(!a||!m.data||m.phase!=="ready"||!A)return;const R=Ne.identity.create({...A,eventHead:m.data.cursor.eventHead,viewHash:m.data.cursor.viewHash});let J=!0;const ne=Hc.createSseReconciler({identity:R,initial:m.data,isCurrent:()=>J,onSnapshot:()=>{},onPatch:()=>m.refetch(),onRefetch:()=>m.refetch(),onStale:()=>m.refetch()}),Ae=Hc.connectSse({origin:a,identity:R,reconciler:ne,lastEventId:Hc.encodeCheckpoint(m.data.cursor)});return Ae.completion.catch(()=>{}),()=>{J=!1,Ae.close()}},[a,A,m]),B.useEffect(()=>{if(!a||!f||!x||!Y)return;const R=Vr(x),J=Ne.identity.create({...Y,...R});let ne=!0;const Ae=Ne.transport.createSseReconciler({identity:J,isCurrent:()=>ne,onSnapshot:(xe,Ze)=>{var Ie,ce;(Ze.eventHead.sequence!==((Ie=R.eventHead)==null?void 0:Ie.sequence)||Ze.eventHead.hash!==((ce=R.eventHead)==null?void 0:ce.hash)||Ze.viewHash!==R.viewHash)&&(b.refetch(),w.refetch())},onPatch:()=>{b.refetch(),w.refetch()},onRefetch:()=>{b.refetch(),w.refetch()},onStale:()=>{b.refetch(),w.refetch()}}),we=Ne.transport.connectSse({origin:a,identity:J,reconciler:Ae});return we.completion.catch(()=>{}),()=>{ne=!1,we.close()}},[w,a,f,x,Y,b]);const de=B.useCallback(async()=>{const R=se;R.binding!==null&&Ne.projection.isValidatedState(R.projection)&&R.projection.data!==null&&l(Object.freeze({routeKey:s,binding:R.binding,projection:R.projection}));try{let J;if(t.kind==="operate.review"&&_){const ne=await N.reconcile();J=yw(Object.freeze({phase:"ready",data:ne,error:null,refetch:N.refetch,reconcile:N.reconcile}),_)}else if(eu(t)&&O){const ne=await re.reconcile();J=vw(Object.freeze({phase:"ready",data:ne,error:null,refetch:re.refetch,reconcile:re.reconcile}),O,t)}else if(t.product==="planning"&&y){const ne=await m.reconcile();J=Ew(Object.freeze({phase:"ready",data:ne,error:null,refetch:m.refetch,reconcile:m.reconcile}),y)}else throw new Ne.projection.ValidationError("$.route","does not own an exact reconciliation read");if(!Ne.projection.isValidatedState(J)||J.data===null)throw new Ne.projection.ValidationError("$.projection","did not return a verified projection");return l(null),J}catch(J){const ne=R.binding!==null&&Ne.projection.isValidatedState(R.projection)&&R.projection.data!==null,Ae=yr(J,ne),we=ne?I4(R.projection,Ae):R.binding===null?R.projection:Ya(R.binding,Ae);return ne&&R.binding!==null&&l(Object.freeze({routeKey:s,binding:R.binding,projection:we})),we}},[re,O,se,y,m,N,_,t,s]);return Object.freeze({binding:se.binding,projection:se.projection,planningProjection:pe,operateCyclesProjection:fe,operateSearchBindings:T,operateReviewNavigation:te,refetchCurrent:de})}function bw(e){return e!==void 0?e:typeof window>"u"?"":window.location.hash}function k4(e,t){return e!==void 0||typeof window>"u"?()=>{}:(window.addEventListener("hashchange",t),()=>window.removeEventListener("hashchange",t))}function M4({buildId:e,initialHash:t,identity:a,connection:s,bootstrap:c,bootPhase:l,bootDetail:u}){const f=B.useSyncExternalStore(S=>k4(t,S),()=>bw(t),()=>bw(t)),h=c===void 0&&s===void 0,[A,y]=B.useState(c??null),[m,E]=B.useState(l??(h?"checking":"compatible")),[b,w]=B.useState(u??null);B.useEffect(()=>{if(!h)return;const S=new AbortController;return E("checking"),w("Waiting for OpenPlanr to return a validated bootstrap envelope."),BP(e,{signal:S.signal}).then(_=>{y(_.bootstrap),E(_.phase==="compatible"?"compatible":_.phase),w(_.detail)}).catch(()=>{}),()=>S.abort()},[e,h]);const x=B.useMemo(()=>s??x1(A,e,b),[A,b,e,s]),j=B.useMemo(()=>a??j1(A),[A,a]),I=B.useMemo(()=>Ha(f),[f]),C=I.kind==="system.diagnostics"||m==="incompatible"||x.state==="incompatible",O=T4(m==="compatible"&&x.state!=="incompatible"&&I.product!==null?A:null,I);return r.jsxs(y1,{buildId:e,initialHash:C?Pa(kw):t,identity:j,connection:x,bootstrap:A,bootPhase:m,bootDetail:b,binding:O.binding,projection:O.projection,planningProjection:O.planningProjection,operateCyclesProjection:O.operateCyclesProjection,operateSearchBindings:O.operateSearchBindings,operateReviewNavigation:O.operateReviewNavigation,refetchCurrent:O.refetchCurrent,children:[r.jsx(B1,{}),r.jsx(pP,{})]})}const t0=document.querySelector("#root");if(!t0)throw new Error("OpenPlanr dashboard root element is missing.");DS.createRoot(t0).render(r.jsx(B.StrictMode,{children:r.jsx(M4,{buildId:"dashboard-0.1.5-11df7521ace6e45b"})}));
|
|
557
|
+
//# sourceMappingURL=index-AeydhSKa.js.map
|