@hve-squad/mcp 0.7.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 (73) hide show
  1. package/LICENSE +21 -0
  2. package/NOTICE +46 -0
  3. package/README.md +233 -0
  4. package/dist/src/auth/entra.js +164 -0
  5. package/dist/src/auth/jose-verifier.js +31 -0
  6. package/dist/src/auth/scopes.js +240 -0
  7. package/dist/src/catalog/catalog.js +80 -0
  8. package/dist/src/config/operator-config.js +281 -0
  9. package/dist/src/engine/advisory-pipeline.js +367 -0
  10. package/dist/src/engine/advisory-run-store.js +31 -0
  11. package/dist/src/engine/artifact-store.js +165 -0
  12. package/dist/src/engine/auto-memory.js +207 -0
  13. package/dist/src/engine/backends/azure-blob-artifact-store.js +246 -0
  14. package/dist/src/engine/backends/azure-openai.js +69 -0
  15. package/dist/src/engine/backends/azure-table-run-state.js +319 -0
  16. package/dist/src/engine/backends/azure-table-squad-memory.js +240 -0
  17. package/dist/src/engine/backends/file-squad-memory.js +208 -0
  18. package/dist/src/engine/backends/graph-squad-memory.js +271 -0
  19. package/dist/src/engine/backends/managed-identity-credential.js +33 -0
  20. package/dist/src/engine/backends/overflow-squad-memory.js +151 -0
  21. package/dist/src/engine/backlog-contract.js +200 -0
  22. package/dist/src/engine/business-tools.js +118 -0
  23. package/dist/src/engine/consumption.js +134 -0
  24. package/dist/src/engine/coordinator-engine.js +1 -0
  25. package/dist/src/engine/council.js +204 -0
  26. package/dist/src/engine/delegated.js +190 -0
  27. package/dist/src/engine/dispatch-loop.js +84 -0
  28. package/dist/src/engine/durable-run-state.js +251 -0
  29. package/dist/src/engine/embedded-prompt.js +35 -0
  30. package/dist/src/engine/embedded-roles.js +133 -0
  31. package/dist/src/engine/embedded.js +1023 -0
  32. package/dist/src/engine/federation.js +96 -0
  33. package/dist/src/engine/field-cipher.js +84 -0
  34. package/dist/src/engine/gates.js +241 -0
  35. package/dist/src/engine/markdown-table.js +43 -0
  36. package/dist/src/engine/model-backend.js +16 -0
  37. package/dist/src/engine/persona-loader.js +132 -0
  38. package/dist/src/engine/persona.js +287 -0
  39. package/dist/src/engine/profiles.js +237 -0
  40. package/dist/src/engine/render/pptx-render-service.js +60 -0
  41. package/dist/src/engine/render/python-pptx-render-backend.js +117 -0
  42. package/dist/src/engine/render/render-backend.js +25 -0
  43. package/dist/src/engine/render-embedded.js +69 -0
  44. package/dist/src/engine/routing.js +275 -0
  45. package/dist/src/engine/run-params.js +70 -0
  46. package/dist/src/engine/run-state.js +132 -0
  47. package/dist/src/engine/run-worker.js +60 -0
  48. package/dist/src/engine/squad-history.js +136 -0
  49. package/dist/src/engine/squad-ledger.js +215 -0
  50. package/dist/src/engine/squad-memory-resources.js +218 -0
  51. package/dist/src/engine/squad-memory-state.js +57 -0
  52. package/dist/src/engine/squad-run-recorder.js +212 -0
  53. package/dist/src/engine/targeted-squad-memory.js +94 -0
  54. package/dist/src/engine/workspace.js +68 -0
  55. package/dist/src/observability/logger.js +75 -0
  56. package/dist/src/observability/redact.js +77 -0
  57. package/dist/src/paths.js +108 -0
  58. package/dist/src/router/router.js +88 -0
  59. package/dist/src/server-http.js +304 -0
  60. package/dist/src/server.js +237 -0
  61. package/dist/src/transports/http-core.js +1240 -0
  62. package/dist/src/transports/http.js +90 -0
  63. package/dist/src/transports/session-store.js +78 -0
  64. package/dist/src/transports/stdio.js +12 -0
  65. package/dist/src/worker-main.js +87 -0
  66. package/generated/copilot-studio-connector/README.md +44 -0
  67. package/generated/copilot-studio-connector/agent-instructions.md +90 -0
  68. package/generated/copilot-studio-connector/apiDefinition.swagger.json +60 -0
  69. package/generated/copilot-studio-connector/apiProperties.json +35 -0
  70. package/generated/copilot-studio-connector/connector.manifest.json +86 -0
  71. package/generated/mcp-tools.schema.json +462 -0
  72. package/package.json +61 -0
  73. package/tools.catalog.yml +397 -0
