@geminixiang/mikan 1.0.0-beta.60 → 1.0.0-beta.62
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 +44 -0
- package/README.md +3 -1
- package/dist/adapters/intake.js +12 -2
- package/dist/adapters/intake.js.map +1 -1
- package/dist/adapters/progressive-renderer.d.ts.map +1 -1
- package/dist/adapters/progressive-renderer.js +4 -0
- package/dist/adapters/progressive-renderer.js.map +1 -1
- package/dist/adapters/slack/bot.d.ts +9 -3
- package/dist/adapters/slack/bot.d.ts.map +1 -1
- package/dist/adapters/slack/bot.js +145 -16
- package/dist/adapters/slack/bot.js.map +1 -1
- package/dist/adapters/slack/task-status.d.ts +7 -0
- package/dist/adapters/slack/task-status.d.ts.map +1 -0
- package/dist/adapters/slack/task-status.js +101 -0
- package/dist/adapters/slack/task-status.js.map +1 -0
- package/dist/adapters/web/admin/portal.d.ts +1 -1
- package/dist/adapters/web/admin/portal.d.ts.map +1 -1
- package/dist/adapters/web/admin/portal.js +33 -25
- package/dist/adapters/web/admin/portal.js.map +1 -1
- package/dist/adapters/web/admin/types.d.ts +6 -3
- package/dist/adapters/web/admin/types.d.ts.map +1 -1
- package/dist/adapters/web/admin/types.js.map +1 -1
- package/dist/adapters/web/server.d.ts +3 -0
- package/dist/adapters/web/server.d.ts.map +1 -1
- package/dist/adapters/web/server.js +4 -6
- package/dist/adapters/web/server.js.map +1 -1
- package/dist/adapters/web/session-view/portal.js +2 -1
- package/dist/adapters/web/session-view/portal.js.map +1 -1
- package/dist/cli/boot.js +1 -1
- package/dist/cli/boot.js.map +1 -1
- package/dist/cli/office.d.ts.map +1 -1
- package/dist/cli/office.js +66 -0
- package/dist/cli/office.js.map +1 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +4 -4
- package/dist/config.js.map +1 -1
- package/dist/env-manifest.js +3 -3
- package/dist/env-manifest.js.map +1 -1
- package/dist/events/index.d.ts +56 -34
- package/dist/events/index.d.ts.map +1 -1
- package/dist/events/index.js +114 -23
- package/dist/events/index.js.map +1 -1
- package/dist/events/scheduler.d.ts +34 -0
- package/dist/events/scheduler.d.ts.map +1 -0
- package/dist/events/scheduler.js +231 -0
- package/dist/events/scheduler.js.map +1 -0
- package/dist/harness/mcp.d.ts.map +1 -1
- package/dist/harness/mcp.js +1 -3
- package/dist/harness/mcp.js.map +1 -1
- package/dist/harness/open-connector.d.ts +21 -10
- package/dist/harness/open-connector.d.ts.map +1 -1
- package/dist/harness/open-connector.js +109 -135
- package/dist/harness/open-connector.js.map +1 -1
- package/dist/harness/presenter.d.ts +1 -0
- package/dist/harness/presenter.d.ts.map +1 -1
- package/dist/harness/presenter.js +37 -9
- package/dist/harness/presenter.js.map +1 -1
- package/dist/harness/prompt.d.ts.map +1 -1
- package/dist/harness/prompt.js +9 -4
- package/dist/harness/prompt.js.map +1 -1
- package/dist/harness/runner.d.ts.map +1 -1
- package/dist/harness/runner.js +81 -34
- package/dist/harness/runner.js.map +1 -1
- package/dist/harness/session.d.ts +3 -0
- package/dist/harness/session.d.ts.map +1 -1
- package/dist/harness/session.js +21 -1
- package/dist/harness/session.js.map +1 -1
- package/dist/harness/tools/event.d.ts +1 -1
- package/dist/harness/tools/event.d.ts.map +1 -1
- package/dist/harness/tools/event.js +19 -22
- package/dist/harness/tools/event.js.map +1 -1
- package/dist/harness/tools/index.d.ts +4 -1
- package/dist/harness/tools/index.d.ts.map +1 -1
- package/dist/harness/tools/index.js +6 -3
- package/dist/harness/tools/index.js.map +1 -1
- package/dist/harness/tools/task.d.ts +20 -0
- package/dist/harness/tools/task.d.ts.map +1 -0
- package/dist/harness/tools/task.js +79 -0
- package/dist/harness/tools/task.js.map +1 -0
- package/dist/main.js +17 -9
- package/dist/main.js.map +1 -1
- package/dist/office/index.d.ts +3 -2
- package/dist/office/index.d.ts.map +1 -1
- package/dist/office/index.js +3 -3
- package/dist/office/index.js.map +1 -1
- package/dist/office/projection.d.ts.map +1 -1
- package/dist/office/projection.js +0 -2
- package/dist/office/projection.js.map +1 -1
- package/dist/office/types.d.ts +0 -2
- package/dist/office/types.d.ts.map +1 -1
- package/dist/office/types.js.map +1 -1
- package/dist/runtime/conversation-runtime.d.ts.map +1 -1
- package/dist/runtime/conversation-runtime.js +35 -13
- package/dist/runtime/conversation-runtime.js.map +1 -1
- package/dist/runtime/types.d.ts +6 -2
- package/dist/runtime/types.d.ts.map +1 -1
- package/dist/runtime/types.js.map +1 -1
- package/dist/sessions/chat-history-sync.js +8 -3
- package/dist/sessions/chat-history-sync.js.map +1 -1
- package/dist/sessions/session-store.d.ts +8 -0
- package/dist/sessions/session-store.d.ts.map +1 -1
- package/dist/sessions/session-store.js +46 -21
- package/dist/sessions/session-store.js.map +1 -1
- package/dist/types.d.ts +26 -5
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/package.json +3 -2
- package/dist/events/watcher.d.ts +0 -43
- package/dist/events/watcher.d.ts.map +0 -1
- package/dist/events/watcher.js +0 -395
- package/dist/events/watcher.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -9,6 +9,50 @@ any release.
|
|
|
9
9
|
|
|
10
10
|
## [Unreleased]
|
|
11
11
|
|
|
12
|
+
## [1.0.0-beta.62]
|
|
13
|
+
|
|
14
|
+
### Changed
|
|
15
|
+
|
|
16
|
+
- Scheduled events now live in host-only per-office state (`<state dir>/conversations/<office key>/events/`) and are never mounted into a sandbox. The `event` tool and the Admin portal are the only writers, both confined to the current office; `create` never overwrites, deleting a record cancels its timer or cron immediately, and the Slack App Home lists only the opener's DM office schedules. The filesystem watcher is gone: hand-edited records take effect on the next start.
|
|
17
|
+
- OpenConnector is an ordinary MCP server with a deployment default. When a Slack conversation has not declared `open-connector`, mikan mints that conversation's runtime token with `OPENCONNECTOR_ADMIN_TOKEN` and saves a normal `mcpServers` entry in its settings; conversations may override it with a self-hosted server or disable it like any other MCP entry. The loader no longer fills `connectionName`; connection selection belongs to OpenConnector.
|
|
18
|
+
|
|
19
|
+
### Added
|
|
20
|
+
|
|
21
|
+
- `mikan office migrate-events` moves legacy `<workspace>/events/*.json` records into the owning office's state and reports records it cannot attribute.
|
|
22
|
+
- `mikan office migrate-openconnector` converts legacy `open-connector-runtime-token.json` files into conversation MCP entries.
|
|
23
|
+
|
|
24
|
+
### Fixed
|
|
25
|
+
|
|
26
|
+
- The agent `event` tool can no longer list, read, update, or delete another office's events, and `scope=all` is rejected.
|
|
27
|
+
|
|
28
|
+
### Docs and maintenance
|
|
29
|
+
|
|
30
|
+
- Redraw the architecture diagram as a single rounded page and refresh the README image.
|
|
31
|
+
- Support local Slack E2E runs, capture intake and session markers on failure, and schedule E2E events through the `event` tool instead of writing files.
|
|
32
|
+
- Record the Office isolation policy, storage inventory, and OpenConnector history audit under `docs/`.
|
|
33
|
+
|
|
34
|
+
## [1.0.0-beta.61]
|
|
35
|
+
|
|
36
|
+
### Added
|
|
37
|
+
|
|
38
|
+
- Ground Slack DM progress replies in runtime/v4 task observations; common task-thread status queries no longer steer work, and ordinary followups do not repeat completion mentions.
|
|
39
|
+
- Slack DM task handoff: independent task threads keep the main conversation free, with text steering in active task threads and continuation after stopping.
|
|
40
|
+
|
|
41
|
+
### Fixed
|
|
42
|
+
|
|
43
|
+
- Keep thread stop acknowledgements in the source thread, including shared-channel unmentioned stop controls.
|
|
44
|
+
- Notify Slack DM task requesters with a fresh in-thread mention after normal completion.
|
|
45
|
+
- Finalize stop acknowledgements that arrive after the cancelled run has already settled.
|
|
46
|
+
- Propagate final response delivery failures so rejected updates do not trigger completion notifications.
|
|
47
|
+
- Honor stop during runner preparation and keep older active tasks visible in status queries.
|
|
48
|
+
- Report task admission, asynchronous startup, and status inspection failures through the existing Sentry/OTLP observability path.
|
|
49
|
+
|
|
50
|
+
### Changed
|
|
51
|
+
|
|
52
|
+
- Publish the already built and verified npm package without rerunning build and repository setup lifecycle scripts.
|
|
53
|
+
- Keep the documented and CI coverage commands as stable entry points while maintaining their shared Vitest invocation in one place.
|
|
54
|
+
- Validate debug Session View selections from their path and header, leaving full parsing to consumers that load session content instead of inspecting the same file twice.
|
|
55
|
+
|
|
12
56
|
## [1.0.0-beta.60]
|
|
13
57
|
|
|
14
58
|
### Fixed
|
package/README.md
CHANGED
|
@@ -16,7 +16,9 @@ A multi-platform AI coding agent for Slack, Telegram, Discord, and GitHub.
|
|
|
16
16
|
|
|
17
17
|
mikan keeps the chat record, agent session, and execution runtime separate:
|
|
18
18
|
|
|
19
|
-

