@rubytech/create-maxy-code 0.1.417 → 0.1.423

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 (165) hide show
  1. package/dist/__tests__/brand-port-uniqueness.test.js +74 -0
  2. package/dist/known-brands.js +1 -0
  3. package/package.json +1 -1
  4. package/payload/platform/config/brand-registry.json +8 -0
  5. package/payload/platform/lib/active-rules/dist/index.d.ts +35 -0
  6. package/payload/platform/lib/active-rules/dist/index.d.ts.map +1 -0
  7. package/payload/platform/lib/active-rules/dist/index.js +94 -0
  8. package/payload/platform/lib/active-rules/dist/index.js.map +1 -0
  9. package/payload/platform/lib/active-rules/package.json +7 -0
  10. package/payload/platform/lib/active-rules/src/index.test.ts +89 -0
  11. package/payload/platform/lib/active-rules/src/index.ts +133 -0
  12. package/payload/platform/lib/active-rules/tsconfig.json +9 -0
  13. package/payload/platform/package-lock.json +5158 -2922
  14. package/payload/platform/package.json +4 -3
  15. package/payload/platform/plugins/admin/hooks/__tests__/prompt-optimiser-compliance.test.sh +22 -0
  16. package/payload/platform/plugins/admin/hooks/prompt-optimiser-compliance.sh +14 -1
  17. package/payload/platform/plugins/admin/skills/platform-architecture/SKILL.md +16 -2
  18. package/payload/platform/plugins/docs/references/internals.md +10 -0
  19. package/payload/platform/plugins/docs/references/memory-guide.md +4 -0
  20. package/payload/platform/plugins/docs/references/outlook-guide.md +1 -1
  21. package/payload/platform/plugins/memory/PLUGIN.md +3 -0
  22. package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/profile-read-active-rules.test.d.ts +2 -0
  23. package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/profile-read-active-rules.test.d.ts.map +1 -0
  24. package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/profile-read-active-rules.test.js +49 -0
  25. package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/profile-read-active-rules.test.js.map +1 -0
  26. package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/profile-update-reconcile.test.d.ts +2 -0
  27. package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/profile-update-reconcile.test.d.ts.map +1 -0
  28. package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/profile-update-reconcile.test.js +99 -0
  29. package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/profile-update-reconcile.test.js.map +1 -0
  30. package/payload/platform/plugins/memory/mcp/dist/tools/profile-read.d.ts +3 -0
  31. package/payload/platform/plugins/memory/mcp/dist/tools/profile-read.d.ts.map +1 -1
  32. package/payload/platform/plugins/memory/mcp/dist/tools/profile-read.js +11 -3
  33. package/payload/platform/plugins/memory/mcp/dist/tools/profile-read.js.map +1 -1
  34. package/payload/platform/plugins/memory/mcp/dist/tools/profile-update.d.ts +21 -0
  35. package/payload/platform/plugins/memory/mcp/dist/tools/profile-update.d.ts.map +1 -1
  36. package/payload/platform/plugins/memory/mcp/dist/tools/profile-update.js +106 -14
  37. package/payload/platform/plugins/memory/mcp/dist/tools/profile-update.js.map +1 -1
  38. package/payload/platform/plugins/memory/skills/conversational-memory/SKILL.md +30 -1
  39. package/payload/platform/plugins/memory/skills/preference-audit/SKILL.md +50 -0
  40. package/payload/platform/plugins/outlook/mcp/dist/__tests__/calendar-write.test.js +24 -0
  41. package/payload/platform/plugins/outlook/mcp/dist/__tests__/calendar-write.test.js.map +1 -1
  42. package/payload/platform/plugins/outlook/mcp/dist/tools/calendar-create.d.ts +15 -2
  43. package/payload/platform/plugins/outlook/mcp/dist/tools/calendar-create.d.ts.map +1 -1
  44. package/payload/platform/plugins/outlook/mcp/dist/tools/calendar-create.js +16 -7
  45. package/payload/platform/plugins/outlook/mcp/dist/tools/calendar-create.js.map +1 -1
  46. package/payload/platform/plugins/whatsapp/PLUGIN.md +3 -1
  47. package/payload/platform/plugins/whatsapp/mcp/dist/__tests__/resolve-read-account.test.d.ts +2 -0
  48. package/payload/platform/plugins/whatsapp/mcp/dist/__tests__/resolve-read-account.test.d.ts.map +1 -0
  49. package/payload/platform/plugins/whatsapp/mcp/dist/__tests__/resolve-read-account.test.js +15 -0
  50. package/payload/platform/plugins/whatsapp/mcp/dist/__tests__/resolve-read-account.test.js.map +1 -0
  51. package/payload/platform/plugins/whatsapp/mcp/dist/index.js +14 -8
  52. package/payload/platform/plugins/whatsapp/mcp/dist/index.js.map +1 -1
  53. package/payload/platform/plugins/whatsapp/mcp/dist/resolve-read-account.d.ts +7 -0
  54. package/payload/platform/plugins/whatsapp/mcp/dist/resolve-read-account.d.ts.map +1 -0
  55. package/payload/platform/plugins/whatsapp/mcp/dist/resolve-read-account.js +13 -0
  56. package/payload/platform/plugins/whatsapp/mcp/dist/resolve-read-account.js.map +1 -0
  57. package/payload/platform/plugins/whatsapp/references/channels-whatsapp.md +9 -1
  58. package/payload/platform/plugins/work/mcp/dist/__tests__/work-create-raised-by-env.test.d.ts +2 -0
  59. package/payload/platform/plugins/work/mcp/dist/__tests__/work-create-raised-by-env.test.d.ts.map +1 -0
  60. package/payload/platform/plugins/work/mcp/dist/__tests__/work-create-raised-by-env.test.js +66 -0
  61. package/payload/platform/plugins/work/mcp/dist/__tests__/work-create-raised-by-env.test.js.map +1 -0
  62. package/payload/platform/plugins/work/mcp/dist/tools/work-create.d.ts.map +1 -1
  63. package/payload/platform/plugins/work/mcp/dist/tools/work-create.js +8 -1
  64. package/payload/platform/plugins/work/mcp/dist/tools/work-create.js.map +1 -1
  65. package/payload/platform/scripts/__tests__/provision-role-stamp.test.sh +3 -0
  66. package/payload/platform/scripts/lib/provision-account-dir.sh +9 -1
  67. package/payload/platform/services/claude-session-manager/dist/agent-identity-locator.d.ts +1 -1
  68. package/payload/platform/services/claude-session-manager/dist/agent-identity-locator.d.ts.map +1 -1
  69. package/payload/platform/services/claude-session-manager/dist/agent-identity-locator.js +5 -1
  70. package/payload/platform/services/claude-session-manager/dist/agent-identity-locator.js.map +1 -1
  71. package/payload/platform/services/claude-session-manager/dist/http-server.d.ts +1 -0
  72. package/payload/platform/services/claude-session-manager/dist/http-server.d.ts.map +1 -1
  73. package/payload/platform/services/claude-session-manager/dist/http-server.js +65 -4
  74. package/payload/platform/services/claude-session-manager/dist/http-server.js.map +1 -1
  75. package/payload/platform/services/claude-session-manager/dist/index.js +53 -0
  76. package/payload/platform/services/claude-session-manager/dist/index.js.map +1 -1
  77. package/payload/platform/services/claude-session-manager/dist/passive-dispatch-prune.d.ts +37 -0
  78. package/payload/platform/services/claude-session-manager/dist/passive-dispatch-prune.d.ts.map +1 -0
  79. package/payload/platform/services/claude-session-manager/dist/passive-dispatch-prune.js +80 -0
  80. package/payload/platform/services/claude-session-manager/dist/passive-dispatch-prune.js.map +1 -0
  81. package/payload/platform/services/claude-session-manager/dist/passive-intake-audit.d.ts +70 -0
  82. package/payload/platform/services/claude-session-manager/dist/passive-intake-audit.d.ts.map +1 -0
  83. package/payload/platform/services/claude-session-manager/dist/passive-intake-audit.js +129 -0
  84. package/payload/platform/services/claude-session-manager/dist/passive-intake-audit.js.map +1 -0
  85. package/payload/platform/services/claude-session-manager/dist/preference-reconciliation-audit.d.ts +46 -0
  86. package/payload/platform/services/claude-session-manager/dist/preference-reconciliation-audit.d.ts.map +1 -0
  87. package/payload/platform/services/claude-session-manager/dist/preference-reconciliation-audit.js +96 -0
  88. package/payload/platform/services/claude-session-manager/dist/preference-reconciliation-audit.js.map +1 -0
  89. package/payload/platform/services/claude-session-manager/dist/pty-spawner.d.ts +39 -0
  90. package/payload/platform/services/claude-session-manager/dist/pty-spawner.d.ts.map +1 -1
  91. package/payload/platform/services/claude-session-manager/dist/pty-spawner.js +66 -5
  92. package/payload/platform/services/claude-session-manager/dist/pty-spawner.js.map +1 -1
  93. package/payload/platform/services/claude-session-manager/dist/public-agent-reachability.d.ts.map +1 -1
  94. package/payload/platform/services/claude-session-manager/dist/public-agent-reachability.js +5 -1
  95. package/payload/platform/services/claude-session-manager/dist/public-agent-reachability.js.map +1 -1
  96. package/payload/platform/services/claude-session-manager/dist/system-prompt.d.ts +6 -0
  97. package/payload/platform/services/claude-session-manager/dist/system-prompt.d.ts.map +1 -1
  98. package/payload/platform/services/claude-session-manager/dist/system-prompt.js +20 -0
  99. package/payload/platform/services/claude-session-manager/dist/system-prompt.js.map +1 -1
  100. package/payload/platform/services/telegram-channel/dist/instructions.d.ts +9 -0
  101. package/payload/platform/services/telegram-channel/dist/instructions.d.ts.map +1 -0
  102. package/payload/platform/services/telegram-channel/dist/instructions.js +80 -0
  103. package/payload/platform/services/telegram-channel/dist/instructions.js.map +1 -0
  104. package/payload/platform/services/telegram-channel/dist/notification.d.ts +93 -0
  105. package/payload/platform/services/telegram-channel/dist/notification.d.ts.map +1 -0
  106. package/payload/platform/services/telegram-channel/dist/notification.js +119 -0
  107. package/payload/platform/services/telegram-channel/dist/notification.js.map +1 -0
  108. package/payload/platform/services/telegram-channel/dist/server.d.ts +40 -0
  109. package/payload/platform/services/telegram-channel/dist/server.d.ts.map +1 -0
  110. package/payload/platform/services/telegram-channel/dist/server.js +291 -0
  111. package/payload/platform/services/telegram-channel/dist/server.js.map +1 -0
  112. package/payload/platform/services/telegram-channel/dist/turn-follow.d.ts +28 -0
  113. package/payload/platform/services/telegram-channel/dist/turn-follow.d.ts.map +1 -0
  114. package/payload/platform/services/telegram-channel/dist/turn-follow.js +188 -0
  115. package/payload/platform/services/telegram-channel/dist/turn-follow.js.map +1 -0
  116. package/payload/platform/services/webchat-channel/dist/instructions.d.ts.map +1 -1
  117. package/payload/platform/services/webchat-channel/dist/instructions.js +37 -78
  118. package/payload/platform/services/webchat-channel/dist/instructions.js.map +1 -1
  119. package/payload/platform/services/webchat-channel/dist/notification.d.ts +5 -0
  120. package/payload/platform/services/webchat-channel/dist/notification.d.ts.map +1 -1
  121. package/payload/platform/services/webchat-channel/dist/notification.js +6 -1
  122. package/payload/platform/services/webchat-channel/dist/notification.js.map +1 -1
  123. package/payload/platform/services/whatsapp-channel/dist/notification.d.ts +20 -36
  124. package/payload/platform/services/whatsapp-channel/dist/notification.d.ts.map +1 -1
  125. package/payload/platform/services/whatsapp-channel/dist/notification.js +43 -81
  126. package/payload/platform/services/whatsapp-channel/dist/notification.js.map +1 -1
  127. package/payload/platform/templates/agents/admin/IDENTITY.md +2 -1
  128. package/payload/platform/templates/agents/passive/IDENTITY.md +21 -0
  129. package/payload/platform/templates/specialists/agents/content-producer.md +4 -0
  130. package/payload/server/public/assets/{AdminLoginScreens-CBTx7ZPK.js → AdminLoginScreens-B1P6PrZ3.js} +1 -1
  131. package/payload/server/public/assets/AdminShell-Y1fHQApK.js +2 -0
  132. package/payload/server/public/assets/{Checkbox-BHTxekRB.js → Checkbox-CgCqOslz.js} +1 -1
  133. package/payload/server/public/assets/{Transcript-5kLbBInN.js → Transcript-DZzFjhoq.js} +1 -1
  134. package/payload/server/public/assets/{admin-BWCLE32N.js → admin-BRBjJEci.js} +1 -1
  135. package/payload/server/public/assets/{browser-CRvCPsvV.js → browser-ID7iqIi4.js} +1 -1
  136. package/payload/server/public/assets/{calendar-BI-kd-QP.js → calendar-BEQPMTtd.js} +1 -1
  137. package/payload/server/public/assets/chat-D0GDSWM-.js +1 -0
  138. package/payload/server/public/assets/chevron-left-A0HYKwGY.js +1 -0
  139. package/payload/server/public/assets/data-CV38dClT.js +1 -0
  140. package/payload/server/public/assets/{graph-BFSyW_5i.js → graph-BK0MjKRy.js} +1 -1
  141. package/payload/server/public/assets/{graph-labels-DEjD_qJh.js → graph-labels-BfG6FO25.js} +1 -1
  142. package/payload/server/public/assets/{maximize-2-BcMJNeCB.js → maximize-2-DrBaKD3z.js} +1 -1
  143. package/payload/server/public/assets/{operator-Dtvm9ero.js → operator-CnpNyIJ8.js} +1 -1
  144. package/payload/server/public/assets/page-DC_L-IS1.js +32 -0
  145. package/payload/server/public/assets/{page-TXi9dmaB.js → page-DKHLflh7.js} +1 -1
  146. package/payload/server/public/assets/{public-DBx3U0r8.js → public-ByUJr48E.js} +1 -1
  147. package/payload/server/public/assets/{rotate-ccw-8ti3QkeY.js → rotate-ccw-D45TbeAI.js} +1 -1
  148. package/payload/server/public/assets/useSubAccountSwitcher-CCn22f98.css +1 -0
  149. package/payload/server/public/assets/useSubAccountSwitcher-CprHkBnZ.js +9 -0
  150. package/payload/server/public/browser.html +4 -4
  151. package/payload/server/public/calendar.html +5 -5
  152. package/payload/server/public/chat.html +9 -9
  153. package/payload/server/public/data.html +8 -8
  154. package/payload/server/public/graph.html +9 -9
  155. package/payload/server/public/index.html +11 -11
  156. package/payload/server/public/operator.html +11 -11
  157. package/payload/server/public/public.html +9 -9
  158. package/payload/server/server.js +406 -99
  159. package/payload/server/public/assets/AdminShell-DPHUeXea.js +0 -2
  160. package/payload/server/public/assets/chat-DFy8hb1y.js +0 -1
  161. package/payload/server/public/assets/chevron-left-Bggm5B5U.js +0 -1
  162. package/payload/server/public/assets/data-HvZ69Ya1.js +0 -1
  163. package/payload/server/public/assets/page-C_pm3hl3.js +0 -32
  164. package/payload/server/public/assets/useSubAccountSwitcher-BUvlETHN.css +0 -1
  165. package/payload/server/public/assets/useSubAccountSwitcher-Bc5dOBdI.js +0 -9
