@jungjaehoon/mama-os 0.48.4 → 0.49.1

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 (166) hide show
  1. package/dist/agent/agent-loop.d.ts +6 -7
  2. package/dist/agent/agent-loop.d.ts.map +1 -1
  3. package/dist/agent/agent-loop.js +106 -80
  4. package/dist/agent/agent-loop.js.map +1 -1
  5. package/dist/agent/code-act/host-bridge.d.ts.map +1 -1
  6. package/dist/agent/code-act/host-bridge.js +7 -9
  7. package/dist/agent/code-act/host-bridge.js.map +1 -1
  8. package/dist/agent/codex-home.d.ts.map +1 -1
  9. package/dist/agent/codex-home.js +3 -1
  10. package/dist/agent/codex-home.js.map +1 -1
  11. package/dist/agent/gateway-tool-executor.d.ts +0 -16
  12. package/dist/agent/gateway-tool-executor.d.ts.map +1 -1
  13. package/dist/agent/gateway-tool-executor.js +0 -51
  14. package/dist/agent/gateway-tool-executor.js.map +1 -1
  15. package/dist/agent/gateway-tools.md +1 -2
  16. package/dist/agent/os-agent-capabilities.md +14 -34
  17. package/dist/agent/role-manager.d.ts.map +1 -1
  18. package/dist/agent/role-manager.js +6 -3
  19. package/dist/agent/role-manager.js.map +1 -1
  20. package/dist/agent/tool-registry.d.ts.map +1 -1
  21. package/dist/agent/tool-registry.js +27 -8
  22. package/dist/agent/tool-registry.js.map +1 -1
  23. package/dist/agent/types.d.ts +20 -6
  24. package/dist/agent/types.d.ts.map +1 -1
  25. package/dist/agent/types.js.map +1 -1
  26. package/dist/api/graph-api-types.d.ts +0 -18
  27. package/dist/api/graph-api-types.d.ts.map +1 -1
  28. package/dist/api/graph-api.d.ts.map +1 -1
  29. package/dist/api/graph-api.js +9 -81
  30. package/dist/api/graph-api.js.map +1 -1
  31. package/dist/cli/commands/start.d.ts +7 -16
  32. package/dist/cli/commands/start.d.ts.map +1 -1
  33. package/dist/cli/commands/start.js +188 -189
  34. package/dist/cli/commands/start.js.map +1 -1
  35. package/dist/cli/config/types.d.ts.map +1 -1
  36. package/dist/cli/config/types.js +11 -4
  37. package/dist/cli/config/types.js.map +1 -1
  38. package/dist/cli/runtime/agent-loop-init.d.ts.map +1 -1
  39. package/dist/cli/runtime/agent-loop-init.js +31 -11
  40. package/dist/cli/runtime/agent-loop-init.js.map +1 -1
  41. package/dist/cli/runtime/api-routes-init.d.ts +0 -2
  42. package/dist/cli/runtime/api-routes-init.d.ts.map +1 -1
  43. package/dist/cli/runtime/api-routes-init.js +9 -95
  44. package/dist/cli/runtime/api-routes-init.js.map +1 -1
  45. package/dist/cli/runtime/api-server-init.d.ts +2 -2
  46. package/dist/cli/runtime/api-server-init.d.ts.map +1 -1
  47. package/dist/cli/runtime/api-server-init.js +2 -2
  48. package/dist/cli/runtime/api-server-init.js.map +1 -1
  49. package/dist/cli/runtime/scheduler-init.d.ts +3 -4
  50. package/dist/cli/runtime/scheduler-init.d.ts.map +1 -1
  51. package/dist/cli/runtime/scheduler-init.js +6 -16
  52. package/dist/cli/runtime/scheduler-init.js.map +1 -1
  53. package/dist/cli/runtime/shutdown.d.ts +0 -1
  54. package/dist/cli/runtime/shutdown.d.ts.map +1 -1
  55. package/dist/cli/runtime/shutdown.js +1 -1
  56. package/dist/cli/runtime/shutdown.js.map +1 -1
  57. package/dist/cli/runtime/types.d.ts +0 -5
  58. package/dist/cli/runtime/types.d.ts.map +1 -1
  59. package/dist/concurrency/lane-manager.d.ts +1 -1
  60. package/dist/concurrency/lane-manager.d.ts.map +1 -1
  61. package/dist/concurrency/lane-manager.js +4 -2
  62. package/dist/concurrency/lane-manager.js.map +1 -1
  63. package/dist/concurrency/types.d.ts +4 -0
  64. package/dist/concurrency/types.d.ts.map +1 -1
  65. package/dist/concurrency/types.js.map +1 -1
  66. package/dist/envelope/types.d.ts +1 -1
  67. package/dist/envelope/types.d.ts.map +1 -1
  68. package/dist/envelope/types.js.map +1 -1
  69. package/dist/gateways/message-router.d.ts +15 -71
  70. package/dist/gateways/message-router.d.ts.map +1 -1
  71. package/dist/gateways/message-router.js +124 -493
  72. package/dist/gateways/message-router.js.map +1 -1
  73. package/dist/gateways/session-store.d.ts +3 -23
  74. package/dist/gateways/session-store.d.ts.map +1 -1
  75. package/dist/gateways/session-store.js +2 -64
  76. package/dist/gateways/session-store.js.map +1 -1
  77. package/dist/gateways/telegram-report-context-store.d.ts +4 -66
  78. package/dist/gateways/telegram-report-context-store.d.ts.map +1 -1
  79. package/dist/gateways/telegram-report-context-store.js +11 -235
  80. package/dist/gateways/telegram-report-context-store.js.map +1 -1
  81. package/dist/gateways/turn-contract.d.ts +7 -3
  82. package/dist/gateways/turn-contract.d.ts.map +1 -1
  83. package/dist/operator/operator-trigger-loop.d.ts +1 -12
  84. package/dist/operator/operator-trigger-loop.d.ts.map +1 -1
  85. package/dist/operator/operator-trigger-loop.js +6 -40
  86. package/dist/operator/operator-trigger-loop.js.map +1 -1
  87. package/dist/operator/owner-event-loop.d.ts +9 -8
  88. package/dist/operator/owner-event-loop.d.ts.map +1 -1
  89. package/dist/operator/owner-event-loop.js +8 -22
  90. package/dist/operator/owner-event-loop.js.map +1 -1
  91. package/dist/operator/owner-event-policy.d.ts.map +1 -1
  92. package/dist/operator/owner-event-policy.js +0 -2
  93. package/dist/operator/owner-event-policy.js.map +1 -1
  94. package/dist/operator/owner-event-prompt.d.ts +0 -2
  95. package/dist/operator/owner-event-prompt.d.ts.map +1 -1
  96. package/dist/operator/owner-event-prompt.js +1 -8
  97. package/dist/operator/owner-event-prompt.js.map +1 -1
  98. package/dist/operator/owner-runtime-journal.d.ts +21 -0
  99. package/dist/operator/owner-runtime-journal.d.ts.map +1 -0
  100. package/dist/operator/owner-runtime-journal.js +131 -0
  101. package/dist/operator/owner-runtime-journal.js.map +1 -0
  102. package/dist/operator/owner-runtime.d.ts +32 -0
  103. package/dist/operator/owner-runtime.d.ts.map +1 -0
  104. package/dist/operator/owner-runtime.js +31 -0
  105. package/dist/operator/owner-runtime.js.map +1 -0
  106. package/dist/operator/pending-report-store.d.ts +2 -2
  107. package/dist/operator/pending-report-store.d.ts.map +1 -1
  108. package/dist/operator/pending-report-store.js +4 -1
  109. package/dist/operator/pending-report-store.js.map +1 -1
  110. package/dist/operator/report-run.d.ts +7 -10
  111. package/dist/operator/report-run.d.ts.map +1 -1
  112. package/dist/operator/report-run.js +5 -26
  113. package/dist/operator/report-run.js.map +1 -1
  114. package/dist/operator/situation-report.d.ts +25 -6
  115. package/dist/operator/situation-report.d.ts.map +1 -1
  116. package/dist/operator/situation-report.js +28 -37
  117. package/dist/operator/situation-report.js.map +1 -1
  118. package/dist/operator/task-ledger.d.ts +8 -1
  119. package/dist/operator/task-ledger.d.ts.map +1 -1
  120. package/dist/operator/task-ledger.js +51 -16
  121. package/dist/operator/task-ledger.js.map +1 -1
  122. package/dist/operator/task-list-views.d.ts.map +1 -1
  123. package/dist/operator/task-list-views.js +45 -24
  124. package/dist/operator/task-list-views.js.map +1 -1
  125. package/dist/operator/task-temporal.d.ts +3 -0
  126. package/dist/operator/task-temporal.d.ts.map +1 -1
  127. package/dist/operator/task-temporal.js +12 -0
  128. package/dist/operator/task-temporal.js.map +1 -1
  129. package/dist/operator/trigger-author.d.ts +0 -45
  130. package/dist/operator/trigger-author.d.ts.map +1 -1
  131. package/dist/operator/trigger-author.js +0 -122
  132. package/dist/operator/trigger-author.js.map +1 -1
  133. package/dist/operator/worker-run.d.ts +9 -23
  134. package/dist/operator/worker-run.d.ts.map +1 -1
  135. package/dist/operator/worker-run.js +18 -74
  136. package/dist/operator/worker-run.js.map +1 -1
  137. package/dist/operator/workorder-consumer.d.ts.map +1 -1
  138. package/dist/operator/workorder-consumer.js +7 -0
  139. package/dist/operator/workorder-consumer.js.map +1 -1
  140. package/dist/scheduler/cron-worker.d.ts +0 -3
  141. package/dist/scheduler/cron-worker.d.ts.map +1 -1
  142. package/dist/scheduler/cron-worker.js +2 -13
  143. package/dist/scheduler/cron-worker.js.map +1 -1
  144. package/dist/scheduler/heartbeat.d.ts +3 -1
  145. package/dist/scheduler/heartbeat.d.ts.map +1 -1
  146. package/dist/scheduler/heartbeat.js +13 -4
  147. package/dist/scheduler/heartbeat.js.map +1 -1
  148. package/dist/validation/types.d.ts +1 -1
  149. package/dist/validation/types.js +1 -1
  150. package/package.json +1 -1
  151. package/dist/cli/runtime/memory-agent-init.d.ts +0 -37
  152. package/dist/cli/runtime/memory-agent-init.d.ts.map +0 -1
  153. package/dist/cli/runtime/memory-agent-init.js +0 -202
  154. package/dist/cli/runtime/memory-agent-init.js.map +0 -1
  155. package/dist/gateways/owner-report-inbox.d.ts +0 -40
  156. package/dist/gateways/owner-report-inbox.d.ts.map +0 -1
  157. package/dist/gateways/owner-report-inbox.js +0 -128
  158. package/dist/gateways/owner-report-inbox.js.map +0 -1
  159. package/dist/multi-agent/memory-agent-persona.d.ts +0 -11
  160. package/dist/multi-agent/memory-agent-persona.d.ts.map +0 -1
  161. package/dist/multi-agent/memory-agent-persona.js +0 -175
  162. package/dist/multi-agent/memory-agent-persona.js.map +0 -1
  163. package/dist/operator/report-context.d.ts +0 -184
  164. package/dist/operator/report-context.d.ts.map +0 -1
  165. package/dist/operator/report-context.js +0 -1052
  166. package/dist/operator/report-context.js.map +0 -1
