@jungjaehoon/mama-os 0.53.1 → 0.58.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/CHANGELOG.md +71 -0
- package/README.md +62 -259
- package/db/migrations/001-connector-event-index.sql +251 -0
- package/dist/agent/claude-native-tool-policy.d.ts +17 -0
- package/dist/agent/claude-native-tool-policy.d.ts.map +1 -0
- package/dist/agent/claude-native-tool-policy.js +88 -0
- package/dist/agent/claude-native-tool-policy.js.map +1 -0
- package/dist/api/attachment-actions.d.ts +16 -0
- package/dist/api/attachment-actions.d.ts.map +1 -0
- package/dist/api/attachment-actions.js +280 -0
- package/dist/api/attachment-actions.js.map +1 -0
- package/dist/api/auth-middleware.d.ts +15 -55
- package/dist/api/auth-middleware.d.ts.map +1 -1
- package/dist/api/auth-middleware.js +56 -233
- package/dist/api/auth-middleware.js.map +1 -1
- package/dist/api/cf-access.d.ts +6 -0
- package/dist/api/cf-access.d.ts.map +1 -0
- package/dist/api/cf-access.js +121 -0
- package/dist/api/cf-access.js.map +1 -0
- package/dist/api/file-delivery.d.ts +29 -0
- package/dist/api/file-delivery.d.ts.map +1 -0
- package/dist/api/file-delivery.js +90 -0
- package/dist/api/file-delivery.js.map +1 -0
- package/dist/api/help-actions.d.ts +12 -0
- package/dist/api/help-actions.d.ts.map +1 -0
- package/dist/api/help-actions.js +70 -0
- package/dist/api/help-actions.js.map +1 -0
- package/dist/api/owner-timezone-actions.d.ts +10 -0
- package/dist/api/owner-timezone-actions.d.ts.map +1 -0
- package/dist/api/owner-timezone-actions.js +73 -0
- package/dist/api/owner-timezone-actions.js.map +1 -0
- package/dist/api/record-actions.d.ts +8 -0
- package/dist/api/record-actions.d.ts.map +1 -0
- package/dist/api/record-actions.js +53 -0
- package/dist/api/record-actions.js.map +1 -0
- package/dist/api/report-actions.d.ts +20 -0
- package/dist/api/report-actions.d.ts.map +1 -0
- package/dist/api/report-actions.js +137 -0
- package/dist/api/report-actions.js.map +1 -0
- package/dist/api/report-handler.d.ts +15 -11
- package/dist/api/report-handler.d.ts.map +1 -1
- package/dist/api/report-handler.js +48 -120
- package/dist/api/report-handler.js.map +1 -1
- package/dist/api/report-persistence.d.ts +3 -3
- package/dist/api/report-persistence.d.ts.map +1 -1
- package/dist/api/report-persistence.js +35 -10
- package/dist/api/report-persistence.js.map +1 -1
- package/dist/api/report-source-actions.d.ts +11 -0
- package/dist/api/report-source-actions.d.ts.map +1 -0
- package/dist/api/report-source-actions.js +309 -0
- package/dist/api/report-source-actions.js.map +1 -0
- package/dist/api/security-events.d.ts +23 -0
- package/dist/api/security-events.d.ts.map +1 -0
- package/dist/api/security-events.js +71 -0
- package/dist/api/security-events.js.map +1 -0
- package/dist/api/source-actions.d.ts +9 -0
- package/dist/api/source-actions.d.ts.map +1 -0
- package/dist/api/source-actions.js +274 -0
- package/dist/api/source-actions.js.map +1 -0
- package/dist/api/stored-source-reader.d.ts +21 -0
- package/dist/api/stored-source-reader.d.ts.map +1 -0
- package/dist/api/stored-source-reader.js +269 -0
- package/dist/api/stored-source-reader.js.map +1 -0
- package/dist/api/viewer-data.d.ts +143 -0
- package/dist/api/viewer-data.d.ts.map +1 -0
- package/dist/api/viewer-data.js +518 -0
- package/dist/api/viewer-data.js.map +1 -0
- package/dist/api/viewer-request-security.d.ts +12 -0
- package/dist/api/viewer-request-security.d.ts.map +1 -0
- package/dist/api/viewer-request-security.js +217 -0
- package/dist/api/viewer-request-security.js.map +1 -0
- package/dist/api/viewer-server.d.ts +56 -0
- package/dist/api/viewer-server.d.ts.map +1 -0
- package/dist/api/viewer-server.js +937 -0
- package/dist/api/viewer-server.js.map +1 -0
- package/dist/api/wiki-actions.d.ts +20 -0
- package/dist/api/wiki-actions.d.ts.map +1 -0
- package/dist/api/wiki-actions.js +296 -0
- package/dist/api/wiki-actions.js.map +1 -0
- package/dist/api/work-actions.d.ts +96 -0
- package/dist/api/work-actions.d.ts.map +1 -0
- package/dist/api/work-actions.js +956 -0
- package/dist/api/work-actions.js.map +1 -0
- package/dist/cli/commands/daemon.d.ts +90 -0
- package/dist/cli/commands/daemon.d.ts.map +1 -0
- package/dist/cli/commands/daemon.js +632 -0
- package/dist/cli/commands/daemon.js.map +1 -0
- package/dist/cli/commands/init.d.ts +7 -18
- package/dist/cli/commands/init.d.ts.map +1 -1
- package/dist/cli/commands/init.js +357 -273
- package/dist/cli/commands/init.js.map +1 -1
- package/dist/cli/commands/replay.d.ts +12 -0
- package/dist/cli/commands/replay.d.ts.map +1 -0
- package/dist/cli/commands/replay.js +145 -0
- package/dist/cli/commands/replay.js.map +1 -0
- package/dist/cli/commands/secret.d.ts +6 -0
- package/dist/cli/commands/secret.d.ts.map +1 -0
- package/dist/cli/commands/secret.js +24 -0
- package/dist/cli/commands/secret.js.map +1 -0
- package/dist/cli/index.d.ts +0 -5
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +52 -95
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/launch-files.d.ts +10 -0
- package/dist/cli/launch-files.d.ts.map +1 -0
- package/dist/cli/launch-files.js +74 -0
- package/dist/cli/launch-files.js.map +1 -0
- package/dist/cli/prompt.d.ts +15 -0
- package/dist/cli/prompt.d.ts.map +1 -0
- package/dist/cli/prompt.js +64 -0
- package/dist/cli/prompt.js.map +1 -0
- package/dist/cli/runtime/action-mcp-config.d.ts +15 -0
- package/dist/cli/runtime/action-mcp-config.d.ts.map +1 -0
- package/dist/cli/runtime/action-mcp-config.js +56 -0
- package/dist/cli/runtime/action-mcp-config.js.map +1 -0
- package/dist/cli/runtime/claude-caller-config.d.ts +4 -0
- package/dist/cli/runtime/claude-caller-config.d.ts.map +1 -0
- package/dist/cli/runtime/claude-caller-config.js +46 -0
- package/dist/cli/runtime/claude-caller-config.js.map +1 -0
- package/dist/cli/secrets.d.ts +9 -0
- package/dist/cli/secrets.d.ts.map +1 -0
- package/dist/cli/secrets.js +94 -0
- package/dist/cli/secrets.js.map +1 -0
- package/dist/connectors/calendar/index.d.ts +11 -10
- package/dist/connectors/calendar/index.d.ts.map +1 -1
- package/dist/connectors/calendar/index.js +171 -97
- package/dist/connectors/calendar/index.js.map +1 -1
- package/dist/connectors/chatwork/index.d.ts +31 -5
- package/dist/connectors/chatwork/index.d.ts.map +1 -1
- package/dist/connectors/chatwork/index.js +184 -20
- package/dist/connectors/chatwork/index.js.map +1 -1
- package/dist/connectors/claude-code/index.d.ts +0 -2
- package/dist/connectors/claude-code/index.d.ts.map +1 -1
- package/dist/connectors/claude-code/index.js +94 -70
- package/dist/connectors/claude-code/index.js.map +1 -1
- package/dist/connectors/config-loader.d.ts +1 -6
- package/dist/connectors/config-loader.d.ts.map +1 -1
- package/dist/connectors/config-loader.js +154 -134
- package/dist/connectors/config-loader.js.map +1 -1
- package/dist/connectors/discord/index.d.ts +8 -1
- package/dist/connectors/discord/index.d.ts.map +1 -1
- package/dist/connectors/discord/index.js +110 -32
- package/dist/connectors/discord/index.js.map +1 -1
- package/dist/connectors/drive/index.d.ts +10 -5
- package/dist/connectors/drive/index.d.ts.map +1 -1
- package/dist/connectors/drive/index.js +145 -88
- package/dist/connectors/drive/index.js.map +1 -1
- package/dist/connectors/framework/attachment-io.d.ts +5 -0
- package/dist/connectors/framework/attachment-io.d.ts.map +1 -0
- package/dist/connectors/framework/attachment-io.js +72 -0
- package/dist/connectors/framework/attachment-io.js.map +1 -0
- package/dist/connectors/framework/attachments.d.ts +32 -0
- package/dist/connectors/framework/attachments.d.ts.map +1 -0
- package/dist/connectors/framework/attachments.js +14 -0
- package/dist/connectors/framework/attachments.js.map +1 -0
- package/dist/connectors/framework/connector-event-types.d.ts +136 -0
- package/dist/connectors/framework/connector-event-types.d.ts.map +1 -0
- package/dist/connectors/framework/connector-event-types.js +3 -0
- package/dist/connectors/framework/connector-event-types.js.map +1 -0
- package/dist/connectors/framework/connector-state.d.ts +3 -0
- package/dist/connectors/framework/connector-state.d.ts.map +1 -0
- package/dist/connectors/framework/connector-state.js +47 -0
- package/dist/connectors/framework/connector-state.js.map +1 -0
- package/dist/connectors/framework/event-index.d.ts +28 -0
- package/dist/connectors/framework/event-index.d.ts.map +1 -0
- package/dist/connectors/framework/event-index.js +354 -0
- package/dist/connectors/framework/event-index.js.map +1 -0
- package/dist/connectors/framework/gws-utils.d.ts +3 -8
- package/dist/connectors/framework/gws-utils.d.ts.map +1 -1
- package/dist/connectors/framework/gws-utils.js +23 -30
- package/dist/connectors/framework/gws-utils.js.map +1 -1
- package/dist/connectors/framework/index.d.ts +4 -2
- package/dist/connectors/framework/index.d.ts.map +1 -1
- package/dist/connectors/framework/index.js +8 -6
- package/dist/connectors/framework/index.js.map +1 -1
- package/dist/connectors/framework/polling-scheduler.d.ts +71 -52
- package/dist/connectors/framework/polling-scheduler.d.ts.map +1 -1
- package/dist/connectors/framework/polling-scheduler.js +236 -168
- package/dist/connectors/framework/polling-scheduler.js.map +1 -1
- package/dist/connectors/framework/raw-query.d.ts +44 -0
- package/dist/connectors/framework/raw-query.d.ts.map +1 -0
- package/dist/connectors/framework/raw-query.js +584 -0
- package/dist/connectors/framework/raw-query.js.map +1 -0
- package/dist/connectors/framework/stored-index-read.d.ts +16 -0
- package/dist/connectors/framework/stored-index-read.d.ts.map +1 -0
- package/dist/connectors/framework/stored-index-read.js +66 -0
- package/dist/connectors/framework/stored-index-read.js.map +1 -0
- package/dist/connectors/framework/types.d.ts +17 -61
- package/dist/connectors/framework/types.d.ts.map +1 -1
- package/dist/connectors/framework/types.js +0 -4
- package/dist/connectors/framework/types.js.map +1 -1
- package/dist/connectors/gmail/index.d.ts +3 -2
- package/dist/connectors/gmail/index.d.ts.map +1 -1
- package/dist/connectors/gmail/index.js +74 -27
- package/dist/connectors/gmail/index.js.map +1 -1
- package/dist/connectors/ical/index.d.ts +29 -0
- package/dist/connectors/ical/index.d.ts.map +1 -0
- package/dist/connectors/ical/index.js +220 -0
- package/dist/connectors/ical/index.js.map +1 -0
- package/dist/connectors/ical/parser.d.ts +13 -0
- package/dist/connectors/ical/parser.d.ts.map +1 -0
- package/dist/connectors/ical/parser.js +117 -0
- package/dist/connectors/ical/parser.js.map +1 -0
- package/dist/connectors/imessage/index.d.ts +3 -1
- package/dist/connectors/imessage/index.d.ts.map +1 -1
- package/dist/connectors/imessage/index.js +31 -16
- package/dist/connectors/imessage/index.js.map +1 -1
- package/dist/connectors/index.d.ts +12 -5
- package/dist/connectors/index.d.ts.map +1 -1
- package/dist/connectors/index.js +67 -18
- package/dist/connectors/index.js.map +1 -1
- package/dist/connectors/kagemusha/index.d.ts +7 -19
- package/dist/connectors/kagemusha/index.d.ts.map +1 -1
- package/dist/connectors/kagemusha/index.js +123 -173
- package/dist/connectors/kagemusha/index.js.map +1 -1
- package/dist/connectors/notion/index.d.ts.map +1 -1
- package/dist/connectors/notion/index.js +79 -36
- package/dist/connectors/notion/index.js.map +1 -1
- package/dist/connectors/obsidian/index.d.ts +1 -1
- package/dist/connectors/obsidian/index.d.ts.map +1 -1
- package/dist/connectors/obsidian/index.js +59 -57
- package/dist/connectors/obsidian/index.js.map +1 -1
- package/dist/connectors/sheets/index.d.ts +8 -4
- package/dist/connectors/sheets/index.d.ts.map +1 -1
- package/dist/connectors/sheets/index.js +155 -143
- package/dist/connectors/sheets/index.js.map +1 -1
- package/dist/connectors/slack/index.d.ts +24 -5
- package/dist/connectors/slack/index.d.ts.map +1 -1
- package/dist/connectors/slack/index.js +177 -39
- package/dist/connectors/slack/index.js.map +1 -1
- package/dist/connectors/telegram/index.d.ts +9 -2
- package/dist/connectors/telegram/index.d.ts.map +1 -1
- package/dist/connectors/telegram/index.js +119 -70
- package/dist/connectors/telegram/index.js.map +1 -1
- package/dist/connectors/trello/index.d.ts +10 -3
- package/dist/connectors/trello/index.d.ts.map +1 -1
- package/dist/connectors/trello/index.js +88 -39
- package/dist/connectors/trello/index.js.map +1 -1
- package/dist/gateways/base-gateway.d.ts +9 -33
- package/dist/gateways/base-gateway.d.ts.map +1 -1
- package/dist/gateways/base-gateway.js +7 -28
- package/dist/gateways/base-gateway.js.map +1 -1
- package/dist/gateways/conversation-record.d.ts +52 -0
- package/dist/gateways/conversation-record.d.ts.map +1 -0
- package/dist/gateways/conversation-record.js +220 -0
- package/dist/gateways/conversation-record.js.map +1 -0
- package/dist/gateways/discord.d.ts +33 -135
- package/dist/gateways/discord.d.ts.map +1 -1
- package/dist/gateways/discord.js +258 -778
- package/dist/gateways/discord.js.map +1 -1
- package/dist/gateways/session-store.d.ts +28 -9
- package/dist/gateways/session-store.d.ts.map +1 -1
- package/dist/gateways/session-store.js +192 -60
- package/dist/gateways/session-store.js.map +1 -1
- package/dist/gateways/slack.d.ts +35 -105
- package/dist/gateways/slack.d.ts.map +1 -1
- package/dist/gateways/slack.js +282 -440
- package/dist/gateways/slack.js.map +1 -1
- package/dist/gateways/telegram-attachments.d.ts +32 -0
- package/dist/gateways/telegram-attachments.d.ts.map +1 -0
- package/dist/gateways/telegram-attachments.js +113 -0
- package/dist/gateways/telegram-attachments.js.map +1 -0
- package/dist/gateways/telegram-errors.d.ts +3 -0
- package/dist/gateways/telegram-errors.d.ts.map +1 -0
- package/dist/gateways/telegram-errors.js +10 -0
- package/dist/gateways/telegram-errors.js.map +1 -0
- package/dist/gateways/telegram-format.d.ts.map +1 -1
- package/dist/gateways/telegram-format.js +11 -3
- package/dist/gateways/telegram-format.js.map +1 -1
- package/dist/gateways/telegram-message-ledger.d.ts +31 -25
- package/dist/gateways/telegram-message-ledger.d.ts.map +1 -1
- package/dist/gateways/telegram-message-ledger.js +122 -146
- package/dist/gateways/telegram-message-ledger.js.map +1 -1
- package/dist/gateways/telegram-response-presenter.d.ts +3 -1
- package/dist/gateways/telegram-response-presenter.d.ts.map +1 -1
- package/dist/gateways/telegram-response-presenter.js +14 -0
- package/dist/gateways/telegram-response-presenter.js.map +1 -1
- package/dist/gateways/telegram-text-entities.d.ts +2 -3
- package/dist/gateways/telegram-text-entities.d.ts.map +1 -1
- package/dist/gateways/telegram-text-entities.js +4 -5
- package/dist/gateways/telegram-text-entities.js.map +1 -1
- package/dist/gateways/telegram.d.ts +39 -101
- package/dist/gateways/telegram.d.ts.map +1 -1
- package/dist/gateways/telegram.js +406 -919
- package/dist/gateways/telegram.js.map +1 -1
- package/dist/gateways/turn-contract.d.ts +27 -87
- package/dist/gateways/turn-contract.d.ts.map +1 -1
- package/dist/gateways/types.d.ts +14 -299
- package/dist/gateways/types.d.ts.map +1 -1
- package/dist/gateways/types.js +0 -3
- package/dist/gateways/types.js.map +1 -1
- package/dist/index.d.ts +1 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -23
- package/dist/index.js.map +1 -1
- package/dist/operator/board-read-views.d.ts +8 -10
- package/dist/operator/board-read-views.d.ts.map +1 -1
- package/dist/operator/board-read-views.js +7 -16
- package/dist/operator/board-read-views.js.map +1 -1
- package/dist/operator/board-slot-instructions.d.ts +5 -8
- package/dist/operator/board-slot-instructions.d.ts.map +1 -1
- package/dist/operator/board-slot-instructions.js +12 -24
- package/dist/operator/board-slot-instructions.js.map +1 -1
- package/dist/replay/import-manifest.d.ts +21 -0
- package/dist/replay/import-manifest.d.ts.map +1 -0
- package/dist/replay/import-manifest.js +157 -0
- package/dist/replay/import-manifest.js.map +1 -0
- package/dist/replay/jev-client.d.ts +35 -0
- package/dist/replay/jev-client.d.ts.map +1 -0
- package/dist/replay/jev-client.js +141 -0
- package/dist/replay/jev-client.js.map +1 -0
- package/dist/replay/kagemusha-import.d.ts +35 -0
- package/dist/replay/kagemusha-import.d.ts.map +1 -0
- package/dist/replay/kagemusha-import.js +543 -0
- package/dist/replay/kagemusha-import.js.map +1 -0
- package/dist/replay/replay-cursor.d.ts +31 -0
- package/dist/replay/replay-cursor.d.ts.map +1 -0
- package/dist/replay/replay-cursor.js +189 -0
- package/dist/replay/replay-cursor.js.map +1 -0
- package/dist/replay/replay-feeder.d.ts +55 -0
- package/dist/replay/replay-feeder.d.ts.map +1 -0
- package/dist/replay/replay-feeder.js +214 -0
- package/dist/replay/replay-feeder.js.map +1 -0
- package/dist/replay/replay-ledger.d.ts +32 -0
- package/dist/replay/replay-ledger.d.ts.map +1 -0
- package/dist/replay/replay-ledger.js +91 -0
- package/dist/replay/replay-ledger.js.map +1 -0
- package/dist/replay/replay-source-catalog.d.ts +66 -0
- package/dist/replay/replay-source-catalog.d.ts.map +1 -0
- package/dist/replay/replay-source-catalog.js +332 -0
- package/dist/replay/replay-source-catalog.js.map +1 -0
- package/dist/replay/trello-import.d.ts +33 -0
- package/dist/replay/trello-import.d.ts.map +1 -0
- package/dist/replay/trello-import.js +204 -0
- package/dist/replay/trello-import.js.map +1 -0
- package/dist/replay/window-queue.d.ts +116 -0
- package/dist/replay/window-queue.d.ts.map +1 -0
- package/dist/replay/window-queue.js +497 -0
- package/dist/replay/window-queue.js.map +1 -0
- package/dist/runtime/action-mcp-server.d.ts +30 -0
- package/dist/runtime/action-mcp-server.d.ts.map +1 -0
- package/dist/runtime/action-mcp-server.js +178 -0
- package/dist/runtime/action-mcp-server.js.map +1 -0
- package/dist/runtime/action-surface.d.ts +47 -0
- package/dist/runtime/action-surface.d.ts.map +1 -0
- package/dist/runtime/action-surface.js +192 -0
- package/dist/runtime/action-surface.js.map +1 -0
- package/dist/runtime/backend-security.d.ts +7 -0
- package/dist/runtime/backend-security.d.ts.map +1 -0
- package/dist/runtime/backend-security.js +28 -0
- package/dist/runtime/backend-security.js.map +1 -0
- package/dist/runtime/claude-caller-hook.d.ts +20 -0
- package/dist/runtime/claude-caller-hook.d.ts.map +1 -0
- package/dist/runtime/claude-caller-hook.js +41 -0
- package/dist/runtime/claude-caller-hook.js.map +1 -0
- package/dist/runtime/config.d.ts +84 -0
- package/dist/runtime/config.d.ts.map +1 -0
- package/dist/runtime/config.js +361 -0
- package/dist/runtime/config.js.map +1 -0
- package/dist/runtime/connectors.d.ts +41 -0
- package/dist/runtime/connectors.d.ts.map +1 -0
- package/dist/runtime/connectors.js +187 -0
- package/dist/runtime/connectors.js.map +1 -0
- package/dist/runtime/core-db.d.ts +8 -0
- package/dist/runtime/core-db.d.ts.map +1 -0
- package/dist/runtime/core-db.js +19 -0
- package/dist/runtime/core-db.js.map +1 -0
- package/dist/runtime/model-cache.d.ts +9 -0
- package/dist/runtime/model-cache.d.ts.map +1 -0
- package/dist/runtime/model-cache.js +22 -0
- package/dist/runtime/model-cache.js.map +1 -0
- package/dist/runtime/native-session.d.ts +86 -0
- package/dist/runtime/native-session.d.ts.map +1 -0
- package/dist/runtime/native-session.js +282 -0
- package/dist/runtime/native-session.js.map +1 -0
- package/dist/runtime/owner-policy.d.ts +10 -0
- package/dist/runtime/owner-policy.d.ts.map +1 -0
- package/dist/runtime/owner-policy.js +35 -0
- package/dist/runtime/owner-policy.js.map +1 -0
- package/dist/runtime/owner-runtime.d.ts +89 -0
- package/dist/runtime/owner-runtime.d.ts.map +1 -0
- package/dist/runtime/owner-runtime.js +319 -0
- package/dist/runtime/owner-runtime.js.map +1 -0
- package/dist/runtime/owner-system-prompt.d.ts +16 -0
- package/dist/runtime/owner-system-prompt.d.ts.map +1 -0
- package/dist/runtime/owner-system-prompt.js +118 -0
- package/dist/runtime/owner-system-prompt.js.map +1 -0
- package/dist/runtime/recent-owner-exchanges.d.ts +8 -0
- package/dist/runtime/recent-owner-exchanges.d.ts.map +1 -0
- package/dist/runtime/recent-owner-exchanges.js +27 -0
- package/dist/runtime/recent-owner-exchanges.js.map +1 -0
- package/dist/runtime/record-orders.d.ts +49 -0
- package/dist/runtime/record-orders.d.ts.map +1 -0
- package/dist/runtime/record-orders.js +152 -0
- package/dist/runtime/record-orders.js.map +1 -0
- package/dist/runtime/report-scheduler.d.ts +24 -0
- package/dist/runtime/report-scheduler.d.ts.map +1 -0
- package/dist/runtime/report-scheduler.js +100 -0
- package/dist/runtime/report-scheduler.js.map +1 -0
- package/dist/runtime/session-credential.d.ts +5 -0
- package/dist/runtime/session-credential.d.ts.map +1 -0
- package/dist/runtime/session-credential.js +19 -0
- package/dist/runtime/session-credential.js.map +1 -0
- package/dist/runtime/stimulus-delivery.d.ts +83 -0
- package/dist/runtime/stimulus-delivery.d.ts.map +1 -0
- package/dist/runtime/stimulus-delivery.js +507 -0
- package/dist/runtime/stimulus-delivery.js.map +1 -0
- package/dist/runtime/timezone.d.ts +15 -0
- package/dist/runtime/timezone.d.ts.map +1 -0
- package/dist/runtime/timezone.js +128 -0
- package/dist/runtime/timezone.js.map +1 -0
- package/dist/runtime/turn-orders.d.ts +86 -0
- package/dist/runtime/turn-orders.d.ts.map +1 -0
- package/dist/runtime/turn-orders.js +272 -0
- package/dist/runtime/turn-orders.js.map +1 -0
- package/dist/sqlite.d.ts +7 -32
- package/dist/sqlite.d.ts.map +1 -1
- package/dist/sqlite.js +10 -48
- package/dist/sqlite.js.map +1 -1
- package/dist/storage/migrations/raw-item-revisions.d.ts +6 -0
- package/dist/storage/migrations/raw-item-revisions.d.ts.map +1 -0
- package/dist/storage/migrations/raw-item-revisions.js +109 -0
- package/dist/storage/migrations/raw-item-revisions.js.map +1 -0
- package/dist/storage/migrations-source.d.ts +5 -0
- package/dist/storage/migrations-source.d.ts.map +1 -0
- package/dist/storage/migrations-source.js +24 -0
- package/dist/storage/migrations-source.js.map +1 -0
- package/dist/storage/source-archive.d.ts +123 -0
- package/dist/storage/source-archive.d.ts.map +1 -0
- package/dist/storage/source-archive.js +595 -0
- package/dist/storage/source-archive.js.map +1 -0
- package/dist/storage-sqlite.d.ts +59 -0
- package/dist/storage-sqlite.d.ts.map +1 -0
- package/dist/storage-sqlite.js +75 -0
- package/dist/storage-sqlite.js.map +1 -0
- package/dist/utils/untrusted-content.d.ts +5 -35
- package/dist/utils/untrusted-content.d.ts.map +1 -1
- package/dist/utils/untrusted-content.js +16 -75
- package/dist/utils/untrusted-content.js.map +1 -1
- package/dist/wiki/obsidian-writer.d.ts +4 -2
- package/dist/wiki/obsidian-writer.d.ts.map +1 -1
- package/dist/wiki/obsidian-writer.js +85 -4
- package/dist/wiki/obsidian-writer.js.map +1 -1
- package/dist/wiki/path-safety.d.ts +2 -0
- package/dist/wiki/path-safety.d.ts.map +1 -1
- package/dist/wiki/path-safety.js +11 -3
- package/dist/wiki/path-safety.js.map +1 -1
- package/dist/wiki/wiki-edits.d.ts +17 -0
- package/dist/wiki/wiki-edits.d.ts.map +1 -0
- package/dist/wiki/wiki-edits.js +75 -0
- package/dist/wiki/wiki-edits.js.map +1 -0
- package/dist/wiki/wiki-read.d.ts +20 -11
- package/dist/wiki/wiki-read.d.ts.map +1 -1
- package/dist/wiki/wiki-read.js +87 -89
- package/dist/wiki/wiki-read.js.map +1 -1
- package/dist/wiki-artifacts/types.d.ts +1 -1
- package/dist/wiki-artifacts/types.d.ts.map +1 -1
- package/dist/wiki-artifacts/wiki-publish-adapter.d.ts.map +1 -1
- package/dist/wiki-artifacts/wiki-publish-adapter.js +13 -9
- package/dist/wiki-artifacts/wiki-publish-adapter.js.map +1 -1
- package/package.json +11 -41
- package/public/viewer/js/modules/graph.js +111 -41
- package/public/viewer/js/modules/memory.js +4 -31
- package/public/viewer/js/modules/wiki.js +0 -37
- package/public/viewer/js/utils/api.js +4 -50
- package/public/viewer/log-viewer.html +46 -0
- package/public/viewer/operator/operator.css +1 -1
- package/public/viewer/operator/operator.js +10835 -8211
- package/public/viewer/src/modules/graph.ts +133 -41
- package/public/viewer/src/modules/memory.ts +4 -31
- package/public/viewer/src/modules/wiki.ts +0 -42
- package/public/viewer/src/types/global.d.ts +1 -1
- package/public/viewer/src/utils/api.ts +7 -83
- package/public/viewer/viewer.html +7 -96
- package/dist/agent/agent-loop.d.ts +0 -289
- package/dist/agent/agent-loop.d.ts.map +0 -1
- package/dist/agent/agent-loop.js +0 -2842
- package/dist/agent/agent-loop.js.map +0 -1
- package/dist/agent/attachment-text-extractor.d.ts +0 -2
- package/dist/agent/attachment-text-extractor.d.ts.map +0 -1
- package/dist/agent/attachment-text-extractor.js +0 -128
- package/dist/agent/attachment-text-extractor.js.map +0 -1
- package/dist/agent/backend-model-policy.d.ts +0 -58
- package/dist/agent/backend-model-policy.d.ts.map +0 -1
- package/dist/agent/backend-model-policy.js +0 -167
- package/dist/agent/backend-model-policy.js.map +0 -1
- package/dist/agent/backend-model-runner-factory.d.ts +0 -27
- package/dist/agent/backend-model-runner-factory.d.ts.map +0 -1
- package/dist/agent/backend-model-runner-factory.js +0 -88
- package/dist/agent/backend-model-runner-factory.js.map +0 -1
- package/dist/agent/claude-cli-wrapper.d.ts +0 -144
- package/dist/agent/claude-cli-wrapper.d.ts.map +0 -1
- package/dist/agent/claude-cli-wrapper.js +0 -382
- package/dist/agent/claude-cli-wrapper.js.map +0 -1
- package/dist/agent/cli-arg-redaction.d.ts +0 -2
- package/dist/agent/cli-arg-redaction.d.ts.map +0 -1
- package/dist/agent/cli-arg-redaction.js +0 -18
- package/dist/agent/cli-arg-redaction.js.map +0 -1
- package/dist/agent/cline-cli-adapter.d.ts +0 -126
- package/dist/agent/cline-cli-adapter.d.ts.map +0 -1
- package/dist/agent/cline-cli-adapter.js +0 -1042
- package/dist/agent/cline-cli-adapter.js.map +0 -1
- package/dist/agent/cline-native-tool-policy.d.ts +0 -9
- package/dist/agent/cline-native-tool-policy.d.ts.map +0 -1
- package/dist/agent/cline-native-tool-policy.js +0 -61
- package/dist/agent/cline-native-tool-policy.js.map +0 -1
- package/dist/agent/code-act/completed-terminal-result.d.ts +0 -5
- package/dist/agent/code-act/completed-terminal-result.d.ts.map +0 -1
- package/dist/agent/code-act/completed-terminal-result.js +0 -83
- package/dist/agent/code-act/completed-terminal-result.js.map +0 -1
- package/dist/agent/code-act/constants.d.ts +0 -11
- package/dist/agent/code-act/constants.d.ts.map +0 -1
- package/dist/agent/code-act/constants.js +0 -64
- package/dist/agent/code-act/constants.js.map +0 -1
- package/dist/agent/code-act/host-bridge.d.ts +0 -50
- package/dist/agent/code-act/host-bridge.d.ts.map +0 -1
- package/dist/agent/code-act/host-bridge.js +0 -1405
- package/dist/agent/code-act/host-bridge.js.map +0 -1
- package/dist/agent/code-act/index.d.ts +0 -10
- package/dist/agent/code-act/index.d.ts.map +0 -1
- package/dist/agent/code-act/index.js +0 -22
- package/dist/agent/code-act/index.js.map +0 -1
- package/dist/agent/code-act/run-context-registry.d.ts +0 -36
- package/dist/agent/code-act/run-context-registry.d.ts.map +0 -1
- package/dist/agent/code-act/run-context-registry.js +0 -143
- package/dist/agent/code-act/run-context-registry.js.map +0 -1
- package/dist/agent/code-act/sandbox.d.ts +0 -25
- package/dist/agent/code-act/sandbox.d.ts.map +0 -1
- package/dist/agent/code-act/sandbox.js +0 -494
- package/dist/agent/code-act/sandbox.js.map +0 -1
- package/dist/agent/code-act/tool-catalog.d.ts +0 -30
- package/dist/agent/code-act/tool-catalog.d.ts.map +0 -1
- package/dist/agent/code-act/tool-catalog.js +0 -185
- package/dist/agent/code-act/tool-catalog.js.map +0 -1
- package/dist/agent/code-act/tool-policy.d.ts +0 -51
- package/dist/agent/code-act/tool-policy.d.ts.map +0 -1
- package/dist/agent/code-act/tool-policy.js +0 -160
- package/dist/agent/code-act/tool-policy.js.map +0 -1
- package/dist/agent/code-act/type-definition-generator.d.ts +0 -19
- package/dist/agent/code-act/type-definition-generator.d.ts.map +0 -1
- package/dist/agent/code-act/type-definition-generator.js +0 -73
- package/dist/agent/code-act/type-definition-generator.js.map +0 -1
- package/dist/agent/code-act/types.d.ts +0 -57
- package/dist/agent/code-act/types.d.ts.map +0 -1
- package/dist/agent/code-act/types.js +0 -14
- package/dist/agent/code-act/types.js.map +0 -1
- package/dist/agent/codex-app-server-process.d.ts +0 -257
- package/dist/agent/codex-app-server-process.d.ts.map +0 -1
- package/dist/agent/codex-app-server-process.js +0 -2084
- package/dist/agent/codex-app-server-process.js.map +0 -1
- package/dist/agent/codex-auth.d.ts +0 -2
- package/dist/agent/codex-auth.d.ts.map +0 -1
- package/dist/agent/codex-auth.js +0 -17
- package/dist/agent/codex-auth.js.map +0 -1
- package/dist/agent/codex-auxiliary-tools.d.ts +0 -17
- package/dist/agent/codex-auxiliary-tools.d.ts.map +0 -1
- package/dist/agent/codex-auxiliary-tools.js +0 -267
- package/dist/agent/codex-auxiliary-tools.js.map +0 -1
- package/dist/agent/codex-home.d.ts +0 -13
- package/dist/agent/codex-home.d.ts.map +0 -1
- package/dist/agent/codex-home.js +0 -644
- package/dist/agent/codex-home.js.map +0 -1
- package/dist/agent/codex-thread-registry.d.ts +0 -63
- package/dist/agent/codex-thread-registry.d.ts.map +0 -1
- package/dist/agent/codex-thread-registry.js +0 -433
- package/dist/agent/codex-thread-registry.js.map +0 -1
- package/dist/agent/content-dedup.d.ts +0 -86
- package/dist/agent/content-dedup.d.ts.map +0 -1
- package/dist/agent/content-dedup.js +0 -114
- package/dist/agent/content-dedup.js.map +0 -1
- package/dist/agent/context-compile-contract.d.ts +0 -5
- package/dist/agent/context-compile-contract.d.ts.map +0 -1
- package/dist/agent/context-compile-contract.js +0 -8
- package/dist/agent/context-compile-contract.js.map +0 -1
- package/dist/agent/context-compile-service.d.ts +0 -60
- package/dist/agent/context-compile-service.d.ts.map +0 -1
- package/dist/agent/context-compile-service.js +0 -481
- package/dist/agent/context-compile-service.js.map +0 -1
- package/dist/agent/context-prompt-builder.d.ts +0 -24
- package/dist/agent/context-prompt-builder.d.ts.map +0 -1
- package/dist/agent/context-prompt-builder.js +0 -61
- package/dist/agent/context-prompt-builder.js.map +0 -1
- package/dist/agent/contract-extractor.d.ts +0 -124
- package/dist/agent/contract-extractor.d.ts.map +0 -1
- package/dist/agent/contract-extractor.js +0 -465
- package/dist/agent/contract-extractor.js.map +0 -1
- package/dist/agent/drive-tools.d.ts +0 -83
- package/dist/agent/drive-tools.d.ts.map +0 -1
- package/dist/agent/drive-tools.js +0 -338
- package/dist/agent/drive-tools.js.map +0 -1
- package/dist/agent/gateway-tool-catalog.d.ts +0 -14
- package/dist/agent/gateway-tool-catalog.d.ts.map +0 -1
- package/dist/agent/gateway-tool-catalog.js +0 -41
- package/dist/agent/gateway-tool-catalog.js.map +0 -1
- package/dist/agent/gateway-tool-executor.d.ts +0 -353
- package/dist/agent/gateway-tool-executor.d.ts.map +0 -1
- package/dist/agent/gateway-tool-executor.js +0 -5448
- package/dist/agent/gateway-tool-executor.js.map +0 -1
- package/dist/agent/gateway-tools.md +0 -166
- package/dist/agent/image-translation-tools.d.ts +0 -48
- package/dist/agent/image-translation-tools.d.ts.map +0 -1
- package/dist/agent/image-translation-tools.js +0 -274
- package/dist/agent/image-translation-tools.js.map +0 -1
- package/dist/agent/index.d.ts +0 -13
- package/dist/agent/index.d.ts.map +0 -1
- package/dist/agent/index.js +0 -18
- package/dist/agent/index.js.map +0 -1
- package/dist/agent/mama-tool-handlers.d.ts +0 -11
- package/dist/agent/mama-tool-handlers.d.ts.map +0 -1
- package/dist/agent/mama-tool-handlers.js +0 -220
- package/dist/agent/mama-tool-handlers.js.map +0 -1
- package/dist/agent/managed-agent-runtime-sync.d.ts +0 -36
- package/dist/agent/managed-agent-runtime-sync.d.ts.map +0 -1
- package/dist/agent/managed-agent-runtime-sync.js +0 -245
- package/dist/agent/managed-agent-runtime-sync.js.map +0 -1
- package/dist/agent/managed-agent-validation.d.ts +0 -4
- package/dist/agent/managed-agent-validation.d.ts.map +0 -1
- package/dist/agent/managed-agent-validation.js +0 -85
- package/dist/agent/managed-agent-validation.js.map +0 -1
- package/dist/agent/model-runner.d.ts +0 -180
- package/dist/agent/model-runner.d.ts.map +0 -1
- package/dist/agent/model-runner.js +0 -54
- package/dist/agent/model-runner.js.map +0 -1
- package/dist/agent/native-effect-observer.d.ts +0 -20
- package/dist/agent/native-effect-observer.d.ts.map +0 -1
- package/dist/agent/native-effect-observer.js +0 -86
- package/dist/agent/native-effect-observer.js.map +0 -1
- package/dist/agent/obsidian-cli-args.d.ts +0 -14
- package/dist/agent/obsidian-cli-args.d.ts.map +0 -1
- package/dist/agent/obsidian-cli-args.js +0 -57
- package/dist/agent/obsidian-cli-args.js.map +0 -1
- package/dist/agent/os-agent-capabilities.md +0 -367
- package/dist/agent/persistent-cli-adapter.d.ts +0 -173
- package/dist/agent/persistent-cli-adapter.d.ts.map +0 -1
- package/dist/agent/persistent-cli-adapter.js +0 -506
- package/dist/agent/persistent-cli-adapter.js.map +0 -1
- package/dist/agent/persistent-cli-process.d.ts +0 -392
- package/dist/agent/persistent-cli-process.d.ts.map +0 -1
- package/dist/agent/persistent-cli-process.js +0 -1568
- package/dist/agent/persistent-cli-process.js.map +0 -1
- package/dist/agent/post-tool-handler.d.ts +0 -27
- package/dist/agent/post-tool-handler.d.ts.map +0 -1
- package/dist/agent/post-tool-handler.js +0 -194
- package/dist/agent/post-tool-handler.js.map +0 -1
- package/dist/agent/pre-compact-handler.d.ts +0 -36
- package/dist/agent/pre-compact-handler.d.ts.map +0 -1
- package/dist/agent/pre-compact-handler.js +0 -162
- package/dist/agent/pre-compact-handler.js.map +0 -1
- package/dist/agent/prompt-enhancer.d.ts +0 -33
- package/dist/agent/prompt-enhancer.d.ts.map +0 -1
- package/dist/agent/prompt-enhancer.js +0 -811
- package/dist/agent/prompt-enhancer.js.map +0 -1
- package/dist/agent/prompt-size-monitor.d.ts +0 -104
- package/dist/agent/prompt-size-monitor.d.ts.map +0 -1
- package/dist/agent/prompt-size-monitor.js +0 -192
- package/dist/agent/prompt-size-monitor.js.map +0 -1
- package/dist/agent/role-manager.d.ts +0 -122
- package/dist/agent/role-manager.d.ts.map +0 -1
- package/dist/agent/role-manager.js +0 -300
- package/dist/agent/role-manager.js.map +0 -1
- package/dist/agent/session-pool.d.ts +0 -176
- package/dist/agent/session-pool.d.ts.map +0 -1
- package/dist/agent/session-pool.js +0 -368
- package/dist/agent/session-pool.js.map +0 -1
- package/dist/agent/skill-loader.d.ts +0 -87
- package/dist/agent/skill-loader.d.ts.map +0 -1
- package/dist/agent/skill-loader.js +0 -461
- package/dist/agent/skill-loader.js.map +0 -1
- package/dist/agent/stop-continuation-handler.d.ts +0 -106
- package/dist/agent/stop-continuation-handler.d.ts.map +0 -1
- package/dist/agent/stop-continuation-handler.js +0 -230
- package/dist/agent/stop-continuation-handler.js.map +0 -1
- package/dist/agent/subagent-run-reconcile.d.ts +0 -23
- package/dist/agent/subagent-run-reconcile.d.ts.map +0 -1
- package/dist/agent/subagent-run-reconcile.js +0 -56
- package/dist/agent/subagent-run-reconcile.js.map +0 -1
- package/dist/agent/temporal-code-act-breaker.d.ts +0 -26
- package/dist/agent/temporal-code-act-breaker.d.ts.map +0 -1
- package/dist/agent/temporal-code-act-breaker.js +0 -94
- package/dist/agent/temporal-code-act-breaker.js.map +0 -1
- package/dist/agent/token-estimator.d.ts +0 -25
- package/dist/agent/token-estimator.d.ts.map +0 -1
- package/dist/agent/token-estimator.js +0 -75
- package/dist/agent/token-estimator.js.map +0 -1
- package/dist/agent/tool-registry.d.ts +0 -81
- package/dist/agent/tool-registry.d.ts.map +0 -1
- package/dist/agent/tool-registry.js +0 -876
- package/dist/agent/tool-registry.js.map +0 -1
- package/dist/agent/types.d.ts +0 -1261
- package/dist/agent/types.d.ts.map +0 -1
- package/dist/agent/types.js +0 -60
- package/dist/agent/types.js.map +0 -1
- package/dist/agent/yaml-frontmatter.d.ts +0 -75
- package/dist/agent/yaml-frontmatter.d.ts.map +0 -1
- package/dist/agent/yaml-frontmatter.js +0 -166
- package/dist/agent/yaml-frontmatter.js.map +0 -1
- package/dist/api/agent-context-handler.d.ts +0 -10
- package/dist/api/agent-context-handler.d.ts.map +0 -1
- package/dist/api/agent-context-handler.js +0 -216
- package/dist/api/agent-context-handler.js.map +0 -1
- package/dist/api/agent-graph-handler.d.ts +0 -18
- package/dist/api/agent-graph-handler.d.ts.map +0 -1
- package/dist/api/agent-graph-handler.js +0 -569
- package/dist/api/agent-graph-handler.js.map +0 -1
- package/dist/api/agent-handler.d.ts +0 -36
- package/dist/api/agent-handler.d.ts.map +0 -1
- package/dist/api/agent-handler.js +0 -223
- package/dist/api/agent-handler.js.map +0 -1
- package/dist/api/agent-raw-handler.d.ts +0 -70
- package/dist/api/agent-raw-handler.d.ts.map +0 -1
- package/dist/api/agent-raw-handler.js +0 -262
- package/dist/api/agent-raw-handler.js.map +0 -1
- package/dist/api/agent-situation-handler.d.ts +0 -14
- package/dist/api/agent-situation-handler.d.ts.map +0 -1
- package/dist/api/agent-situation-handler.js +0 -383
- package/dist/api/agent-situation-handler.js.map +0 -1
- package/dist/api/connector-feed-handler.d.ts +0 -42
- package/dist/api/connector-feed-handler.d.ts.map +0 -1
- package/dist/api/connector-feed-handler.js +0 -180
- package/dist/api/connector-feed-handler.js.map +0 -1
- package/dist/api/cron-handler.d.ts +0 -44
- package/dist/api/cron-handler.d.ts.map +0 -1
- package/dist/api/cron-handler.js +0 -261
- package/dist/api/cron-handler.js.map +0 -1
- package/dist/api/entity-audit-handler.d.ts +0 -12
- package/dist/api/entity-audit-handler.d.ts.map +0 -1
- package/dist/api/entity-audit-handler.js +0 -119
- package/dist/api/entity-audit-handler.js.map +0 -1
- package/dist/api/entity-audit-queue.d.ts +0 -74
- package/dist/api/entity-audit-queue.d.ts.map +0 -1
- package/dist/api/entity-audit-queue.js +0 -123
- package/dist/api/entity-audit-queue.js.map +0 -1
- package/dist/api/entity-audit-runner.d.ts +0 -9
- package/dist/api/entity-audit-runner.d.ts.map +0 -1
- package/dist/api/entity-audit-runner.js +0 -240
- package/dist/api/entity-audit-runner.js.map +0 -1
- package/dist/api/entity-review-handler.d.ts +0 -18
- package/dist/api/entity-review-handler.d.ts.map +0 -1
- package/dist/api/entity-review-handler.js +0 -521
- package/dist/api/entity-review-handler.js.map +0 -1
- package/dist/api/error-handler.d.ts +0 -22
- package/dist/api/error-handler.d.ts.map +0 -1
- package/dist/api/error-handler.js +0 -104
- package/dist/api/error-handler.js.map +0 -1
- package/dist/api/graph-api-types.d.ts +0 -105
- package/dist/api/graph-api-types.d.ts.map +0 -1
- package/dist/api/graph-api-types.js +0 -6
- package/dist/api/graph-api-types.js.map +0 -1
- package/dist/api/graph-api.d.ts +0 -42
- package/dist/api/graph-api.d.ts.map +0 -1
- package/dist/api/graph-api.js +0 -3460
- package/dist/api/graph-api.js.map +0 -1
- package/dist/api/heartbeat-handler.d.ts +0 -49
- package/dist/api/heartbeat-handler.d.ts.map +0 -1
- package/dist/api/heartbeat-handler.js +0 -106
- package/dist/api/heartbeat-handler.js.map +0 -1
- package/dist/api/index.d.ts +0 -145
- package/dist/api/index.d.ts.map +0 -1
- package/dist/api/index.js +0 -448
- package/dist/api/index.js.map +0 -1
- package/dist/api/intelligence-handler.d.ts +0 -116
- package/dist/api/intelligence-handler.d.ts.map +0 -1
- package/dist/api/intelligence-handler.js +0 -280
- package/dist/api/intelligence-handler.js.map +0 -1
- package/dist/api/memory-provenance-handler.d.ts +0 -3
- package/dist/api/memory-provenance-handler.d.ts.map +0 -1
- package/dist/api/memory-provenance-handler.js +0 -120
- package/dist/api/memory-provenance-handler.js.map +0 -1
- package/dist/api/operator-handler.d.ts +0 -19
- package/dist/api/operator-handler.d.ts.map +0 -1
- package/dist/api/operator-handler.js +0 -106
- package/dist/api/operator-handler.js.map +0 -1
- package/dist/api/operator-summary.d.ts +0 -3
- package/dist/api/operator-summary.d.ts.map +0 -1
- package/dist/api/operator-summary.js +0 -72
- package/dist/api/operator-summary.js.map +0 -1
- package/dist/api/operator-tasks-handler.d.ts +0 -7
- package/dist/api/operator-tasks-handler.d.ts.map +0 -1
- package/dist/api/operator-tasks-handler.js +0 -192
- package/dist/api/operator-tasks-handler.js.map +0 -1
- package/dist/api/runtime-status-handler.d.ts +0 -42
- package/dist/api/runtime-status-handler.d.ts.map +0 -1
- package/dist/api/runtime-status-handler.js +0 -56
- package/dist/api/runtime-status-handler.js.map +0 -1
- package/dist/api/skills-handler.d.ts +0 -12
- package/dist/api/skills-handler.d.ts.map +0 -1
- package/dist/api/skills-handler.js +0 -156
- package/dist/api/skills-handler.js.map +0 -1
- package/dist/api/token-handler.d.ts +0 -33
- package/dist/api/token-handler.d.ts.map +0 -1
- package/dist/api/token-handler.js +0 -118
- package/dist/api/token-handler.js.map +0 -1
- package/dist/api/types.d.ts +0 -155
- package/dist/api/types.d.ts.map +0 -1
- package/dist/api/types.js +0 -49
- package/dist/api/types.js.map +0 -1
- package/dist/api/ui-command-handler.d.ts +0 -48
- package/dist/api/ui-command-handler.d.ts.map +0 -1
- package/dist/api/ui-command-handler.js +0 -160
- package/dist/api/ui-command-handler.js.map +0 -1
- package/dist/api/upload-handler.d.ts +0 -12
- package/dist/api/upload-handler.d.ts.map +0 -1
- package/dist/api/upload-handler.js +0 -321
- package/dist/api/upload-handler.js.map +0 -1
- package/dist/api/wiki-handler.d.ts +0 -19
- package/dist/api/wiki-handler.d.ts.map +0 -1
- package/dist/api/wiki-handler.js +0 -136
- package/dist/api/wiki-handler.js.map +0 -1
- package/dist/api/worker-envelope.d.ts +0 -26
- package/dist/api/worker-envelope.d.ts.map +0 -1
- package/dist/api/worker-envelope.js +0 -176
- package/dist/api/worker-envelope.js.map +0 -1
- package/dist/auth/claude-client.d.ts +0 -12
- package/dist/auth/claude-client.d.ts.map +0 -1
- package/dist/auth/claude-client.js +0 -36
- package/dist/auth/claude-client.js.map +0 -1
- package/dist/auth/claude-code-auth.d.ts +0 -12
- package/dist/auth/claude-code-auth.d.ts.map +0 -1
- package/dist/auth/claude-code-auth.js +0 -85
- package/dist/auth/claude-code-auth.js.map +0 -1
- package/dist/auth/index.d.ts +0 -9
- package/dist/auth/index.d.ts.map +0 -1
- package/dist/auth/index.js +0 -13
- package/dist/auth/index.js.map +0 -1
- package/dist/auth/oauth-manager.d.ts +0 -59
- package/dist/auth/oauth-manager.d.ts.map +0 -1
- package/dist/auth/oauth-manager.js +0 -252
- package/dist/auth/oauth-manager.js.map +0 -1
- package/dist/auth/types.d.ts +0 -92
- package/dist/auth/types.d.ts.map +0 -1
- package/dist/auth/types.js +0 -23
- package/dist/auth/types.js.map +0 -1
- package/dist/cli/commands/connector.d.ts +0 -14
- package/dist/cli/commands/connector.d.ts.map +0 -1
- package/dist/cli/commands/connector.js +0 -174
- package/dist/cli/commands/connector.js.map +0 -1
- package/dist/cli/commands/gateway.d.ts +0 -18
- package/dist/cli/commands/gateway.d.ts.map +0 -1
- package/dist/cli/commands/gateway.js +0 -144
- package/dist/cli/commands/gateway.js.map +0 -1
- package/dist/cli/commands/report.d.ts +0 -14
- package/dist/cli/commands/report.d.ts.map +0 -1
- package/dist/cli/commands/report.js +0 -102
- package/dist/cli/commands/report.js.map +0 -1
- package/dist/cli/commands/run.d.ts +0 -19
- package/dist/cli/commands/run.d.ts.map +0 -1
- package/dist/cli/commands/run.js +0 -123
- package/dist/cli/commands/run.js.map +0 -1
- package/dist/cli/commands/setup.d.ts +0 -3
- package/dist/cli/commands/setup.d.ts.map +0 -1
- package/dist/cli/commands/setup.js +0 -9
- package/dist/cli/commands/setup.js.map +0 -1
- package/dist/cli/commands/start.d.ts +0 -263
- package/dist/cli/commands/start.d.ts.map +0 -1
- package/dist/cli/commands/start.js +0 -2230
- package/dist/cli/commands/start.js.map +0 -1
- package/dist/cli/commands/status.d.ts +0 -18
- package/dist/cli/commands/status.d.ts.map +0 -1
- package/dist/cli/commands/status.js +0 -326
- package/dist/cli/commands/status.js.map +0 -1
- package/dist/cli/commands/stop.d.ts +0 -28
- package/dist/cli/commands/stop.d.ts.map +0 -1
- package/dist/cli/commands/stop.js +0 -597
- package/dist/cli/commands/stop.js.map +0 -1
- package/dist/cli/config/config-manager.d.ts +0 -84
- package/dist/cli/config/config-manager.d.ts.map +0 -1
- package/dist/cli/config/config-manager.js +0 -886
- package/dist/cli/config/config-manager.js.map +0 -1
- package/dist/cli/config/types.d.ts +0 -633
- package/dist/cli/config/types.d.ts.map +0 -1
- package/dist/cli/config/types.js +0 -247
- package/dist/cli/config/types.js.map +0 -1
- package/dist/cli/runtime/agent-loop-init.d.ts +0 -53
- package/dist/cli/runtime/agent-loop-init.d.ts.map +0 -1
- package/dist/cli/runtime/agent-loop-init.js +0 -368
- package/dist/cli/runtime/agent-loop-init.js.map +0 -1
- package/dist/cli/runtime/api-routes-init.d.ts +0 -84
- package/dist/cli/runtime/api-routes-init.d.ts.map +0 -1
- package/dist/cli/runtime/api-routes-init.js +0 -1542
- package/dist/cli/runtime/api-routes-init.js.map +0 -1
- package/dist/cli/runtime/api-server-init.d.ts +0 -59
- package/dist/cli/runtime/api-server-init.d.ts.map +0 -1
- package/dist/cli/runtime/api-server-init.js +0 -159
- package/dist/cli/runtime/api-server-init.js.map +0 -1
- package/dist/cli/runtime/code-act-executor.d.ts +0 -14
- package/dist/cli/runtime/code-act-executor.d.ts.map +0 -1
- package/dist/cli/runtime/code-act-executor.js +0 -108
- package/dist/cli/runtime/code-act-executor.js.map +0 -1
- package/dist/cli/runtime/connector-bootstrap.d.ts +0 -8
- package/dist/cli/runtime/connector-bootstrap.d.ts.map +0 -1
- package/dist/cli/runtime/connector-bootstrap.js +0 -14
- package/dist/cli/runtime/connector-bootstrap.js.map +0 -1
- package/dist/cli/runtime/connector-init.d.ts +0 -64
- package/dist/cli/runtime/connector-init.d.ts.map +0 -1
- package/dist/cli/runtime/connector-init.js +0 -237
- package/dist/cli/runtime/connector-init.js.map +0 -1
- package/dist/cli/runtime/daemon.d.ts +0 -38
- package/dist/cli/runtime/daemon.d.ts.map +0 -1
- package/dist/cli/runtime/daemon.js +0 -263
- package/dist/cli/runtime/daemon.js.map +0 -1
- package/dist/cli/runtime/envelope-bootstrap.d.ts +0 -17
- package/dist/cli/runtime/envelope-bootstrap.d.ts.map +0 -1
- package/dist/cli/runtime/envelope-bootstrap.js +0 -56
- package/dist/cli/runtime/envelope-bootstrap.js.map +0 -1
- package/dist/cli/runtime/gateway-init.d.ts +0 -55
- package/dist/cli/runtime/gateway-init.d.ts.map +0 -1
- package/dist/cli/runtime/gateway-init.js +0 -196
- package/dist/cli/runtime/gateway-init.js.map +0 -1
- package/dist/cli/runtime/gateway-wiring.d.ts +0 -51
- package/dist/cli/runtime/gateway-wiring.d.ts.map +0 -1
- package/dist/cli/runtime/gateway-wiring.js +0 -215
- package/dist/cli/runtime/gateway-wiring.js.map +0 -1
- package/dist/cli/runtime/mama-core-init.d.ts +0 -42
- package/dist/cli/runtime/mama-core-init.d.ts.map +0 -1
- package/dist/cli/runtime/mama-core-init.js +0 -211
- package/dist/cli/runtime/mama-core-init.js.map +0 -1
- package/dist/cli/runtime/message-router-config.d.ts +0 -4
- package/dist/cli/runtime/message-router-config.d.ts.map +0 -1
- package/dist/cli/runtime/message-router-config.js +0 -11
- package/dist/cli/runtime/message-router-config.js.map +0 -1
- package/dist/cli/runtime/metrics-init.d.ts +0 -28
- package/dist/cli/runtime/metrics-init.d.ts.map +0 -1
- package/dist/cli/runtime/metrics-init.js +0 -131
- package/dist/cli/runtime/metrics-init.js.map +0 -1
- package/dist/cli/runtime/owner-backfill.d.ts +0 -24
- package/dist/cli/runtime/owner-backfill.d.ts.map +0 -1
- package/dist/cli/runtime/owner-backfill.js +0 -24
- package/dist/cli/runtime/owner-backfill.js.map +0 -1
- package/dist/cli/runtime/scheduler-init.d.ts +0 -60
- package/dist/cli/runtime/scheduler-init.d.ts.map +0 -1
- package/dist/cli/runtime/scheduler-init.js +0 -173
- package/dist/cli/runtime/scheduler-init.js.map +0 -1
- package/dist/cli/runtime/server-start.d.ts +0 -23
- package/dist/cli/runtime/server-start.d.ts.map +0 -1
- package/dist/cli/runtime/server-start.js +0 -174
- package/dist/cli/runtime/server-start.js.map +0 -1
- package/dist/cli/runtime/shutdown.d.ts +0 -46
- package/dist/cli/runtime/shutdown.d.ts.map +0 -1
- package/dist/cli/runtime/shutdown.js +0 -240
- package/dist/cli/runtime/shutdown.js.map +0 -1
- package/dist/cli/runtime/temporal-init.d.ts +0 -26
- package/dist/cli/runtime/temporal-init.d.ts.map +0 -1
- package/dist/cli/runtime/temporal-init.js +0 -57
- package/dist/cli/runtime/temporal-init.js.map +0 -1
- package/dist/cli/runtime/types.d.ts +0 -127
- package/dist/cli/runtime/types.d.ts.map +0 -1
- package/dist/cli/runtime/types.js +0 -12
- package/dist/cli/runtime/types.js.map +0 -1
- package/dist/cli/runtime/utilities.d.ts +0 -72
- package/dist/cli/runtime/utilities.d.ts.map +0 -1
- package/dist/cli/runtime/utilities.js +0 -472
- package/dist/cli/runtime/utilities.js.map +0 -1
- package/dist/cli/shutdown-utils.d.ts +0 -6
- package/dist/cli/shutdown-utils.d.ts.map +0 -1
- package/dist/cli/shutdown-utils.js +0 -11
- package/dist/cli/shutdown-utils.js.map +0 -1
- package/dist/cli/utils/pid-manager.d.ts +0 -56
- package/dist/cli/utils/pid-manager.d.ts.map +0 -1
- package/dist/cli/utils/pid-manager.js +0 -141
- package/dist/cli/utils/pid-manager.js.map +0 -1
- package/dist/concurrency/index.d.ts +0 -13
- package/dist/concurrency/index.d.ts.map +0 -1
- package/dist/concurrency/index.js +0 -22
- package/dist/concurrency/index.js.map +0 -1
- package/dist/concurrency/lane-manager.d.ts +0 -113
- package/dist/concurrency/lane-manager.d.ts.map +0 -1
- package/dist/concurrency/lane-manager.js +0 -248
- package/dist/concurrency/lane-manager.js.map +0 -1
- package/dist/concurrency/session-key.d.ts +0 -41
- package/dist/concurrency/session-key.d.ts.map +0 -1
- package/dist/concurrency/session-key.js +0 -61
- package/dist/concurrency/session-key.js.map +0 -1
- package/dist/concurrency/types.d.ts +0 -73
- package/dist/concurrency/types.d.ts.map +0 -1
- package/dist/concurrency/types.js +0 -16
- package/dist/concurrency/types.js.map +0 -1
- package/dist/connectors/framework/raw-store.d.ts +0 -63
- package/dist/connectors/framework/raw-store.d.ts.map +0 -1
- package/dist/connectors/framework/raw-store.js +0 -356
- package/dist/connectors/framework/raw-store.js.map +0 -1
- package/dist/connectors/kagemusha/query-tools.d.ts +0 -146
- package/dist/connectors/kagemusha/query-tools.d.ts.map +0 -1
- package/dist/connectors/kagemusha/query-tools.js +0 -467
- package/dist/connectors/kagemusha/query-tools.js.map +0 -1
- package/dist/connectors/private-connector-policy.d.ts +0 -174
- package/dist/connectors/private-connector-policy.d.ts.map +0 -1
- package/dist/connectors/private-connector-policy.js +0 -299
- package/dist/connectors/private-connector-policy.js.map +0 -1
- package/dist/connectors/private-prompt-overlay.d.ts +0 -17
- package/dist/connectors/private-prompt-overlay.d.ts.map +0 -1
- package/dist/connectors/private-prompt-overlay.js +0 -156
- package/dist/connectors/private-prompt-overlay.js.map +0 -1
- package/dist/connectors/trello/query-tools.d.ts +0 -243
- package/dist/connectors/trello/query-tools.d.ts.map +0 -1
- package/dist/connectors/trello/query-tools.js +0 -661
- package/dist/connectors/trello/query-tools.js.map +0 -1
- package/dist/db/agent-store.d.ts +0 -145
- package/dist/db/agent-store.d.ts.map +0 -1
- package/dist/db/agent-store.js +0 -279
- package/dist/db/agent-store.js.map +0 -1
- package/dist/db/migrations/agent-activity-envelope-hash.d.ts +0 -3
- package/dist/db/migrations/agent-activity-envelope-hash.d.ts.map +0 -1
- package/dist/db/migrations/agent-activity-envelope-hash.js +0 -29
- package/dist/db/migrations/agent-activity-envelope-hash.js.map +0 -1
- package/dist/db/migrations/agent-activity-gateway-call-id.d.ts +0 -3
- package/dist/db/migrations/agent-activity-gateway-call-id.d.ts.map +0 -1
- package/dist/db/migrations/agent-activity-gateway-call-id.js +0 -17
- package/dist/db/migrations/agent-activity-gateway-call-id.js.map +0 -1
- package/dist/db/migrations/agent-activity-tool-name.d.ts +0 -8
- package/dist/db/migrations/agent-activity-tool-name.d.ts.map +0 -1
- package/dist/db/migrations/agent-activity-tool-name.js +0 -24
- package/dist/db/migrations/agent-activity-tool-name.js.map +0 -1
- package/dist/db/migrations/agent-activity-validation-columns.d.ts +0 -3
- package/dist/db/migrations/agent-activity-validation-columns.d.ts.map +0 -1
- package/dist/db/migrations/agent-activity-validation-columns.js +0 -22
- package/dist/db/migrations/agent-activity-validation-columns.js.map +0 -1
- package/dist/db/migrations/agent-metrics-response-avg.d.ts +0 -3
- package/dist/db/migrations/agent-metrics-response-avg.d.ts.map +0 -1
- package/dist/db/migrations/agent-metrics-response-avg.js +0 -19
- package/dist/db/migrations/agent-metrics-response-avg.js.map +0 -1
- package/dist/db/migrations/agent-store-tables.d.ts +0 -3
- package/dist/db/migrations/agent-store-tables.d.ts.map +0 -1
- package/dist/db/migrations/agent-store-tables.js +0 -64
- package/dist/db/migrations/agent-store-tables.js.map +0 -1
- package/dist/db/migrations/envelope-tables.d.ts +0 -3
- package/dist/db/migrations/envelope-tables.d.ts.map +0 -1
- package/dist/db/migrations/envelope-tables.js +0 -38
- package/dist/db/migrations/envelope-tables.js.map +0 -1
- package/dist/db/migrations/operator-owner-action-candidates.d.ts +0 -19
- package/dist/db/migrations/operator-owner-action-candidates.d.ts.map +0 -1
- package/dist/db/migrations/operator-owner-action-candidates.js +0 -254
- package/dist/db/migrations/operator-owner-action-candidates.js.map +0 -1
- package/dist/db/migrations/operator-procedures.d.ts +0 -4
- package/dist/db/migrations/operator-procedures.d.ts.map +0 -1
- package/dist/db/migrations/operator-procedures.js +0 -63
- package/dist/db/migrations/operator-procedures.js.map +0 -1
- package/dist/db/migrations/operator-task-classification.d.ts +0 -15
- package/dist/db/migrations/operator-task-classification.d.ts.map +0 -1
- package/dist/db/migrations/operator-task-classification.js +0 -25
- package/dist/db/migrations/operator-task-classification.js.map +0 -1
- package/dist/db/migrations/operator-task-external-lifecycle.d.ts +0 -17
- package/dist/db/migrations/operator-task-external-lifecycle.d.ts.map +0 -1
- package/dist/db/migrations/operator-task-external-lifecycle.js +0 -199
- package/dist/db/migrations/operator-task-external-lifecycle.js.map +0 -1
- package/dist/db/migrations/operator-task-review-lifecycle.d.ts +0 -4
- package/dist/db/migrations/operator-task-review-lifecycle.d.ts.map +0 -1
- package/dist/db/migrations/operator-task-review-lifecycle.js +0 -17
- package/dist/db/migrations/operator-task-review-lifecycle.js.map +0 -1
- package/dist/db/migrations/operator-task-temporal.d.ts +0 -8
- package/dist/db/migrations/operator-task-temporal.d.ts.map +0 -1
- package/dist/db/migrations/operator-task-temporal.js +0 -214
- package/dist/db/migrations/operator-task-temporal.js.map +0 -1
- package/dist/db/migrations/owner-action-effects.d.ts +0 -18
- package/dist/db/migrations/owner-action-effects.d.ts.map +0 -1
- package/dist/db/migrations/owner-action-effects.js +0 -111
- package/dist/db/migrations/owner-action-effects.js.map +0 -1
- package/dist/db/migrations/raw-item-revisions.d.ts +0 -4
- package/dist/db/migrations/raw-item-revisions.d.ts.map +0 -1
- package/dist/db/migrations/raw-item-revisions.js +0 -29
- package/dist/db/migrations/raw-item-revisions.js.map +0 -1
- package/dist/db/migrations/token-usage-agent-version.d.ts +0 -3
- package/dist/db/migrations/token-usage-agent-version.d.ts.map +0 -1
- package/dist/db/migrations/token-usage-agent-version.js +0 -16
- package/dist/db/migrations/token-usage-agent-version.js.map +0 -1
- package/dist/db/migrations/validation-session-tables.d.ts +0 -3
- package/dist/db/migrations/validation-session-tables.d.ts.map +0 -1
- package/dist/db/migrations/validation-session-tables.js +0 -59
- package/dist/db/migrations/validation-session-tables.js.map +0 -1
- package/dist/envelope/authority.d.ts +0 -15
- package/dist/envelope/authority.d.ts.map +0 -1
- package/dist/envelope/authority.js +0 -95
- package/dist/envelope/authority.js.map +0 -1
- package/dist/envelope/canonical.d.ts +0 -14
- package/dist/envelope/canonical.d.ts.map +0 -1
- package/dist/envelope/canonical.js +0 -68
- package/dist/envelope/canonical.js.map +0 -1
- package/dist/envelope/enforcer.d.ts +0 -30
- package/dist/envelope/enforcer.d.ts.map +0 -1
- package/dist/envelope/enforcer.js +0 -286
- package/dist/envelope/enforcer.js.map +0 -1
- package/dist/envelope/expiry.d.ts +0 -2
- package/dist/envelope/expiry.d.ts.map +0 -1
- package/dist/envelope/expiry.js +0 -15
- package/dist/envelope/expiry.js.map +0 -1
- package/dist/envelope/index.d.ts +0 -9
- package/dist/envelope/index.d.ts.map +0 -1
- package/dist/envelope/index.js +0 -25
- package/dist/envelope/index.js.map +0 -1
- package/dist/envelope/key-provider.d.ts +0 -7
- package/dist/envelope/key-provider.d.ts.map +0 -1
- package/dist/envelope/key-provider.js +0 -137
- package/dist/envelope/key-provider.js.map +0 -1
- package/dist/envelope/reactive-config.d.ts +0 -24
- package/dist/envelope/reactive-config.d.ts.map +0 -1
- package/dist/envelope/reactive-config.js +0 -198
- package/dist/envelope/reactive-config.js.map +0 -1
- package/dist/envelope/run-guard.d.ts +0 -10
- package/dist/envelope/run-guard.d.ts.map +0 -1
- package/dist/envelope/run-guard.js +0 -19
- package/dist/envelope/run-guard.js.map +0 -1
- package/dist/envelope/signature.d.ts +0 -15
- package/dist/envelope/signature.d.ts.map +0 -1
- package/dist/envelope/signature.js +0 -75
- package/dist/envelope/signature.js.map +0 -1
- package/dist/envelope/store.d.ts +0 -16
- package/dist/envelope/store.d.ts.map +0 -1
- package/dist/envelope/store.js +0 -118
- package/dist/envelope/store.js.map +0 -1
- package/dist/envelope/tool-connector-scope.d.ts +0 -35
- package/dist/envelope/tool-connector-scope.d.ts.map +0 -1
- package/dist/envelope/tool-connector-scope.js +0 -61
- package/dist/envelope/tool-connector-scope.js.map +0 -1
- package/dist/envelope/types.d.ts +0 -60
- package/dist/envelope/types.d.ts.map +0 -1
- package/dist/envelope/types.js +0 -9
- package/dist/envelope/types.js.map +0 -1
- package/dist/evidence/effects.d.ts +0 -125
- package/dist/evidence/effects.d.ts.map +0 -1
- package/dist/evidence/effects.js +0 -409
- package/dist/evidence/effects.js.map +0 -1
- package/dist/evidence/read.d.ts +0 -130
- package/dist/evidence/read.d.ts.map +0 -1
- package/dist/evidence/read.js +0 -167
- package/dist/evidence/read.js.map +0 -1
- package/dist/gateways/attachment-utils.d.ts +0 -28
- package/dist/gateways/attachment-utils.d.ts.map +0 -1
- package/dist/gateways/attachment-utils.js +0 -489
- package/dist/gateways/attachment-utils.js.map +0 -1
- package/dist/gateways/channel-history.d.ts +0 -148
- package/dist/gateways/channel-history.d.ts.map +0 -1
- package/dist/gateways/channel-history.js +0 -385
- package/dist/gateways/channel-history.js.map +0 -1
- package/dist/gateways/context-injector.d.ts +0 -255
- package/dist/gateways/context-injector.d.ts.map +0 -1
- package/dist/gateways/context-injector.js +0 -285
- package/dist/gateways/context-injector.js.map +0 -1
- package/dist/gateways/image-analyzer.d.ts +0 -28
- package/dist/gateways/image-analyzer.d.ts.map +0 -1
- package/dist/gateways/image-analyzer.js +0 -154
- package/dist/gateways/image-analyzer.js.map +0 -1
- package/dist/gateways/index.d.ts +0 -35
- package/dist/gateways/index.d.ts.map +0 -1
- package/dist/gateways/index.js +0 -55
- package/dist/gateways/index.js.map +0 -1
- package/dist/gateways/member-candidate-store.d.ts +0 -26
- package/dist/gateways/member-candidate-store.d.ts.map +0 -1
- package/dist/gateways/member-candidate-store.js +0 -90
- package/dist/gateways/member-candidate-store.js.map +0 -1
- package/dist/gateways/member-effective-scope.d.ts +0 -25
- package/dist/gateways/member-effective-scope.d.ts.map +0 -1
- package/dist/gateways/member-effective-scope.js +0 -323
- package/dist/gateways/member-effective-scope.js.map +0 -1
- package/dist/gateways/message-router.d.ts +0 -239
- package/dist/gateways/message-router.d.ts.map +0 -1
- package/dist/gateways/message-router.js +0 -1714
- package/dist/gateways/message-router.js.map +0 -1
- package/dist/gateways/plugin-loader.d.ts +0 -80
- package/dist/gateways/plugin-loader.d.ts.map +0 -1
- package/dist/gateways/plugin-loader.js +0 -299
- package/dist/gateways/plugin-loader.js.map +0 -1
- package/dist/gateways/principal.d.ts +0 -37
- package/dist/gateways/principal.d.ts.map +0 -1
- package/dist/gateways/principal.js +0 -95
- package/dist/gateways/principal.js.map +0 -1
- package/dist/gateways/report-projection-v1.d.ts +0 -41
- package/dist/gateways/report-projection-v1.d.ts.map +0 -1
- package/dist/gateways/report-projection-v1.js +0 -160
- package/dist/gateways/report-projection-v1.js.map +0 -1
- package/dist/gateways/telegram-media.d.ts +0 -41
- package/dist/gateways/telegram-media.d.ts.map +0 -1
- package/dist/gateways/telegram-media.js +0 -242
- package/dist/gateways/telegram-media.js.map +0 -1
- package/dist/gateways/telegram-report-context-store.d.ts +0 -131
- package/dist/gateways/telegram-report-context-store.d.ts.map +0 -1
- package/dist/gateways/telegram-report-context-store.js +0 -388
- package/dist/gateways/telegram-report-context-store.js.map +0 -1
- package/dist/gateways/tool-status-tracker.d.ts +0 -87
- package/dist/gateways/tool-status-tracker.d.ts.map +0 -1
- package/dist/gateways/tool-status-tracker.js +0 -284
- package/dist/gateways/tool-status-tracker.js.map +0 -1
- package/dist/mcp/code-act-api-client.d.ts +0 -32
- package/dist/mcp/code-act-api-client.d.ts.map +0 -1
- package/dist/mcp/code-act-api-client.js +0 -80
- package/dist/mcp/code-act-api-client.js.map +0 -1
- package/dist/mcp/code-act-mcp-config.d.ts +0 -49
- package/dist/mcp/code-act-mcp-config.d.ts.map +0 -1
- package/dist/mcp/code-act-mcp-config.js +0 -124
- package/dist/mcp/code-act-mcp-config.js.map +0 -1
- package/dist/mcp/code-act-server.d.ts +0 -14
- package/dist/mcp/code-act-server.d.ts.map +0 -1
- package/dist/mcp/code-act-server.js +0 -204
- package/dist/mcp/code-act-server.js.map +0 -1
- package/dist/mcp/code-act-terminal-transport.d.ts +0 -64
- package/dist/mcp/code-act-terminal-transport.d.ts.map +0 -1
- package/dist/mcp/code-act-terminal-transport.js +0 -176
- package/dist/mcp/code-act-terminal-transport.js.map +0 -1
- package/dist/memory/agent-notice-queue.d.ts +0 -24
- package/dist/memory/agent-notice-queue.d.ts.map +0 -1
- package/dist/memory/agent-notice-queue.js +0 -40
- package/dist/memory/agent-notice-queue.js.map +0 -1
- package/dist/memory/audit-task-queue.d.ts +0 -28
- package/dist/memory/audit-task-queue.d.ts.map +0 -1
- package/dist/memory/audit-task-queue.js +0 -29
- package/dist/memory/audit-task-queue.js.map +0 -1
- package/dist/memory/bootstrap-context.d.ts +0 -12
- package/dist/memory/bootstrap-context.d.ts.map +0 -1
- package/dist/memory/bootstrap-context.js +0 -68
- package/dist/memory/bootstrap-context.js.map +0 -1
- package/dist/memory/history-extractor.d.ts +0 -69
- package/dist/memory/history-extractor.d.ts.map +0 -1
- package/dist/memory/history-extractor.js +0 -210
- package/dist/memory/history-extractor.js.map +0 -1
- package/dist/memory/memory-agent-ack.d.ts +0 -4
- package/dist/memory/memory-agent-ack.d.ts.map +0 -1
- package/dist/memory/memory-agent-ack.js +0 -54
- package/dist/memory/memory-agent-ack.js.map +0 -1
- package/dist/memory/memory-agent-dashboard.d.ts +0 -35
- package/dist/memory/memory-agent-dashboard.d.ts.map +0 -1
- package/dist/memory/memory-agent-dashboard.js +0 -116
- package/dist/memory/memory-agent-dashboard.js.map +0 -1
- package/dist/memory/memory-logger.d.ts +0 -47
- package/dist/memory/memory-logger.d.ts.map +0 -1
- package/dist/memory/memory-logger.js +0 -126
- package/dist/memory/memory-logger.js.map +0 -1
- package/dist/memory/provenance-live.d.ts +0 -111
- package/dist/memory/provenance-live.d.ts.map +0 -1
- package/dist/memory/provenance-live.js +0 -381
- package/dist/memory/provenance-live.js.map +0 -1
- package/dist/memory/provenance-resolver.d.ts +0 -184
- package/dist/memory/provenance-resolver.d.ts.map +0 -1
- package/dist/memory/provenance-resolver.js +0 -152
- package/dist/memory/provenance-resolver.js.map +0 -1
- package/dist/memory/raw-backed-memory-ingest.d.ts +0 -26
- package/dist/memory/raw-backed-memory-ingest.d.ts.map +0 -1
- package/dist/memory/raw-backed-memory-ingest.js +0 -214
- package/dist/memory/raw-backed-memory-ingest.js.map +0 -1
- package/dist/memory/recall-bundle-formatter.d.ts +0 -26
- package/dist/memory/recall-bundle-formatter.d.ts.map +0 -1
- package/dist/memory/recall-bundle-formatter.js +0 -53
- package/dist/memory/recall-bundle-formatter.js.map +0 -1
- package/dist/memory/save-candidate-extractor.d.ts +0 -16
- package/dist/memory/save-candidate-extractor.d.ts.map +0 -1
- package/dist/memory/save-candidate-extractor.js +0 -127
- package/dist/memory/save-candidate-extractor.js.map +0 -1
- package/dist/memory/save-candidate-types.d.ts +0 -16
- package/dist/memory/save-candidate-types.d.ts.map +0 -1
- package/dist/memory/save-candidate-types.js +0 -3
- package/dist/memory/save-candidate-types.js.map +0 -1
- package/dist/memory/scope-context.d.ts +0 -12
- package/dist/memory/scope-context.d.ts.map +0 -1
- package/dist/memory/scope-context.js +0 -18
- package/dist/memory/scope-context.js.map +0 -1
- package/dist/memory/secret-filter.d.ts +0 -23
- package/dist/memory/secret-filter.d.ts.map +0 -1
- package/dist/memory/secret-filter.js +0 -90
- package/dist/memory/secret-filter.js.map +0 -1
- package/dist/multi-agent/agent-event-bus.d.ts +0 -50
- package/dist/multi-agent/agent-event-bus.d.ts.map +0 -1
- package/dist/multi-agent/agent-event-bus.js +0 -101
- package/dist/multi-agent/agent-event-bus.js.map +0 -1
- package/dist/multi-agent/agent-process-manager.d.ts +0 -205
- package/dist/multi-agent/agent-process-manager.d.ts.map +0 -1
- package/dist/multi-agent/agent-process-manager.js +0 -1191
- package/dist/multi-agent/agent-process-manager.js.map +0 -1
- package/dist/multi-agent/bmad-templates.d.ts +0 -49
- package/dist/multi-agent/bmad-templates.d.ts.map +0 -1
- package/dist/multi-agent/bmad-templates.js +0 -121
- package/dist/multi-agent/bmad-templates.js.map +0 -1
- package/dist/multi-agent/runtime-process.d.ts +0 -74
- package/dist/multi-agent/runtime-process.d.ts.map +0 -1
- package/dist/multi-agent/runtime-process.js +0 -160
- package/dist/multi-agent/runtime-process.js.map +0 -1
- package/dist/multi-agent/tool-permission-manager.d.ts +0 -70
- package/dist/multi-agent/tool-permission-manager.d.ts.map +0 -1
- package/dist/multi-agent/tool-permission-manager.js +0 -195
- package/dist/multi-agent/tool-permission-manager.js.map +0 -1
- package/dist/multi-agent/types.d.ts +0 -438
- package/dist/multi-agent/types.d.ts.map +0 -1
- package/dist/multi-agent/types.js +0 -27
- package/dist/multi-agent/types.js.map +0 -1
- package/dist/multi-agent/wiki-agent-persona.d.ts +0 -16
- package/dist/multi-agent/wiki-agent-persona.d.ts.map +0 -1
- package/dist/multi-agent/wiki-agent-persona.js +0 -23
- package/dist/multi-agent/wiki-agent-persona.js.map +0 -1
- package/dist/multi-agent/workflow-types.d.ts +0 -186
- package/dist/multi-agent/workflow-types.d.ts.map +0 -1
- package/dist/multi-agent/workflow-types.js +0 -9
- package/dist/multi-agent/workflow-types.js.map +0 -1
- package/dist/observability/code-audit.d.ts +0 -87
- package/dist/observability/code-audit.d.ts.map +0 -1
- package/dist/observability/code-audit.js +0 -414
- package/dist/observability/code-audit.js.map +0 -1
- package/dist/observability/health-check.d.ts +0 -102
- package/dist/observability/health-check.d.ts.map +0 -1
- package/dist/observability/health-check.js +0 -422
- package/dist/observability/health-check.js.map +0 -1
- package/dist/observability/health-score.d.ts +0 -29
- package/dist/observability/health-score.d.ts.map +0 -1
- package/dist/observability/health-score.js +0 -83
- package/dist/observability/health-score.js.map +0 -1
- package/dist/observability/metrics-cleanup.d.ts +0 -24
- package/dist/observability/metrics-cleanup.d.ts.map +0 -1
- package/dist/observability/metrics-cleanup.js +0 -51
- package/dist/observability/metrics-cleanup.js.map +0 -1
- package/dist/observability/metrics-store.d.ts +0 -52
- package/dist/observability/metrics-store.d.ts.map +0 -1
- package/dist/observability/metrics-store.js +0 -186
- package/dist/observability/metrics-store.js.map +0 -1
- package/dist/observability/operational-issues.d.ts +0 -55
- package/dist/observability/operational-issues.d.ts.map +0 -1
- package/dist/observability/operational-issues.js +0 -170
- package/dist/observability/operational-issues.js.map +0 -1
- package/dist/onboarding/agent-contract.d.ts +0 -42
- package/dist/onboarding/agent-contract.d.ts.map +0 -1
- package/dist/onboarding/agent-contract.js +0 -129
- package/dist/onboarding/agent-contract.js.map +0 -1
- package/dist/onboarding/assess-live.d.ts +0 -22
- package/dist/onboarding/assess-live.d.ts.map +0 -1
- package/dist/onboarding/assess-live.js +0 -200
- package/dist/onboarding/assess-live.js.map +0 -1
- package/dist/onboarding/bootstrap-template.d.ts +0 -5
- package/dist/onboarding/bootstrap-template.d.ts.map +0 -1
- package/dist/onboarding/bootstrap-template.js +0 -34
- package/dist/onboarding/bootstrap-template.js.map +0 -1
- package/dist/operator/action-verifier.d.ts +0 -75
- package/dist/operator/action-verifier.d.ts.map +0 -1
- package/dist/operator/action-verifier.js +0 -149
- package/dist/operator/action-verifier.js.map +0 -1
- package/dist/operator/board-delta-gate.d.ts +0 -131
- package/dist/operator/board-delta-gate.d.ts.map +0 -1
- package/dist/operator/board-delta-gate.js +0 -181
- package/dist/operator/board-delta-gate.js.map +0 -1
- package/dist/operator/board-pipeline-render.d.ts +0 -16
- package/dist/operator/board-pipeline-render.d.ts.map +0 -1
- package/dist/operator/board-pipeline-render.js +0 -69
- package/dist/operator/board-pipeline-render.js.map +0 -1
- package/dist/operator/board-reconcile.d.ts +0 -61
- package/dist/operator/board-reconcile.d.ts.map +0 -1
- package/dist/operator/board-reconcile.js +0 -157
- package/dist/operator/board-reconcile.js.map +0 -1
- package/dist/operator/board-refresh-gate.d.ts +0 -39
- package/dist/operator/board-refresh-gate.d.ts.map +0 -1
- package/dist/operator/board-refresh-gate.js +0 -83
- package/dist/operator/board-refresh-gate.js.map +0 -1
- package/dist/operator/changes-projection.d.ts +0 -72
- package/dist/operator/changes-projection.d.ts.map +0 -1
- package/dist/operator/changes-projection.js +0 -110
- package/dist/operator/changes-projection.js.map +0 -1
- package/dist/operator/connector-delta-repo.d.ts +0 -33
- package/dist/operator/connector-delta-repo.d.ts.map +0 -1
- package/dist/operator/connector-delta-repo.js +0 -0
- package/dist/operator/connector-delta-repo.js.map +0 -1
- package/dist/operator/console-brief.d.ts +0 -40
- package/dist/operator/console-brief.d.ts.map +0 -1
- package/dist/operator/console-brief.js +0 -246
- package/dist/operator/console-brief.js.map +0 -1
- package/dist/operator/experience-evidence.d.ts +0 -18
- package/dist/operator/experience-evidence.d.ts.map +0 -1
- package/dist/operator/experience-evidence.js +0 -82
- package/dist/operator/experience-evidence.js.map +0 -1
- package/dist/operator/experience-hints.d.ts +0 -44
- package/dist/operator/experience-hints.d.ts.map +0 -1
- package/dist/operator/experience-hints.js +0 -98
- package/dist/operator/experience-hints.js.map +0 -1
- package/dist/operator/external-correlation.d.ts +0 -94
- package/dist/operator/external-correlation.d.ts.map +0 -1
- package/dist/operator/external-correlation.js +0 -177
- package/dist/operator/external-correlation.js.map +0 -1
- package/dist/operator/external-lifecycle-candidates.d.ts +0 -70
- package/dist/operator/external-lifecycle-candidates.d.ts.map +0 -1
- package/dist/operator/external-lifecycle-candidates.js +0 -579
- package/dist/operator/external-lifecycle-candidates.js.map +0 -1
- package/dist/operator/external-lifecycle-discovery.d.ts +0 -61
- package/dist/operator/external-lifecycle-discovery.d.ts.map +0 -1
- package/dist/operator/external-lifecycle-discovery.js +0 -103
- package/dist/operator/external-lifecycle-discovery.js.map +0 -1
- package/dist/operator/external-lifecycle.d.ts +0 -105
- package/dist/operator/external-lifecycle.d.ts.map +0 -1
- package/dist/operator/external-lifecycle.js +0 -27
- package/dist/operator/external-lifecycle.js.map +0 -1
- package/dist/operator/file-coordination.d.ts +0 -7
- package/dist/operator/file-coordination.d.ts.map +0 -1
- package/dist/operator/file-coordination.js +0 -84
- package/dist/operator/file-coordination.js.map +0 -1
- package/dist/operator/file-export.d.ts +0 -22
- package/dist/operator/file-export.d.ts.map +0 -1
- package/dist/operator/file-export.js +0 -115
- package/dist/operator/file-export.js.map +0 -1
- package/dist/operator/leg-cadence.d.ts +0 -72
- package/dist/operator/leg-cadence.d.ts.map +0 -1
- package/dist/operator/leg-cadence.js +0 -122
- package/dist/operator/leg-cadence.js.map +0 -1
- package/dist/operator/mama-memory-port.d.ts +0 -13
- package/dist/operator/mama-memory-port.d.ts.map +0 -1
- package/dist/operator/mama-memory-port.js +0 -33
- package/dist/operator/mama-memory-port.js.map +0 -1
- package/dist/operator/operator-interfaces.d.ts +0 -136
- package/dist/operator/operator-interfaces.d.ts.map +0 -1
- package/dist/operator/operator-interfaces.js +0 -15
- package/dist/operator/operator-interfaces.js.map +0 -1
- package/dist/operator/operator-trigger-loop.d.ts +0 -203
- package/dist/operator/operator-trigger-loop.d.ts.map +0 -1
- package/dist/operator/operator-trigger-loop.js +0 -827
- package/dist/operator/operator-trigger-loop.js.map +0 -1
- package/dist/operator/owner-action-effects.d.ts +0 -112
- package/dist/operator/owner-action-effects.d.ts.map +0 -1
- package/dist/operator/owner-action-effects.js +0 -375
- package/dist/operator/owner-action-effects.js.map +0 -1
- package/dist/operator/owner-event-effects.d.ts +0 -65
- package/dist/operator/owner-event-effects.d.ts.map +0 -1
- package/dist/operator/owner-event-effects.js +0 -249
- package/dist/operator/owner-event-effects.js.map +0 -1
- package/dist/operator/owner-event-inbox.d.ts +0 -124
- package/dist/operator/owner-event-inbox.d.ts.map +0 -1
- package/dist/operator/owner-event-inbox.js +0 -440
- package/dist/operator/owner-event-inbox.js.map +0 -1
- package/dist/operator/owner-event-loop.d.ts +0 -99
- package/dist/operator/owner-event-loop.d.ts.map +0 -1
- package/dist/operator/owner-event-loop.js +0 -253
- package/dist/operator/owner-event-loop.js.map +0 -1
- package/dist/operator/owner-event-outcome.d.ts +0 -36
- package/dist/operator/owner-event-outcome.d.ts.map +0 -1
- package/dist/operator/owner-event-outcome.js +0 -174
- package/dist/operator/owner-event-outcome.js.map +0 -1
- package/dist/operator/owner-event-policy.d.ts +0 -40
- package/dist/operator/owner-event-policy.d.ts.map +0 -1
- package/dist/operator/owner-event-policy.js +0 -75
- package/dist/operator/owner-event-policy.js.map +0 -1
- package/dist/operator/owner-event-prompt.d.ts +0 -21
- package/dist/operator/owner-event-prompt.d.ts.map +0 -1
- package/dist/operator/owner-event-prompt.js +0 -69
- package/dist/operator/owner-event-prompt.js.map +0 -1
- package/dist/operator/owner-runtime-journal.d.ts +0 -21
- package/dist/operator/owner-runtime-journal.d.ts.map +0 -1
- package/dist/operator/owner-runtime-journal.js +0 -135
- package/dist/operator/owner-runtime-journal.js.map +0 -1
- package/dist/operator/owner-runtime.d.ts +0 -48
- package/dist/operator/owner-runtime.d.ts.map +0 -1
- package/dist/operator/owner-runtime.js +0 -99
- package/dist/operator/owner-runtime.js.map +0 -1
- package/dist/operator/pending-report-store.d.ts +0 -99
- package/dist/operator/pending-report-store.d.ts.map +0 -1
- package/dist/operator/pending-report-store.js +0 -554
- package/dist/operator/pending-report-store.js.map +0 -1
- package/dist/operator/procedure-activation.d.ts +0 -7
- package/dist/operator/procedure-activation.d.ts.map +0 -1
- package/dist/operator/procedure-activation.js +0 -132
- package/dist/operator/procedure-activation.js.map +0 -1
- package/dist/operator/procedure-projection.d.ts +0 -25
- package/dist/operator/procedure-projection.d.ts.map +0 -1
- package/dist/operator/procedure-projection.js +0 -80
- package/dist/operator/procedure-projection.js.map +0 -1
- package/dist/operator/procedure-runtime.d.ts +0 -45
- package/dist/operator/procedure-runtime.d.ts.map +0 -1
- package/dist/operator/procedure-runtime.js +0 -496
- package/dist/operator/procedure-runtime.js.map +0 -1
- package/dist/operator/procedure-store.d.ts +0 -97
- package/dist/operator/procedure-store.d.ts.map +0 -1
- package/dist/operator/procedure-store.js +0 -368
- package/dist/operator/procedure-store.js.map +0 -1
- package/dist/operator/provenance-lookup.d.ts +0 -18
- package/dist/operator/provenance-lookup.d.ts.map +0 -1
- package/dist/operator/provenance-lookup.js +0 -54
- package/dist/operator/provenance-lookup.js.map +0 -1
- package/dist/operator/repair-request.d.ts +0 -29
- package/dist/operator/repair-request.d.ts.map +0 -1
- package/dist/operator/repair-request.js +0 -115
- package/dist/operator/repair-request.js.map +0 -1
- package/dist/operator/report-carry-delivery.d.ts +0 -35
- package/dist/operator/report-carry-delivery.d.ts.map +0 -1
- package/dist/operator/report-carry-delivery.js +0 -55
- package/dist/operator/report-carry-delivery.js.map +0 -1
- package/dist/operator/report-carry.d.ts +0 -66
- package/dist/operator/report-carry.d.ts.map +0 -1
- package/dist/operator/report-carry.js +0 -352
- package/dist/operator/report-carry.js.map +0 -1
- package/dist/operator/report-delivery-coordinator.d.ts +0 -84
- package/dist/operator/report-delivery-coordinator.d.ts.map +0 -1
- package/dist/operator/report-delivery-coordinator.js +0 -146
- package/dist/operator/report-delivery-coordinator.js.map +0 -1
- package/dist/operator/report-run.d.ts +0 -52
- package/dist/operator/report-run.d.ts.map +0 -1
- package/dist/operator/report-run.js +0 -32
- package/dist/operator/report-run.js.map +0 -1
- package/dist/operator/report-scheduler.d.ts +0 -66
- package/dist/operator/report-scheduler.d.ts.map +0 -1
- package/dist/operator/report-scheduler.js +0 -135
- package/dist/operator/report-scheduler.js.map +0 -1
- package/dist/operator/runtime-config.d.ts +0 -10
- package/dist/operator/runtime-config.d.ts.map +0 -1
- package/dist/operator/runtime-config.js +0 -21
- package/dist/operator/runtime-config.js.map +0 -1
- package/dist/operator/situation-report.d.ts +0 -197
- package/dist/operator/situation-report.d.ts.map +0 -1
- package/dist/operator/situation-report.js +0 -462
- package/dist/operator/situation-report.js.map +0 -1
- package/dist/operator/subagent-stimulus.d.ts +0 -34
- package/dist/operator/subagent-stimulus.d.ts.map +0 -1
- package/dist/operator/subagent-stimulus.js +0 -145
- package/dist/operator/subagent-stimulus.js.map +0 -1
- package/dist/operator/task-ledger.d.ts +0 -879
- package/dist/operator/task-ledger.d.ts.map +0 -1
- package/dist/operator/task-ledger.js +0 -3601
- package/dist/operator/task-ledger.js.map +0 -1
- package/dist/operator/task-list-views.d.ts +0 -91
- package/dist/operator/task-list-views.d.ts.map +0 -1
- package/dist/operator/task-list-views.js +0 -532
- package/dist/operator/task-list-views.js.map +0 -1
- package/dist/operator/task-temporal.d.ts +0 -24
- package/dist/operator/task-temporal.d.ts.map +0 -1
- package/dist/operator/task-temporal.js +0 -123
- package/dist/operator/task-temporal.js.map +0 -1
- package/dist/operator/temporal-effect.d.ts +0 -65
- package/dist/operator/temporal-effect.d.ts.map +0 -1
- package/dist/operator/temporal-effect.js +0 -71
- package/dist/operator/temporal-effect.js.map +0 -1
- package/dist/operator/temporal-reconcile.d.ts +0 -49
- package/dist/operator/temporal-reconcile.d.ts.map +0 -1
- package/dist/operator/temporal-reconcile.js +0 -231
- package/dist/operator/temporal-reconcile.js.map +0 -1
- package/dist/operator/temporal-runtime.d.ts +0 -51
- package/dist/operator/temporal-runtime.d.ts.map +0 -1
- package/dist/operator/temporal-runtime.js +0 -104
- package/dist/operator/temporal-runtime.js.map +0 -1
- package/dist/operator/temporal-worker.d.ts +0 -18
- package/dist/operator/temporal-worker.d.ts.map +0 -1
- package/dist/operator/temporal-worker.js +0 -82
- package/dist/operator/temporal-worker.js.map +0 -1
- package/dist/operator/thread-brief-memory.d.ts +0 -29
- package/dist/operator/thread-brief-memory.d.ts.map +0 -1
- package/dist/operator/thread-brief-memory.js +0 -61
- package/dist/operator/thread-brief-memory.js.map +0 -1
- package/dist/operator/trigger-author.d.ts +0 -63
- package/dist/operator/trigger-author.d.ts.map +0 -1
- package/dist/operator/trigger-author.js +0 -384
- package/dist/operator/trigger-author.js.map +0 -1
- package/dist/operator/trigger-evolve.d.ts +0 -31
- package/dist/operator/trigger-evolve.d.ts.map +0 -1
- package/dist/operator/trigger-evolve.js +0 -51
- package/dist/operator/trigger-evolve.js.map +0 -1
- package/dist/operator/trigger-fire.d.ts +0 -29
- package/dist/operator/trigger-fire.d.ts.map +0 -1
- package/dist/operator/trigger-fire.js +0 -41
- package/dist/operator/trigger-fire.js.map +0 -1
- package/dist/operator/trigger-matcher.d.ts +0 -19
- package/dist/operator/trigger-matcher.d.ts.map +0 -1
- package/dist/operator/trigger-matcher.js +0 -65
- package/dist/operator/trigger-matcher.js.map +0 -1
- package/dist/operator/trigger-registry.d.ts +0 -58
- package/dist/operator/trigger-registry.d.ts.map +0 -1
- package/dist/operator/trigger-registry.js +0 -349
- package/dist/operator/trigger-registry.js.map +0 -1
- package/dist/operator/trigger-review.d.ts +0 -23
- package/dist/operator/trigger-review.d.ts.map +0 -1
- package/dist/operator/trigger-review.js +0 -193
- package/dist/operator/trigger-review.js.map +0 -1
- package/dist/operator/trigger-types.d.ts +0 -95
- package/dist/operator/trigger-types.d.ts.map +0 -1
- package/dist/operator/trigger-types.js +0 -14
- package/dist/operator/trigger-types.js.map +0 -1
- package/dist/operator/wiki-continuity.d.ts +0 -153
- package/dist/operator/wiki-continuity.d.ts.map +0 -1
- package/dist/operator/wiki-continuity.js +0 -221
- package/dist/operator/wiki-continuity.js.map +0 -1
- package/dist/operator/worker-run.d.ts +0 -109
- package/dist/operator/worker-run.d.ts.map +0 -1
- package/dist/operator/worker-run.js +0 -131
- package/dist/operator/worker-run.js.map +0 -1
- package/dist/operator/workorder-consumer.d.ts +0 -294
- package/dist/operator/workorder-consumer.d.ts.map +0 -1
- package/dist/operator/workorder-consumer.js +0 -1108
- package/dist/operator/workorder-consumer.js.map +0 -1
- package/dist/operator/workorder-hooks.d.ts +0 -162
- package/dist/operator/workorder-hooks.d.ts.map +0 -1
- package/dist/operator/workorder-hooks.js +0 -342
- package/dist/operator/workorder-hooks.js.map +0 -1
- package/dist/operator/workorder-publishers.d.ts +0 -117
- package/dist/operator/workorder-publishers.d.ts.map +0 -1
- package/dist/operator/workorder-publishers.js +0 -544
- package/dist/operator/workorder-publishers.js.map +0 -1
- package/dist/runners/cli-runner.d.ts +0 -59
- package/dist/runners/cli-runner.d.ts.map +0 -1
- package/dist/runners/cli-runner.js +0 -191
- package/dist/runners/cli-runner.js.map +0 -1
- package/dist/runners/index.d.ts +0 -11
- package/dist/runners/index.d.ts.map +0 -1
- package/dist/runners/index.js +0 -15
- package/dist/runners/index.js.map +0 -1
- package/dist/runners/types.d.ts +0 -81
- package/dist/runners/types.d.ts.map +0 -1
- package/dist/runners/types.js +0 -31
- package/dist/runners/types.js.map +0 -1
- package/dist/scheduler/cron-result-router.d.ts +0 -24
- package/dist/scheduler/cron-result-router.d.ts.map +0 -1
- package/dist/scheduler/cron-result-router.js +0 -63
- package/dist/scheduler/cron-result-router.js.map +0 -1
- package/dist/scheduler/cron-scheduler.d.ts +0 -115
- package/dist/scheduler/cron-scheduler.d.ts.map +0 -1
- package/dist/scheduler/cron-scheduler.js +0 -336
- package/dist/scheduler/cron-scheduler.js.map +0 -1
- package/dist/scheduler/cron-worker.d.ts +0 -39
- package/dist/scheduler/cron-worker.d.ts.map +0 -1
- package/dist/scheduler/cron-worker.js +0 -94
- package/dist/scheduler/cron-worker.js.map +0 -1
- package/dist/scheduler/heartbeat.d.ts +0 -64
- package/dist/scheduler/heartbeat.d.ts.map +0 -1
- package/dist/scheduler/heartbeat.js +0 -197
- package/dist/scheduler/heartbeat.js.map +0 -1
- package/dist/scheduler/index.d.ts +0 -26
- package/dist/scheduler/index.d.ts.map +0 -1
- package/dist/scheduler/index.js +0 -37
- package/dist/scheduler/index.js.map +0 -1
- package/dist/scheduler/job-lock.d.ts +0 -85
- package/dist/scheduler/job-lock.d.ts.map +0 -1
- package/dist/scheduler/job-lock.js +0 -137
- package/dist/scheduler/job-lock.js.map +0 -1
- package/dist/scheduler/recovery.d.ts +0 -78
- package/dist/scheduler/recovery.d.ts.map +0 -1
- package/dist/scheduler/recovery.js +0 -124
- package/dist/scheduler/recovery.js.map +0 -1
- package/dist/scheduler/schedule-store.d.ts +0 -112
- package/dist/scheduler/schedule-store.d.ts.map +0 -1
- package/dist/scheduler/schedule-store.js +0 -259
- package/dist/scheduler/schedule-store.js.map +0 -1
- package/dist/scheduler/token-keep-alive.d.ts +0 -49
- package/dist/scheduler/token-keep-alive.d.ts.map +0 -1
- package/dist/scheduler/token-keep-alive.js +0 -102
- package/dist/scheduler/token-keep-alive.js.map +0 -1
- package/dist/scheduler/types.d.ts +0 -98
- package/dist/scheduler/types.d.ts.map +0 -1
- package/dist/scheduler/types.js +0 -21
- package/dist/scheduler/types.js.map +0 -1
- package/dist/security/security-monitor.d.ts +0 -56
- package/dist/security/security-monitor.d.ts.map +0 -1
- package/dist/security/security-monitor.js +0 -779
- package/dist/security/security-monitor.js.map +0 -1
- package/dist/security/trusted-proxy.d.ts +0 -9
- package/dist/security/trusted-proxy.d.ts.map +0 -1
- package/dist/security/trusted-proxy.js +0 -36
- package/dist/security/trusted-proxy.js.map +0 -1
- package/dist/skills/index.d.ts +0 -10
- package/dist/skills/index.d.ts.map +0 -1
- package/dist/skills/index.js +0 -26
- package/dist/skills/index.js.map +0 -1
- package/dist/skills/skill-executor.d.ts +0 -48
- package/dist/skills/skill-executor.d.ts.map +0 -1
- package/dist/skills/skill-executor.js +0 -483
- package/dist/skills/skill-executor.js.map +0 -1
- package/dist/skills/skill-loader.d.ts +0 -40
- package/dist/skills/skill-loader.d.ts.map +0 -1
- package/dist/skills/skill-loader.js +0 -233
- package/dist/skills/skill-loader.js.map +0 -1
- package/dist/skills/skill-matcher.d.ts +0 -33
- package/dist/skills/skill-matcher.d.ts.map +0 -1
- package/dist/skills/skill-matcher.js +0 -190
- package/dist/skills/skill-matcher.js.map +0 -1
- package/dist/skills/skill-registry.d.ts +0 -117
- package/dist/skills/skill-registry.d.ts.map +0 -1
- package/dist/skills/skill-registry.js +0 -627
- package/dist/skills/skill-registry.js.map +0 -1
- package/dist/skills/types.d.ts +0 -131
- package/dist/skills/types.d.ts.map +0 -1
- package/dist/skills/types.js +0 -12
- package/dist/skills/types.js.map +0 -1
- package/dist/utils/log-sanitizer.d.ts +0 -79
- package/dist/utils/log-sanitizer.d.ts.map +0 -1
- package/dist/utils/log-sanitizer.js +0 -215
- package/dist/utils/log-sanitizer.js.map +0 -1
- package/dist/validation/session-service.d.ts +0 -72
- package/dist/validation/session-service.d.ts.map +0 -1
- package/dist/validation/session-service.js +0 -298
- package/dist/validation/session-service.js.map +0 -1
- package/dist/validation/store.d.ts +0 -25
- package/dist/validation/store.d.ts.map +0 -1
- package/dist/validation/store.js +0 -200
- package/dist/validation/store.js.map +0 -1
- package/dist/validation/types.d.ts +0 -119
- package/dist/validation/types.d.ts.map +0 -1
- package/dist/validation/types.js +0 -57
- package/dist/validation/types.js.map +0 -1
- package/dist/wiki/wiki-turn-contract.d.ts +0 -19
- package/dist/wiki/wiki-turn-contract.d.ts.map +0 -1
- package/dist/wiki/wiki-turn-contract.js +0 -60
- package/dist/wiki/wiki-turn-contract.js.map +0 -1
- package/public/viewer/js/utils/ui-commands.js +0 -88
- package/public/viewer/src/utils/ui-commands.ts +0 -114
- package/scripts/attachment/extract-office-text.js +0 -179
- package/scripts/attachment/extract-pdf-text.swift +0 -36
- package/scripts/backfill-channel-keys.ts +0 -509
- package/scripts/crack-failure-digests.ts +0 -55
- package/scripts/generate-gateway-tools.ts +0 -131
- package/scripts/image/fb-overlay.py +0 -128
- package/scripts/image/ocr-image.py +0 -38
- package/scripts/postinstall.js +0 -161
- package/scripts/setup-ocr.js +0 -120
- package/templates/AGENTS.claude.md +0 -23
- package/templates/AGENTS.codex.md +0 -11
- package/templates/bmad/LICENSE +0 -28
- package/templates/bmad/architecture.md +0 -343
- package/templates/bmad/bmm-workflow-status.template.yaml +0 -66
- package/templates/bmad/prd.md +0 -198
- package/templates/bmad/product-brief.md +0 -149
- package/templates/bmad/sprint-status.template.yaml +0 -35
- package/templates/bmad/tech-spec.md +0 -151
- package/templates/entity-audit-fixtures/cross-language-aliases.json +0 -28
- package/templates/entity-audit-fixtures/gold-canonical-identities.json +0 -46
- package/templates/skills/danggeun-monitor.md +0 -88
- package/templates/skills/document-analyze.md +0 -63
- package/templates/skills/frontend-design.md +0 -71
- package/templates/skills/image-translate.md +0 -62
- package/templates/skills/multi-agent-collab.md +0 -145
- package/templates/skills/scheduling.md +0 -107
- package/templates/workspace/skill-forge/DESIGN.md +0 -115
- package/templates/workspace/skill-forge/agents/architect.ts +0 -295
- package/templates/workspace/skill-forge/agents/developer.ts +0 -364
- package/templates/workspace/skill-forge/agents/qa.ts +0 -313
- package/templates/workspace/skill-forge/claude-api.ts +0 -353
- package/templates/workspace/skill-forge/discord-ui.ts +0 -580
- package/templates/workspace/skill-forge/error-handler.ts +0 -354
- package/templates/workspace/skill-forge/mama-integration.ts +0 -357
- package/templates/workspace/skill-forge/orchestrator.ts +0 -495
- package/templates/workspace/skill-forge/output/generated-skills/skills/hello-world/README.md +0 -24
- package/templates/workspace/skill-forge/output/generated-skills/skills/hello-world/index.ts +0 -79
- package/templates/workspace/skill-forge/output/generated-skills/skills/hello-world/types.ts +0 -17
- package/templates/workspace/skill-forge/package.json +0 -21
- package/templates/workspace/skill-forge/state/session.json +0 -132
- package/templates/workspace/skill-forge/test-e2e.ts +0 -139
- package/templates/workspace/skill-forge/tsconfig.json +0 -20
- package/templates/workspace/skill-forge/types.ts +0 -159
|
@@ -1,1542 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* API route registration.
|
|
4
|
-
*
|
|
5
|
-
* Extracted from start.ts (Task 11 Part B).
|
|
6
|
-
* Registers ALL REST endpoints, middleware, static file serving,
|
|
7
|
-
* and wires Dashboard + Wiki agents via AgentProcessManager.
|
|
8
|
-
*/
|
|
9
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
12
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
13
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
14
|
-
}
|
|
15
|
-
Object.defineProperty(o, k2, desc);
|
|
16
|
-
}) : (function(o, m, k, k2) {
|
|
17
|
-
if (k2 === undefined) k2 = k;
|
|
18
|
-
o[k2] = m[k];
|
|
19
|
-
}));
|
|
20
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
21
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
22
|
-
}) : function(o, v) {
|
|
23
|
-
o["default"] = v;
|
|
24
|
-
});
|
|
25
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
26
|
-
var ownKeys = function(o) {
|
|
27
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
28
|
-
var ar = [];
|
|
29
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
30
|
-
return ar;
|
|
31
|
-
};
|
|
32
|
-
return ownKeys(o);
|
|
33
|
-
};
|
|
34
|
-
return function (mod) {
|
|
35
|
-
if (mod && mod.__esModule) return mod;
|
|
36
|
-
var result = {};
|
|
37
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
38
|
-
__setModuleDefault(result, mod);
|
|
39
|
-
return result;
|
|
40
|
-
};
|
|
41
|
-
})();
|
|
42
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
43
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
44
|
-
};
|
|
45
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
46
|
-
exports.buildReconcileExternalLifecycleCandidates = void 0;
|
|
47
|
-
exports.registerKagemushaTaskRoute = registerKagemushaTaskRoute;
|
|
48
|
-
exports.registerApiRoutes = registerApiRoutes;
|
|
49
|
-
const node_fs_1 = require("node:fs");
|
|
50
|
-
const node_os_1 = require("node:os");
|
|
51
|
-
const express_1 = __importDefault(require("express"));
|
|
52
|
-
const node_path_1 = __importDefault(require("node:path"));
|
|
53
|
-
const node_http_1 = __importDefault(require("node:http"));
|
|
54
|
-
const agent_store_js_1 = require("../../db/agent-store.js");
|
|
55
|
-
const memory_agent_dashboard_js_1 = require("../../memory/memory-agent-dashboard.js");
|
|
56
|
-
const upload_handler_js_1 = require("../../api/upload-handler.js");
|
|
57
|
-
const operator_tasks_handler_js_1 = require("../../api/operator-tasks-handler.js");
|
|
58
|
-
const auth_middleware_js_1 = require("../../api/auth-middleware.js");
|
|
59
|
-
const utilities_js_1 = require("./utilities.js");
|
|
60
|
-
const code_act_mcp_config_js_1 = require("../../mcp/code-act-mcp-config.js");
|
|
61
|
-
const code_audit_js_1 = require("../../observability/code-audit.js");
|
|
62
|
-
const workorder_publishers_js_1 = require("../../operator/workorder-publishers.js");
|
|
63
|
-
const workorder_hooks_js_1 = require("../../operator/workorder-hooks.js");
|
|
64
|
-
const board_delta_gate_js_1 = require("../../operator/board-delta-gate.js");
|
|
65
|
-
const wiki_continuity_js_1 = require("../../operator/wiki-continuity.js");
|
|
66
|
-
const external_lifecycle_discovery_js_1 = require("../../operator/external-lifecycle-discovery.js");
|
|
67
|
-
Object.defineProperty(exports, "buildReconcileExternalLifecycleCandidates", { enumerable: true, get: function () { return external_lifecycle_discovery_js_1.buildReconcileExternalLifecycleCandidates; } });
|
|
68
|
-
const security_monitor_js_1 = require("../../security/security-monitor.js");
|
|
69
|
-
const debugLogger = __importStar(require("@jungjaehoon/mama-core/debug-logger"));
|
|
70
|
-
const leg_cadence_js_1 = require("../../operator/leg-cadence.js");
|
|
71
|
-
const { DebugLogger } = debugLogger;
|
|
72
|
-
const routesLogger = new DebugLogger('api-routes');
|
|
73
|
-
const HOST_MANUAL_FULL_REPAIR_CHANNEL = 'host:api-report-agent-refresh';
|
|
74
|
-
function queryString(value) {
|
|
75
|
-
return typeof value === 'string' ? value : undefined;
|
|
76
|
-
}
|
|
77
|
-
function queryLimit(value) {
|
|
78
|
-
if (typeof value !== 'string') {
|
|
79
|
-
return 30;
|
|
80
|
-
}
|
|
81
|
-
const limit = Number(value);
|
|
82
|
-
return Number.isFinite(limit) ? limit : 30;
|
|
83
|
-
}
|
|
84
|
-
function registerKagemushaTaskRoute(app, policy, loadQuery = async () => (await import('../../connectors/kagemusha/query-tools.js')).queryTasks) {
|
|
85
|
-
if (!policy.isEnabled('kagemusha')) {
|
|
86
|
-
return;
|
|
87
|
-
}
|
|
88
|
-
app.get('/api/kagemusha/tasks', auth_middleware_js_1.requireAuth, async (req, res) => {
|
|
89
|
-
try {
|
|
90
|
-
const queryTasks = await loadQuery();
|
|
91
|
-
const tasks = queryTasks({
|
|
92
|
-
status: queryString(req.query.status),
|
|
93
|
-
priority: queryString(req.query.priority),
|
|
94
|
-
search: queryString(req.query.search),
|
|
95
|
-
sourceRoom: queryString(req.query.sourceRoom),
|
|
96
|
-
limit: queryLimit(req.query.limit),
|
|
97
|
-
});
|
|
98
|
-
if (req.query.filter === 'overdue') {
|
|
99
|
-
const now = Date.now();
|
|
100
|
-
const overdue = tasks.filter((task) => {
|
|
101
|
-
return task.deadline !== null && new Date(task.deadline).getTime() < now;
|
|
102
|
-
});
|
|
103
|
-
res.json({ success: true, tasks: overdue, total: overdue.length });
|
|
104
|
-
return;
|
|
105
|
-
}
|
|
106
|
-
res.json({ success: true, tasks, total: tasks.length });
|
|
107
|
-
}
|
|
108
|
-
catch (error) {
|
|
109
|
-
res.status(500).json({
|
|
110
|
-
success: false,
|
|
111
|
-
error: error instanceof Error ? error.message : String(error),
|
|
112
|
-
});
|
|
113
|
-
}
|
|
114
|
-
});
|
|
115
|
-
}
|
|
116
|
-
async function registerApiRoutes(params) {
|
|
117
|
-
const { config, apiServer, eventBus, oauthManager: _oauthManager, mamaApi: _mamaApi, messageRouter, toolExecutor, discordGateway, slackGateway, graphHandler, getAdapter, privateConnectorPolicy, rawConnectorScope, sessionsDb, workOrderConsumer, boardRefreshGate, } = params;
|
|
118
|
-
let boardBootTimeout = null;
|
|
119
|
-
let boardInterval = null;
|
|
120
|
-
let wikiContinuityInterval = null;
|
|
121
|
-
let boardReconcileScheduler = null;
|
|
122
|
-
let boardReconcileEnabled = false;
|
|
123
|
-
let requestBoardRepair = () => {
|
|
124
|
-
routesLogger.error('[stage2] Board repair nudge ignored: dashboard-agent is not configured');
|
|
125
|
-
};
|
|
126
|
-
// ── Stage-2 workorder publishers ──────────────────────────────────────
|
|
127
|
-
// The ONLY system run path since v0.28.0: every scheduled/boot/manual run
|
|
128
|
-
// below enqueues an occurrence-keyed workorder for the consumer lane (the
|
|
129
|
-
// legacy executeValidatedRun persona runs were removed after the 2026-07-22
|
|
130
|
-
// production cutover).
|
|
131
|
-
const enqueueWorkOrderOrThrow = (workKind, idempotencyKey, payload, priority) => {
|
|
132
|
-
const ledger = toolExecutor.getTaskLedger();
|
|
133
|
-
if (!ledger) {
|
|
134
|
-
throw new Error(`[stage2] TaskLedger unavailable - cannot enqueue ${workKind} workorder`);
|
|
135
|
-
}
|
|
136
|
-
(0, workorder_publishers_js_1.validateWorkOrderPayload)(workKind, payload);
|
|
137
|
-
const wo = ledger.enqueueWorkOrder({ workKind, idempotencyKey, input: payload, priority });
|
|
138
|
-
console.log(`[stage2] enqueued workorder ${workKind}#${wo.id} key=${idempotencyKey}`);
|
|
139
|
-
return wo;
|
|
140
|
-
};
|
|
141
|
-
// Wire EventBus to tool executor for agent_notices tool
|
|
142
|
-
toolExecutor.setAgentEventBus(eventBus);
|
|
143
|
-
(0, operator_tasks_handler_js_1.registerOperatorTaskRoutes)(apiServer.app, {
|
|
144
|
-
getTaskLedger: () => toolExecutor.getTaskLedger(),
|
|
145
|
-
});
|
|
146
|
-
const hasEnabledAgentConfig = (agentId) => {
|
|
147
|
-
const agentConfig = config.multi_agent?.agents?.[agentId];
|
|
148
|
-
return Boolean(agentConfig && agentConfig.enabled !== false);
|
|
149
|
-
};
|
|
150
|
-
// ── Report Slots + legacy dashboard/wiki fanout ───────────────────────
|
|
151
|
-
const wikiAgentConfigured = hasEnabledAgentConfig('wiki-agent');
|
|
152
|
-
// Manual refresh endpoint (kept for compatibility)
|
|
153
|
-
apiServer.app.post('/api/report/refresh', auth_middleware_js_1.requireAuth, (_req, res) => {
|
|
154
|
-
res.json({ ok: true, message: 'Viewer now renders data directly from Intelligence API' });
|
|
155
|
-
});
|
|
156
|
-
apiServer.app.post('/api/operator/report', auth_middleware_js_1.requireAuth, (_req, res) => {
|
|
157
|
-
const outcome = params.requestFullReport?.() ?? {
|
|
158
|
-
accepted: false,
|
|
159
|
-
reason: 'unavailable',
|
|
160
|
-
};
|
|
161
|
-
if (outcome.accepted) {
|
|
162
|
-
res.status(202).json({ ok: true, status: 'accepted' });
|
|
163
|
-
return;
|
|
164
|
-
}
|
|
165
|
-
const status = outcome.reason === 'busy' ? 409 : 503;
|
|
166
|
-
res.status(status).json({ ok: false, reason: outcome.reason ?? 'unavailable' });
|
|
167
|
-
});
|
|
168
|
-
// -- TG-05/TG-06 owner-report delivery recovery (design Decision 3) --
|
|
169
|
-
// A definite rejection is never retried automatically; these explicit
|
|
170
|
-
// operator actions are the ONLY way to reactivate the same delivery ID or
|
|
171
|
-
// to cancel a proven-unaccepted occurrence. The trigger loop observes the
|
|
172
|
-
// resulting terminal/retryable state on its next tick.
|
|
173
|
-
const reportContextStore = params.reportContextStore;
|
|
174
|
-
if (reportContextStore) {
|
|
175
|
-
apiServer.app.get('/api/operator/report-delivery/:deliveryId', auth_middleware_js_1.requireAuth, (req, res) => {
|
|
176
|
-
const event = reportContextStore.getEvent(String(req.params.deliveryId));
|
|
177
|
-
if (!event) {
|
|
178
|
-
res.status(404).json({ ok: false, error: 'unknown delivery ID' });
|
|
179
|
-
return;
|
|
180
|
-
}
|
|
181
|
-
res.json({ ok: true, event });
|
|
182
|
-
});
|
|
183
|
-
const isProtocolRefusal = (error) => error instanceof Error && /cannot be (cancelled|reactivated)/i.test(error.message);
|
|
184
|
-
apiServer.app.post('/api/operator/report-delivery/reactivate', auth_middleware_js_1.requireAuth, (req, res) => {
|
|
185
|
-
const deliveryId = (req.body ?? {}).deliveryId;
|
|
186
|
-
if (typeof deliveryId !== 'string' || deliveryId.length === 0) {
|
|
187
|
-
res.status(400).json({ ok: false, error: 'deliveryId must be a non-empty string' });
|
|
188
|
-
return;
|
|
189
|
-
}
|
|
190
|
-
try {
|
|
191
|
-
reportContextStore.reactivate(deliveryId);
|
|
192
|
-
res.json({
|
|
193
|
-
ok: true,
|
|
194
|
-
message: `delivery ${deliveryId} reactivated; next due tick retries`,
|
|
195
|
-
});
|
|
196
|
-
}
|
|
197
|
-
catch (error) {
|
|
198
|
-
res.status(isProtocolRefusal(error) ? 409 : 500).json({
|
|
199
|
-
ok: false,
|
|
200
|
-
error: error instanceof Error ? error.message : String(error),
|
|
201
|
-
});
|
|
202
|
-
}
|
|
203
|
-
});
|
|
204
|
-
apiServer.app.post('/api/operator/report-delivery/cancel', auth_middleware_js_1.requireAuth, (req, res) => {
|
|
205
|
-
const body = (req.body ?? {});
|
|
206
|
-
const deliveryId = body.deliveryId;
|
|
207
|
-
const reason = body.reason;
|
|
208
|
-
if (typeof deliveryId !== 'string' ||
|
|
209
|
-
deliveryId.length === 0 ||
|
|
210
|
-
typeof reason !== 'string' ||
|
|
211
|
-
reason.length === 0) {
|
|
212
|
-
res
|
|
213
|
-
.status(400)
|
|
214
|
-
.json({ ok: false, error: 'deliveryId and reason must be non-empty strings' });
|
|
215
|
-
return;
|
|
216
|
-
}
|
|
217
|
-
try {
|
|
218
|
-
reportContextStore.cancel(deliveryId, reason, new Date().toISOString());
|
|
219
|
-
res.json({ ok: true, message: `delivery ${deliveryId} cancelled` });
|
|
220
|
-
}
|
|
221
|
-
catch (error) {
|
|
222
|
-
res.status(isProtocolRefusal(error) ? 409 : 500).json({
|
|
223
|
-
ok: false,
|
|
224
|
-
error: error instanceof Error ? error.message : String(error),
|
|
225
|
-
});
|
|
226
|
-
}
|
|
227
|
-
});
|
|
228
|
-
}
|
|
229
|
-
if (config.agent.backend === 'claude') {
|
|
230
|
-
// Merge code-act MCP server into mama-mcp-config.json. The owner runtime's
|
|
231
|
-
// own claude persona needs this entry, so it is NOT gated on any legacy
|
|
232
|
-
// self-paced agent (dashboard-agent / wiki-agent) being configured.
|
|
233
|
-
try {
|
|
234
|
-
(0, code_act_mcp_config_js_1.ensureCodeActMcpConfig)({
|
|
235
|
-
mcpConfigPath: node_path_1.default.join((0, node_os_1.homedir)(), '.mama', 'mama-mcp-config.json'),
|
|
236
|
-
apiPort: utilities_js_1.API_PORT,
|
|
237
|
-
logger: routesLogger,
|
|
238
|
-
});
|
|
239
|
-
}
|
|
240
|
-
catch (err) {
|
|
241
|
-
routesLogger.warn('[api-routes-init] Failed to merge code-act into MCP config:', err);
|
|
242
|
-
}
|
|
243
|
-
}
|
|
244
|
-
// report_publish is a core surface (feeds the /viewer operator board), not a
|
|
245
|
-
// multi-agent feature: wire it unconditionally. All slot ids are accepted;
|
|
246
|
-
// size/count caps and loud logging live in createReportPublisher.
|
|
247
|
-
{
|
|
248
|
-
const { createReportPublisher } = await import('../../api/report-handler.js');
|
|
249
|
-
toolExecutor.setReportPublisher(createReportPublisher(apiServer.reportStore, apiServer.reportSseClients));
|
|
250
|
-
// S1-T4 artifact hub: the console READS the board it directs. Same store
|
|
251
|
-
// the publisher writes - MAMA's status answers cite these slots
|
|
252
|
-
// instead of re-deriving state from memory copies.
|
|
253
|
-
toolExecutor.setReportReader(() => {
|
|
254
|
-
const slots = apiServer.reportStore.getAll();
|
|
255
|
-
const projected = {};
|
|
256
|
-
for (const [name, slot] of Object.entries(slots)) {
|
|
257
|
-
projected[name] = {
|
|
258
|
-
html: slot.html,
|
|
259
|
-
basisRevision: slot.basisRevision,
|
|
260
|
-
currentBasisRevision: slot.currentBasisRevision,
|
|
261
|
-
freshness: slot.freshness,
|
|
262
|
-
updatedAt: Number.isFinite(slot.updatedAt)
|
|
263
|
-
? new Date(slot.updatedAt).toISOString()
|
|
264
|
-
: null,
|
|
265
|
-
};
|
|
266
|
-
}
|
|
267
|
-
return projected;
|
|
268
|
-
});
|
|
269
|
-
}
|
|
270
|
-
{
|
|
271
|
-
// ── Stage-2 Board publisher and verifier ───────────────────────────
|
|
272
|
-
// Schedule/boot/manual all funnel here: one occurrence-keyed board
|
|
273
|
-
// workorder per entry. An enqueue failure is logged loudly and the next
|
|
274
|
-
// occurrence retries - there is no fallback run path.
|
|
275
|
-
const reconcileEnabled = process.env.MAMA_BOARD_RECONCILE === '1';
|
|
276
|
-
boardReconcileEnabled = reconcileEnabled;
|
|
277
|
-
// Evidence that a board was actually WRITTEN, not just that a run reached
|
|
278
|
-
// 'done'. An unverified full run reaches 'done' too, so the delta gate
|
|
279
|
-
// requires a publish at or after the baseline run's enqueue time.
|
|
280
|
-
const boardPublishedAt = () => {
|
|
281
|
-
const slots = apiServer.reportStore.getAll();
|
|
282
|
-
let oldest = Number.POSITIVE_INFINITY;
|
|
283
|
-
for (const slotId of workorder_hooks_js_1.REQUIRED_FULL_BOARD_SLOTS) {
|
|
284
|
-
const updatedAt = slots[slotId]?.updatedAt;
|
|
285
|
-
if (!Number.isFinite(updatedAt))
|
|
286
|
-
return 0;
|
|
287
|
-
oldest = Math.min(oldest, updatedAt);
|
|
288
|
-
}
|
|
289
|
-
return Number.isFinite(oldest) ? oldest : 0;
|
|
290
|
-
};
|
|
291
|
-
const runDashboardAgent = (opts) => {
|
|
292
|
-
try {
|
|
293
|
-
// Cheap host-side delta gate (Fix E). It runs in BOTH configs, because
|
|
294
|
-
// under MAMA_BOARD_RECONCILE=1 every scheduled enqueue reaches this
|
|
295
|
-
// line WITH dirt: `needsFullRepair()` is true whenever a channel delta
|
|
296
|
-
// or an owner board request arrived since the last verified full run
|
|
297
|
-
// (board-refresh-gate.ts), which is an "inputs moved" claim - exactly
|
|
298
|
-
// the claim this gate re-checks against what the board actually reads.
|
|
299
|
-
// The "board was not rebuilt" case is NOT suppressed: it surfaces as
|
|
300
|
-
// the gate's own `unpublished` reason, measured from the report slots
|
|
301
|
-
// rather than assumed. A broken signal enqueues as before -
|
|
302
|
-
// availability of the board beats the token saving - but says so.
|
|
303
|
-
const delta = (0, board_delta_gate_js_1.evaluateBoardFullDelta)({
|
|
304
|
-
readWatermark: () => {
|
|
305
|
-
const ledger = toolExecutor.getTaskLedger();
|
|
306
|
-
if (!ledger) {
|
|
307
|
-
throw new Error('TaskLedger unavailable - cannot read the board input watermark');
|
|
308
|
-
}
|
|
309
|
-
const adapter = getAdapter();
|
|
310
|
-
return (0, board_delta_gate_js_1.composeBoardInputWatermark)([
|
|
311
|
-
(0, board_delta_gate_js_1.connectorObservationTerm)(adapter),
|
|
312
|
-
ledger.ownerTaskTerm(),
|
|
313
|
-
(0, board_delta_gate_js_1.memoryRecencyTerm)(adapter),
|
|
314
|
-
]);
|
|
315
|
-
},
|
|
316
|
-
readBaseline: () => {
|
|
317
|
-
const ledger = toolExecutor.getTaskLedger();
|
|
318
|
-
if (!ledger) {
|
|
319
|
-
throw new Error('TaskLedger unavailable - cannot read the full-board baseline');
|
|
320
|
-
}
|
|
321
|
-
return ledger.lastCompletedBoardFullRun();
|
|
322
|
-
},
|
|
323
|
-
readBoardPublishedAt: boardPublishedAt,
|
|
324
|
-
});
|
|
325
|
-
if (delta.warning) {
|
|
326
|
-
// error, not warn: DebugLogger defaults to MAMA_LOG_LEVEL=ERROR, so a
|
|
327
|
-
// warn here would be invisible on a normal daemon - and a gate whose
|
|
328
|
-
// signal is broken is permanently inert, which is exactly the kind of
|
|
329
|
-
// silent degradation this file logs loudly everywhere else.
|
|
330
|
-
routesLogger.error(`[stage2] board delta gate unavailable (${delta.warning}); enqueueing the full board anyway`);
|
|
331
|
-
}
|
|
332
|
-
// Two independent authorities, and neither of them is "the daemon just
|
|
333
|
-
// started" (owner decision 2026-09-09). `delta` means the watermark
|
|
334
|
-
// moved, and the in-memory gate must agree that something actually
|
|
335
|
-
// arrived - the notices term of that watermark is an in-memory ring, so
|
|
336
|
-
// a restart alone changes it and used to buy one full run per boot. The
|
|
337
|
-
// other reasons are EVIDENCE about the board itself (no baseline, never
|
|
338
|
-
// published, stale past DEFAULT_BOARD_FULL_MAX_STALENESS_MS, or a signal
|
|
339
|
-
// we could not read), and those still enqueue on their own: availability
|
|
340
|
-
// of the board beats the token saving.
|
|
341
|
-
const gateDirty = boardRefreshGate ? boardRefreshGate.needsFullRepair() : true;
|
|
342
|
-
// 'unpublished' is the ONE reason that must still agree with the in-memory dirt: a
|
|
343
|
-
// board whose last completed run honestly had nothing to publish stays unpublished
|
|
344
|
-
// forever, so on its own this reason would re-enqueue every 30 minutes for the rest
|
|
345
|
-
// of the daemon's life. Every other reason is bounded on its own - 'no-baseline'
|
|
346
|
-
// fires once, 'stale' at most once per DEFAULT_BOARD_FULL_MAX_STALENESS_MS, 'delta'
|
|
347
|
-
// only when a durable term actually moved, and 'signal-unavailable' is the case
|
|
348
|
-
// where availability of the board beats the token saving.
|
|
349
|
-
const needsDirtAgreement = delta.reason === 'unpublished';
|
|
350
|
-
if (!opts?.force && !delta.enqueue) {
|
|
351
|
-
routesLogger.info(`[stage2] board full skipped: ${delta.reason} - nothing the board reads has moved since the last published full run`);
|
|
352
|
-
return;
|
|
353
|
-
}
|
|
354
|
-
if (!opts?.force && needsDirtAgreement && !gateDirty) {
|
|
355
|
-
routesLogger.info(`[stage2] board full skipped: ${delta.reason} with a clean repair gate - the last completed run had nothing to publish and nothing has arrived since`);
|
|
356
|
-
return;
|
|
357
|
-
}
|
|
358
|
-
// The skips say why nothing ran; this says why something did. Without it a boot
|
|
359
|
-
// enqueue was the one board decision with no reason on the record.
|
|
360
|
-
// A forced refresh is always a rebuild; otherwise the gate decides (board-delta-gate.ts).
|
|
361
|
-
const runMode = opts?.force ? 'full' : delta.mode;
|
|
362
|
-
const anchorPublishedAt = runMode === 'delta' ? delta.anchorPublishedAt : null;
|
|
363
|
-
const anchor = anchorPublishedAt === null ? null : new Date(anchorPublishedAt).toISOString();
|
|
364
|
-
// The basis the published board rests on, read from the SAME report slots the anchor
|
|
365
|
-
// came from - not a fresh read, so the turn is told the basis of what it is editing.
|
|
366
|
-
const anchorBasis = anchor === null
|
|
367
|
-
? null
|
|
368
|
-
: (apiServer.reportStore.get('pipeline')?.currentBasisRevision ?? null);
|
|
369
|
-
// An anchored decision the store cannot name a basis for is not a delta: the turn would
|
|
370
|
-
// have to invent the basis it publishes under. Rebuild instead of guessing.
|
|
371
|
-
const mode = runMode === 'delta' && anchor !== null && anchorBasis !== null ? 'delta' : 'full';
|
|
372
|
-
if (mode === 'delta') {
|
|
373
|
-
routesLogger.info(`[stage2] board delta enqueued: ${delta.reason} (anchor ${String(anchor)}, basis ${String(anchorBasis)})`);
|
|
374
|
-
}
|
|
375
|
-
else {
|
|
376
|
-
routesLogger.info(`[stage2] board full enqueued: ${opts?.force ? 'force' : delta.reason} (watermark ${delta.watermark ?? 'unavailable'})`);
|
|
377
|
-
}
|
|
378
|
-
if (opts?.force && boardRefreshGate) {
|
|
379
|
-
// Host-owned manual dirt is captured before validation/enqueue can
|
|
380
|
-
// fail. It clears only through the full run-bound effect verifier.
|
|
381
|
-
boardRefreshGate.markChannelDirty(HOST_MANUAL_FULL_REPAIR_CHANNEL);
|
|
382
|
-
}
|
|
383
|
-
const now = Date.now();
|
|
384
|
-
const repair = boardRefreshGate?.captureFullRepair();
|
|
385
|
-
const ledger = toolExecutor.getTaskLedger();
|
|
386
|
-
if (!ledger) {
|
|
387
|
-
throw new Error('TaskLedger unavailable - cannot issue reclassification candidates');
|
|
388
|
-
}
|
|
389
|
-
const reclassificationCandidates = ledger
|
|
390
|
-
.list({
|
|
391
|
-
includeTerminal: false,
|
|
392
|
-
qualification: 'legacy_unqualified',
|
|
393
|
-
order: 'deadline_priority',
|
|
394
|
-
limit: 10,
|
|
395
|
-
})
|
|
396
|
-
.map((task) => ({ taskId: task.id, taskRevision: task.revision }));
|
|
397
|
-
enqueueWorkOrderOrThrow('board', opts?.force
|
|
398
|
-
? (0, workorder_publishers_js_1.boardManualKey)(now)
|
|
399
|
-
: boardRefreshGate
|
|
400
|
-
? (0, workorder_publishers_js_1.boardRepairKey)()
|
|
401
|
-
: (0, workorder_publishers_js_1.boardFullKey)(now), {
|
|
402
|
-
mode,
|
|
403
|
-
...(mode === 'delta'
|
|
404
|
-
? { deltaAnchor: anchor, deltaBasisRevision: anchorBasis }
|
|
405
|
-
: {}),
|
|
406
|
-
...(repair ?? {}),
|
|
407
|
-
// Carried so this run's completion becomes the next tick's baseline.
|
|
408
|
-
...(delta.watermark === null ? {} : { deltaWatermark: delta.watermark }),
|
|
409
|
-
reclassificationCandidates,
|
|
410
|
-
...(opts?.force ? { force: true } : {}),
|
|
411
|
-
}, opts?.force ? 'high' : undefined);
|
|
412
|
-
}
|
|
413
|
-
catch (err) {
|
|
414
|
-
routesLogger.error('[stage2] board enqueue failed:', err instanceof Error ? err.message : err);
|
|
415
|
-
}
|
|
416
|
-
};
|
|
417
|
-
// Host-gated repair: runs only when the gate is dirty or the delta moved.
|
|
418
|
-
requestBoardRepair = () => runDashboardAgent();
|
|
419
|
-
// First run after 10s (let connectors poll first), then every 30 min
|
|
420
|
-
// ONE constant feeds both the timer and the declared cadence - if they
|
|
421
|
-
// drift apart the watchdog pages on a schedule nobody is running.
|
|
422
|
-
const DASHBOARD_AGENT_INTERVAL_MS = 30 * 60 * 1000;
|
|
423
|
-
boardBootTimeout = setTimeout(() => {
|
|
424
|
-
runDashboardAgent();
|
|
425
|
-
}, 10_000);
|
|
426
|
-
(0, leg_cadence_js_1.getLegCadence)()?.declare('dashboard-agent', DASHBOARD_AGENT_INTERVAL_MS);
|
|
427
|
-
boardInterval = setInterval(() => {
|
|
428
|
-
(0, leg_cadence_js_1.getLegCadence)()?.beat('dashboard-agent');
|
|
429
|
-
runDashboardAgent();
|
|
430
|
-
}, DASHBOARD_AGENT_INTERVAL_MS);
|
|
431
|
-
// Manual trigger (owner-forced: the workorder carries force=true so the
|
|
432
|
-
// worker brief skips its NO_UPDATE delta gate)
|
|
433
|
-
apiServer.app.post('/api/report/agent-refresh', auth_middleware_js_1.requireAuth, async (_req, res) => {
|
|
434
|
-
runDashboardAgent({ force: true });
|
|
435
|
-
res.json({ ok: true, message: 'Board refresh workorder enqueued (forced)' });
|
|
436
|
-
});
|
|
437
|
-
// Manual Board reconcile remains available for an explicit operator
|
|
438
|
-
// request. Connector deltas belong to the MAMA owner-event agent and are
|
|
439
|
-
// no longer consumed by a parallel Board worker.
|
|
440
|
-
if (reconcileEnabled && boardRefreshGate) {
|
|
441
|
-
const { ReconcileScheduler } = await import('../../operator/board-reconcile.js');
|
|
442
|
-
const { captureSnapshot, verifyAfterRun } = await import('../../operator/action-verifier.js');
|
|
443
|
-
// Verifier deps (M8 Phase 2): run-bound signals only -- notes from the
|
|
444
|
-
// operator ledger, board slots. Observe, never block. Trace queries are
|
|
445
|
-
// worker-keyed (buildWorkerTraceQueries below): reconcile runs execute
|
|
446
|
-
// on the workorder consumer lane only.
|
|
447
|
-
const reconcileLedger = toolExecutor.getTaskLedger();
|
|
448
|
-
const verifierDeps = {
|
|
449
|
-
getSlots: () => apiServer.reportStore.getAllSorted(),
|
|
450
|
-
getLedgerHash: () => reconcileLedger?.payloadHash() ?? '',
|
|
451
|
-
getScopedNoteMaxId: (scope) => reconcileLedger?.maxNoUpdateId(scope) ?? 0,
|
|
452
|
-
};
|
|
453
|
-
// Stage-2 board completion hook (plan D1/E3/G1): the consumer wraps
|
|
454
|
-
// reconcile workorders with the SAME bracket the legacy closure owns,
|
|
455
|
-
// but trace rows from worker runs carry the worker's identity, not
|
|
456
|
-
// agent_id='dashboard-agent' - the re-key goes through details JSON
|
|
457
|
-
// (agent_activity has NO channel_id column; json_extract is the only
|
|
458
|
-
// schema-supported key; agent_id re-keying is a green-test trap).
|
|
459
|
-
if (workOrderConsumer) {
|
|
460
|
-
const { applyBoardRefreshVerdict, buildFullBoardTraceQueries, buildWorkerTraceQueries, boardCandidateReceiptVerdict, } = await import('../../operator/workorder-hooks.js');
|
|
461
|
-
// Per ATTEMPT, not per lane: a sibling board order running inside a delegated
|
|
462
|
-
// attempt's window must not discharge it (review P1-1).
|
|
463
|
-
const reconcileVerifierDepsFor = (attemptId) => ({
|
|
464
|
-
...verifierDeps,
|
|
465
|
-
...buildWorkerTraceQueries(sessionsDb, 'worker:board', undefined, attemptId),
|
|
466
|
-
});
|
|
467
|
-
const fullVerifierDepsFor = (attemptId) => ({
|
|
468
|
-
...verifierDeps,
|
|
469
|
-
...buildFullBoardTraceQueries(sessionsDb, 'worker:board', attemptId),
|
|
470
|
-
});
|
|
471
|
-
workOrderConsumer.registerHook('board', {
|
|
472
|
-
verdictRequired: true,
|
|
473
|
-
before: (wo) => {
|
|
474
|
-
if (wo.payload.mode === 'reconcile') {
|
|
475
|
-
return captureSnapshot(reconcileVerifierDepsFor(wo.id), `reconcile:${String(wo.payload.channelKey)}`);
|
|
476
|
-
}
|
|
477
|
-
if (wo.payload.mode !== 'reconcile' && typeof wo.payload.noUpdateScope === 'string') {
|
|
478
|
-
return captureSnapshot(fullVerifierDepsFor(wo.id), wo.payload.noUpdateScope);
|
|
479
|
-
}
|
|
480
|
-
return null;
|
|
481
|
-
},
|
|
482
|
-
after: (wo, response, beforeState) => {
|
|
483
|
-
const receiptVerdict = boardCandidateReceiptVerdict(wo, reconcileLedger);
|
|
484
|
-
if (!beforeState) {
|
|
485
|
-
if (response.includes('NO_UPDATE')) {
|
|
486
|
-
console.log('[stage2] board worker: no changes detected, publish skipped');
|
|
487
|
-
}
|
|
488
|
-
return receiptVerdict;
|
|
489
|
-
}
|
|
490
|
-
const isReconcile = wo.payload.mode === 'reconcile';
|
|
491
|
-
const scope = isReconcile
|
|
492
|
-
? `reconcile:${String(wo.payload.channelKey)}`
|
|
493
|
-
: String(wo.payload.noUpdateScope);
|
|
494
|
-
const verdict = verifyAfterRun(isReconcile ? reconcileVerifierDepsFor(wo.id) : fullVerifierDepsFor(wo.id), beforeState, scope);
|
|
495
|
-
// force:true is a request to rebuild/publish, so an exact no-op
|
|
496
|
-
// note cannot discharge it. Non-force scheduled repair may use
|
|
497
|
-
// the exact scope note when there is genuinely nothing to write.
|
|
498
|
-
const effectVerified = verdict.verified &&
|
|
499
|
-
!(wo.payload.mode !== 'reconcile' &&
|
|
500
|
-
wo.payload.force === true &&
|
|
501
|
-
verdict.obligatedTraceCount === 0);
|
|
502
|
-
// The mode is named in the outcome: a verified delta and a verified full are
|
|
503
|
-
// different claims about how the board was produced, and `full_verified` on a delta
|
|
504
|
-
// run would hide which one actually happened.
|
|
505
|
-
const boardMode = wo.payload.mode === 'delta' ? 'delta' : 'full';
|
|
506
|
-
const outcome = effectVerified
|
|
507
|
-
? isReconcile
|
|
508
|
-
? 'reconcile_verified'
|
|
509
|
-
: `${boardMode}_verified`
|
|
510
|
-
: isReconcile
|
|
511
|
-
? 'reconcile_unverified'
|
|
512
|
-
: `${boardMode}_unverified`;
|
|
513
|
-
console.log(`[stage2] ${outcome} scope=${scope}${verdict.effects.length > 0 ? ` (${verdict.effects.join('; ')})` : ''}`);
|
|
514
|
-
try {
|
|
515
|
-
if (sessionsDb) {
|
|
516
|
-
(0, agent_store_js_1.logActivity)(sessionsDb, {
|
|
517
|
-
agent_id: 'workorder-board',
|
|
518
|
-
agent_version: 0,
|
|
519
|
-
type: outcome,
|
|
520
|
-
input_summary: scope,
|
|
521
|
-
output_summary: verdict.effects.join('; '),
|
|
522
|
-
execution_status: 'completed',
|
|
523
|
-
trigger_reason: 'workorder',
|
|
524
|
-
});
|
|
525
|
-
}
|
|
526
|
-
}
|
|
527
|
-
catch {
|
|
528
|
-
/* telemetry only */
|
|
529
|
-
}
|
|
530
|
-
if (!effectVerified) {
|
|
531
|
-
eventBus.emit({
|
|
532
|
-
type: 'agent:action',
|
|
533
|
-
agent: 'Dashboard Agent',
|
|
534
|
-
action: isReconcile ? 'reconcile_unverified' : 'full_unverified',
|
|
535
|
-
target: isReconcile ? String(wo.payload.channelKey) : scope,
|
|
536
|
-
});
|
|
537
|
-
}
|
|
538
|
-
return applyBoardRefreshVerdict(wo, effectVerified, receiptVerdict, boardRefreshGate);
|
|
539
|
-
},
|
|
540
|
-
});
|
|
541
|
-
}
|
|
542
|
-
const reconcileScheduler = new ReconcileScheduler({
|
|
543
|
-
debounceMs: Number(process.env.MAMA_RECONCILE_DEBOUNCE_MS) || undefined,
|
|
544
|
-
maxWaitMs: Number(process.env.MAMA_RECONCILE_MAX_WAIT_MS) || undefined,
|
|
545
|
-
globalMaxPerHour: Number(process.env.MAMA_RECONCILE_MAX_PER_HOUR) || undefined,
|
|
546
|
-
log: (line) => console.log(line),
|
|
547
|
-
run: (channelKey, deltaLines, eventIds, repairGeneration) => {
|
|
548
|
-
// The reconcile leg is a board workorder; its bracket verification
|
|
549
|
-
// runs in the consumer's completion hook (registered above).
|
|
550
|
-
try {
|
|
551
|
-
const privateKagemushaPartition = channelKey.startsWith('kagemusha:');
|
|
552
|
-
const mayProjectKagemushaLifecycle = privateConnectorPolicy.isEnabled('kagemusha') &&
|
|
553
|
-
rawConnectorScope.includes('kagemusha');
|
|
554
|
-
if (privateKagemushaPartition && !mayProjectKagemushaLifecycle) {
|
|
555
|
-
// A private partition that boot did not authorize is consumed
|
|
556
|
-
// without a generic board workorder. Rejecting would retain and
|
|
557
|
-
// retry the private delta; enqueuing would leak its prose.
|
|
558
|
-
boardRefreshGate.consumeUnauthorizedPartition(channelKey, repairGeneration);
|
|
559
|
-
return Promise.resolve();
|
|
560
|
-
}
|
|
561
|
-
const ledger = toolExecutor.getTaskLedger();
|
|
562
|
-
if (!ledger) {
|
|
563
|
-
throw new Error('[stage2] TaskLedger unavailable - cannot construct lifecycle evidence');
|
|
564
|
-
}
|
|
565
|
-
const candidates = (0, external_lifecycle_discovery_js_1.buildReconcileExternalLifecycleCandidates)({
|
|
566
|
-
eventIds,
|
|
567
|
-
getAdapter,
|
|
568
|
-
ledger,
|
|
569
|
-
privateConnectorPolicy,
|
|
570
|
-
rawConnectorScope,
|
|
571
|
-
});
|
|
572
|
-
const reclassificationCandidates = ledger
|
|
573
|
-
.list({ channel: channelKey, order: 'updated', limit: 10 })
|
|
574
|
-
.map((task) => ({ taskId: task.id, taskRevision: task.revision }));
|
|
575
|
-
enqueueWorkOrderOrThrow('board', (0, workorder_publishers_js_1.boardReconcileKey)(channelKey, Date.now()), {
|
|
576
|
-
mode: 'reconcile',
|
|
577
|
-
channelKey,
|
|
578
|
-
deltaLines,
|
|
579
|
-
// The batch, carried structurally. It was already inside deltaLines as
|
|
580
|
-
// `[id:evt_...]` text and could only be recovered by parsing prose.
|
|
581
|
-
eventIds,
|
|
582
|
-
repairGeneration,
|
|
583
|
-
reclassificationCandidates,
|
|
584
|
-
// Host-authored structural authority. deltaLines remain untrusted,
|
|
585
|
-
// human-readable context and never grant lifecycle mutations.
|
|
586
|
-
candidates,
|
|
587
|
-
});
|
|
588
|
-
}
|
|
589
|
-
catch (err) {
|
|
590
|
-
routesLogger.error('[stage2] reconcile enqueue failed:', err instanceof Error ? err.message : err);
|
|
591
|
-
// REJECT so ReconcileScheduler restores pendingLines - a
|
|
592
|
-
// resolved failure silently drops this delta (PR bot round).
|
|
593
|
-
return Promise.reject(err instanceof Error ? err : new Error(String(err)));
|
|
594
|
-
}
|
|
595
|
-
return Promise.resolve();
|
|
596
|
-
},
|
|
597
|
-
});
|
|
598
|
-
boardReconcileScheduler = reconcileScheduler;
|
|
599
|
-
// Manual reconcile: lines from the body, or the caller must supply them
|
|
600
|
-
// (no silent alternate data path -- M8 review #17).
|
|
601
|
-
apiServer.app.post('/api/operator/reconcile', auth_middleware_js_1.requireAuth, (req, res) => {
|
|
602
|
-
const { channelKey, lines } = (req.body ?? {});
|
|
603
|
-
if (typeof channelKey !== 'string' ||
|
|
604
|
-
channelKey.length === 0 ||
|
|
605
|
-
channelKey.length > 1000 ||
|
|
606
|
-
!Array.isArray(lines) ||
|
|
607
|
-
lines.length === 0) {
|
|
608
|
-
res.status(400).json({
|
|
609
|
-
ok: false,
|
|
610
|
-
error: 'channelKey (1-1000 chars) and non-empty lines[] are required',
|
|
611
|
-
});
|
|
612
|
-
return;
|
|
613
|
-
}
|
|
614
|
-
const repairGeneration = boardRefreshGate.markChannelDirty(channelKey);
|
|
615
|
-
reconcileScheduler.enqueue(channelKey, lines, [], repairGeneration);
|
|
616
|
-
res.json({ ok: true, message: 'Reconcile queued (async; runs after debounce)' });
|
|
617
|
-
});
|
|
618
|
-
console.log('[reconcile] Board reconcile leg enabled (MAMA_BOARD_RECONCILE=1)');
|
|
619
|
-
}
|
|
620
|
-
}
|
|
621
|
-
// ── Wiki Agent ──────────────────────────────────────────────────────
|
|
622
|
-
const wikiConfig = config.wiki;
|
|
623
|
-
if (wikiAgentConfigured && wikiConfig?.enabled && wikiConfig.vaultPath) {
|
|
624
|
-
const { ObsidianWriter } = await import('../../wiki/obsidian-writer.js');
|
|
625
|
-
const obsWriter = new ObsidianWriter(wikiConfig.vaultPath, wikiConfig.wikiDir || 'wiki');
|
|
626
|
-
obsWriter.ensureDirectories();
|
|
627
|
-
routesLogger.debug(`[Wiki Agent] vault: ${obsWriter.getWikiPath()}`);
|
|
628
|
-
// Wire Obsidian vault path for CLI tool. The wiki directory itself is what
|
|
629
|
-
// gets registered as an Obsidian vault (agent-facing paths like daily/... are
|
|
630
|
-
// relative to it), so the CLI vault name is the wiki path's basename.
|
|
631
|
-
const fullWikiPath = obsWriter.getWikiPath();
|
|
632
|
-
const obsidianVaultName = node_path_1.default.basename(fullWikiPath);
|
|
633
|
-
toolExecutor.setObsidianVaultPath(fullWikiPath, obsidianVaultName);
|
|
634
|
-
routesLogger.debug(`[Wiki Agent] Obsidian CLI vault: ${fullWikiPath} (vault=${obsidianVaultName})`);
|
|
635
|
-
// Ensure Obsidian is running with the wiki vault open (macOS only).
|
|
636
|
-
// NOTE: obsidian://open?vault= only opens vaults ALREADY registered in
|
|
637
|
-
// Obsidian; registering the wiki directory as a vault is a one-time manual
|
|
638
|
-
// setup step. If it is not registered, the CLI reports unavailable and the
|
|
639
|
-
// agent falls back to wiki_publish (direct file writes still work).
|
|
640
|
-
if (process.platform === 'darwin' && !process.env.VITEST) {
|
|
641
|
-
try {
|
|
642
|
-
const { execFile: execFileChild } = await import('child_process');
|
|
643
|
-
execFileChild('open', [`obsidian://open?vault=${encodeURIComponent(obsidianVaultName)}`], { timeout: 5000 }, () => {
|
|
644
|
-
/* non-fatal: CLI will return error, agent falls back to wiki_publish */
|
|
645
|
-
});
|
|
646
|
-
}
|
|
647
|
-
catch {
|
|
648
|
-
/* non-fatal */
|
|
649
|
-
}
|
|
650
|
-
}
|
|
651
|
-
// Wire wiki_publish tool to shared gateway executor (used by code-act path)
|
|
652
|
-
toolExecutor.setWikiPublisher((pages) => {
|
|
653
|
-
const scheduledPages = pages.every((page) => page.expectedContentVersion !== undefined);
|
|
654
|
-
if (scheduledPages) {
|
|
655
|
-
// Home.md is the v5 index and is part of the staged page set. Legacy index.md/log.md
|
|
656
|
-
// writes stay on the generic path so a scheduled publish has one rollback boundary.
|
|
657
|
-
obsWriter.writePagesAtomically(pages);
|
|
658
|
-
}
|
|
659
|
-
else {
|
|
660
|
-
for (const page of pages) {
|
|
661
|
-
obsWriter.writePage(page);
|
|
662
|
-
}
|
|
663
|
-
obsWriter.updateIndex(pages);
|
|
664
|
-
obsWriter.appendLog('compile', `Published ${pages.length} pages`);
|
|
665
|
-
}
|
|
666
|
-
routesLogger.debug(`[Wiki Agent] Published ${pages.length} pages to vault`);
|
|
667
|
-
eventBus.emit({
|
|
668
|
-
type: 'wiki:compiled',
|
|
669
|
-
pages: pages.map((p) => p.path || ''),
|
|
670
|
-
});
|
|
671
|
-
});
|
|
672
|
-
// Owner/host IANA time zone - the same source the temporal runtime and the
|
|
673
|
-
// TaskLedger derive the owner day from.
|
|
674
|
-
const wikiTimeZone = Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
675
|
-
// The wiki source watermark covers connector observation, native owner tasks
|
|
676
|
-
// and memory recency. Agent notices are DELIBERATELY EXCLUDED: a wiki
|
|
677
|
-
// completion/no-update notice must not move the watermark and so wake the
|
|
678
|
-
// wiki turn forever.
|
|
679
|
-
const readWikiSourceWatermark = () => {
|
|
680
|
-
const ledger = toolExecutor.getTaskLedger();
|
|
681
|
-
if (!ledger) {
|
|
682
|
-
throw new Error('TaskLedger unavailable - cannot read the wiki source watermark');
|
|
683
|
-
}
|
|
684
|
-
const adapter = getAdapter();
|
|
685
|
-
return (0, wiki_continuity_js_1.composeWikiSourceWatermark)([
|
|
686
|
-
(0, board_delta_gate_js_1.connectorObservationTerm)(adapter),
|
|
687
|
-
ledger.ownerTaskTerm(),
|
|
688
|
-
(0, board_delta_gate_js_1.memoryRecencyTerm)(adapter),
|
|
689
|
-
]);
|
|
690
|
-
};
|
|
691
|
-
const runWikiAgent = (trigger, opts) => {
|
|
692
|
-
try {
|
|
693
|
-
const now = Date.now();
|
|
694
|
-
const ledger = toolExecutor.getTaskLedger();
|
|
695
|
-
if (!ledger) {
|
|
696
|
-
throw new Error('TaskLedger unavailable - cannot plan a wiki run');
|
|
697
|
-
}
|
|
698
|
-
const decision = (0, wiki_continuity_js_1.evaluateWikiContinuity)({
|
|
699
|
-
nowMs: now,
|
|
700
|
-
timeZone: wikiTimeZone,
|
|
701
|
-
connectors: (0, wiki_continuity_js_1.publicWikiConnectorScope)(rawConnectorScope, privateConnectorPolicy.enabledPrivateConnectors),
|
|
702
|
-
trigger,
|
|
703
|
-
forced: opts?.forced === true,
|
|
704
|
-
requestedOwnerDate: opts?.ownerDate,
|
|
705
|
-
readSourceWatermark: readWikiSourceWatermark,
|
|
706
|
-
readBaseline: () => ledger.lastCompletedWikiRun(),
|
|
707
|
-
});
|
|
708
|
-
if (decision.warning) {
|
|
709
|
-
routesLogger.error(`[stage2] wiki source watermark unavailable (${decision.warning}); enqueueing the wiki run anyway`);
|
|
710
|
-
}
|
|
711
|
-
if (!decision.enqueue || decision.payload === null) {
|
|
712
|
-
routesLogger.info(`[stage2] wiki skipped: ${decision.reason} - same owner date and source watermark already completed`);
|
|
713
|
-
return { status: 'skipped', reason: decision.reason };
|
|
714
|
-
}
|
|
715
|
-
// Non-forced continuity runs dedupe on the typed source snapshot (owner
|
|
716
|
-
// date + watermark) so boot/hourly/event against an unchanged snapshot
|
|
717
|
-
// resolve to ONE open workorder; a null watermark falls back to a coarse
|
|
718
|
-
// per-day hour bucket; a forced manual run stays occurrence-unique.
|
|
719
|
-
const idempotencyKey = opts?.forced
|
|
720
|
-
? (0, workorder_publishers_js_1.wikiBatchKey)(trigger, now)
|
|
721
|
-
: decision.payload.sourceWatermark === null
|
|
722
|
-
? (0, workorder_publishers_js_1.wikiUnavailableKey)(decision.payload.ownerDate, now)
|
|
723
|
-
: (0, workorder_publishers_js_1.wikiContinuityKey)(decision.payload.ownerDate, decision.payload.sourceWatermark);
|
|
724
|
-
const wo = enqueueWorkOrderOrThrow('wiki', idempotencyKey, { ...decision.payload }, opts?.forced ? 'high' : undefined);
|
|
725
|
-
return { status: 'enqueued', workOrderId: wo.id };
|
|
726
|
-
}
|
|
727
|
-
catch (err) {
|
|
728
|
-
const error = err instanceof Error ? err.message : String(err);
|
|
729
|
-
routesLogger.error('[stage2] wiki enqueue failed:', error);
|
|
730
|
-
return { status: 'error', error };
|
|
731
|
-
}
|
|
732
|
-
};
|
|
733
|
-
// Stage-2 wiki completion hook (plan E4): outcome reading only - the
|
|
734
|
-
// wiki:compiled events flow through the wikiPublisher independently.
|
|
735
|
-
if (workOrderConsumer) {
|
|
736
|
-
const { buildWikiAfterHook, buildWorkerTraceQueries, LANE_OBLIGATED_TOOLS } = await import('../../operator/workorder-hooks.js');
|
|
737
|
-
// Bound to the ATTEMPT: a delegated wiki attempt stays open for up to 30 minutes, and
|
|
738
|
-
// a sibling wiki order's wiki_publish must not discharge it (review P1-1).
|
|
739
|
-
const wikiTracesFor = (attemptId) => buildWorkerTraceQueries(sessionsDb, 'worker:wiki', LANE_OBLIGATED_TOOLS.wiki, attemptId);
|
|
740
|
-
workOrderConsumer.registerHook('wiki', {
|
|
741
|
-
verdictRequired: true,
|
|
742
|
-
// The trace rowid before the run is what makes the count run-bound; without it the
|
|
743
|
-
// hook would count any wiki_publish this process ever made.
|
|
744
|
-
before: (wo) => wikiTracesFor(wo.id).getTraceMaxId(),
|
|
745
|
-
after: buildWikiAfterHook((line) => routesLogger.info(line), {
|
|
746
|
-
tracesFor: wikiTracesFor,
|
|
747
|
-
onUnverified: (note) => eventBus.emit({
|
|
748
|
-
type: 'agent:action',
|
|
749
|
-
agent: 'Wiki Agent',
|
|
750
|
-
action: 'unverified',
|
|
751
|
-
target: note,
|
|
752
|
-
}),
|
|
753
|
-
}),
|
|
754
|
-
});
|
|
755
|
-
}
|
|
756
|
-
// Event-driven: compile when extraction completes. Trailing-edge debounce so
|
|
757
|
-
// bursts of extraction:completed events coalesce into one wiki compile run.
|
|
758
|
-
// Scheduled/event callers discard the run outcome - their failures are
|
|
759
|
-
// log-only inside runWikiAgent; only the manual route surfaces an error.
|
|
760
|
-
eventBus.onDebounced('extraction:completed', () => {
|
|
761
|
-
runWikiAgent('extraction:completed');
|
|
762
|
-
}, 30_000);
|
|
763
|
-
// Promotion feeds the wiki: freshly promoted decisions are exactly the
|
|
764
|
-
// material daily notes and lessons compile from.
|
|
765
|
-
eventBus.onDebounced('memory:promoted', () => {
|
|
766
|
-
runWikiAgent('memory:promoted');
|
|
767
|
-
}, 30_000);
|
|
768
|
-
// Emit agent:action notices when wiki pages are compiled
|
|
769
|
-
eventBus.on('wiki:compiled', (event) => {
|
|
770
|
-
if (event.type === 'wiki:compiled') {
|
|
771
|
-
for (const page of event.pages) {
|
|
772
|
-
eventBus.emit({
|
|
773
|
-
type: 'agent:action',
|
|
774
|
-
agent: 'Wiki Agent',
|
|
775
|
-
action: 'compiled',
|
|
776
|
-
target: page,
|
|
777
|
-
});
|
|
778
|
-
}
|
|
779
|
-
}
|
|
780
|
-
});
|
|
781
|
-
// Manual trigger API. A manual request bypasses the skip gate (forced) and
|
|
782
|
-
// may backfill a missed recent day via a STRICT optional ownerDate; a
|
|
783
|
-
// malformed date is rejected rather than silently defaulted.
|
|
784
|
-
apiServer.app.post('/api/wiki/compile', auth_middleware_js_1.requireAuth, async (req, res) => {
|
|
785
|
-
const body = (req.body ?? {});
|
|
786
|
-
let ownerDate;
|
|
787
|
-
if (body.ownerDate !== undefined) {
|
|
788
|
-
if (typeof body.ownerDate !== 'string') {
|
|
789
|
-
res.status(400).json({ ok: false, error: 'ownerDate must be a YYYY-MM-DD string' });
|
|
790
|
-
return;
|
|
791
|
-
}
|
|
792
|
-
try {
|
|
793
|
-
ownerDate = (0, wiki_continuity_js_1.parseStrictOwnerDate)(body.ownerDate);
|
|
794
|
-
}
|
|
795
|
-
catch (err) {
|
|
796
|
-
res
|
|
797
|
-
.status(400)
|
|
798
|
-
.json({ ok: false, error: err instanceof Error ? err.message : String(err) });
|
|
799
|
-
return;
|
|
800
|
-
}
|
|
801
|
-
// A future day cannot be backfilled: reject at the HTTP boundary with a
|
|
802
|
-
// clear 400 rather than letting the planner throw into a swallowed 200.
|
|
803
|
-
const currentOwnerDate = (0, wiki_continuity_js_1.ownerDateForInstant)(Date.now(), wikiTimeZone);
|
|
804
|
-
if (ownerDate > currentOwnerDate) {
|
|
805
|
-
res.status(400).json({
|
|
806
|
-
ok: false,
|
|
807
|
-
error: `ownerDate ${ownerDate} is in the future (current owner date ${currentOwnerDate})`,
|
|
808
|
-
});
|
|
809
|
-
return;
|
|
810
|
-
}
|
|
811
|
-
}
|
|
812
|
-
const outcome = runWikiAgent('manual', { forced: true, ownerDate });
|
|
813
|
-
if (outcome.status === 'error') {
|
|
814
|
-
// A real planning/ledger/validation/enqueue failure must not be reported
|
|
815
|
-
// as success (M1): return a non-2xx and never say enqueued.
|
|
816
|
-
res.status(500).json({ ok: false, error: outcome.error });
|
|
817
|
-
return;
|
|
818
|
-
}
|
|
819
|
-
res.json({ ok: true, message: 'Wiki compile workorder enqueued', status: outcome.status });
|
|
820
|
-
});
|
|
821
|
-
// No boot enqueue (owner decision 2026-09-09): a restart is not evidence
|
|
822
|
-
// that the wiki has anything to compile, and the boot continuity order was
|
|
823
|
-
// what put a multi-minute maintenance turn in front of the owner's first
|
|
824
|
-
// message after every restart. The hourly continuity tick below still gives
|
|
825
|
-
// a new owner date its one run, on evidence rather than on boot.
|
|
826
|
-
// Host-owned hourly continuity tick. The cheap watermark/date gate inside
|
|
827
|
-
// runWikiAgent skips the model when the same owner date and source watermark
|
|
828
|
-
// already completed; a new owner date still gets one run even when quiet.
|
|
829
|
-
const WIKI_CONTINUITY_INTERVAL_MS = 60 * 60 * 1000;
|
|
830
|
-
wikiContinuityInterval = setInterval(() => {
|
|
831
|
-
runWikiAgent('hourly');
|
|
832
|
-
}, WIKI_CONTINUITY_INTERVAL_MS);
|
|
833
|
-
wikiContinuityInterval.unref?.();
|
|
834
|
-
routesLogger.info('[Wiki Agent] Ready — triggers: hourly continuity tick, extraction:completed / memory:promoted events, POST /api/wiki/compile');
|
|
835
|
-
}
|
|
836
|
-
// -- Memory Promotion: scheduled observation->decision curation --
|
|
837
|
-
// Owner directive 2026-07-11: the decision layer starved after the 07-03/04
|
|
838
|
-
// backfill because nothing periodically judges connector-ingested business
|
|
839
|
-
// data (the M0 kill switch removed direct LLM extraction, and the memory
|
|
840
|
-
// agent only audits owner conversation turns). This pass has the memory
|
|
841
|
-
// agent promote DURABLE judgments only -- task states stay on the board.
|
|
842
|
-
const memoryAgentConfigured = hasEnabledAgentConfig('memory');
|
|
843
|
-
if (memoryAgentConfigured) {
|
|
844
|
-
const PROMOTION_INTERVAL_MS = (0, workorder_publishers_js_1.normalizePromotionIntervalMs)(Math.max(1, Number(process.env.MAMA_MEMORY_PROMOTION_HOURS) || 6) * 60 * 60 * 1000);
|
|
845
|
-
const PROMOTION_INITIAL_DELAY_MS = 10 * 60 * 1000; // let connectors poll first
|
|
846
|
-
// Promotion runs are workorders: enqueue-only, the consumer lane runs
|
|
847
|
-
// them under the memory-curation brief. The PROMOTED <n> parse and its
|
|
848
|
-
// event emissions live in the completion hook below.
|
|
849
|
-
const runMemoryPromotion = (opts) => {
|
|
850
|
-
try {
|
|
851
|
-
const now = Date.now();
|
|
852
|
-
enqueueWorkOrderOrThrow('memory-curation', opts?.manual ? (0, workorder_publishers_js_1.promotionManualKey)(now) : (0, workorder_publishers_js_1.promotionKey)(now, PROMOTION_INTERVAL_MS), { scheduledAt: new Date(now).toISOString() }, opts?.manual ? 'high' : undefined);
|
|
853
|
-
}
|
|
854
|
-
catch (err) {
|
|
855
|
-
routesLogger.error('[stage2] promotion enqueue failed:', err instanceof Error ? err.message : err);
|
|
856
|
-
}
|
|
857
|
-
};
|
|
858
|
-
// Stage-2 promotion completion hook (plan E4): the PROMOTED <n> parse and
|
|
859
|
-
// its event emissions are the wiki ingress chain's second link - losing
|
|
860
|
-
// them in the workorder conversion would silently sever memory:promoted.
|
|
861
|
-
if (workOrderConsumer) {
|
|
862
|
-
const { buildPromotionAfterHook, buildWorkerTraceQueries, LANE_OBLIGATED_TOOLS, LANE_WRITE_TOOLS, } = await import('../../operator/workorder-hooks.js');
|
|
863
|
-
const promotionTracesFor = (attemptId) => buildWorkerTraceQueries(sessionsDb, 'worker:memory-curation', LANE_OBLIGATED_TOOLS['memory-curation'], attemptId);
|
|
864
|
-
workOrderConsumer.registerHook('memory-curation', {
|
|
865
|
-
before: (wo) => promotionTracesFor(wo.id).getTraceMaxId(),
|
|
866
|
-
after: buildPromotionAfterHook({
|
|
867
|
-
emitAgentAction: (action, target) => eventBus.emit({ type: 'agent:action', agent: 'Memory Agent', action, target }),
|
|
868
|
-
emitMemoryPromoted: (saved) => eventBus.emit({ type: 'memory:promoted', saved }),
|
|
869
|
-
log: (line) => console.log(line),
|
|
870
|
-
}, {
|
|
871
|
-
tracesFor: promotionTracesFor,
|
|
872
|
-
writeTracesFor: (attemptId) => buildWorkerTraceQueries(sessionsDb, 'worker:memory-curation', LANE_WRITE_TOOLS['memory-curation'], attemptId),
|
|
873
|
-
log: (line) => console.log(line),
|
|
874
|
-
onUnverified: (note) => eventBus.emit({
|
|
875
|
-
type: 'agent:action',
|
|
876
|
-
agent: 'Memory Agent',
|
|
877
|
-
action: 'unverified',
|
|
878
|
-
target: note,
|
|
879
|
-
}),
|
|
880
|
-
}),
|
|
881
|
-
});
|
|
882
|
-
}
|
|
883
|
-
setTimeout(() => runMemoryPromotion(), PROMOTION_INITIAL_DELAY_MS);
|
|
884
|
-
(0, leg_cadence_js_1.getLegCadence)()?.declare('memory-promotion', PROMOTION_INTERVAL_MS);
|
|
885
|
-
setInterval(() => {
|
|
886
|
-
(0, leg_cadence_js_1.getLegCadence)()?.beat('memory-promotion');
|
|
887
|
-
runMemoryPromotion();
|
|
888
|
-
}, PROMOTION_INTERVAL_MS);
|
|
889
|
-
apiServer.app.post('/api/memory/promote', auth_middleware_js_1.requireAuth, (_req, res) => {
|
|
890
|
-
runMemoryPromotion({ manual: true });
|
|
891
|
-
res.json({ ok: true, message: 'Memory promotion workorder enqueued' });
|
|
892
|
-
});
|
|
893
|
-
console.log(`[Memory Promotion] Ready: every ${PROMOTION_INTERVAL_MS / 3_600_000}h, POST /api/memory/promote`);
|
|
894
|
-
}
|
|
895
|
-
// -- System Audit: hourly deterministic code checks ---------------------
|
|
896
|
-
// Owner decision 2026-04-22 (legacy id: mama_conductor_audit_code_based_read_only),
|
|
897
|
-
// landed 2026-07-17: the audit is fact collection and recording executed by
|
|
898
|
-
// CODE - no LLM invocation, no auto-fix, no broad filesystem access. The
|
|
899
|
-
// prior hourly LLM audit violated that decision and the 2026-05-14
|
|
900
|
-
// no-shell-autofix rule, and lost its tools entirely to the persona
|
|
901
|
-
// lockdown (--tools ""). The 24h alert-dedup contract (owner verdict
|
|
902
|
-
// 2026-07-11) is preserved inside runCodeAudit; MAJOR findings flow through
|
|
903
|
-
// dispatchSecurityAlertDirect to the configured security alert sender.
|
|
904
|
-
const AUDIT_INTERVAL_MS = 60 * 60 * 1000; // 1 hour
|
|
905
|
-
const AUDIT_INITIAL_DELAY_MS = 5 * 60 * 1000; // 5 min after startup
|
|
906
|
-
const doSystemAudit = async () => {
|
|
907
|
-
try {
|
|
908
|
-
const report = await (0, code_audit_js_1.runCodeAudit)({
|
|
909
|
-
config: {
|
|
910
|
-
telegram: config.telegram,
|
|
911
|
-
multi_agent: config.multi_agent,
|
|
912
|
-
roles: config.roles,
|
|
913
|
-
},
|
|
914
|
-
// Evaluated at audit time: gateway-wiring registers the sender only
|
|
915
|
-
// for ACTIVE gateways, so a configured target on a dead gateway must
|
|
916
|
-
// not report a false PASS.
|
|
917
|
-
securityAlertConfigured: (0, security_monitor_js_1.hasSecurityAlertSender)(),
|
|
918
|
-
// Direct dispatch, NOT recordSecurityEvent: audit findings are
|
|
919
|
-
// self-generated and must not fabricate incident/denylist/RDAP
|
|
920
|
-
// artifacts for a pseudo client. dispatchSecurityAlertDirect awaits
|
|
921
|
-
// delivery and throws on failure, so runCodeAudit keeps
|
|
922
|
-
// last_alerted_at null and retries on the next run (fail loud).
|
|
923
|
-
alert: async (finding, reason) => {
|
|
924
|
-
await (0, security_monitor_js_1.dispatchSecurityAlertDirect)({
|
|
925
|
-
type: 'system_audit_finding',
|
|
926
|
-
severity: 'critical',
|
|
927
|
-
message: `[Audit/${reason}] ${finding.summary}`,
|
|
928
|
-
// path carries the finding id so the alert-cooldown fingerprint
|
|
929
|
-
// distinguishes findings instead of collapsing them all into one.
|
|
930
|
-
path: finding.id,
|
|
931
|
-
details: { findingId: finding.id, detail: finding.detail ?? null },
|
|
932
|
-
});
|
|
933
|
-
},
|
|
934
|
-
});
|
|
935
|
-
const majors = report.findings.filter((f) => f.severity === 'MAJOR').length;
|
|
936
|
-
const minors = report.findings.filter((f) => f.severity === 'MINOR').length;
|
|
937
|
-
routesLogger.info(`[System Audit] ${report.pass_items.length} pass, ${majors} MAJOR, ${minors} MINOR, ` +
|
|
938
|
-
`alerted=[${report.alerted.join(',')}] in ${report.duration_ms}ms`);
|
|
939
|
-
if (report.alert_delivery_failures.length > 0) {
|
|
940
|
-
routesLogger.error('[System Audit] Alert delivery failures:', report.alert_delivery_failures.join('; '));
|
|
941
|
-
}
|
|
942
|
-
return report;
|
|
943
|
-
}
|
|
944
|
-
catch (err) {
|
|
945
|
-
routesLogger.error('[System Audit] Failed:', err instanceof Error ? err.message : String(err));
|
|
946
|
-
return null;
|
|
947
|
-
}
|
|
948
|
-
};
|
|
949
|
-
// Serialize scheduled and manual runs (same pattern as the memory-promotion
|
|
950
|
-
// chain above): overlapping audits would read the same prior state, alert
|
|
951
|
-
// twice, and race the audit-findings.json write. doSystemAudit never
|
|
952
|
-
// rejects, so chaining on the previous run is sufficient.
|
|
953
|
-
let auditRunChain = Promise.resolve(null);
|
|
954
|
-
const runSystemAudit = () => {
|
|
955
|
-
const next = auditRunChain.then(doSystemAudit);
|
|
956
|
-
auditRunChain = next;
|
|
957
|
-
return next;
|
|
958
|
-
};
|
|
959
|
-
setTimeout(() => {
|
|
960
|
-
void runSystemAudit();
|
|
961
|
-
(0, leg_cadence_js_1.getLegCadence)()?.declare('system-audit', AUDIT_INTERVAL_MS);
|
|
962
|
-
setInterval(() => {
|
|
963
|
-
(0, leg_cadence_js_1.getLegCadence)()?.beat('system-audit');
|
|
964
|
-
void runSystemAudit();
|
|
965
|
-
}, AUDIT_INTERVAL_MS);
|
|
966
|
-
}, AUDIT_INITIAL_DELAY_MS);
|
|
967
|
-
// Manual trigger returns the full report (read-only, no LLM, fast)
|
|
968
|
-
apiServer.app.post('/api/system/audit', auth_middleware_js_1.requireAuth, async (_req, res) => {
|
|
969
|
-
const report = await runSystemAudit();
|
|
970
|
-
if (report) {
|
|
971
|
-
res.json({ ok: true, mode: 'code', report });
|
|
972
|
-
}
|
|
973
|
-
else {
|
|
974
|
-
res.status(500).json({ ok: false, error: 'audit failed - see daemon.log' });
|
|
975
|
-
}
|
|
976
|
-
});
|
|
977
|
-
routesLogger.info('[System Audit] Ready - deterministic code checks every 60 min, POST /api/system/audit for manual run');
|
|
978
|
-
// ── Memory Agent stats API ────────────────────────────────────────────
|
|
979
|
-
apiServer.app.get('/api/memory-agent/stats', auth_middleware_js_1.requireAuth, (_req, res) => {
|
|
980
|
-
const stats = messageRouter.getMemoryAgentStats();
|
|
981
|
-
res.json(stats);
|
|
982
|
-
});
|
|
983
|
-
// ── Memory Agent dashboard API ────────────────────────────────────────
|
|
984
|
-
apiServer.app.get('/api/memory-agent/dashboard', auth_middleware_js_1.requireAuth, async (_req, res) => {
|
|
985
|
-
try {
|
|
986
|
-
// 1. Memory agent runtime stats
|
|
987
|
-
const agentStats = messageRouter.getMemoryAgentStats();
|
|
988
|
-
// 2. Memory DB stats (decisions, checkpoints, outcomes, topics)
|
|
989
|
-
const adapter = getAdapter();
|
|
990
|
-
const now = Date.now();
|
|
991
|
-
const weekAgo = now - 7 * 24 * 60 * 60 * 1000;
|
|
992
|
-
const monthAgo = now - 30 * 24 * 60 * 60 * 1000;
|
|
993
|
-
const totalRow = adapter.prepare('SELECT COUNT(*) as count FROM decisions').get();
|
|
994
|
-
const weekRow = adapter
|
|
995
|
-
.prepare('SELECT COUNT(*) as count FROM decisions WHERE created_at > ?')
|
|
996
|
-
.get(weekAgo);
|
|
997
|
-
const monthRow = adapter
|
|
998
|
-
.prepare('SELECT COUNT(*) as count FROM decisions WHERE created_at > ?')
|
|
999
|
-
.get(monthAgo);
|
|
1000
|
-
const checkpointRow = adapter.prepare('SELECT COUNT(*) as count FROM checkpoints').get();
|
|
1001
|
-
const outcomeRows = adapter
|
|
1002
|
-
.prepare(`SELECT outcome, COUNT(*) as count FROM decisions
|
|
1003
|
-
WHERE outcome IS NOT NULL GROUP BY outcome`)
|
|
1004
|
-
.all();
|
|
1005
|
-
const outcomes = {};
|
|
1006
|
-
for (const row of outcomeRows) {
|
|
1007
|
-
outcomes[row.outcome?.toLowerCase() ?? 'unknown'] = row.count;
|
|
1008
|
-
}
|
|
1009
|
-
const topTopics = adapter
|
|
1010
|
-
.prepare(`SELECT topic, COUNT(*) as count FROM decisions
|
|
1011
|
-
WHERE topic IS NOT NULL GROUP BY topic ORDER BY count DESC LIMIT 10`)
|
|
1012
|
-
.all();
|
|
1013
|
-
// 3. Recent decisions (last 20)
|
|
1014
|
-
const recentDecisions = adapter
|
|
1015
|
-
.prepare(`SELECT id, topic, decision, outcome, confidence, created_at
|
|
1016
|
-
FROM decisions ORDER BY created_at DESC LIMIT 20`)
|
|
1017
|
-
.all();
|
|
1018
|
-
// 4. Channel summaries (from channel_summary_state table, if it exists)
|
|
1019
|
-
let channelSummaries = [];
|
|
1020
|
-
try {
|
|
1021
|
-
const rawSummaries = adapter
|
|
1022
|
-
.prepare('SELECT channel_key, updated_at FROM channel_summary_state ORDER BY updated_at DESC LIMIT 20')
|
|
1023
|
-
.all();
|
|
1024
|
-
channelSummaries = rawSummaries.map((r) => ({
|
|
1025
|
-
channelKey: r.channel_key,
|
|
1026
|
-
updatedAt: r.updated_at,
|
|
1027
|
-
}));
|
|
1028
|
-
}
|
|
1029
|
-
catch {
|
|
1030
|
-
// Table may not exist yet — not an error
|
|
1031
|
-
}
|
|
1032
|
-
const payload = (0, memory_agent_dashboard_js_1.buildMemoryAgentDashboardPayload)({
|
|
1033
|
-
agentStats,
|
|
1034
|
-
channelSummaries,
|
|
1035
|
-
recentDecisions,
|
|
1036
|
-
generatedAt: new Date().toISOString(),
|
|
1037
|
-
});
|
|
1038
|
-
res.json({
|
|
1039
|
-
...payload,
|
|
1040
|
-
agent: agentStats,
|
|
1041
|
-
memory: {
|
|
1042
|
-
total: totalRow?.count ?? 0,
|
|
1043
|
-
thisWeek: weekRow?.count ?? 0,
|
|
1044
|
-
thisMonth: monthRow?.count ?? 0,
|
|
1045
|
-
checkpoints: checkpointRow?.count ?? 0,
|
|
1046
|
-
outcomes,
|
|
1047
|
-
topTopics,
|
|
1048
|
-
},
|
|
1049
|
-
channelSummaries,
|
|
1050
|
-
});
|
|
1051
|
-
}
|
|
1052
|
-
catch (error) {
|
|
1053
|
-
routesLogger.error('[memory-agent/dashboard] Error', error instanceof Error ? error : String(error));
|
|
1054
|
-
res.status(500).json({
|
|
1055
|
-
error: error instanceof Error ? error.message : String(error),
|
|
1056
|
-
});
|
|
1057
|
-
}
|
|
1058
|
-
});
|
|
1059
|
-
// ── Session API endpoints ─────────────────────────────────────────────
|
|
1060
|
-
apiServer.app.get('/api/sessions/last-active', auth_middleware_js_1.requireAuth, async (_req, res) => {
|
|
1061
|
-
try {
|
|
1062
|
-
const sessions = messageRouter.listSessions('viewer');
|
|
1063
|
-
if (sessions.length === 0) {
|
|
1064
|
-
res.json({ session: null });
|
|
1065
|
-
return;
|
|
1066
|
-
}
|
|
1067
|
-
const sorted = sessions.sort((a, b) => b.lastActive - a.lastActive);
|
|
1068
|
-
res.json({ session: sorted[0] });
|
|
1069
|
-
}
|
|
1070
|
-
catch (error) {
|
|
1071
|
-
console.error('[Sessions API] Error:', error);
|
|
1072
|
-
res.status(500).json({ error: error instanceof Error ? error.message : String(error) });
|
|
1073
|
-
}
|
|
1074
|
-
});
|
|
1075
|
-
apiServer.app.get('/api/sessions', auth_middleware_js_1.requireAuth, async (_req, res) => {
|
|
1076
|
-
try {
|
|
1077
|
-
const viewerSessions = messageRouter.listSessions('viewer');
|
|
1078
|
-
const discordSessions = messageRouter.listSessions('discord');
|
|
1079
|
-
const telegramSessions = messageRouter.listSessions('telegram');
|
|
1080
|
-
const slackSessions = messageRouter.listSessions('slack');
|
|
1081
|
-
res.json({
|
|
1082
|
-
viewer: viewerSessions,
|
|
1083
|
-
discord: discordSessions,
|
|
1084
|
-
telegram: telegramSessions,
|
|
1085
|
-
slack: slackSessions,
|
|
1086
|
-
});
|
|
1087
|
-
}
|
|
1088
|
-
catch (error) {
|
|
1089
|
-
console.error('[Sessions API] Error:', error);
|
|
1090
|
-
res.status(500).json({ error: error instanceof Error ? error.message : String(error) });
|
|
1091
|
-
}
|
|
1092
|
-
});
|
|
1093
|
-
registerKagemushaTaskRoute(apiServer.app, apiServer.privateConnectorPolicy);
|
|
1094
|
-
// ── Agent Notices endpoint ────────────────────────────────────────────
|
|
1095
|
-
apiServer.app.get('/api/agent-notices', auth_middleware_js_1.requireAuth, async (_req, res) => {
|
|
1096
|
-
try {
|
|
1097
|
-
const limit = Number(_req.query.limit) || 20;
|
|
1098
|
-
const notices = eventBus.getRecentNotices(limit);
|
|
1099
|
-
res.json({
|
|
1100
|
-
success: true,
|
|
1101
|
-
notices: notices.map((n) => ({
|
|
1102
|
-
agent: n.agent,
|
|
1103
|
-
action: n.action,
|
|
1104
|
-
target: n.target,
|
|
1105
|
-
timestamp: new Date(n.timestamp).toISOString(),
|
|
1106
|
-
})),
|
|
1107
|
-
total: notices.length,
|
|
1108
|
-
});
|
|
1109
|
-
}
|
|
1110
|
-
catch (error) {
|
|
1111
|
-
res.status(500).json({
|
|
1112
|
-
success: false,
|
|
1113
|
-
error: error instanceof Error ? error.message : String(error),
|
|
1114
|
-
});
|
|
1115
|
-
}
|
|
1116
|
-
});
|
|
1117
|
-
// ── Discord send endpoint ─────────────────────────────────────────────
|
|
1118
|
-
apiServer.app.post('/api/discord/send', auth_middleware_js_1.requireAuth, async (req, res) => {
|
|
1119
|
-
try {
|
|
1120
|
-
const { channelId, message } = req.body;
|
|
1121
|
-
if (!channelId || !message) {
|
|
1122
|
-
res.status(400).json({ error: 'channelId and message are required' });
|
|
1123
|
-
return;
|
|
1124
|
-
}
|
|
1125
|
-
if (!discordGateway) {
|
|
1126
|
-
res.status(503).json({ error: 'Discord gateway not connected' });
|
|
1127
|
-
return;
|
|
1128
|
-
}
|
|
1129
|
-
console.log(`[Discord Send] Sending to ${channelId}: ${message.substring(0, 50)}...`);
|
|
1130
|
-
await discordGateway.sendMessage(channelId, message);
|
|
1131
|
-
console.log(`[Discord Send] Success`);
|
|
1132
|
-
res.json({ success: true });
|
|
1133
|
-
}
|
|
1134
|
-
catch (error) {
|
|
1135
|
-
console.error('[Discord Send] Error:', error);
|
|
1136
|
-
res.status(500).json({ error: error instanceof Error ? error.message : String(error) });
|
|
1137
|
-
}
|
|
1138
|
-
});
|
|
1139
|
-
// ── Slack send endpoint ───────────────────────────────────────────────
|
|
1140
|
-
apiServer.app.post('/api/slack/send', auth_middleware_js_1.requireAuth, async (req, res) => {
|
|
1141
|
-
try {
|
|
1142
|
-
const { channelId, message, filePath, caption } = req.body;
|
|
1143
|
-
if (!channelId || (!message && !filePath)) {
|
|
1144
|
-
res.status(400).json({ error: 'channelId and (message or filePath) are required' });
|
|
1145
|
-
return;
|
|
1146
|
-
}
|
|
1147
|
-
if (!slackGateway) {
|
|
1148
|
-
res.status(503).json({ error: 'Slack gateway not connected' });
|
|
1149
|
-
return;
|
|
1150
|
-
}
|
|
1151
|
-
if (filePath) {
|
|
1152
|
-
// SECURITY: Path traversal prevention (same pattern as /api/discord/image)
|
|
1153
|
-
const fsMod = await import('fs/promises');
|
|
1154
|
-
const workspacePath = config.workspace?.path?.replace('~', process.env.HOME || '') ||
|
|
1155
|
-
`${process.env.HOME}/.mama/workspace`;
|
|
1156
|
-
const tempPath = node_path_1.default.join(workspacePath, 'temp');
|
|
1157
|
-
const tmpPath = '/tmp';
|
|
1158
|
-
const resolvedFilePath = node_path_1.default.isAbsolute(filePath)
|
|
1159
|
-
? node_path_1.default.resolve(filePath)
|
|
1160
|
-
: node_path_1.default.resolve(workspacePath, filePath);
|
|
1161
|
-
const normalizedWorkspace = node_path_1.default.resolve(workspacePath);
|
|
1162
|
-
const normalizedTemp = node_path_1.default.resolve(tempPath);
|
|
1163
|
-
const isInWorkspace = resolvedFilePath.startsWith(normalizedWorkspace + node_path_1.default.sep);
|
|
1164
|
-
const isInTemp = resolvedFilePath.startsWith(normalizedTemp + node_path_1.default.sep);
|
|
1165
|
-
const isInTmp = resolvedFilePath.startsWith(tmpPath + '/');
|
|
1166
|
-
if (!isInWorkspace && !isInTemp && !isInTmp) {
|
|
1167
|
-
console.warn(`[Slack Send] SECURITY: Path traversal blocked: ${filePath} -> ${resolvedFilePath}`);
|
|
1168
|
-
res
|
|
1169
|
-
.status(400)
|
|
1170
|
-
.json({ error: 'File path must be within workspace, workspace/temp, or /tmp' });
|
|
1171
|
-
return;
|
|
1172
|
-
}
|
|
1173
|
-
// Block sensitive file types
|
|
1174
|
-
const deniedExtensions = ['.db', '.key', '.pem', '.env', '.sqlite', '.sqlite3'];
|
|
1175
|
-
const ext = node_path_1.default.extname(resolvedFilePath).toLowerCase();
|
|
1176
|
-
if (deniedExtensions.includes(ext)) {
|
|
1177
|
-
console.warn(`[Slack Send] SECURITY: Denied file type blocked: ${ext}`);
|
|
1178
|
-
res.status(400).json({ error: 'File type not allowed' });
|
|
1179
|
-
return;
|
|
1180
|
-
}
|
|
1181
|
-
try {
|
|
1182
|
-
await fsMod.access(resolvedFilePath);
|
|
1183
|
-
}
|
|
1184
|
-
catch {
|
|
1185
|
-
res.status(404).json({ error: 'File not found' });
|
|
1186
|
-
return;
|
|
1187
|
-
}
|
|
1188
|
-
console.log(`[Slack Send] Sending file to ${channelId}: ${resolvedFilePath}`);
|
|
1189
|
-
await slackGateway.sendFile(channelId, resolvedFilePath, caption);
|
|
1190
|
-
}
|
|
1191
|
-
if (message) {
|
|
1192
|
-
console.log(`[Slack Send] Sending to ${channelId}: ${message.substring(0, 50)}...`);
|
|
1193
|
-
await slackGateway.sendMessage(channelId, message);
|
|
1194
|
-
}
|
|
1195
|
-
console.log(`[Slack Send] Success`);
|
|
1196
|
-
res.json({ success: true });
|
|
1197
|
-
}
|
|
1198
|
-
catch (error) {
|
|
1199
|
-
console.error('[Slack Send] Error:', error);
|
|
1200
|
-
res.status(500).json({ error: error instanceof Error ? error.message : String(error) });
|
|
1201
|
-
}
|
|
1202
|
-
});
|
|
1203
|
-
// Legacy model-and-send endpoints are retired. They accepted an arbitrary
|
|
1204
|
-
// destination without the delivery ledger, so retries could duplicate output.
|
|
1205
|
-
for (const retiredPath of ['/api/discord/cron', '/api/report']) {
|
|
1206
|
-
apiServer.app.post(retiredPath, auth_middleware_js_1.requireAuth, (_req, res) => {
|
|
1207
|
-
res.status(410).json({
|
|
1208
|
-
error: 'Legacy model-and-send endpoint retired; use the owner runtime and receipted delivery',
|
|
1209
|
-
});
|
|
1210
|
-
});
|
|
1211
|
-
}
|
|
1212
|
-
// ── Screenshot endpoint ───────────────────────────────────────────────
|
|
1213
|
-
apiServer.app.post('/api/screenshot', auth_middleware_js_1.requireAuth, async (req, res) => {
|
|
1214
|
-
const { spawn } = await import('child_process');
|
|
1215
|
-
try {
|
|
1216
|
-
const { channelId, htmlFile, caption } = req.body;
|
|
1217
|
-
if (!channelId || !htmlFile) {
|
|
1218
|
-
res.status(400).json({ error: 'channelId and htmlFile are required' });
|
|
1219
|
-
return;
|
|
1220
|
-
}
|
|
1221
|
-
if (!discordGateway) {
|
|
1222
|
-
res.status(503).json({ error: 'Discord gateway not connected' });
|
|
1223
|
-
return;
|
|
1224
|
-
}
|
|
1225
|
-
const workspacePath = config.workspace?.path?.replace('~', process.env.HOME || '') ||
|
|
1226
|
-
`${process.env.HOME}/.mama/workspace`;
|
|
1227
|
-
// SECURITY P0: Path traversal prevention
|
|
1228
|
-
if (node_path_1.default.isAbsolute(htmlFile)) {
|
|
1229
|
-
res.status(400).json({ error: 'Absolute paths not allowed' });
|
|
1230
|
-
return;
|
|
1231
|
-
}
|
|
1232
|
-
const resolvedPath = node_path_1.default.resolve(workspacePath, htmlFile);
|
|
1233
|
-
const normalizedWorkspace = node_path_1.default.resolve(workspacePath);
|
|
1234
|
-
if (!resolvedPath.startsWith(normalizedWorkspace + node_path_1.default.sep)) {
|
|
1235
|
-
res.status(400).json({ error: 'Path traversal detected' });
|
|
1236
|
-
return;
|
|
1237
|
-
}
|
|
1238
|
-
const fs = await import('fs/promises');
|
|
1239
|
-
try {
|
|
1240
|
-
await fs.access(resolvedPath);
|
|
1241
|
-
}
|
|
1242
|
-
catch {
|
|
1243
|
-
res.status(404).json({ error: 'File not found' });
|
|
1244
|
-
return;
|
|
1245
|
-
}
|
|
1246
|
-
const allowedExtensions = ['.html', '.htm'];
|
|
1247
|
-
if (!allowedExtensions.some((ext) => resolvedPath.toLowerCase().endsWith(ext))) {
|
|
1248
|
-
res.status(400).json({ error: 'Only HTML files allowed' });
|
|
1249
|
-
return;
|
|
1250
|
-
}
|
|
1251
|
-
const htmlPath = resolvedPath;
|
|
1252
|
-
const outputPath = `${workspacePath}/temp/screenshot-${Date.now()}.png`;
|
|
1253
|
-
console.log(`[Screenshot] Taking screenshot of: ${htmlPath}`);
|
|
1254
|
-
// SECURITY P0: never shell out. Use spawn with args to avoid injection.
|
|
1255
|
-
await new Promise((resolve, reject) => {
|
|
1256
|
-
const child = spawn('node', [`${workspacePath}/scripts/html-screenshot.mjs`, htmlPath, outputPath], {
|
|
1257
|
-
cwd: workspacePath,
|
|
1258
|
-
stdio: 'ignore',
|
|
1259
|
-
});
|
|
1260
|
-
let settled = false;
|
|
1261
|
-
const timeoutId = setTimeout(() => {
|
|
1262
|
-
if (settled)
|
|
1263
|
-
return;
|
|
1264
|
-
settled = true;
|
|
1265
|
-
child.kill('SIGKILL');
|
|
1266
|
-
reject(new Error('Screenshot script timed out after 30000ms'));
|
|
1267
|
-
}, 30000);
|
|
1268
|
-
child.on('error', (err) => {
|
|
1269
|
-
clearTimeout(timeoutId);
|
|
1270
|
-
if (settled)
|
|
1271
|
-
return;
|
|
1272
|
-
settled = true;
|
|
1273
|
-
reject(err);
|
|
1274
|
-
});
|
|
1275
|
-
child.on('exit', (code, signal) => {
|
|
1276
|
-
clearTimeout(timeoutId);
|
|
1277
|
-
if (settled)
|
|
1278
|
-
return;
|
|
1279
|
-
settled = true;
|
|
1280
|
-
if (code === 0) {
|
|
1281
|
-
resolve();
|
|
1282
|
-
return;
|
|
1283
|
-
}
|
|
1284
|
-
reject(new Error(`Screenshot script failed: code=${code ?? 'null'} signal=${signal ?? 'null'}`));
|
|
1285
|
-
});
|
|
1286
|
-
});
|
|
1287
|
-
// Send to Discord
|
|
1288
|
-
console.log(`[Screenshot] Sending to Discord: ${outputPath}`);
|
|
1289
|
-
await discordGateway.sendFile(channelId, outputPath, caption);
|
|
1290
|
-
console.log('[Screenshot] Complete');
|
|
1291
|
-
res.json({ success: true, screenshot: outputPath });
|
|
1292
|
-
}
|
|
1293
|
-
catch (error) {
|
|
1294
|
-
console.error('[Screenshot] Error:', error);
|
|
1295
|
-
res.status(500).json({ error: error instanceof Error ? error.message : String(error) });
|
|
1296
|
-
}
|
|
1297
|
-
});
|
|
1298
|
-
// ── Discord image endpoint (4-layer path validation) ──────────────────
|
|
1299
|
-
apiServer.app.post('/api/discord/image', auth_middleware_js_1.requireAuth, async (req, res) => {
|
|
1300
|
-
const fs = await import('fs/promises');
|
|
1301
|
-
try {
|
|
1302
|
-
const { channelId, imagePath, caption } = req.body;
|
|
1303
|
-
if (!channelId || !imagePath) {
|
|
1304
|
-
res.status(400).json({ error: 'channelId and imagePath are required' });
|
|
1305
|
-
return;
|
|
1306
|
-
}
|
|
1307
|
-
if (!discordGateway) {
|
|
1308
|
-
res.status(503).json({ error: 'Discord gateway not connected' });
|
|
1309
|
-
return;
|
|
1310
|
-
}
|
|
1311
|
-
// SECURITY P0: 4-layer path validation
|
|
1312
|
-
const workspacePath = config.workspace?.path?.replace('~', process.env.HOME || '') ||
|
|
1313
|
-
`${process.env.HOME}/.mama/workspace`;
|
|
1314
|
-
const tempPath = node_path_1.default.join(workspacePath, 'temp');
|
|
1315
|
-
const tmpPath = '/tmp';
|
|
1316
|
-
// Layer 1: Reject absolute paths (unless in allowed directories)
|
|
1317
|
-
if (node_path_1.default.isAbsolute(imagePath)) {
|
|
1318
|
-
const normalizedInput = node_path_1.default.normalize(imagePath);
|
|
1319
|
-
const isInWorkspace = normalizedInput.startsWith(node_path_1.default.resolve(workspacePath) + node_path_1.default.sep);
|
|
1320
|
-
const isInTemp = normalizedInput.startsWith(node_path_1.default.resolve(tempPath) + node_path_1.default.sep);
|
|
1321
|
-
const isInTmp = normalizedInput.startsWith(tmpPath + node_path_1.default.sep);
|
|
1322
|
-
if (!isInWorkspace && !isInTemp && !isInTmp) {
|
|
1323
|
-
console.warn(`[Discord Image] SECURITY: Absolute path blocked: ${imagePath}`);
|
|
1324
|
-
res
|
|
1325
|
-
.status(400)
|
|
1326
|
-
.json({ error: 'Absolute paths only allowed in workspace, workspace/temp, or /tmp' });
|
|
1327
|
-
return;
|
|
1328
|
-
}
|
|
1329
|
-
}
|
|
1330
|
-
// Layer 2: Resolve and verify within allowed directories
|
|
1331
|
-
const resolvedImagePath = node_path_1.default.isAbsolute(imagePath)
|
|
1332
|
-
? node_path_1.default.resolve(imagePath)
|
|
1333
|
-
: node_path_1.default.resolve(workspacePath, imagePath);
|
|
1334
|
-
const normalizedWorkspace = node_path_1.default.resolve(workspacePath);
|
|
1335
|
-
const normalizedTemp = node_path_1.default.resolve(tempPath);
|
|
1336
|
-
const isInWorkspace = resolvedImagePath.startsWith(normalizedWorkspace + node_path_1.default.sep);
|
|
1337
|
-
const isInTemp = resolvedImagePath.startsWith(normalizedTemp + node_path_1.default.sep);
|
|
1338
|
-
const isInTmp = resolvedImagePath.startsWith(tmpPath + node_path_1.default.sep);
|
|
1339
|
-
if (!isInWorkspace && !isInTemp && !isInTmp) {
|
|
1340
|
-
console.warn(`[Discord Image] SECURITY: Path traversal blocked: ${imagePath} -> ${resolvedImagePath}`);
|
|
1341
|
-
res.status(400).json({ error: 'Path traversal detected' });
|
|
1342
|
-
return;
|
|
1343
|
-
}
|
|
1344
|
-
// Layer 3: Verify file exists
|
|
1345
|
-
try {
|
|
1346
|
-
await fs.access(resolvedImagePath);
|
|
1347
|
-
}
|
|
1348
|
-
catch {
|
|
1349
|
-
res.status(404).json({ error: 'Image file not found' });
|
|
1350
|
-
return;
|
|
1351
|
-
}
|
|
1352
|
-
// Layer 4: Whitelist extensions
|
|
1353
|
-
const allowedExtensions = ['.png', '.jpg', '.jpeg', '.gif', '.webp'];
|
|
1354
|
-
if (!allowedExtensions.some((ext) => resolvedImagePath.toLowerCase().endsWith(ext))) {
|
|
1355
|
-
console.warn(`[Discord Image] SECURITY: Invalid extension blocked: ${resolvedImagePath}`);
|
|
1356
|
-
res
|
|
1357
|
-
.status(400)
|
|
1358
|
-
.json({ error: 'Only image files allowed (.png, .jpg, .jpeg, .gif, .webp)' });
|
|
1359
|
-
return;
|
|
1360
|
-
}
|
|
1361
|
-
console.log(`[Discord Image] Sending: ${resolvedImagePath}`);
|
|
1362
|
-
await discordGateway.sendFile(channelId, resolvedImagePath, caption);
|
|
1363
|
-
console.log('[Discord Image] Complete');
|
|
1364
|
-
res.json({ success: true });
|
|
1365
|
-
}
|
|
1366
|
-
catch (error) {
|
|
1367
|
-
console.error('[Discord Image] Error:', error);
|
|
1368
|
-
res.status(500).json({ error: error instanceof Error ? error.message : String(error) });
|
|
1369
|
-
}
|
|
1370
|
-
});
|
|
1371
|
-
// ── Upload / download media endpoints ─────────────────────────────────
|
|
1372
|
-
apiServer.app.use('/api', (0, upload_handler_js_1.createUploadRouter)());
|
|
1373
|
-
// ── Auth gate for /graph/* write endpoints ────────────────────────────
|
|
1374
|
-
apiServer.app.use('/graph', (req, res, next) => {
|
|
1375
|
-
const isRead = req.method === 'GET' || req.method === 'HEAD';
|
|
1376
|
-
if (!isRead && !(0, auth_middleware_js_1.isAuthenticated)(req)) {
|
|
1377
|
-
(0, auth_middleware_js_1.logUnauthorizedAttempt)(req);
|
|
1378
|
-
res.status(401).json({
|
|
1379
|
-
error: true,
|
|
1380
|
-
code: 'UNAUTHORIZED',
|
|
1381
|
-
message: 'Authentication required.',
|
|
1382
|
-
});
|
|
1383
|
-
return;
|
|
1384
|
-
}
|
|
1385
|
-
next();
|
|
1386
|
-
});
|
|
1387
|
-
// ── Graph handler middleware ───────────────────────────────────────────
|
|
1388
|
-
apiServer.app.use(async (req, res, next) => {
|
|
1389
|
-
const handled = await graphHandler(req, res);
|
|
1390
|
-
if (!handled)
|
|
1391
|
-
next();
|
|
1392
|
-
});
|
|
1393
|
-
// ── Session proxy middleware ───────────────────────────────────────────
|
|
1394
|
-
apiServer.app.use((req, res, next) => {
|
|
1395
|
-
if (req.path.startsWith('/api/session')) {
|
|
1396
|
-
const bodyData = req.body ? JSON.stringify(req.body) : '';
|
|
1397
|
-
const options = {
|
|
1398
|
-
hostname: 'localhost',
|
|
1399
|
-
port: utilities_js_1.EMBEDDING_PORT,
|
|
1400
|
-
path: req.url,
|
|
1401
|
-
method: req.method,
|
|
1402
|
-
headers: {
|
|
1403
|
-
...req.headers,
|
|
1404
|
-
host: `localhost:${utilities_js_1.EMBEDDING_PORT}`,
|
|
1405
|
-
'content-length': Buffer.byteLength(bodyData),
|
|
1406
|
-
},
|
|
1407
|
-
};
|
|
1408
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1409
|
-
const proxy = node_http_1.default.request(options, (proxyRes) => {
|
|
1410
|
-
res.writeHead(proxyRes.statusCode, proxyRes.headers);
|
|
1411
|
-
proxyRes.pipe(res, { end: true });
|
|
1412
|
-
});
|
|
1413
|
-
if (bodyData) {
|
|
1414
|
-
proxy.write(bodyData);
|
|
1415
|
-
}
|
|
1416
|
-
proxy.end();
|
|
1417
|
-
proxy.on('error', (error) => {
|
|
1418
|
-
if (!res.headersSent) {
|
|
1419
|
-
res.status(500).json({ error: 'Failed to proxy session API', details: error.message });
|
|
1420
|
-
}
|
|
1421
|
-
});
|
|
1422
|
-
}
|
|
1423
|
-
else {
|
|
1424
|
-
next();
|
|
1425
|
-
}
|
|
1426
|
-
});
|
|
1427
|
-
console.log(`✓ Session API proxied to port ${utilities_js_1.EMBEDDING_PORT}`);
|
|
1428
|
-
// ── Daemon Log API ────────────────────────────────────────────────────
|
|
1429
|
-
apiServer.app.get('/api/logs/daemon', auth_middleware_js_1.requireAuth, (req, res) => {
|
|
1430
|
-
const logPath = node_path_1.default.join((0, node_os_1.homedir)(), '.mama', 'logs', 'daemon.log');
|
|
1431
|
-
if (!(0, node_fs_1.existsSync)(logPath)) {
|
|
1432
|
-
res.status(404).json({ error: 'daemon.log not found' });
|
|
1433
|
-
return;
|
|
1434
|
-
}
|
|
1435
|
-
try {
|
|
1436
|
-
const stat = (0, node_fs_1.statSync)(logPath);
|
|
1437
|
-
const since = parseInt(req.query.since, 10) || 0;
|
|
1438
|
-
if (since > 0 && stat.mtimeMs <= since) {
|
|
1439
|
-
res.status(304).end();
|
|
1440
|
-
return;
|
|
1441
|
-
}
|
|
1442
|
-
const requestedTail = parseInt(req.query.tail, 10);
|
|
1443
|
-
const tail = Math.min(Math.max(isNaN(requestedTail) ? 200 : requestedTail, 1), 5000);
|
|
1444
|
-
const chunkSize = Math.min(stat.size, tail * 300);
|
|
1445
|
-
const buffer = Buffer.alloc(chunkSize);
|
|
1446
|
-
const fd = (0, node_fs_1.openSync)(logPath, 'r');
|
|
1447
|
-
try {
|
|
1448
|
-
(0, node_fs_1.readSync)(fd, buffer, 0, chunkSize, Math.max(0, stat.size - chunkSize));
|
|
1449
|
-
}
|
|
1450
|
-
finally {
|
|
1451
|
-
(0, node_fs_1.closeSync)(fd);
|
|
1452
|
-
}
|
|
1453
|
-
const raw = buffer.toString('utf-8');
|
|
1454
|
-
const allLines = raw.split('\n').filter((l) => l.trim());
|
|
1455
|
-
const lines = allLines.slice(-tail);
|
|
1456
|
-
const isFullFile = chunkSize >= stat.size;
|
|
1457
|
-
res.json({
|
|
1458
|
-
lines,
|
|
1459
|
-
total: isFullFile ? allLines.length : undefined,
|
|
1460
|
-
totalBytes: stat.size,
|
|
1461
|
-
mtime: stat.mtimeMs,
|
|
1462
|
-
truncated: !isFullFile,
|
|
1463
|
-
});
|
|
1464
|
-
}
|
|
1465
|
-
catch (err) {
|
|
1466
|
-
res.status(500).json({ error: err instanceof Error ? err.message : String(err) });
|
|
1467
|
-
}
|
|
1468
|
-
});
|
|
1469
|
-
// ── Workspace skills API ──────────────────────────────────────────────
|
|
1470
|
-
const skillsWorkDir = node_path_1.default.join((0, node_os_1.homedir)(), '.mama', 'workspace', 'skills');
|
|
1471
|
-
apiServer.app.get('/api/workspace/skills', auth_middleware_js_1.requireAuth, (_req, res) => {
|
|
1472
|
-
try {
|
|
1473
|
-
if (!(0, node_fs_1.existsSync)(skillsWorkDir)) {
|
|
1474
|
-
res.json({ skills: [] });
|
|
1475
|
-
return;
|
|
1476
|
-
}
|
|
1477
|
-
const dirs = (0, node_fs_1.readdirSync)(skillsWorkDir, { withFileTypes: true })
|
|
1478
|
-
.filter((d) => d.isDirectory())
|
|
1479
|
-
.map((d) => {
|
|
1480
|
-
const mdPath = node_path_1.default.join(skillsWorkDir, d.name, 'SKILL.md');
|
|
1481
|
-
const exists = (0, node_fs_1.existsSync)(mdPath);
|
|
1482
|
-
return { id: d.name, exists };
|
|
1483
|
-
})
|
|
1484
|
-
.filter((s) => s.exists)
|
|
1485
|
-
.map(({ id }) => ({ id }));
|
|
1486
|
-
res.json({ skills: dirs });
|
|
1487
|
-
}
|
|
1488
|
-
catch (err) {
|
|
1489
|
-
console.warn('[GET /api/workspace/skills] Failed to read skills directory (non-fatal):', err);
|
|
1490
|
-
res.json({ skills: [] });
|
|
1491
|
-
}
|
|
1492
|
-
});
|
|
1493
|
-
apiServer.app.get('/api/workspace/skills/:name/content', auth_middleware_js_1.requireAuth, (req, res) => {
|
|
1494
|
-
const name = req.params.name;
|
|
1495
|
-
if (!name || /[^a-zA-Z0-9_-]/.test(name)) {
|
|
1496
|
-
res.status(400).json({ error: 'Invalid skill name' });
|
|
1497
|
-
return;
|
|
1498
|
-
}
|
|
1499
|
-
const mdPath = node_path_1.default.join(skillsWorkDir, name, 'SKILL.md');
|
|
1500
|
-
try {
|
|
1501
|
-
if (!(0, node_fs_1.existsSync)(mdPath)) {
|
|
1502
|
-
res.status(404).json({ error: 'Skill not found' });
|
|
1503
|
-
return;
|
|
1504
|
-
}
|
|
1505
|
-
const content = (0, node_fs_1.readFileSync)(mdPath, 'utf-8');
|
|
1506
|
-
res.json({ content });
|
|
1507
|
-
}
|
|
1508
|
-
catch (err) {
|
|
1509
|
-
routesLogger.warn('[GET /api/workspace/skills/:name/content] Failed to read skill:', err);
|
|
1510
|
-
res.status(500).json({ error: 'Failed to read skill content' });
|
|
1511
|
-
}
|
|
1512
|
-
});
|
|
1513
|
-
console.log('✓ Workspace Skills API available at /api/workspace/skills');
|
|
1514
|
-
// ── Viewer static assets ──────────────────────────────────────────────
|
|
1515
|
-
const publicDir = node_path_1.default.join(__dirname, '..', '..', '..', 'public');
|
|
1516
|
-
apiServer.app.use(express_1.default.static(publicDir, {
|
|
1517
|
-
setHeaders: (res, _filePath) => {
|
|
1518
|
-
res.setHeader('Cache-Control', 'no-cache, no-store, must-revalidate');
|
|
1519
|
-
res.setHeader('Pragma', 'no-cache');
|
|
1520
|
-
res.setHeader('Expires', '0');
|
|
1521
|
-
},
|
|
1522
|
-
}));
|
|
1523
|
-
console.log('✓ Viewer UI available at /viewer');
|
|
1524
|
-
return {
|
|
1525
|
-
boardReconcileEnabled,
|
|
1526
|
-
requestBoardRepair,
|
|
1527
|
-
stop: () => {
|
|
1528
|
-
if (boardBootTimeout)
|
|
1529
|
-
clearTimeout(boardBootTimeout);
|
|
1530
|
-
boardBootTimeout = null;
|
|
1531
|
-
if (boardInterval)
|
|
1532
|
-
clearInterval(boardInterval);
|
|
1533
|
-
boardInterval = null;
|
|
1534
|
-
if (wikiContinuityInterval)
|
|
1535
|
-
clearInterval(wikiContinuityInterval);
|
|
1536
|
-
wikiContinuityInterval = null;
|
|
1537
|
-
boardReconcileScheduler?.stop();
|
|
1538
|
-
boardReconcileScheduler = null;
|
|
1539
|
-
},
|
|
1540
|
-
};
|
|
1541
|
-
}
|
|
1542
|
-
//# sourceMappingURL=api-routes-init.js.map
|