@event4u/agent-config 14.2.0 → 14.5.0

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.
Files changed (117) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/CHANGELOG.md +33 -252
  3. package/agents/templates/.ai-council.yml.example +35 -0
  4. package/dist/agent-src/contexts/execution/roadmap-process-loop.md +83 -12
  5. package/dist/agent-src/rules/roadmap-progress-sync.md +48 -4
  6. package/dist/agent-src/scripts/resume_probe.ts +154 -9
  7. package/dist/agent-src/scripts/roadmap_gates.ts +210 -6
  8. package/dist/agent-src/skills/roadmap-management/SKILL.md +9 -4
  9. package/dist/agent-src/templates/agent-settings.md +70 -0
  10. package/dist/agent-src/templates/agents/agent-project-settings.example.yml +1 -1
  11. package/dist/agent-src/templates/scripts/telemetry/remote.ts +571 -0
  12. package/dist/agent-src/templates/scripts/telemetry/settings.ts +222 -44
  13. package/dist/cli/python/workspace_drive.js +8 -3
  14. package/dist/cli/python/workspace_drive.js.map +1 -1
  15. package/dist/cli/python/workspace_hosts.js +16 -12
  16. package/dist/cli/python/workspace_hosts.js.map +1 -1
  17. package/dist/cli/registry.js +2 -0
  18. package/dist/cli/registry.js.map +1 -1
  19. package/dist/cli-delegate/{chunk-F3YUF7SA.js → chunk-3UCJWMMP.js} +1 -1
  20. package/dist/cli-delegate/chunk-F7DQWYR5.js +69 -0
  21. package/dist/cli-delegate/{chunk-7PZ4FSZB.js → chunk-FBKL6JWT.js} +61 -2
  22. package/dist/cli-delegate/{chunk-MNWRDMR5.js → chunk-PKOBQADP.js} +1 -1
  23. package/dist/cli-delegate/cmd_conformance.js +26 -11
  24. package/dist/cli-delegate/cmd_doctor.js +2 -2
  25. package/dist/cli-delegate/cmd_handoff.js +3 -3
  26. package/dist/cli-delegate/cmd_route_audit.js +2 -2
  27. package/dist/cli-delegate/cmd_settings_set.js +17 -3
  28. package/dist/discovery/deprecation-report.md +1 -1
  29. package/dist/discovery/discovery-manifest.json +4 -4
  30. package/dist/discovery/discovery-manifest.json.sha256 +1 -1
  31. package/dist/discovery/discovery-manifest.summary.md +1 -1
  32. package/dist/discovery/dormancy-report.md +1 -1
  33. package/dist/discovery/orphan-report.md +1 -1
  34. package/dist/discovery/packs.json +2 -2
  35. package/dist/discovery/trust-report.md +1 -1
  36. package/dist/discovery/workspaces.json +2 -2
  37. package/dist/hooks/dispatch.js +3754 -1721
  38. package/dist/mcp/registry-manifest.json +2 -2
  39. package/dist/mcp/server.json +2 -2
  40. package/dist/mcp/server.mjs +1070 -408
  41. package/dist/scripts/_lib/host_launch.js +66 -0
  42. package/dist/scripts/_lib/host_launch.js.map +1 -0
  43. package/dist/server/io/yamlIO.js +175 -3
  44. package/dist/server/io/yamlIO.js.map +1 -1
  45. package/dist/server/routes/wizard.js +20 -1
  46. package/dist/server/routes/wizard.js.map +1 -1
  47. package/dist/shared/settingsConsent.js +25 -0
  48. package/dist/shared/settingsConsent.js.map +1 -1
  49. package/docs/contracts/settings-classes.md +11 -0
  50. package/docs/guidelines/agent-infra/roadmap-progress-mechanics.md +2 -1
  51. package/package.json +1 -1
  52. package/src/agent-src/scripts/resume_probe.ts +154 -9
  53. package/src/agent-src/scripts/roadmap_gates.ts +210 -6
  54. package/src/agent-src/templates/scripts/telemetry/remote.ts +571 -0
  55. package/src/agent-src/templates/scripts/telemetry/settings.ts +222 -44
  56. package/src/config/estate-count-budget.json +127 -0
  57. package/src/config/evaluator-budgets.json +4 -4
  58. package/src/config/gate-coverage.yml +32 -4
  59. package/src/config/gate-violation-baselines.json +63 -63
  60. package/src/config/gitignore-block.txt +5 -0
  61. package/src/config/hook-latency-budget.json +40 -1
  62. package/src/config/hook-token-budget.json +16 -0
  63. package/src/config/rule-stub-ceilings.json +11 -3
  64. package/src/scripts/_dispatch.bash +42 -1
  65. package/src/scripts/_lib/council_fallback_posture.ts +81 -0
  66. package/src/scripts/_lib/council_fallback_wiring.ts +126 -0
  67. package/src/scripts/_lib/council_settings_block.ts +152 -0
  68. package/src/scripts/_lib/headless_invocation.ts +285 -0
  69. package/src/scripts/_lib/host_launch.ts +72 -0
  70. package/src/scripts/_lib/map_to_object.ts +16 -0
  71. package/src/scripts/_lib/roadmap_checkboxes.ts +88 -0
  72. package/src/scripts/_lib/run_checkpoint.ts +409 -0
  73. package/src/scripts/_lib/session_register.ts +32 -1
  74. package/src/scripts/_lib/stdin.ts +35 -1
  75. package/src/scripts/_lib/turn_end_refusals.ts +12 -4
  76. package/src/scripts/_lib/unattended_guard.ts +371 -0
  77. package/src/scripts/ai_council/config.ts +27 -1
  78. package/src/scripts/ai_council/events_log.ts +12 -1
  79. package/src/scripts/ai_council/fallback_config.ts +114 -0
  80. package/src/scripts/ai_council/mid_flight_fallback.ts +295 -0
  81. package/src/scripts/ai_council/orchestrator.ts +251 -292
  82. package/src/scripts/ai_council/py_parity.ts +139 -0
  83. package/src/scripts/ai_council/response_render.ts +99 -0
  84. package/src/scripts/ai_council/spend_gate.ts +123 -0
  85. package/src/scripts/ai_council/transport_resolver.ts +81 -13
  86. package/src/scripts/bench_hook_injection.ts +118 -7
  87. package/src/scripts/bench_hook_latency.ts +442 -16
  88. package/src/scripts/check_estate_count.ts +924 -0
  89. package/src/scripts/compile_hook_manifest.ts +67 -0
  90. package/src/scripts/council_cli.ts +100 -125
  91. package/src/scripts/decision_memo.ts +325 -0
  92. package/src/scripts/hook_manifest.json +1 -0
  93. package/src/scripts/hook_manifest.yaml +172 -25
  94. package/src/scripts/hooks/concern_registry.ts +6 -0
  95. package/src/scripts/hooks/dispatch_hook.ts +183 -10
  96. package/src/scripts/hooks/dispatch_issues.ts +26 -0
  97. package/src/scripts/hooks/end_review_nudge_hook.ts +97 -24
  98. package/src/scripts/hooks/hook_stdin.ts +111 -5
  99. package/src/scripts/hooks/host_semantics.ts +28 -0
  100. package/src/scripts/hooks/injection_budget.ts +731 -0
  101. package/src/scripts/hooks/payload_stub.ts +446 -0
  102. package/src/scripts/hooks/run_continuation_hook.ts +683 -0
  103. package/src/scripts/hooks/session_eol_hook.ts +52 -0
  104. package/src/scripts/hooks/telemetry_usage_hook.ts +339 -0
  105. package/src/scripts/hooks/tool_result_bytes_hook.ts +27 -0
  106. package/src/scripts/hooks/turn_end_gate_hook.ts +45 -7
  107. package/src/scripts/hooks_doctor.ts +16 -2
  108. package/src/scripts/interruption_report.ts +330 -13
  109. package/src/scripts/lint_hook_manifest.ts +167 -0
  110. package/src/scripts/roadmap_progress_hook.ts +254 -46
  111. package/src/scripts/run_supervise.ts +623 -0
  112. package/src/scripts/session_register_hook.ts +146 -12
  113. package/src/scripts/sessions_cli.ts +18 -6
  114. package/src/scripts/telemetry_disclosure_hook.ts +244 -0
  115. package/src/server/io/yamlIO.ts +167 -3
  116. package/src/shared/settingsConsent.ts +49 -2
  117. package/dist/cli-delegate/chunk-MMJL4TIX.js +0 -18