|
|
19
|
+
[](docs/architecture.html)
|
|
20
|
+
|
|
21
|
+
[Download the HTML/SVG source](docs/architecture.html) to view the full architecture diagram locally.
|
|
20
22
|
|
|
21
23
|
- **Conversation office** is the unit everything else hangs off: one conversation's working area plus its own sandbox runtime. An office is identified by its platform and raw conversation id, and its directory is named by an office key (`v1-<platform>-<readable-id>-<hash>`), so two platforms can never collide on the same raw id.
|
|
22
24
|
- **Chat / conversation data** is the platform-facing record: `log.jsonl`, attachments, and conversation files.
|
package/dist/adapters/intake.js
CHANGED
|
@@ -83,10 +83,20 @@ async function handleStopMagicWord(options) {
|
|
|
83
83
|
target = resolveOnlyScopedStopTarget(handler, address);
|
|
84
84
|
}
|
|
85
85
|
if (target) {
|
|
86
|
-
|
|
86
|
+
if (eventBase.thread_ts) {
|
|
87
|
+
await handler.handleStop(address, target, bot, eventBase.thread_ts);
|
|
88
|
+
}
|
|
89
|
+
else {
|
|
90
|
+
await handler.handleStop(address, target, bot);
|
|
91
|
+
}
|
|
87
92
|
}
|
|
88
93
|
else if (magicWord.addressed) {
|
|
89
|
-
|
|
94
|
+
if (eventBase.thread_ts && bot.postInThread) {
|
|
95
|
+
await bot.postInThread(conversationId, eventBase.thread_ts, formatNothingRunning(bot));
|
|
96
|
+
}
|
|
97
|
+
else {
|
|
98
|
+
await bot.postMessage(conversationId, formatNothingRunning(bot));
|
|
99
|
+
}
|
|
90
100
|
}
|
|
91
101
|
}
|
|
92
102
|
function widensToScopedSession(scopeFallback, sessionKey, conversationId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C;SAAM,IAAI,SAAS,CAAC,SAAS,EAAE,CAAC;QAC/B,IAAI,SAAS,CAAC,SAAS,IAAI,GAAG,CAAC,YAAY,EAAE,CAAC;YAC5C,MAAM,GAAG,CAAC,YAAY,CAAC,cAAc,EAAE,SAAS,CAAC,SAAS,EAAE,oBAAoB,CAAC,GAAG,CAAC,CAAC,CAAC;QACzF,CAAC;aAAM,CAAC;YACN,MAAM,GAAG,CAAC,WAAW,CAAC,cAAc,EAAE,oBAAoB,CAAC,GAAG,CAAC,CAAC,CAAC;QACnE,CAAC;IACH,CAAC;AACH,CAAC;AAED,SAAS,qBAAqB,CAC5B,aAA+C,EAC/C,UAA8B,EAC9B,cAAsB;IAEtB,IAAI,aAAa,KAAK,OAAO;QAAE,OAAO,KAAK,CAAC;IAC5C,IAAI,aAAa,KAAK,QAAQ;QAAE,OAAO,IAAI,CAAC;IAC5C,2EAA2E;IAC3E,4EAA4E;IAC5E,OAAO,UAAU,KAAK,SAAS,IAAI,UAAU,KAAK,cAAc,CAAC;AACnE,CAAC","sourcesContent":["import {\n assertSessionKeyBelongsToConversation,\n assertConversationId,\n} from \"../sessions/session-key.js\";\nimport type { ConversationEvent } from \"../adapter.js\";\nimport { formatAlreadyWorking, formatNothingRunning } from \"../platform-messages.js\";\nimport { resolveOnlyScopedStopTarget, resolveStopTarget } from \"./shared.js\";\nimport type { MessageIntakeOptions, MessageIntakeOutcome } from \"./types.js\";\n\n/**\n * Recognize a magic word: a highest-priority chat control phrase that bypasses\n * trigger policy and queueing (see CONTEXT.md). One grammar for every\n * platform: optional leading slash, optional `@botname` suffix, any case.\n */\nexport function matchMagicWord(text: string): \"stop\" | null {\n return /^\\/?stop(?:@\\w+)?$/i.test(text.trim()) ? \"stop\" : null;\n}\n\n/**\n * Shared message ingress pipeline for platform adapters.\n *\n * Platform adapters normalize SDK events; this module owns the ordering for\n * messages that may start an agent run:\n *\n * magic word → trigger policy → attachments → log → busy policy → queue → dispatch\n *\n * Magic words are matched before the trigger gate — `stop` must never wait on\n * trigger filtering or queue behind a running agent turn. Adapters state\n * platform policy as data (`magicWord`, `busyPolicy`) instead of callbacks.\n */\nexport async function processMessageIntake<TEvent extends ConversationEvent>(\n options: MessageIntakeOptions<TEvent>,\n): Promise<MessageIntakeOutcome> {\n assertConversationId(options.eventBase.conversationId);\n if (options.eventBase.sessionKey !== undefined) {\n assertSessionKeyBelongsToConversation(\n options.eventBase.sessionKey,\n options.eventBase.conversationId,\n );\n }\n if (matchMagicWord(options.magicWord.text ?? options.eventBase.text) === \"stop\") {\n options.log?.({ ...options.logEntryBase, attachments: [] });\n await handleStopMagicWord(options);\n return \"magic-word\";\n }\n\n if (!options.addressed) {\n options.log?.({ ...options.logEntryBase, attachments: [] });\n return \"not-triggered\";\n }\n\n function prepareEvent(attachments: unknown[]): TEvent {\n const event = { ...options.eventBase, attachments } as TEvent;\n options.log?.({ ...options.logEntryBase, attachments });\n return event;\n }\n\n async function rejectedWhileBusy(): Promise<boolean> {\n const sessionKey = options.eventBase.sessionKey ?? options.eventBase.conversationId;\n if (!options.handler.isRunning(options.eventBase.address, sessionKey)) return false;\n await options.bot.postMessage(\n options.eventBase.conversationId,\n formatAlreadyWorking(options.bot, \"/stop\"),\n );\n return true;\n }\n\n function dispatch(event: TEvent): Promise<void> {\n const context = options.createContext(event);\n return options.handler.handleEvent(event, options.bot, context);\n }\n\n if (options.deferAttachmentsUntilRun) {\n // Busy rejection happens inside the queued work here, so the outcome is\n // already \"enqueued\" by the time it is evaluated.\n options.enqueue(options.queueKey, async () => {\n const event = prepareEvent(await options.processAttachments());\n if (options.busyPolicy === \"reject\" && (await rejectedWhileBusy())) return;\n return dispatch(event);\n });\n return \"enqueued\";\n }\n\n const event = prepareEvent(await options.processAttachments());\n if (options.busyPolicy === \"reject\" && (await rejectedWhileBusy())) return \"rejected-busy\";\n options.enqueue(options.queueKey, () => dispatch(event));\n return \"enqueued\";\n}\n\n/**\n * Resolve and stop the session a magic-word `stop` targets. When nothing is\n * running, reply only if the message addressed the bot — an unaddressed\n * \"stop\" in a busy channel should never make the bot pipe up.\n */\nasync function handleStopMagicWord<TEvent extends ConversationEvent>(\n options: MessageIntakeOptions<TEvent>,\n): Promise<void> {\n const { handler, bot, eventBase, magicWord } = options;\n const address = eventBase.address;\n const conversationId = eventBase.conversationId;\n const sessionKey = eventBase.sessionKey;\n\n let target = resolveStopTarget({ handler, address, sessionKey });\n if (!target && widensToScopedSession(magicWord.scopeFallback, sessionKey, conversationId)) {\n target = resolveOnlyScopedStopTarget(handler, address);\n }\n\n if (target) {\n if (eventBase.thread_ts) {\n await handler.handleStop(address, target, bot, eventBase.thread_ts);\n } else {\n await handler.handleStop(address, target, bot);\n }\n } else if (magicWord.addressed) {\n if (eventBase.thread_ts && bot.postInThread) {\n await bot.postInThread(conversationId, eventBase.thread_ts, formatNothingRunning(bot));\n } else {\n await bot.postMessage(conversationId, formatNothingRunning(bot));\n }\n }\n}\n\nfunction widensToScopedSession(\n scopeFallback: \"top-level\" | \"always\" | \"never\",\n sessionKey: string | undefined,\n conversationId: string,\n): boolean {\n if (scopeFallback === \"never\") return false;\n if (scopeFallback === \"always\") return true;\n // \"top-level\": only a message aimed at the persistent conversation session\n // may widen to the single running scoped session; thread messages stay put.\n return sessionKey === undefined || sessionKey === conversationId;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"progressive-renderer.d.ts","sourceRoot":"","sources":["../../src/adapters/progressive-renderer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EACd,qBAAqB,EAEtB,MAAM,eAAe,CAAC;AAQvB,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,YAAY,CAAC;AAE9D,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,cAAc,GAAG,MAAM,CASvE;
|
|
1
|
+
{"version":3,"file":"progressive-renderer.d.ts","sourceRoot":"","sources":["../../src/adapters/progressive-renderer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EACd,qBAAqB,EAEtB,MAAM,eAAe,CAAC;AAQvB,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,YAAY,CAAC;AAE9D,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,cAAc,GAAG,MAAM,CASvE;AA6hBD,wBAAgB,yBAAyB,CAAC,QAAQ,EAAE,2BAA2B,GAAG;IAChF,SAAS,EAAE,qBAAqB,CAAC;CAClC,CAEA"}
|
|
@@ -244,6 +244,10 @@ class ProgressiveRenderer {
|
|
|
244
244
|
// A secondary notification must not poison the response queue.
|
|
245
245
|
}
|
|
246
246
|
}
|
|
247
|
+
// Incremental/status updates are best effort. Replacements and finalization
|
|
248
|
+
// are delivery boundaries: callers must not mistake a rejected send for success.
|
|
249
|
+
if (label === "replaceResponse" || label === "finishResponse")
|
|
250
|
+
throw err;
|
|
247
251
|
});
|
|
248
252
|
this.queueTail = handled.catch(() => undefined);
|
|
249
253
|
return handled;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"progressive-renderer.js","sourceRoot":"","sources":["../../src/adapters/progressive-renderer.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,GAAG,MAAM,WAAW,CAAC;AACjC,OAAO,EACL,+BAA+B,EAC/B,cAAc,EACd,SAAS,GAEV,MAAM,aAAa,CAAC;AAGrB,MAAM,UAAU,wBAAwB,CAAC,MAAsB;IAC7D,MAAM,aAAa,GAAG,cAAc,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAClD,MAAM,QAAQ,GAAG,CAAC,MAAM,CAAC,UAAU,GAAG,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;IACvD,IAAI,IAAI,GAAG,KAAK,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,IAAI,MAAM,CAAC,QAAQ,IAAI,CAAC;IACzE,IAAI,MAAM,CAAC,KAAK;QAAE,IAAI,IAAI,KAAK,MAAM,CAAC,KAAK,EAA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,CAAC;YACtE,IAAI,OAAO,EAAE,KAAK,QAAQ,IAAI,OAAO,EAAE,KAAK,QAAQ;gBAAE,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACrE,CAAC;QACD,OAAO,GAAG,CAAC;IACb,CAAC;CACF;AAED,MAAM,UAAU,yBAAyB,CAAC,QAAqC;IAG7E,OAAO,EAAE,SAAS,EAAE,IAAI,mBAAmB,CAAC,QAAQ,CAAC,CAAC,SAAS,EAAE,CAAC;AACpE,CAAC","sourcesContent":["import type {\n ChatToolResult,\n ConversationResponder,\n SubagentProgressSnapshot,\n} from \"../adapter.js\";\nimport * as log from \"../log.js\";\nimport {\n createChatResponseErrorReporter,\n formatToolArgs,\n splitText,\n type ChatResponseErrorOperation,\n} from \"./shared.js\";\nimport type { ProgressiveRendererPlatform } from \"./types.js\";\n\nexport function formatMarkdownToolResult(result: ChatToolResult): string {\n const argsFormatted = formatToolArgs(result.args);\n const duration = (result.durationMs / 1000).toFixed(1);\n let text = `**${result.isError ? \"Error\" : \"Done\"} ${result.toolName}**`;\n if (result.label) text += `: ${result.label}`;\n text += ` (${duration}s)\\n`;\n if (argsFormatted) text += `\\`\\`\\`\\n${argsFormatted}\\n\\`\\`\\`\\n`;\n text += `**Result:**\\n\\`\\`\\`\\n${result.result}\\n\\`\\`\\``;\n return text;\n}\n\ninterface RendererState {\n responseId: string | null;\n source: string;\n working: boolean;\n streamActive: boolean;\n streamUnavailable: boolean;\n streamedSource: string;\n pendingChars: number;\n lastFlushAt: number;\n resetDelta: boolean;\n typingInterval: ReturnType<typeof setInterval> | null;\n typingFailureWarned: boolean;\n extraIds: Array<string | number>;\n /**\n * Messages holding the overflow of a response too long for one message,\n * in order. Reused across redraws — see `postSplit`.\n */\n continuationIds: Array<string | number>;\n}\n\n/**\n * Floor on how often a streaming response redraws.\n *\n * Every platform meters edits per channel — Slack's is the tightest at roughly\n * fifty a minute — and a redraw sends the whole message, so the cost is the\n * number of calls, not their size. One second keeps a long answer inside that\n * budget while still reading as live.\n *\n * This is a floor, not a target: the interval is measured from when the last\n * redraw *finished*, so a platform that slows down under load slows the redraw\n * rate with it instead of queueing work it cannot deliver.\n */\nconst DEFAULT_FLUSH_INTERVAL_MS = 1000;\n\nclass ProgressiveRenderer {\n readonly responder: ConversationResponder;\n private readonly state: RendererState;\n private readonly sanitize: (text: string) => string;\n private readonly reportResponseError;\n private readonly now = Date.now;\n private readonly flushIntervalMs: number;\n private queueTail = Promise.resolve();\n\n constructor(private readonly platform: ProgressiveRendererPlatform) {\n this.state = {\n responseId: platform.initialResponseId ?? null,\n source: \"\",\n working: true,\n streamActive: false,\n streamUnavailable: false,\n streamedSource: \"\",\n pendingChars: 0,\n lastFlushAt: 0,\n resetDelta: false,\n typingInterval: null,\n typingFailureWarned: false,\n extraIds: [],\n continuationIds: [],\n };\n this.sanitize = platform.sanitize ?? ((text: string) => text);\n this.reportResponseError = platform.responseErrorContext\n ? createChatResponseErrorReporter(() => platform.responseErrorContext!(this.state.responseId))\n : undefined;\n this.flushIntervalMs = platform.flushIntervalMs ?? DEFAULT_FLUSH_INTERVAL_MS;\n this.responder = this.createResponder();\n }\n\n private createResponder(): ConversationResponder {\n return {\n respond: (text) => this.respond(text),\n appendResponseDelta:\n this.platform.supportsDeltas || this.platform.stream\n ? (delta) => this.appendDelta(delta)\n : undefined,\n finishResponse:\n this.platform.supportsDeltas || this.platform.stream\n ? (finalText) => this.finishResponse(finalText)\n : undefined,\n replaceResponse: (text, options) => this.replaceResponse(text, options),\n replaceSubagentProgress: this.platform.formatSubagentProgress\n ? (progress, finalText) => this.replaceSubagentProgress(progress, finalText)\n : undefined,\n respondDiagnostic: (text, options) => this.respondDiagnostic(text, options),\n respondToolResult: (result) => this.respondToolResult(result),\n setTyping: (isTyping) => this.setTyping(isTyping),\n setWorking: (working) => this.setWorking(working),\n uploadFile: (filePath, title) => this.uploadFile(filePath, title),\n ...(this.platform.react ? { react: this.platform.react } : {}),\n deleteResponse: () => this.deleteResponse(),\n };\n }\n\n private stopTyping(): void {\n if (this.state.typingInterval !== null) {\n clearInterval(this.state.typingInterval);\n this.state.typingInterval = null;\n }\n }\n\n private provisional(text: string, working: boolean): string {\n if (this.platform.formatProvisional) return this.platform.formatProvisional(text, working);\n return working && this.platform.workingIndicator ? text + this.platform.workingIndicator : text;\n }\n\n private split(text: string): string[] {\n return splitText(text, this.platform.maxLength, this.platform.formatContinuation);\n }\n\n private async postOrUpdate(text: string): Promise<void> {\n if (this.state.responseId !== null) {\n await this.platform.update(this.state.responseId, text);\n return;\n }\n if (this.platform.typing?.stopOnSend) this.stopTyping();\n this.state.responseId = await this.platform.post(text);\n }\n\n private async postSplit(text: string): Promise<void> {\n const [head = text, ...tail] = this.split(text);\n await this.postOrUpdate(head);\n for (const [index, part] of tail.entries()) {\n const existing = this.state.continuationIds[index];\n if (existing !== undefined) {\n await this.platform.update(String(existing), part);\n continue;\n }\n if (this.platform.typing?.stopOnSend) this.stopTyping();\n const id = await this.platform.postExtra(part, this.state.responseId);\n if (id !== undefined && id !== null) this.state.continuationIds[index] = id;\n }\n }\n\n private async postExtra(text: string): Promise<void> {\n if (this.platform.typing?.stopOnSend) this.stopTyping();\n await this.platform.postExtra(text, this.state.responseId);\n }\n\n private async stopNativeStream(): Promise<void> {\n if (!this.state.streamActive || this.state.responseId === null || !this.platform.stream) return;\n const streamId = this.state.responseId;\n this.state.streamActive = false;\n this.state.streamedSource = \"\";\n await this.platform.stream.stop(streamId);\n }\n\n private async abandonNativeStream(): Promise<void> {\n if (!this.platform.stream || this.state.responseId === null) return;\n const streamId = this.state.responseId;\n this.state.streamActive = false;\n this.state.streamedSource = \"\";\n await this.platform.stream.stop(streamId).catch(() => undefined);\n if (this.state.responseId === streamId) this.state.responseId = null;\n }\n\n private async renderRaw(\n text: string,\n operation: \"render\" | \"replace\",\n options?: { createOverflowLink?: () => string },\n canonicalText = text,\n ): Promise<string> {\n try {\n await this.postSplit(text);\n return canonicalText;\n } catch (err) {\n if (!this.platform.handleTooLong) throw err;\n if (this.platform.isTooLongError && !this.platform.isTooLongError(err)) throw err;\n const fallback = await this.platform.handleTooLong({\n text: canonicalText,\n operation,\n options,\n responseId: this.state.responseId,\n write: (fallbackText) => this.postSplit(fallbackText),\n getResponseId: () => this.state.responseId,\n });\n return fallback.text;\n }\n }\n\n private async renderDelta(text: string): Promise<string> {\n if (this.state.working && !text.trim()) return text;\n const prepared = this.platform.prepareSource?.(text, this.state.working) ?? text;\n const stream = this.platform.stream;\n const display = this.provisional(prepared, this.state.working);\n if (!stream || this.state.streamUnavailable) {\n await this.renderRaw(display, \"render\", undefined, prepared);\n return prepared;\n }\n if (this.state.responseId !== null && !this.state.streamActive) {\n await this.renderRaw(display, \"render\", undefined, prepared);\n return prepared;\n }\n if (\n this.state.responseId !== null &&\n this.state.streamActive &&\n !prepared.startsWith(this.state.streamedSource)\n ) {\n await this.abandonNativeStream();\n await this.renderRaw(display, \"render\", undefined, prepared);\n return prepared;\n }\n\n try {\n if (this.state.responseId !== null) {\n const delta = prepared.slice(this.state.streamedSource.length);\n if (delta && delta.length >= (stream.minDeltaChars ?? 0)) {\n await stream.append(this.state.responseId, delta);\n this.state.streamedSource = prepared;\n }\n return prepared;\n }\n this.state.responseId = await stream.start(prepared);\n this.state.streamActive = true;\n this.state.streamedSource = prepared;\n return prepared;\n } catch (err) {\n this.state.streamUnavailable = true;\n log.logWarning(\n \"Native response streaming unavailable; falling back to message updates\",\n err instanceof Error ? err.message : String(err),\n );\n await this.abandonNativeStream();\n await this.renderRaw(display, \"render\", undefined, prepared);\n return prepared;\n }\n }\n\n private async renderFinal(text: string): Promise<string> {\n const stream = this.platform.stream;\n if (stream && this.state.streamActive && this.state.responseId !== null) {\n let streamed = false;\n try {\n if (text.startsWith(this.state.streamedSource)) {\n const delta = text.slice(this.state.streamedSource.length);\n if (delta) await stream.append(this.state.responseId, delta);\n await stream.stop(this.state.responseId);\n streamed = true;\n }\n } catch (err) {\n this.state.streamUnavailable = true;\n log.logWarning(\n \"Native response streaming unavailable; falling back to message updates\",\n err instanceof Error ? err.message : String(err),\n );\n }\n this.state.streamActive = false;\n this.state.streamedSource = \"\";\n if (streamed) {\n if (this.platform.needsCanonicalRender?.(text)) await this.renderRaw(text, \"render\");\n return text;\n }\n await this.abandonNativeStream();\n }\n if (this.state.responseId !== null || text) return this.renderRaw(text, \"render\");\n return text;\n }\n\n private async run(\n label: string,\n operation: ChatResponseErrorOperation,\n work: () => Promise<void>,\n extra: () => Record<string, unknown>,\n ): Promise<void> {\n const operationPromise = this.queueTail.then(work);\n const handled = operationPromise.catch(async (err) => {\n const message = err instanceof Error ? err.message : String(err);\n log.logWarning(`${this.platform.label} ${label} error`, message);\n this.reportResponseError?.(err, operation, extra());\n if (this.platform.notifySendFailure) {\n try {\n await this.platform.notifySendFailure(message);\n } catch {\n // A secondary notification must not poison the response queue.\n }\n }\n });\n this.queueTail = handled.catch(() => undefined);\n return handled;\n }\n\n private async appendDelta(delta: string): Promise<void> {\n await this.run(\n \"appendResponseDelta\",\n \"respond\",\n async () => {\n if (!delta) return;\n if (this.state.resetDelta) {\n this.state.source = \"\";\n this.state.pendingChars = 0;\n this.state.resetDelta = false;\n }\n const sanitized = this.sanitize(delta);\n this.state.source += sanitized;\n this.state.pendingChars += sanitized.length;\n const elapsed = this.now() - this.state.lastFlushAt;\n if (\n this.state.lastFlushAt === 0 ||\n (elapsed >= this.flushIntervalMs && this.state.pendingChars > 0)\n ) {\n this.state.pendingChars = 0;\n try {\n this.state.source = await this.renderDelta(this.state.source);\n } finally {\n // A rejected edit still spent an API call. Pace subsequent deltas\n // from its completion too, retaining source for the next attempt.\n this.state.lastFlushAt = this.now();\n }\n }\n },\n () => ({ textLength: delta.length, accumulatedLength: this.state.source.length }),\n );\n }\n\n private async respond(text: string): Promise<void> {\n await this.run(\n \"respond\",\n \"respond\",\n async () => {\n const sanitized = this.sanitize(text);\n this.state.source = this.state.source ? `${this.state.source}\\n${sanitized}` : sanitized;\n this.state.pendingChars = 0;\n this.state.source = await this.renderDelta(this.state.source);\n if (this.state.responseId !== null && this.platform.logIntermediateResponses) {\n this.platform.logBotResponse?.(text, this.state.responseId);\n }\n },\n () => ({\n phase: this.state.responseId ? \"update\" : \"initial_post\",\n textLength: text.length,\n accumulatedLength: this.state.source.length,\n }),\n );\n }\n\n private async finishResponse(finalText?: string): Promise<void> {\n await this.run(\n \"finishResponse\",\n \"set_working\",\n async () => {\n if (finalText !== undefined) this.state.source = this.sanitize(finalText);\n this.state.resetDelta = false;\n this.state.pendingChars = 0;\n this.stopTyping();\n this.state.working = false;\n this.state.source = await this.renderFinal(this.state.source);\n if (this.state.responseId !== null) {\n this.platform.logBotResponse?.(this.state.source, this.state.responseId);\n }\n await this.platform.onFinish?.(this.state.source, this.state.responseId);\n },\n () => ({ finalTextLength: finalText?.length }),\n );\n }\n\n private async replaceResponse(\n text: string,\n options?: { createOverflowLink?: () => string },\n ): Promise<void> {\n await this.run(\n \"replaceResponse\",\n \"replace_response\",\n async () => {\n this.state.source = this.sanitize(text);\n this.state.pendingChars = 0;\n this.state.resetDelta = true;\n if (this.state.streamActive) await this.stopNativeStream();\n if (this.state.working && !this.state.source.trim()) return;\n const prepared =\n this.platform.prepareSource?.(this.state.source, this.state.working) ?? this.state.source;\n this.state.source = await this.renderRaw(\n this.provisional(prepared, this.state.working),\n \"replace\",\n options,\n prepared,\n );\n },\n () => ({ textLength: text.length, hadExistingResponse: Boolean(this.state.responseId) }),\n );\n }\n\n private async replaceSubagentProgress(\n progress: SubagentProgressSnapshot,\n finalText?: string,\n ): Promise<void> {\n const dashboard = this.platform.formatSubagentProgress!(progress);\n await this.responder.replaceResponse(finalText ? `${dashboard}\\n\\n${finalText}` : dashboard);\n }\n\n private async respondDiagnostic(\n text: string,\n options: { style?: \"muted\" | \"error\" } = {},\n ): Promise<void> {\n await this.run(\n \"respondDiagnostic\",\n \"respond_diagnostic\",\n async () => {\n const ids = this.platform.postDiagnostic\n ? await this.platform.postDiagnostic(text, options, this.state.responseId)\n : await this.postDefaultDiagnostic(text, options);\n this.state.extraIds.push(...ids);\n },\n () => ({ textLength: text.length, style: options.style }),\n );\n }\n\n private async respondToolResult(result: ChatToolResult): Promise<void> {\n await this.responder.respondDiagnostic(this.platform.formatToolResult(result));\n }\n\n private async setTyping(isTyping: boolean): Promise<void> {\n await this.run(\n \"setTyping\",\n \"set_working\",\n async () => {\n if (this.platform.setTyping) {\n await this.platform.setTyping(isTyping, this.state.responseId);\n return;\n }\n const typing = this.platform.typing;\n if (!typing) return;\n const onTypingError = (err: unknown): void => {\n if (this.state.typingFailureWarned) return;\n this.state.typingFailureWarned = true;\n log.logWarning(\n `${this.platform.label} sendTyping failed (further occurrences suppressed for this session)`,\n err instanceof Error ? err.message : String(err),\n );\n };\n if (isTyping && this.state.typingInterval === null) {\n typing.send().catch(onTypingError);\n this.state.typingInterval = setInterval(() => {\n typing.send().catch(onTypingError);\n }, typing.intervalMs);\n } else if (!isTyping) {\n this.stopTyping();\n }\n },\n () => ({ working: isTyping }),\n );\n }\n\n private async setWorking(working: boolean): Promise<void> {\n await this.run(\n \"setWorking\",\n \"set_working\",\n async () => {\n this.state.working = working;\n if (!working) this.stopTyping();\n await this.platform.onWorkingChanged?.(working, this.state.responseId);\n if (\n this.state.responseId === null ||\n (!this.platform.workingIndicator && !this.platform.stream)\n ) {\n return;\n }\n if (working && !this.state.source.trim()) return;\n if (this.state.streamActive && !working) {\n await this.stopNativeStream();\n return;\n }\n if (this.state.responseId !== null) {\n this.state.source = await this.renderRaw(\n this.provisional(this.state.source, working),\n \"render\",\n undefined,\n this.state.source,\n );\n }\n },\n () => ({ working }),\n );\n }\n\n private async uploadFile(filePath: string, title?: string): Promise<void> {\n if (this.platform.uploadFile) {\n await this.platform.uploadFile(filePath, title);\n return;\n }\n const note = this.platform.uploadFallbackNote?.(title ?? filePath);\n if (note === undefined) return;\n await this.run(\n \"uploadFile\",\n \"respond_diagnostic\",\n () => this.postExtra(note),\n () => ({ filePath }),\n );\n }\n\n private async deleteResponse(): Promise<void> {\n await this.run(\n \"deleteResponse\",\n \"respond\",\n async () => {\n this.stopTyping();\n if (this.state.streamActive) await this.stopNativeStream().catch(() => undefined);\n for (const id of [...this.state.extraIds, ...this.state.continuationIds]) {\n try {\n await this.platform.deleteExtra?.(id);\n } catch {\n // Deleting diagnostics is best effort.\n }\n }\n this.state.extraIds = [];\n this.state.continuationIds = [];\n if (this.state.responseId !== null) {\n try {\n await this.platform.delete?.(this.state.responseId);\n } catch {\n // Deleting the main response is best effort.\n }\n }\n this.state.responseId = null;\n this.state.source = \"\";\n this.state.streamUnavailable = false;\n this.state.streamedSource = \"\";\n this.state.streamActive = false;\n this.state.resetDelta = false;\n this.state.working = true;\n },\n () => ({}),\n );\n }\n\n private async postDefaultDiagnostic(\n text: string,\n options: { style?: \"muted\" | \"error\" },\n ): Promise<Array<string | number>> {\n const prefix = options.style === \"error\" ? this.platform.errorPrefix : \"\";\n const ids: Array<string | number> = [];\n for (const part of this.split(this.sanitize(`${prefix}${text}`))) {\n const id = await this.platform.postExtra(part, this.state.responseId);\n if (typeof id === \"string\" || typeof id === \"number\") ids.push(id);\n }\n return ids;\n }\n}\n\nexport function createProgressiveRenderer(platform: ProgressiveRendererPlatform): {\n responder: ConversationResponder;\n} {\n return { responder: new ProgressiveRenderer(platform).responder };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"progressive-renderer.js","sourceRoot":"","sources":["../../src/adapters/progressive-renderer.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,GAAG,MAAM,WAAW,CAAC;AACjC,OAAO,EACL,+BAA+B,EAC/B,cAAc,EACd,SAAS,GAEV,MAAM,aAAa,CAAC;AAGrB,MAAM,UAAU,wBAAwB,CAAC,MAAsB;IAC7D,MAAM,aAAa,GAAG,cAAc,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAClD,MAAM,QAAQ,GAAG,CAAC,MAAM,CAAC,UAAU,GAAG,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,CAA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AQ,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,CAAC;QAC1E,MAAM,GAAG,GAA2B,EAAE,CAAC;QACvC,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,MAAM,GAAG,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC;YACjE,MAAM,EAAE,GAAG,MAAM,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;YACtE,IAAI,OAAO,EAAE,KAAK,QAAQ,IAAI,OAAO,EAAE,KAAK,QAAQ;gBAAE,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACrE,CAAC;QACD,OAAO,GAAG,CAAC;IACb,CAAC;CACF;AAED,MAAM,UAAU,yBAAyB,CAAC,QAAqC;IAG7E,OAAO,EAAE,SAAS,EAAE,IAAI,mBAAmB,CAAC,QAAQ,CAAC,CAAC,SAAS,EAAE,CAAC;AACpE,CAAC","sourcesContent":["import type {\n ChatToolResult,\n ConversationResponder,\n SubagentProgressSnapshot,\n} from \"../adapter.js\";\nimport * as log from \"../log.js\";\nimport {\n createChatResponseErrorReporter,\n formatToolArgs,\n splitText,\n type ChatResponseErrorOperation,\n} from \"./shared.js\";\nimport type { ProgressiveRendererPlatform } from \"./types.js\";\n\nexport function formatMarkdownToolResult(result: ChatToolResult): string {\n const argsFormatted = formatToolArgs(result.args);\n const duration = (result.durationMs / 1000).toFixed(1);\n let text = `**${result.isError ? \"Error\" : \"Done\"} ${result.toolName}**`;\n if (result.label) text += `: ${result.label}`;\n text += ` (${duration}s)\\n`;\n if (argsFormatted) text += `\\`\\`\\`\\n${argsFormatted}\\n\\`\\`\\`\\n`;\n text += `**Result:**\\n\\`\\`\\`\\n${result.result}\\n\\`\\`\\``;\n return text;\n}\n\ninterface RendererState {\n responseId: string | null;\n source: string;\n working: boolean;\n streamActive: boolean;\n streamUnavailable: boolean;\n streamedSource: string;\n pendingChars: number;\n lastFlushAt: number;\n resetDelta: boolean;\n typingInterval: ReturnType<typeof setInterval> | null;\n typingFailureWarned: boolean;\n extraIds: Array<string | number>;\n /**\n * Messages holding the overflow of a response too long for one message,\n * in order. Reused across redraws — see `postSplit`.\n */\n continuationIds: Array<string | number>;\n}\n\n/**\n * Floor on how often a streaming response redraws.\n *\n * Every platform meters edits per channel — Slack's is the tightest at roughly\n * fifty a minute — and a redraw sends the whole message, so the cost is the\n * number of calls, not their size. One second keeps a long answer inside that\n * budget while still reading as live.\n *\n * This is a floor, not a target: the interval is measured from when the last\n * redraw *finished*, so a platform that slows down under load slows the redraw\n * rate with it instead of queueing work it cannot deliver.\n */\nconst DEFAULT_FLUSH_INTERVAL_MS = 1000;\n\nclass ProgressiveRenderer {\n readonly responder: ConversationResponder;\n private readonly state: RendererState;\n private readonly sanitize: (text: string) => string;\n private readonly reportResponseError;\n private readonly now = Date.now;\n private readonly flushIntervalMs: number;\n private queueTail = Promise.resolve();\n\n constructor(private readonly platform: ProgressiveRendererPlatform) {\n this.state = {\n responseId: platform.initialResponseId ?? null,\n source: \"\",\n working: true,\n streamActive: false,\n streamUnavailable: false,\n streamedSource: \"\",\n pendingChars: 0,\n lastFlushAt: 0,\n resetDelta: false,\n typingInterval: null,\n typingFailureWarned: false,\n extraIds: [],\n continuationIds: [],\n };\n this.sanitize = platform.sanitize ?? ((text: string) => text);\n this.reportResponseError = platform.responseErrorContext\n ? createChatResponseErrorReporter(() => platform.responseErrorContext!(this.state.responseId))\n : undefined;\n this.flushIntervalMs = platform.flushIntervalMs ?? DEFAULT_FLUSH_INTERVAL_MS;\n this.responder = this.createResponder();\n }\n\n private createResponder(): ConversationResponder {\n return {\n respond: (text) => this.respond(text),\n appendResponseDelta:\n this.platform.supportsDeltas || this.platform.stream\n ? (delta) => this.appendDelta(delta)\n : undefined,\n finishResponse:\n this.platform.supportsDeltas || this.platform.stream\n ? (finalText) => this.finishResponse(finalText)\n : undefined,\n replaceResponse: (text, options) => this.replaceResponse(text, options),\n replaceSubagentProgress: this.platform.formatSubagentProgress\n ? (progress, finalText) => this.replaceSubagentProgress(progress, finalText)\n : undefined,\n respondDiagnostic: (text, options) => this.respondDiagnostic(text, options),\n respondToolResult: (result) => this.respondToolResult(result),\n setTyping: (isTyping) => this.setTyping(isTyping),\n setWorking: (working) => this.setWorking(working),\n uploadFile: (filePath, title) => this.uploadFile(filePath, title),\n ...(this.platform.react ? { react: this.platform.react } : {}),\n deleteResponse: () => this.deleteResponse(),\n };\n }\n\n private stopTyping(): void {\n if (this.state.typingInterval !== null) {\n clearInterval(this.state.typingInterval);\n this.state.typingInterval = null;\n }\n }\n\n private provisional(text: string, working: boolean): string {\n if (this.platform.formatProvisional) return this.platform.formatProvisional(text, working);\n return working && this.platform.workingIndicator ? text + this.platform.workingIndicator : text;\n }\n\n private split(text: string): string[] {\n return splitText(text, this.platform.maxLength, this.platform.formatContinuation);\n }\n\n private async postOrUpdate(text: string): Promise<void> {\n if (this.state.responseId !== null) {\n await this.platform.update(this.state.responseId, text);\n return;\n }\n if (this.platform.typing?.stopOnSend) this.stopTyping();\n this.state.responseId = await this.platform.post(text);\n }\n\n private async postSplit(text: string): Promise<void> {\n const [head = text, ...tail] = this.split(text);\n await this.postOrUpdate(head);\n for (const [index, part] of tail.entries()) {\n const existing = this.state.continuationIds[index];\n if (existing !== undefined) {\n await this.platform.update(String(existing), part);\n continue;\n }\n if (this.platform.typing?.stopOnSend) this.stopTyping();\n const id = await this.platform.postExtra(part, this.state.responseId);\n if (id !== undefined && id !== null) this.state.continuationIds[index] = id;\n }\n }\n\n private async postExtra(text: string): Promise<void> {\n if (this.platform.typing?.stopOnSend) this.stopTyping();\n await this.platform.postExtra(text, this.state.responseId);\n }\n\n private async stopNativeStream(): Promise<void> {\n if (!this.state.streamActive || this.state.responseId === null || !this.platform.stream) return;\n const streamId = this.state.responseId;\n this.state.streamActive = false;\n this.state.streamedSource = \"\";\n await this.platform.stream.stop(streamId);\n }\n\n private async abandonNativeStream(): Promise<void> {\n if (!this.platform.stream || this.state.responseId === null) return;\n const streamId = this.state.responseId;\n this.state.streamActive = false;\n this.state.streamedSource = \"\";\n await this.platform.stream.stop(streamId).catch(() => undefined);\n if (this.state.responseId === streamId) this.state.responseId = null;\n }\n\n private async renderRaw(\n text: string,\n operation: \"render\" | \"replace\",\n options?: { createOverflowLink?: () => string },\n canonicalText = text,\n ): Promise<string> {\n try {\n await this.postSplit(text);\n return canonicalText;\n } catch (err) {\n if (!this.platform.handleTooLong) throw err;\n if (this.platform.isTooLongError && !this.platform.isTooLongError(err)) throw err;\n const fallback = await this.platform.handleTooLong({\n text: canonicalText,\n operation,\n options,\n responseId: this.state.responseId,\n write: (fallbackText) => this.postSplit(fallbackText),\n getResponseId: () => this.state.responseId,\n });\n return fallback.text;\n }\n }\n\n private async renderDelta(text: string): Promise<string> {\n if (this.state.working && !text.trim()) return text;\n const prepared = this.platform.prepareSource?.(text, this.state.working) ?? text;\n const stream = this.platform.stream;\n const display = this.provisional(prepared, this.state.working);\n if (!stream || this.state.streamUnavailable) {\n await this.renderRaw(display, \"render\", undefined, prepared);\n return prepared;\n }\n if (this.state.responseId !== null && !this.state.streamActive) {\n await this.renderRaw(display, \"render\", undefined, prepared);\n return prepared;\n }\n if (\n this.state.responseId !== null &&\n this.state.streamActive &&\n !prepared.startsWith(this.state.streamedSource)\n ) {\n await this.abandonNativeStream();\n await this.renderRaw(display, \"render\", undefined, prepared);\n return prepared;\n }\n\n try {\n if (this.state.responseId !== null) {\n const delta = prepared.slice(this.state.streamedSource.length);\n if (delta && delta.length >= (stream.minDeltaChars ?? 0)) {\n await stream.append(this.state.responseId, delta);\n this.state.streamedSource = prepared;\n }\n return prepared;\n }\n this.state.responseId = await stream.start(prepared);\n this.state.streamActive = true;\n this.state.streamedSource = prepared;\n return prepared;\n } catch (err) {\n this.state.streamUnavailable = true;\n log.logWarning(\n \"Native response streaming unavailable; falling back to message updates\",\n err instanceof Error ? err.message : String(err),\n );\n await this.abandonNativeStream();\n await this.renderRaw(display, \"render\", undefined, prepared);\n return prepared;\n }\n }\n\n private async renderFinal(text: string): Promise<string> {\n const stream = this.platform.stream;\n if (stream && this.state.streamActive && this.state.responseId !== null) {\n let streamed = false;\n try {\n if (text.startsWith(this.state.streamedSource)) {\n const delta = text.slice(this.state.streamedSource.length);\n if (delta) await stream.append(this.state.responseId, delta);\n await stream.stop(this.state.responseId);\n streamed = true;\n }\n } catch (err) {\n this.state.streamUnavailable = true;\n log.logWarning(\n \"Native response streaming unavailable; falling back to message updates\",\n err instanceof Error ? err.message : String(err),\n );\n }\n this.state.streamActive = false;\n this.state.streamedSource = \"\";\n if (streamed) {\n if (this.platform.needsCanonicalRender?.(text)) await this.renderRaw(text, \"render\");\n return text;\n }\n await this.abandonNativeStream();\n }\n if (this.state.responseId !== null || text) return this.renderRaw(text, \"render\");\n return text;\n }\n\n private async run(\n label: string,\n operation: ChatResponseErrorOperation,\n work: () => Promise<void>,\n extra: () => Record<string, unknown>,\n ): Promise<void> {\n const operationPromise = this.queueTail.then(work);\n const handled = operationPromise.catch(async (err) => {\n const message = err instanceof Error ? err.message : String(err);\n log.logWarning(`${this.platform.label} ${label} error`, message);\n this.reportResponseError?.(err, operation, extra());\n if (this.platform.notifySendFailure) {\n try {\n await this.platform.notifySendFailure(message);\n } catch {\n // A secondary notification must not poison the response queue.\n }\n }\n // Incremental/status updates are best effort. Replacements and finalization\n // are delivery boundaries: callers must not mistake a rejected send for success.\n if (label === \"replaceResponse\" || label === \"finishResponse\") throw err;\n });\n this.queueTail = handled.catch(() => undefined);\n return handled;\n }\n\n private async appendDelta(delta: string): Promise<void> {\n await this.run(\n \"appendResponseDelta\",\n \"respond\",\n async () => {\n if (!delta) return;\n if (this.state.resetDelta) {\n this.state.source = \"\";\n this.state.pendingChars = 0;\n this.state.resetDelta = false;\n }\n const sanitized = this.sanitize(delta);\n this.state.source += sanitized;\n this.state.pendingChars += sanitized.length;\n const elapsed = this.now() - this.state.lastFlushAt;\n if (\n this.state.lastFlushAt === 0 ||\n (elapsed >= this.flushIntervalMs && this.state.pendingChars > 0)\n ) {\n this.state.pendingChars = 0;\n try {\n this.state.source = await this.renderDelta(this.state.source);\n } finally {\n // A rejected edit still spent an API call. Pace subsequent deltas\n // from its completion too, retaining source for the next attempt.\n this.state.lastFlushAt = this.now();\n }\n }\n },\n () => ({ textLength: delta.length, accumulatedLength: this.state.source.length }),\n );\n }\n\n private async respond(text: string): Promise<void> {\n await this.run(\n \"respond\",\n \"respond\",\n async () => {\n const sanitized = this.sanitize(text);\n this.state.source = this.state.source ? `${this.state.source}\\n${sanitized}` : sanitized;\n this.state.pendingChars = 0;\n this.state.source = await this.renderDelta(this.state.source);\n if (this.state.responseId !== null && this.platform.logIntermediateResponses) {\n this.platform.logBotResponse?.(text, this.state.responseId);\n }\n },\n () => ({\n phase: this.state.responseId ? \"update\" : \"initial_post\",\n textLength: text.length,\n accumulatedLength: this.state.source.length,\n }),\n );\n }\n\n private async finishResponse(finalText?: string): Promise<void> {\n await this.run(\n \"finishResponse\",\n \"set_working\",\n async () => {\n if (finalText !== undefined) this.state.source = this.sanitize(finalText);\n this.state.resetDelta = false;\n this.state.pendingChars = 0;\n this.stopTyping();\n this.state.working = false;\n this.state.source = await this.renderFinal(this.state.source);\n if (this.state.responseId !== null) {\n this.platform.logBotResponse?.(this.state.source, this.state.responseId);\n }\n await this.platform.onFinish?.(this.state.source, this.state.responseId);\n },\n () => ({ finalTextLength: finalText?.length }),\n );\n }\n\n private async replaceResponse(\n text: string,\n options?: { createOverflowLink?: () => string },\n ): Promise<void> {\n await this.run(\n \"replaceResponse\",\n \"replace_response\",\n async () => {\n this.state.source = this.sanitize(text);\n this.state.pendingChars = 0;\n this.state.resetDelta = true;\n if (this.state.streamActive) await this.stopNativeStream();\n if (this.state.working && !this.state.source.trim()) return;\n const prepared =\n this.platform.prepareSource?.(this.state.source, this.state.working) ?? this.state.source;\n this.state.source = await this.renderRaw(\n this.provisional(prepared, this.state.working),\n \"replace\",\n options,\n prepared,\n );\n },\n () => ({ textLength: text.length, hadExistingResponse: Boolean(this.state.responseId) }),\n );\n }\n\n private async replaceSubagentProgress(\n progress: SubagentProgressSnapshot,\n finalText?: string,\n ): Promise<void> {\n const dashboard = this.platform.formatSubagentProgress!(progress);\n await this.responder.replaceResponse(finalText ? `${dashboard}\\n\\n${finalText}` : dashboard);\n }\n\n private async respondDiagnostic(\n text: string,\n options: { style?: \"muted\" | \"error\" } = {},\n ): Promise<void> {\n await this.run(\n \"respondDiagnostic\",\n \"respond_diagnostic\",\n async () => {\n const ids = this.platform.postDiagnostic\n ? await this.platform.postDiagnostic(text, options, this.state.responseId)\n : await this.postDefaultDiagnostic(text, options);\n this.state.extraIds.push(...ids);\n },\n () => ({ textLength: text.length, style: options.style }),\n );\n }\n\n private async respondToolResult(result: ChatToolResult): Promise<void> {\n await this.responder.respondDiagnostic(this.platform.formatToolResult(result));\n }\n\n private async setTyping(isTyping: boolean): Promise<void> {\n await this.run(\n \"setTyping\",\n \"set_working\",\n async () => {\n if (this.platform.setTyping) {\n await this.platform.setTyping(isTyping, this.state.responseId);\n return;\n }\n const typing = this.platform.typing;\n if (!typing) return;\n const onTypingError = (err: unknown): void => {\n if (this.state.typingFailureWarned) return;\n this.state.typingFailureWarned = true;\n log.logWarning(\n `${this.platform.label} sendTyping failed (further occurrences suppressed for this session)`,\n err instanceof Error ? err.message : String(err),\n );\n };\n if (isTyping && this.state.typingInterval === null) {\n typing.send().catch(onTypingError);\n this.state.typingInterval = setInterval(() => {\n typing.send().catch(onTypingError);\n }, typing.intervalMs);\n } else if (!isTyping) {\n this.stopTyping();\n }\n },\n () => ({ working: isTyping }),\n );\n }\n\n private async setWorking(working: boolean): Promise<void> {\n await this.run(\n \"setWorking\",\n \"set_working\",\n async () => {\n this.state.working = working;\n if (!working) this.stopTyping();\n await this.platform.onWorkingChanged?.(working, this.state.responseId);\n if (\n this.state.responseId === null ||\n (!this.platform.workingIndicator && !this.platform.stream)\n ) {\n return;\n }\n if (working && !this.state.source.trim()) return;\n if (this.state.streamActive && !working) {\n await this.stopNativeStream();\n return;\n }\n if (this.state.responseId !== null) {\n this.state.source = await this.renderRaw(\n this.provisional(this.state.source, working),\n \"render\",\n undefined,\n this.state.source,\n );\n }\n },\n () => ({ working }),\n );\n }\n\n private async uploadFile(filePath: string, title?: string): Promise<void> {\n if (this.platform.uploadFile) {\n await this.platform.uploadFile(filePath, title);\n return;\n }\n const note = this.platform.uploadFallbackNote?.(title ?? filePath);\n if (note === undefined) return;\n await this.run(\n \"uploadFile\",\n \"respond_diagnostic\",\n () => this.postExtra(note),\n () => ({ filePath }),\n );\n }\n\n private async deleteResponse(): Promise<void> {\n await this.run(\n \"deleteResponse\",\n \"respond\",\n async () => {\n this.stopTyping();\n if (this.state.streamActive) await this.stopNativeStream().catch(() => undefined);\n for (const id of [...this.state.extraIds, ...this.state.continuationIds]) {\n try {\n await this.platform.deleteExtra?.(id);\n } catch {\n // Deleting diagnostics is best effort.\n }\n }\n this.state.extraIds = [];\n this.state.continuationIds = [];\n if (this.state.responseId !== null) {\n try {\n await this.platform.delete?.(this.state.responseId);\n } catch {\n // Deleting the main response is best effort.\n }\n }\n this.state.responseId = null;\n this.state.source = \"\";\n this.state.streamUnavailable = false;\n this.state.streamedSource = \"\";\n this.state.streamActive = false;\n this.state.resetDelta = false;\n this.state.working = true;\n },\n () => ({}),\n );\n }\n\n private async postDefaultDiagnostic(\n text: string,\n options: { style?: \"muted\" | \"error\" },\n ): Promise<Array<string | number>> {\n const prefix = options.style === \"error\" ? this.platform.errorPrefix : \"\";\n const ids: Array<string | number> = [];\n for (const part of this.split(this.sanitize(`${prefix}${text}`))) {\n const id = await this.platform.postExtra(part, this.state.responseId);\n if (typeof id === \"string\" || typeof id === \"number\") ids.push(id);\n }\n return ids;\n }\n}\n\nexport function createProgressiveRenderer(platform: ProgressiveRendererPlatform): {\n responder: ConversationResponder;\n} {\n return { responder: new ProgressiveRenderer(platform).responder };\n}\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type MessagingBot, type ConversationEvent, type MessagingEventHandler, type MessagingInfo, type PlatformHistoryMessage, type PlatformHistoryOptions, type PlatformUserInfo } from "../../adapter.js";
|
|
2
2
|
import { type Workspace } from "../../office/index.js";
|
|
3
|
-
import type {
|
|
3
|
+
import type { EventScheduler } from "../../events/scheduler.js";
|
|
4
4
|
import type { SlackChannel, SlackUser } from "./types.js";
|
|
5
5
|
import { type SuggestedPrompt } from "./assistant.js";
|
|
6
6
|
/** Slices `text` into pieces that each fit one streaming call. */
|
|
@@ -38,7 +38,7 @@ export declare class SlackMessagingBot implements MessagingBot {
|
|
|
38
38
|
private stopped;
|
|
39
39
|
private queues;
|
|
40
40
|
private intake;
|
|
41
|
-
private
|
|
41
|
+
private eventScheduler;
|
|
42
42
|
/** Host office dir for a Slack conversation. */
|
|
43
43
|
private conversationDir;
|
|
44
44
|
private resolveReplyMode;
|
|
@@ -48,7 +48,7 @@ export declare class SlackMessagingBot implements MessagingBot {
|
|
|
48
48
|
botToken: string;
|
|
49
49
|
workspace: Workspace;
|
|
50
50
|
});
|
|
51
|
-
|
|
51
|
+
setEventScheduler(scheduler: EventScheduler): void;
|
|
52
52
|
start(): Promise<void>;
|
|
53
53
|
stop(): Promise<void>;
|
|
54
54
|
getUser(userId: string): SlackUser | undefined;
|
|
@@ -144,6 +144,7 @@ export declare class SlackMessagingBot implements MessagingBot {
|
|
|
144
144
|
enqueueEvent(event: ConversationEvent): boolean;
|
|
145
145
|
private getQueue;
|
|
146
146
|
private resolveQueueKey;
|
|
147
|
+
private isTaskThread;
|
|
147
148
|
private hasKnownThreadSession;
|
|
148
149
|
/**
|
|
149
150
|
* Slack's own conversation vocabulary for this channel, from the metadata
|
|
@@ -156,6 +157,10 @@ export declare class SlackMessagingBot implements MessagingBot {
|
|
|
156
157
|
private channelKindFor;
|
|
157
158
|
private processSlackMessageIntake;
|
|
158
159
|
private appendRunningTasks;
|
|
160
|
+
/**
|
|
161
|
+
* Scheduled jobs of the opener's own DM office only: the App Home is a
|
|
162
|
+
* personal surface, so other offices' schedules are not listed here.
|
|
163
|
+
*/
|
|
159
164
|
private appendScheduledJobs;
|
|
160
165
|
private buildHomeView;
|
|
161
166
|
private createCommandAdapters;
|
|
@@ -170,6 +175,7 @@ export declare class SlackMessagingBot implements MessagingBot {
|
|
|
170
175
|
private setupEventHandlers;
|
|
171
176
|
private handleAppMention;
|
|
172
177
|
private admitHumanMessage;
|
|
178
|
+
private deliverTaskUpdate;
|
|
173
179
|
private handleMessageEvent;
|
|
174
180
|
private handleSlashCommand;
|
|
175
181
|
private handleAppHomeOpened;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bot.d.ts","sourceRoot":"","sources":["../../../src/adapters/slack/bot.ts"],"names":[],"mappings":"AAMA,OAAO,EAGL,KAAK,YAAY,EAEjB,KAAK,iBAAiB,EACtB,KAAK,qBAAqB,EAI1B,KAAK,aAAa,EAElB,KAAK,sBAAsB,EAC3B,KAAK,sBAAsB,EAC3B,KAAK,gBAAgB,EACtB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAuB,KAAK,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAG5E,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"bot.d.ts","sourceRoot":"","sources":["../../../src/adapters/slack/bot.ts"],"names":[],"mappings":"AAMA,OAAO,EAGL,KAAK,YAAY,EAEjB,KAAK,iBAAiB,EACtB,KAAK,qBAAqB,EAI1B,KAAK,aAAa,EAElB,KAAK,sBAAsB,EAC3B,KAAK,sBAAsB,EAC3B,KAAK,gBAAgB,EACtB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAuB,KAAK,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAG5E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAGhE,OAAO,KAAK,EAGV,YAAY,EAEZ,SAAS,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