charness 4.1.1 → 4.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +29 -0
- package/DEVELOPMENT.md +10 -4
- package/{COMMERCIAL-LICENSE.md → LICENSE-COMMERCIAL.md} +1 -1
- package/MIGRATION_3_TO_4.md +1 -1
- package/README.md +4 -1
- package/SETUP.md +3 -1
- package/agent-plugin/skills/charness-delegate-claude/SKILL.md +1 -0
- package/agent-plugin/skills/charness-orchestration/SKILL.md +1 -0
- package/dist/adapters/adapterNames.d.ts +2 -0
- package/dist/adapters/adapterNames.d.ts.map +1 -1
- package/dist/adapters/adapterNames.js +3 -1
- package/dist/adapters/adapterNames.js.map +1 -1
- package/dist/adapters/claudeJsonStreamAdapter.d.ts +14 -0
- package/dist/adapters/claudeJsonStreamAdapter.d.ts.map +1 -1
- package/dist/adapters/claudeJsonStreamAdapter.js +36 -6
- package/dist/adapters/claudeJsonStreamAdapter.js.map +1 -1
- package/dist/adapters/openCodeAdapter.d.ts +31 -2
- package/dist/adapters/openCodeAdapter.d.ts.map +1 -1
- package/dist/adapters/openCodeAdapter.js +84 -8
- package/dist/adapters/openCodeAdapter.js.map +1 -1
- package/dist/adapters/terminalAdapter.d.ts.map +1 -1
- package/dist/adapters/terminalAdapter.js +2 -1
- package/dist/adapters/terminalAdapter.js.map +1 -1
- package/dist/bot.d.ts.map +1 -1
- package/dist/bot.js +605 -87
- package/dist/bot.js.map +1 -1
- package/dist/cli/claudeProfiles.d.ts +3 -0
- package/dist/cli/claudeProfiles.d.ts.map +1 -1
- package/dist/cli/claudeProfiles.js +8 -0
- package/dist/cli/claudeProfiles.js.map +1 -1
- package/dist/connectors/telegram/commands/botCore.d.ts +5 -2
- package/dist/connectors/telegram/commands/botCore.d.ts.map +1 -1
- package/dist/connectors/telegram/commands/claudeAccounts.d.ts +5 -0
- package/dist/connectors/telegram/commands/claudeAccounts.d.ts.map +1 -1
- package/dist/connectors/telegram/commands/claudeAccounts.js +15 -39
- package/dist/connectors/telegram/commands/claudeAccounts.js.map +1 -1
- package/dist/connectors/telegram/commands/compaction.d.ts +6 -0
- package/dist/connectors/telegram/commands/compaction.d.ts.map +1 -1
- package/dist/connectors/telegram/commands/compaction.js +8 -1
- package/dist/connectors/telegram/commands/compaction.js.map +1 -1
- package/dist/connectors/telegram/commands/questionSetAside.d.ts +111 -0
- package/dist/connectors/telegram/commands/questionSetAside.d.ts.map +1 -0
- package/dist/connectors/telegram/commands/questionSetAside.js +637 -0
- package/dist/connectors/telegram/commands/questionSetAside.js.map +1 -0
- package/dist/connectors/telegram/commands/questionWait.d.ts +21 -0
- package/dist/connectors/telegram/commands/questionWait.d.ts.map +1 -0
- package/dist/connectors/telegram/commands/questionWait.js +109 -0
- package/dist/connectors/telegram/commands/questionWait.js.map +1 -0
- package/dist/connectors/telegram/commands/topicAccess.js +1 -1
- package/dist/connectors/telegram/commands/topicAccess.js.map +1 -1
- package/dist/connectors/telegram/commands/topicCommand.d.ts +0 -2
- package/dist/connectors/telegram/commands/topicCommand.d.ts.map +1 -1
- package/dist/connectors/telegram/commands/topicCommand.js +4 -5
- package/dist/connectors/telegram/commands/topicCommand.js.map +1 -1
- package/dist/connectors/telegram/commands/topicStatus.d.ts +24 -0
- package/dist/connectors/telegram/commands/topicStatus.d.ts.map +1 -0
- package/dist/connectors/telegram/commands/topicStatus.js +148 -0
- package/dist/connectors/telegram/commands/topicStatus.js.map +1 -0
- package/dist/connectors/telegram/firstUpdateBatchNote.d.ts +30 -0
- package/dist/connectors/telegram/firstUpdateBatchNote.d.ts.map +1 -0
- package/dist/connectors/telegram/firstUpdateBatchNote.js +39 -0
- package/dist/connectors/telegram/firstUpdateBatchNote.js.map +1 -0
- package/dist/connectors/telegram/inbound.d.ts +12 -0
- package/dist/connectors/telegram/inbound.d.ts.map +1 -1
- package/dist/connectors/telegram/inbound.js +31 -3
- package/dist/connectors/telegram/inbound.js.map +1 -1
- package/dist/connectors/telegram/topicIndicator.d.ts +86 -0
- package/dist/connectors/telegram/topicIndicator.d.ts.map +1 -0
- package/dist/connectors/telegram/topicIndicator.js +490 -0
- package/dist/connectors/telegram/topicIndicator.js.map +1 -0
- package/dist/connectors/telegram/waitingTopicRenames.d.ts +39 -0
- package/dist/connectors/telegram/waitingTopicRenames.d.ts.map +1 -0
- package/dist/connectors/telegram/waitingTopicRenames.js +48 -0
- package/dist/connectors/telegram/waitingTopicRenames.js.map +1 -0
- package/dist/i18n/de.d.ts.map +1 -1
- package/dist/i18n/de.js +47 -0
- package/dist/i18n/de.js.map +1 -1
- package/dist/i18n/en.d.ts.map +1 -1
- package/dist/i18n/en.js +47 -0
- package/dist/i18n/en.js.map +1 -1
- package/dist/i18n/es.d.ts.map +1 -1
- package/dist/i18n/es.js +47 -0
- package/dist/i18n/es.js.map +1 -1
- package/dist/i18n/fr.d.ts.map +1 -1
- package/dist/i18n/fr.js +47 -0
- package/dist/i18n/fr.js.map +1 -1
- package/dist/i18n/hi.d.ts.map +1 -1
- package/dist/i18n/hi.js +47 -0
- package/dist/i18n/hi.js.map +1 -1
- package/dist/i18n/ja.d.ts.map +1 -1
- package/dist/i18n/ja.js +47 -0
- package/dist/i18n/ja.js.map +1 -1
- package/dist/i18n/ka.d.ts.map +1 -1
- package/dist/i18n/ka.js +47 -0
- package/dist/i18n/ka.js.map +1 -1
- package/dist/i18n/pt.d.ts.map +1 -1
- package/dist/i18n/pt.js +47 -0
- package/dist/i18n/pt.js.map +1 -1
- package/dist/i18n/ru.d.ts.map +1 -1
- package/dist/i18n/ru.js +47 -0
- package/dist/i18n/ru.js.map +1 -1
- package/dist/i18n/uk.d.ts.map +1 -1
- package/dist/i18n/uk.js +47 -0
- package/dist/i18n/uk.js.map +1 -1
- package/dist/i18n/uz.d.ts.map +1 -1
- package/dist/i18n/uz.js +47 -0
- package/dist/i18n/uz.js.map +1 -1
- package/dist/i18n/zh.d.ts.map +1 -1
- package/dist/i18n/zh.js +47 -0
- package/dist/i18n/zh.js.map +1 -1
- package/dist/instanceSettings.d.ts +19 -1
- package/dist/instanceSettings.d.ts.map +1 -1
- package/dist/instanceSettings.js +35 -2
- package/dist/instanceSettings.js.map +1 -1
- package/dist/openCodeOpenQuestion.d.ts +12 -4
- package/dist/openCodeOpenQuestion.d.ts.map +1 -1
- package/dist/openCodeOpenQuestion.js +16 -7
- package/dist/openCodeOpenQuestion.js.map +1 -1
- package/dist/openCodeQuestionFlow.d.ts +10 -2
- package/dist/openCodeQuestionFlow.d.ts.map +1 -1
- package/dist/openCodeQuestionFlow.js +27 -5
- package/dist/openCodeQuestionFlow.js.map +1 -1
- package/dist/postToSession.d.ts +9 -0
- package/dist/postToSession.d.ts.map +1 -1
- package/dist/postToSession.js +15 -2
- package/dist/postToSession.js.map +1 -1
- package/dist/state.d.ts +98 -6
- package/dist/state.d.ts.map +1 -1
- package/dist/state.js +149 -7
- package/dist/state.js.map +1 -1
- package/dist/testTimings.d.ts +10 -2
- package/dist/testTimings.d.ts.map +1 -1
- package/dist/testTimings.js +20 -1
- package/dist/testTimings.js.map +1 -1
- package/dist/todos/registry.d.ts +2 -0
- package/dist/todos/registry.d.ts.map +1 -1
- package/dist/todos/registry.js +3 -1
- package/dist/todos/registry.js.map +1 -1
- package/dist/types.d.ts +88 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/utils/claudeCompactHook.d.ts +3 -1
- package/dist/utils/claudeCompactHook.d.ts.map +1 -1
- package/dist/utils/claudeCompactHook.js +3 -1
- package/dist/utils/claudeCompactHook.js.map +1 -1
- package/dist/utils/claudeLimitSwitch.d.ts +1 -1
- package/dist/utils/claudeLimitSwitch.d.ts.map +1 -1
- package/dist/utils/claudeLimitSwitch.js +1 -1
- package/dist/utils/claudeLimitSwitch.js.map +1 -1
- package/dist/utils/claudeProfileSync.d.ts +88 -0
- package/dist/utils/claudeProfileSync.d.ts.map +1 -0
- package/dist/utils/claudeProfileSync.js +198 -0
- package/dist/utils/claudeProfileSync.js.map +1 -0
- package/dist/utils/claudeProfiles.d.ts +101 -6
- package/dist/utils/claudeProfiles.d.ts.map +1 -1
- package/dist/utils/claudeProfiles.js +288 -23
- package/dist/utils/claudeProfiles.js.map +1 -1
- package/dist/utils/claudeUsageRefresher.d.ts +8 -1
- package/dist/utils/claudeUsageRefresher.d.ts.map +1 -1
- package/dist/utils/claudeUsageRefresher.js +11 -1
- package/dist/utils/claudeUsageRefresher.js.map +1 -1
- package/dist/utils/cutButtonLabel.d.ts +7 -0
- package/dist/utils/cutButtonLabel.d.ts.map +1 -0
- package/dist/utils/cutButtonLabel.js +17 -0
- package/dist/utils/cutButtonLabel.js.map +1 -0
- package/dist/utils/limitSwitchPlan.d.ts +44 -0
- package/dist/utils/limitSwitchPlan.d.ts.map +1 -0
- package/dist/utils/limitSwitchPlan.js +54 -0
- package/dist/utils/limitSwitchPlan.js.map +1 -0
- package/dist/utils/questionWaitChoices.d.ts +20 -0
- package/dist/utils/questionWaitChoices.d.ts.map +1 -0
- package/dist/utils/questionWaitChoices.js +31 -0
- package/dist/utils/questionWaitChoices.js.map +1 -0
- package/dist/utils/questionWaitPlan.d.ts +166 -0
- package/dist/utils/questionWaitPlan.d.ts.map +1 -0
- package/dist/utils/questionWaitPlan.js +237 -0
- package/dist/utils/questionWaitPlan.js.map +1 -0
- package/dist/utils/replyQuote.d.ts +10 -0
- package/dist/utils/replyQuote.d.ts.map +1 -1
- package/dist/utils/replyQuote.js +18 -7
- package/dist/utils/replyQuote.js.map +1 -1
- package/dist/utils/talkerAccess.d.ts +2 -2
- package/dist/utils/talkerAccess.d.ts.map +1 -1
- package/dist/utils/talkerAccess.js +5 -4
- package/dist/utils/talkerAccess.js.map +1 -1
- package/dist/utils/telegramError.d.ts +6 -0
- package/dist/utils/telegramError.d.ts.map +1 -1
- package/dist/utils/telegramError.js +12 -0
- package/dist/utils/telegramError.js.map +1 -1
- package/dist/utils/topicAccessScreenPlan.d.ts +1 -1
- package/dist/utils/topicAccessScreenPlan.d.ts.map +1 -1
- package/dist/utils/topicAccessScreenPlan.js +3 -7
- package/dist/utils/topicAccessScreenPlan.js.map +1 -1
- package/dist/utils/topicIndicatorPlan.d.ts +143 -0
- package/dist/utils/topicIndicatorPlan.d.ts.map +1 -0
- package/dist/utils/topicIndicatorPlan.js +202 -0
- package/dist/utils/topicIndicatorPlan.js.map +1 -0
- package/dist/utils/topicIndicatorSources.d.ts +40 -0
- package/dist/utils/topicIndicatorSources.d.ts.map +1 -0
- package/dist/utils/topicIndicatorSources.js +31 -0
- package/dist/utils/topicIndicatorSources.js.map +1 -0
- package/dist/utils/topicStatusPlan.d.ts +90 -0
- package/dist/utils/topicStatusPlan.d.ts.map +1 -0
- package/dist/utils/topicStatusPlan.js +160 -0
- package/dist/utils/topicStatusPlan.js.map +1 -0
- package/npm-shrinkwrap.json +2 -2
- package/package.json +2 -2
|
@@ -5123,26 +5123,32 @@ class OpenCodeAdapter extends events_1.EventEmitter {
|
|
|
5123
5123
|
* {@link getOpenQuestionForSession} helper.
|
|
5124
5124
|
*
|
|
5125
5125
|
* Best-effort: a read/parse failure is logged and swallowed — it must never
|
|
5126
|
-
* throw out of reattach
|
|
5126
|
+
* throw out of reattach — and reported as `readFailed` to a caller that
|
|
5127
|
+
* counts on the question being shown. Only meaningful on the resume/reattach path; a
|
|
5127
5128
|
* brand-new session (startSession) has no history and thus no open question,
|
|
5128
5129
|
* so it is deliberately NOT called there.
|
|
5129
5130
|
*/
|
|
5130
|
-
async restoreOpenQuestion(key, sessionId, workDir) {
|
|
5131
|
+
async restoreOpenQuestion(key, sessionId, workDir, exceptRequestId) {
|
|
5131
5132
|
try {
|
|
5132
5133
|
const response = await this.apiRequest('GET', buildDirectoryScopedPath('/question', workDir));
|
|
5133
|
-
|
|
5134
|
+
// An answer that is not a list is as good as none read (`resyncOpenQuestion` says «unknown» for it too).
|
|
5135
|
+
if (!Array.isArray(response))
|
|
5136
|
+
return 'readFailed';
|
|
5137
|
+
const restored = (0, openCodeOpenQuestion_1.getOpenQuestionForSession)(response, sessionId, workDir, { exceptRequestId });
|
|
5134
5138
|
if (!restored)
|
|
5135
|
-
return;
|
|
5139
|
+
return 'none';
|
|
5136
5140
|
// The session may have been stopped/replaced between the GET and now.
|
|
5137
5141
|
const session = this.sessions.get((0, sessionKey_1.keyToString)(key));
|
|
5138
5142
|
if (!session?.isActive || session.sessionId !== sessionId)
|
|
5139
|
-
return;
|
|
5143
|
+
return 'none';
|
|
5140
5144
|
session.pendingQuestion = restored;
|
|
5141
5145
|
console.log(`[OpenCode] Restored open question ${restored.requestId} for ${(0, sessionKey_1.keyToString)(key)} on reattach`);
|
|
5142
5146
|
this.emit('question', key, restored);
|
|
5147
|
+
return 'emitted';
|
|
5143
5148
|
}
|
|
5144
5149
|
catch (e) {
|
|
5145
5150
|
console.warn(`[OpenCode] restore open question failed:`, e instanceof Error ? e.message : e);
|
|
5151
|
+
return 'readFailed';
|
|
5146
5152
|
}
|
|
5147
5153
|
}
|
|
5148
5154
|
/**
|
|
@@ -5171,6 +5177,10 @@ class OpenCodeAdapter extends events_1.EventEmitter {
|
|
|
5171
5177
|
return false;
|
|
5172
5178
|
}
|
|
5173
5179
|
}
|
|
5180
|
+
/** The one request that answers a question: `POST /question/:id/reply`, one list of answer texts per question. Resolves once the server took it. */
|
|
5181
|
+
async postQuestionReply(requestId, directory, answers) {
|
|
5182
|
+
await this.apiRequest('POST', buildDirectoryScopedPath(`/question/${requestId}/reply`, directory), { answers });
|
|
5183
|
+
}
|
|
5174
5184
|
/**
|
|
5175
5185
|
* @description Reply to a pending question with user-selected answers.
|
|
5176
5186
|
* Called by the bot when the user clicks an inline button or types a custom answer.
|
|
@@ -5183,13 +5193,79 @@ class OpenCodeAdapter extends events_1.EventEmitter {
|
|
|
5183
5193
|
session.pendingQuestion = null;
|
|
5184
5194
|
// Audit S15 / #41: surface failures via `error` so the bot's
|
|
5185
5195
|
// handleAgentError shows them in the thread, not just in console.
|
|
5186
|
-
this.
|
|
5187
|
-
answers,
|
|
5188
|
-
}).catch((e) => {
|
|
5196
|
+
this.postQuestionReply(requestId, directory, answers).catch((e) => {
|
|
5189
5197
|
console.error(`[OpenCode] Failed to reply to question:`, e);
|
|
5190
5198
|
this.emit('error', key, e instanceof Error ? e : new Error(String(e)));
|
|
5191
5199
|
});
|
|
5192
5200
|
}
|
|
5201
|
+
/**
|
|
5202
|
+
* @description Set the question `requestId` aside: REPLY to it with `text` as the custom answer of every question left open
|
|
5203
|
+
* (`givenAnswers` keeps the ones already collected), so the question tool returns and the agent goes on. Never a reject —
|
|
5204
|
+
* a `Question.RejectedError` ends OpenCode's agent loop (`continue_loop_on_deny` is off by default), which is the opposite
|
|
5205
|
+
* of «go on». The reply takes any text as an answer (the server does not check it against the options). Does nothing, and
|
|
5206
|
+
* says so (`false`), unless `requestId` is the question pending now; `true` once the reply is sent. The send's own outcome comes
|
|
5207
|
+
* later, through `onSettled` (`true`: the server took the reply; `false`: it did not — and the question stays open on the server,
|
|
5208
|
+
* which the caller must not mistake for «the agent went on»). A failed set-aside reply does not surface through the `error` event:
|
|
5209
|
+
* the caller owns what to do about it.
|
|
5210
|
+
*/
|
|
5211
|
+
setQuestionAside(key, requestId, text, givenAnswers, onSettled) {
|
|
5212
|
+
const session = this.sessions.get((0, sessionKey_1.keyToString)(key));
|
|
5213
|
+
const pending = session?.isActive ? session.pendingQuestion : null;
|
|
5214
|
+
if (!session || !pending || pending.requestId !== requestId)
|
|
5215
|
+
return false;
|
|
5216
|
+
const answers = pending.questions.map((_, index) => givenAnswers[index] ?? [text]);
|
|
5217
|
+
session.pendingQuestion = null;
|
|
5218
|
+
this.postQuestionReply(requestId, pending.directory, answers)
|
|
5219
|
+
.then(() => onSettled?.(true))
|
|
5220
|
+
.catch((e) => {
|
|
5221
|
+
console.error(`[OpenCode] Failed to set the question ${requestId} aside:`, e);
|
|
5222
|
+
onSettled?.(false);
|
|
5223
|
+
});
|
|
5224
|
+
return true;
|
|
5225
|
+
}
|
|
5226
|
+
/**
|
|
5227
|
+
* @description Ask the server what it holds: `GET /question` for this session's instance, read into `session.pendingQuestion`
|
|
5228
|
+
* when `requestId` is among the session's open questions, wherever it stands in the list (the adapter's copy is only a cache that
|
|
5229
|
+
* a reattach which could not read the server leaves empty). Resolves `held` (the cache now has it, nothing is emitted: the bot
|
|
5230
|
+
* that asks already knows the question), `none` (the server holds no such question of this session — it holds none, or only
|
|
5231
|
+
* OTHER ones: the bot's copy is stale, and the cache is left as it was, never filled with a question the bot did not ask about) or `unknown` (the read failed, or the
|
|
5232
|
+
* session is not active — a stale-version replacement is under way — so nothing can be told).
|
|
5233
|
+
*/
|
|
5234
|
+
async resyncOpenQuestion(key, requestId) {
|
|
5235
|
+
const session = this.sessions.get((0, sessionKey_1.keyToString)(key));
|
|
5236
|
+
if (!session?.isActive)
|
|
5237
|
+
return 'unknown';
|
|
5238
|
+
try {
|
|
5239
|
+
const response = await this.apiRequest('GET', buildDirectoryScopedPath('/question', session.workDir));
|
|
5240
|
+
if (!Array.isArray(response))
|
|
5241
|
+
return 'unknown';
|
|
5242
|
+
// Among ALL the session's open entries: the server may hold more than one (parallel tool calls), and the bot's is not
|
|
5243
|
+
// necessarily the first.
|
|
5244
|
+
const held = (0, openCodeOpenQuestion_1.getOpenQuestionForSession)(response, session.sessionId, session.workDir, { requestId });
|
|
5245
|
+
if (!held)
|
|
5246
|
+
return 'none';
|
|
5247
|
+
const current = this.sessions.get((0, sessionKey_1.keyToString)(key));
|
|
5248
|
+
if (!current?.isActive || current.sessionId !== session.sessionId)
|
|
5249
|
+
return 'unknown';
|
|
5250
|
+
current.pendingQuestion = held;
|
|
5251
|
+
return 'held';
|
|
5252
|
+
}
|
|
5253
|
+
catch (e) {
|
|
5254
|
+
console.warn('[OpenCode] re-reading the open question failed:', e instanceof Error ? e.message : e);
|
|
5255
|
+
return 'unknown';
|
|
5256
|
+
}
|
|
5257
|
+
}
|
|
5258
|
+
/**
|
|
5259
|
+
* @description Hand the question the server holds for this session to the bot as a `question` event (see {@link restoreOpenQuestion});
|
|
5260
|
+
* nothing when it holds none. `exceptRequestId` leaves the question the bot has just set aside out — a sibling open at the same time
|
|
5261
|
+
* (the model's parallel tool calls) is the one to show. Resolves `emitted`, `none` (also: no live session) or `readFailed`.
|
|
5262
|
+
*/
|
|
5263
|
+
async surfaceOpenQuestion(key, exceptRequestId) {
|
|
5264
|
+
const session = this.sessions.get((0, sessionKey_1.keyToString)(key));
|
|
5265
|
+
if (!session?.isActive)
|
|
5266
|
+
return 'none';
|
|
5267
|
+
return this.restoreOpenQuestion(key, session.sessionId, session.workDir, exceptRequestId);
|
|
5268
|
+
}
|
|
5193
5269
|
/**
|
|
5194
5270
|
* @description Reject a pending question server-side WITHOUT answering it —
|
|
5195
5271
|
* called when the user ABANDONS the question (sends a fresh prompt instead of
|