@geminixiang/mikan 1.0.0-beta.45 → 1.0.0-beta.46
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 +26 -0
- package/README.md +12 -19
- package/dist/adapter.d.ts +1 -1
- package/dist/adapter.d.ts.map +1 -1
- package/dist/adapter.js.map +1 -1
- package/dist/adapters/discord/bot.d.ts +3 -1
- package/dist/adapters/discord/bot.d.ts.map +1 -1
- package/dist/adapters/discord/bot.js +143 -141
- package/dist/adapters/discord/bot.js.map +1 -1
- package/dist/adapters/discord/context.d.ts +2 -8
- package/dist/adapters/discord/context.d.ts.map +1 -1
- package/dist/adapters/discord/context.js +1 -1
- package/dist/adapters/discord/context.js.map +1 -1
- package/dist/adapters/discord/format.d.ts.map +1 -1
- package/dist/adapters/discord/format.js +2 -4
- package/dist/adapters/discord/format.js.map +1 -1
- package/dist/adapters/github/bot.d.ts.map +1 -1
- package/dist/adapters/github/bot.js +1 -4
- package/dist/adapters/github/bot.js.map +1 -1
- package/dist/adapters/github/context.d.ts +2 -9
- package/dist/adapters/github/context.d.ts.map +1 -1
- package/dist/adapters/github/context.js.map +1 -1
- package/dist/adapters/github/github-ops.d.ts +4 -17
- package/dist/adapters/github/github-ops.d.ts.map +1 -1
- package/dist/adapters/github/github-ops.js +17 -86
- package/dist/adapters/github/github-ops.js.map +1 -1
- package/dist/adapters/github/tool-pack.d.ts.map +1 -1
- package/dist/adapters/github/tool-pack.js +0 -1
- package/dist/adapters/github/tool-pack.js.map +1 -1
- package/dist/adapters/github/tools/checks.d.ts +0 -1
- package/dist/adapters/github/tools/checks.d.ts.map +1 -1
- package/dist/adapters/github/tools/checks.js +3 -22
- package/dist/adapters/github/tools/checks.js.map +1 -1
- package/dist/adapters/github/types.d.ts +0 -33
- package/dist/adapters/github/types.d.ts.map +1 -1
- package/dist/adapters/github/types.js.map +1 -1
- package/dist/adapters/progressive-renderer.d.ts.map +1 -1
- package/dist/adapters/progressive-renderer.js +311 -318
- package/dist/adapters/progressive-renderer.js.map +1 -1
- package/dist/adapters/slack/blocks.d.ts.map +1 -1
- package/dist/adapters/slack/blocks.js +1 -4
- package/dist/adapters/slack/blocks.js.map +1 -1
- package/dist/adapters/slack/bot.d.ts +12 -0
- package/dist/adapters/slack/bot.d.ts.map +1 -1
- package/dist/adapters/slack/bot.js +158 -178
- package/dist/adapters/slack/bot.js.map +1 -1
- package/dist/adapters/slack/context.d.ts +2 -8
- package/dist/adapters/slack/context.d.ts.map +1 -1
- package/dist/adapters/slack/context.js +1 -1
- package/dist/adapters/slack/context.js.map +1 -1
- package/dist/adapters/slack/response-lifecycle.d.ts.map +1 -1
- package/dist/adapters/slack/response-lifecycle.js +135 -123
- package/dist/adapters/slack/response-lifecycle.js.map +1 -1
- package/dist/adapters/slack/stream-limits.d.ts +1 -1
- package/dist/adapters/slack/stream-limits.js +1 -1
- package/dist/adapters/slack/stream-limits.js.map +1 -1
- package/dist/adapters/slack/types.d.ts +4 -0
- package/dist/adapters/slack/types.d.ts.map +1 -1
- package/dist/adapters/slack/types.js.map +1 -1
- package/dist/adapters/telegram/context.d.ts +2 -8
- package/dist/adapters/telegram/context.d.ts.map +1 -1
- package/dist/adapters/telegram/context.js +1 -2
- package/dist/adapters/telegram/context.js.map +1 -1
- package/dist/adapters/types.d.ts +11 -5
- package/dist/adapters/types.d.ts.map +1 -1
- package/dist/adapters/types.js.map +1 -1
- package/dist/agent/catalog.d.ts +6 -18
- package/dist/agent/catalog.d.ts.map +1 -1
- package/dist/agent/catalog.js +19 -155
- package/dist/agent/catalog.js.map +1 -1
- package/dist/agent/execution.d.ts +0 -7
- package/dist/agent/execution.d.ts.map +1 -1
- package/dist/agent/execution.js +23 -21
- package/dist/agent/execution.js.map +1 -1
- package/dist/agent/presenter.d.ts +7 -9
- package/dist/agent/presenter.d.ts.map +1 -1
- package/dist/agent/presenter.js +355 -357
- package/dist/agent/presenter.js.map +1 -1
- package/dist/agent/prompt.d.ts +5 -12
- package/dist/agent/prompt.d.ts.map +1 -1
- package/dist/agent/prompt.js +56 -81
- package/dist/agent/prompt.js.map +1 -1
- package/dist/agent/runner.d.ts +0 -7
- package/dist/agent/runner.d.ts.map +1 -1
- package/dist/agent/runner.js +255 -308
- package/dist/agent/runner.js.map +1 -1
- package/dist/agent/types.d.ts +21 -17
- package/dist/agent/types.d.ts.map +1 -1
- package/dist/agent/types.js +0 -1
- package/dist/agent/types.js.map +1 -1
- package/dist/cli/boot.d.ts.map +1 -1
- package/dist/cli/boot.js +7 -10
- package/dist/cli/boot.js.map +1 -1
- package/dist/cli/onboard.d.ts +10 -0
- package/dist/cli/onboard.d.ts.map +1 -0
- package/dist/cli/onboard.js +237 -0
- package/dist/cli/onboard.js.map +1 -0
- package/dist/cli/types.d.ts +8 -3
- package/dist/cli/types.d.ts.map +1 -1
- package/dist/cli/types.js.map +1 -1
- package/dist/commands/auto-reply.d.ts.map +1 -1
- package/dist/commands/auto-reply.js +5 -12
- package/dist/commands/auto-reply.js.map +1 -1
- package/dist/commands/manifest.d.ts.map +1 -1
- package/dist/commands/manifest.js +9 -16
- package/dist/commands/manifest.js.map +1 -1
- package/dist/commands/new.d.ts.map +1 -1
- package/dist/commands/new.js +15 -10
- package/dist/commands/new.js.map +1 -1
- package/dist/commands/registry.d.ts.map +1 -1
- package/dist/commands/registry.js +0 -2
- package/dist/commands/registry.js.map +1 -1
- package/dist/commands/sandbox.d.ts.map +1 -1
- package/dist/commands/sandbox.js +89 -70
- package/dist/commands/sandbox.js.map +1 -1
- package/dist/commands/session-view.js +9 -2
- package/dist/commands/session-view.js.map +1 -1
- package/dist/commands/types.d.ts +4 -3
- package/dist/commands/types.d.ts.map +1 -1
- package/dist/commands/types.js.map +1 -1
- package/dist/config.d.ts +13 -17
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +39 -37
- package/dist/config.js.map +1 -1
- package/dist/dream/index.d.ts +20 -0
- package/dist/dream/index.d.ts.map +1 -0
- package/dist/dream/index.js +253 -0
- package/dist/dream/index.js.map +1 -0
- package/dist/dream/types.d.ts +30 -0
- package/dist/dream/types.d.ts.map +1 -0
- package/dist/dream/types.js.map +1 -0
- package/dist/env-manifest.d.ts.map +1 -1
- package/dist/env-manifest.js +2 -34
- package/dist/env-manifest.js.map +1 -1
- package/dist/execution-resolver.d.ts +9 -2
- package/dist/execution-resolver.d.ts.map +1 -1
- package/dist/execution-resolver.js +26 -27
- package/dist/execution-resolver.js.map +1 -1
- package/dist/harness/event-format.d.ts +1 -2
- package/dist/harness/event-format.d.ts.map +1 -1
- package/dist/harness/event-format.js +9 -15
- package/dist/harness/event-format.js.map +1 -1
- package/dist/harness/index.d.ts +1 -7
- package/dist/harness/index.d.ts.map +1 -1
- package/dist/harness/index.js +0 -4
- package/dist/harness/index.js.map +1 -1
- package/dist/harness/models.d.ts.map +1 -1
- package/dist/harness/models.js +15 -35
- package/dist/harness/models.js.map +1 -1
- package/dist/harness/runner.d.ts +7 -16
- package/dist/harness/runner.d.ts.map +1 -1
- package/dist/harness/runner.js +13 -131
- package/dist/harness/runner.js.map +1 -1
- package/dist/harness/session-store.d.ts +1 -1
- package/dist/harness/session-store.d.ts.map +1 -1
- package/dist/harness/session-store.js +1 -1
- package/dist/harness/session-store.js.map +1 -1
- package/dist/harness/subagent-runner.d.ts +2 -2
- package/dist/harness/subagent-runner.d.ts.map +1 -1
- package/dist/harness/subagent-runner.js +157 -162
- package/dist/harness/subagent-runner.js.map +1 -1
- package/dist/harness/types.d.ts +1 -13
- package/dist/harness/types.d.ts.map +1 -1
- package/dist/harness/types.js.map +1 -1
- package/dist/index.d.ts +3 -9
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -5
- package/dist/index.js.map +1 -1
- package/dist/main.js +31 -212
- package/dist/main.js.map +1 -1
- package/dist/mcp/catalog.d.ts +5 -0
- package/dist/mcp/catalog.d.ts.map +1 -0
- package/dist/mcp/catalog.js +135 -0
- package/dist/mcp/catalog.js.map +1 -0
- package/dist/mcp/loader.d.ts.map +1 -1
- package/dist/mcp/loader.js +3 -6
- package/dist/mcp/loader.js.map +1 -1
- package/dist/mcp/types.d.ts +22 -0
- package/dist/mcp/types.d.ts.map +1 -1
- package/dist/mcp/types.js.map +1 -1
- package/dist/office/index.d.ts +136 -8
- package/dist/office/index.d.ts.map +1 -1
- package/dist/office/index.js +1050 -9
- package/dist/office/index.js.map +1 -1
- package/dist/office/types.d.ts +19 -1
- package/dist/office/types.d.ts.map +1 -1
- package/dist/office/types.js.map +1 -1
- package/dist/packages/index.d.ts +168 -5
- package/dist/packages/index.d.ts.map +1 -1
- package/dist/packages/index.js +749 -5
- package/dist/packages/index.js.map +1 -1
- package/dist/packages/types.d.ts +1 -5
- package/dist/packages/types.d.ts.map +1 -1
- package/dist/packages/types.js.map +1 -1
- package/dist/provisioner.d.ts +2 -9
- package/dist/provisioner.d.ts.map +1 -1
- package/dist/provisioner.js +3 -12
- package/dist/provisioner.js.map +1 -1
- package/dist/runtime/conversation-runtime.d.ts.map +1 -1
- package/dist/runtime/conversation-runtime.js +117 -380
- package/dist/runtime/conversation-runtime.js.map +1 -1
- package/dist/runtime/session-lifecycle.d.ts +32 -18
- package/dist/runtime/session-lifecycle.d.ts.map +1 -1
- package/dist/runtime/session-lifecycle.js +159 -46
- package/dist/runtime/session-lifecycle.js.map +1 -1
- package/dist/runtime/types.d.ts +4 -26
- package/dist/runtime/types.d.ts.map +1 -1
- package/dist/runtime/types.js.map +1 -1
- package/dist/sandbox/cloudflare.d.ts.map +1 -1
- package/dist/sandbox/cloudflare.js +2 -3
- package/dist/sandbox/cloudflare.js.map +1 -1
- package/dist/sandbox/container.d.ts +0 -1
- package/dist/sandbox/container.d.ts.map +1 -1
- package/dist/sandbox/container.js +2 -3
- package/dist/sandbox/container.js.map +1 -1
- package/dist/sandbox/host.d.ts.map +1 -1
- package/dist/sandbox/host.js +4 -2
- package/dist/sandbox/host.js.map +1 -1
- package/dist/sandbox/identity.d.ts +10 -19
- package/dist/sandbox/identity.d.ts.map +1 -1
- package/dist/sandbox/identity.js +8 -8
- package/dist/sandbox/identity.js.map +1 -1
- package/dist/sandbox/index.d.ts +7 -10
- package/dist/sandbox/index.d.ts.map +1 -1
- package/dist/sandbox/index.js +45 -16
- package/dist/sandbox/index.js.map +1 -1
- package/dist/sandbox/types.d.ts +13 -45
- package/dist/sandbox/types.d.ts.map +1 -1
- package/dist/sandbox/types.js.map +1 -1
- package/dist/sandbox/utils.d.ts +5 -0
- package/dist/sandbox/utils.d.ts.map +1 -1
- package/dist/sandbox/utils.js +10 -0
- package/dist/sandbox/utils.js.map +1 -1
- package/dist/sessions/chat-history-sync.d.ts +1 -3
- package/dist/sessions/chat-history-sync.d.ts.map +1 -1
- package/dist/sessions/chat-history-sync.js +58 -11
- package/dist/sessions/chat-history-sync.js.map +1 -1
- package/dist/sessions/migrate-v3.d.ts +2 -5
- package/dist/sessions/migrate-v3.d.ts.map +1 -1
- package/dist/sessions/migrate-v3.js +17 -1
- package/dist/sessions/migrate-v3.js.map +1 -1
- package/dist/sessions/store.d.ts +5 -6
- package/dist/sessions/store.d.ts.map +1 -1
- package/dist/sessions/store.js +62 -2
- package/dist/sessions/store.js.map +1 -1
- package/dist/sessions/types.d.ts +9 -0
- package/dist/sessions/types.d.ts.map +1 -1
- package/dist/sessions/types.js.map +1 -1
- package/dist/tools/bash.d.ts.map +1 -1
- package/dist/tools/bash.js +2 -10
- package/dist/tools/bash.js.map +1 -1
- package/dist/tools/read.js +2 -2
- package/dist/tools/read.js.map +1 -1
- package/dist/tools/sandbox.d.ts.map +1 -1
- package/dist/tools/sandbox.js +2 -3
- package/dist/tools/sandbox.js.map +1 -1
- package/dist/tools/subagent.d.ts +1 -1
- package/dist/tools/subagent.js.map +1 -1
- package/dist/types.d.ts +38 -127
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/dist/vault/index.d.ts +9 -2
- package/dist/vault/index.d.ts.map +1 -1
- package/dist/vault/index.js +29 -5
- package/dist/vault/index.js.map +1 -1
- package/dist/web/admin/portal.d.ts +12 -1
- package/dist/web/admin/portal.d.ts.map +1 -1
- package/dist/web/admin/portal.js +437 -422
- package/dist/web/admin/portal.js.map +1 -1
- package/dist/web/admin/types.d.ts +2 -2
- package/dist/web/admin/types.d.ts.map +1 -1
- package/dist/web/admin/types.js.map +1 -1
- package/dist/web/login/portal.d.ts +7 -1
- package/dist/web/login/portal.d.ts.map +1 -1
- package/dist/web/login/portal.js +143 -78
- package/dist/web/login/portal.js.map +1 -1
- package/dist/web/portal-shell.d.ts +1 -0
- package/dist/web/portal-shell.d.ts.map +1 -1
- package/dist/web/portal-shell.js +12 -1
- package/dist/web/portal-shell.js.map +1 -1
- package/dist/web/server.d.ts +3 -3
- package/dist/web/server.d.ts.map +1 -1
- package/dist/web/server.js.map +1 -1
- package/dist/web/session-view/portal.d.ts +8 -1
- package/dist/web/session-view/portal.d.ts.map +1 -1
- package/dist/web/session-view/portal.js +609 -132
- package/dist/web/session-view/portal.js.map +1 -1
- package/dist/web/session-view/types.d.ts +8 -0
- package/dist/web/session-view/types.d.ts.map +1 -1
- package/dist/web/session-view/types.js.map +1 -1
- package/dist/workspace-projection/index.d.ts +14 -2
- package/dist/workspace-projection/index.d.ts.map +1 -1
- package/dist/workspace-projection/index.js +102 -14
- package/dist/workspace-projection/index.js.map +1 -1
- package/dist/workspace-projection/types.d.ts +14 -1
- package/dist/workspace-projection/types.d.ts.map +1 -1
- package/dist/workspace-projection/types.js.map +1 -1
- package/package.json +3 -5
- package/dist/adapters/github/cloudbuild.d.ts +0 -19
- package/dist/adapters/github/cloudbuild.d.ts.map +0 -1
- package/dist/adapters/github/cloudbuild.js +0 -71
- package/dist/adapters/github/cloudbuild.js.map +0 -1
- package/dist/adapters/github/gcp-auth.d.ts +0 -28
- package/dist/adapters/github/gcp-auth.d.ts.map +0 -1
- package/dist/adapters/github/gcp-auth.js +0 -196
- package/dist/adapters/github/gcp-auth.js.map +0 -1
- package/dist/agent/index.d.ts +0 -9
- package/dist/agent/index.d.ts.map +0 -1
- package/dist/agent/index.js +0 -8
- package/dist/agent/index.js.map +0 -1
- package/dist/cli/ext-dev.d.ts +0 -2
- package/dist/cli/ext-dev.d.ts.map +0 -1
- package/dist/cli/ext-dev.js +0 -188
- package/dist/cli/ext-dev.js.map +0 -1
- package/dist/cli/ext.d.ts +0 -2
- package/dist/cli/ext.d.ts.map +0 -1
- package/dist/cli/ext.js +0 -324
- package/dist/cli/ext.js.map +0 -1
- package/dist/commands/extensions.d.ts +0 -26
- package/dist/commands/extensions.d.ts.map +0 -1
- package/dist/commands/extensions.js +0 -103
- package/dist/commands/extensions.js.map +0 -1
- package/dist/extension-schedules.d.ts +0 -31
- package/dist/extension-schedules.d.ts.map +0 -1
- package/dist/extension-schedules.js +0 -229
- package/dist/extension-schedules.js.map +0 -1
- package/dist/harness/auth.d.ts +0 -17
- package/dist/harness/auth.d.ts.map +0 -1
- package/dist/harness/auth.js +0 -92
- package/dist/harness/auth.js.map +0 -1
- package/dist/harness/extensions/loader.d.ts +0 -40
- package/dist/harness/extensions/loader.d.ts.map +0 -1
- package/dist/harness/extensions/loader.js +0 -723
- package/dist/harness/extensions/loader.js.map +0 -1
- package/dist/harness/extensions/registry.d.ts +0 -155
- package/dist/harness/extensions/registry.d.ts.map +0 -1
- package/dist/harness/extensions/registry.js +0 -420
- package/dist/harness/extensions/registry.js.map +0 -1
- package/dist/harness/extensions/types.d.ts +0 -665
- package/dist/harness/extensions/types.d.ts.map +0 -1
- package/dist/harness/extensions/types.js.map +0 -1
- package/dist/office/address.d.ts +0 -31
- package/dist/office/address.d.ts.map +0 -1
- package/dist/office/address.js +0 -113
- package/dist/office/address.js.map +0 -1
- package/dist/office/layout.d.ts +0 -27
- package/dist/office/layout.d.ts.map +0 -1
- package/dist/office/layout.js +0 -97
- package/dist/office/layout.js.map +0 -1
- package/dist/office/migration.d.ts +0 -44
- package/dist/office/migration.d.ts.map +0 -1
- package/dist/office/migration.js +0 -255
- package/dist/office/migration.js.map +0 -1
- package/dist/office/registry.d.ts +0 -75
- package/dist/office/registry.d.ts.map +0 -1
- package/dist/office/registry.js +0 -646
- package/dist/office/registry.js.map +0 -1
- package/dist/packages/admin.d.ts +0 -17
- package/dist/packages/admin.d.ts.map +0 -1
- package/dist/packages/admin.js +0 -98
- package/dist/packages/admin.js.map +0 -1
- package/dist/packages/inspect.d.ts +0 -11
- package/dist/packages/inspect.d.ts.map +0 -1
- package/dist/packages/inspect.js +0 -98
- package/dist/packages/inspect.js.map +0 -1
- package/dist/packages/materialize.d.ts +0 -40
- package/dist/packages/materialize.d.ts.map +0 -1
- package/dist/packages/materialize.js +0 -297
- package/dist/packages/materialize.js.map +0 -1
- package/dist/packages/resolve.d.ts +0 -25
- package/dist/packages/resolve.d.ts.map +0 -1
- package/dist/packages/resolve.js +0 -208
- package/dist/packages/resolve.js.map +0 -1
- package/dist/packages/source.d.ts +0 -39
- package/dist/packages/source.d.ts.map +0 -1
- package/dist/packages/source.js +0 -189
- package/dist/packages/source.js.map +0 -1
- package/dist/sandbox/errors.d.ts +0 -6
- package/dist/sandbox/errors.d.ts.map +0 -1
- package/dist/sandbox/errors.js +0 -11
- package/dist/sandbox/errors.js.map +0 -1
- package/dist/sandbox/firecracker.d.ts +0 -18
- package/dist/sandbox/firecracker.d.ts.map +0 -1
- package/dist/sandbox/firecracker.js +0 -223
- package/dist/sandbox/firecracker.js.map +0 -1
- package/dist/sandbox/gondolin.d.ts +0 -57
- package/dist/sandbox/gondolin.d.ts.map +0 -1
- package/dist/sandbox/gondolin.js +0 -764
- package/dist/sandbox/gondolin.js.map +0 -1
- package/dist/sandbox/image.d.ts +0 -3
- package/dist/sandbox/image.d.ts.map +0 -1
- package/dist/sandbox/image.js +0 -29
- package/dist/sandbox/image.js.map +0 -1
- package/dist/sessions/conversation-log.d.ts +0 -9
- package/dist/sessions/conversation-log.d.ts.map +0 -1
- package/dist/sessions/conversation-log.js +0 -50
- package/dist/sessions/conversation-log.js.map +0 -1
- package/dist/sessions/rotation.d.ts +0 -2
- package/dist/sessions/rotation.d.ts.map +0 -1
- package/dist/sessions/rotation.js +0 -41
- package/dist/sessions/rotation.js.map +0 -1
- package/dist/vault/disabled.d.ts +0 -9
- package/dist/vault/disabled.d.ts.map +0 -1
- package/dist/vault/disabled.js +0 -25
- package/dist/vault/disabled.js.map +0 -1
- package/dist/web/admin/store.d.ts +0 -13
- package/dist/web/admin/store.d.ts.map +0 -1
- package/dist/web/admin/store.js +0 -14
- package/dist/web/admin/store.js.map +0 -1
- package/dist/web/login/store.d.ts +0 -8
- package/dist/web/login/store.d.ts.map +0 -1
- package/dist/web/login/store.js +0 -15
- package/dist/web/login/store.js.map +0 -1
- package/dist/web/session-view/service.d.ts +0 -6
- package/dist/web/session-view/service.d.ts.map +0 -1
- package/dist/web/session-view/service.js +0 -517
- package/dist/web/session-view/service.js.map +0 -1
- package/dist/web/session-view/store.d.ts +0 -8
- package/dist/web/session-view/store.d.ts.map +0 -1
- package/dist/web/session-view/store.js +0 -15
- package/dist/web/session-view/store.js.map +0 -1
- /package/dist/{harness/extensions → dream}/types.js +0 -0
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { SocketModeClient } from "@slack/socket-mode";
|
|
2
2
|
import { WebAPIRateLimitedError, WebClient } from "@slack/web-api";
|
|
3
|
-
import { readEnv } from "../../env-manifest.js";
|
|
4
3
|
import { existsSync, readFileSync } from "node:fs";
|
|
5
4
|
import { readFile, writeFile } from "node:fs/promises";
|
|
6
5
|
import { basename, join } from "node:path";
|
|
@@ -8,12 +7,12 @@ import { createConversationEvent, createConversationMessage, } from "../../adapt
|
|
|
8
7
|
import { createOfficeAddress } from "../../office/index.js";
|
|
9
8
|
import { COMMAND_MANIFEST } from "../../commands/manifest.js";
|
|
10
9
|
import { resolveConversationSettings } from "../../config.js";
|
|
11
|
-
import { parseExtActionId } from "../../harness/extensions/registry.js";
|
|
12
10
|
import * as log from "../../log.js";
|
|
13
11
|
import { isRecord, readTextFileIfExists } from "../../utils/file-guards.js";
|
|
14
12
|
import { PRODUCT_NAME, formatForceStopped } from "../../platform-messages.js";
|
|
15
13
|
import { appendBotResponseLog, appendChannelLog, MessagingEventQueue, saveIncomingAttachments, withRetry, } from "../shared.js";
|
|
16
14
|
import { processMessageIntake } from "../intake.js";
|
|
15
|
+
import { recordPlatformChannelKind, } from "../../workspace-projection/index.js";
|
|
17
16
|
import { AssistantThreadRegistry, handleAgentContextChanged, handleAgentDmOpened, handleAssistantThreadStarted, titleAssistantThread, } from "./assistant.js";
|
|
18
17
|
import { createSlackAdapters } from "./context.js";
|
|
19
18
|
import { hasMaterializedChatSession, registerThreadSession, } from "../../sessions/chat-history-sync.js";
|
|
@@ -560,7 +559,6 @@ export class SlackMessagingBot {
|
|
|
560
559
|
return {
|
|
561
560
|
name: "slack",
|
|
562
561
|
trustModel: "membership",
|
|
563
|
-
bareExtensionCommands: true,
|
|
564
562
|
formattingGuide: "## Slack Formatting\nWrite standard Markdown/GFM: **bold**, _italic_, ~~strike~~, `code`, fenced code blocks, [links](url), lists, and pipe tables (rendered as native Slack tables).\nDo NOT use Slack mrkdwn syntax like *single-asterisk bold* or <url|label> links.",
|
|
565
563
|
channels: this.getAllChannels().map((c) => ({ id: c.id, name: c.name })),
|
|
566
564
|
users: this.getAllUsers().map((u) => ({
|
|
@@ -672,7 +670,42 @@ export class SlackMessagingBot {
|
|
|
672
670
|
sessionKey,
|
|
673
671
|
});
|
|
674
672
|
}
|
|
673
|
+
/**
|
|
674
|
+
* Slack's own conversation vocabulary for this channel, from the metadata
|
|
675
|
+
* fetchChannels() already loads. Externally shared channels report
|
|
676
|
+
* "external" regardless of privacy — platform-public within one workspace
|
|
677
|
+
* is the sharing condition, and a channel visible to another organization
|
|
678
|
+
* does not satisfy it. Unknown channels return undefined (never recorded,
|
|
679
|
+
* so the projection keeps its isolated default).
|
|
680
|
+
*/
|
|
681
|
+
channelKindFor(channelId) {
|
|
682
|
+
if (channelId.startsWith("D"))
|
|
683
|
+
return "im";
|
|
684
|
+
const channel = this.channels.get(channelId);
|
|
685
|
+
if (!channel)
|
|
686
|
+
return undefined;
|
|
687
|
+
if (channel.name.startsWith("DM:"))
|
|
688
|
+
return "im";
|
|
689
|
+
if (channel.isExternallyShared)
|
|
690
|
+
return "external";
|
|
691
|
+
if (channel.isPrivate === true)
|
|
692
|
+
return "private_channel";
|
|
693
|
+
if (channel.isPrivate === false)
|
|
694
|
+
return "public_channel";
|
|
695
|
+
return undefined;
|
|
696
|
+
}
|
|
675
697
|
processSlackMessageIntake(options) {
|
|
698
|
+
const kind = this.channelKindFor(options.event.conversationId);
|
|
699
|
+
if (kind) {
|
|
700
|
+
try {
|
|
701
|
+
recordPlatformChannelKind(this.workspace.office(options.event.address), kind);
|
|
702
|
+
}
|
|
703
|
+
catch (err) {
|
|
704
|
+
// A failed snapshot must not block the message; the projection just
|
|
705
|
+
// keeps its previous (or isolated default) posture.
|
|
706
|
+
log.logWarning("Failed to record Slack channel kind", String(err));
|
|
707
|
+
}
|
|
708
|
+
}
|
|
676
709
|
const absorbAttachmentFailure = () => {
|
|
677
710
|
void options.attachmentsPromise.catch((err) => {
|
|
678
711
|
log.logWarning("Failed to log Slack message", String(err));
|
|
@@ -702,22 +735,7 @@ export class SlackMessagingBot {
|
|
|
702
735
|
absorbAttachmentFailure();
|
|
703
736
|
});
|
|
704
737
|
}
|
|
705
|
-
|
|
706
|
-
const blocks = [
|
|
707
|
-
{
|
|
708
|
-
type: "section",
|
|
709
|
-
text: {
|
|
710
|
-
type: "mrkdwn",
|
|
711
|
-
text: `*${PRODUCT_NAME}*\nStart a new task or check on running work.`,
|
|
712
|
-
},
|
|
713
|
-
accessory: {
|
|
714
|
-
type: "image",
|
|
715
|
-
image_url: "https://media1.tenor.com/m/lfDATg4Bhc0AAAAC/happy-cat.gif",
|
|
716
|
-
alt_text: PRODUCT_NAME,
|
|
717
|
-
},
|
|
718
|
-
},
|
|
719
|
-
];
|
|
720
|
-
// --- Running tasks ---
|
|
738
|
+
appendRunningTasks(blocks) {
|
|
721
739
|
const runningSessions = this.handler.getRunningSessions();
|
|
722
740
|
blocks.push({ type: "divider" }, {
|
|
723
741
|
type: "header",
|
|
@@ -732,67 +750,49 @@ export class SlackMessagingBot {
|
|
|
732
750
|
type: "context",
|
|
733
751
|
elements: [{ type: "mrkdwn", text: "_No tasks running right now._" }],
|
|
734
752
|
});
|
|
753
|
+
return;
|
|
735
754
|
}
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
const
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
755
|
+
const stuckThresholdMs = 10 * 60 * 1000;
|
|
756
|
+
for (const session of runningSessions) {
|
|
757
|
+
const channelId = conversationIdOf(session.sessionKey);
|
|
758
|
+
const channelName = this.channels.get(channelId)?.name;
|
|
759
|
+
const elapsed = Math.floor((Date.now() - session.startedAt) / 60000);
|
|
760
|
+
const elapsedStr = elapsed < 1 ? "<1 min" : `${elapsed} min`;
|
|
761
|
+
const lastActivity = session.lastActivityAt ? Date.now() - session.lastActivityAt : 0;
|
|
762
|
+
const isStuck = lastActivity > stuckThresholdMs;
|
|
763
|
+
let statusLine = `${isStuck ? "_stuck_" : "_running_"} · ${elapsedStr}`;
|
|
764
|
+
if (session.currentTool)
|
|
765
|
+
statusLine += ` · ${session.currentTool}`;
|
|
766
|
+
if (isStuck)
|
|
767
|
+
statusLine += ` · idle ${Math.floor(lastActivity / 60000)}m`;
|
|
768
|
+
blocks.push({
|
|
769
|
+
type: "context",
|
|
770
|
+
elements: [
|
|
771
|
+
{
|
|
772
|
+
type: "mrkdwn",
|
|
773
|
+
text: `*${channelName ? `#${channelName}` : channelId}* · ${statusLine}`,
|
|
774
|
+
},
|
|
775
|
+
],
|
|
776
|
+
});
|
|
777
|
+
if (isStuck) {
|
|
759
778
|
blocks.push({
|
|
760
779
|
type: "context",
|
|
761
780
|
elements: [
|
|
781
|
+
{ type: "mrkdwn", text: " " },
|
|
762
782
|
{
|
|
763
|
-
type: "
|
|
764
|
-
text:
|
|
783
|
+
type: "button",
|
|
784
|
+
text: { type: "plain_text", text: "Force Stop", emoji: true },
|
|
785
|
+
// `value` preserves the raw key; action_id is only a unique route.
|
|
786
|
+
action_id: `force_stop_${session.sessionKey.replace(/:/g, "_")}`,
|
|
787
|
+
value: session.sessionKey,
|
|
788
|
+
style: "danger",
|
|
765
789
|
},
|
|
766
790
|
],
|
|
767
791
|
});
|
|
768
|
-
// Add Force Stop button as separate element if stuck
|
|
769
|
-
if (isStuck) {
|
|
770
|
-
blocks.push({
|
|
771
|
-
type: "context",
|
|
772
|
-
elements: [
|
|
773
|
-
{
|
|
774
|
-
type: "mrkdwn",
|
|
775
|
-
text: " ",
|
|
776
|
-
},
|
|
777
|
-
{
|
|
778
|
-
type: "button",
|
|
779
|
-
text: { type: "plain_text", text: "Force Stop", emoji: true },
|
|
780
|
-
// The raw session key travels in `value` (Slack returns it
|
|
781
|
-
// verbatim); the action_id only routes and must be unique per
|
|
782
|
-
// view, so it carries a sanitized copy of the key. Never
|
|
783
|
-
// decode the key from the action_id — the `:`↔`_` rewrite is
|
|
784
|
-
// irreversible for conversation ids that contain `_` (GitHub's
|
|
785
|
-
// GH_owner_repo_number do, by design).
|
|
786
|
-
action_id: `force_stop_${session.sessionKey.replace(/:/g, "_")}`,
|
|
787
|
-
value: session.sessionKey,
|
|
788
|
-
style: "danger",
|
|
789
|
-
},
|
|
790
|
-
],
|
|
791
|
-
});
|
|
792
|
-
}
|
|
793
792
|
}
|
|
794
793
|
}
|
|
795
|
-
|
|
794
|
+
}
|
|
795
|
+
appendScheduledJobs(blocks) {
|
|
796
796
|
const periodicEvents = this.eventsWatcher?.getPeriodicEvents() ?? [];
|
|
797
797
|
blocks.push({ type: "divider" }, {
|
|
798
798
|
type: "header",
|
|
@@ -807,34 +807,46 @@ export class SlackMessagingBot {
|
|
|
807
807
|
type: "context",
|
|
808
808
|
elements: [{ type: "mrkdwn", text: "_No scheduled jobs._" }],
|
|
809
809
|
});
|
|
810
|
+
return;
|
|
810
811
|
}
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
:
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
:
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
text: {
|
|
831
|
-
type: "mrkdwn",
|
|
832
|
-
text: `*${ev.text}*\n└ \`${ev.schedule}\` · ${channelLabel} · Next: ${nextStr}`,
|
|
833
|
-
},
|
|
834
|
-
});
|
|
835
|
-
}
|
|
812
|
+
for (const event of periodicEvents) {
|
|
813
|
+
const channel = event.platform === "slack" ? this.channels.get(event.conversationId) : undefined;
|
|
814
|
+
const channelId = channel ? `#${channel.name}` : event.conversationId;
|
|
815
|
+
const channelLabel = `${event.platform}:${channelId}`;
|
|
816
|
+
const nextRun = event.nextRun
|
|
817
|
+
? new Date(event.nextRun).toLocaleString("en-US", {
|
|
818
|
+
month: "short",
|
|
819
|
+
day: "numeric",
|
|
820
|
+
hour: "2-digit",
|
|
821
|
+
minute: "2-digit",
|
|
822
|
+
})
|
|
823
|
+
: "—";
|
|
824
|
+
blocks.push({
|
|
825
|
+
type: "section",
|
|
826
|
+
text: {
|
|
827
|
+
type: "mrkdwn",
|
|
828
|
+
text: `*${event.text}*\n└ \`${event.schedule}\` · ${channelLabel} · Next: ${nextRun}`,
|
|
829
|
+
},
|
|
830
|
+
});
|
|
836
831
|
}
|
|
837
|
-
|
|
832
|
+
}
|
|
833
|
+
buildHomeView() {
|
|
834
|
+
const blocks = [
|
|
835
|
+
{
|
|
836
|
+
type: "section",
|
|
837
|
+
text: {
|
|
838
|
+
type: "mrkdwn",
|
|
839
|
+
text: `*${PRODUCT_NAME}*\nStart a new task or check on running work.`,
|
|
840
|
+
},
|
|
841
|
+
accessory: {
|
|
842
|
+
type: "image",
|
|
843
|
+
image_url: "https://media1.tenor.com/m/lfDATg4Bhc0AAAAC/happy-cat.gif",
|
|
844
|
+
alt_text: PRODUCT_NAME,
|
|
845
|
+
},
|
|
846
|
+
},
|
|
847
|
+
];
|
|
848
|
+
this.appendRunningTasks(blocks);
|
|
849
|
+
this.appendScheduledJobs(blocks);
|
|
838
850
|
blocks.push({ type: "divider" }, {
|
|
839
851
|
type: "context",
|
|
840
852
|
elements: [
|
|
@@ -843,7 +855,8 @@ export class SlackMessagingBot {
|
|
|
843
855
|
});
|
|
844
856
|
return { type: "home", blocks: blocks };
|
|
845
857
|
}
|
|
846
|
-
createCommandAdapters(
|
|
858
|
+
createCommandAdapters(input) {
|
|
859
|
+
const { conversationId, userId, userName, text, ts, ...options } = input;
|
|
847
860
|
const message = createConversationMessage({
|
|
848
861
|
platform: "slack",
|
|
849
862
|
conversationId,
|
|
@@ -937,9 +950,16 @@ export class SlackMessagingBot {
|
|
|
937
950
|
...(threadTs ? { thread_ts: threadTs } : {}),
|
|
938
951
|
sessionKey,
|
|
939
952
|
});
|
|
940
|
-
const context = this.createCommandAdapters(
|
|
941
|
-
|
|
942
|
-
:
|
|
953
|
+
const context = this.createCommandAdapters({
|
|
954
|
+
conversationId,
|
|
955
|
+
userId: payload.user_id,
|
|
956
|
+
userName,
|
|
957
|
+
text: commandText,
|
|
958
|
+
ts: eventTs,
|
|
959
|
+
...(isDirectMessage
|
|
960
|
+
? { threadTs, sessionKey }
|
|
961
|
+
: { ephemeralChannelId: conversationId, threadTs, sessionKey }),
|
|
962
|
+
});
|
|
943
963
|
return { event, context };
|
|
944
964
|
}
|
|
945
965
|
/**
|
|
@@ -972,16 +992,6 @@ export class SlackMessagingBot {
|
|
|
972
992
|
this.socketClient.on("unable_to_socket_mode_start", (err) => {
|
|
973
993
|
log.logWarning("Slack socket unable_to_start", err ? String(err) : "");
|
|
974
994
|
});
|
|
975
|
-
// Which events Slack actually delivers is otherwise unknowable from here:
|
|
976
|
-
// a listener that never fires looks the same whether the subscription is
|
|
977
|
-
// missing, the app needs reinstalling, or the surface never emits it at
|
|
978
|
-
// all. Off by default — this is one line per event on a busy workspace.
|
|
979
|
-
if (readEnv("SLACK_TRACE_EVENTS")) {
|
|
980
|
-
this.socketClient.on("slack_event", ({ type, body }) => {
|
|
981
|
-
const inner = body?.event;
|
|
982
|
-
log.logInfo(`Slack socket event: ${type ?? "?"}${inner?.type ? ` → ${inner.type}` : ""}${inner?.tab ? ` (tab: ${inner.tab})` : ""}`);
|
|
983
|
-
});
|
|
984
|
-
}
|
|
985
995
|
this.socketClient.on("app_mention", (payload) => this.handleAppMention(payload));
|
|
986
996
|
this.socketClient.on("message", (payload) => this.handleMessageEvent(payload));
|
|
987
997
|
this.socketClient.on("slash_commands", (payload) => void this.handleSlashCommand(payload));
|
|
@@ -1039,49 +1049,44 @@ export class SlackMessagingBot {
|
|
|
1039
1049
|
});
|
|
1040
1050
|
ack();
|
|
1041
1051
|
}
|
|
1042
|
-
|
|
1043
|
-
const
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1052
|
+
admitHumanMessage(event, ack) {
|
|
1053
|
+
const hasSlackContent = !!event.text ||
|
|
1054
|
+
!!event.files?.length ||
|
|
1055
|
+
!!event.blocks?.length ||
|
|
1056
|
+
!!event.attachments?.length;
|
|
1057
|
+
const isOwnMessage = event.user === this.botUserId || (!!this.botId && event.bot_id === this.botId);
|
|
1058
|
+
if (isOwnMessage) {
|
|
1048
1059
|
ack();
|
|
1049
|
-
return;
|
|
1060
|
+
return false;
|
|
1050
1061
|
}
|
|
1051
|
-
//
|
|
1052
|
-
//
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
if (
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
if (!hasSlackContent) {
|
|
1064
|
-
ack();
|
|
1065
|
-
return;
|
|
1062
|
+
// User-token posts carry bot_id/app_id beside the human user. Only unknown
|
|
1063
|
+
// authors and known bot users take the external-bot loop-protection path.
|
|
1064
|
+
const authorIsKnownHuman = !!event.user && this.users.get(event.user)?.isBot === false;
|
|
1065
|
+
const isExternalMessage = event.subtype === "bot_message" || (!!event.bot_id && !authorIsKnownHuman);
|
|
1066
|
+
if (isExternalMessage) {
|
|
1067
|
+
const supportedSubtype = event.subtype === undefined ||
|
|
1068
|
+
event.subtype === "bot_message" ||
|
|
1069
|
+
event.subtype === "file_share";
|
|
1070
|
+
if (supportedSubtype && hasSlackContent) {
|
|
1071
|
+
void this.logExternalMessagingBotMessage(event).catch((err) => {
|
|
1072
|
+
log.logWarning("Failed to log Slack bot message", String(err));
|
|
1073
|
+
});
|
|
1066
1074
|
}
|
|
1067
|
-
void this.logExternalMessagingBotMessage(e).catch((err) => {
|
|
1068
|
-
log.logWarning("Failed to log Slack bot message", String(err));
|
|
1069
|
-
});
|
|
1070
|
-
ack();
|
|
1071
|
-
return;
|
|
1072
|
-
}
|
|
1073
|
-
if (!e.user) {
|
|
1074
|
-
ack();
|
|
1075
|
-
return;
|
|
1076
|
-
}
|
|
1077
|
-
if (e.subtype !== undefined && e.subtype !== "file_share") {
|
|
1078
1075
|
ack();
|
|
1079
|
-
return;
|
|
1076
|
+
return false;
|
|
1080
1077
|
}
|
|
1081
|
-
|
|
1082
|
-
|
|
1078
|
+
const isSupportedUserMessage = !!event.user &&
|
|
1079
|
+
(event.subtype === undefined || event.subtype === "file_share") &&
|
|
1080
|
+
hasSlackContent;
|
|
1081
|
+
if (isSupportedUserMessage)
|
|
1082
|
+
return true;
|
|
1083
|
+
ack();
|
|
1084
|
+
return false;
|
|
1085
|
+
}
|
|
1086
|
+
handleMessageEvent({ event, ack }) {
|
|
1087
|
+
const e = event;
|
|
1088
|
+
if (!this.admitHumanMessage(e, ack))
|
|
1083
1089
|
return;
|
|
1084
|
-
}
|
|
1085
1090
|
// message.im normally carries channel_type "im", but fall back to the
|
|
1086
1091
|
// D-prefix convention (used by handleAppMention and session keys) so a
|
|
1087
1092
|
// missing channel_type cannot silently demote a DM to an auto-reply
|
|
@@ -1242,36 +1247,6 @@ export class SlackMessagingBot {
|
|
|
1242
1247
|
: undefined;
|
|
1243
1248
|
const threadTs = container.thread_ts;
|
|
1244
1249
|
const sessionKey = resolveSlackSessionKey(channelId, threadTs);
|
|
1245
|
-
// Extension-owned actions (ext:<slug>: namespaced by api.blockkit.post)
|
|
1246
|
-
// dispatch exclusively to the extension's onAction handler — no agent
|
|
1247
|
-
// run, no chat-history entry. They never fall through to the model: an
|
|
1248
|
-
// unconsumed namespaced action means the extension is gone, and its
|
|
1249
|
-
// routing id would only confuse an agent run.
|
|
1250
|
-
const extAction = parseExtActionId(action.action_id ?? "");
|
|
1251
|
-
if (extAction) {
|
|
1252
|
-
this.getQueue(this.resolveQueueKey(channelId, sessionKey)).enqueue(async () => {
|
|
1253
|
-
const consumed = await this.handler.handleExtensionAction({
|
|
1254
|
-
address: createOfficeAddress("slack", channelId),
|
|
1255
|
-
sessionKey,
|
|
1256
|
-
conversationKind: channelId.startsWith("D") ? "direct" : "shared",
|
|
1257
|
-
slug: extAction.slug,
|
|
1258
|
-
action: {
|
|
1259
|
-
actionId: extAction.actionId,
|
|
1260
|
-
value: action.value ?? selectedOption?.value ?? selectedOption?.text?.text,
|
|
1261
|
-
selectedValues: selectedOptions?.map((option) => option.value ?? option.text?.text ?? ""),
|
|
1262
|
-
userId,
|
|
1263
|
-
userName: body.user?.username ?? body.user?.name,
|
|
1264
|
-
conversationId: channelId,
|
|
1265
|
-
messageTs: container.message_ts,
|
|
1266
|
-
threadTs,
|
|
1267
|
-
},
|
|
1268
|
-
});
|
|
1269
|
-
if (!consumed) {
|
|
1270
|
-
log.logWarning(`[${channelId}] Dropped extension action ${action.action_id}`, `no handler registered by extension "${extAction.slug}"`);
|
|
1271
|
-
}
|
|
1272
|
-
});
|
|
1273
|
-
return;
|
|
1274
|
-
}
|
|
1275
1250
|
const selectedText = selectedOption?.text?.text ?? selectedOption?.value;
|
|
1276
1251
|
const selectedTexts = selectedOptions?.map((option) => option.text?.text ?? option.value);
|
|
1277
1252
|
const valueText = selectedTexts?.length
|
|
@@ -1607,7 +1582,12 @@ export class SlackMessagingBot {
|
|
|
1607
1582
|
if (channels) {
|
|
1608
1583
|
for (const c of channels) {
|
|
1609
1584
|
if (c.id && c.name && c.is_member) {
|
|
1610
|
-
this.channels.set(c.id, {
|
|
1585
|
+
this.channels.set(c.id, {
|
|
1586
|
+
id: c.id,
|
|
1587
|
+
name: c.name,
|
|
1588
|
+
...(typeof c.is_private === "boolean" ? { isPrivate: c.is_private } : {}),
|
|
1589
|
+
...(c.is_shared || c.is_ext_shared ? { isExternallyShared: true } : {}),
|
|
1590
|
+
});
|
|
1611
1591
|
}
|
|
1612
1592
|
}
|
|
1613
1593
|
}
|