@@ -35,8 +35,21 @@
35
35
 
36
36
  import { isConservativeDefault, type SettingsClass } from './settingsClasses.js';
37
37
 
38
- /** The provenance vocabulary `settings:set` writes. Mirrors its own enum. */
39
- export type ConsentSource = 'auto-detected' | 'jit-answer' | 'manual' | 'gui';
38
+ /**
39
+ * The provenance vocabulary this READER understands.
40
+ *
41
+ * Deliberately one value wider than what `settings:set` can write: `org-pack`
42
+ * is readable here and absent from `ProvenanceSource` in
43
+ * `src/scripts/_cli/cmd_settings_set.ts`. That asymmetry is ADR-233 § D3 and
44
+ * it is the whole safety property — a value no agent-reachable path can write
45
+ * is a value the agent cannot stamp on its own permission. It is a type
46
+ * difference rather than a runtime check on purpose: there is no branch to
47
+ * forget and none to bypass.
48
+ */
49
+ export type ConsentSource = 'auto-detected' | 'jit-answer' | 'manual' | 'gui' | 'org-pack';
50
+
51
+ /** Keys `org-pack` provenance may grant. ADR-233 § D2. */
52
+ const ORG_PACK_KEY_PREFIX = 'telemetry.remote.';
40
53
 
