@jungjaehoon/mama-os 0.58.0 → 0.58.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 (32) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/README.md +1 -1
  3. package/dist/api/code-act-actions.d.ts +28 -0
  4. package/dist/api/code-act-actions.d.ts.map +1 -0
  5. package/dist/api/code-act-actions.js +216 -0
  6. package/dist/api/code-act-actions.js.map +1 -0
  7. package/dist/api/help-actions.d.ts +6 -3
  8. package/dist/api/help-actions.d.ts.map +1 -1
  9. package/dist/api/help-actions.js +140 -28
  10. package/dist/api/help-actions.js.map +1 -1
  11. package/dist/runtime/action-mcp-server.d.ts.map +1 -1
  12. package/dist/runtime/action-mcp-server.js +29 -7
  13. package/dist/runtime/action-mcp-server.js.map +1 -1
  14. package/dist/runtime/action-surface.d.ts +1 -1
  15. package/dist/runtime/action-surface.d.ts.map +1 -1
  16. package/dist/runtime/action-surface.js +18 -6
  17. package/dist/runtime/action-surface.js.map +1 -1
  18. package/dist/runtime/owner-system-prompt.d.ts +0 -1
  19. package/dist/runtime/owner-system-prompt.d.ts.map +1 -1
  20. package/dist/runtime/owner-system-prompt.js +22 -24
  21. package/dist/runtime/owner-system-prompt.js.map +1 -1
  22. package/dist/runtime/stimulus-delivery.d.ts.map +1 -1
  23. package/dist/runtime/stimulus-delivery.js +4 -5
  24. package/dist/runtime/stimulus-delivery.js.map +1 -1
  25. package/dist/runtime/turn-orders.d.ts +1 -1
  26. package/dist/runtime/turn-orders.d.ts.map +1 -1
  27. package/dist/runtime/turn-orders.js +9 -13
  28. package/dist/runtime/turn-orders.js.map +1 -1
  29. package/dist/utils/untrusted-content.d.ts.map +1 -1
  30. package/dist/utils/untrusted-content.js +4 -1
  31. package/dist/utils/untrusted-content.js.map +1 -1
  32. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -7,6 +7,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.58.1] - 2026-09-29
11
+
12
+ ### Changed
13
+
14
+ - Each owner action is listed with its arguments; `help` returns types, descriptions and examples
15
+ as text; the tool-use example shows a targeted, filtered read. See the root CHANGELOG.
16
+
10
17
  ## [0.58.0] - 2026-09-29
11
18
 
12
19
  The owner agent runs in the reference operator's structure: a short session start, lessons that
package/README.md CHANGED
@@ -4,7 +4,7 @@ One owner agent on Claude or Codex watches connected work, keeps task revisions
4
4
  answers on Telegram, publishes reports and a board, and recalls corrections.
5
5
  [mama-core](../mama-core/README.md) supplies the shared engine.
6
6
 
7
- Current manifest: **0.58.0**. This README describes the unreleased `rebuild/owner-flow` source.
7
+ Current manifest: **0.58.1**. This README describes the unreleased `rebuild/owner-flow` source.
8
8
  Use [owner setup](../../docs/start/owner-setup.md) with Node.js 22.13+ and pnpm.
9
9
 
10
10
  ## Start and operate
