@jungjaehoon/mama-os 0.47.0 → 0.48.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.
- package/dist/agent/agent-loop.d.ts.map +1 -1
- package/dist/agent/agent-loop.js +9 -11
- package/dist/agent/agent-loop.js.map +1 -1
- package/dist/agent/code-act/constants.d.ts +4 -1
- package/dist/agent/code-act/constants.d.ts.map +1 -1
- package/dist/agent/code-act/constants.js +34 -97
- package/dist/agent/code-act/constants.js.map +1 -1
- package/dist/agent/code-act/host-bridge.d.ts +2 -1
- package/dist/agent/code-act/host-bridge.d.ts.map +1 -1
- package/dist/agent/code-act/host-bridge.js +227 -29
- package/dist/agent/code-act/host-bridge.js.map +1 -1
- package/dist/agent/code-act/sandbox.d.ts +1 -0
- package/dist/agent/code-act/sandbox.d.ts.map +1 -1
- package/dist/agent/code-act/sandbox.js +33 -6
- package/dist/agent/code-act/sandbox.js.map +1 -1
- package/dist/agent/code-act/tool-catalog.d.ts +28 -0
- package/dist/agent/code-act/tool-catalog.d.ts.map +1 -0
- package/dist/agent/code-act/tool-catalog.js +146 -0
- package/dist/agent/code-act/tool-catalog.js.map +1 -0
- package/dist/agent/code-act/tool-policy.d.ts +2 -1
- package/dist/agent/code-act/tool-policy.d.ts.map +1 -1
- package/dist/agent/code-act/tool-policy.js +2 -1
- package/dist/agent/code-act/tool-policy.js.map +1 -1
- package/dist/agent/code-act/type-definition-generator.d.ts +6 -0
- package/dist/agent/code-act/type-definition-generator.d.ts.map +1 -1
- package/dist/agent/code-act/type-definition-generator.js +40 -21
- package/dist/agent/code-act/type-definition-generator.js.map +1 -1
- package/dist/agent/gateway-tool-executor.d.ts +6 -0
- package/dist/agent/gateway-tool-executor.d.ts.map +1 -1
- package/dist/agent/gateway-tool-executor.js +102 -58
- package/dist/agent/gateway-tool-executor.js.map +1 -1
- package/dist/agent/gateway-tools.md +7 -7
- package/dist/agent/tool-registry.d.ts.map +1 -1
- package/dist/agent/tool-registry.js +22 -13
- package/dist/agent/tool-registry.js.map +1 -1
- package/dist/api/graph-api-types.d.ts +3 -0
- package/dist/api/graph-api-types.d.ts.map +1 -1
- package/dist/cli/commands/start.d.ts.map +1 -1
- package/dist/cli/commands/start.js +7 -0
- package/dist/cli/commands/start.js.map +1 -1
- package/dist/cli/runtime/code-act-executor.d.ts.map +1 -1
- package/dist/cli/runtime/code-act-executor.js +5 -0
- package/dist/cli/runtime/code-act-executor.js.map +1 -1
- package/dist/connectors/kagemusha/query-tools.d.ts +57 -0
- package/dist/connectors/kagemusha/query-tools.d.ts.map +1 -1
- package/dist/connectors/kagemusha/query-tools.js +247 -0
- package/dist/connectors/kagemusha/query-tools.js.map +1 -1
- package/dist/connectors/private-connector-policy.d.ts +32 -6
- package/dist/connectors/private-connector-policy.d.ts.map +1 -1
- package/dist/connectors/private-connector-policy.js +40 -5
- package/dist/connectors/private-connector-policy.js.map +1 -1
- package/dist/connectors/trello/query-tools.d.ts +148 -16
- package/dist/connectors/trello/query-tools.d.ts.map +1 -1
- package/dist/connectors/trello/query-tools.js +453 -65
- package/dist/connectors/trello/query-tools.js.map +1 -1
- package/dist/mcp/code-act-api-client.d.ts +1 -0
- package/dist/mcp/code-act-api-client.d.ts.map +1 -1
- package/dist/mcp/code-act-api-client.js.map +1 -1
- package/dist/mcp/code-act-server.js +8 -6
- package/dist/mcp/code-act-server.js.map +1 -1
- package/dist/mcp/code-act-terminal-transport.d.ts +2 -0
- package/dist/mcp/code-act-terminal-transport.d.ts.map +1 -1
- package/dist/mcp/code-act-terminal-transport.js +18 -6
- package/dist/mcp/code-act-terminal-transport.js.map +1 -1
- package/dist/multi-agent/agent-process-manager.d.ts.map +1 -1
- package/dist/multi-agent/agent-process-manager.js +1 -5
- package/dist/multi-agent/agent-process-manager.js.map +1 -1
- package/dist/operator/board-read-views.d.ts +49 -0
- package/dist/operator/board-read-views.d.ts.map +1 -0
- package/dist/operator/board-read-views.js +207 -0
- package/dist/operator/board-read-views.js.map +1 -0
- package/dist/operator/task-ledger.d.ts +85 -0
- package/dist/operator/task-ledger.d.ts.map +1 -1
- package/dist/operator/task-ledger.js +128 -0
- package/dist/operator/task-ledger.js.map +1 -1
- package/dist/operator/task-list-views.d.ts +91 -0
- package/dist/operator/task-list-views.d.ts.map +1 -0
- package/dist/operator/task-list-views.js +483 -0
- package/dist/operator/task-list-views.js.map +1 -0
- package/dist/operator/workorder-consumer.js +1 -1
- package/dist/operator/workorder-consumer.js.map +1 -1
- package/dist/sqlite.d.ts +7 -0
- package/dist/sqlite.d.ts.map +1 -1
- package/dist/sqlite.js +8 -0
- package/dist/sqlite.js.map +1 -1
- package/package.json +2 -1
|
@@ -49,6 +49,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
49
49
|
};
|
|
50
50
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
51
51
|
exports.GatewayToolExecutor = void 0;
|
|
52
|
+
exports.serializeCodeActModelResult = serializeCodeActModelResult;
|
|
52
53
|
const fs_1 = require("fs");
|
|
53
54
|
const async_hooks_1 = require("async_hooks");
|
|
54
55
|
const crypto_1 = require("crypto");
|
|
@@ -81,6 +82,8 @@ const agent_store_js_1 = require("../db/agent-store.js");
|
|
|
81
82
|
const index_js_1 = require("../envelope/index.js");
|
|
82
83
|
const wiki_publish_adapter_js_1 = require("../wiki-artifacts/wiki-publish-adapter.js");
|
|
83
84
|
const changes_projection_js_1 = require("../operator/changes-projection.js");
|
|
85
|
+
const task_list_views_js_1 = require("../operator/task-list-views.js");
|
|
86
|
+
const board_read_views_js_1 = require("../operator/board-read-views.js");
|
|
84
87
|
const read_js_1 = require("../evidence/read.js");
|
|
85
88
|
const private_connector_policy_js_1 = require("../connectors/private-connector-policy.js");
|
|
86
89
|
const member_candidate_store_js_1 = require("../gateways/member-candidate-store.js");
|
|
@@ -93,19 +96,6 @@ const DEFAULT_PRIVATE_CONNECTOR_POLICY = (0, private_connector_policy_js_1.resol
|
|
|
93
96
|
function isReportPublishResult(value) {
|
|
94
97
|
return value !== undefined && !Array.isArray(value);
|
|
95
98
|
}
|
|
96
|
-
function serializeTaskToolRecord(task) {
|
|
97
|
-
return {
|
|
98
|
-
...task,
|
|
99
|
-
due_at: task.dueAt === null ? null : new Date(task.dueAt).toISOString(),
|
|
100
|
-
deadline_offset_minutes: task.deadlineOffsetMinutes,
|
|
101
|
-
temporal_epoch: task.temporalEpoch,
|
|
102
|
-
temporal_reconciled_occurrence_key: task.temporalReconciledOccurrenceKey,
|
|
103
|
-
last_temporal_checked_at: task.lastTemporalCheckedAt,
|
|
104
|
-
next_temporal_check_at: task.nextTemporalCheckAt,
|
|
105
|
-
last_temporal_attempt_id: task.lastTemporalAttemptId,
|
|
106
|
-
temporal_state: task.temporalState,
|
|
107
|
-
};
|
|
108
|
-
}
|
|
109
99
|
function temporalContextPacketBinding(context) {
|
|
110
100
|
return `temporal:${context.taskId}:${context.generationKey}`;
|
|
111
101
|
}
|
|
@@ -216,6 +206,21 @@ const TEMPORAL_WRITE_TOOLS = new Set([
|
|
|
216
206
|
'webchat_send',
|
|
217
207
|
'save_integration_token',
|
|
218
208
|
]);
|
|
209
|
+
const TASK_UPDATE_PUBLIC_FIELDS = [
|
|
210
|
+
'id',
|
|
211
|
+
'title',
|
|
212
|
+
'status',
|
|
213
|
+
'priority',
|
|
214
|
+
'assignee',
|
|
215
|
+
'deadline',
|
|
216
|
+
'due_at',
|
|
217
|
+
'latest_event',
|
|
218
|
+
'confirmed',
|
|
219
|
+
'expected_revision',
|
|
220
|
+
'context_packet_id',
|
|
221
|
+
'review_anchor_ref',
|
|
222
|
+
];
|
|
223
|
+
const TASK_UPDATE_PUBLIC_FIELD_SET = new Set(TASK_UPDATE_PUBLIC_FIELDS);
|
|
219
224
|
const MEMORY_READ_PERMISSION_BEFORE_ENVELOPE_TOOLS = new Set([
|
|
220
225
|
'mama_save',
|
|
221
226
|
'mama_search',
|
|
@@ -240,6 +245,30 @@ const OWNER_CONSOLE_MEMBER_TOOLS = new Set([
|
|
|
240
245
|
]);
|
|
241
246
|
class ContextPacketProvenanceError extends Error {
|
|
242
247
|
}
|
|
248
|
+
/**
|
|
249
|
+
* Compact model boundary for Code-Act; internal receipts retain the richer result object.
|
|
250
|
+
* The JSON root (success, audit ledger, terminal codes) stays machine-readable; when the run
|
|
251
|
+
* read external evidence only the value/logs payload is fenced as untrusted data.
|
|
252
|
+
*/
|
|
253
|
+
function serializeCodeActModelResult(result) {
|
|
254
|
+
const record = result;
|
|
255
|
+
const { message, untrustedExternalEvidence, value, logs, ...modelResult } = record;
|
|
256
|
+
if (typeof message === 'string' && value === undefined && typeof modelResult.error !== 'string') {
|
|
257
|
+
modelResult.message = message;
|
|
258
|
+
}
|
|
259
|
+
const payload = {
|
|
260
|
+
...(value !== undefined ? { value } : {}),
|
|
261
|
+
...(logs !== undefined ? { logs } : {}),
|
|
262
|
+
};
|
|
263
|
+
if (untrustedExternalEvidence === true) {
|
|
264
|
+
return JSON.stringify({
|
|
265
|
+
...modelResult,
|
|
266
|
+
untrustedExternalEvidence: true,
|
|
267
|
+
payload: (0, untrusted_content_js_1.wrapUntrustedContent)('external-evidence-code-act', JSON.stringify(payload)),
|
|
268
|
+
});
|
|
269
|
+
}
|
|
270
|
+
return JSON.stringify({ ...modelResult, ...payload });
|
|
271
|
+
}
|
|
243
272
|
function asRecord(value) {
|
|
244
273
|
return value && typeof value === 'object' && !Array.isArray(value)
|
|
245
274
|
? value
|
|
@@ -2507,8 +2536,9 @@ class GatewayToolExecutor {
|
|
|
2507
2536
|
error: 'Report store not wired (board_read requires the API server report store).',
|
|
2508
2537
|
};
|
|
2509
2538
|
}
|
|
2510
|
-
|
|
2511
|
-
|
|
2539
|
+
// Default returns slot descriptors only; a named slot pages its text/html
|
|
2540
|
+
// by code points so a long slot is fully reachable, never silently sliced.
|
|
2541
|
+
return (0, board_read_views_js_1.readBoardView)(input, this.reportReader());
|
|
2512
2542
|
}
|
|
2513
2543
|
case 'audit_findings_read': {
|
|
2514
2544
|
const auditStatePath = (0, path_1.join)(process.env.HOME || (0, os_1.homedir)(), '.mama', 'state', 'audit-findings.json');
|
|
@@ -2603,14 +2633,17 @@ class GatewayToolExecutor {
|
|
|
2603
2633
|
// kagemusha_*: state questions read the source live, never the
|
|
2604
2634
|
// connector change-log projection (2026-07-24 incident chain).
|
|
2605
2635
|
case 'trello_search': {
|
|
2606
|
-
const {
|
|
2636
|
+
const { searchTrelloBoardCards } = await import('../connectors/trello/query-tools.js');
|
|
2607
2637
|
const searchInput = input;
|
|
2608
2638
|
try {
|
|
2609
|
-
|
|
2639
|
+
// Progressive: honest full match total + continuation + per-board coverage,
|
|
2640
|
+
// not a hidden 20-result cap. Paged over the cached board snapshot.
|
|
2641
|
+
const page = await searchTrelloBoardCards({
|
|
2610
2642
|
query: searchInput.query ?? '',
|
|
2611
2643
|
limit: searchInput.limit,
|
|
2644
|
+
cursor: searchInput.cursor,
|
|
2612
2645
|
});
|
|
2613
|
-
return { success: true,
|
|
2646
|
+
return { success: true, ...page };
|
|
2614
2647
|
}
|
|
2615
2648
|
catch (err) {
|
|
2616
2649
|
return {
|
|
@@ -2621,10 +2654,19 @@ class GatewayToolExecutor {
|
|
|
2621
2654
|
}
|
|
2622
2655
|
}
|
|
2623
2656
|
case 'trello_card': {
|
|
2624
|
-
const {
|
|
2657
|
+
const { getTrelloCardDetail } = await import('../connectors/trello/query-tools.js');
|
|
2625
2658
|
const cardInput = input;
|
|
2626
2659
|
try {
|
|
2627
|
-
|
|
2660
|
+
// Sectioned detail (summary|description|checklists|checklist_items) with
|
|
2661
|
+
// explicit continuation; the board allowlist is enforced before any field.
|
|
2662
|
+
const card = await getTrelloCardDetail({
|
|
2663
|
+
cardId: cardInput.cardId ?? '',
|
|
2664
|
+
section: cardInput.section,
|
|
2665
|
+
offset: cardInput.offset,
|
|
2666
|
+
limit: cardInput.limit,
|
|
2667
|
+
checklistId: cardInput.checklistId,
|
|
2668
|
+
readVersion: cardInput.readVersion,
|
|
2669
|
+
});
|
|
2628
2670
|
return { success: true, card };
|
|
2629
2671
|
}
|
|
2630
2672
|
catch (err) {
|
|
@@ -2636,16 +2678,23 @@ class GatewayToolExecutor {
|
|
|
2636
2678
|
}
|
|
2637
2679
|
}
|
|
2638
2680
|
case 'trello_kanban': {
|
|
2639
|
-
const {
|
|
2681
|
+
const { getTrelloBoardsOverview, getTrelloListCards } = await import('../connectors/trello/query-tools.js');
|
|
2640
2682
|
const kanbanInput = input;
|
|
2641
2683
|
try {
|
|
2642
|
-
//
|
|
2643
|
-
//
|
|
2644
|
-
//
|
|
2645
|
-
|
|
2646
|
-
|
|
2647
|
-
|
|
2648
|
-
|
|
2684
|
+
// Default returns the board/list overview with counts and coverage - NO
|
|
2685
|
+
// card arrays. A named (boardId, listId) pages that list's open cards
|
|
2686
|
+
// beyond the old kanban ceiling, cursor pinned to the read snapshot.
|
|
2687
|
+
if (kanbanInput.boardId !== undefined || kanbanInput.listId !== undefined) {
|
|
2688
|
+
const cards = await getTrelloListCards({
|
|
2689
|
+
boardId: kanbanInput.boardId ?? '',
|
|
2690
|
+
listId: kanbanInput.listId ?? '',
|
|
2691
|
+
limit: kanbanInput.limit,
|
|
2692
|
+
cursor: kanbanInput.cursor,
|
|
2693
|
+
});
|
|
2694
|
+
return { success: true, ...cards };
|
|
2695
|
+
}
|
|
2696
|
+
const overview = await getTrelloBoardsOverview();
|
|
2697
|
+
return { success: true, ...overview };
|
|
2649
2698
|
}
|
|
2650
2699
|
catch (err) {
|
|
2651
2700
|
return {
|
|
@@ -2656,12 +2705,14 @@ class GatewayToolExecutor {
|
|
|
2656
2705
|
}
|
|
2657
2706
|
}
|
|
2658
2707
|
case 'kagemusha_messages': {
|
|
2659
|
-
const {
|
|
2708
|
+
const { queryMessagesPage } = await import('../connectors/kagemusha/query-tools.js');
|
|
2660
2709
|
const msgInput = input;
|
|
2661
2710
|
if (!msgInput.channelId) {
|
|
2662
2711
|
throw new types_js_1.AgentError('kagemusha_messages requires channelId', 'TOOL_ERROR', undefined, false);
|
|
2663
2712
|
}
|
|
2664
|
-
|
|
2713
|
+
// Progressive: (created_at,id) keyset over an append-only asOf bound with
|
|
2714
|
+
// total/returned/nextCursor; an unknown channel is a loud missing-source error.
|
|
2715
|
+
return { success: true, ...queryMessagesPage(msgInput) };
|
|
2665
2716
|
}
|
|
2666
2717
|
case 'changes_read': {
|
|
2667
2718
|
if (!this.taskLedger) {
|
|
@@ -2677,37 +2728,23 @@ class GatewayToolExecutor {
|
|
|
2677
2728
|
if (!this.taskLedger) {
|
|
2678
2729
|
return { success: false, error: 'Task ledger not configured' };
|
|
2679
2730
|
}
|
|
2731
|
+
// Under a Temporal work context the universe is exactly the one host-bound
|
|
2732
|
+
// owner task; the views observe/count only it and treat every other id as
|
|
2733
|
+
// generic missing. Fetch it here so an unavailable bound task stays the same
|
|
2734
|
+
// superseded signal it was before the progressive views.
|
|
2680
2735
|
const temporalContext = this.getExecutionState().temporalWorkContext;
|
|
2736
|
+
let boundTask;
|
|
2681
2737
|
if (temporalContext) {
|
|
2682
|
-
const
|
|
2683
|
-
if (!
|
|
2738
|
+
const found = this.taskLedger.getById(temporalContext.taskId);
|
|
2739
|
+
if (!found) {
|
|
2684
2740
|
throw new types_js_1.AgentError('Host-bound temporal owner task is unavailable', 'WORKORDER_SUPERSEDED', undefined, false);
|
|
2685
2741
|
}
|
|
2686
|
-
|
|
2687
|
-
success: true,
|
|
2688
|
-
tasks: [serializeTaskToolRecord(boundTask)],
|
|
2689
|
-
};
|
|
2742
|
+
boundTask = found;
|
|
2690
2743
|
}
|
|
2691
|
-
|
|
2692
|
-
|
|
2693
|
-
|
|
2694
|
-
// that says "the open items are..." from one page states more than it read.
|
|
2695
|
-
const page = this.taskLedger.listPage({
|
|
2696
|
-
status: listInput.status,
|
|
2697
|
-
includeTerminal: listInput.include_terminal,
|
|
2698
|
-
channel: listInput.channel,
|
|
2699
|
-
search: listInput.search,
|
|
2700
|
-
limit: listInput.limit,
|
|
2701
|
-
order: listInput.order ?? 'deadline_priority',
|
|
2702
|
-
cursor: listInput.cursor,
|
|
2744
|
+
return (0, task_list_views_js_1.runTaskListView)(input, {
|
|
2745
|
+
ledger: this.taskLedger,
|
|
2746
|
+
boundTask,
|
|
2703
2747
|
});
|
|
2704
|
-
return {
|
|
2705
|
-
success: true,
|
|
2706
|
-
tasks: page.tasks.map(serializeTaskToolRecord),
|
|
2707
|
-
total: page.total,
|
|
2708
|
-
returned: page.returned,
|
|
2709
|
-
nextCursor: page.nextCursor,
|
|
2710
|
-
};
|
|
2711
2748
|
}
|
|
2712
2749
|
case 'task_external_correlation': {
|
|
2713
2750
|
if (!this.taskLedger) {
|
|
@@ -2854,7 +2891,7 @@ class GatewayToolExecutor {
|
|
|
2854
2891
|
}
|
|
2855
2892
|
return {
|
|
2856
2893
|
success: true,
|
|
2857
|
-
task: serializeTaskToolRecord(
|
|
2894
|
+
task: (0, task_list_views_js_1.serializeTaskToolRecord)(
|
|
2858
2895
|
// The run id comes from trusted execution state, never from the tool call:
|
|
2859
2896
|
// an agent that can name its own run in the effect ledger can sign someone
|
|
2860
2897
|
// else's work with it.
|
|
@@ -2881,6 +2918,12 @@ class GatewayToolExecutor {
|
|
|
2881
2918
|
throw new types_js_1.AgentError(`task_update field ${forbidden} is host-owned`, 'TOOL_ERROR', undefined, false);
|
|
2882
2919
|
}
|
|
2883
2920
|
}
|
|
2921
|
+
const unsupportedFields = Object.keys(rawTaskUpdate).filter((field) => !TASK_UPDATE_PUBLIC_FIELD_SET.has(field));
|
|
2922
|
+
if (unsupportedFields.length > 0) {
|
|
2923
|
+
throw new types_js_1.AgentError(`task_update unsupported field(s): ${unsupportedFields.join(', ')}. ` +
|
|
2924
|
+
`Supported fields: ${TASK_UPDATE_PUBLIC_FIELDS.join(', ')}. ` +
|
|
2925
|
+
'Use latest_event for input; responses return latestEvent.', 'TOOL_ERROR', undefined, false);
|
|
2926
|
+
}
|
|
2884
2927
|
const { id: rawId, context_packet_id: contextPacketId, review_anchor_ref: reviewAnchorRef, ...patch } = rawTaskUpdate;
|
|
2885
2928
|
// Agents routinely pass "12"; coerce, reject non-numeric with a typed error.
|
|
2886
2929
|
const id = typeof rawId === 'string' ? Number(rawId.trim()) : rawId;
|
|
@@ -2955,7 +2998,7 @@ class GatewayToolExecutor {
|
|
|
2955
2998
|
causeKind: this.getExecutionState().source === 'operator' ? 'clock' : 'owner_message',
|
|
2956
2999
|
...(verifiedReviewEvidence ? { verifiedReviewEvidence } : {}),
|
|
2957
3000
|
});
|
|
2958
|
-
return { success: true, task: serializeTaskToolRecord(updated) };
|
|
3001
|
+
return { success: true, task: (0, task_list_views_js_1.serializeTaskToolRecord)(updated) };
|
|
2959
3002
|
}
|
|
2960
3003
|
case 'task_temporal_reconcile': {
|
|
2961
3004
|
if (!this.taskLedger) {
|
|
@@ -3887,7 +3930,7 @@ class GatewayToolExecutor {
|
|
|
3887
3930
|
usedUntrustedExternalEvidence = true;
|
|
3888
3931
|
}
|
|
3889
3932
|
};
|
|
3890
|
-
bridge.injectInto(sandbox, policy
|
|
3933
|
+
bridge.injectInto(sandbox, policy);
|
|
3891
3934
|
const result = await sandbox.execute(input.code, { signal: state.signal });
|
|
3892
3935
|
const terminalMutationCodes = new Set([
|
|
3893
3936
|
CODE_ACT_MUTATION_COMMITTED_AFTER_ABORT,
|
|
@@ -3922,6 +3965,7 @@ class GatewayToolExecutor {
|
|
|
3922
3965
|
metrics: result.metrics,
|
|
3923
3966
|
hostToolExecutions,
|
|
3924
3967
|
hostToolsInvoked,
|
|
3968
|
+
...(usedUntrustedExternalEvidence ? { untrustedExternalEvidence: true } : {}),
|
|
3925
3969
|
message: result.success
|
|
3926
3970
|
? usedUntrustedExternalEvidence
|
|
3927
3971
|
? (0, untrusted_content_js_1.wrapUntrustedContent)('external-evidence-code-act', successfulMessage)
|