41
54
  /**
42
55
  * The sources that can carry a human decision.
@@ -44,6 +57,11 @@ export type ConsentSource = 'auto-detected' | 'jit-answer' | 'manual' | 'gui';
44
57
  * `jit-answer` is a question the user answered. `gui` is a human at the settings
45
58
  * editor. `manual` is a hand-edit or an explicit CLI write on the user's
46
59
  * instruction. `auto-detected` is excluded on purpose — see the module header.
60
+ *
61
+ * `org-pack` is NOT in this list, and its absence is not an oversight: it
62
+ * grants, but only for one namespace, so it is handled by its own branch in
63
+ * `consentVerdict` rather than by membership here. Putting it in this list
64
+ * would make it grant everywhere, which is the erosion ADR-233 § D2 refuses.
47
65
  */
48
66
  const HUMAN_SOURCES: readonly ConsentSource[] = ['jit-answer', 'gui', 'manual'];
49
67
 
@@ -56,12 +74,23 @@ export type ConsentVerdict =
56
74
  | 'withheld-unrecorded'
57
75
  /** Permissive and recorded, but recorded as a machine inference. */
58
76
  | 'withheld-machine-inferred'
77
+ /**
78
+ * An org administrator consented, but for a key outside the namespace
79
+ * that grant covers (ADR-233 § D2).
80
+ */
81
+ | 'withheld-org-pack-out-of-scope'
59
82
  /** Not a consent question at all: A needs none, C is human-only. */
60
83
  | 'not-a-consent-key';
61
84
 
62
85
  export interface ConsentQuery {
63
86
  /** The key's class, from the contract — `undefined` means unclassified. */
64
87
  cls: SettingsClass | undefined;
88
+ /**
89
+ * The dotted key. Required only to evaluate an `org-pack` grant, which is
90
+ * namespace-scoped; every other source decides without it, so it stays
91
+ * optional rather than breaking existing callers.
92
+ */
93
+ key?: string | undefined;
65
94
  /** The effective value after normal resolution. */
66
95
  value: unknown;
67
96
  /**
@@ -97,6 +126,21 @@ export function consentVerdict(query: ConsentQuery): ConsentVerdict {
97
126
  if (isConservativeDefault(query.value)) {
98
127
  return 'withheld-default';
99
128
  }
129
+ // The org-pack branch runs BEFORE the hand-edit branch, and the order is
130
+ // the fix rather than a style choice. `handEdited` is true for a
131
+ // project-local `.agent-settings.yml` — which is precisely the file an org
132
+ // pack ships — so with hand-edit first, a recorded `org-pack` provenance
133
+ // on an out-of-scope key would be granted by the wrong branch and ADR-233
134
+ // § D2's namespace scope would hold for no real deployment. A recorded
135
+ // source is the more specific fact and decides first.
136
+ if (query.source === 'org-pack') {
137
+ // A human decided, but not the human this value binds — so the grant
138
+ // is real and narrow. An absent key cannot be shown to be in scope,
139
+ // and unproven is withheld here as everywhere else in this function.
140
+ return query.key !== undefined && query.key.startsWith(ORG_PACK_KEY_PREFIX)
141
+ ? 'granted'
142
+ : 'withheld-org-pack-out-of-scope';
143
+ }
100
144
  if (query.handEdited === true) {
101
145
  return 'granted';
102
146
  }
@@ -130,6 +174,9 @@ export function withheldReason(verdict: ConsentVerdict, key: string): string | n
130
174
  return `${key} permits this, but nothing records who decided it. Ask, or set it via the GUI.`;
131
175
  case 'withheld-machine-inferred':
132
176
  return `${key} was auto-detected, not decided. A machine inference is not a consent.`;
177
+ case 'withheld-org-pack-out-of-scope':
178
+ return `${key} carries an org-pack consent, which grants only under `
179
+ + `${ORG_PACK_KEY_PREFIX}* (ADR-233). Ask this user directly.`;
133
180
  case 'not-a-consent-key':
134
181
  return `${key} is not a class-B consent key — this gate does not apply to it.`;
135
182
  }
@@ -1,18 +0,0 @@
1
- import { createRequire as __acCreateRequire } from 'node:module'; const require = globalThis.require ?? __acCreateRequire(import.meta.url);
2
-
3
- // src/scripts/hooks/hook_stdin.ts
4
- import * as fs from "node:fs";
5
- var _override = null;
6
- function readHookStdin() {
7
- if (_override !== null) return _override;
8
- try {
9
- if (process.stdin.isTTY) return "";
10
- return fs.readFileSync(0, "utf-8");
11
- } catch {
12
- return "";
13
- }
14
- }
15
-
16
- export {
17
- readHookStdin
18
- };