@@ -0,0 +1,188 @@
1
+ // Turn-end detector for the telegram native channel. A faithful mirror of
2
+ // whatsapp-channel/turn-follow.ts — `reduceTurnFromLines` folds one turn's JSONL
3
+ // lines into the delivery decision and `followTurnEnds` tails the session JSONL
4
+ // from a byte offset and reports every assistant end_turn (not just the first),
5
+ // so a follow-on turn produced from a mid-turn-queued message is covered too.
6
+ // Pure of the MCP SDK so it unit-tests in isolation.
7
+ //
8
+ // The divergence from the WhatsApp twin: this channel has no fallback delivery
9
+ // and no reply-document tool. The follower exists ONLY to detect the
10
+ // turn-undelivered anomaly — a channel turn that ends with substantive assistant
11
+ // text but never called the reply tool, so the operator (who sees only
12
+ // reply-tool text in the reader) receives nothing. The reply text itself is
13
+ // never delivered or re-sent here; the gateway logs the anomaly.
14
+ import { closeSync, existsSync, openSync, readdirSync, readSync, statSync, watch } from 'node:fs';
15
+ import { homedir } from 'node:os';
16
+ import { join } from 'node:path';
17
+ // The reply tool the agent uses to deliver to the telegram chat. Its presence in
18
+ // a turn means the operator received something this turn. Mirrors the registered
19
+ // server name ('telegram-channel') in claude-session-manager's spawn; kept as a
20
+ // literal here to avoid a cross-package import. This channel exposes no
21
+ // reply-document tool, so this set has one named member plus the generic alias.
22
+ const REPLY_TOOL_NAMES = new Set(['mcp__telegram-channel__reply', 'mcp__channel__reply']);
23
+ /** Fold one turn's JSONL line strings into the delivery decision. Pure. */
24
+ export function reduceTurnFromLines(lines) {
25
+ let replied = false;
26
+ let finalText = '';
27
+ let reachedEndTurn = false;
28
+ for (const line of lines) {
29
+ if (!line)
30
+ continue;
31
+ let ev;
32
+ try {
33
+ ev = JSON.parse(line);
34
+ }
35
+ catch {
36
+ continue;
37
+ }
38
+ if (ev.type !== 'assistant')
39
+ continue;
40
+ const msg = ev.message;
41
+ const isEnd = msg?.stop_reason === 'end_turn';
42
+ if (!msg || !Array.isArray(msg.content)) {
43
+ if (isEnd) {
44
+ reachedEndTurn = true;
45
+ finalText = '';
46
+ }
47
+ continue;
48
+ }
49
+ let endText = '';
50
+ for (const block of msg.content) {
51
+ if (block?.type === 'tool_use' && typeof block.name === 'string' && REPLY_TOOL_NAMES.has(block.name)) {
52
+ replied = true;
53
+ }
54
+ else if (block?.type === 'text' && typeof block.text === 'string' && isEnd) {
55
+ endText += block.text;
56
+ }
57
+ }
58
+ if (isEnd) {
59
+ reachedEndTurn = true;
60
+ finalText = endText;
61
+ }
62
+ }
63
+ return { replied, finalText, reachedEndTurn };
64
+ }
65
+ /** True iff `line` is an assistant message with stop_reason 'end_turn'. */
66
+ function isAssistantEndTurn(line) {
67
+ if (!line)
68
+ return false;
69
+ let ev;
70
+ try {
71
+ ev = JSON.parse(line);
72
+ }
73
+ catch {
74
+ return false;
75
+ }
76
+ return ev.type === 'assistant' && ev.message?.stop_reason === 'end_turn';
77
+ }
78
+ function claudeConfigRoot(env) {
79
+ return env.CLAUDE_CONFIG_DIR ?? join(homedir(), '.claude');
80
+ }
81
+ /**
82
+ * Walk `${CLAUDE_CONFIG_DIR}/projects/<slug>/` for `${sessionId}.jsonl` (live
83
+ * and archived). Returns the first match or null. Inlined from
84
+ * whatsapp-channel/jsonl-watch.ts (itself inlined from
85
+ * claude-session-manager/src/jsonl-path.ts) to avoid a cross-package dep.
86
+ */
87
+ export function findJsonlForSessionId(sessionId, env = process.env) {
88
+ const projectsRoot = join(claudeConfigRoot(env), 'projects');
89
+ if (!existsSync(projectsRoot))
90
+ return null;
91
+ let slugs;
92
+ try {
93
+ slugs = readdirSync(projectsRoot, { withFileTypes: true })
94
+ .filter((d) => d.isDirectory())
95
+ .map((d) => d.name);
96
+ }
97
+ catch {
98
+ return null;
99
+ }
100
+ const basename = `${sessionId}.jsonl`;
101
+ for (const slug of slugs) {
102
+ const live = join(projectsRoot, slug, basename);
103
+ if (existsSync(live))
104
+ return live;
105
+ const archived = join(projectsRoot, slug, 'archive', basename);
106
+ if (existsSync(archived))
107
+ return archived;
108
+ }
109
+ return null;
110
+ }
111
+ /**
112
+ * Tail `jsonlPath` from `startOffset` for the life of the session, invoking
113
+ * `onTurnEnd` once for every assistant end_turn with that turn's outcome. It
114
+ * segments the JSONL at each end_turn so a follow-on turn produced from a
115
+ * mid-turn-queued message is reported too. The process dies with the session,
116
+ * so there is no per-turn timeout; the promise resolves only when the file
117
+ * becomes unreadable. Never rejects. (Mirror of the WhatsApp twin.)
118
+ */
119
+ export async function followTurnEnds(jsonlPath, startOffset, onTurnEnd) {
120
+ let baseSize;
121
+ try {
122
+ baseSize = statSync(jsonlPath).size;
123
+ }
124
+ catch {
125
+ return;
126
+ }
127
+ return new Promise((resolve) => {
128
+ let offset = Math.min(startOffset, baseSize);
129
+ let carry = '';
130
+ let segment = [];
131
+ let settled = false;
132
+ const settle = () => {
133
+ if (settled)
134
+ return;
135
+ settled = true;
136
+ watcher.close();
137
+ clearInterval(poll);
138
+ resolve();
139
+ };
140
+ // Poll as well as watch: fs.watch misses appends on some platforms (notably
141
+ // macOS), so a light poll guarantees growth is seen within the interval.
142
+ const poll = setInterval(() => drain(), 200);
143
+ const drain = () => {
144
+ let end;
145
+ try {
146
+ end = statSync(jsonlPath).size;
147
+ }
148
+ catch {
149
+ settle();
150
+ return;
151
+ }
152
+ if (end <= offset)
153
+ return;
154
+ let buf;
155
+ try {
156
+ const fd = openSync(jsonlPath, 'r');
157
+ try {
158
+ buf = Buffer.alloc(end - offset);
159
+ readSync(fd, buf, 0, buf.length, offset);
160
+ }
161
+ finally {
162
+ closeSync(fd);
163
+ }
164
+ }
165
+ catch {
166
+ settle();
167
+ return;
168
+ }
169
+ offset = end;
170
+ carry += buf.toString('utf8');
171
+ let nl = carry.indexOf('\n');
172
+ while (nl !== -1) {
173
+ const line = carry.slice(0, nl);
174
+ carry = carry.slice(nl + 1);
175
+ nl = carry.indexOf('\n');
176
+ segment.push(line);
177
+ if (isAssistantEndTurn(line)) {
178
+ onTurnEnd(reduceTurnFromLines(segment));
179
+ segment = [];
180
+ }
181
+ }
182
+ };
183
+ const watcher = watch(jsonlPath, { persistent: false }, () => drain());
184
+ watcher.on('error', () => settle());
185
+ drain(); // catch lines already present between startOffset and now
186
+ });
187
+ }
188
+ //# sourceMappingURL=turn-follow.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"turn-follow.js","sourceRoot":"","sources":["../src/turn-follow.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,iFAAiF;AACjF,gFAAgF;AAChF,gFAAgF;AAChF,8EAA8E;AAC9E,qDAAqD;AACrD,EAAE;AACF,+EAA+E;AAC/E,qEAAqE;AACrE,iFAAiF;AACjF,uEAAuE;AACvE,4EAA4E;AAC5E,iEAAiE;AACjE,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,QAAQ,EAAE,WAAW,EAAE,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AACjG,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AACjC,OAAO,EAAE,IAAI,EAAE,MAAM,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":3,"file":"instructions.d.ts","sourceRoot":"","sources":["../src/instructions.ts"],"names":[],"mappings":"AAOA,MAAM,MAAM,kBAAkB,GAAG,OAAO,GAAG,QAAQ,CAAA;AAEnD;4EAC4E;AAC5E,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,GAAG,kBAAkB,CAE9E;AA6BD,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,kBAAkB,GAAG,MAAM,CAEpE;AAED,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,kBAAkB,GAAG,MAAM,CAIrE;AAED,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,kBAAkB,GAAG,MAAM,CAErE;AAQD,wBAAgB,oCAAoC,IAAI,MAAM,CAU7D;AAwBD,eAAO,MAAM,yBAAyB,QAqBZ,CAAA"}
@@ -58,88 +58,47 @@ export function connectorAuthenticateToolDescription() {
58
58
  'connector becomes usable on their next message.',
59
59
  ].join(' ');
