create-egregore 0.20.2 → 0.21.0-runtime-mvp.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 +1013 -16
- package/bin/cli.js +11 -0
- package/lib/claude-runtime.js +192 -0
- package/lib/local.js +38 -31
- package/lib/pi-runtime.js +1 -0
- package/lib/prime-runtime.js +1 -0
- package/lib/runtime-identity.js +146 -0
- package/lib/setup.js +116 -17
- package/package.json +10 -6
- package/runtime/claude/.claude/context/commit-format.md +110 -0
- package/runtime/claude/.claude/context/git-language.md +46 -0
- package/runtime/claude/.claude/context/notification-consent.md +66 -0
- package/runtime/claude/.claude/context/pr-format.md +67 -0
- package/runtime/claude/.claude/context/telemetry.md +133 -0
- package/runtime/claude/.claude/hooks/boundary-check.sh +333 -0
- package/runtime/claude/.claude/hooks/branch-guard.sh +231 -0
- package/runtime/claude/.claude/hooks/card-context.sh +38 -0
- package/runtime/claude/.claude/hooks/emissary-detect.sh +53 -0
- package/runtime/claude/.claude/hooks/memory-refresh.sh +67 -0
- package/runtime/claude/.claude/hooks/onboarding-guard.sh +86 -0
- package/runtime/claude/.claude/hooks/retrieval-context.sh +43 -0
- package/runtime/claude/.claude/rules/voice-bedrock.md +73 -0
- package/runtime/claude/.claude/settings.json +131 -0
- package/runtime/claude/.claude/skills/activity/SKILL.md +68 -0
- package/runtime/claude/.claude/skills/announce/SKILL.md +54 -0
- package/runtime/claude/.claude/skills/archive/SKILL.md +71 -0
- package/runtime/claude/.claude/skills/branch/SKILL.md +147 -0
- package/runtime/claude/.claude/skills/checkup/SKILL.md +159 -0
- package/runtime/claude/.claude/skills/commit/SKILL.md +103 -0
- package/runtime/claude/.claude/skills/contribute/SKILL.md +343 -0
- package/runtime/claude/.claude/skills/create-skill/SKILL.md +135 -0
- package/runtime/claude/.claude/skills/dark-mode/SKILL.md +410 -0
- package/runtime/claude/.claude/skills/dashboard/SKILL.md +43 -0
- package/runtime/claude/.claude/skills/deep-reflect/REPORT.md +140 -0
- package/runtime/claude/.claude/skills/deep-reflect/RESEARCH.md +132 -0
- package/runtime/claude/.claude/skills/deep-reflect/ROLES.md +104 -0
- package/runtime/claude/.claude/skills/deep-reflect/SKILL.md +170 -0
- package/runtime/claude/.claude/skills/delete-user/SKILL.md +150 -0
- package/runtime/claude/.claude/skills/emissary/SKILL.md +220 -0
- package/runtime/claude/.claude/skills/handoff/SKILL.md +124 -0
- package/runtime/claude/.claude/skills/harvest/AUDIT.md +546 -0
- package/runtime/claude/.claude/skills/harvest/FORMAT.md +436 -0
- package/runtime/claude/.claude/skills/harvest/PROCESS.md +395 -0
- package/runtime/claude/.claude/skills/harvest/QUESTION_PALETTE.md +76 -0
- package/runtime/claude/.claude/skills/harvest/SKILL.md +100 -0
- package/runtime/claude/.claude/skills/ingest/SKILL.md +112 -0
- package/runtime/claude/.claude/skills/ingest-corpus/SKILL.md +187 -0
- package/runtime/claude/.claude/skills/ingest-notion/SKILL.md +214 -0
- package/runtime/claude/.claude/skills/ingest-user-interview/SKILL.md +65 -0
- package/runtime/claude/.claude/skills/ingest-user-interview/references/analysis-contract.md +125 -0
- package/runtime/claude/.claude/skills/invite/SKILL.md +111 -0
- package/runtime/claude/.claude/skills/issue/SKILL.md +104 -0
- package/runtime/claude/.claude/skills/me/SKILL.md +81 -0
- package/runtime/claude/.claude/skills/meeting/SKILL.md +76 -0
- package/runtime/claude/.claude/skills/meeting/references/analysis-contract.md +102 -0
- package/runtime/claude/.claude/skills/note/SKILL.md +71 -0
- package/runtime/claude/.claude/skills/notion-connect/SKILL.md +124 -0
- package/runtime/claude/.claude/skills/onboarding/SKILL.md +159 -0
- package/runtime/claude/.claude/skills/pr/SKILL.md +85 -0
- package/runtime/claude/.claude/skills/pull/SKILL.md +79 -0
- package/runtime/claude/.claude/skills/push/SKILL.md +47 -0
- package/runtime/claude/.claude/skills/quest/SKILL.md +121 -0
- package/runtime/claude/.claude/skills/reflect/SKILL.md +69 -0
- package/runtime/claude/.claude/skills/review-pr/SKILL.md +276 -0
- package/runtime/claude/.claude/skills/save/SKILL.md +92 -0
- package/runtime/claude/.claude/skills/slack-connect/SKILL.md +148 -0
- package/runtime/claude/.claude/skills/summon/SKILL.md +240 -0
- package/runtime/claude/.claude/skills/sync-repos/SKILL.md +82 -0
- package/runtime/claude/.claude/skills/teams-connect/SKILL.md +216 -0
- package/runtime/claude/.claude/skills/telegram-connect/SKILL.md +110 -0
- package/runtime/claude/.claude/skills/telemetry/SKILL.md +117 -0
- package/runtime/claude/.claude/skills/test/SKILL.md +87 -0
- package/runtime/claude/.claude/skills/the-spiral/SKILL.md +492 -0
- package/runtime/claude/.claude/skills/tui-design/SKILL.md +188 -0
- package/runtime/claude/.claude/skills/tutorial/SKILL.md +100 -0
- package/runtime/claude/.claude/skills/update/SKILL.md +265 -0
- package/runtime/claude/.claude/skills/view/SKILL.md +393 -0
- package/runtime/claude/.claude/skills/view/compose-scaffold.html +221 -0
- package/runtime/claude/.claude/skills/visual-explain/SKILL.md +132 -0
- package/runtime/claude/.claude/skills/wrap/SKILL.md +98 -0
- package/runtime/claude/CLAUDE.md +447 -0
- package/runtime/claude/bin/activity-action.sh +92 -0
- package/runtime/claude/bin/activity-data.sh +17 -0
- package/runtime/claude/bin/agent.sh +783 -0
- package/runtime/claude/bin/artifact-register.sh +164 -0
- package/runtime/claude/bin/artifact-writeback.sh +53 -0
- package/runtime/claude/bin/artifacts.sh +288 -0
- package/runtime/claude/bin/attendant.sh +707 -0
- package/runtime/claude/bin/autosave.sh +112 -0
- package/runtime/claude/bin/boundary.sh +253 -0
- package/runtime/claude/bin/build-sealed-dataroom.mjs +722 -0
- package/runtime/claude/bin/capture-reconcile.sh +69 -0
- package/runtime/claude/bin/capture-run.sh +357 -0
- package/runtime/claude/bin/codex-install-skills.sh +78 -0
- package/runtime/claude/bin/codex-render-spec.mjs +462 -0
- package/runtime/claude/bin/codex-session-start.sh +275 -0
- package/runtime/claude/bin/codex-skill-render.mjs +349 -0
- package/runtime/claude/bin/codex-sync-skills.sh +237 -0
- package/runtime/claude/bin/connect-refresh.sh +33 -0
- package/runtime/claude/bin/contribute-guard.sh +79 -0
- package/runtime/claude/bin/corpus_map.py +806 -0
- package/runtime/claude/bin/corpus_survey.py +304 -0
- package/runtime/claude/bin/dashboard-data.sh +18 -0
- package/runtime/claude/bin/github-auth.sh +121 -0
- package/runtime/claude/bin/graph-batch.sh +86 -0
- package/runtime/claude/bin/graph-op.sh +1106 -0
- package/runtime/claude/bin/graph-projection.sh +54 -0
- package/runtime/claude/bin/graph-wal.sh +242 -0
- package/runtime/claude/bin/graph.sh +267 -0
- package/runtime/claude/bin/handoff-lifecycle-job.sh +146 -0
- package/runtime/claude/bin/handoff-lifecycle.sh +280 -0
- package/runtime/claude/bin/handoff-pr-backfill.sh +86 -0
- package/runtime/claude/bin/handoff-preview.sh +169 -0
- package/runtime/claude/bin/handoff-run.sh +692 -0
- package/runtime/claude/bin/handoff-save-egregore.sh +224 -0
- package/runtime/claude/bin/index-handoff.sh +322 -0
- package/runtime/claude/bin/ingest-graph.sh +86 -0
- package/runtime/claude/bin/ingest-item.sh +10 -0
- package/runtime/claude/bin/ingest-surface.html +495 -0
- package/runtime/claude/bin/ingest.py +1011 -0
- package/runtime/claude/bin/ingest.sh +308 -0
- package/runtime/claude/bin/ingest_graph.py +856 -0
- package/runtime/claude/bin/ingest_surface.py +544 -0
- package/runtime/claude/bin/invite.sh +6 -0
- package/runtime/claude/bin/issue.sh +10 -0
- package/runtime/claude/bin/knowledge.sh +10 -0
- package/runtime/claude/bin/lib/artifact-id.sh +46 -0
- package/runtime/claude/bin/lib/config.sh +136 -0
- package/runtime/claude/bin/lib/context.sh +642 -0
- package/runtime/claude/bin/lib/dashboard-artifact.sh +242 -0
- package/runtime/claude/bin/lib/ensure-develop.sh +183 -0
- package/runtime/claude/bin/lib/git-message.sh +37 -0
- package/runtime/claude/bin/lib/git-sync.sh +494 -0
- package/runtime/claude/bin/lib/greeting.sh +548 -0
- package/runtime/claude/bin/lib/handoff-meta.sh +97 -0
- package/runtime/claude/bin/lib/hash.sh +13 -0
- package/runtime/claude/bin/lib/identity.sh +213 -0
- package/runtime/claude/bin/lib/metrics.sh +374 -0
- package/runtime/claude/bin/lib/noncode.sh +31 -0
- package/runtime/claude/bin/lib/permissions.sh +106 -0
- package/runtime/claude/bin/lib/time.sh +56 -0
- package/runtime/claude/bin/lib/worktree-links.sh +85 -0
- package/runtime/claude/bin/node-run.sh +42 -0
- package/runtime/claude/bin/notification.sh +6 -0
- package/runtime/claude/bin/notify.sh +636 -0
- package/runtime/claude/bin/observe-context.sh +14 -0
- package/runtime/claude/bin/onboarding.sh +6 -0
- package/runtime/claude/bin/person.py +634 -0
- package/runtime/claude/bin/person.sh +481 -0
- package/runtime/claude/bin/pi-render-spec.mjs +140 -0
- package/runtime/claude/bin/post-update.sh +37 -0
- package/runtime/claude/bin/prime-render-spec.mjs +147 -0
- package/runtime/claude/bin/publish-artifact.sh +324 -0
- package/runtime/claude/bin/publish-references.sh +144 -0
- package/runtime/claude/bin/quest.sh +9 -0
- package/runtime/claude/bin/question.sh +8 -0
- package/runtime/claude/bin/repo-state.sh +96 -0
- package/runtime/claude/bin/research-ingest.sh +7 -0
- package/runtime/claude/bin/restore-owned-skills.sh +67 -0
- package/runtime/claude/bin/retrieval_eval.py +385 -0
- package/runtime/claude/bin/runtime-identity.sh +70 -0
- package/runtime/claude/bin/runtime-upgrade.sh +43 -0
- package/runtime/claude/bin/scroll.sh +9 -0
- package/runtime/claude/bin/search.sh +318 -0
- package/runtime/claude/bin/session-autosave.sh +220 -0
- package/runtime/claude/bin/session-log.sh +199 -0
- package/runtime/claude/bin/session-start.sh +696 -0
- package/runtime/claude/bin/settings.sh +532 -0
- package/runtime/claude/bin/startup-check.sh +136 -0
- package/runtime/claude/bin/statusline.sh +41 -0
- package/runtime/claude/bin/telemetry.sh +666 -0
- package/runtime/claude/bin/test-changes.sh +344 -0
- package/runtime/claude/bin/thread.sh +9 -0
- package/runtime/claude/bin/todo.sh +9 -0
- package/runtime/claude/bin/view-render.sh +126 -0
- package/runtime/claude/bin/worktree-create.sh +145 -0
- package/runtime/claude/bin/worktree-remove.sh +50 -0
- package/runtime/claude/bin/worktree.sh +198 -0
- package/runtime/claude/egregore_runtime/__init__.py +228 -0
- package/runtime/claude/egregore_runtime/adapters/__init__.py +5 -0
- package/runtime/claude/egregore_runtime/adapters/invitation.py +237 -0
- package/runtime/claude/egregore_runtime/adapters/notification.py +59 -0
- package/runtime/claude/egregore_runtime/adapters/qmd.py +1701 -0
- package/runtime/claude/egregore_runtime/adapters/qmd_cli.py +210 -0
- package/runtime/claude/egregore_runtime/adapters/qmd_embed_worker.py +59 -0
- package/runtime/claude/egregore_runtime/admin_gate.py +102 -0
- package/runtime/claude/egregore_runtime/artifacts.py +523 -0
- package/runtime/claude/egregore_runtime/contracts.py +499 -0
- package/runtime/claude/egregore_runtime/entitlements.py +85 -0
- package/runtime/claude/egregore_runtime/errors.py +10 -0
- package/runtime/claude/egregore_runtime/graph.py +356 -0
- package/runtime/claude/egregore_runtime/handoff_lookup.py +196 -0
- package/runtime/claude/egregore_runtime/harness_cli.py +1221 -0
- package/runtime/claude/egregore_runtime/identity.py +734 -0
- package/runtime/claude/egregore_runtime/identity_cli.py +91 -0
- package/runtime/claude/egregore_runtime/ingest.py +575 -0
- package/runtime/claude/egregore_runtime/ingest_cli.py +254 -0
- package/runtime/claude/egregore_runtime/ingest_index_cli.py +147 -0
- package/runtime/claude/egregore_runtime/invitation_cli.py +51 -0
- package/runtime/claude/egregore_runtime/invitations.py +116 -0
- package/runtime/claude/egregore_runtime/issue_cli.py +305 -0
- package/runtime/claude/egregore_runtime/issues.py +359 -0
- package/runtime/claude/egregore_runtime/knowledge.py +376 -0
- package/runtime/claude/egregore_runtime/knowledge_cli.py +173 -0
- package/runtime/claude/egregore_runtime/lifecycle.py +888 -0
- package/runtime/claude/egregore_runtime/lifecycle_cli.py +269 -0
- package/runtime/claude/egregore_runtime/notification_cli.py +125 -0
- package/runtime/claude/egregore_runtime/notifications.py +230 -0
- package/runtime/claude/egregore_runtime/observe.py +342 -0
- package/runtime/claude/egregore_runtime/onboarding.py +290 -0
- package/runtime/claude/egregore_runtime/onboarding_cli.py +110 -0
- package/runtime/claude/egregore_runtime/policy.py +144 -0
- package/runtime/claude/egregore_runtime/profile.py +193 -0
- package/runtime/claude/egregore_runtime/quest_cli.py +216 -0
- package/runtime/claude/egregore_runtime/question_cli.py +180 -0
- package/runtime/claude/egregore_runtime/questions.py +304 -0
- package/runtime/claude/egregore_runtime/quests.py +419 -0
- package/runtime/claude/egregore_runtime/readiness.py +379 -0
- package/runtime/claude/egregore_runtime/research_ingest.py +256 -0
- package/runtime/claude/egregore_runtime/research_ingest_cli.py +44 -0
- package/runtime/claude/egregore_runtime/runtime.py +464 -0
- package/runtime/claude/egregore_runtime/scroll_cli.py +185 -0
- package/runtime/claude/egregore_runtime/scrolls.py +726 -0
- package/runtime/claude/egregore_runtime/status.py +412 -0
- package/runtime/claude/egregore_runtime/status_cli.py +174 -0
- package/runtime/claude/egregore_runtime/sync.py +218 -0
- package/runtime/claude/egregore_runtime/teamsync.py +139 -0
- package/runtime/claude/egregore_runtime/telemetry.py +640 -0
- package/runtime/claude/egregore_runtime/thread_cli.py +173 -0
- package/runtime/claude/egregore_runtime/threads.py +517 -0
- package/runtime/claude/egregore_runtime/todo_cli.py +142 -0
- package/runtime/claude/egregore_runtime/todos.py +244 -0
- package/runtime/claude/egregore_runtime/upgrade.py +770 -0
- package/runtime/claude/egregore_runtime/upgrade_worker.py +53 -0
- package/runtime/claude/egregore_runtime/writeback.py +391 -0
- package/runtime/claude/egregore_runtime/writeback_cli.py +114 -0
- package/runtime/claude/manifest.json +284 -0
- package/runtime/codex/.codex/hooks/search-hint.js +21 -52
- package/runtime/codex/.codex/hooks.json +3 -3
- package/runtime/codex/.codex/skills/activity/SKILL.md +23 -66
- package/runtime/codex/.codex/skills/announce/SKILL.md +27 -50
- package/runtime/codex/.codex/skills/archive/SKILL.md +21 -36
- package/runtime/codex/.codex/skills/checkup/SKILL.md +77 -36
- package/runtime/codex/.codex/skills/dark-mode/SKILL.md +1 -1
- package/runtime/codex/.codex/skills/dashboard/SKILL.md +17 -47
- package/runtime/codex/.codex/skills/handoff/SKILL.md +84 -133
- package/runtime/codex/.codex/skills/harvest/SKILL.md +32 -117
- package/runtime/codex/.codex/skills/ingest/SKILL.md +47 -25
- package/runtime/codex/.codex/skills/ingest-user-interview/SKILL.md +18 -36
- package/runtime/codex/.codex/skills/ingest-user-interview/references/analysis-contract.md +42 -0
- package/runtime/codex/.codex/skills/invite/SKILL.md +21 -35
- package/runtime/codex/.codex/skills/issue/SKILL.md +60 -41
- package/runtime/codex/.codex/skills/me/SKILL.md +1 -1
- package/runtime/codex/.codex/skills/meeting/SKILL.md +16 -36
- package/runtime/codex/.codex/skills/meeting/references/analysis-contract.md +48 -0
- package/runtime/codex/.codex/skills/note/SKILL.md +30 -25
- package/runtime/codex/.codex/skills/onboarding/SKILL.md +36 -41
- package/runtime/codex/.codex/skills/pull/SKILL.md +1 -1
- package/runtime/codex/.codex/skills/quest/SKILL.md +27 -66
- package/runtime/codex/.codex/skills/reflect/SKILL.md +22 -36
- package/runtime/codex/.codex/skills/save/SKILL.md +2 -2
- package/runtime/codex/.codex/skills/telemetry/SKILL.md +1 -1
- package/runtime/codex/.codex/skills/test/SKILL.md +1 -1
- package/runtime/codex/.codex/skills/tutorial/SKILL.md +40 -41
- package/runtime/codex/.codex/skills/view/SKILL.md +115 -111
- package/runtime/codex/.codex/skills/wrap/SKILL.md +45 -41
- package/runtime/codex/.codex/spec-manifest.json +9 -9
- package/runtime/codex/AGENTS.md +62 -58
- package/runtime/codex/bin/activity-action.sh +92 -0
- package/runtime/codex/bin/activity-data.sh +12 -233
- package/runtime/codex/bin/agent.sh +84 -100
- package/runtime/codex/bin/artifact-register.sh +164 -0
- package/runtime/codex/bin/artifact-writeback.sh +53 -0
- package/runtime/codex/bin/artifacts.sh +288 -0
- package/runtime/codex/bin/build-sealed-dataroom.mjs +722 -0
- package/runtime/codex/bin/capture-run.sh +18 -2
- package/runtime/codex/bin/codex-render-spec.mjs +41 -16
- package/runtime/codex/bin/codex-session-start.sh +14 -4
- package/runtime/codex/bin/codex-skill-render.mjs +9 -7
- package/runtime/codex/bin/corpus_map.py +806 -0
- package/runtime/codex/bin/corpus_survey.py +304 -0
- package/runtime/codex/bin/dashboard-data.sh +11 -171
- package/runtime/codex/bin/github-auth.sh +121 -0
- package/runtime/codex/bin/graph-batch.sh +7 -0
- package/runtime/codex/bin/graph-op.sh +4 -0
- package/runtime/codex/bin/graph-projection.sh +54 -0
- package/runtime/codex/bin/graph-wal.sh +13 -0
- package/runtime/codex/bin/graph.sh +44 -0
- package/runtime/codex/bin/handoff-lifecycle-job.sh +146 -0
- package/runtime/codex/bin/handoff-lifecycle.sh +280 -0
- package/runtime/codex/bin/handoff-preview.sh +169 -0
- package/runtime/codex/bin/handoff-run.sh +42 -26
- package/runtime/codex/bin/ingest-graph.sh +6 -0
- package/runtime/codex/bin/ingest-item.sh +10 -0
- package/runtime/codex/bin/ingest.sh +59 -30
- package/runtime/codex/bin/invite.sh +6 -0
- package/runtime/codex/bin/issue.sh +10 -0
- package/runtime/codex/bin/knowledge.sh +10 -0
- package/runtime/codex/bin/lib/config.sh +20 -0
- package/runtime/codex/bin/lib/context.sh +46 -25
- package/runtime/codex/bin/lib/git-sync.sh +70 -6
- package/runtime/codex/bin/lib/greeting.sh +34 -5
- package/runtime/codex/bin/lib/handoff-meta.sh +97 -0
- package/runtime/codex/bin/lib/worktree-links.sh +6 -0
- package/runtime/codex/bin/node-run.sh +42 -0
- package/runtime/codex/bin/notification.sh +6 -0
- package/runtime/codex/bin/observe-context.sh +14 -0
- package/runtime/codex/bin/onboarding.sh +6 -0
- package/runtime/codex/bin/person.py +4 -0
- package/runtime/codex/bin/person.sh +43 -10
- package/runtime/codex/bin/pi-render-spec.mjs +140 -0
- package/runtime/codex/bin/post-update.sh +37 -0
- package/runtime/codex/bin/prime-render-spec.mjs +147 -0
- package/runtime/codex/bin/publish-artifact.sh +55 -2
- package/runtime/codex/bin/quest.sh +9 -0
- package/runtime/codex/bin/question.sh +8 -0
- package/runtime/codex/bin/research-ingest.sh +7 -0
- package/runtime/codex/bin/restore-owned-skills.sh +67 -0
- package/runtime/codex/bin/retrieval_eval.py +385 -0
- package/runtime/codex/bin/runtime-identity.sh +70 -0
- package/runtime/codex/bin/runtime-upgrade.sh +43 -0
- package/runtime/codex/bin/scroll.sh +9 -0
- package/runtime/codex/bin/search.sh +231 -195
- package/runtime/codex/bin/settings.sh +174 -5
- package/runtime/codex/bin/startup-check.sh +136 -0
- package/runtime/codex/bin/telemetry.sh +522 -247
- package/runtime/codex/bin/test-changes.sh +344 -0
- package/runtime/codex/bin/thread.sh +9 -0
- package/runtime/codex/bin/todo.sh +9 -0
- package/runtime/codex/bin/view-render.sh +126 -0
- package/runtime/codex/bin/worktree-create.sh +19 -5
- package/runtime/codex/egregore_runtime/__init__.py +228 -0
- package/runtime/codex/egregore_runtime/adapters/__init__.py +5 -0
- package/runtime/codex/egregore_runtime/adapters/invitation.py +237 -0
- package/runtime/codex/egregore_runtime/adapters/notification.py +59 -0
- package/runtime/codex/egregore_runtime/adapters/qmd.py +1701 -0
- package/runtime/codex/egregore_runtime/adapters/qmd_cli.py +210 -0
- package/runtime/codex/egregore_runtime/adapters/qmd_embed_worker.py +59 -0
- package/runtime/codex/egregore_runtime/admin_gate.py +102 -0
- package/runtime/codex/egregore_runtime/artifacts.py +523 -0
- package/runtime/codex/egregore_runtime/contracts.py +499 -0
- package/runtime/codex/egregore_runtime/entitlements.py +85 -0
- package/runtime/codex/egregore_runtime/errors.py +10 -0
- package/runtime/codex/egregore_runtime/graph.py +356 -0
- package/runtime/codex/egregore_runtime/handoff_lookup.py +196 -0
- package/runtime/codex/egregore_runtime/harness_cli.py +1221 -0
- package/runtime/codex/egregore_runtime/identity.py +734 -0
- package/runtime/codex/egregore_runtime/identity_cli.py +91 -0
- package/runtime/codex/egregore_runtime/ingest.py +575 -0
- package/runtime/codex/egregore_runtime/ingest_cli.py +254 -0
- package/runtime/codex/egregore_runtime/ingest_index_cli.py +147 -0
- package/runtime/codex/egregore_runtime/invitation_cli.py +51 -0
- package/runtime/codex/egregore_runtime/invitations.py +116 -0
- package/runtime/codex/egregore_runtime/issue_cli.py +305 -0
- package/runtime/codex/egregore_runtime/issues.py +359 -0
- package/runtime/codex/egregore_runtime/knowledge.py +376 -0
- package/runtime/codex/egregore_runtime/knowledge_cli.py +173 -0
- package/runtime/codex/egregore_runtime/lifecycle.py +888 -0
- package/runtime/codex/egregore_runtime/lifecycle_cli.py +269 -0
- package/runtime/codex/egregore_runtime/notification_cli.py +125 -0
- package/runtime/codex/egregore_runtime/notifications.py +230 -0
- package/runtime/codex/egregore_runtime/observe.py +342 -0
- package/runtime/codex/egregore_runtime/onboarding.py +290 -0
- package/runtime/codex/egregore_runtime/onboarding_cli.py +110 -0
- package/runtime/codex/egregore_runtime/policy.py +144 -0
- package/runtime/codex/egregore_runtime/profile.py +193 -0
- package/runtime/codex/egregore_runtime/quest_cli.py +216 -0
- package/runtime/codex/egregore_runtime/question_cli.py +180 -0
- package/runtime/codex/egregore_runtime/questions.py +304 -0
- package/runtime/codex/egregore_runtime/quests.py +419 -0
- package/runtime/codex/egregore_runtime/readiness.py +379 -0
- package/runtime/codex/egregore_runtime/research_ingest.py +256 -0
- package/runtime/codex/egregore_runtime/research_ingest_cli.py +44 -0
- package/runtime/codex/egregore_runtime/runtime.py +464 -0
- package/runtime/codex/egregore_runtime/scroll_cli.py +185 -0
- package/runtime/codex/egregore_runtime/scrolls.py +726 -0
- package/runtime/codex/egregore_runtime/status.py +412 -0
- package/runtime/codex/egregore_runtime/status_cli.py +174 -0
- package/runtime/codex/egregore_runtime/sync.py +218 -0
- package/runtime/codex/egregore_runtime/teamsync.py +139 -0
- package/runtime/codex/egregore_runtime/telemetry.py +640 -0
- package/runtime/codex/egregore_runtime/thread_cli.py +173 -0
- package/runtime/codex/egregore_runtime/threads.py +517 -0
- package/runtime/codex/egregore_runtime/todo_cli.py +142 -0
- package/runtime/codex/egregore_runtime/todos.py +244 -0
- package/runtime/codex/egregore_runtime/upgrade.py +770 -0
- package/runtime/codex/egregore_runtime/upgrade_worker.py +53 -0
- package/runtime/codex/egregore_runtime/writeback.py +391 -0
- package/runtime/codex/egregore_runtime/writeback_cli.py +114 -0
- package/runtime/codex/manifest.json +98 -1
- package/runtime/pi/.codex/hooks/search-hint.js +21 -52
- package/runtime/pi/.codex/hooks.json +3 -3
- package/runtime/pi/.codex/skills/activity/SKILL.md +23 -66
- package/runtime/pi/.codex/skills/announce/SKILL.md +27 -50
- package/runtime/pi/.codex/skills/archive/SKILL.md +21 -36
- package/runtime/pi/.codex/skills/checkup/SKILL.md +77 -36
- package/runtime/pi/.codex/skills/dark-mode/SKILL.md +1 -1
- package/runtime/pi/.codex/skills/dashboard/SKILL.md +17 -47
- package/runtime/pi/.codex/skills/handoff/SKILL.md +84 -133
- package/runtime/pi/.codex/skills/harvest/SKILL.md +32 -117
- package/runtime/pi/.codex/skills/ingest/SKILL.md +47 -25
- package/runtime/pi/.codex/skills/ingest-user-interview/SKILL.md +18 -36
- package/runtime/pi/.codex/skills/ingest-user-interview/references/analysis-contract.md +42 -0
- package/runtime/pi/.codex/skills/invite/SKILL.md +21 -35
- package/runtime/pi/.codex/skills/issue/SKILL.md +60 -41
- package/runtime/pi/.codex/skills/me/SKILL.md +1 -1
- package/runtime/pi/.codex/skills/meeting/SKILL.md +16 -36
- package/runtime/pi/.codex/skills/meeting/references/analysis-contract.md +48 -0
- package/runtime/pi/.codex/skills/note/SKILL.md +30 -25
- package/runtime/pi/.codex/skills/onboarding/SKILL.md +36 -41
- package/runtime/pi/.codex/skills/pull/SKILL.md +1 -1
- package/runtime/pi/.codex/skills/quest/SKILL.md +27 -66
- package/runtime/pi/.codex/skills/reflect/SKILL.md +22 -36
- package/runtime/pi/.codex/skills/save/SKILL.md +2 -2
- package/runtime/pi/.codex/skills/telemetry/SKILL.md +1 -1
- package/runtime/pi/.codex/skills/test/SKILL.md +1 -1
- package/runtime/pi/.codex/skills/tutorial/SKILL.md +40 -41
- package/runtime/pi/.codex/skills/view/SKILL.md +115 -111
- package/runtime/pi/.codex/skills/wrap/SKILL.md +45 -41
- package/runtime/pi/.codex/spec-manifest.json +9 -9
- package/runtime/pi/.pi/APPEND_SYSTEM.md +57 -48
- package/runtime/pi/.pi/extensions/egregore.ts +7 -0
- package/runtime/pi/.pi/spec-manifest.json +2 -2
- package/runtime/pi/AGENTS.md +62 -58
- package/runtime/pi/bin/activity-action.sh +92 -0
- package/runtime/pi/bin/activity-data.sh +12 -233
- package/runtime/pi/bin/agent.sh +84 -100
- package/runtime/pi/bin/artifact-register.sh +164 -0
- package/runtime/pi/bin/artifact-writeback.sh +53 -0
- package/runtime/pi/bin/artifacts.sh +288 -0
- package/runtime/pi/bin/build-sealed-dataroom.mjs +722 -0
- package/runtime/pi/bin/capture-run.sh +18 -2
- package/runtime/pi/bin/codex-render-spec.mjs +41 -16
- package/runtime/pi/bin/codex-session-start.sh +14 -4
- package/runtime/pi/bin/codex-skill-render.mjs +9 -7
- package/runtime/pi/bin/corpus_map.py +806 -0
- package/runtime/pi/bin/corpus_survey.py +304 -0
- package/runtime/pi/bin/dashboard-data.sh +11 -171
- package/runtime/pi/bin/github-auth.sh +121 -0
- package/runtime/pi/bin/graph-batch.sh +7 -0
- package/runtime/pi/bin/graph-op.sh +4 -0
- package/runtime/pi/bin/graph-projection.sh +54 -0
- package/runtime/pi/bin/graph-wal.sh +13 -0
- package/runtime/pi/bin/graph.sh +44 -0
- package/runtime/pi/bin/handoff-lifecycle-job.sh +146 -0
- package/runtime/pi/bin/handoff-lifecycle.sh +280 -0
- package/runtime/pi/bin/handoff-preview.sh +169 -0
- package/runtime/pi/bin/handoff-run.sh +42 -26
- package/runtime/pi/bin/ingest-graph.sh +6 -0
- package/runtime/pi/bin/ingest-item.sh +10 -0
- package/runtime/pi/bin/ingest.sh +59 -30
- package/runtime/pi/bin/invite.sh +6 -0
- package/runtime/pi/bin/issue.sh +10 -0
- package/runtime/pi/bin/knowledge.sh +10 -0
- package/runtime/pi/bin/lib/config.sh +20 -0
- package/runtime/pi/bin/lib/context.sh +46 -25
- package/runtime/pi/bin/lib/git-sync.sh +70 -6
- package/runtime/pi/bin/lib/greeting.sh +34 -5
- package/runtime/pi/bin/lib/handoff-meta.sh +97 -0
- package/runtime/pi/bin/lib/worktree-links.sh +6 -0
- package/runtime/pi/bin/node-run.sh +42 -0
- package/runtime/pi/bin/notification.sh +6 -0
- package/runtime/pi/bin/observe-context.sh +14 -0
- package/runtime/pi/bin/onboarding.sh +6 -0
- package/runtime/pi/bin/person.py +4 -0
- package/runtime/pi/bin/person.sh +43 -10
- package/runtime/pi/bin/pi-observe-context.mjs +93 -0
- package/runtime/pi/bin/pi-product-workflows.mjs +1 -1
- package/runtime/pi/bin/pi-render-spec.mjs +1 -1
- package/runtime/pi/bin/post-update.sh +37 -0
- package/runtime/pi/bin/prime-render-spec.mjs +147 -0
- package/runtime/pi/bin/publish-artifact.sh +55 -2
- package/runtime/pi/bin/quest.sh +9 -0
- package/runtime/pi/bin/question.sh +8 -0
- package/runtime/pi/bin/research-ingest.sh +7 -0
- package/runtime/pi/bin/restore-owned-skills.sh +67 -0
- package/runtime/pi/bin/retrieval_eval.py +385 -0
- package/runtime/pi/bin/runtime-identity.sh +70 -0
- package/runtime/pi/bin/runtime-upgrade.sh +43 -0
- package/runtime/pi/bin/scroll.sh +9 -0
- package/runtime/pi/bin/search.sh +231 -195
- package/runtime/pi/bin/settings.sh +174 -5
- package/runtime/pi/bin/startup-check.sh +136 -0
- package/runtime/pi/bin/telemetry.sh +522 -247
- package/runtime/pi/bin/test-changes.sh +344 -0
- package/runtime/pi/bin/thread.sh +9 -0
- package/runtime/pi/bin/todo.sh +9 -0
- package/runtime/pi/bin/view-render.sh +126 -0
- package/runtime/pi/bin/worktree-create.sh +19 -5
- package/runtime/pi/egregore_runtime/__init__.py +228 -0
- package/runtime/pi/egregore_runtime/adapters/__init__.py +5 -0
- package/runtime/pi/egregore_runtime/adapters/invitation.py +237 -0
- package/runtime/pi/egregore_runtime/adapters/notification.py +59 -0
- package/runtime/pi/egregore_runtime/adapters/qmd.py +1701 -0
- package/runtime/pi/egregore_runtime/adapters/qmd_cli.py +210 -0
- package/runtime/pi/egregore_runtime/adapters/qmd_embed_worker.py +59 -0
- package/runtime/pi/egregore_runtime/admin_gate.py +102 -0
- package/runtime/pi/egregore_runtime/artifacts.py +523 -0
- package/runtime/pi/egregore_runtime/contracts.py +499 -0
- package/runtime/pi/egregore_runtime/entitlements.py +85 -0
- package/runtime/pi/egregore_runtime/errors.py +10 -0
- package/runtime/pi/egregore_runtime/graph.py +356 -0
- package/runtime/pi/egregore_runtime/handoff_lookup.py +196 -0
- package/runtime/pi/egregore_runtime/harness_cli.py +1221 -0
- package/runtime/pi/egregore_runtime/identity.py +734 -0
- package/runtime/pi/egregore_runtime/identity_cli.py +91 -0
- package/runtime/pi/egregore_runtime/ingest.py +575 -0
- package/runtime/pi/egregore_runtime/ingest_cli.py +254 -0
- package/runtime/pi/egregore_runtime/ingest_index_cli.py +147 -0
- package/runtime/pi/egregore_runtime/invitation_cli.py +51 -0
- package/runtime/pi/egregore_runtime/invitations.py +116 -0
- package/runtime/pi/egregore_runtime/issue_cli.py +305 -0
- package/runtime/pi/egregore_runtime/issues.py +359 -0
- package/runtime/pi/egregore_runtime/knowledge.py +376 -0
- package/runtime/pi/egregore_runtime/knowledge_cli.py +173 -0
- package/runtime/pi/egregore_runtime/lifecycle.py +888 -0
- package/runtime/pi/egregore_runtime/lifecycle_cli.py +269 -0
- package/runtime/pi/egregore_runtime/notification_cli.py +125 -0
- package/runtime/pi/egregore_runtime/notifications.py +230 -0
- package/runtime/pi/egregore_runtime/observe.py +342 -0
- package/runtime/pi/egregore_runtime/onboarding.py +290 -0
- package/runtime/pi/egregore_runtime/onboarding_cli.py +110 -0
- package/runtime/pi/egregore_runtime/policy.py +144 -0
- package/runtime/pi/egregore_runtime/profile.py +193 -0
- package/runtime/pi/egregore_runtime/quest_cli.py +216 -0
- package/runtime/pi/egregore_runtime/question_cli.py +180 -0
- package/runtime/pi/egregore_runtime/questions.py +304 -0
- package/runtime/pi/egregore_runtime/quests.py +419 -0
- package/runtime/pi/egregore_runtime/readiness.py +379 -0
- package/runtime/pi/egregore_runtime/research_ingest.py +256 -0
- package/runtime/pi/egregore_runtime/research_ingest_cli.py +44 -0
- package/runtime/pi/egregore_runtime/runtime.py +464 -0
- package/runtime/pi/egregore_runtime/scroll_cli.py +185 -0
- package/runtime/pi/egregore_runtime/scrolls.py +726 -0
- package/runtime/pi/egregore_runtime/status.py +412 -0
- package/runtime/pi/egregore_runtime/status_cli.py +174 -0
- package/runtime/pi/egregore_runtime/sync.py +218 -0
- package/runtime/pi/egregore_runtime/teamsync.py +139 -0
- package/runtime/pi/egregore_runtime/telemetry.py +640 -0
- package/runtime/pi/egregore_runtime/thread_cli.py +173 -0
- package/runtime/pi/egregore_runtime/threads.py +517 -0
- package/runtime/pi/egregore_runtime/todo_cli.py +142 -0
- package/runtime/pi/egregore_runtime/todos.py +244 -0
- package/runtime/pi/egregore_runtime/upgrade.py +770 -0
- package/runtime/pi/egregore_runtime/upgrade_worker.py +53 -0
- package/runtime/pi/egregore_runtime/writeback.py +391 -0
- package/runtime/pi/egregore_runtime/writeback_cli.py +114 -0
- package/runtime/pi/manifest.json +98 -1
- package/runtime/prime/.codex/hooks/search-hint.js +21 -52
- package/runtime/prime/.codex/hooks.json +3 -3
- package/runtime/prime/.codex/skills/activity/SKILL.md +23 -66
- package/runtime/prime/.codex/skills/announce/SKILL.md +27 -50
- package/runtime/prime/.codex/skills/archive/SKILL.md +21 -36
- package/runtime/prime/.codex/skills/checkup/SKILL.md +77 -36
- package/runtime/prime/.codex/skills/dark-mode/SKILL.md +1 -1
- package/runtime/prime/.codex/skills/dashboard/SKILL.md +17 -47
- package/runtime/prime/.codex/skills/handoff/SKILL.md +84 -133
- package/runtime/prime/.codex/skills/harvest/SKILL.md +32 -117
- package/runtime/prime/.codex/skills/ingest/SKILL.md +47 -25
- package/runtime/prime/.codex/skills/ingest-user-interview/SKILL.md +18 -36
- package/runtime/prime/.codex/skills/ingest-user-interview/references/analysis-contract.md +42 -0
- package/runtime/prime/.codex/skills/invite/SKILL.md +21 -35
- package/runtime/prime/.codex/skills/issue/SKILL.md +60 -41
- package/runtime/prime/.codex/skills/me/SKILL.md +1 -1
- package/runtime/prime/.codex/skills/meeting/SKILL.md +16 -36
- package/runtime/prime/.codex/skills/meeting/references/analysis-contract.md +48 -0
- package/runtime/prime/.codex/skills/note/SKILL.md +30 -25
- package/runtime/prime/.codex/skills/onboarding/SKILL.md +36 -41
- package/runtime/prime/.codex/skills/pull/SKILL.md +1 -1
- package/runtime/prime/.codex/skills/quest/SKILL.md +27 -66
- package/runtime/prime/.codex/skills/reflect/SKILL.md +22 -36
- package/runtime/prime/.codex/skills/save/SKILL.md +2 -2
- package/runtime/prime/.codex/skills/telemetry/SKILL.md +1 -1
- package/runtime/prime/.codex/skills/test/SKILL.md +1 -1
- package/runtime/prime/.codex/skills/tutorial/SKILL.md +40 -41
- package/runtime/prime/.codex/skills/view/SKILL.md +115 -111
- package/runtime/prime/.codex/skills/wrap/SKILL.md +45 -41
- package/runtime/prime/.codex/spec-manifest.json +9 -9
- package/runtime/prime/.prime/agent/APPEND_SYSTEM.md +57 -48
- package/runtime/prime/.prime/agent/extensions/egregore.ts +7 -0
- package/runtime/prime/.prime/agent/spec-manifest.json +2 -2
- package/runtime/prime/AGENTS.md +62 -58
- package/runtime/prime/bin/activity-action.sh +92 -0
- package/runtime/prime/bin/activity-data.sh +12 -233
- package/runtime/prime/bin/agent.sh +84 -100
- package/runtime/prime/bin/artifact-register.sh +164 -0
- package/runtime/prime/bin/artifact-writeback.sh +53 -0
- package/runtime/prime/bin/artifacts.sh +288 -0
- package/runtime/prime/bin/build-sealed-dataroom.mjs +722 -0
- package/runtime/prime/bin/capture-run.sh +18 -2
- package/runtime/prime/bin/codex-render-spec.mjs +41 -16
- package/runtime/prime/bin/codex-session-start.sh +14 -4
- package/runtime/prime/bin/codex-skill-render.mjs +9 -7
- package/runtime/prime/bin/corpus_map.py +806 -0
- package/runtime/prime/bin/corpus_survey.py +304 -0
- package/runtime/prime/bin/dashboard-data.sh +11 -171
- package/runtime/prime/bin/github-auth.sh +121 -0
- package/runtime/prime/bin/graph-batch.sh +7 -0
- package/runtime/prime/bin/graph-op.sh +4 -0
- package/runtime/prime/bin/graph-projection.sh +54 -0
- package/runtime/prime/bin/graph-wal.sh +13 -0
- package/runtime/prime/bin/graph.sh +44 -0
- package/runtime/prime/bin/handoff-lifecycle-job.sh +146 -0
- package/runtime/prime/bin/handoff-lifecycle.sh +280 -0
- package/runtime/prime/bin/handoff-preview.sh +169 -0
- package/runtime/prime/bin/handoff-run.sh +42 -26
- package/runtime/prime/bin/ingest-graph.sh +6 -0
- package/runtime/prime/bin/ingest-item.sh +10 -0
- package/runtime/prime/bin/ingest.sh +59 -30
- package/runtime/prime/bin/invite.sh +6 -0
- package/runtime/prime/bin/issue.sh +10 -0
- package/runtime/prime/bin/knowledge.sh +10 -0
- package/runtime/prime/bin/lib/config.sh +20 -0
- package/runtime/prime/bin/lib/context.sh +46 -25
- package/runtime/prime/bin/lib/git-sync.sh +70 -6
- package/runtime/prime/bin/lib/greeting.sh +34 -5
- package/runtime/prime/bin/lib/handoff-meta.sh +97 -0
- package/runtime/prime/bin/lib/worktree-links.sh +6 -0
- package/runtime/prime/bin/node-run.sh +42 -0
- package/runtime/prime/bin/notification.sh +6 -0
- package/runtime/prime/bin/observe-context.sh +14 -0
- package/runtime/prime/bin/onboarding.sh +6 -0
- package/runtime/prime/bin/person.py +4 -0
- package/runtime/prime/bin/person.sh +43 -10
- package/runtime/prime/bin/pi-observe-context.mjs +93 -0
- package/runtime/prime/bin/pi-product-workflows.mjs +1 -1
- package/runtime/prime/bin/pi-render-spec.mjs +140 -0
- package/runtime/prime/bin/post-update.sh +37 -0
- package/runtime/prime/bin/prime-render-spec.mjs +1 -1
- package/runtime/prime/bin/publish-artifact.sh +55 -2
- package/runtime/prime/bin/quest.sh +9 -0
- package/runtime/prime/bin/question.sh +8 -0
- package/runtime/prime/bin/research-ingest.sh +7 -0
- package/runtime/prime/bin/restore-owned-skills.sh +67 -0
- package/runtime/prime/bin/retrieval_eval.py +385 -0
- package/runtime/prime/bin/runtime-identity.sh +70 -0
- package/runtime/prime/bin/runtime-upgrade.sh +43 -0
- package/runtime/prime/bin/scroll.sh +9 -0
- package/runtime/prime/bin/search.sh +231 -195
- package/runtime/prime/bin/settings.sh +174 -5
- package/runtime/prime/bin/startup-check.sh +136 -0
- package/runtime/prime/bin/telemetry.sh +522 -247
- package/runtime/prime/bin/test-changes.sh +344 -0
- package/runtime/prime/bin/thread.sh +9 -0
- package/runtime/prime/bin/todo.sh +9 -0
- package/runtime/prime/bin/view-render.sh +126 -0
- package/runtime/prime/bin/worktree-create.sh +19 -5
- package/runtime/prime/egregore_runtime/__init__.py +228 -0
- package/runtime/prime/egregore_runtime/adapters/__init__.py +5 -0
- package/runtime/prime/egregore_runtime/adapters/invitation.py +237 -0
- package/runtime/prime/egregore_runtime/adapters/notification.py +59 -0
- package/runtime/prime/egregore_runtime/adapters/qmd.py +1701 -0
- package/runtime/prime/egregore_runtime/adapters/qmd_cli.py +210 -0
- package/runtime/prime/egregore_runtime/adapters/qmd_embed_worker.py +59 -0
- package/runtime/prime/egregore_runtime/admin_gate.py +102 -0
- package/runtime/prime/egregore_runtime/artifacts.py +523 -0
- package/runtime/prime/egregore_runtime/contracts.py +499 -0
- package/runtime/prime/egregore_runtime/entitlements.py +85 -0
- package/runtime/prime/egregore_runtime/errors.py +10 -0
- package/runtime/prime/egregore_runtime/graph.py +356 -0
- package/runtime/prime/egregore_runtime/handoff_lookup.py +196 -0
- package/runtime/prime/egregore_runtime/harness_cli.py +1221 -0
- package/runtime/prime/egregore_runtime/identity.py +734 -0
- package/runtime/prime/egregore_runtime/identity_cli.py +91 -0
- package/runtime/prime/egregore_runtime/ingest.py +575 -0
- package/runtime/prime/egregore_runtime/ingest_cli.py +254 -0
- package/runtime/prime/egregore_runtime/ingest_index_cli.py +147 -0
- package/runtime/prime/egregore_runtime/invitation_cli.py +51 -0
- package/runtime/prime/egregore_runtime/invitations.py +116 -0
- package/runtime/prime/egregore_runtime/issue_cli.py +305 -0
- package/runtime/prime/egregore_runtime/issues.py +359 -0
- package/runtime/prime/egregore_runtime/knowledge.py +376 -0
- package/runtime/prime/egregore_runtime/knowledge_cli.py +173 -0
- package/runtime/prime/egregore_runtime/lifecycle.py +888 -0
- package/runtime/prime/egregore_runtime/lifecycle_cli.py +269 -0
- package/runtime/prime/egregore_runtime/notification_cli.py +125 -0
- package/runtime/prime/egregore_runtime/notifications.py +230 -0
- package/runtime/prime/egregore_runtime/observe.py +342 -0
- package/runtime/prime/egregore_runtime/onboarding.py +290 -0
- package/runtime/prime/egregore_runtime/onboarding_cli.py +110 -0
- package/runtime/prime/egregore_runtime/policy.py +144 -0
- package/runtime/prime/egregore_runtime/profile.py +193 -0
- package/runtime/prime/egregore_runtime/quest_cli.py +216 -0
- package/runtime/prime/egregore_runtime/question_cli.py +180 -0
- package/runtime/prime/egregore_runtime/questions.py +304 -0
- package/runtime/prime/egregore_runtime/quests.py +419 -0
- package/runtime/prime/egregore_runtime/readiness.py +379 -0
- package/runtime/prime/egregore_runtime/research_ingest.py +256 -0
- package/runtime/prime/egregore_runtime/research_ingest_cli.py +44 -0
- package/runtime/prime/egregore_runtime/runtime.py +464 -0
- package/runtime/prime/egregore_runtime/scroll_cli.py +185 -0
- package/runtime/prime/egregore_runtime/scrolls.py +726 -0
- package/runtime/prime/egregore_runtime/status.py +412 -0
- package/runtime/prime/egregore_runtime/status_cli.py +174 -0
- package/runtime/prime/egregore_runtime/sync.py +218 -0
- package/runtime/prime/egregore_runtime/teamsync.py +139 -0
- package/runtime/prime/egregore_runtime/telemetry.py +640 -0
- package/runtime/prime/egregore_runtime/thread_cli.py +173 -0
- package/runtime/prime/egregore_runtime/threads.py +517 -0
- package/runtime/prime/egregore_runtime/todo_cli.py +142 -0
- package/runtime/prime/egregore_runtime/todos.py +244 -0
- package/runtime/prime/egregore_runtime/upgrade.py +770 -0
- package/runtime/prime/egregore_runtime/upgrade_worker.py +53 -0
- package/runtime/prime/egregore_runtime/writeback.py +391 -0
- package/runtime/prime/egregore_runtime/writeback_cli.py +114 -0
- package/runtime/prime/manifest.json +98 -1
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Worktree lifecycle management for Egregore sessions.
|
|
3
|
+
# Each session gets an isolated worktree so parallel sessions don't conflict.
|
|
4
|
+
#
|
|
5
|
+
# Usage:
|
|
6
|
+
# bash bin/worktree.sh setup <worktree-path> <main-project-dir>
|
|
7
|
+
# bash bin/worktree.sh cleanup <worktree-path>
|
|
8
|
+
# bash bin/worktree.sh cleanup-stale <main-project-dir>
|
|
9
|
+
# bash bin/worktree.sh health [path]
|
|
10
|
+
# bash bin/worktree.sh list
|
|
11
|
+
|
|
12
|
+
set -o pipefail
|
|
13
|
+
|
|
14
|
+
if [[ "${1:-}" == "--help" || "${1:-}" == "-h" ]]; then
|
|
15
|
+
echo "Usage: worktree.sh <command> [args...]"
|
|
16
|
+
echo ""
|
|
17
|
+
echo "Worktree lifecycle management for Egregore sessions."
|
|
18
|
+
echo ""
|
|
19
|
+
echo "Commands:"
|
|
20
|
+
echo " setup <path> <main-dir> Set up symlinks for a new worktree"
|
|
21
|
+
echo " cleanup <path> Remove a worktree"
|
|
22
|
+
echo " cleanup-stale <main-dir> List stale worktrees (manual review)"
|
|
23
|
+
echo " health [path] Check worktree + branch health"
|
|
24
|
+
echo " list List all git worktrees"
|
|
25
|
+
exit 0
|
|
26
|
+
fi
|
|
27
|
+
|
|
28
|
+
CMD="${1:-}"
|
|
29
|
+
shift 2>/dev/null || true
|
|
30
|
+
|
|
31
|
+
case "$CMD" in
|
|
32
|
+
|
|
33
|
+
setup)
|
|
34
|
+
# Setup symlinks so worktree shares state with main project.
|
|
35
|
+
# Args: <worktree-path> <main-project-dir>
|
|
36
|
+
WT_PATH="${1:?Usage: worktree.sh setup <worktree-path> <main-project-dir>}"
|
|
37
|
+
MAIN_DIR="${2:?Usage: worktree.sh setup <worktree-path> <main-project-dir>}"
|
|
38
|
+
|
|
39
|
+
# Symlink shared files from main project
|
|
40
|
+
for FILE in memory .env .egregore-state.json .egregore-session-id; do
|
|
41
|
+
SRC="$MAIN_DIR/$FILE"
|
|
42
|
+
DST="$WT_PATH/$FILE"
|
|
43
|
+
if [ "$FILE" = "memory" ]; then
|
|
44
|
+
# memory may be a symlink (follow to its target) or a real directory.
|
|
45
|
+
if [ -L "$SRC" ]; then
|
|
46
|
+
SRC=$(realpath "$SRC" 2>/dev/null) || continue
|
|
47
|
+
fi
|
|
48
|
+
[ -d "$SRC" ] || continue
|
|
49
|
+
else
|
|
50
|
+
[ -f "$SRC" ] || continue
|
|
51
|
+
fi
|
|
52
|
+
ln -sfn "$SRC" "$DST"
|
|
53
|
+
done
|
|
54
|
+
|
|
55
|
+
# Symlink egregore.json if not already present (committed file)
|
|
56
|
+
if [ -f "$MAIN_DIR/egregore.json" ] && [ ! -f "$WT_PATH/egregore.json" ]; then
|
|
57
|
+
ln -sfn "$MAIN_DIR/egregore.json" "$WT_PATH/egregore.json"
|
|
58
|
+
fi
|
|
59
|
+
|
|
60
|
+
# Find terminal TTY for statusline matching
|
|
61
|
+
_pid=$$
|
|
62
|
+
_tty=""
|
|
63
|
+
while [ "$_pid" -gt 1 ] 2>/dev/null; do
|
|
64
|
+
_ptty=$(ps -o tty= -p "$_pid" 2>/dev/null | tr -d ' ')
|
|
65
|
+
if [ -n "$_ptty" ] && [ "$_ptty" != "??" ]; then
|
|
66
|
+
_tty="$_ptty"
|
|
67
|
+
break
|
|
68
|
+
fi
|
|
69
|
+
_pid=$(ps -o ppid= -p "$_pid" 2>/dev/null | tr -d ' ')
|
|
70
|
+
done
|
|
71
|
+
[ -n "$_tty" ] && echo "$_tty" > "$WT_PATH/.egregore-worktree-tty"
|
|
72
|
+
|
|
73
|
+
echo "Worktree setup complete: $WT_PATH"
|
|
74
|
+
;;
|
|
75
|
+
|
|
76
|
+
cleanup)
|
|
77
|
+
# Remove a worktree. Only called explicitly (ExitWorktree or manual).
|
|
78
|
+
# Args: <worktree-path>
|
|
79
|
+
WT_PATH="${1:?Usage: worktree.sh cleanup <worktree-path>}"
|
|
80
|
+
|
|
81
|
+
# Remove from instance registry if accidentally registered
|
|
82
|
+
REGISTRY="$HOME/.egregore/instances.json"
|
|
83
|
+
if [ -f "$REGISTRY" ]; then
|
|
84
|
+
RESOLVED_WT=$(realpath "$WT_PATH" 2>/dev/null || echo "$WT_PATH")
|
|
85
|
+
UPDATED=$(jq --arg p "$RESOLVED_WT" '[.[] | select(.path != $p)]' "$REGISTRY" 2>/dev/null)
|
|
86
|
+
if [ -n "$UPDATED" ]; then
|
|
87
|
+
echo "$UPDATED" > "$REGISTRY.tmp" && mv "$REGISTRY.tmp" "$REGISTRY"
|
|
88
|
+
fi
|
|
89
|
+
fi
|
|
90
|
+
|
|
91
|
+
git worktree remove "$WT_PATH" --force 2>/dev/null || true
|
|
92
|
+
git worktree prune 2>/dev/null || true
|
|
93
|
+
|
|
94
|
+
echo "Worktree cleaned up: $WT_PATH"
|
|
95
|
+
;;
|
|
96
|
+
|
|
97
|
+
cleanup-stale)
|
|
98
|
+
# List stale worktrees for manual review. Does NOT auto-delete.
|
|
99
|
+
# Run interactively or from a cleanup command — never from session-start.
|
|
100
|
+
# Args: <main-project-dir>
|
|
101
|
+
MAIN_DIR="${1:?Usage: worktree.sh cleanup-stale <main-project-dir>}"
|
|
102
|
+
WT_BASE="$MAIN_DIR/.claude/worktrees"
|
|
103
|
+
|
|
104
|
+
if [ ! -d "$WT_BASE" ]; then
|
|
105
|
+
echo "No worktrees directory."
|
|
106
|
+
exit 0
|
|
107
|
+
fi
|
|
108
|
+
|
|
109
|
+
NOW_TS=$(date +%s)
|
|
110
|
+
FOUND=0
|
|
111
|
+
|
|
112
|
+
for WT_DIR in "$WT_BASE"/*/; do
|
|
113
|
+
[ -d "$WT_DIR" ] || continue
|
|
114
|
+
|
|
115
|
+
WT_NAME=$(basename "$WT_DIR")
|
|
116
|
+
WT_BRANCH=""
|
|
117
|
+
STATUS="unknown"
|
|
118
|
+
|
|
119
|
+
if [ -f "$WT_DIR/.git" ]; then
|
|
120
|
+
WT_BRANCH=$(git -C "$WT_DIR" branch --show-current 2>/dev/null || echo "?")
|
|
121
|
+
|
|
122
|
+
# Check if merged
|
|
123
|
+
if [ "$WT_BRANCH" != "?" ] && [ "$WT_BRANCH" != "develop" ] && [ "$WT_BRANCH" != "main" ]; then
|
|
124
|
+
if git merge-base --is-ancestor "$(git -C "$WT_DIR" rev-parse HEAD 2>/dev/null)" \
|
|
125
|
+
"$(git -C "$MAIN_DIR" rev-parse origin/develop 2>/dev/null)" 2>/dev/null; then
|
|
126
|
+
STATUS="merged"
|
|
127
|
+
else
|
|
128
|
+
STATUS="active"
|
|
129
|
+
fi
|
|
130
|
+
fi
|
|
131
|
+
else
|
|
132
|
+
STATUS="broken"
|
|
133
|
+
fi
|
|
134
|
+
|
|
135
|
+
# Age
|
|
136
|
+
WT_MTIME=$(stat -f %m "$WT_DIR" 2>/dev/null || stat -c %Y "$WT_DIR" 2>/dev/null || echo "$NOW_TS")
|
|
137
|
+
WT_AGE_H=$(( (NOW_TS - WT_MTIME) / 3600 ))
|
|
138
|
+
|
|
139
|
+
if [ "$STATUS" = "merged" ] || [ "$STATUS" = "broken" ] || [ "$WT_AGE_H" -gt 24 ]; then
|
|
140
|
+
echo " $WT_NAME [$STATUS] ${WT_AGE_H}h old branch: ${WT_BRANCH:-none}"
|
|
141
|
+
FOUND=$((FOUND + 1))
|
|
142
|
+
fi
|
|
143
|
+
done
|
|
144
|
+
|
|
145
|
+
if [ "$FOUND" -eq 0 ]; then
|
|
146
|
+
echo "No stale worktrees found."
|
|
147
|
+
else
|
|
148
|
+
echo ""
|
|
149
|
+
echo "To remove: bash bin/worktree.sh cleanup <path>"
|
|
150
|
+
fi
|
|
151
|
+
|
|
152
|
+
# Prune git's internal worktree list
|
|
153
|
+
git -C "$MAIN_DIR" worktree prune 2>/dev/null || true
|
|
154
|
+
;;
|
|
155
|
+
|
|
156
|
+
health)
|
|
157
|
+
# Check worktree + branch health
|
|
158
|
+
# Exit codes: 0=healthy, 1=not_worktree, 2=branch_gone, 3=protected_branch
|
|
159
|
+
WT_PATH="${1:-$(pwd)}"
|
|
160
|
+
|
|
161
|
+
if [ ! -f "$WT_PATH/.git" ]; then
|
|
162
|
+
echo '{"status":"not_worktree"}'
|
|
163
|
+
exit 1
|
|
164
|
+
fi
|
|
165
|
+
|
|
166
|
+
BRANCH=$(git -C "$WT_PATH" branch --show-current 2>/dev/null || echo "")
|
|
167
|
+
|
|
168
|
+
case "$BRANCH" in
|
|
169
|
+
develop|main|master)
|
|
170
|
+
jq -n --arg branch "$BRANCH" '{status: "protected_branch", branch: $branch}'
|
|
171
|
+
exit 3
|
|
172
|
+
;;
|
|
173
|
+
esac
|
|
174
|
+
|
|
175
|
+
# Check if remote branch still exists
|
|
176
|
+
git -C "$WT_PATH" fetch origin --prune --quiet 2>/dev/null || true
|
|
177
|
+
if ! git -C "$WT_PATH" ls-remote --heads origin "$BRANCH" 2>/dev/null | grep -q "$BRANCH"; then
|
|
178
|
+
if git -C "$WT_PATH" branch -r --merged origin/develop 2>/dev/null | grep -q "origin/$BRANCH" 2>/dev/null; then
|
|
179
|
+
jq -n --arg branch "$BRANCH" '{status: "merged", branch: $branch}'
|
|
180
|
+
else
|
|
181
|
+
jq -n --arg branch "$BRANCH" '{status: "remote_deleted", branch: $branch}'
|
|
182
|
+
fi
|
|
183
|
+
exit 2
|
|
184
|
+
fi
|
|
185
|
+
|
|
186
|
+
jq -n --arg branch "$BRANCH" '{status: "healthy", branch: $branch}'
|
|
187
|
+
exit 0
|
|
188
|
+
;;
|
|
189
|
+
|
|
190
|
+
list)
|
|
191
|
+
git worktree list
|
|
192
|
+
;;
|
|
193
|
+
|
|
194
|
+
*)
|
|
195
|
+
echo "Usage: worktree.sh {setup|cleanup|cleanup-stale|health|list}" >&2
|
|
196
|
+
exit 1
|
|
197
|
+
;;
|
|
198
|
+
esac
|
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
"""Public Egregore Runtime v1 contracts.
|
|
2
|
+
|
|
3
|
+
Infrastructure adapters live outside this package. Harnesses and rituals
|
|
4
|
+
should depend on these domain types and protocols rather than QMD, Neo4j,
|
|
5
|
+
Supabase, or Git implementation details.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
from .contracts import (
|
|
9
|
+
AccountIdentity,
|
|
10
|
+
ActionAuthorizer,
|
|
11
|
+
ActorContext,
|
|
12
|
+
ActorIdentity,
|
|
13
|
+
ActorKind,
|
|
14
|
+
ArtifactRelationship,
|
|
15
|
+
ArtifactWriteback,
|
|
16
|
+
CanonicalArtifact,
|
|
17
|
+
Capability,
|
|
18
|
+
Entitlements,
|
|
19
|
+
EgregoreProfile,
|
|
20
|
+
EvidenceItem,
|
|
21
|
+
GraphProjection,
|
|
22
|
+
GraphProjectionHealth,
|
|
23
|
+
IdentityResolver,
|
|
24
|
+
IngestSource,
|
|
25
|
+
Ingestor,
|
|
26
|
+
OrgContext,
|
|
27
|
+
OrgContextCompiler,
|
|
28
|
+
OrgMembership,
|
|
29
|
+
Permission,
|
|
30
|
+
PolicyDecision,
|
|
31
|
+
RetrievalHit,
|
|
32
|
+
RetrievalMode,
|
|
33
|
+
RetrievalRequest,
|
|
34
|
+
RetrievalResult,
|
|
35
|
+
Retriever,
|
|
36
|
+
RetrieverHealth,
|
|
37
|
+
RetrievalRuntimeControl,
|
|
38
|
+
SourceProvenance,
|
|
39
|
+
SyncStatus,
|
|
40
|
+
SyncTransport,
|
|
41
|
+
SynchronizationReceipt,
|
|
42
|
+
TelemetryEvent,
|
|
43
|
+
TelemetrySink,
|
|
44
|
+
TemporalScope,
|
|
45
|
+
WritebackEvent,
|
|
46
|
+
WritebackStatus,
|
|
47
|
+
)
|
|
48
|
+
from .errors import AuthorizationDenied, ContextBudgetError, EgregoreRuntimeError
|
|
49
|
+
from .observe import DefaultOrgContextCompiler
|
|
50
|
+
from .policy import ActorGrant, StaticPolicy, all_access_dogfood_policy, scope_allows_path
|
|
51
|
+
from .telemetry import (
|
|
52
|
+
ALLOWED_METRIC_KEYS,
|
|
53
|
+
TELEMETRY_SCHEMA_VERSION,
|
|
54
|
+
HttpSharedTelemetrySink,
|
|
55
|
+
LocalTelemetrySink,
|
|
56
|
+
SharedTelemetrySink,
|
|
57
|
+
TelemetryPrivacyError,
|
|
58
|
+
TelemetryShareError,
|
|
59
|
+
TelemetrySharePlan,
|
|
60
|
+
TelemetryShareReceipt,
|
|
61
|
+
TelemetryStatus,
|
|
62
|
+
event_from_mapping,
|
|
63
|
+
make_event,
|
|
64
|
+
validate_event,
|
|
65
|
+
)
|
|
66
|
+
from .notifications import (
|
|
67
|
+
EXACT_NOTIFICATION_CONFIRMATION,
|
|
68
|
+
NOTIFICATION_BINDING_SCHEMA,
|
|
69
|
+
NotificationBinding,
|
|
70
|
+
NotificationError,
|
|
71
|
+
NotificationService,
|
|
72
|
+
NotificationTransport,
|
|
73
|
+
)
|
|
74
|
+
from .entitlements import (
|
|
75
|
+
ACTIVE_ENTITLEMENT_STATUSES,
|
|
76
|
+
CAPABILITY_REVISION,
|
|
77
|
+
LOCAL_CAPABILITIES,
|
|
78
|
+
PLAN_CAPABILITIES,
|
|
79
|
+
resolve_entitlements,
|
|
80
|
+
)
|
|
81
|
+
from .identity import (
|
|
82
|
+
IDENTITY_SCHEMA,
|
|
83
|
+
LocalIdentityResolver,
|
|
84
|
+
OrganizationMemberPresentation,
|
|
85
|
+
actor_identity,
|
|
86
|
+
actor_presentation_name,
|
|
87
|
+
control_plane_identity_from_records,
|
|
88
|
+
initialize_local_instance_identity,
|
|
89
|
+
migrate_local_identity_state,
|
|
90
|
+
new_identity_id,
|
|
91
|
+
organization_member_presentations,
|
|
92
|
+
reconcile_control_plane_identity,
|
|
93
|
+
)
|
|
94
|
+
from .onboarding import (
|
|
95
|
+
ONBOARDING_SCHEMA,
|
|
96
|
+
OnboardingPlan,
|
|
97
|
+
OnboardingService,
|
|
98
|
+
OnboardingSnapshot,
|
|
99
|
+
OnboardingStep,
|
|
100
|
+
onboarding_plan,
|
|
101
|
+
)
|
|
102
|
+
from .invitations import (
|
|
103
|
+
InvitationReceipt,
|
|
104
|
+
InvitationService,
|
|
105
|
+
InvitationTransport,
|
|
106
|
+
InvitationTransportResult,
|
|
107
|
+
)
|
|
108
|
+
from .profile import (
|
|
109
|
+
CONFIG_SCHEMA,
|
|
110
|
+
DEFAULT_CONTEXT_BUDGET,
|
|
111
|
+
PROFILE_SCHEMA,
|
|
112
|
+
ProfileConfigError,
|
|
113
|
+
default_profile_config,
|
|
114
|
+
initialize_org_config,
|
|
115
|
+
load_profile,
|
|
116
|
+
new_org_id,
|
|
117
|
+
render_identity_document,
|
|
118
|
+
)
|
|
119
|
+
from .artifacts import (
|
|
120
|
+
ARTIFACT_SCHEMA_VERSION,
|
|
121
|
+
ArtifactConflictError,
|
|
122
|
+
ArtifactSchemaError,
|
|
123
|
+
canonical_artifact_id,
|
|
124
|
+
CanonicalArtifactStore,
|
|
125
|
+
CanonicalDocument,
|
|
126
|
+
LocalMarkdownArtifactStore,
|
|
127
|
+
parse_canonical_markdown,
|
|
128
|
+
render_canonical_markdown,
|
|
129
|
+
)
|
|
130
|
+
from .graph import DisabledGraphProjection, LegacyGraphProjection, graph_projection
|
|
131
|
+
from .ingest import (
|
|
132
|
+
CanonicalIngestRegistry,
|
|
133
|
+
CanonicalIngestWorkflow,
|
|
134
|
+
IngestPhase,
|
|
135
|
+
IngestRegistrationReceipt,
|
|
136
|
+
IngestReceipt,
|
|
137
|
+
IngestReview,
|
|
138
|
+
IngestWorkflow,
|
|
139
|
+
LocalIngestJournal,
|
|
140
|
+
LocalQuarantine,
|
|
141
|
+
NormalizedIngest,
|
|
142
|
+
)
|
|
143
|
+
from .runtime import EgregoreRuntime, local_runtime
|
|
144
|
+
from .questions import (
|
|
145
|
+
QUESTION_SCHEMA_VERSION,
|
|
146
|
+
CanonicalQuestionService,
|
|
147
|
+
PendingQuestion,
|
|
148
|
+
QuestionLifecycleError,
|
|
149
|
+
)
|
|
150
|
+
from .issues import (
|
|
151
|
+
ISSUE_SCHEMA_VERSION,
|
|
152
|
+
ISSUE_STATUSES,
|
|
153
|
+
CanonicalIssueService,
|
|
154
|
+
IssueSnapshot,
|
|
155
|
+
parse_issue_markdown,
|
|
156
|
+
)
|
|
157
|
+
from .knowledge import (
|
|
158
|
+
KNOWLEDGE_SCHEMA_VERSION,
|
|
159
|
+
PRIVATE_NOTE_SCHEMA_VERSION,
|
|
160
|
+
CanonicalKnowledgeService,
|
|
161
|
+
KnowledgeCaptureError,
|
|
162
|
+
PersonalNote,
|
|
163
|
+
PersonalNoteService,
|
|
164
|
+
)
|
|
165
|
+
from .research_ingest import (
|
|
166
|
+
RESEARCH_INGEST_SCHEMA_VERSION,
|
|
167
|
+
CanonicalResearchIngestService,
|
|
168
|
+
ResearchIngestError,
|
|
169
|
+
ResearchIngestReceipt,
|
|
170
|
+
)
|
|
171
|
+
from .quests import (
|
|
172
|
+
QUEST_STATUSES,
|
|
173
|
+
CanonicalQuestService,
|
|
174
|
+
QuestSnapshot,
|
|
175
|
+
parse_quest_markdown,
|
|
176
|
+
)
|
|
177
|
+
from .todos import (
|
|
178
|
+
TODO_STATUSES,
|
|
179
|
+
CanonicalTodoService,
|
|
180
|
+
TodoSnapshot,
|
|
181
|
+
parse_todo_markdown,
|
|
182
|
+
)
|
|
183
|
+
from .status import (
|
|
184
|
+
STATUS_INDEX_SPEC_VERSION,
|
|
185
|
+
STATUS_SCHEMA_VERSION,
|
|
186
|
+
CanonicalStatusSnapshotService,
|
|
187
|
+
)
|
|
188
|
+
from .sync import GitSyncError, LocalGitSyncTransport
|
|
189
|
+
from .writeback import CanonicalArtifactWriteback
|
|
190
|
+
from .lifecycle import (
|
|
191
|
+
AttentionState,
|
|
192
|
+
AuthorityState,
|
|
193
|
+
CanonicalLifecycleService,
|
|
194
|
+
LIFECYCLE_INDEX_SPEC,
|
|
195
|
+
LifecycleAction,
|
|
196
|
+
LifecycleError,
|
|
197
|
+
LifecyclePlan,
|
|
198
|
+
LifecyclePolicy,
|
|
199
|
+
LifecycleRecord,
|
|
200
|
+
LifecycleTransition,
|
|
201
|
+
ObligationState,
|
|
202
|
+
)
|
|
203
|
+
from .threads import (
|
|
204
|
+
THREAD_CONFIRMATION,
|
|
205
|
+
THREAD_EVENT_SCHEMA_VERSION,
|
|
206
|
+
THREAD_SCHEMA_VERSION,
|
|
207
|
+
CanonicalThreadService,
|
|
208
|
+
ThreadError,
|
|
209
|
+
ThreadFoldReceipt,
|
|
210
|
+
ThreadSnapshot,
|
|
211
|
+
parse_thread_markdown,
|
|
212
|
+
)
|
|
213
|
+
from .scrolls import (
|
|
214
|
+
EXACT_SHARE_CONFIRMATION,
|
|
215
|
+
SCROLL_EVENT_SCHEMA_VERSION,
|
|
216
|
+
SCROLL_SCHEMA_VERSION,
|
|
217
|
+
SCROLL_SHARE_SCHEMA_VERSION,
|
|
218
|
+
CanonicalScrollService,
|
|
219
|
+
ScrollError,
|
|
220
|
+
ScrollEventReceipt,
|
|
221
|
+
ScrollSharePlan,
|
|
222
|
+
ScrollShareReceipt,
|
|
223
|
+
ScrollSnapshot,
|
|
224
|
+
parse_scroll_markdown,
|
|
225
|
+
scroll_turn_id,
|
|
226
|
+
)
|
|
227
|
+
|
|
228
|
+
__all__ = [name for name in globals() if not name.startswith("_")]
|
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
"""GitHub and Connected invitation transports for Egregore Runtime."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import json
|
|
6
|
+
import os
|
|
7
|
+
from pathlib import Path
|
|
8
|
+
import tempfile
|
|
9
|
+
from typing import Any, Mapping
|
|
10
|
+
from urllib.error import HTTPError, URLError
|
|
11
|
+
from urllib.request import Request, urlopen
|
|
12
|
+
from uuid import uuid4
|
|
13
|
+
|
|
14
|
+
from ..contracts import ActorContext
|
|
15
|
+
from ..invitations import InvitationTransportResult
|
|
16
|
+
from ..sync import LocalGitSyncTransport
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def _json(path: Path) -> dict[str, Any]:
|
|
20
|
+
value = json.loads(path.read_text(encoding="utf-8"))
|
|
21
|
+
if not isinstance(value, dict):
|
|
22
|
+
raise ValueError(f"{path} must contain an object")
|
|
23
|
+
return value
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
def _secret(root: Path, name: str) -> str:
|
|
27
|
+
environment = os.environ.get(name, "").strip()
|
|
28
|
+
if environment:
|
|
29
|
+
return environment
|
|
30
|
+
env_path = root / ".env"
|
|
31
|
+
if not env_path.is_file():
|
|
32
|
+
return ""
|
|
33
|
+
prefix = f"{name}="
|
|
34
|
+
for line in env_path.read_text(encoding="utf-8").splitlines():
|
|
35
|
+
if line.startswith(prefix):
|
|
36
|
+
return line[len(prefix) :].strip()
|
|
37
|
+
return ""
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
def _request_json(
|
|
41
|
+
url: str,
|
|
42
|
+
*,
|
|
43
|
+
method: str,
|
|
44
|
+
headers: Mapping[str, str],
|
|
45
|
+
payload: Mapping[str, Any] | None = None,
|
|
46
|
+
timeout: float = 15,
|
|
47
|
+
) -> tuple[int, dict[str, Any]]:
|
|
48
|
+
body = None if payload is None else json.dumps(payload).encode("utf-8")
|
|
49
|
+
request = Request(url, method=method, headers=dict(headers), data=body)
|
|
50
|
+
try:
|
|
51
|
+
with urlopen(request, timeout=timeout) as response: # noqa: S310 - fixed/configured APIs
|
|
52
|
+
raw = response.read().decode("utf-8")
|
|
53
|
+
return response.status, json.loads(raw) if raw else {}
|
|
54
|
+
except HTTPError as exc:
|
|
55
|
+
raw = exc.read().decode("utf-8", errors="replace")
|
|
56
|
+
try:
|
|
57
|
+
detail = json.loads(raw)
|
|
58
|
+
except json.JSONDecodeError:
|
|
59
|
+
detail = {"detail": f"HTTP {exc.code}"}
|
|
60
|
+
return exc.code, detail
|
|
61
|
+
except URLError as exc:
|
|
62
|
+
raise OSError(f"invitation transport unavailable: {exc.reason}") from exc
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
class ShellInvitationTransport:
|
|
66
|
+
"""Select Local GitHub or Connected control-plane transport by config."""
|
|
67
|
+
|
|
68
|
+
def __init__(self, root: Path | str, *, push_remote: bool = True) -> None:
|
|
69
|
+
self.root = Path(root).resolve()
|
|
70
|
+
self.config = _json(self.root / "egregore.json")
|
|
71
|
+
self.push_remote = push_remote
|
|
72
|
+
|
|
73
|
+
def invite(
|
|
74
|
+
self,
|
|
75
|
+
actor: ActorContext,
|
|
76
|
+
*,
|
|
77
|
+
provider: str,
|
|
78
|
+
provider_username: str,
|
|
79
|
+
) -> InvitationTransportResult:
|
|
80
|
+
if provider != "github":
|
|
81
|
+
raise ValueError("unsupported invitation provider")
|
|
82
|
+
connected = bool(self.config.get("api_url")) or self.config.get("mode") == "connected"
|
|
83
|
+
if connected:
|
|
84
|
+
return self._connected(actor, provider_username)
|
|
85
|
+
return self._local(actor, provider_username)
|
|
86
|
+
|
|
87
|
+
def _repos(self) -> tuple[str, ...]:
|
|
88
|
+
memory = str(self.config.get("memory_repo") or "").rstrip("/")
|
|
89
|
+
memory_name = memory.rsplit("/", 1)[-1].removesuffix(".git")
|
|
90
|
+
values: list[str] = [str(self.config.get("repo_name") or ""), memory_name]
|
|
91
|
+
for row in self.config.get("repos") or ():
|
|
92
|
+
values.append(str(row.get("name") if isinstance(row, Mapping) else row))
|
|
93
|
+
return tuple(dict.fromkeys(value for value in values if value))
|
|
94
|
+
|
|
95
|
+
def _github_add(self, org: str, repo: str, username: str, token: str) -> int:
|
|
96
|
+
status, _ = _request_json(
|
|
97
|
+
f"https://api.github.com/repos/{org}/{repo}/collaborators/{username}",
|
|
98
|
+
method="PUT",
|
|
99
|
+
headers={
|
|
100
|
+
"Authorization": f"Bearer {token}",
|
|
101
|
+
"Accept": "application/vnd.github+json",
|
|
102
|
+
"Content-Type": "application/json",
|
|
103
|
+
"X-GitHub-Api-Version": "2022-11-28",
|
|
104
|
+
},
|
|
105
|
+
payload={"permission": "push"},
|
|
106
|
+
)
|
|
107
|
+
return status
|
|
108
|
+
|
|
109
|
+
def _write_stub(
|
|
110
|
+
self, actor: ActorContext, username: str
|
|
111
|
+
) -> tuple[str, tuple[str, ...]]:
|
|
112
|
+
people = (self.root / "memory" / "people").resolve()
|
|
113
|
+
people.mkdir(parents=True, exist_ok=True)
|
|
114
|
+
target = people / f"{username}.md"
|
|
115
|
+
if target.exists() and "Onboarded:" in target.read_text(encoding="utf-8"):
|
|
116
|
+
return "existing-member", ()
|
|
117
|
+
if not target.exists():
|
|
118
|
+
invite_id = f"invite_{uuid4().hex}"
|
|
119
|
+
text = "\n".join(
|
|
120
|
+
[
|
|
121
|
+
"---",
|
|
122
|
+
"schema: egregore-membership-invite/v1",
|
|
123
|
+
f"invite_id: {invite_id}",
|
|
124
|
+
f"org_id: {actor.profile.org_id}",
|
|
125
|
+
"identity_status: invited",
|
|
126
|
+
"provider: github",
|
|
127
|
+
f"provider_username: {username}",
|
|
128
|
+
f"github: {username}", # compatibility alias for person.sh
|
|
129
|
+
f"invited_by_actor: {actor.actor.actor_id}",
|
|
130
|
+
"---",
|
|
131
|
+
"",
|
|
132
|
+
]
|
|
133
|
+
)
|
|
134
|
+
descriptor, temporary = tempfile.mkstemp(prefix=f".{target.name}.", dir=people)
|
|
135
|
+
try:
|
|
136
|
+
with os.fdopen(descriptor, "w", encoding="utf-8") as handle:
|
|
137
|
+
handle.write(text)
|
|
138
|
+
os.replace(temporary, target)
|
|
139
|
+
finally:
|
|
140
|
+
if os.path.exists(temporary):
|
|
141
|
+
os.unlink(temporary)
|
|
142
|
+
try:
|
|
143
|
+
sync = LocalGitSyncTransport(
|
|
144
|
+
(self.root / "memory").resolve(), push_remote=self.push_remote
|
|
145
|
+
).push(message=f"chore(people): invite {username}", paths=(str(target),))
|
|
146
|
+
except Exception as exc:
|
|
147
|
+
return "recorded-unsynced", (f"canonical Git sync: {exc}",)
|
|
148
|
+
return (
|
|
149
|
+
"recorded" if not sync.warnings else "recorded-local",
|
|
150
|
+
tuple(f"canonical Git sync: {warning}" for warning in sync.warnings),
|
|
151
|
+
)
|
|
152
|
+
|
|
153
|
+
def _local(self, actor: ActorContext, username: str) -> InvitationTransportResult:
|
|
154
|
+
token = _secret(self.root, "GITHUB_TOKEN")
|
|
155
|
+
if not token:
|
|
156
|
+
raise ValueError("GitHub authentication is required; run bash bin/github-auth.sh")
|
|
157
|
+
org = str(self.config.get("github_org") or "").strip()
|
|
158
|
+
repos = self._repos()
|
|
159
|
+
if not org or not repos:
|
|
160
|
+
raise ValueError("egregore.json must define github_org and repo_name")
|
|
161
|
+
rows: list[Mapping[str, str]] = []
|
|
162
|
+
for repo in repos:
|
|
163
|
+
status = self._github_add(org, repo, username, token)
|
|
164
|
+
rows.append(
|
|
165
|
+
{
|
|
166
|
+
"repo": repo,
|
|
167
|
+
"status": "added" if status in {201, 204} else (
|
|
168
|
+
"already-added" if status == 422 else f"failed-http-{status}"
|
|
169
|
+
),
|
|
170
|
+
}
|
|
171
|
+
)
|
|
172
|
+
core = rows[0]["status"]
|
|
173
|
+
successful = core in {"added", "already-added"}
|
|
174
|
+
profile, sync_warnings = (
|
|
175
|
+
self._write_stub(actor, username)
|
|
176
|
+
if successful
|
|
177
|
+
else ("not-recorded", ())
|
|
178
|
+
)
|
|
179
|
+
warnings = tuple(
|
|
180
|
+
f"{row['repo']}: {row['status']}" for row in rows if row["status"].startswith("failed")
|
|
181
|
+
) + sync_warnings
|
|
182
|
+
repo = str(self.config.get("repo_name"))
|
|
183
|
+
return InvitationTransportResult(
|
|
184
|
+
status="accepted" if successful else "rejected",
|
|
185
|
+
provider_status=core,
|
|
186
|
+
memory_status=profile,
|
|
187
|
+
managed_access=tuple(rows[1:]),
|
|
188
|
+
join_command=f"npx -y create-egregore@latest join {org}/{repo}",
|
|
189
|
+
group_link=str(self.config.get("telegram_group_link") or "") or None,
|
|
190
|
+
manual_access_url=f"https://github.com/{org}/{repo}/settings/access",
|
|
191
|
+
warnings=warnings,
|
|
192
|
+
)
|
|
193
|
+
|
|
194
|
+
def _connected(self, actor: ActorContext, username: str) -> InvitationTransportResult:
|
|
195
|
+
api_url = str(self.config.get("api_url") or "").rstrip("/")
|
|
196
|
+
api_key = _secret(self.root, "EGREGORE_API_KEY")
|
|
197
|
+
github_token = _secret(self.root, "GITHUB_TOKEN")
|
|
198
|
+
if not api_url or not api_key or not github_token:
|
|
199
|
+
raise ValueError("Connected invitation requires Egregore and GitHub authentication")
|
|
200
|
+
org = str(self.config.get("github_org") or "")
|
|
201
|
+
repo = str(self.config.get("repo_name") or "")
|
|
202
|
+
status, payload = _request_json(
|
|
203
|
+
f"{api_url}/api/org/invite",
|
|
204
|
+
method="POST",
|
|
205
|
+
headers={
|
|
206
|
+
"Authorization": f"Bearer {api_key}",
|
|
207
|
+
"Content-Type": "application/json",
|
|
208
|
+
},
|
|
209
|
+
payload={
|
|
210
|
+
"github_org": org,
|
|
211
|
+
"github_username": username,
|
|
212
|
+
"repo_name": repo,
|
|
213
|
+
"slug": self.config.get("slug"),
|
|
214
|
+
"github_token": github_token,
|
|
215
|
+
},
|
|
216
|
+
)
|
|
217
|
+
if status >= 400:
|
|
218
|
+
detail = str(payload.get("detail") or f"HTTP {status}")
|
|
219
|
+
return InvitationTransportResult(
|
|
220
|
+
status="rejected",
|
|
221
|
+
provider_status=f"failed-http-{status}",
|
|
222
|
+
memory_status="not-recorded",
|
|
223
|
+
manual_access_url=f"https://github.com/{org}/{repo}/settings/access",
|
|
224
|
+
warnings=(detail,),
|
|
225
|
+
)
|
|
226
|
+
github = payload.get("github_invite") or {}
|
|
227
|
+
memory = payload.get("memory_access") or {}
|
|
228
|
+
return InvitationTransportResult(
|
|
229
|
+
status="accepted",
|
|
230
|
+
provider_status=str(github.get("status") or "unknown"),
|
|
231
|
+
memory_status=str(memory.get("status") or "unknown"),
|
|
232
|
+
managed_access=tuple(payload.get("managed_access") or ()),
|
|
233
|
+
invite_url=str(payload.get("invite_url") or "") or None,
|
|
234
|
+
join_command=str(payload.get("fallback_command") or "") or None,
|
|
235
|
+
group_link=str(payload.get("telegram_group_link") or "") or None,
|
|
236
|
+
manual_access_url=f"https://github.com/{org}/{repo}/settings/access",
|
|
237
|
+
)
|