create-egregore 0.21.0 → 0.21.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/assets/egregore-launcher.js +2 -2
- package/lib/renderer-install.js +42 -0
- package/lib/setup.js +15 -14
- package/package.json +2 -2
- package/runtime/claude/.claude/skills/view/SKILL.md +2 -1
- package/runtime/claude/bin/artifact-renderer-install.sh +157 -0
- package/runtime/claude/bin/artifact-renderer.sh +57 -0
- package/runtime/claude/bin/handoff-preview.sh +2 -4
- package/runtime/claude/bin/handoff-run.sh +4 -11
- package/runtime/claude/bin/lib/artifact-renderer/dependencies-lock.json +94 -0
- package/runtime/claude/bin/lib/artifact-renderer/dependencies.json +8 -0
- package/runtime/claude/bin/lib/dashboard-artifact.sh +2 -2
- package/runtime/claude/bin/lib/greeting.sh +2 -13
- package/runtime/claude/bin/post-update.sh +5 -0
- package/runtime/claude/bin/publish-artifact.sh +6 -27
- package/runtime/claude/bin/view-render.sh +2 -13
- package/runtime/claude/egregore_runtime/identity_transfer.py +33 -1
- package/runtime/claude/egregore_runtime/upgrade.py +51 -0
- package/runtime/claude/manifest.json +4 -0
- package/runtime/codex/bin/artifact-renderer-install.sh +157 -0
- package/runtime/codex/bin/artifact-renderer.sh +57 -0
- package/runtime/codex/bin/handoff-preview.sh +2 -4
- package/runtime/codex/bin/handoff-run.sh +4 -11
- package/runtime/codex/bin/lib/artifact-renderer/dependencies-lock.json +94 -0
- package/runtime/codex/bin/lib/artifact-renderer/dependencies.json +8 -0
- package/runtime/codex/bin/lib/dashboard-artifact.sh +2 -2
- package/runtime/codex/bin/lib/greeting.sh +2 -13
- package/runtime/codex/bin/post-update.sh +5 -0
- package/runtime/codex/bin/publish-artifact.sh +6 -27
- package/runtime/codex/bin/view-render.sh +2 -13
- package/runtime/codex/egregore_runtime/identity_transfer.py +33 -1
- package/runtime/codex/egregore_runtime/upgrade.py +51 -0
- package/runtime/codex/manifest.json +4 -0
- package/runtime/pi/bin/artifact-renderer-install.sh +157 -0
- package/runtime/pi/bin/artifact-renderer.sh +57 -0
- package/runtime/pi/bin/handoff-preview.sh +2 -4
- package/runtime/pi/bin/handoff-run.sh +4 -11
- package/runtime/pi/bin/lib/artifact-renderer/dependencies-lock.json +94 -0
- package/runtime/pi/bin/lib/artifact-renderer/dependencies.json +8 -0
- package/runtime/pi/bin/lib/dashboard-artifact.sh +2 -2
- package/runtime/pi/bin/lib/greeting.sh +2 -13
- package/runtime/pi/bin/pi-product-workflows.mjs +1 -4
- package/runtime/pi/bin/post-update.sh +5 -0
- package/runtime/pi/bin/publish-artifact.sh +6 -27
- package/runtime/pi/bin/view-render.sh +2 -13
- package/runtime/pi/egregore_runtime/identity_transfer.py +33 -1
- package/runtime/pi/egregore_runtime/upgrade.py +51 -0
- package/runtime/pi/manifest.json +4 -0
- package/runtime/prime/bin/artifact-renderer-install.sh +157 -0
- package/runtime/prime/bin/artifact-renderer.sh +57 -0
- package/runtime/prime/bin/handoff-preview.sh +2 -4
- package/runtime/prime/bin/handoff-run.sh +4 -11
- package/runtime/prime/bin/lib/artifact-renderer/dependencies-lock.json +94 -0
- package/runtime/prime/bin/lib/artifact-renderer/dependencies.json +8 -0
- package/runtime/prime/bin/lib/dashboard-artifact.sh +2 -2
- package/runtime/prime/bin/lib/greeting.sh +2 -13
- package/runtime/prime/bin/pi-product-workflows.mjs +1 -4
- package/runtime/prime/bin/post-update.sh +5 -0
- package/runtime/prime/bin/publish-artifact.sh +6 -27
- package/runtime/prime/bin/view-render.sh +2 -13
- package/runtime/prime/egregore_runtime/identity_transfer.py +33 -1
- package/runtime/prime/egregore_runtime/upgrade.py +51 -0
- package/runtime/prime/manifest.json +4 -0
|
@@ -11,6 +11,7 @@ from dataclasses import replace
|
|
|
11
11
|
import hashlib
|
|
12
12
|
import json
|
|
13
13
|
import os
|
|
14
|
+
import re
|
|
14
15
|
from pathlib import Path, PurePosixPath
|
|
15
16
|
import tempfile
|
|
16
17
|
from typing import Any, Mapping
|
|
@@ -101,6 +102,26 @@ def _changed_fields(fields: Mapping[str, Any], source_id: str, destination_id: s
|
|
|
101
102
|
return updates
|
|
102
103
|
|
|
103
104
|
|
|
105
|
+
def _malformed_transfer_candidate(markdown: str, source_id: str) -> bool:
|
|
106
|
+
"""Identify an invalid document that could still require ownership transfer.
|
|
107
|
+
|
|
108
|
+
Existing memory can contain old or adversarial Markdown that is not a valid
|
|
109
|
+
Runtime artifact. Identity reconciliation must not fail because an unrelated
|
|
110
|
+
document is malformed, but it must fail closed when that document explicitly
|
|
111
|
+
names the current actor as a transferable owner.
|
|
112
|
+
"""
|
|
113
|
+
|
|
114
|
+
if not source_id:
|
|
115
|
+
return False
|
|
116
|
+
actor = re.escape(source_id)
|
|
117
|
+
question = re.search(r"(?m)^type:\s*[\"']?question[\"']?\s*$", markdown)
|
|
118
|
+
recipient = re.search(rf"(?m)^to_actor_id:\s*[\"']?{actor}[\"']?\s*$", markdown)
|
|
119
|
+
thread = re.search(r"(?m)^type:\s*[\"']?thread[\"']?\s*$", markdown)
|
|
120
|
+
steward = re.search(rf"(?m)^steward_id:\s*[\"']?{actor}[\"']?\s*$", markdown)
|
|
121
|
+
stewards = re.search(rf"(?m)^steward_ids:\s*.*\b{actor}\b", markdown)
|
|
122
|
+
return bool((question and recipient) or (thread and (steward or stewards)))
|
|
123
|
+
|
|
124
|
+
|
|
104
125
|
def _document(before: str, path: str, pair: Mapping[str, Any], transfer_id: str):
|
|
105
126
|
fields, _ = split_frontmatter(before)
|
|
106
127
|
updates = _changed_fields(fields, pair["source"]["actor_id"], pair["destination"]["actor_id"])
|
|
@@ -148,7 +169,18 @@ def _inventory(memory: Path, runtime, source: ActorContext, destination_id: str)
|
|
|
148
169
|
if len(raw) > MAX_DOCUMENT_BYTES or size > MAX_SCAN_BYTES:
|
|
149
170
|
raise IdentityTransferError("ownership inventory exceeds its byte limit; retain the current identity")
|
|
150
171
|
before = raw.decode("utf-8")
|
|
151
|
-
|
|
172
|
+
try:
|
|
173
|
+
fields, _ = split_frontmatter(before)
|
|
174
|
+
except ValueError as error:
|
|
175
|
+
# A malformed legacy or test document outside the transfer
|
|
176
|
+
# contract must not block identity reconciliation. If it names
|
|
177
|
+
# the current owner, fail closed so ownership is never left
|
|
178
|
+
# half-transferred.
|
|
179
|
+
if _malformed_transfer_candidate(before, source.actor.actor_id):
|
|
180
|
+
raise IdentityTransferError(
|
|
181
|
+
f"ownership inventory cannot parse {relative}: {error}"
|
|
182
|
+
) from error
|
|
183
|
+
continue
|
|
152
184
|
if (fields.get("org") or fields.get("org_id")) not in {None, source.profile.org_id}:
|
|
153
185
|
continue
|
|
154
186
|
if _changed_fields(fields, source.actor.actor_id, destination_id):
|
|
@@ -17,6 +17,7 @@ from __future__ import annotations
|
|
|
17
17
|
import json
|
|
18
18
|
import os
|
|
19
19
|
import re
|
|
20
|
+
import signal
|
|
20
21
|
import subprocess
|
|
21
22
|
import sys
|
|
22
23
|
import time
|
|
@@ -27,6 +28,8 @@ from typing import Any, Mapping
|
|
|
27
28
|
from .adapters.qmd import QMD_VERSION, RERANKING_ENABLED, QmdLocalRetriever
|
|
28
29
|
|
|
29
30
|
SCHEMA_VERSION = "egregore-runtime-upgrade/v1"
|
|
31
|
+
_RENDERER_INSTALL_TIMEOUT_SECONDS = 180
|
|
32
|
+
_RENDERER_TERMINATE_GRACE_SECONDS = 5
|
|
30
33
|
|
|
31
34
|
# Stage keys in preparation order. Labels are the user-facing truth shown by
|
|
32
35
|
# Settings; keep them in plain team language.
|
|
@@ -628,6 +631,54 @@ class UpgradeEngine:
|
|
|
628
631
|
if probe.returncode != 0:
|
|
629
632
|
self._fail(state, "node", "the selected Node runtime failed its version probe")
|
|
630
633
|
return False
|
|
634
|
+
# Explicit Runtime preparation owns package provisioning. Preview and
|
|
635
|
+
# session startup only resolve installed renderers. Older candidates
|
|
636
|
+
# predate this helper and retain their original upgrade contract.
|
|
637
|
+
renderer_installer = (
|
|
638
|
+
Path(state.get("installed_path") or "")
|
|
639
|
+
/ "runtime" / APPLY_TREE / "bin" / "artifact-renderer-install.sh"
|
|
640
|
+
)
|
|
641
|
+
if renderer_installer.is_file():
|
|
642
|
+
environment = {**os.environ, **self.retriever.environment}
|
|
643
|
+
environment["PATH"] = str(Path(node).parent) + os.pathsep + environment.get("PATH", "")
|
|
644
|
+
try:
|
|
645
|
+
with subprocess.Popen(
|
|
646
|
+
("bash", str(renderer_installer), "--root", str(self.repository_root)),
|
|
647
|
+
stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True,
|
|
648
|
+
cwd=self.repository_root, env=environment, start_new_session=True,
|
|
649
|
+
) as renderer:
|
|
650
|
+
try:
|
|
651
|
+
stdout, stderr = renderer.communicate(timeout=_RENDERER_INSTALL_TIMEOUT_SECONDS)
|
|
652
|
+
except subprocess.TimeoutExpired:
|
|
653
|
+
# npm is a child of the installer shell. Stop the entire
|
|
654
|
+
# group so its EXIT cleanup can run without an orphaned
|
|
655
|
+
# package manager still writing into the staging tree.
|
|
656
|
+
try:
|
|
657
|
+
os.killpg(renderer.pid, signal.SIGTERM)
|
|
658
|
+
except ProcessLookupError:
|
|
659
|
+
pass
|
|
660
|
+
try:
|
|
661
|
+
renderer.communicate(timeout=_RENDERER_TERMINATE_GRACE_SECONDS)
|
|
662
|
+
except subprocess.TimeoutExpired:
|
|
663
|
+
pass
|
|
664
|
+
finally:
|
|
665
|
+
# A child may ignore TERM even after Bash exits.
|
|
666
|
+
try:
|
|
667
|
+
os.killpg(renderer.pid, signal.SIGKILL)
|
|
668
|
+
except ProcessLookupError:
|
|
669
|
+
pass
|
|
670
|
+
renderer.communicate()
|
|
671
|
+
raise
|
|
672
|
+
except subprocess.TimeoutExpired:
|
|
673
|
+
self._fail(state, "node", f"artifact renderer provisioning timed out after {_RENDERER_INSTALL_TIMEOUT_SECONDS} seconds; retry preparation")
|
|
674
|
+
return False
|
|
675
|
+
except OSError as exc:
|
|
676
|
+
self._fail(state, "node", f"artifact renderer provisioning failed: {exc}")
|
|
677
|
+
return False
|
|
678
|
+
if renderer.returncode != 0:
|
|
679
|
+
detail = (stderr or stdout).strip()
|
|
680
|
+
self._fail(state, "node", f"artifact renderer provisioning failed: {detail}")
|
|
681
|
+
return False
|
|
631
682
|
self._mark(state, "node", "done", f"{probe.stdout.strip()} at instance-selected path")
|
|
632
683
|
return True
|
|
633
684
|
|
|
@@ -127,6 +127,8 @@
|
|
|
127
127
|
"bin/agent.sh",
|
|
128
128
|
"bin/api-call.sh",
|
|
129
129
|
"bin/artifact-register.sh",
|
|
130
|
+
"bin/artifact-renderer-install.sh",
|
|
131
|
+
"bin/artifact-renderer.sh",
|
|
130
132
|
"bin/artifact-writeback.sh",
|
|
131
133
|
"bin/artifacts.sh",
|
|
132
134
|
"bin/attendant.sh",
|
|
@@ -173,6 +175,8 @@
|
|
|
173
175
|
"bin/issue.sh",
|
|
174
176
|
"bin/knowledge.sh",
|
|
175
177
|
"bin/lib/artifact-id.sh",
|
|
178
|
+
"bin/lib/artifact-renderer/dependencies-lock.json",
|
|
179
|
+
"bin/lib/artifact-renderer/dependencies.json",
|
|
176
180
|
"bin/lib/config.sh",
|
|
177
181
|
"bin/lib/context.sh",
|
|
178
182
|
"bin/lib/dashboard-artifact.sh",
|