60
60
  }
61
- // Task 899 — per-turn admin reframe directive. The server-level INSTRUCTIONS
62
- // above are set once at MCP init; the routing + capability-denial guidance must
63
- // ride EVERY turn, the way the WhatsApp channel's composeAdminContent does
64
- // (Task 753). So composeContent wraps every ADMIN inbound as
65
- // `## Context / ## Instruction` with this text. Mirrors whatsapp-channel's
66
- // REFRAME_INSTRUCTION; the channels own their framing text independently
67
- // (rootDir:"src" blocks a shared module), so the capability-denial clause lives
68
- // in both and is drift-guarded by a test in each. The clause is the Task 890
69
- // fix: the agent must search the skills for the owning capability before
70
- // reporting that something cannot be done — a denial is valid only once that
71
- // search comes back empty.
61
+ // Task 899 — per-turn admin reframe directive, byte-identical to the telegram
62
+ // twin's ADMIN_REFRAME_INSTRUCTION (both use the "operator" recipient word). The
63
+ // server-level INSTRUCTIONS above are set once at MCP init; this routing +
64
+ // capability guidance must ride EVERY turn, the way the WhatsApp channel's
65
+ // composeAdminContent does (Task 753). So composeContent wraps every ADMIN
66
+ // inbound as `## Context / ## Instruction` with this text. The channels own their
67
+ // framing text independently (rootDir:"src" blocks a shared module), so the six
68
+ // guarantees live in each and clauses 4–6 (recipient-neutral) are drift-guarded
69
+ // byte-identical by a test in each service.
70
+ //
71
+ // Compressed under Task 1497. The prior webchat-only connector prose
72
+ // (Tasks 1160/1208/1153) is gone: a claude.ai connector is a tool, so it is now
73
+ // covered by guarantee 2's "search the skills and tools" — the same principle
74
+ // that owns every other capability. The connector_authenticate tool and the
75
+ // connector-directory skill are unchanged; the agent reaches them by searching
76
+ // tools/skills, not by a bespoke wrapper paragraph.
72
77
  //
