exempclaw 0.4.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 (201) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +306 -0
  3. package/dist/agent/agent.d.ts +91 -0
  4. package/dist/agent/agent.js +258 -0
  5. package/dist/agent/agent.js.map +1 -0
  6. package/dist/agent/config.d.ts +49 -0
  7. package/dist/agent/config.js +58 -0
  8. package/dist/agent/config.js.map +1 -0
  9. package/dist/agent/persona.d.ts +39 -0
  10. package/dist/agent/persona.js +81 -0
  11. package/dist/agent/persona.js.map +1 -0
  12. package/dist/agents/registry.d.ts +21 -0
  13. package/dist/agents/registry.js +51 -0
  14. package/dist/agents/registry.js.map +1 -0
  15. package/dist/cli/approve.d.ts +17 -0
  16. package/dist/cli/approve.js +50 -0
  17. package/dist/cli/approve.js.map +1 -0
  18. package/dist/cli/chat.d.ts +16 -0
  19. package/dist/cli/chat.js +148 -0
  20. package/dist/cli/chat.js.map +1 -0
  21. package/dist/cli/demo.d.ts +7 -0
  22. package/dist/cli/demo.js +82 -0
  23. package/dist/cli/demo.js.map +1 -0
  24. package/dist/cli/init.d.ts +17 -0
  25. package/dist/cli/init.js +89 -0
  26. package/dist/cli/init.js.map +1 -0
  27. package/dist/cli/live.d.ts +10 -0
  28. package/dist/cli/live.js +109 -0
  29. package/dist/cli/live.js.map +1 -0
  30. package/dist/cli/offline.d.ts +23 -0
  31. package/dist/cli/offline.js +236 -0
  32. package/dist/cli/offline.js.map +1 -0
  33. package/dist/cli/probe.d.ts +23 -0
  34. package/dist/cli/probe.js +140 -0
  35. package/dist/cli/probe.js.map +1 -0
  36. package/dist/cli/render.d.ts +15 -0
  37. package/dist/cli/render.js +50 -0
  38. package/dist/cli/render.js.map +1 -0
  39. package/dist/cli/tui.d.ts +101 -0
  40. package/dist/cli/tui.js +334 -0
  41. package/dist/cli/tui.js.map +1 -0
  42. package/dist/config/index.d.ts +33 -0
  43. package/dist/config/index.js +48 -0
  44. package/dist/config/index.js.map +1 -0
  45. package/dist/connectors/connector.d.ts +58 -0
  46. package/dist/connectors/connector.js +30 -0
  47. package/dist/connectors/connector.js.map +1 -0
  48. package/dist/connectors/email/email-connector.d.ts +43 -0
  49. package/dist/connectors/email/email-connector.js +364 -0
  50. package/dist/connectors/email/email-connector.js.map +1 -0
  51. package/dist/connectors/github/github-connector.d.ts +52 -0
  52. package/dist/connectors/github/github-connector.js +271 -0
  53. package/dist/connectors/github/github-connector.js.map +1 -0
  54. package/dist/connectors/http.d.ts +34 -0
  55. package/dist/connectors/http.js +78 -0
  56. package/dist/connectors/http.js.map +1 -0
  57. package/dist/connectors/index.d.ts +34 -0
  58. package/dist/connectors/index.js +86 -0
  59. package/dist/connectors/index.js.map +1 -0
  60. package/dist/connectors/notion/notion-connector.d.ts +45 -0
  61. package/dist/connectors/notion/notion-connector.js +222 -0
  62. package/dist/connectors/notion/notion-connector.js.map +1 -0
  63. package/dist/connectors/slack/slack-connector.d.ts +43 -0
  64. package/dist/connectors/slack/slack-connector.js +291 -0
  65. package/dist/connectors/slack/slack-connector.js.map +1 -0
  66. package/dist/core/errors.d.ts +36 -0
  67. package/dist/core/errors.js +40 -0
  68. package/dist/core/errors.js.map +1 -0
  69. package/dist/core/logger.d.ts +14 -0
  70. package/dist/core/logger.js +44 -0
  71. package/dist/core/logger.js.map +1 -0
  72. package/dist/core/run-log.d.ts +37 -0
  73. package/dist/core/run-log.js +37 -0
  74. package/dist/core/run-log.js.map +1 -0
  75. package/dist/core/usage.d.ts +22 -0
  76. package/dist/core/usage.js +58 -0
  77. package/dist/core/usage.js.map +1 -0
  78. package/dist/dashboard/data.d.ts +62 -0
  79. package/dist/dashboard/data.js +84 -0
  80. package/dist/dashboard/data.js.map +1 -0
  81. package/dist/dashboard/page.d.ts +9 -0
  82. package/dist/dashboard/page.js +421 -0
  83. package/dist/dashboard/page.js.map +1 -0
  84. package/dist/dashboard/server.d.ts +19 -0
  85. package/dist/dashboard/server.js +44 -0
  86. package/dist/dashboard/server.js.map +1 -0
  87. package/dist/demo/bootstrap.d.ts +25 -0
  88. package/dist/demo/bootstrap.js +60 -0
  89. package/dist/demo/bootstrap.js.map +1 -0
  90. package/dist/demo/claude.d.ts +31 -0
  91. package/dist/demo/claude.js +230 -0
  92. package/dist/demo/claude.js.map +1 -0
  93. package/dist/demo/demo-connector.d.ts +19 -0
  94. package/dist/demo/demo-connector.js +168 -0
  95. package/dist/demo/demo-connector.js.map +1 -0
  96. package/dist/demo/world.d.ts +60 -0
  97. package/dist/demo/world.js +117 -0
  98. package/dist/demo/world.js.map +1 -0
  99. package/dist/index.d.ts +2 -0
  100. package/dist/index.js +396 -0
  101. package/dist/index.js.map +1 -0
  102. package/dist/ingest/ingest.d.ts +63 -0
  103. package/dist/ingest/ingest.js +258 -0
  104. package/dist/ingest/ingest.js.map +1 -0
  105. package/dist/llm/claude.d.ts +97 -0
  106. package/dist/llm/claude.js +163 -0
  107. package/dist/llm/claude.js.map +1 -0
  108. package/dist/memory/compaction.d.ts +22 -0
  109. package/dist/memory/compaction.js +79 -0
  110. package/dist/memory/compaction.js.map +1 -0
  111. package/dist/memory/file-store.d.ts +28 -0
  112. package/dist/memory/file-store.js +110 -0
  113. package/dist/memory/file-store.js.map +1 -0
  114. package/dist/memory/store.d.ts +32 -0
  115. package/dist/memory/store.js +2 -0
  116. package/dist/memory/store.js.map +1 -0
  117. package/dist/orchestrator/orchestrator.d.ts +63 -0
  118. package/dist/orchestrator/orchestrator.js +181 -0
  119. package/dist/orchestrator/orchestrator.js.map +1 -0
  120. package/dist/orchestrator/scheduler.d.ts +33 -0
  121. package/dist/orchestrator/scheduler.js +67 -0
  122. package/dist/orchestrator/scheduler.js.map +1 -0
  123. package/dist/orchestrator/seen-events.d.ts +21 -0
  124. package/dist/orchestrator/seen-events.js +71 -0
  125. package/dist/orchestrator/seen-events.js.map +1 -0
  126. package/dist/plugins/apply.d.ts +9 -0
  127. package/dist/plugins/apply.js +17 -0
  128. package/dist/plugins/apply.js.map +1 -0
  129. package/dist/plugins/define.d.ts +29 -0
  130. package/dist/plugins/define.js +30 -0
  131. package/dist/plugins/define.js.map +1 -0
  132. package/dist/plugins/loader.d.ts +31 -0
  133. package/dist/plugins/loader.js +61 -0
  134. package/dist/plugins/loader.js.map +1 -0
  135. package/dist/plugins/scaffold.d.ts +5 -0
  136. package/dist/plugins/scaffold.js +72 -0
  137. package/dist/plugins/scaffold.js.map +1 -0
  138. package/dist/tools/builtin.d.ts +8 -0
  139. package/dist/tools/builtin.js +63 -0
  140. package/dist/tools/builtin.js.map +1 -0
  141. package/dist/tools/tool.d.ts +84 -0
  142. package/dist/tools/tool.js +70 -0
  143. package/dist/tools/tool.js.map +1 -0
  144. package/dist/ui/agent-view.test.d.ts +1 -0
  145. package/dist/ui/agent-view.test.js +54 -0
  146. package/dist/ui/agent-view.test.js.map +1 -0
  147. package/dist/ui/agents-data.d.ts +7 -0
  148. package/dist/ui/agents-data.js +25 -0
  149. package/dist/ui/agents-data.js.map +1 -0
  150. package/dist/ui/app.d.ts +24 -0
  151. package/dist/ui/app.js +59 -0
  152. package/dist/ui/app.js.map +1 -0
  153. package/dist/ui/app.test.d.ts +1 -0
  154. package/dist/ui/app.test.js +47 -0
  155. package/dist/ui/app.test.js.map +1 -0
  156. package/dist/ui/components/key-hints.d.ts +4 -0
  157. package/dist/ui/components/key-hints.js +6 -0
  158. package/dist/ui/components/key-hints.js.map +1 -0
  159. package/dist/ui/components/menu.d.ts +11 -0
  160. package/dist/ui/components/menu.js +20 -0
  161. package/dist/ui/components/menu.js.map +1 -0
  162. package/dist/ui/create-wizard.test.d.ts +1 -0
  163. package/dist/ui/create-wizard.test.js +58 -0
  164. package/dist/ui/create-wizard.test.js.map +1 -0
  165. package/dist/ui/doctor-data.d.ts +6 -0
  166. package/dist/ui/doctor-data.js +29 -0
  167. package/dist/ui/doctor-data.js.map +1 -0
  168. package/dist/ui/history-data.d.ts +2 -0
  169. package/dist/ui/history-data.js +18 -0
  170. package/dist/ui/history-data.js.map +1 -0
  171. package/dist/ui/screens/agent.d.ts +8 -0
  172. package/dist/ui/screens/agent.js +95 -0
  173. package/dist/ui/screens/agent.js.map +1 -0
  174. package/dist/ui/screens/agents.d.ts +7 -0
  175. package/dist/ui/screens/agents.js +47 -0
  176. package/dist/ui/screens/agents.js.map +1 -0
  177. package/dist/ui/screens/create.d.ts +7 -0
  178. package/dist/ui/screens/create.js +141 -0
  179. package/dist/ui/screens/create.js.map +1 -0
  180. package/dist/ui/screens/doctor.d.ts +5 -0
  181. package/dist/ui/screens/doctor.js +13 -0
  182. package/dist/ui/screens/doctor.js.map +1 -0
  183. package/dist/ui/screens/history.d.ts +7 -0
  184. package/dist/ui/screens/history.js +50 -0
  185. package/dist/ui/screens/history.js.map +1 -0
  186. package/dist/ui/screens/home.d.ts +8 -0
  187. package/dist/ui/screens/home.js +35 -0
  188. package/dist/ui/screens/home.js.map +1 -0
  189. package/dist/ui/screens/plugins.d.ts +7 -0
  190. package/dist/ui/screens/plugins.js +40 -0
  191. package/dist/ui/screens/plugins.js.map +1 -0
  192. package/dist/ui/services.d.ts +33 -0
  193. package/dist/ui/services.js +67 -0
  194. package/dist/ui/services.js.map +1 -0
  195. package/dist/ui/start.d.ts +1 -0
  196. package/dist/ui/start.js +16 -0
  197. package/dist/ui/start.js.map +1 -0
  198. package/dist/ui/theme.d.ts +6 -0
  199. package/dist/ui/theme.js +26 -0
  200. package/dist/ui/theme.js.map +1 -0
  201. package/package.json +69 -0
