@stravica-ai/digital-operator-pa 0.1.52 → 0.1.53

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.
@@ -348,6 +348,12 @@ export function buildGitignore() {
348
348
  '# nature, so it is never committed or synced between hosts.',
349
349
  'operator/config/preferences.local.json',
350
350
  '',
351
+ '# Review surface — per-install submit token (never committed) and the',
352
+ "# reviews inbox itself (a colleague's inline comments are their own",
353
+ '# working notes, not shared source).',
354
+ 'operator/config/review-token.local.json',
355
+ 'operator/content/reviews/',
356
+ '',
351
357
  ].join('\n');
352
358
  }
353
359
 
@@ -765,7 +771,7 @@ export function buildDistillationScheduleJson(config, seams = {}) {
765
771
  /**
766
772
  * Build the .claude/settings.json contents.
767
773
  *
768
- * Three things:
774
+ * Four things:
769
775
  * 1. `permissions.deny` for the built-in `deep-research` skill and
770
776
  * workflow. The core operating model (Bucket 4) directs the PA to
771
777
  * the `/research` verb, which persists a session and promotes
@@ -773,27 +779,67 @@ export function buildDistillationScheduleJson(config, seams = {}) {
773
779
  * `deep-research` skill produces no such trail and would silently
774
780
  * short-circuit the discipline; deny is the correct default.
775
781
  *
776
- * 2. `hooks.PreToolUse` wiring `pa-coordinator-hook` for the matcher
782
+ * 2. `permissions.allow` scoped to the invoking instance's own
783
+ * `com.<paName>.*` launchd labels and the `pnpm exec scheduler`
784
+ * verbs the mandatory librarian step drives. The `/onboard`
785
+ * walkthrough fires `launchctl kickstart -k gui/<uid>/com.<paName>.<paName>-distillation-sweep`
786
+ * as its distillation-schedule proof; without a preauth the
787
+ * built-in permission classifier hard-stops that call on a fresh
788
+ * colleague estate, and the whole self-learning loop fails to
789
+ * wire on first session (w-2026-09-19-dave-004). The allow-list
790
+ * is scoped to THIS instance's own paName so a laptop that
791
+ * carries another estate's plists is never preauthorised to
792
+ * touch them.
793
+ *
794
+ * 3. `hooks.PreToolUse` wiring `pa-coordinator-hook` for the matcher
777
795
  * the coordinator-hook doc gives. The hook is a no-op unless the
778
796
  * operator sets `PA_COORDINATOR_MODE=1` in their shell, so the
779
797
  * scaffold ships the wiring inert. A per-repo overlay slot is
780
798
  * scaffolded alongside as `.claude/coordinator-overlay.json`.
781
799
  *
782
- * 3. `hooks.SessionStart` wiring `distill health --hook-envelope` so
800
+ * 4. `hooks.SessionStart` wiring `distill health --hook-envelope` so
783
801
  * every session boots with a `distillationHealth (live)` block at
784
802
  * the top of the context. Reads the local distill ledger + the
785
- * scaffolded schedule file — never spawns claude, never triggers a
803
+ * scaffolded schedule file, never spawns claude, never triggers a
786
804
  * sweep, cheap to run. The block warns loudly when the schedule is
787
805
  * missing (fresh scaffold pre-/onboard), disabled, or the last run
788
806
  * is stale, so the whole self-learning loop cannot die silently
789
807
  * the way it did on the WSD-laptop cold install of 0.1.41. Invoked
790
808
  * through `pnpm exec` because Claude Code hook subprocesses do not
791
809
  * inherit the pnpm-augmented PATH the interactive session enjoys.
810
+ *
811
+ * @param {object} [opts]
812
+ * @param {string} [opts.paName] - Instance paName. When set, the allow
813
+ * list is scoped to `com.<paName>.*` labels only. When omitted, the
814
+ * allow list is empty (callers with no paName in scope get the same
815
+ * pre-feature shape).
792
816
  */
793
- export function buildClaudeSettingsJson() {
817
+ export function buildClaudeSettingsJson(opts = {}) {
818
+ const paName = typeof opts.paName === 'string' && opts.paName.length > 0
819
+ ? opts.paName
820
+ : null;
821
+ const allow = paName
822
+ ? [
823
+ // launchctl verbs scoped to this instance's own labels. The
824
+ // wildcard is on the id half; the `com.<paName>.` prefix is
825
+ // fixed so the preauth never widens beyond this estate.
826
+ `Bash(launchctl kickstart -k gui/*/com.${paName}.*)`,
827
+ `Bash(launchctl bootout gui/*/com.${paName}.*)`,
828
+ `Bash(launchctl bootstrap gui/* */Library/LaunchAgents/com.${paName}.*.plist)`,
829
+ // The mandatory librarian step's exact command line, plus the
830
+ // scheduler verbs adjacent to it so a fresh-instance operator
831
+ // does not hit a permission prompt in the middle of onboarding.
832
+ 'Bash(pnpm exec scheduler install *)',
833
+ 'Bash(pnpm exec scheduler list*)',
834
+ 'Bash(pnpm exec scheduler remove *)',
835
+ 'Bash(pnpm exec scheduler verify *)',
836
+ 'Bash(pnpm exec scheduler detect*)',
837
+ ]
838
+ : [];
794
839
  return {
795
840
  permissions: {
796
841
  deny: ['Skill(skill:deep-research)', 'Workflow(name:deep-research)'],
842
+ ...(allow.length ? { allow } : {}),
797
843
  },
798
844
  hooks: {
799
845
  PreToolUse: [
@@ -941,7 +987,7 @@ export function buildPlanFromTemplates(config, templates) {
941
987
  plan.push({ kind: 'file', path: '.nvmrc', contents: '24\n' });
942
988
  plan.push({ kind: 'file', path: 'pnpm-workspace.yaml', contents: buildInstanceWorkspaceYaml() });
943
989
 
944
- plan.push({ kind: 'json', path: '.claude/settings.json', contents: buildClaudeSettingsJson() });
990
+ plan.push({ kind: 'json', path: '.claude/settings.json', contents: buildClaudeSettingsJson({ paName }) });
945
991
  // /research slash command: rendered from the packaged core doc so the
946
992
  // command a colleague gets is exactly what the platform ships. The scaffold
947
993
  // never re-authors it, and there is no template to drift.
@@ -72,6 +72,21 @@ Stay available for {OPERATOR_NAME}. Preserve main-thread context. Lead the team
72
72
  10. **All tool development via tool-developer, in Node.js.** No shell scripts, ever -- cross-platform breakage.
73
73
  11. **When work returns, evaluate the process as well as the result.** Feed team improvement continuously -- role defs, briefs, autonomy envelopes, roster.
74
74
 
75
+ ### Dispatch routing (recognise-and-hand-off cues)
76
+
77
+ This block is the routing surface the PA consults when deciding inline-versus-dispatch. Roles that need to fire on cues rather than name-checks ship their cues here as liftable blocks. A missed first routing is a common case, so recovery cues sit alongside primary cues.
78
+
79
+ **Agentic Workflow Designer (`agentic-workflow-designer`).** Dispatch when a correct answer would contain a flow -- more than one actor, or at least one decision or approval point -- and NEVER sketch the flow inline first. Do not answer inline and offer a designed version later; the inline sketch anchors the operator on an unruled, unmapped design and forecloses the role's actual deliverable.
80
+
81
+ - "design a process / workflow / pipeline / automation" for anything
82
+ - anything involving status transitions, approval steps, handoffs, triage rules, escalation paths, or "who does what when"
83
+ - any automation that will run unattended: scheduled, triggered, or looping
84
+ - a correction of a prose answer toward an artefact ("as a designed workflow", "produce the real artefact", "not prose") -- a second ask in this shape after an inline answer means the first ask was a missed dispatch, not that a new kind of request has arrived
85
+
86
+ Non-cues (answer inline): a status question about an existing workflow; a factual question about the role or the Rule of Two; a prose edit to a ruled diagram's supporting text that changes no lane, gate, or mapping.
87
+
88
+ Project bootstrap is the designer's own first act -- the dispatching brief does not need to pre-create a project. A workflow design is project work, never knowledge capture: writing the design under `knowledge/` or `operator/knowledge/` is a routing failure even when the content is good, because the knowledge tree is the cheap path only because it needs no bootstrap.
89
+
75
90
  **Deeper reference:** `operator/knowledge/delegation-dispatch/` -- briefing contract examples, delegation-mode selection tree, task-group patterns, role catalogue, team improvement loop, dispatch envelope (capability matrix, isolation semantics, MCP inheritance).
76
91
 
77
92
  <!-- OPERATOR: add operator-specific dispatch patterns here (surface-specific brief bolt-ons, an operator-specialised role list, per-project orchestration convention). -->
@@ -48,6 +48,12 @@
48
48
  "href": "/core/tools/workspace/app/repos.html",
49
49
  "section": "Workspace"
50
50
  },
51
+ {
52
+ "id": "reviews",
53
+ "label": "Reviews",
54
+ "href": "/core/tools/workspace/app/reviews.html",
55
+ "section": "Workspace"
56
+ },
51
57
  {
52
58
  "id": "delegations",
53
59
  "label": "Delegations",