73
78
  // PUBLIC IS DELIBERATELY EXCLUDED. The public reader echoes the visitor's own
74
79
  // `operator-inbound` turn back to the anonymous browser (it is in
75
80
  // PUBLIC_DELIVERED_KINDS), so wrapping a public inbound would leak this internal
76
81
  // routing language to the visitor — a NO_INTERNALS violation. The public role
77
82
  // keeps plain delivery and relies on the server-level PUBLIC_INSTRUCTIONS.
78
- export const ADMIN_REFRAME_INSTRUCTION = 'Choose the installed specialist that owns this request and dispatch it with the Agent tool. ' +
79
- 'Any deliverable artefact — an email or letter draft, a quote, an order, a report, a PDF, an image, a page — ' +
80
- 'is content-producer work: dispatch content-producer for it, without exception, ' +
81
- 'including follow-up edits to an artefact a specialist already produced. ' +
82
- 'If no specialist fits, load the owning skill. ' +
83
- 'If neither fits (a greeting, a quick question, a confirmation, a direct continuation), just answer. ' +
84
- 'If you are about to do artefact work without an agent or skill, that decision is itself the violation signal ' +
85
- 'stop and reconsider before answering directly. ' +
86
- 'Your capabilities here are very well defined: before you tell the operator something cannot be done, ' +
87
- 'search the skills for the owning capability, and treat a denial as valid only once that search comes back empty. ' +
88
- // Task 1160 capability discovery was connector-blind: a request owned by a
89
- // claude.ai connector (Zoom, Dropbox, Microsoft 365, Cloudflare, Google) has no
90
- // skill, so the skills-only gate above passed a false denial before the agent
91
- // ever reached a connector tool. capabilities-here now lists the loaded
92
- // connectors with their auth state; this clause makes the denial gate consult
93
- // them and routes a live connector into the Task 1153 authenticate path.
94
- 'Some capabilities are owned not by a skill but by a claude.ai connector — Zoom, Dropbox, Microsoft 365, Cloudflare, Google and the like. ' +
95
- 'capabilities-here lists the connectors loaded for this client with their auth state, so before you deny a request that a connector could own, ' +
96
- 'check that list and ToolSearch for mcp__claude_ai_* tools: a connector denial is valid only once the skills AND the connectors both come back empty. ' +
97
- 'When a matching connector exists, use its tool; if the tool result says it needs authentication, call the connector_authenticate tool; ' +
98
- 'and when capabilities-here already shows the connector as needs-auth, offer that authenticate step rather than denying. ' +
99
- // Task 1208 — even when the skills and the loaded connectors both come back
100
- // empty, the integration the operator named may exist in the claude.ai
101
- // connector directory as a connector this client has not added yet. The
102
- // managed registry tool is absent from this session, so discovery is
103
- // catalogue-driven via the connector-directory skill, which searches the
104
- // public catalogue and routes the enable step to claude.ai. This stops the
105
- // agent denying a real connector or defaulting to the generic static-key
106
- // connector before it has looked.
107
- 'When the skills and the loaded connectors both come back empty, do not stop at a denial or jump to the generic static-key connector: ' +
108
- 'a connector you have not added to this client yet may still exist in the claude.ai connector directory, ' +
109
- 'so search the connector directory (load the connector-directory skill) first, and route any match\'s enable step to its claude.ai directory link. ' +
110
- 'Then carry it out. ' +
111
- 'Call the reply tool right away to acknowledge you are on it, ' +
112
- 'send a brief progress note with the reply tool before each long step, and call the reply tool again with the result — ' +
113
- 'never stay silent until the end. ' +
114
- // Task 980 — the channel/visibility model. Two turns ended with the substantive
115
- // answer written as plain assistant text and no reply-tool call; nothing was
116
- // delivered and the operator asked "did you do this?". The bare cadence clause
117
- // above read as progress-note etiquette and the word "reply" collided with the
118
- // agent's own text. This clause states the mechanism and the consequence so the
119
- // failure is unmissable: the operator sees ONLY reply-tool text, so a turn-final
120
- // plain text block is invisible. IDENTICAL to the WhatsApp twin's clause in
121
- // REFRAME_INSTRUCTION (recipient-neutral so the literal matches), drift-guarded
122
- // by a test in each service.
123
- 'Remember you are answering over a channel: the person you are replying to is not watching this session ' +
124
- 'and sees only the text you send with the reply tool. ' +
125
- 'Anything you write as an ordinary assistant message, without calling the reply tool, is invisible to them. ' +
126
- 'So a turn that answers them is finished only once you have called the reply tool with the full answer; ' +
127
- 'a turn that ends without a reply tool call delivers nothing, no matter what you wrote. ' +
128
- // Task 919 — the bridge forwards a SendUserFile call to this conversation as a
129
- // real attachment. Steer the agent to deliver the file, not describe it. This
130
- // clause is identical in the WhatsApp twin (REFRAME_INSTRUCTION) and
131
- // drift-guarded by a test in each service.
132
- 'When you have produced a file to deliver, deliver it by calling SendUserFile with its path — ' +
133
- 'the platform forwards it to this conversation as an attachment; ' +
134
- 'a reply that only names or describes the file is not delivery. ' +
135
- // Task 982 — plain English on every operator-facing reply, not only on explicit
136
- // "explain in plain English" requests. The plainly skill is installed but
137
- // otherwise triggers only on that explicit ask, so ordinary replies carry the
138
- // AI tells it already catalogues. This clause points the agent at the skill for
139
- // every reply form. IDENTICAL to the WhatsApp twin's clause in
140
- // REFRAME_INSTRUCTION (recipient-neutral so the literal matches), drift-guarded
141
- // by a test in each service.
142
- 'Write every reply you send (acknowledgement, progress note, answer, or deliverable summary) ' +
143
- 'in plain English, in the spoken register and free of the AI tells the plainly skill catalogues; ' +
144
- 'load that skill for the full rules.';
83
+ export const ADMIN_REFRAME_INSTRUCTION = 'Dispatch the owning specialist with the Agent tool. ' +
84
+ 'Any deliverable artefact — email, letter, quote, order, report, PDF, image, page — ' +
85
+ 'is content-producer work, without exception, including follow-up edits to one already produced. ' +
86
+ 'Else load the owning skill; else (a greeting, quick question, confirmation) just answer. ' +
87
+ 'Artefact work with neither is the violation signal — reconsider. ' +
88
+ 'Your capabilities here are very well defined: before telling the operator something cannot be done, ' +
89
+ 'search the skills and tools for the owning capability a denial is valid only once that search comes back empty. ' +
90
+ 'Acknowledge on the reply tool, a brief progress note before each long step, then the result — never silent to the end. ' +
91
+ // Channel/visibility model (Task 980): the peer sees ONLY reply-tool text, so a
92
+ // turn-final plain text block delivers nothing. Byte-identical to the whatsapp
93
+ // and telegram twins, drift-guarded by a test in each service.
94
+ 'Over a channel, the person sees only what you send with the reply tool; ' +
95
+ 'a turn ending without a reply tool call delivers nothing. ' +
96
+ // File delivery (Task 919): the bridge forwards a SendUserFile call as a real
97
+ // attachment. Byte-identical to the twins, drift-guarded in each service.
98
+ 'To deliver a file, call SendUserFile with its path — the platform forwards it here as an attachment; ' +
99
+ 'naming or describing the file is not delivery. ' +
100
+ // Plain English (Task 982): every reply rides the plainly register, not only on
101
+ // an explicit request. Byte-identical to the twins, drift-guarded in each service.
102
+ 'Write every reply in plain English, in the spoken register and free of the AI tells the plainly skill catalogues; ' +
103
+ 'load it for the rules.';
145
104
  //# sourceMappingURL=instructions.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"instructions.js","sourceRoot":"","sources":["../src/instructions.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,+EAA+E;AAC/E,6EAA6E;AAC7E,2EAA2E;AAC3E,4EAA4E;AAC5E,gDAAgD;AAIhD;4EAC4E;AAC5E,MAAM,UAAU,kBAAkB,CAAC,GAAuB;IACxD,OAAO,GAAG,KAAK,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAA;AAC9C,CAAC;AAED,MAAM,YAAY,GAChB,gGAAgG;IAChG,iGAAiG;IACjG,mGAAmG;IACnG,iGAAiG;IACjG,0EAA0E,CAAA;AAE5E,MAAM,kBAAkB,GACtB,2DAA2D;IAC3D,kGAAkG;IAClG,+FAA+F;IAC/F,8FAA8F;IAC9F,kGAAkG;IAClG,6FAA6F;IAC7F,wFAAwF;IACxF,YAAY,CAAA;AAEd,MAAM,mBAAmB,GACvB,kEAAkE;IAClE,mGAAmG;IACnG,iGAAiG;IACjG,4FAA4F;IAC5F,kGAAkG;IAClG,iGAAiG;IACjG,oCAAoC;IACpC,YAAY,CAAA;AAEd,MAAM,UAAU,mBAAmB,CAAC,IAAwB;IAC1D,OAAO,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,mBAAmB,CAAC,CAAC,CAAC,kBAAkB,CAAA;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AA2F;IAC3F,mEAAmE;IACnE,sGAAsG;IACtG,oHAAoH;IACpH,yHAAyH;IACzH,gFAAgF;IAChF,+EAA+E;IAC/E,+DAA+D;IAC/D,0EAA0E;IAC1E,4DAA4D;IAC5D,8EAA8E;IAC9E,0EAA0E;IAC1E,uGAAuG;IACvG,iDAAiD;IACjD,gFAAgF;IAChF,mFAAmF;IACnF,oHAAoH;IACpH,wBAAwB,CAAA"}