@@ -0,0 +1,230 @@
1
+ const TRIAGE = {
2
+ match: /initech|overnight|inbox|email|triage|morning|webhook|ana/i,
3
+ turns: [
4
+ {
5
+ status: { activity: "searching", message: "combing the inbox and channels for Initech traffic" },
6
+ tools: [
7
+ { name: "email_search", input: { from: "initech", limit: 10 } },
8
+ { name: "slack_read_channel", input: { channel: "#initech-account", limit: 20 } },
9
+ ],
10
+ },
11
+ {
12
+ status: { activity: "reading", message: "Ana's reply about the webhook retries" },
13
+ tools: [{ name: "email_read_message", input: { uid: 4711 } }],
14
+ },
15
+ {
16
+ text: "Ana confirmed the staging fix held through their overnight soak test — zero dropped events. She's asking for the production date and the volume-pricing one-pager ahead of the September renewal. Engineering proposed Thursday for prod in #initech-account, so I'll confirm \"this week, date locked today\" without promising the exact day in writing, and route the pricing ask to Marcus. Drafting the reply now.\n",
17
+ status: { activity: "writing", message: "drafting a reply in the team's voice" },
18
+ tools: [
19
+ {
20
+ name: "email_send",
21
+ input: {
22
+ to: ["ana.flores@initech.example"],
23
+ subject: "Re: webhook retries dropping events",
24
+ body: "Hi Ana,\n\nGreat news on the soak test — thanks for running it. The fix is slated for production this week; I'm confirming the exact date with engineering today and will follow up the moment it's locked.\n\nOn volume pricing: looping in Marcus Webb, who's preparing the one-pager with finance so you have it well before the September kickoff.\n\nBest,\nJordan (covering support for Alex)",
25
+ inReplyTo: "<m-4711@initech.example>",
26
+ },
27
+ },
28
+ ],
29
+ },
30
+ {
31
+ tools: [
32
+ { name: "email_mark_read", input: { uid: 4711 } },
33
+ {
34
+ name: "remember",
35
+ input: {
36
+ text: "Ana (Initech) confirmed the staging webhook fix on 2026-06-12; promised prod date follow-up this week and routed the volume-pricing one-pager to Marcus before the September renewal.",
37
+ source: "email",
38
+ tags: ["initech", "ana", "renewal"],
39
+ },
40
+ },
41
+ ],
42
+ },
43
+ { status: { activity: "celebrating", message: "Initech thread handled end to end" } },
44
+ {
45
+ text: (ctx) => ctx.denied
46
+ ? "Understood — I didn't send the reply since it wasn't approved. The draft is in my notes: it confirms the soak-test result, promises the prod date this week, and routes the pricing one-pager to Marcus. Say the word (or re-run with approval) and it goes out. I did mark Ana's email read and noted the renewal context in memory."
47
+ : "Done. One thing came in overnight that mattered: Ana confirmed the staging fix held, so I replied confirming production this week (exact date to follow — kept it out of writing per our convention) and routed her volume-pricing ask to Marcus for the September renewal. Her email is marked read and the renewal context is saved to memory. Nothing else in the inbox needed action.",
48
+ },
49
+ ],
50
+ };
51
+ const PRIORITIES = {
52
+ match: /priorit|week|today|plan|focus/i,
53
+ turns: [
54
+ {
55
+ status: { activity: "reading", message: "reviewing the role briefing and open commitments" },
56
+ tools: [{ name: "recall", input: { query: "renewal commitments deadlines process", limit: 10 } }],
57
+ },
58
+ {
59
+ text: "Top of the list this week:\n\n" +
60
+ "1. Initech — confirm the production date for the webhook fix and get Ana her volume-pricing one-pager moving (renewal kickoff is early September; Marcus owns the commercial side).\n" +
61
+ "2. Monday's weekly support summary — due before noon, per the standing convention.\n" +
62
+ "3. Keep an eye on billing disputes: anything over $500 goes to Sam, not us.\n\n" +
63
+ "Want me to start the triage pass? Try: \"Anything from Initech overnight?\"",
64
+ },
65
+ ],
66
+ };
67
+ const IDENTITY = {
68
+ match: /who are you|are you (an? )?(ai|bot|human|robot)|yourself|real person/i,
69
+ turns: [
70
+ {
71
+ text: "I'm Jordan — an AI assistant covering the Customer Support Lead role that Alex Rivera held, running on Exempclaw. I'm configured for transparent disclosure, so I'll always say so when asked (and in outward email too). Right now you're talking to the offline demo brain: a scripted stand-in, a fictional inbox, zero API calls.",
72
+ },
73
+ ],
74
+ };
75
+ const MEMORY = {
76
+ match: /remember|memory|know about/i,
77
+ turns: [
78
+ {
79
+ status: { activity: "searching", message: "checking durable memory" },
80
+ tools: [{ name: "recall", input: { query: "initech renewal process", limit: 10 } }],
81
+ },
82
+ {
83
+ text: "Here's the shape of what I carry between sessions: Initech is the key account (Ana Flores, prefers email), their renewal kicks off in September with a volume-pricing ask, Marcus owns the commercial side, billing disputes over $500 escalate to Sam, and the weekly summary ships Mondays. Anything I learn while working — like today's soak-test confirmation — gets written back with the memory tool. You can browse it yourself with /memory.",
84
+ },
85
+ ],
86
+ };
87
+ const FALLBACK = {
88
+ match: /.*/,
89
+ turns: [
90
+ {
91
+ status: { activity: "thinking", message: "getting oriented in the demo workspace" },
92
+ tools: [{ name: "slack_read_channel", input: { channel: "#support", limit: 10 } }],
93
+ },
94
+ {
95
+ text: "This is the offline demo: I'm a scripted brain attached to the real Exempclaw runtime — real tool loop, real approval gates, real memory, fictional Initech workspace, no API key. Things worth trying:\n\n" +
96
+ '- "Anything from Initech overnight?" — a full triage: search, read, draft, and an outward email that asks for your approval\n' +
97
+ '- "What are my priorities this week?"\n' +
98
+ '- "Are you an AI?" — the disclosure policy at work\n' +
99
+ "- /memory, /cost, /help — operator commands\n\n" +
100
+ "When you connect a real key, the same agent runs on Claude instead of this script.",
101
+ },
102
+ ],
103
+ };
104
+ // Order matters: specific intents (identity, memory, priorities) win before
105
+ // the broad triage matcher, which also fires on bare "initech"/"inbox".
106
+ const SCENARIOS = [IDENTITY, MEMORY, PRIORITIES, TRIAGE, FALLBACK];
107
+ export class DemoClaude {
108
+ latencyMs;
109
+ streamDelayMs;
110
+ toolCounter = 0;
111
+ constructor(opts = {}) {
112
+ this.latencyMs = opts.latencyMs ?? 700;
113
+ this.streamDelayMs = opts.streamDelayMs ?? 16;
114
+ }
115
+ async turn(params) {
116
+ const { text: userText, assistantTurnsSince, denied } = analyzeMessages(params.messages);
117
+ const scenario = SCENARIOS.find((s) => s.match.test(userText)) ?? FALLBACK;
118
+ const turn = scenario.turns[Math.min(assistantTurnsSince, scenario.turns.length - 1)];
119
+ await sleep(this.latencyMs, params.signal);
120
+ throwIfAborted(params.signal);
121
+ const content = [];
122
+ const text = typeof turn.text === "function" ? turn.text({ denied }) : turn.text;
123
+ if (text) {
124
+ await this.streamText(text, params.onText, params.signal);
125
+ content.push({ type: "text", text, citations: null });
126
+ }
127
+ if (turn.status) {
128
+ content.push(this.toolUse("display_status", { activity: turn.status.activity, message: turn.status.message }));
129
+ }
130
+ for (const tool of turn.tools ?? []) {
131
+ content.push(this.toolUse(tool.name, tool.input));
132
+ }
133
+ const hasTools = content.some((b) => b.type === "tool_use");
134
+ return {
135
+ id: `msg_demo_${++this.toolCounter}`,
136
+ type: "message",
137
+ role: "assistant",
138
+ model: params.model ?? "claude-demo",
139
+ content,
140
+ stop_reason: hasTools ? "tool_use" : "end_turn",
141
+ stop_sequence: null,
142
+ usage: fabricateUsage(params.messages.length, assistantTurnsSince, text?.length ?? 0),
143
+ };
144
+ }
145
+ async summarize() {
146
+ await sleep(this.latencyMs / 2);
147
+ return "Demo summary: earlier turns covered Initech triage — Ana confirmed the staging webhook fix, a reply was drafted, and the September renewal context was recorded.";
148
+ }
149
+ toolUse(name, input) {
150
+ return { type: "tool_use", id: `toolu_demo_${++this.toolCounter}`, name, input };
151
+ }
152
+ async streamText(text, onText, signal) {
153
+ if (!onText)
154
+ return;
155
+ if (this.streamDelayMs <= 0) {
156
+ onText(text);
157
+ return;
158
+ }
159
+ for (const word of text.split(/(?<=\s)/)) {
160
+ throwIfAborted(signal);
161
+ onText(word);
162
+ await sleep(this.streamDelayMs, signal);
163
+ }
164
+ }
165
+ }
166
+ /** Finds the operator's last real message, turns since it, and denial state. */
167
+ export function analyzeMessages(messages) {
168
+ let text = "";
169
+ let assistantTurnsSince = 0;
170
+ let denied = false;
171
+ let foundUser = false;
172
+ for (let i = messages.length - 1; i >= 0; i--) {
173
+ const msg = messages[i];
174
+ if (msg.role === "assistant") {
175
+ if (!foundUser)
176
+ assistantTurnsSince++;
177
+ continue;
178
+ }
179
+ if (typeof msg.content === "string") {
180
+ text = msg.content;
181
+ foundUser = true;
182
+ break;
183
+ }
184
+ const toolResults = msg.content.filter((b) => b.type === "tool_result");
185
+ if (toolResults.length > 0) {
186
+ if (!foundUser) {
187
+ for (const result of toolResults) {
188
+ const body = typeof result.content === "string" ? result.content : JSON.stringify(result.content ?? "");
189
+ if (result.is_error && /denied/i.test(body))
190
+ denied = true;
191
+ }
192
+ }
193
+ continue;
194
+ }
195
+ const textBlock = msg.content.find((b) => b.type === "text");
196
+ if (textBlock && textBlock.type === "text") {
197
+ text = textBlock.text;
198
+ foundUser = true;
199
+ break;
200
+ }
201
+ }
202
+ return { text, assistantTurnsSince, denied };
203
+ }
204
+ function fabricateUsage(messageCount, step, outputChars) {
205
+ const input = 900 + messageCount * 240;
206
+ return {
207
+ input_tokens: step === 0 ? input : Math.round(input * 0.12),
208
+ output_tokens: Math.max(60, Math.round(outputChars / 3.5) + 90),
209
+ cache_read_input_tokens: step === 0 ? 0 : Math.round(input * 0.88),
210
+ cache_creation_input_tokens: step === 0 ? Math.round(input * 0.6) : 120,
211
+ };
212
+ }
213
+ function sleep(ms, signal) {
214
+ if (ms <= 0)
215
+ return Promise.resolve();
216
+ return new Promise((resolve) => {
217
+ const timer = setTimeout(done, ms);
218
+ function done() {
219
+ signal?.removeEventListener("abort", done);
220
+ clearTimeout(timer);
221
+ resolve();
222
+ }
223
+ signal?.addEventListener("abort", done, { once: true });
224
+ });
225
+ }
226
+ function throwIfAborted(signal) {
227
+ if (signal?.aborted)
228
+ throw new Error("aborted");
229
+ }
230
+ //# sourceMappingURL=claude.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"claude.js","sourceRoot":"","sources":["../../src/demo/claude.ts"],"names":[],"mappings":"AAmCA,MAAM,MAAM,GAAa;IACvB,KAAK,EAAE,2DAA2D;IAClE,KAAK,EAAE;QACL;YACE,MAAM,EAAE,EAAE,QAAQ,EAAE,WAAW,EAAE,OAAO,EAAE,oDAAoD,EAAE;YAChG,KAAK,EAAE;gBACL,EAAE,IAAI,EAAE,cAAc,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE;gBAC/D,EAAE,IAAI,EAAE,oBAAoB,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,kBAAkB,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE;aAClF;SACF;QACD;YACE,MAAM,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,OAAO,EAAE,uCAAuC,EAAE;YACjF,KAAK,EAAE,CAAC,EAAE,IAAI,EAAE,oBAAoB,EAAE,KAAK,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE,CAAC;SAC9D;QACD;YACE,IAAI,EAAE,2ZAA2Z;YACja,MAAM,EAAE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K,GAAG,IAAI,CAAC;QAClE,2BAA2B,EAAE,IAAI,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG;KACrD,CAAC;AACvB,CAAC;AAED,SAAS,KAAK,CAAC,EAAU,EAAE,MAAoB;IAC7C,IAAI,EAAE,IAAI,CAAC;QAAE,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;IACtC,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;QAC7B,MAAM,KAAK,GAAG,UAAU,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;QACnC,SAAS,IAAI;YACX,MAAM,EAAE,mBAAmB,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;YAC3C,YAAY,CAAC,KAAK,CAAC,CAAC;YACpB,OAAO,EAAE,CAAC;QACZ,CAAC;QACD,MAAM,EAAE,gBAAgB,CAAC,OAAO,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;IAC1D,CAAC,CAAC,CAAC;AACL,CAAC;AAED,SAAS,cAAc,CAAC,MAAoB;IAC1C,IAAI,MAAM,EAAE,OAAO;QAAE,MAAM,IAAI,KAAK,CAAC,SAAS,CAAC,CAAC;AAClD,CAAC"}
@@ -0,0 +1,19 @@
1
+ import type { Connector, ConnectorContext } from "../connectors/connector.js";
2
+ import { type Tool } from "../tools/tool.js";
3
+ import { DemoWorld } from "./world.js";
4
+ /**
5
+ * The demo connector: the same email/Slack tool surface as the real
6
+ * connectors (same names, same schemas, same outward gating), backed by the
7
+ * fictional DemoWorld instead of IMAP/Slack. Needs no credentials.
8
+ *
9
+ * It exists for demo mode, but it's also handy as a sandbox: point any agent
10
+ * (including one running on the real Claude API) at `"connectors": ["demo"]`
11
+ * and let it act on the fictional workspace safely.
12
+ */
13
+ export declare class DemoConnector implements Connector {
14
+ readonly id = "demo";
15
+ readonly world: DemoWorld;
16
+ private log;
17
+ init(ctx: ConnectorContext): Promise<void>;
18
+ tools(): Tool[];
19
+ }
@@ -0,0 +1,168 @@
1
+ import { z } from "zod";
2
+ import { defineTool } from "../tools/tool.js";
3
+ import { DemoWorld } from "./world.js";
4
+ /**
5
+ * The demo connector: the same email/Slack tool surface as the real
6
+ * connectors (same names, same schemas, same outward gating), backed by the
7
+ * fictional DemoWorld instead of IMAP/Slack. Needs no credentials.
8
+ *
9
+ * It exists for demo mode, but it's also handy as a sandbox: point any agent
10
+ * (including one running on the real Claude API) at `"connectors": ["demo"]`
11
+ * and let it act on the fictional workspace safely.
12
+ */
13
+ export class DemoConnector {
14
+ id = "demo";
15
+ world = new DemoWorld();
16
+ log;
17
+ async init(ctx) {
18
+ this.log = ctx.log.child({ scope: "connector", connector: this.id });
19
+ this.log.debug("demo connector ready (fictional workspace, no credentials)");
20
+ }
21
+ tools() {
22
+ const world = this.world;
23
+ const listInbox = defineTool({
24
+ name: "email_list_inbox",
25
+ description: "List recent inbox messages (newest first) with their uid, sender, subject, and read state.",
26
+ schema: z.object({
27
+ limit: z.number().int().min(1).max(50).default(10),
28
+ unreadOnly: z.boolean().default(false),
29
+ }),
30
+ execute: async (input) => {
31
+ const rows = world.emails
32
+ .filter((e) => (input.unreadOnly ? !e.seen : true))
33
+ .slice(-input.limit)
34
+ .reverse()
35
+ .map((e) => `uid=${e.uid}${e.seen ? "" : " [unread]"} ${e.date} from ${e.from} — ${e.subject} messageId=${e.messageId}`);
36
+ return { content: rows.length ? rows.join("\n") : "Inbox is empty." };
37
+ },
38
+ });
39
+ const readMessage = defineTool({
40
+ name: "email_read_message",
41
+ description: "Read one email in full by its uid (from email_list_inbox or email_search).",
42
+ schema: z.object({ uid: z.number().int().min(1) }),
43
+ execute: async (input) => {
44
+ const mail = world.findEmail(input.uid);
45
+ if (!mail)
46
+ return { content: `No message with uid ${input.uid}.`, isError: true };
47
+ return {
48
+ content: [
49
+ `uid=${mail.uid}`,
50
+ `From: ${mail.from}`,
51
+ `To: ${mail.to}`,
52
+ `Date: ${mail.date}`,
53
+ `Subject: ${mail.subject}`,
54
+ `messageId: ${mail.messageId}`,
55
+ "",
56
+ mail.body,
57
+ ].join("\n"),
58
+ };
59
+ },
60
+ });
61
+ const searchMail = defineTool({
62
+ name: "email_search",
63
+ description: "Search the inbox by sender, subject, body text, and/or age. Returns matching messages, newest first.",
64
+ schema: z.object({
65
+ from: z.string().optional(),
66
+ subject: z.string().optional(),
67
+ text: z.string().optional(),
68
+ sinceDays: z.number().int().min(1).max(365).optional(),
69
+ limit: z.number().int().min(1).max(50).default(10),
70
+ }),
71
+ execute: async (input) => {
72
+ const hits = world.searchEmails(input).slice(-input.limit).reverse();
73
+ if (hits.length === 0)
74
+ return { content: "No matching messages." };
75
+ return {
76
+ content: hits
77
+ .map((e) => `uid=${e.uid}${e.seen ? "" : " [unread]"} ${e.date} from ${e.from} — ${e.subject} messageId=${e.messageId}`)
78
+ .join("\n"),
79
+ };
80
+ },
81
+ });
82
+ const markRead = defineTool({
83
+ name: "email_mark_read",
84
+ description: "Mark a message as read (seen) by uid once you've handled it.",
85
+ schema: z.object({ uid: z.number().int().min(1) }),
86
+ execute: async (input) => {
87
+ const mail = world.findEmail(input.uid);
88
+ if (!mail)
89
+ return { content: `No message with uid ${input.uid}.`, isError: true };
90
+ mail.seen = true;
91
+ return { content: `Marked uid ${input.uid} as read.` };
92
+ },
93
+ });
94
+ const sendEmail = defineTool({
95
+ name: "email_send",
96
+ description: "Send an email. To reply within a thread, pass the original message's messageId as inReplyTo. Acts outward; requires approval.",
97
+ outward: true,
98
+ schema: z.object({
99
+ to: z.array(z.string().email()).min(1),
100
+ cc: z.array(z.string().email()).default([]),
101
+ subject: z.string().min(1),
102
+ body: z.string().min(1),
103
+ inReplyTo: z.string().optional(),
104
+ }),
105
+ execute: async (input) => {
106
+ world.sendEmail({ to: input.to, subject: input.subject, body: input.body, inReplyTo: input.inReplyTo });
107
+ return { content: `Sent "${input.subject}" to ${input.to.join(", ")} (id <demo-sent-${world.sentEmails.length}@acme.example>).` };
108
+ },
109
+ });
110
+ const listChannels = defineTool({
111
+ name: "slack_list_channels",
112
+ description: "List Slack channels the agent can see (id and name).",
113
+ schema: z.object({ limit: z.number().int().min(1).max(200).default(50) }),
114
+ execute: async () => ({
115
+ content: world.channels.map((c) => `${c.id} #${c.name} (member)`).join("\n"),
116
+ }),
117
+ });
118
+ const readChannel = defineTool({
119
+ name: "slack_read_channel",
120
+ description: "Read recent messages from a Slack channel (newest last). Accepts a channel id or #name.",
121
+ schema: z.object({ channel: z.string(), limit: z.number().int().min(1).max(100).default(20) }),
122
+ execute: async (input) => {
123
+ const channel = world.findChannel(input.channel);
124
+ if (!channel)
125
+ return { content: `channel not found: ${input.channel}`, isError: true };
126
+ const rows = channel.messages.slice(-input.limit).map((m) => `[ts=${m.ts}] ${m.user}: ${m.text}`);
127
+ return { content: `channel=${channel.id}\n${rows.join("\n")}` };
128
+ },
129
+ });
130
+ const readThread = defineTool({
131
+ name: "slack_read_thread",
132
+ description: "Read a Slack thread by its channel and root thread_ts (newest last).",
133
+ schema: z.object({
134
+ channel: z.string(),
135
+ threadTs: z.string(),
136
+ limit: z.number().int().min(1).max(100).default(50),
137
+ }),
138
+ execute: async (input) => {
139
+ const channel = world.findChannel(input.channel);
140
+ if (!channel)
141
+ return { content: `channel not found: ${input.channel}`, isError: true };
142
+ const rows = channel.messages
143
+ .filter((m) => m.ts === input.threadTs || m.threadTs === input.threadTs)
144
+ .map((m) => `[ts=${m.ts}] ${m.user}: ${m.text}`);
145
+ return { content: rows.length ? rows.join("\n") : "(empty thread)" };
146
+ },
147
+ });
148
+ const postMessage = defineTool({
149
+ name: "slack_post_message",
150
+ description: "Post a message to a Slack channel, or reply in a thread by passing threadTs. Acts outward; requires approval.",
151
+ outward: true,
152
+ schema: z.object({
153
+ channel: z.string(),
154
+ text: z.string().min(1),
155
+ threadTs: z.string().optional(),
156
+ }),
157
+ execute: async (input) => {
158
+ const channel = world.findChannel(input.channel);
159
+ if (!channel)
160
+ return { content: `channel not found: ${input.channel}`, isError: true };
161
+ const ts = world.postMessage(channel, input.text, input.threadTs);
162
+ return { content: `Posted to ${channel.id} at ts=${ts}.` };
163
+ },
164
+ });
165
+ return [listInbox, readMessage, searchMail, markRead, sendEmail, listChannels, readChannel, readThread, postMessage];
166
+ }
167
+ }
168
+ //# sourceMappingURL=demo-connector.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"demo-connector.js","sourceRoot":"","sources":["../../src/demo/demo-connector.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,UAAU,EAAa,MAAM,kBAAkB,CAAC;AAEzD,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAEvC;;;;;;;;GAQG;AACH,MAAM,OAAO,aAAa;IACf,EAAE,GAAG,MAAM,CAAC;IACZ,KAAK,GAAG,IAAI,SAAS,EAAE,CAAC;IACzB,GAAG,CAAU;IAErB,KAAK,CAAC,IAAI,CAAC,GAAqB;QAC9B,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC;QACrE,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,4DAA4D,CAAC,CAAC;IAC/E,CAAC;IAED,KAAK;QACH,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;QAEzB,MAAM,SAAS,GAAG,UAAU,CAAC;YAC3B,IAAI,EAAE,kBAAkB;YACxB,WAAW,EAAE,4FAA4F;YACzG,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC;gBACf,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC;gBAClD,UAA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,IAAI;YACb,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC;gBACf,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE;gBACnB,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;gBACvB,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;aAChC,CAAC;YACF,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE;gBACvB,MAAM,OAAO,GAAG,KAAK,CAAC,WAAW,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;gBACjD,IAAI,CAAC,OAAO;oBAAE,OAAO,EAAE,OAAO,EAAE,sBAAsB,KAAK,CAAC,OAAO,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;gBACvF,MAAM,EAAE,GAAG,KAAK,CAAC,WAAW,CAAC,OAAO,EAAE,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAC;gBAClE,OAAO,EAAE,OAAO,EAAE,aAAa,OAAO,CAAC,EAAE,UAAU,EAAE,GAAG,EAAE,CAAC;YAC7D,CAAC;SACF,CAAC,CAAC;QAEH,OAAO,CAAC,SAAS,EAAE,WAAW,EAAE,UAAU,EAAE,QAAQ,EAAE,SAAS,EAAE,YAAY,EAAE,WAAW,EAAE,UAAU,EAAE,WAAW,CAAC,CAAC;IACvH,CAAC;CACF"}
@@ -0,0 +1,60 @@
1
+ /**
2
+ * The fictional workspace behind demo mode: a small, consistent Initech
3
+ * support universe. The demo connector's tools read and write this world, so
4
+ * the experience (uids, messageIds, thread replies) looks exactly like the
5
+ * real connectors — but nothing leaves the process.
6
+ */
7
+ export interface DemoEmail {
8
+ uid: number;
9
+ from: string;
10
+ to: string;
11
+ subject: string;
12
+ date: string;
13
+ messageId: string;
14
+ body: string;
15
+ seen: boolean;
16
+ }
17
+ export interface DemoSlackMessage {
18
+ user: string;
19
+ text: string;
20
+ ts: string;
21
+ threadTs?: string;
22
+ }
23
+ export interface DemoSlackChannel {
24
+ id: string;
25
+ name: string;
26
+ messages: DemoSlackMessage[];
27
+ }
28
+ export interface SentEmail {
29
+ to: string[];
30
+ subject: string;
31
+ body: string;
32
+ inReplyTo?: string;
33
+ at: string;
34
+ }
35
+ export declare class DemoWorld {
36
+ readonly emails: DemoEmail[];
37
+ readonly channels: DemoSlackChannel[];
38
+ readonly sentEmails: SentEmail[];
39
+ readonly postedMessages: Array<{
40
+ channel: string;
41
+ text: string;
42
+ threadTs?: string;
43
+ ts: string;
44
+ }>;
45
+ private nextTs;
46
+ findEmail(uid: number): DemoEmail | undefined;
47
+ searchEmails(query: {
48
+ from?: string;
49
+ subject?: string;
50
+ text?: string;
51
+ }): DemoEmail[];
52
+ findChannel(ref: string): DemoSlackChannel | undefined;
53
+ sendEmail(mail: Omit<SentEmail, "at">): SentEmail;
54
+ postMessage(channel: DemoSlackChannel, text: string, threadTs?: string): string;
55
+ }
56
+ /** Memories seeded into a fresh demo agent, consistent with the world above. */
57
+ export declare const DEMO_SEED_MEMORIES: Array<{
58
+ text: string;
59
+ tags: string[];
60
+ }>;
@@ -0,0 +1,117 @@
1
+ /**
2
+ * The fictional workspace behind demo mode: a small, consistent Initech
3
+ * support universe. The demo connector's tools read and write this world, so
4
+ * the experience (uids, messageIds, thread replies) looks exactly like the
5
+ * real connectors — but nothing leaves the process.
6
+ */
7
+ export class DemoWorld {
8
+ emails = [
9
+ {
10
+ uid: 4709,
11
+ from: "Marcus Webb <marcus@acme.example>",
12
+ to: "support@acme.example",
13
+ subject: "FYI — Initech renewal kickoff in September",
14
+ date: "2026-06-10T15:20:00Z",
15
+ messageId: "<m-4709@acme.example>",
16
+ body: "Heads up: Initech's finance team starts the renewal conversation in early September. " +
17
+ "Ana hinted they'll push for volume pricing. Let's have the one-pager ready before then.\n\n— Marcus",
18
+ seen: true,
19
+ },
20
+ {
21
+ uid: 4710,
22
+ from: "StatusBot <alerts@acme.example>",
23
+ to: "support@acme.example",
24
+ subject: "[resolved] elevated webhook retry latency",
25
+ date: "2026-06-11T22:41:00Z",
26
+ messageId: "<m-4710@acme.example>",
27
+ body: "The staging fix for webhook retry drops deployed cleanly at 22:30 UTC. Error rate back to baseline.",
28
+ seen: true,
29
+ },
30
+ {
31
+ uid: 4711,
32
+ from: "Ana Flores <ana.flores@initech.example>",
33
+ to: "support@acme.example",
34
+ subject: "Re: webhook retries dropping events",
35
+ date: "2026-06-12T06:55:00Z",
36
+ messageId: "<m-4711@initech.example>",
37
+ body: "Morning — we ran our soak test against staging overnight and the dropped-event rate is zero. " +
38
+ "Looks like your fix holds. Two asks:\n\n" +
39
+ "1. When does it land in production? Our finance close runs on these webhooks.\n" +
40
+ "2. Could you send the volume-pricing one-pager before our renewal kickoff in September?\n\nThanks,\nAna",
41
+ seen: false,
42
+ },
43
+ ];
44
+ channels = [
45
+ {
46
+ id: "C0DEMO1",
47
+ name: "support",
48
+ messages: [
49
+ { user: "priya", text: "Quiet night — two password resets, both self-served.", ts: "1765531200.000100" },
50
+ {
51
+ user: "marcus",
52
+ text: "If Ana confirms the staging fix, let's get the prod date locked today.",
53
+ ts: "1765537200.000200",
54
+ },
55
+ ],
56
+ },
57
+ {
58
+ id: "C0DEMO2",
59
+ name: "initech-account",
60
+ messages: [
61
+ {
62
+ user: "marcus",
63
+ text: "Renewal kickoff is September. Volume pricing one-pager is the ask — drafting with finance.",
64
+ ts: "1765520000.000300",
65
+ },
66
+ {
67
+ user: "engineering-bot",
68
+ text: "webhook-retry fix: staging soak PASSED (0 drops / 48h). Prod rollout proposed for Thursday.",
69
+ ts: "1765540000.000400",
70
+ },
71
+ ],
72
+ },
73
+ ];
74
+ sentEmails = [];
75
+ postedMessages = [];
76
+ nextTs = 1765550000;
77
+ findEmail(uid) {
78
+ return this.emails.find((e) => e.uid === uid);
79
+ }
80
+ searchEmails(query) {
81
+ const norm = (s) => s.toLowerCase();
82
+ return this.emails.filter((e) => {
83
+ if (query.from && !norm(e.from).includes(norm(query.from)))
84
+ return false;
85
+ if (query.subject && !norm(e.subject).includes(norm(query.subject)))
86
+ return false;
87
+ if (query.text && !norm(e.body).includes(norm(query.text)))
88
+ return false;
89
+ return true;
90
+ });
91
+ }
92
+ findChannel(ref) {
93
+ const name = ref.replace(/^#/, "").toLowerCase();
94
+ return this.channels.find((c) => c.id === ref || c.name === name);
95
+ }
96
+ sendEmail(mail) {
97
+ const sent = { ...mail, at: new Date().toISOString() };
98
+ this.sentEmails.push(sent);
99
+ return sent;
100
+ }
101
+ postMessage(channel, text, threadTs) {
102
+ const ts = `${this.nextTs++}.000000`;
103
+ channel.messages.push({ user: "jordan (you)", text, ts, ...(threadTs ? { threadTs } : {}) });
104
+ this.postedMessages.push({ channel: channel.id, text, ts, ...(threadTs ? { threadTs } : {}) });
105
+ return ts;
106
+ }
107
+ }
108
+ /** Memories seeded into a fresh demo agent, consistent with the world above. */
109
+ export const DEMO_SEED_MEMORIES = [
110
+ { text: "Initech is our largest account; Ana Flores is the main contact and prefers email.", tags: ["initech", "ana"] },
111
+ { text: "Initech's renewal conversation starts early September; they want a volume-pricing one-pager first.", tags: ["initech", "renewal", "deadline"] },
112
+ { text: "Marcus Webb is the account executive for Initech — loop him in on anything commercial (#initech-account).", tags: ["marcus", "initech"] },
113
+ { text: "Billing disputes over $500 are escalated to Sam in Billing; never promise refunds directly.", tags: ["process", "billing"] },
114
+ { text: "The weekly support summary goes out Mondays before noon.", tags: ["process", "recurring"] },
115
+ { text: "Never commit to engineering timelines in writing; say you'll check with the team and come back.", tags: ["process", "convention"] },
116
+ ];
117
+ //# sourceMappingURL=world.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"world.js","sourceRoot":"","sources":["../../src/demo/world.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAkCH,MAAM,OAAO,SAAS;IACX,MAAM,GAAgB;QAC7B;YACE,GAAG,EAAE,IAAI;YACT,IAAI,EAAE,mCAAmC;YACzC,EAAE,EAAE,sBAAsB;YAC1B,OAAO,EAAE,4C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