@@ -0,0 +1,133 @@
1
+ /**
2
+ * Embedded role charters for the hero tool(s).
3
+ *
4
+ * The thin slice runs ONE server-side dispatch per hero tool (`squad_research`
5
+ * → a single Squad Researcher; `squad_review` → a single Squad Reviewer). These
6
+ * constants are faithful, attributed PARAPHRASES of the deployed cast personas
7
+ * (the same DD-04 pattern used by `persona.ts`), embedded so the embedded engine
8
+ * is deterministic and testable without a deployed consumer on disk. In a
9
+ * deployed workspace the canonical `*.agent.md` personas remain authoritative;
10
+ * a from-disk loader is the follow-up that lets embedded and delegated share the
11
+ * exact same persona bytes (single-source invariant).
12
+ *
13
+ * Each charter is AUTHORITY — it becomes the model `system` prompt unchanged and
14
+ * never has caller `request`/`context` concatenated into it (SEC-5).
15
+ *
16
+ * ADVISORY scope: the deployed charters own on-disk artifacts under
17
+ * `.copilot-tracking/` and delegate to workers. The embedded boundary produces
18
+ * finished TEXT and dispatches nothing, so these paraphrases carry the role's
19
+ * method and refusals without the artifact-writing and delegation contracts.
20
+ */
21
+ import { loadPersonaForRole } from "./persona-loader.js";
22
+ /** Paraphrased Squad Researcher charter (squad `researcher` role). */
23
+ export const SQUAD_RESEARCHER_CHARTER = [
24
+ "You are the **Squad Researcher**, a read-first investigator dispatched by the",
25
+ "Squad Coordinator. You own the research stage: you gather evidence and frame",
26
+ "findings the Plan stage can be driven from; you do NOT plan, implement, or",
27
+ "land changes. Investigate the task described in the untrusted data, ground",
28
+ "every claim in concrete evidence, separate verified fact from inference, and",
29
+ "produce a concise, well-structured research artifact: a short summary, the key",
30
+ "findings with their evidence, options with trade-offs where relevant, and",
31
+ "explicit open questions. Record gaps rather than closing them with assumption.",
32
+ "Stay within scope; when the task is ambiguous, state the ambiguity rather than",
33
+ "inventing facts.",
34
+ ].join("\n");
35
+ /** Paraphrased Squad Reviewer charter (squad `tester` role). */
36
+ export const SQUAD_REVIEWER_CHARTER = [
37
+ "You are the **Squad Reviewer**, a quality and correctness reviewer dispatched",
38
+ "by the Squad Coordinator. You assess the work described in the untrusted data",
39
+ "against the plan it was built from — correctness, error handling, edge cases,",
40
+ "security, standards alignment, and risk. You are read-only with respect to the",
41
+ "implementation: you report what you find and never fix it. Produce a structured",
42
+ "review: a verdict, the findings ordered by severity, the evidence for each",
43
+ "(with a file-and-line reference where one applies), and concrete follow-ups.",
44
+ "Report every deviation from the plan — work planned but not done, work done but",
45
+ "not planned, and work done differently than planned. An unflattering finding is",
46
+ "a successful review; never soften or omit one to make the run look complete.",
47
+ "When the review is a pre-implementation go/no-go, state the decision and the",
48
+ "conditions explicitly.",
49
+ ].join("\n");
50
+ /**
51
+ * Paraphrased Squad Federation Coordinator charter (the `squad_federate` meta
52
+ * role). Embedded so a federation run resolves a persona even in a minimal image
53
+ * with no deployed cast on disk — exactly the fallback the two hero roles get.
54
+ * In a deployed workspace the on-disk `squad-federation-coordinator.agent.md` wins
55
+ * (single-source invariant); this only prevents `role_not_resolvable`.
56
+ *
57
+ * ADVISORY scope: the embedded boundary produces finished TEXT. This charter
58
+ * therefore describes the federation ROUTING DECISION and per-sub-squad plan as
59
+ * the deliverable — it does not claim to dispatch sub-squads (that is the
60
+ * delegated host's job).
61
+ */
62
+ export const FEDERATION_COORDINATOR_CHARTER = [
63
+ "You are the **Squad Federation Coordinator**, a meta-orchestrator of several",
64
+ "named sub-squads in one repository. You read the federation registry",
65
+ "(`.copilot-tracking/squad/federation.md`) and meta-routing",
66
+ "(`.copilot-tracking/squad/meta-routing.md`), classify the request in the",
67
+ "untrusted data to one or more sub-squads, and scope each sub-squad's turn to",
68
+ "`.copilot-tracking/squad/members/<name>/`.",
69
+ "",
70
+ "You are running in ADVISORY scope: produce the federation decision as text.",
71
+ "State (1) the selected sub-squad(s) and why meta-routing selected each,",
72
+ "(2) the work scoped to each sub-squad, (3) the order and any dependencies",
73
+ "between them, (4) the federation-level risks, gates, and escalations, and",
74
+ "(5) the consolidated outcome you expect. Every sub-squad name is",
75
+ "lower-kebab-case and must already exist in the registry unless the turn is an",
76
+ "explicit init/promote turn; on an unknown or ambiguous target, say so and",
77
+ "escalate rather than inventing a sub-squad.",
78
+ ].join("\n");
79
+ /** Resolve the system-authority charter for an embedded role, or `undefined`. */
80
+ export function charterForRole(role) {
81
+ switch (role) {
82
+ case "Squad Researcher":
83
+ return SQUAD_RESEARCHER_CHARTER;
84
+ case "Squad Reviewer":
85
+ return SQUAD_REVIEWER_CHARTER;
86
+ default:
87
+ return undefined;
88
+ }
89
+ }
90
+ /**
91
+ * Paraphrased fallback records, used when the deployed cast is not on disk (CI /
92
+ * minimal image). These carry an empty `applyTo` because the paraphrase is not a
93
+ * real `*.agent.md` file.
94
+ */
95
+ const PARAPHRASE_RECORDS = {
96
+ "Squad Researcher": { role: "Squad Researcher", charter: SQUAD_RESEARCHER_CHARTER, applyTo: [] },
97
+ "Squad Reviewer": { role: "Squad Reviewer", charter: SQUAD_REVIEWER_CHARTER, applyTo: [] },
98
+ "Squad Federation Coordinator": {
99
+ role: "Squad Federation Coordinator",
100
+ charter: FEDERATION_COORDINATOR_CHARTER,
101
+ applyTo: [],
102
+ },
103
+ };
104
+ /**
105
+ * Resolve a role's persona for the embedded pipeline, preferring the REAL on-disk
106
+ * `*.agent.md` bytes (single-source invariant) and falling back to the paraphrased
107
+ * record when the deployed cast is absent. This is the from-disk entry point the
108
+ * dispatch loop consumes; `charterForRole` is intentionally left unchanged so the
109
+ * single hero-dispatch path stays deterministic for the SEC-5 conformance suites.
110
+ */
111
+ export function resolvePersonaForRole(role, roots) {
112
+ const loaded = roots ? loadPersonaForRole(role, roots) : loadPersonaForRole(role);
113
+ return loaded ?? PARAPHRASE_RECORDS[role];
114
+ }
115
+ /**
116
+ * Resolve a persona for a squad ROLE KEY (e.g. `"architect"`) by mapping the
117
+ * role key to the deployed agent `name:` via the injected `rosterMap`, then
118
+ * resolving that agent name through {@link resolvePersonaForRole} (real on-disk
119
+ * bytes first, hero paraphrase fallback only when the mapped agent is one of the
120
+ * two deterministic hero roles and the cast is absent).
121
+ *
122
+ * Roster PARSING is intentionally NOT done here (that is the routing engine's
123
+ * job); this helper only consumes an already-parsed role -> agent-name map, so
124
+ * the loader layer stays roster-map-injectable. Returns `undefined` when the
125
+ * role key is absent from the map or the mapped persona cannot be resolved.
126
+ */
127
+ export function resolvePersonaForRosterRole(roleKey, rosterMap, roots) {
128
+ const agentName = rosterMap.get(roleKey);
129
+ if (!agentName) {
130
+ return undefined;
131
+ }
132
+ return resolvePersonaForRole(agentName, roots);
133
+ }