@@ -6,6 +6,11 @@ export interface InboundPayload {
6
6
  text: string;
7
7
  /** Per-message id, for dedup/observability. */
8
8
  messageId: string;
9
+ /** Task 1486 — the account's active standing-rules block (already formatted as
10
+ * `## Standing rules`), fetched and attached by the gateway. Prepended above
11
+ * `## Context` for ADMIN turns only; a public visitor never receives it.
12
+ * Absent/blank when the account has no active rules. */
13
+ standingRules?: string;
9
14
  }
10
15
  /** The composed content the agent receives, plus the inner payload's byte
11
16
  * length for the observability line. */
@@ -1 +1 @@
1
- {"version":3,"file":"notification.d.ts","sourceRoot":"","sources":["../src/notification.ts"],"names":[],"mappings":"AAcA,OAAO,EAA6B,KAAK,kBAAkB,EAAE,MAAM,mBAAmB,CAAA;AAEtF,MAAM,WAAW,cAAc;IAC7B,wDAAwD;IACxD,GAAG,EAAE,MAAM,CAAA;IACX,gFAAgF;IAChF,IAAI,EAAE,MAAM,CAAA;IACZ,+CAA+C;IAC/C,SAAS,EAAE,MAAM,CAAA;CAClB;AAED;yCACyC;AACzC,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,MAAM,CAAA;IACf,YAAY,EAAE,MAAM,CAAA;CACrB;AAED;;;;;mFAKmF;AACnF,wBAAgB,cAAc,CAAC,CAAC,EAAE,cAAc,EAAE,IAAI,EAAE,kBAAkB,GAAG,eAAe,CAU3F;AAED;;2BAE2B;AAC3B,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,CAAC,EAAE;IAAE,GAAG,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAErE;AAED;;;mCAGm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B,UAAU,EAAE,MAAM,GACjB;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,OAAO,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE,CAE1E;AAED;;;;cAIc;AACd,wBAAsB,aAAa,CACjC,OAAO,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,EAC/B,IAAI,EAAE;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;CAAE,GAChF,OAAO,CAAC,OAAO,CAAC,CAMlB;AAED;;;mBAGmB;AACnB,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,GAAG,MAAM,CAIrE;AAYD,eAAO,MAAM,sBAAsB,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,MAAM,CAAA;CAAE,EAOhE,CAAA;AAED,MAAM,WAAW,SAAS;IACxB,OAAO,EAAE,MAAM,CAAA;IACf,KAAK,EAAE,MAAM,CAAA;CACd;AAED,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,SAAS,EAAE,CAAA;CAAE,CAU5F"}
@@ -24,8 +24,13 @@ export function composeContent(p, role) {
24
24
  if (role !== 'admin') {
25
25
  return { content: payload, payloadBytes };
26
26
  }
27
+ // Task 1486 — prepend the account's active standing rules above ## Context for
28
+ // admin turns only (a public visitor must never see operator rules).
29
+ const rulesPrefix = typeof p.standingRules === 'string' && p.standingRules.trim().length > 0
30
+ ? `${p.standingRules.trim()}\n\n`
31
+ : '';
27
32
  return {
28
- content: `## Context\n${payload}\n\n## Instruction\n${ADMIN_REFRAME_INSTRUCTION}`,
33
+ content: `${rulesPrefix}## Context\n${payload}\n\n## Instruction\n${ADMIN_REFRAME_INSTRUCTION}`,
29
34
  payloadBytes,
30
35
  };
31
36
  }
