openplanr 2.6.1 → 2.6.3
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 +17 -0
- 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/diagram-artifact-service.d.ts +26 -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 +11 -11
- package/lib/host-packages/claude/openplanr/skills/design/scripts/design.mjs +80 -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 +80 -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 +80 -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/diagram/references/diagram-fidelity.md +14 -0
- package/lib/host-packages/claude/openplanr/skills/plan/scripts/design.mjs +80 -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 +11 -11
- package/lib/host-packages/cursor/openplanr/manifest.json +1 -1
- package/lib/host-packages/cursor/openplanr/rules/planr-design/scripts/design.mjs +80 -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 +80 -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 +80 -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-diagram/references/diagram-fidelity.md +14 -0
- package/lib/host-packages/cursor/openplanr/rules/planr-plan/scripts/design.mjs +80 -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 +11 -11
- package/lib/host-packages/openai/openplanr/skills/design/scripts/design.mjs +80 -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 +80 -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 +80 -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/diagram/references/diagram-fidelity.md +14 -0
- package/lib/host-packages/openai/openplanr/skills/plan/scripts/design.mjs +80 -1
- package/lib/host-packages/openai/openplanr/skills/plan/scripts/runtime/packages/protocol/package.json +5 -1
- package/package.json +2 -2
|
@@ -14910,6 +14910,7 @@ function createArtifactReviewServer({
|
|
|
14910
14910
|
throw artifactError(ARTIFACT_ERROR_CODES.LOOPBACK_STATE, "Artifact review instance id is invalid.");
|
|
14911
14911
|
}
|
|
14912
14912
|
const sessions = /* @__PURE__ */ new Map();
|
|
14913
|
+
const ownerSessions = /* @__PURE__ */ new Map();
|
|
14913
14914
|
let port = null;
|
|
14914
14915
|
let closePromise = null;
|
|
14915
14916
|
let pendingRegistrations = 0;
|
|
@@ -14917,7 +14918,7 @@ function createArtifactReviewServer({
|
|
|
14917
14918
|
let draining = false;
|
|
14918
14919
|
let emptyTimer = null;
|
|
14919
14920
|
const stageRuntime = () => readFileSync11(STAGE_RUNTIME_PATH, "utf8");
|
|
14920
|
-
const idle = () => sessions.size === 0 && pendingRegistrations === 0 && activeRequests === 0;
|
|
14921
|
+
const idle = () => sessions.size === 0 && ownerSessions.size === 0 && pendingRegistrations === 0 && activeRequests === 0;
|
|
14921
14922
|
const scheduleEmpty = () => {
|
|
14922
14923
|
if (emptyTimer || draining || typeof onEmpty !== "function") return;
|
|
14923
14924
|
emptyTimer = setTimeout(async () => {
|
|
@@ -15042,6 +15043,55 @@ function createArtifactReviewServer({
|
|
|
15042
15043
|
notFound(res, { head });
|
|
15043
15044
|
return;
|
|
15044
15045
|
}
|
|
15046
|
+
if (segments[0] === "o") {
|
|
15047
|
+
const owner = safeSessionId(segments[1]) && ownerSessions.get(segments[1]);
|
|
15048
|
+
if (draining || !sessionMatches(owner, segments[2])) {
|
|
15049
|
+
notFound(res, { head });
|
|
15050
|
+
return;
|
|
15051
|
+
}
|
|
15052
|
+
if (segments.length === 3 && !trailingSlash && ["GET", "HEAD"].includes(req.method)) {
|
|
15053
|
+
send(res, 308, "", { location: `/o/${owner.id}/${owner.capability}/` }, { head });
|
|
15054
|
+
return;
|
|
15055
|
+
}
|
|
15056
|
+
const request2 = Promise.resolve().then(() => owner.handleRequest({
|
|
15057
|
+
req,
|
|
15058
|
+
segments: segments.slice(3),
|
|
15059
|
+
head,
|
|
15060
|
+
origin: `http://${LOOPBACK_HOST}:${port}`,
|
|
15061
|
+
recoveryScope: owner.recoveryScope
|
|
15062
|
+
}));
|
|
15063
|
+
owner.pending.add(request2);
|
|
15064
|
+
let response;
|
|
15065
|
+
try {
|
|
15066
|
+
response = await request2;
|
|
15067
|
+
} finally {
|
|
15068
|
+
owner.pending.delete(request2);
|
|
15069
|
+
}
|
|
15070
|
+
if (!response) {
|
|
15071
|
+
notFound(res, { head });
|
|
15072
|
+
return;
|
|
15073
|
+
}
|
|
15074
|
+
if (response.kind === "asset") {
|
|
15075
|
+
const mediaTypes = { document: "text/html", runtime: "text/javascript", stylesheet: "text/css" };
|
|
15076
|
+
if (!Object.hasOwn(mediaTypes, response.asset) || typeof response.body !== "string") throw new Error("Invalid owner asset response.");
|
|
15077
|
+
send(res, response.status, response.body, {
|
|
15078
|
+
...parentHeaders(),
|
|
15079
|
+
"content-type": `${mediaTypes[response.asset]}; charset=utf-8`,
|
|
15080
|
+
"content-security-policy": "default-src 'none'; script-src 'self'; style-src 'self' 'unsafe-inline'; connect-src 'self'; img-src 'self' data: blob:; font-src 'self'; base-uri 'none'; form-action 'none'; frame-ancestors 'none'"
|
|
15081
|
+
}, { head });
|
|
15082
|
+
return;
|
|
15083
|
+
}
|
|
15084
|
+
send(res, response.status, JSON.stringify(response.body), {
|
|
15085
|
+
// Rejections may precede body consumption (for example Content-Length
|
|
15086
|
+
// above the limit). Do not reuse a socket containing unread body bytes.
|
|
15087
|
+
...response.status >= 400 ? { connection: "close" } : {},
|
|
15088
|
+
"content-type": "application/json; charset=utf-8",
|
|
15089
|
+
"cross-origin-resource-policy": "same-origin",
|
|
15090
|
+
"content-security-policy": "default-src 'none'; frame-ancestors 'none'",
|
|
15091
|
+
"x-frame-options": "DENY"
|
|
15092
|
+
}, { head });
|
|
15093
|
+
return;
|
|
15094
|
+
}
|
|
15045
15095
|
if (segments.length < 3 || segments[0] !== "r" || !safeSessionId(segments[1])) {
|
|
15046
15096
|
notFound(res, { head });
|
|
15047
15097
|
return;
|
|
@@ -15200,6 +15250,32 @@ function createArtifactReviewServer({
|
|
|
15200
15250
|
controlToken,
|
|
15201
15251
|
instanceId,
|
|
15202
15252
|
sessionCount: () => sessions.size,
|
|
15253
|
+
/** Trusted local authority only; this operation has no HTTP control route. */
|
|
15254
|
+
registerOwnerSession({ handleRequest } = {}) {
|
|
15255
|
+
if (draining || closePromise || typeof handleRequest !== "function") {
|
|
15256
|
+
throw artifactError(ARTIFACT_ERROR_CODES.LOOPBACK_STATE, "Local owner session cannot be registered.");
|
|
15257
|
+
}
|
|
15258
|
+
const id4 = mintCapabilityToken({ bytes: SESSION_ID_BYTES });
|
|
15259
|
+
const owner = {
|
|
15260
|
+
id: id4,
|
|
15261
|
+
capability: mintCapabilityToken({ bytes: SESSION_TOKEN_BYTES }),
|
|
15262
|
+
recoveryScope: `diagram-owner_${id4}`,
|
|
15263
|
+
handleRequest,
|
|
15264
|
+
pending: /* @__PURE__ */ new Set()
|
|
15265
|
+
};
|
|
15266
|
+
ownerSessions.set(id4, owner);
|
|
15267
|
+
return Object.freeze({
|
|
15268
|
+
sessionId: id4,
|
|
15269
|
+
capability: owner.capability,
|
|
15270
|
+
recoveryScope: owner.recoveryScope,
|
|
15271
|
+
path: `/o/${id4}/${owner.capability}/`,
|
|
15272
|
+
async close() {
|
|
15273
|
+
ownerSessions.delete(id4);
|
|
15274
|
+
await Promise.allSettled([...owner.pending]);
|
|
15275
|
+
if (idle()) scheduleEmpty();
|
|
15276
|
+
}
|
|
15277
|
+
});
|
|
15278
|
+
},
|
|
15203
15279
|
isIdle: idle,
|
|
15204
15280
|
accepting: () => !draining && !closePromise,
|
|
15205
15281
|
beginCloseIfIdle() {
|
|
@@ -15224,6 +15300,9 @@ function createArtifactReviewServer({
|
|
|
15224
15300
|
emptyTimer = null;
|
|
15225
15301
|
closePromise = (async () => {
|
|
15226
15302
|
sessions.clear();
|
|
15303
|
+
const pendingOwners = [...ownerSessions.values()].flatMap((owner) => [...owner.pending]);
|
|
15304
|
+
ownerSessions.clear();
|
|
15305
|
+
await Promise.allSettled(pendingOwners);
|
|
15227
15306
|
await closeHttpServer(server);
|
|
15228
15307
|
})();
|
|
15229
15308
|
return closePromise;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openplanr/protocol",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Canonical OpenPlanr schemas, registries, typed errors, and portable contract validation",
|
|
6
6
|
"license": "MIT",
|
|
@@ -83,6 +83,10 @@
|
|
|
83
83
|
"./enterprise-contracts": {
|
|
84
84
|
"types": "./src/enterprise-contracts.d.mts",
|
|
85
85
|
"import": "./src/enterprise-contracts.mjs"
|
|
86
|
+
},
|
|
87
|
+
"./diagram-authoring-contracts": {
|
|
88
|
+
"types": "./src/diagram-authoring-contracts.d.mts",
|
|
89
|
+
"import": "./src/diagram-authoring-contracts.mjs"
|
|
86
90
|
}
|
|
87
91
|
},
|
|
88
92
|
"files": [
|
|
@@ -4,6 +4,20 @@ Use this reference when the user requests Mermaid or Excalidraw editing, imports
|
|
|
4
4
|
an existing source, or asks why a projection was omitted.
|
|
5
5
|
|
|
6
6
|
- Canonical `.planr-diagram.json` is the semantic source and is always editable.
|
|
7
|
+
- For the v1.13 flowchart authoring path, the `.planr-diagram-bundle.json` holds
|
|
8
|
+
the semantic document, presentation, exact original Mermaid text, and source
|
|
9
|
+
correspondence. Use `@openplanr/artifact/diagram-authoring`'s
|
|
10
|
+
`previewMermaidCopy`, `adoptMermaidCopy`, and `exportMermaidCopy` for copy
|
|
11
|
+
interchange. Preview never saves; adoption requires acknowledgement of that
|
|
12
|
+
exact preview's fidelity losses. Saving the bundle is a separate owner action.
|
|
13
|
+
- The certified Mermaid copy subset supports explicit flowchart node IDs,
|
|
14
|
+
rectangle/rounded/decision/cylinder shapes, directed/bidirectional/undirected
|
|
15
|
+
edges, labels, and nested subgraphs. It does not infer lanes or preserve
|
|
16
|
+
coordinates, manual routes, annotations, styling, or exact source formatting
|
|
17
|
+
on export. Keep the complete bundle when these matter. Copy import/export
|
|
18
|
+
never creates a repository source link or watcher.
|
|
19
|
+
- Legacy sequence diagrams remain readable and renderable; they are not in the
|
|
20
|
+
editable Mermaid copy certification.
|
|
7
21
|
- Mermaid is emitted only when the selected grammar has a certified projection.
|
|
8
22
|
`editable`, `partial`, and `unsupported` are honest compatibility levels, not
|
|
9
23
|
success or failure labels.
|
|
@@ -14910,6 +14910,7 @@ function createArtifactReviewServer({
|
|
|
14910
14910
|
throw artifactError(ARTIFACT_ERROR_CODES.LOOPBACK_STATE, "Artifact review instance id is invalid.");
|
|
14911
14911
|
}
|
|
14912
14912
|
const sessions = /* @__PURE__ */ new Map();
|
|
14913
|
+
const ownerSessions = /* @__PURE__ */ new Map();
|
|
14913
14914
|
let port = null;
|
|
14914
14915
|
let closePromise = null;
|
|
14915
14916
|
let pendingRegistrations = 0;
|
|
@@ -14917,7 +14918,7 @@ function createArtifactReviewServer({
|
|
|
14917
14918
|
let draining = false;
|
|
14918
14919
|
let emptyTimer = null;
|
|
14919
14920
|
const stageRuntime = () => readFileSync11(STAGE_RUNTIME_PATH, "utf8");
|
|
14920
|
-
const idle = () => sessions.size === 0 && pendingRegistrations === 0 && activeRequests === 0;
|
|
14921
|
+
const idle = () => sessions.size === 0 && ownerSessions.size === 0 && pendingRegistrations === 0 && activeRequests === 0;
|
|
14921
14922
|
const scheduleEmpty = () => {
|
|
14922
14923
|
if (emptyTimer || draining || typeof onEmpty !== "function") return;
|
|
14923
14924
|
emptyTimer = setTimeout(async () => {
|
|
@@ -15042,6 +15043,55 @@ function createArtifactReviewServer({
|
|
|
15042
15043
|
notFound(res, { head });
|
|
15043
15044
|
return;
|
|
15044
15045
|
}
|
|
15046
|
+
if (segments[0] === "o") {
|
|
15047
|
+
const owner = safeSessionId(segments[1]) && ownerSessions.get(segments[1]);
|
|
15048
|
+
if (draining || !sessionMatches(owner, segments[2])) {
|
|
15049
|
+
notFound(res, { head });
|
|
15050
|
+
return;
|
|
15051
|
+
}
|
|
15052
|
+
if (segments.length === 3 && !trailingSlash && ["GET", "HEAD"].includes(req.method)) {
|
|
15053
|
+
send(res, 308, "", { location: `/o/${owner.id}/${owner.capability}/` }, { head });
|
|
15054
|
+
return;
|
|
15055
|
+
}
|
|
15056
|
+
const request2 = Promise.resolve().then(() => owner.handleRequest({
|
|
15057
|
+
req,
|
|
15058
|
+
segments: segments.slice(3),
|
|
15059
|
+
head,
|
|
15060
|
+
origin: `http://${LOOPBACK_HOST}:${port}`,
|
|
15061
|
+
recoveryScope: owner.recoveryScope
|
|
15062
|
+
}));
|
|
15063
|
+
owner.pending.add(request2);
|
|
15064
|
+
let response;
|
|
15065
|
+
try {
|
|
15066
|
+
response = await request2;
|
|
15067
|
+
} finally {
|
|
15068
|
+
owner.pending.delete(request2);
|
|
15069
|
+
}
|
|
15070
|
+
if (!response) {
|
|
15071
|
+
notFound(res, { head });
|
|
15072
|
+
return;
|
|
15073
|
+
}
|
|
15074
|
+
if (response.kind === "asset") {
|
|
15075
|
+
const mediaTypes = { document: "text/html", runtime: "text/javascript", stylesheet: "text/css" };
|
|
15076
|
+
if (!Object.hasOwn(mediaTypes, response.asset) || typeof response.body !== "string") throw new Error("Invalid owner asset response.");
|
|
15077
|
+
send(res, response.status, response.body, {
|
|
15078
|
+
...parentHeaders(),
|
|
15079
|
+
"content-type": `${mediaTypes[response.asset]}; charset=utf-8`,
|
|
15080
|
+
"content-security-policy": "default-src 'none'; script-src 'self'; style-src 'self' 'unsafe-inline'; connect-src 'self'; img-src 'self' data: blob:; font-src 'self'; base-uri 'none'; form-action 'none'; frame-ancestors 'none'"
|
|
15081
|
+
}, { head });
|
|
15082
|
+
return;
|
|
15083
|
+
}
|
|
15084
|
+
send(res, response.status, JSON.stringify(response.body), {
|
|
15085
|
+
// Rejections may precede body consumption (for example Content-Length
|
|
15086
|
+
// above the limit). Do not reuse a socket containing unread body bytes.
|
|
15087
|
+
...response.status >= 400 ? { connection: "close" } : {},
|
|
15088
|
+
"content-type": "application/json; charset=utf-8",
|
|
15089
|
+
"cross-origin-resource-policy": "same-origin",
|
|
15090
|
+
"content-security-policy": "default-src 'none'; frame-ancestors 'none'",
|
|
15091
|
+
"x-frame-options": "DENY"
|
|
15092
|
+
}, { head });
|
|
15093
|
+
return;
|
|
15094
|
+
}
|
|
15045
15095
|
if (segments.length < 3 || segments[0] !== "r" || !safeSessionId(segments[1])) {
|
|
15046
15096
|
notFound(res, { head });
|
|
15047
15097
|
return;
|
|
@@ -15200,6 +15250,32 @@ function createArtifactReviewServer({
|
|
|
15200
15250
|
controlToken,
|
|
15201
15251
|
instanceId,
|
|
15202
15252
|
sessionCount: () => sessions.size,
|
|
15253
|
+
/** Trusted local authority only; this operation has no HTTP control route. */
|
|
15254
|
+
registerOwnerSession({ handleRequest } = {}) {
|
|
15255
|
+
if (draining || closePromise || typeof handleRequest !== "function") {
|
|
15256
|
+
throw artifactError(ARTIFACT_ERROR_CODES.LOOPBACK_STATE, "Local owner session cannot be registered.");
|
|
15257
|
+
}
|
|
15258
|
+
const id4 = mintCapabilityToken({ bytes: SESSION_ID_BYTES });
|
|
15259
|
+
const owner = {
|
|
15260
|
+
id: id4,
|
|
15261
|
+
capability: mintCapabilityToken({ bytes: SESSION_TOKEN_BYTES }),
|
|
15262
|
+
recoveryScope: `diagram-owner_${id4}`,
|
|
15263
|
+
handleRequest,
|
|
15264
|
+
pending: /* @__PURE__ */ new Set()
|
|
15265
|
+
};
|
|
15266
|
+
ownerSessions.set(id4, owner);
|
|
15267
|
+
return Object.freeze({
|
|
15268
|
+
sessionId: id4,
|
|
15269
|
+
capability: owner.capability,
|
|
15270
|
+
recoveryScope: owner.recoveryScope,
|
|
15271
|
+
path: `/o/${id4}/${owner.capability}/`,
|
|
15272
|
+
async close() {
|
|
15273
|
+
ownerSessions.delete(id4);
|
|
15274
|
+
await Promise.allSettled([...owner.pending]);
|
|
15275
|
+
if (idle()) scheduleEmpty();
|
|
15276
|
+
}
|
|
15277
|
+
});
|
|
15278
|
+
},
|
|
15203
15279
|
isIdle: idle,
|
|
15204
15280
|
accepting: () => !draining && !closePromise,
|
|
15205
15281
|
beginCloseIfIdle() {
|
|
@@ -15224,6 +15300,9 @@ function createArtifactReviewServer({
|
|
|
15224
15300
|
emptyTimer = null;
|
|
15225
15301
|
closePromise = (async () => {
|
|
15226
15302
|
sessions.clear();
|
|
15303
|
+
const pendingOwners = [...ownerSessions.values()].flatMap((owner) => [...owner.pending]);
|
|
15304
|
+
ownerSessions.clear();
|
|
15305
|
+
await Promise.allSettled(pendingOwners);
|
|
15227
15306
|
await closeHttpServer(server);
|
|
15228
15307
|
})();
|
|
15229
15308
|
return closePromise;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openplanr/protocol",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Canonical OpenPlanr schemas, registries, typed errors, and portable contract validation",
|
|
6
6
|
"license": "MIT",
|
|
@@ -83,6 +83,10 @@
|
|
|
83
83
|
"./enterprise-contracts": {
|
|
84
84
|
"types": "./src/enterprise-contracts.d.mts",
|
|
85
85
|
"import": "./src/enterprise-contracts.mjs"
|
|
86
|
+
},
|
|
87
|
+
"./diagram-authoring-contracts": {
|
|
88
|
+
"types": "./src/diagram-authoring-contracts.d.mts",
|
|
89
|
+
"import": "./src/diagram-authoring-contracts.mjs"
|
|
86
90
|
}
|
|
87
91
|
},
|
|
88
92
|
"files": [
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"files": [
|
|
9
9
|
{
|
|
10
10
|
"path": "manifest.json",
|
|
11
|
-
"digest": "sha256:
|
|
11
|
+
"digest": "sha256:afd571d81a5c12c74392f1ace5cd4c015646abe3c806fae696a6fe67d6c92c47"
|
|
12
12
|
},
|
|
13
13
|
{
|
|
14
14
|
"path": "rules/planr-artifact.mdc",
|
|
@@ -244,7 +244,7 @@
|
|
|
244
244
|
},
|
|
245
245
|
{
|
|
246
246
|
"path": "rules/planr-design-loop/scripts/design.mjs",
|
|
247
|
-
"digest": "sha256:
|
|
247
|
+
"digest": "sha256:7a554ec4a32ea6caa6f3bb9f9e9059d586527afd73e33feb708739b0bb75c627"
|
|
248
248
|
},
|
|
249
249
|
{
|
|
250
250
|
"path": "rules/planr-design-loop/scripts/runtime/notices/entities.txt",
|
|
@@ -292,7 +292,7 @@
|
|
|
292
292
|
},
|
|
293
293
|
{
|
|
294
294
|
"path": "rules/planr-design-loop/scripts/runtime/packages/protocol/package.json",
|
|
295
|
-
"digest": "sha256:
|
|
295
|
+
"digest": "sha256:6e51f9d61b978532cd129f442a4e88f9f3900e58a7239427ec264c34a1337ac3"
|
|
296
296
|
},
|
|
297
297
|
{
|
|
298
298
|
"path": "rules/planr-design-loop/scripts/runtime/packages/protocol/registry/artifact-theme.json",
|
|
@@ -428,7 +428,7 @@
|
|
|
428
428
|
},
|
|
429
429
|
{
|
|
430
430
|
"path": "rules/planr-design-review/scripts/design.mjs",
|
|
431
|
-
"digest": "sha256:
|
|
431
|
+
"digest": "sha256:7a554ec4a32ea6caa6f3bb9f9e9059d586527afd73e33feb708739b0bb75c627"
|
|
432
432
|
},
|
|
433
433
|
{
|
|
434
434
|
"path": "rules/planr-design-review/scripts/runtime/notices/entities.txt",
|
|
@@ -476,7 +476,7 @@
|
|
|
476
476
|
},
|
|
477
477
|
{
|
|
478
478
|
"path": "rules/planr-design-review/scripts/runtime/packages/protocol/package.json",
|
|
479
|
-
"digest": "sha256:
|
|
479
|
+
"digest": "sha256:6e51f9d61b978532cd129f442a4e88f9f3900e58a7239427ec264c34a1337ac3"
|
|
480
480
|
},
|
|
481
481
|
{
|
|
482
482
|
"path": "rules/planr-design-review/scripts/runtime/packages/protocol/registry/artifact-theme.json",
|
|
@@ -612,7 +612,7 @@
|
|
|
612
612
|
},
|
|
613
613
|
{
|
|
614
614
|
"path": "rules/planr-design/scripts/design.mjs",
|
|
615
|
-
"digest": "sha256:
|
|
615
|
+
"digest": "sha256:7a554ec4a32ea6caa6f3bb9f9e9059d586527afd73e33feb708739b0bb75c627"
|
|
616
616
|
},
|
|
617
617
|
{
|
|
618
618
|
"path": "rules/planr-design/scripts/runtime/notices/entities.txt",
|
|
@@ -660,7 +660,7 @@
|
|
|
660
660
|
},
|
|
661
661
|
{
|
|
662
662
|
"path": "rules/planr-design/scripts/runtime/packages/protocol/package.json",
|
|
663
|
-
"digest": "sha256:
|
|
663
|
+
"digest": "sha256:6e51f9d61b978532cd129f442a4e88f9f3900e58a7239427ec264c34a1337ac3"
|
|
664
664
|
},
|
|
665
665
|
{
|
|
666
666
|
"path": "rules/planr-design/scripts/runtime/packages/protocol/registry/artifact-theme.json",
|
|
@@ -752,7 +752,7 @@
|
|
|
752
752
|
},
|
|
753
753
|
{
|
|
754
754
|
"path": "rules/planr-diagram/references/diagram-fidelity.md",
|
|
755
|
-
"digest": "sha256:
|
|
755
|
+
"digest": "sha256:25294a35cd4cef3744023d0fcf26bb57585f2fa544f712e54f1dd14d2c773522"
|
|
756
756
|
},
|
|
757
757
|
{
|
|
758
758
|
"path": "rules/planr-diagram/references/diagram-intent-to-ir.md",
|
|
@@ -828,7 +828,7 @@
|
|
|
828
828
|
},
|
|
829
829
|
{
|
|
830
830
|
"path": "rules/planr-plan/scripts/design.mjs",
|
|
831
|
-
"digest": "sha256:
|
|
831
|
+
"digest": "sha256:7a554ec4a32ea6caa6f3bb9f9e9059d586527afd73e33feb708739b0bb75c627"
|
|
832
832
|
},
|
|
833
833
|
{
|
|
834
834
|
"path": "rules/planr-plan/scripts/planning-ids.mjs",
|
|
@@ -880,7 +880,7 @@
|
|
|
880
880
|
},
|
|
881
881
|
{
|
|
882
882
|
"path": "rules/planr-plan/scripts/runtime/packages/protocol/package.json",
|
|
883
|
-
"digest": "sha256:
|
|
883
|
+
"digest": "sha256:6e51f9d61b978532cd129f442a4e88f9f3900e58a7239427ec264c34a1337ac3"
|
|
884
884
|
},
|
|
885
885
|
{
|
|
886
886
|
"path": "rules/planr-plan/scripts/runtime/packages/protocol/registry/artifact-theme.json",
|
|
@@ -1043,5 +1043,5 @@
|
|
|
1043
1043
|
"digest": "sha256:6378ad3477e4be8b7e916c4249404c50cafecac1c70ffbf5a1a2fce195dfea16"
|
|
1044
1044
|
}
|
|
1045
1045
|
],
|
|
1046
|
-
"contentDigest": "sha256:
|
|
1046
|
+
"contentDigest": "sha256:cfa5baf3840a22a3e82bec87c86797a1f0a5f5a639a63f710a4d808b8888f97b"
|
|
1047
1047
|
}
|
|
@@ -14910,6 +14910,7 @@ function createArtifactReviewServer({
|
|
|
14910
14910
|
throw artifactError(ARTIFACT_ERROR_CODES.LOOPBACK_STATE, "Artifact review instance id is invalid.");
|
|
14911
14911
|
}
|
|
14912
14912
|
const sessions = /* @__PURE__ */ new Map();
|
|
14913
|
+
const ownerSessions = /* @__PURE__ */ new Map();
|
|
14913
14914
|
let port = null;
|
|
14914
14915
|
let closePromise = null;
|
|
14915
14916
|
let pendingRegistrations = 0;
|
|
@@ -14917,7 +14918,7 @@ function createArtifactReviewServer({
|
|
|
14917
14918
|
let draining = false;
|
|
14918
14919
|
let emptyTimer = null;
|
|
14919
14920
|
const stageRuntime = () => readFileSync11(STAGE_RUNTIME_PATH, "utf8");
|
|
14920
|
-
const idle = () => sessions.size === 0 && pendingRegistrations === 0 && activeRequests === 0;
|
|
14921
|
+
const idle = () => sessions.size === 0 && ownerSessions.size === 0 && pendingRegistrations === 0 && activeRequests === 0;
|
|
14921
14922
|
const scheduleEmpty = () => {
|
|
14922
14923
|
if (emptyTimer || draining || typeof onEmpty !== "function") return;
|
|
14923
14924
|
emptyTimer = setTimeout(async () => {
|
|
@@ -15042,6 +15043,55 @@ function createArtifactReviewServer({
|
|
|
15042
15043
|
notFound(res, { head });
|
|
15043
15044
|
return;
|
|
15044
15045
|
}
|
|
15046
|
+
if (segments[0] === "o") {
|
|
15047
|
+
const owner = safeSessionId(segments[1]) && ownerSessions.get(segments[1]);
|
|
15048
|
+
if (draining || !sessionMatches(owner, segments[2])) {
|
|
15049
|
+
notFound(res, { head });
|
|
15050
|
+
return;
|
|
15051
|
+
}
|
|
15052
|
+
if (segments.length === 3 && !trailingSlash && ["GET", "HEAD"].includes(req.method)) {
|
|
15053
|
+
send(res, 308, "", { location: `/o/${owner.id}/${owner.capability}/` }, { head });
|
|
15054
|
+
return;
|
|
15055
|
+
}
|
|
15056
|
+
const request2 = Promise.resolve().then(() => owner.handleRequest({
|
|
15057
|
+
req,
|
|
15058
|
+
segments: segments.slice(3),
|
|
15059
|
+
head,
|
|
15060
|
+
origin: `http://${LOOPBACK_HOST}:${port}`,
|
|
15061
|
+
recoveryScope: owner.recoveryScope
|
|
15062
|
+
}));
|
|
15063
|
+
owner.pending.add(request2);
|
|
15064
|
+
let response;
|
|
15065
|
+
try {
|
|
15066
|
+
response = await request2;
|
|
15067
|
+
} finally {
|
|
15068
|
+
owner.pending.delete(request2);
|
|
15069
|
+
}
|
|
15070
|
+
if (!response) {
|
|
15071
|
+
notFound(res, { head });
|
|
15072
|
+
return;
|
|
15073
|
+
}
|
|
15074
|
+
if (response.kind === "asset") {
|
|
15075
|
+
const mediaTypes = { document: "text/html", runtime: "text/javascript", stylesheet: "text/css" };
|
|
15076
|
+
if (!Object.hasOwn(mediaTypes, response.asset) || typeof response.body !== "string") throw new Error("Invalid owner asset response.");
|
|
15077
|
+
send(res, response.status, response.body, {
|
|
15078
|
+
...parentHeaders(),
|
|
15079
|
+
"content-type": `${mediaTypes[response.asset]}; charset=utf-8`,
|
|
15080
|
+
"content-security-policy": "default-src 'none'; script-src 'self'; style-src 'self' 'unsafe-inline'; connect-src 'self'; img-src 'self' data: blob:; font-src 'self'; base-uri 'none'; form-action 'none'; frame-ancestors 'none'"
|
|
15081
|
+
}, { head });
|
|
15082
|
+
return;
|
|
15083
|
+
}
|
|
15084
|
+
send(res, response.status, JSON.stringify(response.body), {
|
|
15085
|
+
// Rejections may precede body consumption (for example Content-Length
|
|
15086
|
+
// above the limit). Do not reuse a socket containing unread body bytes.
|
|
15087
|
+
...response.status >= 400 ? { connection: "close" } : {},
|
|
15088
|
+
"content-type": "application/json; charset=utf-8",
|
|
15089
|
+
"cross-origin-resource-policy": "same-origin",
|
|
15090
|
+
"content-security-policy": "default-src 'none'; frame-ancestors 'none'",
|
|
15091
|
+
"x-frame-options": "DENY"
|
|
15092
|
+
}, { head });
|
|
15093
|
+
return;
|
|
15094
|
+
}
|
|
15045
15095
|
if (segments.length < 3 || segments[0] !== "r" || !safeSessionId(segments[1])) {
|
|
15046
15096
|
notFound(res, { head });
|
|
15047
15097
|
return;
|
|
@@ -15200,6 +15250,32 @@ function createArtifactReviewServer({
|
|
|
15200
15250
|
controlToken,
|
|
15201
15251
|
instanceId,
|
|
15202
15252
|
sessionCount: () => sessions.size,
|
|
15253
|
+
/** Trusted local authority only; this operation has no HTTP control route. */
|
|
15254
|
+
registerOwnerSession({ handleRequest } = {}) {
|
|
15255
|
+
if (draining || closePromise || typeof handleRequest !== "function") {
|
|
15256
|
+
throw artifactError(ARTIFACT_ERROR_CODES.LOOPBACK_STATE, "Local owner session cannot be registered.");
|
|
15257
|
+
}
|
|
15258
|
+
const id4 = mintCapabilityToken({ bytes: SESSION_ID_BYTES });
|
|
15259
|
+
const owner = {
|
|
15260
|
+
id: id4,
|
|
15261
|
+
capability: mintCapabilityToken({ bytes: SESSION_TOKEN_BYTES }),
|
|
15262
|
+
recoveryScope: `diagram-owner_${id4}`,
|
|
15263
|
+
handleRequest,
|
|
15264
|
+
pending: /* @__PURE__ */ new Set()
|
|
15265
|
+
};
|
|
15266
|
+
ownerSessions.set(id4, owner);
|
|
15267
|
+
return Object.freeze({
|
|
15268
|
+
sessionId: id4,
|
|
15269
|
+
capability: owner.capability,
|
|
15270
|
+
recoveryScope: owner.recoveryScope,
|
|
15271
|
+
path: `/o/${id4}/${owner.capability}/`,
|
|
15272
|
+
async close() {
|
|
15273
|
+
ownerSessions.delete(id4);
|
|
15274
|
+
await Promise.allSettled([...owner.pending]);
|
|
15275
|
+
if (idle()) scheduleEmpty();
|
|
15276
|
+
}
|
|
15277
|
+
});
|
|
15278
|
+
},
|
|
15203
15279
|
isIdle: idle,
|
|
15204
15280
|
accepting: () => !draining && !closePromise,
|
|
15205
15281
|
beginCloseIfIdle() {
|
|
@@ -15224,6 +15300,9 @@ function createArtifactReviewServer({
|
|
|
15224
15300
|
emptyTimer = null;
|
|
15225
15301
|
closePromise = (async () => {
|
|
15226
15302
|
sessions.clear();
|
|
15303
|
+
const pendingOwners = [...ownerSessions.values()].flatMap((owner) => [...owner.pending]);
|
|
15304
|
+
ownerSessions.clear();
|
|
15305
|
+
await Promise.allSettled(pendingOwners);
|
|
15227
15306
|
await closeHttpServer(server);
|
|
15228
15307
|
})();
|
|
15229
15308
|
return closePromise;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openplanr/protocol",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Canonical OpenPlanr schemas, registries, typed errors, and portable contract validation",
|
|
6
6
|
"license": "MIT",
|
|
@@ -83,6 +83,10 @@
|
|
|
83
83
|
"./enterprise-contracts": {
|
|
84
84
|
"types": "./src/enterprise-contracts.d.mts",
|
|
85
85
|
"import": "./src/enterprise-contracts.mjs"
|
|
86
|
+
},
|
|
87
|
+
"./diagram-authoring-contracts": {
|
|
88
|
+
"types": "./src/diagram-authoring-contracts.d.mts",
|
|
89
|
+
"import": "./src/diagram-authoring-contracts.mjs"
|
|
86
90
|
}
|
|
87
91
|
},
|
|
88
92
|
"files": [
|
|
@@ -14910,6 +14910,7 @@ function createArtifactReviewServer({
|
|
|
14910
14910
|
throw artifactError(ARTIFACT_ERROR_CODES.LOOPBACK_STATE, "Artifact review instance id is invalid.");
|
|
14911
14911
|
}
|
|
14912
14912
|
const sessions = /* @__PURE__ */ new Map();
|
|
14913
|
+
const ownerSessions = /* @__PURE__ */ new Map();
|
|
14913
14914
|
let port = null;
|
|
14914
14915
|
let closePromise = null;
|
|
14915
14916
|
let pendingRegistrations = 0;
|
|
@@ -14917,7 +14918,7 @@ function createArtifactReviewServer({
|
|
|
14917
14918
|
let draining = false;
|
|
14918
14919
|
let emptyTimer = null;
|
|
14919
14920
|
const stageRuntime = () => readFileSync11(STAGE_RUNTIME_PATH, "utf8");
|
|
14920
|
-
const idle = () => sessions.size === 0 && pendingRegistrations === 0 && activeRequests === 0;
|
|
14921
|
+
const idle = () => sessions.size === 0 && ownerSessions.size === 0 && pendingRegistrations === 0 && activeRequests === 0;
|
|
14921
14922
|
const scheduleEmpty = () => {
|
|
14922
14923
|
if (emptyTimer || draining || typeof onEmpty !== "function") return;
|
|
14923
14924
|
emptyTimer = setTimeout(async () => {
|
|
@@ -15042,6 +15043,55 @@ function createArtifactReviewServer({
|
|
|
15042
15043
|
notFound(res, { head });
|
|
15043
15044
|
return;
|
|
15044
15045
|
}
|
|
15046
|
+
if (segments[0] === "o") {
|
|
15047
|
+
const owner = safeSessionId(segments[1]) && ownerSessions.get(segments[1]);
|
|
15048
|
+
if (draining || !sessionMatches(owner, segments[2])) {
|
|
15049
|
+
notFound(res, { head });
|
|
15050
|
+
return;
|
|
15051
|
+
}
|
|
15052
|
+
if (segments.length === 3 && !trailingSlash && ["GET", "HEAD"].includes(req.method)) {
|
|
15053
|
+
send(res, 308, "", { location: `/o/${owner.id}/${owner.capability}/` }, { head });
|
|
15054
|
+
return;
|
|
15055
|
+
}
|
|
15056
|
+
const request2 = Promise.resolve().then(() => owner.handleRequest({
|
|
15057
|
+
req,
|
|
15058
|
+
segments: segments.slice(3),
|
|
15059
|
+
head,
|
|
15060
|
+
origin: `http://${LOOPBACK_HOST}:${port}`,
|
|
15061
|
+
recoveryScope: owner.recoveryScope
|
|
15062
|
+
}));
|
|
15063
|
+
owner.pending.add(request2);
|
|
15064
|
+
let response;
|
|
15065
|
+
try {
|
|
15066
|
+
response = await request2;
|
|
15067
|
+
} finally {
|
|
15068
|
+
owner.pending.delete(request2);
|
|
15069
|
+
}
|
|
15070
|
+
if (!response) {
|
|
15071
|
+
notFound(res, { head });
|
|
15072
|
+
return;
|
|
15073
|
+
}
|
|
15074
|
+
if (response.kind === "asset") {
|
|
15075
|
+
const mediaTypes = { document: "text/html", runtime: "text/javascript", stylesheet: "text/css" };
|
|
15076
|
+
if (!Object.hasOwn(mediaTypes, response.asset) || typeof response.body !== "string") throw new Error("Invalid owner asset response.");
|
|
15077
|
+
send(res, response.status, response.body, {
|
|
15078
|
+
...parentHeaders(),
|
|
15079
|
+
"content-type": `${mediaTypes[response.asset]}; charset=utf-8`,
|
|
15080
|
+
"content-security-policy": "default-src 'none'; script-src 'self'; style-src 'self' 'unsafe-inline'; connect-src 'self'; img-src 'self' data: blob:; font-src 'self'; base-uri 'none'; form-action 'none'; frame-ancestors 'none'"
|
|
15081
|
+
}, { head });
|
|
15082
|
+
return;
|
|
15083
|
+
}
|
|
15084
|
+
send(res, response.status, JSON.stringify(response.body), {
|
|
15085
|
+
// Rejections may precede body consumption (for example Content-Length
|
|
15086
|
+
// above the limit). Do not reuse a socket containing unread body bytes.
|
|
15087
|
+
...response.status >= 400 ? { connection: "close" } : {},
|
|
15088
|
+
"content-type": "application/json; charset=utf-8",
|
|
15089
|
+
"cross-origin-resource-policy": "same-origin",
|
|
15090
|
+
"content-security-policy": "default-src 'none'; frame-ancestors 'none'",
|
|
15091
|
+
"x-frame-options": "DENY"
|
|
15092
|
+
}, { head });
|
|
15093
|
+
return;
|
|
15094
|
+
}
|
|
15045
15095
|
if (segments.length < 3 || segments[0] !== "r" || !safeSessionId(segments[1])) {
|
|
15046
15096
|
notFound(res, { head });
|
|
15047
15097
|
return;
|
|
@@ -15200,6 +15250,32 @@ function createArtifactReviewServer({
|
|
|
15200
15250
|
controlToken,
|
|
15201
15251
|
instanceId,
|
|
15202
15252
|
sessionCount: () => sessions.size,
|
|
15253
|
+
/** Trusted local authority only; this operation has no HTTP control route. */
|
|
15254
|
+
registerOwnerSession({ handleRequest } = {}) {
|
|
15255
|
+
if (draining || closePromise || typeof handleRequest !== "function") {
|
|
15256
|
+
throw artifactError(ARTIFACT_ERROR_CODES.LOOPBACK_STATE, "Local owner session cannot be registered.");
|
|
15257
|
+
}
|
|
15258
|
+
const id4 = mintCapabilityToken({ bytes: SESSION_ID_BYTES });
|
|
15259
|
+
const owner = {
|
|
15260
|
+
id: id4,
|
|
15261
|
+
capability: mintCapabilityToken({ bytes: SESSION_TOKEN_BYTES }),
|
|
15262
|
+
recoveryScope: `diagram-owner_${id4}`,
|
|
15263
|
+
handleRequest,
|
|
15264
|
+
pending: /* @__PURE__ */ new Set()
|
|
15265
|
+
};
|
|
15266
|
+
ownerSessions.set(id4, owner);
|
|
15267
|
+
return Object.freeze({
|
|
15268
|
+
sessionId: id4,
|
|
15269
|
+
capability: owner.capability,
|
|
15270
|
+
recoveryScope: owner.recoveryScope,
|
|
15271
|
+
path: `/o/${id4}/${owner.capability}/`,
|
|
15272
|
+
async close() {
|
|
15273
|
+
ownerSessions.delete(id4);
|
|
15274
|
+
await Promise.allSettled([...owner.pending]);
|
|
15275
|
+
if (idle()) scheduleEmpty();
|
|
15276
|
+
}
|
|
15277
|
+
});
|
|
15278
|
+
},
|
|
15203
15279
|
isIdle: idle,
|
|
15204
15280
|
accepting: () => !draining && !closePromise,
|
|
15205
15281
|
beginCloseIfIdle() {
|
|
@@ -15224,6 +15300,9 @@ function createArtifactReviewServer({
|
|
|
15224
15300
|
emptyTimer = null;
|
|
15225
15301
|
closePromise = (async () => {
|
|
15226
15302
|
sessions.clear();
|
|
15303
|
+
const pendingOwners = [...ownerSessions.values()].flatMap((owner) => [...owner.pending]);
|
|
15304
|
+
ownerSessions.clear();
|
|
15305
|
+
await Promise.allSettled(pendingOwners);
|
|
15227
15306
|
await closeHttpServer(server);
|
|
15228
15307
|
})();
|
|
15229
15308
|
return closePromise;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openplanr/protocol",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Canonical OpenPlanr schemas, registries, typed errors, and portable contract validation",
|
|
6
6
|
"license": "MIT",
|
|
@@ -83,6 +83,10 @@
|
|
|
83
83
|
"./enterprise-contracts": {
|
|
84
84
|
"types": "./src/enterprise-contracts.d.mts",
|
|
85
85
|
"import": "./src/enterprise-contracts.mjs"
|
|
86
|
+
},
|
|
87
|
+
"./diagram-authoring-contracts": {
|
|
88
|
+
"types": "./src/diagram-authoring-contracts.d.mts",
|
|
89
|
+
"import": "./src/diagram-authoring-contracts.mjs"
|
|
86
90
|
}
|
|
87
91
|
},
|
|
88
92
|
"files": [
|