@shumkov/orchestra 0.4.1 → 0.4.2

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.
@@ -105,6 +105,15 @@ function _maybeWarnR12Migration({ rawPm, canonical, chatId, threadId, chatCfg, t
105
105
  * @param {string} [opts.channelsClaudeBin] — absolute path to pinned claude binary;
106
106
  * required when ANY chat routes to 'cli'. (Name kept for back-compat with
107
107
  * existing wiring; can be renamed to `claudeBin` in a future refactor.)
108
+ * @param {string|Function} [opts.displayHint] — surface-rendering hint prepended to
109
+ * the CliProcess system prompt. Accepts EITHER a static string (applied to every
110
+ * session) OR a resolver `(chatId, threadId, config) => string` invoked once per
111
+ * spawn, just before the CliProcess is constructed. The resolver receives the
112
+ * spawning chat/topic and the factory's config so the consumer can implement its
113
+ * own per-chat/topic precedence (e.g. a per-chat rich-text toggle) without the
114
+ * engine knowing anything about the consumer's config shape. The resolved string
115
+ * is what reaches CliProcess. Only the 'cli' backend uses this; the 'sdk' backend
116
+ * gets its per-chat hint via spawnFn instead.
108
117
  * @returns {Function} processFactory(sessionKey, ctx) → Process
109
118
  */
110
119
  function createProcessFactory({
@@ -153,13 +162,20 @@ function createProcessFactory({
153
162
  `falling back to SdkProcess. Pass these to createProcessFactory.`,
154
163
  );
155
164
  } else {
165
+ // displayHint may be a static string (same hint for every session) or a
166
+ // resolver called per spawn with the current chat/topic and config, so the
167
+ // consumer can vary the hint per chat (e.g. a per-chat rich-text toggle).
168
+ // The string form is passed through unchanged.
169
+ const resolvedDisplayHint = typeof displayHint === 'function'
170
+ ? displayHint(chatId, threadId, config)
171
+ : displayHint;
156
172
  return new CliProcess({
157
173
  sessionKey, chatId, threadId, label,
158
174
  tmuxRunner,
159
175
  botName,
160
176
  claudeBin: channelsClaudeBin,
161
177
  toolDispatcher,
162
- displayHint,
178
+ displayHint: resolvedDisplayHint,
163
179
  maxOutboundFileBytes,
164
180
  sessionPrefix, bridgeServerName, appDataDir, attachmentBase, productName, surfaceName,
165
181
  logger,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shumkov/orchestra",
3
- "version": "0.4.1",
3
+ "version": "0.4.2",
4
4
  "description": "Drive interactive Claude Code CLI sessions: spawn, inject messages via the MCP channels bridge, observe turns, recover. The transport-agnostic session engine extracted from polygram, shared by polygram (Telegram) and water (WhatsApp).",
5
5
  "type": "commonjs",
6
6
  "main": "index.js",