@@ -1 +1 @@
1
- {"version":3,"file":"notification.js","sourceRoot":"","sources":["../src/notification.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,wEAAwE;AACxE,+EAA+E;AAC/E,yCAAyC;AACzC,EAAE;AACF,+EAA+E;AAC/E,wEAAwE;AACxE,8EAA8E;AAC9E,+EAA+E;AAC/E,+EAA+E;AAC/E,8EAA8E;AAC9E,gFAAgF;AAChF,mEAAmE;AAEnE,OAAO,EAAE,yBAAyB,EAA2B,MAAM,mBAAmB,CAAA;AAkBtF;;;;;mFAKmF;AACnF,MAAM,UAAU,cAAc,CAAC,CAAiB,EAAE,IAAwB;IACxE,MAAM,OAAO,GAAG,CAAC,CAAC,IAAI,CAAA;IACtB,MAAM,YAAY,GAAG,MAAM,CAAC,UAAU,CAAC,OAAO,EAAE,MAAM,CAAC,CAAA;IACvD,IAAI,IAAI,KAAK,OAAO,EAAE,CAAC;QACrB,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,CAAA;IAC3C,CAAC;IACD,OAAO;QACL,OAAO,EAAE,eAAe,OAAO,uBAAuB,yBAAyB,EAAE;QACjF,YAAY;KACb,CAAA;AACH,CAAC;AAED;;2BAE2B;AAC3B,MAAM,UAAU,UAAU,CAAC,KAAa,EAAE,CAAkB;IAC1D,OAAO,CAAC,CAAC,GAAG,KAAK,KAAK,CAAA;AACxB,CAAC;AAED;;;mCAGmC;AACnC,MAAM,UAAU,kBAAkB,CAAC,KAAa,EAAE,IAAY;IAC5D,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,IAAI,EAAE,CAAA;AAC7B,CAAC;AAED;;;kFAGkF;AAClF,MAAM,UAAU,qBAAqB,CACnC,KAAa,EACb,SAAiB;IAEjB,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,SAAS,EAAE,CAAA;AAClC,CAAC;AAED;;;;;;;;;;0EAU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E,yBAAyB,EAAE;IAClD,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,EAAE,sBAAsB,EAAE;CAC/C,CAAA;AAOD,MAAM,UAAU,mBAAmB,CAAC,IAAY;IAC9C,MAAM,UAAU,GAAgB,EAAE,CAAA;IAClC,IAAI,KAAK,GAAG,IAAI,CAAA;IAChB,KAAK,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,IAAI,sBAAsB,EAAE,CAAC;QAClD,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,EAAE;YAC9B,UAAU,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC,CAAA;YAC5C,OAAO,YAAY,CAAA;QACrB,CAAC,CAAC,CAAA;IACJ,CAAC;IACD,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,CAAA;AAC9B,CAAC"}
@@ -20,45 +20,29 @@ export interface InboundPayload {
20
20
  * the channel *door* (`ChannelSource`, whatsapp/webchat); carried only into
21
21
  * the turn's structured log line. Absent on legacy frames = 'user'. */
22
22
  source?: 'user' | 'schedule';
23
+ /** Task 1486 — the account's active standing-rules block, fetched and attached
24
+ * by the gateway (already formatted as a `## Standing rules` markdown
25
+ * section). Prepended above `## Context` so the operator's standing rules ride
26
+ * every turn even after the long-lived session has compacted. Absent/blank on
27
+ * a turn with no active rules. */
28
+ standingRules?: string;
23
29
  }
24
30
  /**
25
- * Task 753 — the standing select-and-dispatch instruction. The inbound message
26
- * is demoted to payload and the turn becomes a routing question: pick the owning
27
- * specialist (dispatch via the Agent tool), else load the owning skill, else
28
- * answer directly. Freestyle inline authoring is the `direct` floor, reached only
29
- * when nothing owns the work which is why a greeting/confirmation needs no
30
- * separate skip: it falls through to `direct`. The turn is now framed in two
31
- * markdown sections (see {@link composeAdminContent}): `## Context` carries the
32
- * inbound payload first, then `## Instruction` carries this directive so the
33
- * agent reads the request, then how to act on it.
31
+ * The standing per-turn admin reframe. Every channel inbound is demoted to
32
+ * payload under `## Context`; this directive rides under `## Instruction` (see
33
+ * {@link composeAdminContent}), so the turn becomes a routing question. It
34
+ * carries six guarantees, each stated once: (1) dispatch the owning specialist
35
+ * content-producer for any deliverable artefact, including follow-up edits else
36
+ * load the owning skill, else just answer; (2) search skills and tools before
37
+ * telling the sender something cannot be done; (3) reply-tool cadence ack,
38
+ * progress, result; (4) channel visibility the peer sees only reply-tool text,
39
+ * so a turn ending without a reply-tool call delivers nothing; (5) deliver files
40
+ * via SendUserFile; (6) plain English per the plainly skill.
34
41
  *
35
- * Task 761 the cadence clause. A long turn (e.g. building a quote across many
36
- * Write/Bash/Edit steps) was producing one channel message, dispatched only at
37
- * turn-end, leaving the sender in silence for minutes. The agent's interim
38
- * narration is surfaced in the dashboard but is never dispatched to the channel;
39
- * only `reply`-tool calls reach WhatsApp. So the clause directs the agent to use
40
- * the reply tool for an early acknowledgement and mid-turn progress, then the
41
- * result — not just the final message. Outcome, not script.
42
- *
43
- * Task 805 — the artefact and self-check clauses. Session e48c2a5e showed the
44
- * cascade alone is ignored on artefact work (0 Agent dispatches across a 52 MB
45
- * session while content-producer owned the work): the agent authored emails,
46
- * an Excel→HTML template, and PDF iterations inline, and the first inline
47
- * artefact anchored every follow-up edit inline. The instruction now names
48
- * content-producer for deliverable artefacts — including follow-up edits to an
49
- * artefact a specialist already produced — and adds a self-check: deciding
50
- * against an agent/skill on artefact work is itself the violation signal.
51
- * Quick conversational replies still fall through to the direct branch.
52
- *
53
- * Task 890 — the capability-denial clause. A turn framed as an action (not a
54
- * how-to) had the agent answer from the partial state visible to it and report
55
- * the wall it hit as fact (a narrow Cloudflare token seen, "can't list
56
- * databases" declared) without ever loading the owning skill that held the
57
- * full capability. The instruction now states the capabilities are well
58
- * defined and requires a skill search before any "cannot be done" statement —
59
- * a denial is valid only once that search returns nothing.
60
- *
61
- * Exported so the unit tests assert the exact wrapped shape.
42
+ * Compressed under Task 1497 (history: 753/761/805/890/919/980/982). Clauses 4–6
43
+ * are recipient-neutral and byte-identical to the webchat and telegram twins'
44
+ * ADMIN_REFRAME_INSTRUCTION, drift-guarded by a test in each service. Exported so
45
+ * the unit tests assert the exact wrapped shape.
62
46
  */
63
47
  export declare const REFRAME_INSTRUCTION: string;
64
48
  /** Task 853 — the two doors a unified (multi-target) session can be bound to. */
@@ -1 +1 @@
1
- {"version":3,"file":"notification.d.ts","sourceRoot":"","sources":["../src/notification.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,OAAO,GAAG,OAAO,GAAG,OAAO,GAAG,UAAU,GAAG,SAAS,CAAA;IAC1D,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB;AAED,MAAM,WAAW,cAAc;IAC7B,qEAAqE;IACrE,QAAQ,EAAE,MAAM,CAAA;IAChB,oEAAoE;IACpE,IAAI,EAAE,MAAM,CAAA;IACZ,wDAAwD;IACxD,WAAW,EAAE,MAAM,CAAA;IACnB;;;kFAG8E;IAC9E,KAAK,EAAE,YAAY,EAAE,CAAA;IACrB;;;4EAGwE;IACxE,MAAM,CAAC,EAAE,MAAM,GAAG,UAAU,CAAA;CAC7B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,eAAO,MAAM,mBAAmB,QA4CO,CAAA;AAEvC,iFAAiF;AACjF,MAAM,MAAM,aAAa,GAAG,UAAU,GAAG,SAAS,CAAA;AAElD;;;YAGY;AACZ,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,MAAM,CAAA;IACf,YAAY,EAAE,MAAM,CAAA;IACpB;8EAC0E;IAC1E,MAAM,EAAE,aAAa,CAAA;CACtB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,wBAAwB,CAAC,CAAC,EAAE,cAAc;;;;;EAOzD;AA0BD;;;;;;;;;GASG;AACH,wBAAgB,mBAAmB,CAAC,CAAC,EAAE,cAAc,EAA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