@@ -1,175 +0,0 @@
1
- "use strict";
2
- /**
3
- * Default persona for the memory agent.
4
- * Written to ~/.mama/personas/memory.md on first use if not present.
5
- */
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.MEMORY_AGENT_PERSONA = void 0;
8
- exports.ensureMemoryPersona = ensureMemoryPersona;
9
- const fs_1 = require("fs");
10
- const path_1 = require("path");
11
- const os_1 = require("os");
12
- const MANAGED_MEMORY_PERSONA_MARKER = '<!-- MAMA managed memory persona v6 -->';
13
- exports.MEMORY_AGENT_PERSONA = `${MANAGED_MEMORY_PERSONA_MARKER}
14
-
15
- You are MAMA's memory auditor and curator — an internal agent that watches conversations, maintains current truth, and advises the main agent when memory matters.
16
-
17
- ## Your Role
18
- - Observe every conversation turn between users and the main agent
19
- - Distinguish time-ordered memory history from current truth
20
- - Use memory tools directly to inspect, evolve, and save memory
21
- - Notify the main agent only when evidence-backed memory findings are relevant
22
- - Never rely on the caller to parse JSON and save for you
23
-
24
- ## Topic Rules
25
- - MUST reuse existing topic if same subject (provided in context)
26
- - Use lowercase snake_case: auth_strategy, database_choice
27
- - Same topic = evolution chain (supersedes)
28
- - Related topic = builds_on or synthesizes
29
-
30
- ## Mandatory Tool Workflow
31
- Keep the workflow minimal and terminate quickly.
32
-
33
- **Step 1 — ALWAYS call \`mama_search\` first.**
34
- Search for existing memories related to the conversation topic. This is mandatory even if you believe nothing is worth saving — you need context to make that judgment.
35
-
36
- **Step 2 — Decide: save or no-op.**
37
- Based on search results and the conversation, decide whether to save or skip.
38
-
39
- **Step 3 — Call \`mama_save\` when the conversation contains ANY of these:**
40
- - A decision, preference, or technical choice
41
- - A constraint, requirement, or lesson learned
42
- - A fact about architecture, tooling, or workflow
43
- - A change that supersedes a prior memory
44
-
45
- When calling \`mama_save\`, always include the \`scopes\` field from the Memory scopes listed at the top of the prompt. Parse the scope entries (e.g., "project:/path, channel:telegram:123") into \`[{kind: "project", id: "/path"}, {kind: "channel", id: "telegram:123"}]\`.
46
-
47
- **Step 4 — Only skip (no-op) when the conversation is ALL of these:**
48
- - Pure greeting, thanks, or confirmation ("ok", "got it", "thanks")
49
- - Contains zero decisions, preferences, facts, or choices
50
- - Even then, you must have called \`mama_search\` first before deciding to skip
51
-
52
- ## Strict Limits
53
- - Call \`mama_search\` at most once per audit.
54
- - Call \`mama_save\` at most once per audit.
55
- - Do NOT call resource discovery tools such as \`list_mcp_resources\` or \`list_mcp_resource_templates\`.
56
- - Do NOT ask follow-up questions.
57
- - Do NOT continue reasoning after the required tool calls finish.
58
- - After finishing tool work, respond with exactly one token:
59
- - \`DONE\` if a save occurred
60
- - \`SKIP\` if nothing should be saved
61
-
62
- ## Relationship Types
63
- - supersedes: replaces a previous decision on same topic
64
- - builds_on: adds information to existing topic without replacing
65
- - synthesizes: merges multiple decisions or infers connections
66
-
67
- ## Truth Model
68
- - Preserve history, but maintain current truth separately
69
- - Old memories may remain in history while becoming stale, contradicted, or superseded
70
- - When uncertain about relationship type, prefer builds_on over supersedes to avoid data loss
71
-
72
- ## Temporal Marker Extraction
73
-
74
- When the conversation contains relative time expressions, extract an explicit event_date and include it in \`mama_save\` as the \`event_date\` field (ISO 8601: "YYYY-MM-DD").
75
-
76
- **Extract event_date when you see:**
77
- - Yesterday → today - 1 day
78
- - Last week / last month → approximate Monday or 1st of previous period
79
- - "In March", "in January 2023" → first day of that month (e.g., "2023-03-01")
80
- - "A year ago", "3 months ago" → today minus that duration
81
- - "On Tuesday", "last Friday" → nearest past occurrence of that weekday
82
- - An explicit date mentioned in the conversation (e.g., "December 28th")
83
-
84
- **How to apply:**
85
- 1. Identify the most precise date derivable from context
86
- 2. Pass \`event_date: "YYYY-MM-DD"\` in \`mama_save\` alongside the decision
87
- 3. If no temporal marker is present, omit event_date (system defaults to created_at)
88
-
89
- ## What to Save
90
- - Architecture decisions, technical choices, tooling preferences
91
- - User preferences and working style
92
- - Constraints, requirements, lessons learned
93
- - Decision changes that should supersede prior memory
94
-
95
- ## What to Skip
96
- - Greetings, casual chat, thanks
97
- - Questions without answers
98
- - Temporary debugging steps
99
- - Code snippets
100
-
101
- ## Response Rules
102
- - You MUST call at least \`mama_search\` before any text response.
103
- - Do not return JSON for the caller to parse
104
- - Do the memory work yourself with tools, then terminate immediately with \`DONE\` or \`SKIP\`
105
- - When in doubt, save — false negatives (missing a memory) are worse than false positives
106
- - You are an internal subagent, not the user-facing assistant
107
-
108
- ## PROMOTION RUN mode
109
- When an incoming message begins with "PROMOTION RUN", it is a scheduled batch
110
- pass over recent business data, NOT a turn audit. In this mode ONLY:
111
- - The per-audit limits above do not apply: you may call mama_search several
112
- times and mama_save up to 5 times, and you gather evidence yourself with
113
- the business-data tools projected for this run plus agent_notices as the run
114
- instructions describe.
115
- - Promote ONLY durable judgments: pricing/scope agreements, a client's standing
116
- preference or boundary, a process rule, a recurring risk pattern. Things that
117
- change how future work is done.
118
- - NEVER promote task lifecycle states ("X was submitted", "Y is in progress") --
119
- the task board owns those. Never promote greetings, scheduling chatter, or
120
- one-off logistics.
121
- - Every save needs scopes (parse from the run instructions or the source
122
- channel) and an event_date for when the judgment was actually made.
123
- - Reuse existing topics found via mama_search so evolution chains stay intact.
124
- - Finish with exactly one line: \`PROMOTED <n>\` (n = number of saves) or
125
- \`NO_UPDATE\` when nothing qualifies. When in doubt in THIS mode, do NOT save --
126
- promotion is curation, and a wrong policy in memory misleads every consumer.`;
127
- function isLegacyManagedPersona(content) {
128
- // v1: old JSON-return persona
129
- if (content.includes("You are MAMA's memory agent") &&
130
- (content.includes('Return ONLY a JSON object') ||
131
- content.includes('Return ONLY JSON') ||
132
- content.includes('Return ONLY the JSON'))) {
133
- return true;
134
- }
135
- // v2: soft tool instructions (didn't enforce tool calls)
136
- if (content.includes('<!-- MAMA managed memory persona v2 -->')) {
137
- return true;
138
- }
139
- // v3: allowed too many follow-up turns and resource-discovery loops
140
- if (content.includes('<!-- MAMA managed memory persona v3 -->')) {
141
- return true;
142
- }
143
- // v4: missing temporal marker extraction
144
- if (content.includes('<!-- MAMA managed memory persona v4 -->')) {
145
- return true;
146
- }
147
- return false;
148
- }
149
- /**
150
- * Ensure persona file exists at ~/.mama/personas/memory.md
151
- * Creates it from default if not present and upgrades legacy managed personas.
152
- */
153
- function ensureMemoryPersona(mamaHomeDir = (0, path_1.join)((0, os_1.homedir)(), '.mama')) {
154
- const personaDir = (0, path_1.join)(mamaHomeDir, 'personas');
155
- const personaPath = (0, path_1.join)(personaDir, 'memory.md');
156
- if (!(0, fs_1.existsSync)(personaDir)) {
157
- (0, fs_1.mkdirSync)(personaDir, { recursive: true });
158
- }
159
- if (!(0, fs_1.existsSync)(personaPath)) {
160
- (0, fs_1.writeFileSync)(personaPath, exports.MEMORY_AGENT_PERSONA, 'utf-8');
161
- return personaPath;
162
- }
163
- const existingContent = (0, fs_1.readFileSync)(personaPath, 'utf-8');
164
- if (isLegacyManagedPersona(existingContent)) {
165
- (0, fs_1.writeFileSync)(personaPath, exports.MEMORY_AGENT_PERSONA, 'utf-8');
166
- }
167
- // Upgrade ANY older managed persona version (match the marker prefix, not the
168
- // exact current version -- an exact match can never upgrade v5 -> v6).
169
- if (existingContent.includes('<!-- MAMA managed memory persona') &&
170
- existingContent !== exports.MEMORY_AGENT_PERSONA) {
171
- (0, fs_1.writeFileSync)(personaPath, exports.MEMORY_AGENT_PERSONA, 'utf-8');
172
- }
173
- return personaPath;
174
- }
175
- //# sourceMappingURL=memory-agent-persona.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"memory-agent-persona.js","sourceRoot":"","sources":["../../src/multi-agent/memory-agent-persona.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAwJH,kDA4BC;AAlLD,2BAAwE;AACxE,+BAA4B;AAC5B,2BAA6B;AAE7B,MAAM,6BAA6B,GAAG,yCAAyC,CAAC;AAEnE,QAAA,oBAAoB,GAAG,GAAG,6BAA6B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;+EAiHW,CAAC;AAEhF,SAAS,sBAAsB,CAAC,OAAe;IAC7C,8BAA8B;IAC9B,IACE,OAAO,CAAC,QAAQ,CAAC,6BAA6B,CAAC;QAC/C,CAAC,OAAO,CAAC,QAAQ,CAAC,2BAA2B,CAAC;YAC5C,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CAAC;YACpC,OAAO,CAAC,QAAQ,CAAC,sBAAsB,CAAC,CAAC,EAC3C,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IACD,yDAAyD;IACzD,IAAI,OAAO,CAAC,QAAQ,CAAC,yCAAyC,CAAC,EAAE,CAAC;QAChE,OAAO,IAAI,CAAC;IACd,CAAC;IACD,oEAAoE;IACpE,IA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;AACrB,CAAC"}
@@ -1,184 +0,0 @@
1
- import type { MemoryScopeRef } from '@jungjaehoon/mama-core';
2
- import type { MemoryTruthRow } from '@jungjaehoon/mama-core/memory/types';
3
- import type { TrelloKanbanSnapshot } from '../connectors/trello/query-tools.js';
4
- import type { ChangesReadFailure, ChangesReadInput, ChangesReadResult } from './changes-projection.js';
5
- import type { CorrelationInput, CorrelationOutcome, CorrelationReason, CorrelationResult } from './external-correlation.js';
6
- import type { ListTasksPage } from './task-ledger.js';
7
- export interface OwnerReportReadScope {
8
- projectRefs: Array<{
9
- kind: 'project';
10
- id: string;
11
- }>;
12
- memoryScopes: MemoryScopeRef[];
13
- rawConnectors: string[];
14
- }
15
- export interface ReportWindowEvidence {
16
- start: string;
17
- end: string;
18
- channelCount: number;
19
- messageCount: number;
20
- channels: Array<{
21
- label: string;
22
- count: number;
23
- excerpts: Array<{
24
- authorLabel: string;
25
- text: string;
26
- observedAt: string | null;
27
- }>;
28
- }>;
29
- triggerActivity: Array<{
30
- kind: string;
31
- count: number;
32
- topics: string[];
33
- }>;
34
- }
35
- export type SourceState = {
36
- state: 'complete';
37
- observedAt: string;
38
- } | {
39
- state: 'partial';
40
- observedAt: string | null;
41
- reason: string;
42
- } | {
43
- state: 'unavailable';
44
- observedAt: null;
45
- reason: string;
46
- };
47
- export interface CurrentClaimSummary {
48
- id: string;
49
- topic: string;
50
- summary: string;
51
- status: string;
52
- confidence: number;
53
- }
54
- export interface OwnerTaskSummary {
55
- id: number;
56
- revision: number;
57
- title: string;
58
- status: string;
59
- latestEvent: string | null;
60
- updatedAt: string;
61
- /** Owner-entered ISO date (YYYY-MM-DD) or null. Overdue work is unanswerable without it. */
62
- deadline: string | null;
63
- /** Host-derived RFC 3339 instant (e.g. review + 14 days) or null. */
64
- dueAt: string | null;
65
- sourceLabel: string | null;
66
- }
67
- export interface TrelloReportSnapshot {
68
- observedAt: string;
69
- complete: boolean;
70
- truncated: boolean;
71
- boards: Array<{
72
- board: string;
73
- status: 'ok' | 'failed';
74
- rosterDegraded: boolean;
75
- }>;
76
- columns: Array<{
77
- board: string;
78
- list: string;
79
- count: number;
80
- returned: number;
81
- cards: Array<{
82
- name: string;
83
- labels: string[];
84
- assignees: string[];
85
- due: string | null;
86
- lastActivity: string;
87
- }>;
88
- }>;
89
- }
90
- export interface CorrelationReport {
91
- coverage: Record<CorrelationOutcome | 'total', number>;
92
- rows: Array<{
93
- taskId: number;
94
- outcome: CorrelationOutcome;
95
- reason: CorrelationReason;
96
- live: {
97
- board: string;
98
- list: string;
99
- } | null;
100
- }>;
101
- }
102
- export interface ChangesReport {
103
- since: string;
104
- total: number;
105
- returned: number;
106
- coverage: {
107
- attributed: number;
108
- unattributed: number;
109
- };
110
- rows: Array<{
111
- kind: string;
112
- targetType: string;
113
- causeState: 'attributed' | 'unattributed';
114
- causeKind: string;
115
- at: string;
116
- }>;
117
- }
118
- export interface OwnerReportContextV1 {
119
- schemaVersion: 'mama.owner-report-context/v1';
120
- observedAt: string;
121
- windowEvidence: ReportWindowEvidence;
122
- sources: Record<'claims' | 'tasks' | 'trello' | 'changes', SourceState>;
123
- packet: {
124
- bytes: number;
125
- truncated: boolean;
126
- };
127
- taskCoverage: {
128
- total: number;
129
- returned: number;
130
- truncated: boolean;
131
- };
132
- currentClaims: CurrentClaimSummary[];
133
- tasks: OwnerTaskSummary[];
134
- trello: TrelloReportSnapshot;
135
- correlations: CorrelationReport;
136
- changes: ChangesReport;
137
- caveats: string[];
138
- /** The system's own open failures (One MAMA Phase 3); bounded to 20, highest severity first. */
139
- operationalIssues: OperationalIssueSummary[];
140
- }
141
- export interface OperationalIssueSummary {
142
- issueId: string;
143
- surface: string;
144
- severity: 'info' | 'warn' | 'error';
145
- summary: string;
146
- occurrences: number;
147
- firstSeenAt: string;
148
- }
149
- export interface OwnerReportContextDeps {
150
- listTaskPage(input: {
151
- includeTerminal: false;
152
- order: 'updated';
153
- limit: number;
154
- cursor?: string;
155
- }): ListTasksPage;
156
- readClaims(scope: OwnerReportReadScope): Promise<MemoryTruthRow[]>;
157
- readTrello(scope: OwnerReportReadScope): Promise<TrelloKanbanSnapshot>;
158
- buildProvenanceLookup(): Promise<CorrelationInput['lookupProvenance']>;
159
- correlate(input: CorrelationInput): CorrelationResult;
160
- readChanges(scope: OwnerReportReadScope, input: ChangesReadInput, nowMs: number): ChangesReadResult | ChangesReadFailure;
161
- now(): number;
162
- /** Open operational issues, already redacted; optional so packet tests need no issue store. */
163
- readOperationalIssues?(): OperationalIssueSummary[];
164
- }
165
- export declare function serializeOwnerReportContext(packet: OwnerReportContextV1): string;
166
- export declare const MAX_OPERATIONAL_ISSUES = 20;
167
- export declare function compileOwnerReportContext(input: {
168
- readScope: OwnerReportReadScope;
169
- windowEvidence: ReportWindowEvidence;
170
- since: string;
171
- }, deps: OwnerReportContextDeps): Promise<OwnerReportContextV1>;
172
- /**
173
- * One MAMA (Phase 1 Task 3): the event turn starts from the same host-compiled
174
- * packet as the report, narrowed to its channel. The read scope MUST be the
175
- * owner-event scope the run's envelope holds - reading under another principal
176
- * is the mismatch that fails the envelope scope audit.
177
- */
178
- export declare function compileChannelPacket(input: {
179
- readScope: OwnerReportReadScope;
180
- channelKey: string;
181
- eventIds: string[];
182
- since: string;
183
- }, deps: OwnerReportContextDeps): Promise<OwnerReportContextV1>;
184
- //# sourceMappingURL=report-context.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"report-context.d.ts","sourceRoot":"","sources":["../../src/operator/report-context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAC;AAE1E,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,qCAAqC,CAAC;AAEhF,OAAO,KAAK,EACV,kBAAkB,EAClB,gBAAgB,EAChB,iBAAiB,EAClB,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,EACV,gBAAgB,EAChB,kBA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