@@ -0,0 +1,28 @@
1
+ import type { ActionContract, ActionDispatcher, ActionRegistration } from '@jungjaehoon/mama-core';
2
+ export interface CodeActHost {
3
+ /** The action names the code may call, e.g. `work.list`. */
4
+ functions: readonly {
5
+ name: string;
6
+ }[];
7
+ call(name: string, input: unknown): Promise<unknown>;
8
+ }
9
+ export interface CodeActResult {
10
+ success: boolean;
11
+ value?: unknown;
12
+ error?: {
13
+ name: string;
14
+ message: string;
15
+ };
16
+ logs: string[];
17
+ hostCallCount: number;
18
+ durationMs: number;
19
+ }
20
+ /** Run the code in a fresh worker process; host calls are answered by `host.call`. */
21
+ export declare function runCodeAct(code: string, host: CodeActHost, timeoutMs?: number): Promise<CodeActResult>;
22
+ export declare const CODE_ACT_CONTRACT: ActionContract;
23
+ /**
24
+ * The code_act action over a dispatcher built after it: the functions are the actions the
25
+ * caller is granted, and each call is dispatched with the caller's own context.
26
+ */
27
+ export declare function codeActRegistration(dispatcher: () => ActionDispatcher): ActionRegistration;
28
+ //# sourceMappingURL=code-act-actions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"code-act-actions.d.ts","sourceRoot":"","sources":["../../src/api/code-act-actions.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAEV,cAAc,EACd,gBAAgB,EAChB,kBAAkB,EACnB,MAAM,wBAAwB,CAAC;AAgEhC,MAAM,WAAW,WAAW;IAC1B,4DAA4D;IAC5D,SAAS,EAAE,SAAS;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IACvC,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CACtD;AAED,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,KAAK,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;IAC1C,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,EAAE,MAAM,CAAC;CACpB;AAID,sFAAsF;AACtF,wBAAgB,UAAU,CACxB,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,WAAW,EACjB,SAAS,SAAqB,GAC7B,OAAO,CAAC,aAAa,CAAC,CA+FxB;AAED,eAAO,MAAM,iBAAiB,EAAE,cAiB/B,CAAC;AAEF;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,UAAU,EAAE,MAAM,gBAAgB,GAAG,kBAAkB,CAoC1F"}
@@ -0,0 +1,216 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CODE_ACT_CONTRACT = void 0;
4
+ exports.runCodeAct = runCodeAct;
5
+ exports.codeActRegistration = codeActRegistration;
6
+ /**
7
+ * code_act: the agent runs one piece of JavaScript that calls several actions, instead of
8
+ * one model round trip per action.
9
+ *
10
+ * Mechanism ported from Kagemusha's code-act sandbox and worker. The code runs in its own
11
+ * Node process; every action it calls is relayed over IPC to this process and dispatched
12
+ * with the calling turn's own context, so the grant, session and traces are the caller's.
13
+ * The worker runs under Node's permission model: `vm` gives the code a clean namespace but
14
+ * is not a boundary, and an escaped script must reach no files, processes or network.
15
+ */
16
+ const node_child_process_1 = require("node:child_process");
17
+ const WORKER_SOURCE = `
18
+ const vm = require('node:vm');
19
+ const pending = new Map();
20
+ let nextId = 0;
21
+ function callTool(name, params) {
22
+ const id = String(++nextId);
23
+ return new Promise((resolve, reject) => {
24
+ pending.set(id, { resolve, reject });
25
+ process.send({ type: 'callTool', id, name, params });
26
+ });
27
+ }
28
+ function assignNested(root, path, fn) {
29
+ let cursor = root;
30
+ for (let i = 0; i < path.length - 1; i++) {
31
+ if (!cursor[path[i]] || typeof cursor[path[i]] !== 'object') cursor[path[i]] = {};
32
+ cursor = cursor[path[i]];
33
+ }
34
+ cursor[path[path.length - 1]] = fn;
35
+ }
36
+ process.on('disconnect', () => process.exit(1));
37
+ process.on('message', async (msg) => {
38
+ if (msg.type === 'toolResult') {
39
+ const call = pending.get(msg.id);
40
+ if (!call) return;
41
+ pending.delete(msg.id);
42
+ if (msg.error !== undefined) call.reject(new Error(msg.error));
43
+ else call.resolve(msg.result);
44
+ return;
45
+ }
46
+ if (msg.type !== 'execute') return;
47
+ const logs = [];
48
+ const sandbox = {
49
+ console: { log: (...args) => logs.push(args.map((a) => (typeof a === 'string' ? a : JSON.stringify(a))).join(' ')) },
50
+ callTool,
51
+ };
52
+ for (const name of msg.functionNames) {
53
+ const proxy = (params) => callTool(name, params);
54
+ if (name.includes('.')) assignNested(sandbox, name.split('.'), proxy);
55
+ else sandbox[name] = proxy;
56
+ }
57
+ sandbox.globalThis = sandbox;
58
+ try {
59
+ const trimmed = msg.code.trim();
60
+ // A single line with no statement keyword is returned; its closing semicolon is dropped.
61
+ const expression = trimmed.replace(/;$/, '');
62
+ const needsReturn =
63
+ !expression.startsWith('return ') && !expression.startsWith('return\\n') && !expression.includes('\\n') &&
64
+ !/^(if|for|while|var|let|const|switch|try|throw|class|function)\\b/.test(expression);
65
+ const body = needsReturn ? 'return ' + expression : msg.code;
66
+ const script = new vm.Script('(async () => { ' + body + '\\n})()', { filename: 'code_act.js' });
67
+ const value = await script.runInContext(vm.createContext(sandbox), { timeout: msg.timeoutMs });
68
+ process.send({ type: 'result', success: true, value, logs }, () => process.exit(0));
69
+ } catch (error) {
70
+ process.send(
71
+ { type: 'result', success: false, logs, error: { name: error && error.name ? error.name : 'Error', message: error && error.message ? error.message : String(error) } },
72
+ () => process.exit(0)
73
+ );
74
+ }
75
+ });
76
+ process.send({ type: 'ready' });
77
+ `;
78
+ const DEFAULT_TIMEOUT_MS = 300_000;
79
+ /** Run the code in a fresh worker process; host calls are answered by `host.call`. */
80
+ function runCodeAct(code, host, timeoutMs = DEFAULT_TIMEOUT_MS) {
81
+ const startedAt = Date.now();
82
+ let hostCallCount = 0;
83
+ return new Promise((resolve) => {
84
+ // An empty environment: --permission does not guard process.env, and the daemon's holds
85
+ // MAMA's own credentials (auth.env), which an escaped script must not read.
86
+ const child = (0, node_child_process_1.spawn)(process.execPath, ['--permission', '-e', WORKER_SOURCE], {
87
+ stdio: ['ignore', 'ignore', 'pipe', 'ipc'],
88
+ env: {},
89
+ });
90
+ let stderr = '';
91
+ let settled = false;
92
+ const settle = (result) => {
93
+ if (settled)
94
+ return;
95
+ settled = true;
96
+ clearTimeout(timer);
97
+ child.kill('SIGKILL');
98
+ resolve({ ...result, hostCallCount, durationMs: Date.now() - startedAt });
99
+ };
100
+ const timer = setTimeout(() => settle({
101
+ success: false,
102
+ error: { name: 'TimeoutError', message: `code_act timed out after ${timeoutMs}ms` },
103
+ logs: [],
104
+ }), timeoutMs);
105
+ child.stderr.on('data', (chunk) => {
106
+ // Keep the tail only: an escaped script could write to stderr for the whole timeout.
107
+ stderr = (stderr + chunk.toString('utf8')).slice(-2000);
108
+ });
109
+ child.on('message', async (msg) => {
110
+ if (msg.type === 'ready') {
111
+ child.send({
112
+ type: 'execute',
113
+ code,
114
+ functionNames: host.functions.map((fn) => fn.name),
115
+ timeoutMs,
116
+ });
117
+ return;
118
+ }
119
+ if (msg.type === 'callTool') {
120
+ // A call that arrives after a timeout must not start an action nobody will see.
121
+ if (settled)
122
+ return;
123
+ hostCallCount += 1;
124
+ try {
125
+ const result = await host.call(msg.name, msg.params);
126
+ if (child.connected)
127
+ child.send({ type: 'toolResult', id: msg.id, result });
128
+ }
129
+ catch (error) {
130
+ if (child.connected)
131
+ child.send({
132
+ type: 'toolResult',
133
+ id: msg.id,
134
+ error: error instanceof Error ? error.message : String(error),
135
+ });
136
+ }
137
+ return;
138
+ }
139
+ if (msg.type === 'result') {
140
+ settle(msg.success
141
+ ? { success: true, value: msg.value, logs: msg.logs ?? [] }
142
+ : { success: false, error: msg.error, logs: msg.logs ?? [] });
143
+ }
144
+ });
145
+ child.on('error', (error) => settle({ success: false, error: { name: 'WorkerError', message: error.message }, logs: [] }));
146
+ child.on('exit', (exitCode, signal) => {
147
+ // A clean exit follows the result message; anything else lost the result.
148
+ if (exitCode === 0 && signal === null)
149
+ return;
150
+ settle({
151
+ success: false,
152
+ error: {
153
+ name: 'WorkerError',
154
+ message: `code_act worker exited (code=${exitCode}, signal=${signal})${stderr ? `: ${stderr.trim().slice(0, 500)}` : ''}`,
155
+ },
156
+ logs: [],
157
+ });
158
+ });
159
+ });
160
+ }
161
+ exports.CODE_ACT_CONTRACT = {
162
+ name: 'code_act',
163
+ summary: 'Run JavaScript that calls MAMA actions and returns only what the turn needs. Every action is an async function by its name, e.g. `return (await work.list({ view: "items", text: "asset" })).tasks.map((task) => [task.title, task.status])`; a failed action throws with its error; independent calls go together with `Promise.all`; `help({ actions: ["work.revise"] })` returns an action\'s argument types and examples; a name with a colon is called as `memory["read:provenance"]({...})`. The code runs in a separate process with no file or process access and an empty environment; its return value, console.log lines and any error come back.',
164
+ inputSchema: {
165
+ type: 'object',
166
+ additionalProperties: false,
167
+ required: ['code'],
168
+ properties: {
169
+ code: {
170
+ type: 'string',
171
+ minLength: 1,
172
+ description: 'The body of an async function, e.g. const [recent, days] = await Promise.all([source.recent({ since: "24h ago" }), schedule.upcoming({ days: 14 })]); return { channels: recent.channels.length, events: days.events.length };',
173
+ },
174
+ },
175
+ },
176
+ };
177
+ /**
178
+ * The code_act action over a dispatcher built after it: the functions are the actions the
179
+ * caller is granted, and each call is dispatched with the caller's own context.
180
+ */
181
+ function codeActRegistration(dispatcher) {
182
+ return {
183
+ contract: exports.CODE_ACT_CONTRACT,
184
+ exec: async (input, context) => {
185
+ const dispatch = dispatcher();
186
+ const granted = new Set(context.access.actions ?? []);
187
+ const functions = dispatch.contracts
188
+ .filter((contract) => contract.name !== exports.CODE_ACT_CONTRACT.name && granted.has(contract.name))
189
+ .map((contract) => ({ name: contract.name }));
190
+ // Inner writes take their command ids from this one; without it two calls would collide.
191
+ const operationId = context.operationId;
192
+ if (!operationId)
193
+ throw new Error('code_act requires an operation id');
194
+ const callable = new Set(functions.map((fn) => fn.name));
195
+ let calls = 0;
196
+ return runCodeAct(input.code, {
197
+ functions,
198
+ call: async (name, params) => {
199
+ // callTool() takes any name; code_act itself would start a worker inside a worker.
200
+ if (!callable.has(name))
201
+ throw new Error(`action_not_granted: ${name}`);
202
+ calls += 1;
203
+ const result = await dispatch({
204
+ action: name,
205
+ input: params ?? {},
206
+ operationId: `${operationId}#${calls}`,
207
+ }, context);
208
+ if (result.status === 'completed')
209
+ return result.data;
210
+ throw new Error(`${result.error.code}: ${result.error.message}`);
211
+ },
212
+ });
213
+ },
214
+ };
215
+ }
216
+ //# sourceMappingURL=code-act-actions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"code-act-actions.js","sourceRoot":"","sources":["../../src/api/code-act-actions.ts"],"names":[],"mappings":";;;AAkGA,gCAmGC;AAyBD,kDAoCC;AAlQD;;;;;;;;;GASG;AACH,2DAA2C;AAQ3C,MAAM,aAAa,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AI,CAAC,CAAC,CAAC;YACzD,IAAI,KAAK,GAAG,CAAC,CAAC;YACd,OAAO,UAAU,CAAE,KAA0B,CAAC,IAAI,EAAE;gBAClD,SAAS;gBACT,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE;oBAC3B,mFAAmF;oBACnF,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC;wBAAE,MAAM,IAAI,KAAK,CAAC,uBAAuB,IAAI,EAAE,CAAC,CAAC;oBACxE,KAAK,IAAI,CAAC,CAAC;oBACX,MAAM,MAAM,GAAG,MAAM,QAAQ,CAC3B;wBACE,MAAM,EAAE,IAAI;wBACZ,KAAK,EAAE,MAAM,IAAI,EAAE;wBACnB,WAAW,EAAE,GAAG,WAAW,IAAI,KAAK,EAAE;qBACvC,EACD,OAAO,CACR,CAAC;oBACF,IAAI,MAAM,CAAC,MAAM,KAAK,WAAW;wBAAE,OAAO,MAAM,CAAC,IAAI,CAAC;oBACtD,MAAM,IAAI,KAAK,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,IAAI,KAAK,MAAM,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;gBACnE,CAAC;aACF,CAAC,CAAC;QACL,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -1,9 +1,12 @@
1
1
  import type { ActionContract, ActionRegistration } from '@jungjaehoon/mama-core';
2
2
  /**
3
- * The first sentence of an action's summary: what every turn shows for it. The full contract is
4
- * one `help` call away, as Kagemusha keeps a one-line catalog and serves detail through `help()`.
3
+ * The argument list the agent calls with, as Kagemusha's code_act description lists
4
+ * `task_update({id, status, priority, deadline})`: top-level names, `?` for optional ones, the
5
+ * allowed values of a plain enum and the bound of a number, list or text.
5
6
  */
6
- export declare function actionCatalogLine(summary: string): string;
7
+ export declare function actionSignature(inputSchema: unknown): string;
8
+ /** What every turn shows for an action: its name, arguments and first sentence. */
9
+ export declare function actionCatalogLine(contract: Pick<ActionContract, 'name' | 'summary' | 'inputSchema'>): string;
7
10
  export interface HelpActionPorts {
8
11
  /** The granted contracts, read when `help` runs so it sees the finished catalog. */
9
12
  contracts(): readonly ActionContract[];
@@ -1 +1 @@
1
- {"version":3,"file":"help-actions.d.ts","sourceRoot":"","sources":["../../src/api/help-actions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAEjF;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAKzD;AAQD,MAAM,WAAW,eAAe;IAC9B,oFAAoF;IACpF,SAAS,IAAI,SAAS,cAAc,EAAE,CAAC;CACxC;AAED,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,eAAe,GAAG,kBAAkB,EAAE,CAiDpF"}
1
+ {"version":3,"file":"help-actions.d.ts","sourceRoot":"","sources":["../../src/api/help-actions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AA8DjF;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,WAAW,EAAE,OAAO,GAAG,MAAM,CAU5D;AAED,mFAAmF;AACnF,wBAAgB,iBAAiB,CAC/B,QAAQ,EAAE,IAAI,CAAC,cAAc,EAAE,MAAM,GAAG,SAAS,GAAG,aAAa,CAAC,GACjE,MAAM,CAER;AA2ED,MAAM,WAAW,eAAe;IAC9B,oFAAoF;IACpF,SAAS,IAAI,SAAS,cAAc,EAAE,CAAC;CACxC;AAED,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,eAAe,GAAG,kBAAkB,EAAE,CA8BpF"}
@@ -1,17 +1,146 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.actionSignature = actionSignature;
3
4
  exports.actionCatalogLine = actionCatalogLine;
4
5
  exports.helpActionRegistrations = helpActionRegistrations;
5
- /**
6
- * The first sentence of an action's summary: what every turn shows for it. The full contract is
7
- * one `help` call away, as Kagemusha keeps a one-line catalog and serves detail through `help()`.
8
- */
9
- function actionCatalogLine(summary) {
6
+ function asSchema(value) {
7
+ return value !== null && typeof value === 'object' && !Array.isArray(value)
8
+ ? value
9
+ : null;
10
+ }
11
+ function firstSentence(summary) {
10
12
  const flat = summary.replace(/\s+/g, ' ').trim();
11
13
  const end = flat.search(/[.!?](\s|$)/);
12
14
  const first = end === -1 ? flat : flat.slice(0, end + 1);
13
15
  return first.length <= 160 ? first : `${first.slice(0, 157)}...`;
14
16
  }
17
+ /** Top-level arguments in schema order, required ones first; `?` marks an optional one. */
18
+ function orderedProperties(schema) {
19
+ const properties = asSchema(schema.properties);
20
+ if (!properties)
21
+ return [];
22
+ const required = new Set(Array.isArray(schema.required) ? schema.required : []);
23
+ const entries = Object.entries(properties);
24
+ return [
25
+ ...entries.filter(([name]) => required.has(name)).map(([name, value]) => [name, value, true]),
26
+ ...entries.filter(([name]) => !required.has(name)).map(([name, value]) => [name, value, false]),
27
+ ];
28
+ }
29
+ function enumText(schema) {
30
+ if ('const' in schema)
31
+ return JSON.stringify(schema.const);
32
+ return Array.isArray(schema.enum)
33
+ ? schema.enum.map((value) => JSON.stringify(value)).join('|')
34
+ : null;
35
+ }
36
+ /**
37
+ * The argument sets a top-level `oneOf`/`anyOf` requires, e.g. `observationRef | observationRefs`
38
+ * for `source.read`, when each alternative only names required arguments.
39
+ */
40
+ function requiredChoice(schema) {
41
+ const alternatives = Array.isArray(schema.oneOf) ? schema.oneOf : schema.anyOf;
42
+ if (!Array.isArray(alternatives))
43
+ return null;
44
+ const sets = alternatives.map((alternative) => {
45
+ const required = asSchema(alternative)?.required;
46
+ return Array.isArray(required) && required.length > 0 ? required.join(' + ') : null;
47
+ });
48
+ return sets.every((set) => set !== null) ? sets.join(' | ') : null;
49
+ }
50
+ /**
51
+ * The bound a caller cannot guess from the name, e.g. `≤50` for a limit, `≤4 items` for a list or
52
+ * `≤1024 chars` for a caption:
53
+ * on the first live day the agent sent `limit: 100` to `work.list`, whose maximum is 50.
54
+ */
55
+ function boundText(schema) {
56
+ if (typeof schema.maximum === 'number')
57
+ return `≤${schema.maximum}`;
58
+ if (typeof schema.maxItems === 'number')
59
+ return `≤${schema.maxItems} items`;
60
+ if (typeof schema.maxLength === 'number')
61
+ return `≤${schema.maxLength} chars`;
62
+ return null;
63
+ }
64
+ /**
65
+ * The argument list the agent calls with, as Kagemusha's code_act description lists
66
+ * `task_update({id, status, priority, deadline})`: top-level names, `?` for optional ones, the
67
+ * allowed values of a plain enum and the bound of a number, list or text.
68
+ */
69
+ function actionSignature(inputSchema) {
70
+ const schema = asSchema(inputSchema);
71
+ if (!schema)
72
+ return '{}';
73
+ const parts = orderedProperties(schema).map(([name, value, required]) => {
74
+ const property = asSchema(value);
75
+ const detail = property ? (enumText(property) ?? boundText(property)) : null;
76
+ return `${name}${required ? '' : '?'}${detail ? `: ${detail}` : ''}`;
77
+ });
78
+ const choice = requiredChoice(schema);
79
+ return `{${parts.join(', ')}${choice ? `; one of: ${choice}` : ''}}`;
80
+ }
81
+ /** What every turn shows for an action: its name, arguments and first sentence. */
82
+ function actionCatalogLine(contract) {
83
+ return `${contract.name}(${actionSignature(contract.inputSchema)}) — ${firstSentence(contract.summary)}`;
84
+ }
85
+ function typeText(value, depth) {
86
+ const schema = asSchema(value);
87
+ if (!schema)
88
+ return 'any';
89
+ const values = enumText(schema);
90
+ if (values)
91
+ return values;
92
+ const alternatives = Array.isArray(schema.oneOf) ? schema.oneOf : schema.anyOf;
93
+ if (Array.isArray(alternatives))
94
+ return alternatives.map((alternative) => typeText(alternative, depth)).join(' | ');
95
+ if (Array.isArray(schema.type))
96
+ return schema.type.join(' | ');
97
+ if (schema.type === 'array') {
98
+ const item = typeText(schema.items, depth);
99
+ return `${/[ |]/.test(item) ? `(${item})` : item}[]`;
100
+ }
101
+ if (schema.type === 'object' || schema.properties !== undefined) {
102
+ const properties = orderedProperties(schema);
103
+ // Two levels show an argument's shape; deeper parts are named `object`, and the argument's
104
+ // description gives an example of the whole value. Keeping help short is what help is for.
105
+ if (properties.length === 0 || depth >= 3)
106
+ return 'object';
107
+ return `{${properties
108
+ .map(([name, property, required]) => `${name}${required ? '' : '?'}: ${typeText(property, depth + 1)}`)
109
+ .join(', ')}}`;
110
+ }
111
+ return typeof schema.type === 'string' ? schema.type : 'any';
112
+ }
113
+ const items = (count) => `${count} item${count === 1 ? '' : 's'}`;
114
+ /** The limits the dispatcher enforces on one argument, e.g. ` (at most 4 items)`. */
115
+ function limitsText(value) {
116
+ const schema = asSchema(value);
117
+ if (!schema)
118
+ return '';
119
+ const limits = [
120
+ typeof schema.minItems === 'number' ? `at least ${items(schema.minItems)}` : null,
121
+ typeof schema.maxItems === 'number' ? `at most ${items(schema.maxItems)}` : null,
122
+ typeof schema.minimum === 'number' ? `min ${schema.minimum}` : null,
123
+ typeof schema.maximum === 'number' ? `max ${schema.maximum}` : null,
124
+ typeof schema.maxLength === 'number' ? `at most ${schema.maxLength} chars` : null,
125
+ typeof schema.pattern === 'string' ? `pattern ${schema.pattern}` : null,
126
+ ].filter((limit) => limit !== null);
127
+ return limits.length === 0 ? '' : ` (${limits.join(', ')})`;
128
+ }
129
+ /** One action's contract as plain lines: signature, summary, each argument and the examples. */
130
+ function helpText(contract) {
131
+ const schema = asSchema(contract.inputSchema) ?? {};
132
+ const lines = [`${contract.name}(${actionSignature(schema)})`, contract.summary];
133
+ for (const [name, property, required] of orderedProperties(schema)) {
134
+ const description = asSchema(property)?.description;
135
+ lines.push(`- ${name}${required ? ' (required)' : ''}: ${typeText(property, 1)}${limitsText(property)}${typeof description === 'string' ? `. ${description}` : ''}`);
136
+ }
137
+ const alternatives = [schema.oneOf, schema.anyOf].find(Array.isArray);
138
+ if (alternatives)
139
+ lines.push(`- one of: ${requiredChoice(schema) ?? alternatives.map((alternative) => typeText(alternative, 1)).join(' | ')}`);
140
+ for (const example of contract.examples ?? [])
141
+ lines.push(`example (${example.title}): ${JSON.stringify(example.input)}`);
142
+ return lines.join('\n');
143
+ }
15
144
  function invalidInput(message) {
16
145
  const error = new Error(message);
17
146
  error.name = 'invalid_input';
@@ -22,7 +151,7 @@ function helpActionRegistrations(ports) {
22
151
  {
23
152
  contract: {
24
153
  name: 'help',
25
- summary: "Read actions' full contracts (summary, input schema, examples) before first use; with no names, list every action with its one-line summary.",
154
+ summary: "Read actions' argument types, allowed values, descriptions and examples as text; with no names, list every action's line.",
26
155
  inputSchema: {
27
156
  type: 'object',
28
157
  additionalProperties: false,
@@ -30,39 +159,22 @@ function helpActionRegistrations(ports) {
30
159
  actions: { type: 'array', items: { type: 'string', minLength: 1 } },
31
160
  },
32
161
  },
33
- examples: [
34
- { title: 'Read two contracts', input: { actions: ['work.list', 'report.publish'] } },
35
- ],
162
+ examples: [{ title: 'Read one contract', input: { actions: ['report.publish'] } }],
36
163
  },
37
164
  exec: (input) => {
38
165
  const requested = input.actions;
39
166
  const contracts = ports.contracts();
40
167
  if (requested === undefined)
41
- return {
42
- actions: contracts.map((contract) => ({
43
- name: contract.name,
44
- summary: actionCatalogLine(contract.summary),
45
- })),
46
- };
168
+ return contracts.map(actionCatalogLine).join('\n');
47
169
  if (!Array.isArray(requested))
48
170
  throw invalidInput('actions must be a list of action names');
49
- // The model sees tools.work_list (Codex) or mcp__mama__work_list (Claude); both name work.list.
50
- const key = (name) => name.replace(/^mcp__mama__/, '').replace(/[.:]/g, '_');
171
+ // Codex sees tools.work_list and Claude calls work.list inside code_act; both name work.list.
172
+ const key = (name) => name.replace(/[.:]/g, '_');
51
173
  const byName = new Map(contracts.map((contract) => [key(contract.name), contract]));
52
174
  const unknown = requested.filter((name) => !byName.has(key(String(name))));
53
175
  if (unknown.length > 0)
54
176
  throw invalidInput(`unknown actions: ${unknown.join(', ')}`);
55
- return {
56
- actions: requested.map((name) => {
57
- const contract = byName.get(key(String(name)));
58
- return {
59
- name: contract.name,
60
- summary: contract.summary,
61
- inputSchema: contract.inputSchema,
62
- ...(contract.examples === undefined ? {} : { examples: contract.examples }),
63
- };
64
- }),
65
- };
177
+ return requested.map((name) => helpText(byName.get(key(String(name))))).join('\n\n');
66
178
  },
67
179
  },
68
180
  ];
@@ -1 +1 @@
1
- {"version":3,"file":"help-actions.js","sourceRoot":"","sources":["../../src/api/help-actions.ts"],"names":[],"mappings":";;AAMA,8CAKC;AAaD,0DAiDC;AAvED;;;GAGG;AACH,SAAgB,iBAAiB,CAAC,OAAe;IAC/C,MAAM,IAAI,GAAG,OAAO,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC;IACjD,MAAM,GAAG,GAAG,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC;IACvC,MAAM,KAAK,GAAG,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,GAAG,CAAC,CAAC,CAAC;IACzD,OAAO,KAAK,CAAC,MAAM,IAAI,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,KAAK,CAAC;AACnE,CAAC;AAED,SAAS,YAAY,CAAC,OAAe;IACnC,MAAM,KAAK,GAAG,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC;IACjC,KAAK,CAAC,IAAI,GAAG,eAAe,CAAC;IAC7B,OAAO,KAAK,CAAC;AACf,CAAC;AAOD,SAAgB,uBAAuB,CAAC,KAAsB;IAC5D,OAAO;QACL;YACE,QAAQ,EAAE;gBACR,IAAI,EAAE,MAAM;gBACZ,OAAO,EACL,8IAA8I;gBAChJ,WAAW,EAAE;oBACX,IAAI,EAAE,QAAQ;oBACd,oBAAoB,EAAE,KAAK;oBAC3B,UAAU,EAAE;wBACV,OAAO,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,SAAS,E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,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAE,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;YACxF,CAAC;SACF;KACF,CAAC;AACJ,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"action-mcp-server.d.ts","sourceRoot":"","sources":["../../src/runtime/action-mcp-server.ts"],"names":[],"mappings":"AAaA,OAAO,QAAQ,MAAM,eAAe,CAAC;AACrC,OAAO,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEtD,OAAO,EAAgB,KAAK,MAAM,EAAE,MAAM,sCAAsC,CAAC;AAMjF,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,KAAK,CAAC;IACf,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACrB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAClC;AAED,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,KAAK,CAAC;IACf,EAAE,EAAE,MAAM,GAAG,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;CAC3C;AAmGD;;;GAGG;AACH,wBAAsB,aAAa,CACjC,OAAO,EAAE,cAAc,EACvB,IAAI,EAAE;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE,GACvB,OAAO,CAAC,eAAe,GAAG,IAAI,CAAC,CA+BjC;AAED,wBAAgB,iBAAiB,CAC/B,OAAO,GAAE;IAAE,KAAK,CAAC,EAAE,QAAQ,CAAC;IAAC,MAAM,CAAC,EAAE,QAAQ,CAAA;CAAO,GACpD,QAAQ,CAAC,SAAS,CA+BpB"}
1
+ {"version":3,"file":"action-mcp-server.d.ts","sourceRoot":"","sources":["../../src/runtime/action-mcp-server.ts"],"names":[],"mappings":"AAaA,OAAO,QAAQ,MAAM,eAAe,CAAC;AACrC,OAAO,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEtD,OAAO,EAAgB,KAAK,MAAM,EAAE,MAAM,sCAAsC,CAAC;AAOjF,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,KAAK,CAAC;IACf,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACrB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAClC;AAED,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,KAAK,CAAC;IACf,EAAE,EAAE,MAAM,GAAG,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;CAC3C;AA2HD;;;GAGG;AACH,wBAAsB,aAAa,CACjC,OAAO,EAAE,cAAc,EACvB,IAAI,EAAE;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE,GACvB,OAAO,CAAC,eAAe,GAAG,IAAI,CAAC,CA+BjC;AAED,wBAAgB,iBAAiB,CAC/B,OAAO,GAAE;IAAE,KAAK,CAAC,EAAE,QAAQ,CAAC;IAAC,MAAM,CAAC,EAAE,QAAQ,CAAA;CAAO,GACpD,QAAQ,CAAC,SAAS,CA+BpB"}
@@ -23,6 +23,7 @@ const client_1 = require("@jungjaehoon/mama-core/client/client");
23
23
  const session_credential_js_1 = require("./session-credential.js");
24
24
  const claude_caller_hook_js_1 = require("./claude-caller-hook.js");
25
25
  const help_actions_js_1 = require("../api/help-actions.js");
26
+ const code_act_actions_js_1 = require("../api/code-act-actions.js");
26
27
  const PROTOCOL_VERSION = '2025-06-18';
27
28
  const SERVER_INFO = { name: 'mama', version: '0.1.0' };
28
29
  function log(message) {
@@ -42,12 +43,30 @@ function runtimeClient(home) {
42
43
  credential: (0, session_credential_js_1.readSessionCredential)(home),
43
44
  });
44
45
  }
45
- /** One line per action, as for the Codex session; `help` returns the full contract. */
46
- function describeTool(contract) {
46
+ /**
47
+ * Claude gets one tool, code_act, as Kagemusha's Claude CLI did: its description lists every other
48
+ * action by name, arguments and first sentence, and the script calls them by name. Claude CLI has
49
+ * no code mode of its own, and its Bash sandbox cannot reach the action socket.
50
+ */
51
+ function codeActTool(contracts) {
52
+ const codeAct = contracts.find((contract) => contract.name === code_act_actions_js_1.CODE_ACT_CONTRACT.name);
53
+ if (!codeAct)
54
+ throw new Error('code_act is not granted to this session');
47
55
  return {
48
- name: contract.name,
49
- description: (0, help_actions_js_1.actionCatalogLine)(contract.summary),
50
- inputSchema: { type: 'object' },
56
+ name: codeAct.name,
57
+ description: [
58
+ codeAct.summary,
59
+ '',
60
+ 'Actions:',
61
+ ...contracts.filter((contract) => contract !== codeAct).map(help_actions_js_1.actionCatalogLine),
62
+ ].join('\n'),
63
+ // Without additionalProperties: the PreToolUse hook adds __mama_caller to the input, which
64
+ // callTool strips before the dispatcher checks the strict schema.
65
+ inputSchema: {
66
+ type: 'object',
67
+ required: ['code'],
68
+ properties: codeAct.inputSchema.properties,
69
+ },
51
70
  };
52
71
  }
53
72
  function textResult(value, isError) {
@@ -58,7 +77,10 @@ function textResult(value, isError) {
58
77
  }
59
78
  function resultContent(name, result) {
60
79
  if (result.status === 'completed') {
61
- return textResult({ success: true, data: (0, untrusted_content_js_1.untrustedToolData)(name, result.data ?? null) }, false);
80
+ // A code_act script that threw completes as an action but failed as a call.
81
+ const failed = name === code_act_actions_js_1.CODE_ACT_CONTRACT.name &&
82
+ result.data?.success === false;
83
+ return textResult({ success: !failed, data: (0, untrusted_content_js_1.untrustedToolData)(name, result.data ?? null) }, failed);
62
84
  }
63
85
  return textResult({
64
86
  success: false,
@@ -114,7 +136,7 @@ async function handleRequest(request, deps) {
114
136
  case 'ping':
115
137
  return reply({});
116
138
  case 'tools/list':
117
- return reply({ tools: (await deps.client.describe()).map(describeTool) });
139
+ return reply({ tools: [codeActTool(await deps.client.describe())] });
118
140
  case 'tools/call':
119
141
  return reply(await callTool(deps.client, request.params ?? {}));
120
142
  case 'resources/list':