agent-afk 6.1.0 → 6.2.1
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/dist/agent/auth/anthropic-credential-check.d.ts +7 -0
- package/dist/agent/auth/claude-login-status.d.ts +9 -0
- package/dist/agent/auth/keychain.d.ts +2 -0
- package/dist/agent/awareness/presence.d.ts +0 -1
- package/dist/agent/daemon/scheduler.failure-streak.d.ts +0 -7
- package/dist/agent/done-evidence.d.ts +2 -0
- package/dist/agent/lsp/client.d.ts +1 -1
- package/dist/agent/lsp/crash-loop-guard.d.ts +5 -0
- package/dist/agent/lsp/pool.d.ts +1 -0
- package/dist/agent/providers/anthropic-direct/provider-query-setup.d.ts +1 -0
- package/dist/agent/providers/router/provider-router.d.ts +1 -0
- package/dist/agent/providers/router/provider-router.fallback.d.ts +1 -0
- package/dist/agent/routing-directive.d.ts +2 -2
- package/dist/agent/session/credential-prime.d.ts +3 -0
- package/dist/agent/session/session-state.d.ts +2 -0
- package/dist/agent/session/stream-consumer.tool-events.d.ts +2 -1
- package/dist/agent/session/turn-stream-runner.abandoned-turn.d.ts +1 -0
- package/dist/cli/commands/acp.handlers.d.ts +0 -1
- package/dist/cli/commands/acp.prompt-turn.d.ts +1 -3
- package/dist/cli/commands/acp.server.d.ts +0 -1
- package/dist/cli/commands/acp.session.d.ts +0 -1
- package/dist/cli/commands/{acp.permission.paths.d.ts → acp.tool-display.d.ts} +6 -0
- package/dist/cli/commands/acp.wire.d.ts +0 -38
- package/dist/cli/commands/chat.action-body.d.ts +0 -1
- package/dist/cli/commands/chat.session-setup.d.ts +0 -1
- package/dist/cli/commands/interactive/global-chat-actions.d.ts +12 -0
- package/dist/cli/commands/interactive/global-chat-commands.d.ts +45 -0
- package/dist/cli/commands/interactive/global-chat-keys.d.ts +27 -0
- package/dist/cli/commands/interactive/global-chat-messages.d.ts +12 -0
- package/dist/cli/commands/interactive/global-chat-model.d.ts +70 -0
- package/dist/cli/commands/interactive/global-chat-onboarding.d.ts +10 -0
- package/dist/cli/commands/interactive/global-chat-render.d.ts +16 -0
- package/dist/cli/commands/interactive/global-chat-terminal.d.ts +38 -0
- package/dist/cli/commands/interactive/global-chat-view.d.ts +22 -0
- package/dist/cli/commands/interactive/global-chat-view.test-helpers.d.ts +76 -0
- package/dist/cli/commands/interactive/shared.d.ts +0 -1
- package/dist/cli/commands/shared-command-options.d.ts +0 -1
- package/dist/cli/commands/update.windows.d.ts +3 -0
- package/dist/cli/config/types.d.ts +0 -2
- package/dist/cli/slash/commands/global-wiring.d.ts +2 -0
- package/dist/cli/slash/commands/global.d.ts +19 -0
- package/dist/cli/tty-trace.d.ts +2 -0
- package/dist/cli.mjs +747 -734
- package/dist/config/env.d.ts +7 -0
- package/dist/config/env.global-chat.d.ts +8 -0
- package/dist/global-chat/client-types.d.ts +95 -0
- package/dist/global-chat/client.d.ts +20 -0
- package/dist/global-chat/client.test.helpers.d.ts +117 -0
- package/dist/global-chat/client.transport.d.ts +39 -0
- package/dist/global-chat/crypto.d.ts +15 -0
- package/dist/global-chat/e2e.test.helpers.d.ts +45 -0
- package/dist/global-chat/identity.d.ts +16 -0
- package/dist/global-chat/mute-store.d.ts +12 -0
- package/dist/global-chat/names.d.ts +15 -0
- package/dist/global-chat/protocol.d.ts +110 -0
- package/dist/global-chat/protocol.parse.d.ts +14 -0
- package/dist/global-chat/relay/index.d.ts +6 -0
- package/dist/global-chat/relay/limiter.d.ts +25 -0
- package/dist/global-chat/relay/room-handlers.d.ts +25 -0
- package/dist/global-chat/relay/room-types.d.ts +23 -0
- package/dist/global-chat/relay/room.d.ts +26 -0
- package/dist/global-chat/relay/store.d.ts +65 -0
- package/dist/global-chat/sanitize.d.ts +3 -0
- package/dist/global-chat/secret-detect.d.ts +7 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.mjs +512 -497
- package/dist/paths.d.ts +2 -1
- package/dist/paths.effect-ledger.d.ts +1 -0
- package/dist/paths.global-chat.d.ts +3 -0
- package/dist/telegram/session-manager.d.ts +0 -1
- package/dist/telegram/stats-ticker.d.ts +1 -0
- package/dist/telegram/streaming.draft.d.ts +10 -0
- package/dist/telegram/streaming.handlers.d.ts +4 -0
- package/dist/telegram/streaming.loop.d.ts +4 -2
- package/dist/telegram/streaming.sender.d.ts +3 -1
- package/dist/telegram.mjs +550 -535
- package/dist/web-ui-assets/assets/{angular-html-C85Dugk9.js → angular-html-DWr24JQY.js} +1 -1
- package/dist/web-ui-assets/assets/{angular-ts-kYjKxpAq.js → angular-ts-Dfjy4Csj.js} +1 -1
- package/dist/web-ui-assets/assets/{apl-H6xD6R6W.js → apl-BwhaI1Ab.js} +1 -1
- package/dist/web-ui-assets/assets/{astro-DQe_HbEs.js → astro-CSFn8niX.js} +1 -1
- package/dist/web-ui-assets/assets/{blade-4-tvsLmi.js → blade-DigedLJH.js} +1 -1
- package/dist/web-ui-assets/assets/{c-gik9xvSm.js → c-CWVxdQv5.js} +1 -1
- package/dist/web-ui-assets/assets/{chapel-CNhK8GmZ.js → chapel-CgtxK7cW.js} +1 -1
- package/dist/web-ui-assets/assets/{cobol-CFRrQwTf.js → cobol-CIyTunqc.js} +1 -1
- package/dist/web-ui-assets/assets/{coffee-CIS9zt6C.js → coffee-CuLoelC_.js} +1 -1
- package/dist/web-ui-assets/assets/{cpp-BJGKcaQ2.js → cpp-C3l2-sfI.js} +1 -1
- package/dist/web-ui-assets/assets/{crystal-DrshRrYd.js → crystal-CFlVKxfG.js} +1 -1
- package/dist/web-ui-assets/assets/{css-RSoGQ9CU.js → css-DvuZRByB.js} +1 -1
- package/dist/web-ui-assets/assets/{dist-CJdV1FJY.js → dist-BoI-WCsc.js} +2 -2
- package/dist/web-ui-assets/assets/{edge-D5Mh5hW4.js → edge-DRSGR2dJ.js} +1 -1
- package/dist/web-ui-assets/assets/{elixir-CVxXxJNz.js → elixir-BpxN8zaT.js} +1 -1
- package/dist/web-ui-assets/assets/{elm-Dlo4E_41.js → elm-DMUP1k7c.js} +1 -1
- package/dist/web-ui-assets/assets/{erb-ByL9xu2F.js → erb-Dk5V_p8b.js} +1 -1
- package/dist/web-ui-assets/assets/{git-rebase-OuLy99Ny.js → git-rebase-DfC3Itju.js} +1 -1
- package/dist/web-ui-assets/assets/{glimmer-js-BNMbvc5A.js → glimmer-js-DPl1pjgU.js} +1 -1
- package/dist/web-ui-assets/assets/{glimmer-ts-LWNvX4Gj.js → glimmer-ts-WMColDOO.js} +1 -1
- package/dist/web-ui-assets/assets/{glsl-DZr3GrVI.js → glsl-DrzHRnmQ.js} +1 -1
- package/dist/web-ui-assets/assets/{graphql-CI8lFP8J.js → graphql-BJCWDb2T.js} +1 -1
- package/dist/web-ui-assets/assets/{hack-tDxt7H8D.js → hack-BKd602jK.js} +1 -1
- package/dist/web-ui-assets/assets/{haml-DkI1Wtrk.js → haml-Dnm3Jt81.js} +1 -1
- package/dist/web-ui-assets/assets/{handlebars-CRsZz40e.js → handlebars-DgzEHqLl.js} +1 -1
- package/dist/web-ui-assets/assets/{html-BIypIehr.js → html-Du469FWf.js} +1 -1
- package/dist/web-ui-assets/assets/{html-derivative-rr2iMJpd.js → html-derivative-C9H_B3r8.js} +1 -1
- package/dist/web-ui-assets/assets/{http-D6S54Bbx.js → http-BOe-jpS7.js} +1 -1
- package/dist/web-ui-assets/assets/{hurl-BSshBRHD.js → hurl-B5TCpGYZ.js} +1 -1
- package/dist/web-ui-assets/assets/{index-DxbrAlfz.js → index-Bkn2M-MI.js} +4 -4
- package/dist/web-ui-assets/assets/{java-EtJoHQZR.js → java-C3zMnwdO.js} +1 -1
- package/dist/web-ui-assets/assets/{javascript-CLpqmXE0.js → javascript-BPPnLFX4.js} +1 -1
- package/dist/web-ui-assets/assets/{jinja-PA6irl9u.js → jinja-TCflfo9d.js} +1 -1
- package/dist/web-ui-assets/assets/{jison-DxqwpCqh.js → jison-htjOCLKg.js} +1 -1
- package/dist/web-ui-assets/assets/{json-B6fuMtpU.js → json-CU3NFVj2.js} +1 -1
- package/dist/web-ui-assets/assets/{jsx-BJyOE1yn.js → jsx-cHA0dcya.js} +1 -1
- package/dist/web-ui-assets/assets/{julia-DHqh2B7-.js → julia-C9WczjMQ.js} +1 -1
- package/dist/web-ui-assets/assets/{just-CSPu2IZ4.js → just-DMmUG_Ld.js} +1 -1
- package/dist/web-ui-assets/assets/{latex-1lJzG2hL.js → latex-CBnlPWoy.js} +1 -1
- package/dist/web-ui-assets/assets/{liquid-D9Ciy6uZ.js → liquid-BVZcXUsR.js} +1 -1
- package/dist/web-ui-assets/assets/{lua-CFjUSwQg.js → lua-57fPimvp.js} +1 -1
- package/dist/web-ui-assets/assets/{marko-CfzAx6nq.js → marko-Csr2iwj7.js} +1 -1
- package/dist/web-ui-assets/assets/{mdc-CJ7N65mG.js → mdc-BAYnzJrs.js} +1 -1
- package/dist/web-ui-assets/assets/{nginx-BMoA9yN9.js → nginx-BFHiPlMt.js} +1 -1
- package/dist/web-ui-assets/assets/{nim-BDzXDiN9.js → nim-DmMzuj5q.js} +1 -1
- package/dist/web-ui-assets/assets/{org-DqkXzdx7.js → org-BwuvpNcM.js} +1 -1
- package/dist/web-ui-assets/assets/{perl-BfDhtEbl.js → perl-CZEHkt36.js} +1 -1
- package/dist/web-ui-assets/assets/{php-CG-iT0bZ.js → php-ByluSCZm.js} +1 -1
- package/dist/web-ui-assets/assets/{pug-CwR1_59V.js → pug-CQ33DFqW.js} +1 -1
- package/dist/web-ui-assets/assets/{qml-CSHgad12.js → qml-CBoUMW6C.js} +1 -1
- package/dist/web-ui-assets/assets/{r-DIjvsd-X.js → r-CmdcEanC.js} +1 -1
- package/dist/web-ui-assets/assets/{razor-Dr-UE982.js → razor-DB7pXtUc.js} +1 -1
- package/dist/web-ui-assets/assets/{regexp-CNiPgECb.js → regexp-CGvMdd6t.js} +1 -1
- package/dist/web-ui-assets/assets/{rst-BFhRD-Dc.js → rst-CObWJocr.js} +1 -1
- package/dist/web-ui-assets/assets/{ruby-6gDBsBPK.js → ruby-BBWdv_cz.js} +1 -1
- package/dist/web-ui-assets/assets/{sas-BH8HGnTp.js → sas-B19YJcFw.js} +1 -1
- package/dist/web-ui-assets/assets/{scss-DHyUaYhk.js → scss-C0xmnNjT.js} +1 -1
- package/dist/web-ui-assets/assets/{shellscript-C6y3E5Sv.js → shellscript-BGK0M1Eb.js} +1 -1
- package/dist/web-ui-assets/assets/{shellsession-DHS7GsE9.js → shellsession-CXVvNE3Y.js} +1 -1
- package/dist/web-ui-assets/assets/{soy-C2tuyyR2.js → soy-zGMCt0Qx.js} +1 -1
- package/dist/web-ui-assets/assets/{sql-DccA9zc6.js → sql-Cdngy-h9.js} +1 -1
- package/dist/web-ui-assets/assets/{stata-CSDjFjIS.js → stata-CbTs_wAo.js} +1 -1
- package/dist/web-ui-assets/assets/{surrealql-Deemb84V.js → surrealql-CWddraAo.js} +1 -1
- package/dist/web-ui-assets/assets/{svelte-Di-dGYfQ.js → svelte-BpwrDh1w.js} +1 -1
- package/dist/web-ui-assets/assets/{templ-nltc8MkE.js → templ-BUtYdEzY.js} +1 -1
- package/dist/web-ui-assets/assets/{tex-CCk-q3gk.js → tex-DILFHqov.js} +1 -1
- package/dist/web-ui-assets/assets/{ts-tags-BTslhx07.js → ts-tags-EaqdnST6.js} +1 -1
- package/dist/web-ui-assets/assets/{tsx-DTO7ESyr.js → tsx-C5_ksxvs.js} +1 -1
- package/dist/web-ui-assets/assets/{twig-12YiESYn.js → twig-BQZNMNLt.js} +1 -1
- package/dist/web-ui-assets/assets/{typescript-DomHOzpY.js → typescript-BtFbCKzi.js} +1 -1
- package/dist/web-ui-assets/assets/{typst-DnLdDQm5.js → typst-C8VQND_D.js} +1 -1
- package/dist/web-ui-assets/assets/{vue-BNvjzHNk.js → vue-BVF-pCqB.js} +1 -1
- package/dist/web-ui-assets/assets/{vue-html-C0QzS-K2.js → vue-html-Cgy0WjeQ.js} +1 -1
- package/dist/web-ui-assets/assets/{vue-vine-BeCf67d3.js → vue-vine-p_SuHnmI.js} +1 -1
- package/dist/web-ui-assets/assets/{xml-_WZueolK.js → xml-BXlD1L6I.js} +1 -1
- package/dist/web-ui-assets/assets/{xsl-CmPrFugX.js → xsl-DdJiL0e7.js} +1 -1
- package/dist/web-ui-assets/assets/{yaml-C74a4W5w.js → yaml-BulRLEp7.js} +1 -1
- package/dist/web-ui-assets/index.html +1 -1
- package/package.json +1 -1
- package/dist/agent/afk-channel.d.ts +0 -9
- package/dist/agent/afk-ledger-channel.d.ts +0 -23
- package/dist/cli/commands/acp.permission.d.ts +0 -7
- package/dist/cli/commands/acp.permission.grants.d.ts +0 -5
- package/dist/cli/commands/acp.permission.labels.d.ts +0 -5
- package/dist/cli/commands/acp.permission.policy.d.ts +0 -7
- package/dist/cli/commands/acp.permission.realpath.d.ts +0 -7
- package/dist/cli/commands/acp.permission.sensitive.d.ts +0 -6
- package/dist/telegram/session-manager.active-route.d.ts +0 -3
- /package/dist/cli/commands/{acp.permission.git.d.ts → acp.tool-display.git.d.ts} +0 -0
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type CredentialSourceId } from './credential-resolver.js';
|
|
2
|
+
export interface AnthropicCredentialStatus {
|
|
3
|
+
ok: boolean;
|
|
4
|
+
source?: CredentialSourceId;
|
|
5
|
+
detail?: string;
|
|
6
|
+
}
|
|
7
|
+
export declare function checkAnthropicCredential(): Promise<AnthropicCredentialStatus>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export type ClaudeLoginStatus = 'valid' | 'refreshed' | 'no-login' | 'no-token' | 'expired-no-refresh' | 'refresh-failed';
|
|
2
|
+
export interface ClaudeLoginRefreshResult {
|
|
3
|
+
token?: string;
|
|
4
|
+
status: ClaudeLoginStatus;
|
|
5
|
+
}
|
|
6
|
+
export declare function recordClaudeLoginStatus(status: ClaudeLoginStatus): void;
|
|
7
|
+
export declare function lastClaudeLoginStatus(): ClaudeLoginStatus | undefined;
|
|
8
|
+
export declare function _resetClaudeLoginStatus(): void;
|
|
9
|
+
export declare function describeClaudeLoginStatus(status: ClaudeLoginStatus | undefined): string | undefined;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type ClaudeLoginRefreshResult } from './claude-login-status.js';
|
|
1
2
|
export declare function _resetKeychainReadCache(): void;
|
|
2
3
|
export declare function clearKeychainCache(): void;
|
|
3
4
|
export declare function loadClaudeCodeOauthToken(opts?: {
|
|
@@ -5,6 +6,7 @@ export declare function loadClaudeCodeOauthToken(opts?: {
|
|
|
5
6
|
background?: boolean;
|
|
6
7
|
}): string | undefined;
|
|
7
8
|
export declare function refreshClaudeCodeOauthToken(): Promise<string | undefined>;
|
|
9
|
+
export declare function refreshClaudeCodeOauthTokenWithStatus(): Promise<ClaudeLoginRefreshResult>;
|
|
8
10
|
export declare function claudeCodeCredentialsPath(): string;
|
|
9
11
|
export declare function parseAccountIdentifier(token: string): string;
|
|
10
12
|
export declare function writeLinuxCredentials(credPath: string, blob: string): void;
|
|
@@ -41,7 +41,6 @@ export interface TouchHeartbeatOptions {
|
|
|
41
41
|
}
|
|
42
42
|
export declare function touchPresenceHeartbeat(sessionId: string, options?: TouchHeartbeatOptions): Promise<void>;
|
|
43
43
|
export declare function patchPresenceFile(sessionId: string, patch: (record: PresenceFileInfo) => void): Promise<void>;
|
|
44
|
-
export declare function setPresenceAfk(sessionId: string, afk: boolean): Promise<void>;
|
|
45
44
|
export declare function setPresenceBlocked(sessionId: string, blocked: boolean): Promise<void>;
|
|
46
45
|
export declare function updatePresenceCwd(sessionId: string, cwd: string): Promise<void>;
|
|
47
46
|
export declare function removePresenceFile(sessionId: string): Promise<void>;
|
|
@@ -18,14 +18,7 @@ export declare class FailureStreakTracker {
|
|
|
18
18
|
hydrate(taskId: string, telemetryPath: string): void;
|
|
19
19
|
forget(taskId: string): void;
|
|
20
20
|
record(taskId: string, task: ScheduledTask | undefined, record: TelemetryRecord, threshold?: number): StreakAction;
|
|
21
|
-
getStreak(taskId: string): Readonly<StreakSnapshot> | undefined;
|
|
22
21
|
snapshot(taskId: string): StreakSnapshot;
|
|
23
|
-
listBreachedStreaks(threshold?: number): Array<{
|
|
24
|
-
taskId: string;
|
|
25
|
-
count: number;
|
|
26
|
-
failingSince: string;
|
|
27
|
-
lastError: string | undefined;
|
|
28
|
-
}>;
|
|
29
22
|
_reset(): void;
|
|
30
23
|
}
|
|
31
24
|
export declare function resolveThreshold(task: ScheduledTask | undefined): number;
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
export interface ToolEventMin {
|
|
2
2
|
toolName: string;
|
|
3
3
|
input: string;
|
|
4
|
+
inputRaw?: string;
|
|
4
5
|
isError?: boolean;
|
|
5
6
|
}
|
|
7
|
+
export declare function isPatchApplyDryRun(e: ToolEventMin): boolean;
|
|
6
8
|
export declare const DONE_EVIDENCE_TOOLS: ReadonlySet<string>;
|
|
7
9
|
export declare function isVerificationCommand(input: string): boolean;
|
|
8
10
|
export declare function classifyDoneEvidence(toolEvents: readonly ToolEventMin[]): 'no-code-changes' | 'verified' | 'unverified';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ServerSpec } from './server-spec.js';
|
|
2
2
|
import { type SyncResult } from './document-sync.js';
|
|
3
3
|
import { DiagnosticsStore } from './diagnostics-store.js';
|
|
4
|
-
export type LspFailureKind = 'timeout' | 'aborted' | 'exited' | 'spawn' | 'response';
|
|
4
|
+
export type LspFailureKind = 'timeout' | 'aborted' | 'exited' | 'spawn' | 'response' | 'disabled';
|
|
5
5
|
export declare class LspClientError extends Error {
|
|
6
6
|
readonly kind: LspFailureKind;
|
|
7
7
|
constructor(kind: LspFailureKind, message: string);
|
|
@@ -1,20 +1,25 @@
|
|
|
1
1
|
export declare const CRASH_LIMIT = 3;
|
|
2
2
|
export declare const CRASH_WINDOW_MS = 120000;
|
|
3
|
+
export declare const GUARD_COOLDOWN_MS = 300000;
|
|
3
4
|
export interface CrashLoopGuardOptions {
|
|
4
5
|
readonly limit?: number;
|
|
5
6
|
readonly windowMs?: number;
|
|
7
|
+
readonly cooldownMs?: number;
|
|
6
8
|
readonly now?: () => number;
|
|
7
9
|
}
|
|
8
10
|
export declare class CrashLoopGuard {
|
|
9
11
|
private readonly limit;
|
|
10
12
|
private readonly windowMs;
|
|
13
|
+
private readonly cooldownMs;
|
|
11
14
|
private readonly now;
|
|
12
15
|
private readonly timestamps;
|
|
13
16
|
private _failed;
|
|
17
|
+
private _failedAt;
|
|
14
18
|
constructor(opts?: CrashLoopGuardOptions);
|
|
15
19
|
get failed(): boolean;
|
|
16
20
|
recordCrash(): boolean;
|
|
17
21
|
get recentCrashes(): number;
|
|
22
|
+
get cooldownRemainingMs(): number;
|
|
18
23
|
}
|
|
19
24
|
export declare function getOrCreateGuard(key: string, opts?: CrashLoopGuardOptions): CrashLoopGuard;
|
|
20
25
|
export declare function deleteGuard(key: string): void;
|
package/dist/agent/lsp/pool.d.ts
CHANGED
|
@@ -19,6 +19,7 @@ export declare function poolKey(spec: ServerSpec, root: string): string;
|
|
|
19
19
|
export declare class LspServerPool {
|
|
20
20
|
private readonly opts;
|
|
21
21
|
private readonly entries;
|
|
22
|
+
private readonly evictedDisposals;
|
|
22
23
|
private spawnCount;
|
|
23
24
|
constructor(opts?: LspServerPoolOptions);
|
|
24
25
|
get spawned(): number;
|
|
@@ -5,6 +5,7 @@ import { setUpQueryClient } from './query/client-setup.js';
|
|
|
5
5
|
import { wireQueryDispatcher } from './query/dispatcher-wiring.js';
|
|
6
6
|
import { assembleQueryPrompt } from './query/prompt-assembly.js';
|
|
7
7
|
import type { ProviderQueryContext } from './provider-context.js';
|
|
8
|
+
export declare function missingCredentialError(providerName: string): Error;
|
|
8
9
|
export interface QuerySetupResult {
|
|
9
10
|
client: Anthropic;
|
|
10
11
|
authMode: import('./types.js').AuthMode;
|
|
@@ -6,6 +6,7 @@ export interface ProviderRouterDeps {
|
|
|
6
6
|
providerNameForModel: (model: string | undefined) => string;
|
|
7
7
|
resolveApiKey: (model: string | undefined) => string | undefined;
|
|
8
8
|
getFallbackModel?: () => string | undefined;
|
|
9
|
+
primeCredential?: (model: string | undefined) => Promise<void>;
|
|
9
10
|
}
|
|
10
11
|
export interface ProviderRouterArgs {
|
|
11
12
|
prompt: AsyncIterable<ProviderUserTurn>;
|
|
@@ -23,6 +23,7 @@ export interface FallbackRouterHost {
|
|
|
23
23
|
export interface FallbackDeps {
|
|
24
24
|
providerNameForModel: (model: string | undefined) => string;
|
|
25
25
|
getFallbackModel?: () => string | undefined;
|
|
26
|
+
primeCredential?: (model: string | undefined) => Promise<void>;
|
|
26
27
|
}
|
|
27
28
|
type FallbackRequest = Extract<ProviderEvent, {
|
|
28
29
|
type: 'model.fallback_request';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const ROUTING_DIRECTIVE = "[skill-routing: active]\n\nRoute recurring work through registered skills instead of rolling ad-hoc solutions:\n\n- Before non-trivial implementation (multi-file edits, new features, config/build changes \u2014 anything that writes) \u2192 `/ground-state` first. Do NOT substitute inline `git status`/`get_runtime_state` \u2014 the skill triangulates git + infra + prior-session memory in parallel, which the inline checks miss. If `/ground-state` dispatch fails (depth limit, unavailable), fall back to inline checks AND note the coverage gap.\n- Bugs, failing tests, or regressions \u2192 `/diagnose`\n- High-stakes sub-agent output that will drive edits or commits \u2192 `/shadow-verify` before acting\n- Refactor needing parallel waves \u2192 `/parallelize`\n- Parallel or dependent multi-task work \u2192 `compose` tool (DAG of subagent nodes; minimize the longest dependency chain)\n- Greenfield feature where a written spec would genuinely help (novel scope, multi-day work, or external stakeholders involved) \u2192 `/mint`\n\nDo NOT reach for `/mint` for: bug fixes (use `/diagnose`), refactors with known shape, single-feature edits, work already spec'd in chat, or anything where the spec/approve pause would feel like ceremony. Implement directly in those cases.\n\nDefault to parallel execution. When a task decomposes into 2+ independent sub-tasks, dispatch them in a single compose wave or parallel agent calls -- do not run them one after another. Sequential dispatch is reserved for chains where an earlier output materially shapes the later prompt.\n\nCommon composed sequences \u2014 reach for these when the task shape matches:\n\n- Bug with failing test and non-trivial fix \u2192 `/diagnose` \u2192 `/shadow-verify` on the proposed fix\n- Refactor needing parallel waves \u2192 plan \u2192 `/parallelize` \u2192 build waves\n- Diagnose + fix in parallel \u2192 `compose` with two independent nodes\n- Research \u2192 implement \u2192 verify pipeline \u2192 `compose` with edges: research\u2192implement\u2192verify\n- Multiple independent investigations \u2192 `compose` with N nodes, no edges\n\nReach for context-isolated investigators when the task is exploratory:\n\n- Map an unfamiliar module before editing \u2192 `/gather` or `/research`\n- Re-derive a load-bearing claim independently \u2192 `/shadow-verify`\n- Audit a diff before merge \u2192 `/review`\n- Generate alternatives before committing to a plan \u2192 `/devils-advocate`\n\nOr dispatch a raw `agent` call when no skill matches but the work is parallelizable, verification-heavy, or would otherwise consume substantial inline context.\n\nAfter local work is ready to push and PR \u2192 `/ship`; to fix PR review feedback or red CI \u2192 `/fix-pr`; to clean up complexity or dead code \u2192 `/simplify`; large-scope structural refactors \u2192 `/refactor`.\n\nSkip orchestration for: single-line edits, trivial Q&A, and direct tool calls the user explicitly requested. The goal is leverage, not ceremony. If a skill would add overhead without adding value, don't invoke it.\n\nDefault to acting autonomously. `ask_question` is a last resort, not a first move \u2014 every question blocks on the operator, who is often away from keyboard.\n\nBefore you ask, you MUST exhaust the tools you have: read the files, check git, search the codebase and docs, inspect runtime state. If any tool can get you the answer, use the tool \u2014 never ask the operator for something you can discover yourself. When a wrong guess would be cheap or reversible, make a reasonable assumption, proceed, and state the assumption instead of asking.\n\n**Answerability \u2014 a question only helps if a human will actually answer it:**\n\n`surface` (from `get_runtime_state`, view `\"self\"`) is a partial signal, not a guarantee:\n- `daemon`, or any session started by a scheduler, cron job, or another agent, has no human watching \u2014 never block on `ask_question` here.\n- `cli` is ambiguous: the interactive REPL and the Telegram bot can reach a human, but one-shot `chat` runs and sub-agent forks report the same `cli` and have no elicitation handler \u2014 there `ask_question` returns `{ action: 'decline' }` instantly.\n- Even when a handler exists, the operator is usually away, so a blocking question can stall until the turn aborts.\n\nSo treat `ask_question` as best-effort: a `decline` or `cancel` result means \"no answer is coming,\" not a failure to abort the task on. When you cannot be sure a human will answer, instead of asking:\n1. **Proceed on a stated assumption** \u2014 pick the most reasonable interpretation, act on it, and record the assumption in your Done/Blocked terminal state for async review.\n2. **Emit a Blocked artifact** \u2014 if no safe assumption exists and proceeding would be irreversible, end the turn with a **Blocked** terminal state naming exactly what the operator must supply before the next run.\n\nReserve `ask_question` for the narrow set of things no tool can resolve: a genuinely ambiguous requirement whose readings lead to materially different work, a decision with significant or irreversible consequences, or context that lives only in the operator's head (a preference, a secret, an external constraint):\n\n- Question types: `text` (open-ended), `confirm` (yes/no), `choice` (single pick from list), `multi_choice` (multi-pick), `number` (numeric with optional bounds). When `allow_custom: true`, the result may include `custom_value` instead of `value` \u2014 check `content.custom_value !== undefined` to detect a free-form answer.\n- Ask one focused question at a time. Do NOT ask multiple questions in a single call, and do NOT stack several ask_question calls across a turn \u2014 fold the genuine unknowns into the single most decision-relevant question.\n- Do NOT use when the user has already provided sufficient context \u2014 infer and proceed instead.\n- The result `action` will be `accept` (answered), `cancel` (user interrupted), `decline` (no handler), or `skip` (optional question skipped).\n- `allow_custom` (choice/multi_choice only): opt-in to a free-form entry affordance. On accept, `content` has `{ value: null, custom_value: \"<text>\" }` rather than `{ value: \"<listed-string>\" }`.\n- After a `cancel` or `decline`,
|
|
2
|
-
export declare const END_OF_TURN_DIRECTIVE = "[end-of-turn protocol]\n\nEvery turn must end in one externally identifiable terminal state. AFK users need inspectable artifacts, not ceremony. Write each bullet as a single sentence.\n\n**Done**\n- What was done: <one-sentence summary>\n- Evidence: <durable location \u2014 file path, commit SHA, trace path, test output, or memory key; never transcript-only>\n- What changed: <world-state delta>\n- Deferred: <anything still pending, with why; or \"none\">\n- Not checked: <what you did not verify that a reader could reasonably assume you did; always include, using \"nothing material\" when true>\n- Undo: <how to reverse this turn's changes, or \"irreversible\" plus what cannot be reversed; include only if this turn changed something outside the conversation, such as files, commits, pushes, messages, or external systems; omit this bullet otherwise>\n- If files were written or edited but no `git commit` ran, say so explicitly \u2014 name the uncommitted paths and why (e.g. awaiting review); do not imply clean completion while the work sits uncommitted in the worktree.\n\n**Blocked**\n- What blocks: <the blocker>\n- What must change to unblock: <the unblock condition; never a command your own tools could have run, since you should have run it>\n- What has already been done: <progress so far>\n\n**Asking**\n- Question: <one precise question>\n- Assumption it resolves: <what answering clarifies>\n- Once answered: <what you will do>\n\n**Interrupted**\n- What you were doing: <the in-progress task>\n- Where state was saved: <location>\n- What resumption requires: <prerequisites>\n\nBefore emitting a terminal state, consider whether this session produced knowledge reusable across future sessions \u2014 a decision with rationale, a surprising debugging learning, a user preference or correction, or a non-obvious project convention. If so, call `memory_update` (target: \"fact\") before the terminal-state block. Do not force a write when there is nothing genuinely new \u2014 many sessions have nothing worth persisting, and that is fine.\n\nNever end a turn mid-loop without one of these. The terminal-state heading must be the last block of the response, with no trailing prose after it.";
|
|
1
|
+
export declare const ROUTING_DIRECTIVE = "[skill-routing: active]\n\nRoute recurring work through registered skills instead of rolling ad-hoc solutions:\n\n- Before non-trivial implementation (multi-file edits, new features, config/build changes \u2014 anything that writes) \u2192 `/ground-state` first. Do NOT substitute inline `git status`/`get_runtime_state` \u2014 the skill triangulates git + infra + prior-session memory in parallel, which the inline checks miss. If `/ground-state` dispatch fails (depth limit, unavailable), fall back to inline checks AND note the coverage gap.\n- Bugs, failing tests, or regressions \u2192 `/diagnose`\n- High-stakes sub-agent output that will drive edits or commits \u2192 `/shadow-verify` before acting\n- Refactor needing parallel waves \u2192 `/parallelize`\n- Parallel or dependent multi-task work \u2192 `compose` tool (DAG of subagent nodes; minimize the longest dependency chain)\n- Greenfield feature where a written spec would genuinely help (novel scope, multi-day work, or external stakeholders involved) \u2192 `/mint`\n\nDo NOT reach for `/mint` for: bug fixes (use `/diagnose`), refactors with known shape, single-feature edits, work already spec'd in chat, or anything where the spec/approve pause would feel like ceremony. Implement directly in those cases.\n\nDefault to parallel execution. When a task decomposes into 2+ independent sub-tasks, dispatch them in a single compose wave or parallel agent calls -- do not run them one after another. Sequential dispatch is reserved for chains where an earlier output materially shapes the later prompt.\n\nCommon composed sequences \u2014 reach for these when the task shape matches:\n\n- Bug with failing test and non-trivial fix \u2192 `/diagnose` \u2192 `/shadow-verify` on the proposed fix\n- Refactor needing parallel waves \u2192 plan \u2192 `/parallelize` \u2192 build waves\n- Diagnose + fix in parallel \u2192 `compose` with two independent nodes\n- Research \u2192 implement \u2192 verify pipeline \u2192 `compose` with edges: research\u2192implement\u2192verify\n- Multiple independent investigations \u2192 `compose` with N nodes, no edges\n\nReach for context-isolated investigators when the task is exploratory:\n\n- Map an unfamiliar module before editing \u2192 `/gather` or `/research`\n- Re-derive a load-bearing claim independently \u2192 `/shadow-verify`\n- Audit a diff before merge \u2192 `/review`\n- Generate alternatives before committing to a plan \u2192 `/devils-advocate`\n\nOr dispatch a raw `agent` call when no skill matches but the work is parallelizable, verification-heavy, or would otherwise consume substantial inline context.\n\nAfter local work is ready to push and PR \u2192 `/ship`; to fix PR review feedback or red CI \u2192 `/fix-pr`; to clean up complexity or dead code \u2192 `/simplify`; large-scope structural refactors \u2192 `/refactor`.\n\nSkip orchestration for: single-line edits, trivial Q&A, and direct tool calls the user explicitly requested. The goal is leverage, not ceremony. If a skill would add overhead without adding value, don't invoke it.\n\nDefault to acting autonomously. `ask_question` is a last resort, not a first move \u2014 every question blocks on the operator, who is often away from keyboard.\n\nBefore you ask, you MUST exhaust the tools you have: read the files, check git, search the codebase and docs, inspect runtime state. If any tool can get you the answer, use the tool \u2014 never ask the operator for something you can discover yourself. When a wrong guess would be cheap or reversible, make a reasonable assumption, proceed, and state the assumption instead of asking.\n\n**Answerability \u2014 a question only helps if a human will actually answer it:**\n\n`surface` (from `get_runtime_state`, view `\"self\"`) is a partial signal, not a guarantee:\n- `daemon`, or any session started by a scheduler, cron job, or another agent, has no human watching \u2014 never block on `ask_question` here.\n- `cli` is ambiguous: the interactive REPL and the Telegram bot can reach a human, but one-shot `chat` runs and sub-agent forks report the same `cli` and have no elicitation handler \u2014 there `ask_question` returns `{ action: 'decline' }` instantly.\n- Even when a handler exists, the operator is usually away, so a blocking question can stall until the turn aborts.\n\nSo treat `ask_question` as best-effort: a `decline` or `cancel` result means \"no answer is coming,\" not a failure to abort the task on. When you cannot be sure a human will answer, instead of asking:\n1. **Proceed on a stated assumption** \u2014 pick the most reasonable interpretation, act on it, and record the assumption in your Done/Blocked terminal state for async review.\n2. **Emit a Blocked artifact** \u2014 if no safe assumption exists and proceeding would be irreversible, end the turn with a **Blocked** terminal state naming exactly what the operator must supply before the next run.\n\nReserve `ask_question` for the narrow set of things no tool can resolve: a genuinely ambiguous requirement whose readings lead to materially different work, a decision with significant or irreversible consequences, or context that lives only in the operator's head (a preference, a secret, an external constraint):\n\n- Question types: `text` (open-ended), `confirm` (yes/no), `choice` (single pick from list), `multi_choice` (multi-pick), `number` (numeric with optional bounds). When `allow_custom: true`, the result may include `custom_value` instead of `value` \u2014 check `content.custom_value !== undefined` to detect a free-form answer.\n- Ask one focused question at a time. Do NOT ask multiple questions in a single call, and do NOT stack several ask_question calls across a turn \u2014 fold the genuine unknowns into the single most decision-relevant question.\n- Do NOT use when the user has already provided sufficient context \u2014 infer and proceed instead.\n- The result `action` will be `accept` (answered), `cancel` (user interrupted), `decline` (no handler), or `skip` (optional question skipped).\n- `allow_custom` (choice/multi_choice only): opt-in to a free-form entry affordance. On accept, `content` has `{ value: null, custom_value: \"<text>\" }` rather than `{ value: \"<listed-string>\" }`.\n- After a `cancel` or `decline`, do not loop and re-ask. Either proceed on a stated assumption (reversible work) or end with a **Blocked** terminal state naming exactly what the operator must supply (irreversible work).";
|
|
2
|
+
export declare const END_OF_TURN_DIRECTIVE = "[end-of-turn protocol]\n\nEvery turn must end in one externally identifiable terminal state. AFK users need inspectable artifacts, not ceremony. Write each bullet as a single sentence.\n\n**Done**\n- What was done: <one-sentence summary>\n- Evidence: <durable location \u2014 file path, commit SHA, trace path, test output, or memory key; never transcript-only>\n- What changed: <world-state delta>\n- Deferred: <anything still pending, with why; or \"none\">\n- Assumptions: <any assumption you proceeded on after a declined or cancelled ask_question, plus the rationale; omit this bullet when no assumptions were made>\n- Not checked: <what you did not verify that a reader could reasonably assume you did; always include, using \"nothing material\" when true>\n- Undo: <how to reverse this turn's changes, or \"irreversible\" plus what cannot be reversed; include only if this turn changed something outside the conversation, such as files, commits, pushes, messages, or external systems; omit this bullet otherwise>\n- If files were written or edited but no `git commit` ran, say so explicitly \u2014 name the uncommitted paths and why (e.g. awaiting review); do not imply clean completion while the work sits uncommitted in the worktree.\n\n**Blocked**\n- What blocks: <the blocker>\n- What must change to unblock: <the unblock condition; never a command your own tools could have run, since you should have run it>\n- What has already been done: <progress so far>\n\n**Asking**\n- Question: <one precise question>\n- Assumption it resolves: <what answering clarifies>\n- Once answered: <what you will do>\n\n**Interrupted**\n- What you were doing: <the in-progress task>\n- Where state was saved: <location>\n- What resumption requires: <prerequisites>\n\nBefore emitting a terminal state, consider whether this session produced knowledge reusable across future sessions \u2014 a decision with rationale, a surprising debugging learning, a user preference or correction, or a non-obvious project convention. If so, call `memory_update` (target: \"fact\") before the terminal-state block. Do not force a write when there is nothing genuinely new \u2014 many sessions have nothing worth persisting, and that is fine.\n\nNever end a turn mid-loop without one of these. The terminal-state heading must be the last block of the response, with no trailing prose after it.";
|
|
3
3
|
export type PromptSurface = 'repl' | 'telegram' | 'one-shot';
|
|
4
4
|
export declare function assembleSystemPrompt(base: string | undefined, autoRouting: boolean, surface?: PromptSurface): string | undefined;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { AgentConfig } from '../types/config-types.js';
|
|
2
|
+
export declare function sessionNeedsStoredLogin(config: AgentConfig, model: string | undefined): boolean;
|
|
3
|
+
export declare function primeSessionCredential(config: AgentConfig, model: string | undefined): Promise<void>;
|
|
@@ -5,6 +5,7 @@ export declare class SessionStateManager {
|
|
|
5
5
|
private resolveInitialization;
|
|
6
6
|
private rejectInitialization;
|
|
7
7
|
private initializationSettled;
|
|
8
|
+
private initializationError;
|
|
8
9
|
private sessionMetadata;
|
|
9
10
|
private sessionIdentity;
|
|
10
11
|
private onSessionIdAssigned?;
|
|
@@ -19,5 +20,6 @@ export declare class SessionStateManager {
|
|
|
19
20
|
resolveInitializationIfNeeded(): void;
|
|
20
21
|
resolveInitializationOnce(): void;
|
|
21
22
|
rejectInitializationOnce(error: Error): void;
|
|
23
|
+
getInitializationError(): Error | undefined;
|
|
22
24
|
isInitializationSettled(): boolean;
|
|
23
25
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ProviderEvent } from '../provider.js';
|
|
2
|
-
import type
|
|
2
|
+
import { type ToolEventMin } from '../done-evidence.js';
|
|
3
3
|
type ToolUseStartEvent = Extract<ProviderEvent, {
|
|
4
4
|
type: 'tool.use.start';
|
|
5
5
|
}>;
|
|
@@ -9,6 +9,7 @@ type ToolOutputEvent = Extract<ProviderEvent, {
|
|
|
9
9
|
export interface ToolEventAccumulator {
|
|
10
10
|
_successfulToolNames?: string[];
|
|
11
11
|
_pendingToolInputs?: Map<string, string>;
|
|
12
|
+
_pendingToolInputsRaw?: Map<string, string>;
|
|
12
13
|
_turnToolEvents?: ToolEventMin[];
|
|
13
14
|
}
|
|
14
15
|
export declare function recordToolUseStart(acc: ToolEventAccumulator, event: ToolUseStartEvent): void;
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import type { AcpSessionHandle } from './acp.session.js';
|
|
2
|
-
import type { AcpClientPeer,
|
|
2
|
+
import type { AcpClientPeer, SessionUpdate, StopReason, ToolCallStart, TranslatorState } from './acp.wire.js';
|
|
3
3
|
export interface ActiveTurn {
|
|
4
4
|
abort: AbortController;
|
|
5
5
|
cancelled: boolean;
|
|
6
|
-
ending?: boolean;
|
|
7
6
|
done: Promise<void>;
|
|
8
7
|
}
|
|
9
8
|
export interface LiveSession {
|
|
@@ -11,7 +10,6 @@ export interface LiveSession {
|
|
|
11
10
|
cwd: string;
|
|
12
11
|
handle?: AcpSessionHandle;
|
|
13
12
|
translator: TranslatorState;
|
|
14
|
-
gate?: AcpPermissionGate;
|
|
15
13
|
active?: ActiveTurn;
|
|
16
14
|
closing: boolean;
|
|
17
15
|
wireMcp?: string;
|
|
@@ -9,7 +9,6 @@ import { AcpSessionResources } from './acp.session.resources.js';
|
|
|
9
9
|
export interface AcpSessionOptions {
|
|
10
10
|
model: AgentModelInput;
|
|
11
11
|
maxTurns: number;
|
|
12
|
-
dangerouslySkipPermissions?: boolean;
|
|
13
12
|
cwd?: string;
|
|
14
13
|
canUseTool?: CanUseTool;
|
|
15
14
|
childCanUseTool?: ChildCanUseToolFactory;
|
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
import path from 'node:path';
|
|
2
2
|
export type PathFlavor = typeof path.posix;
|
|
3
|
+
export declare function delegationSuffix(toolName: string): string;
|
|
3
4
|
export declare function isContained(root: string, abs: string, p?: PathFlavor): boolean;
|
|
4
5
|
export declare function driveless(raw: string, p?: PathFlavor): boolean;
|
|
5
6
|
export declare function relocatesChildren(toolName: string, input: Record<string, unknown>, cwd: string | undefined, p?: PathFlavor): boolean;
|
|
6
7
|
export declare function dependsOnCallerCwd(input: Record<string, unknown>, p?: PathFlavor): boolean;
|
|
7
8
|
export declare function outsidePaths(toolName: string, input: Record<string, unknown>, cwd: string | undefined, callerCwd?: string, p?: PathFlavor): string[];
|
|
9
|
+
export declare const GIT_MARKER = "(git internals)";
|
|
10
|
+
export declare const CONFIG_MARKER = "(project config that runs commands)";
|
|
11
|
+
export declare const AGENT_MARKER = "(agent instructions or definitions)";
|
|
12
|
+
export declare function sensitiveMarker(raw: string, base: string | undefined, p?: PathFlavor): string;
|
|
13
|
+
export declare function sensitiveMarkers(toolName: string, input: Record<string, unknown>, base: string | undefined, p?: PathFlavor): string[];
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
import type { CanUseTool } from '../../agent/types/sdk-types.js';
|
|
2
|
-
import type { ChildToolOrigin } from '../../agent/tools/nesting.can-use-tool.js';
|
|
3
|
-
import type { ElicitationHandler } from '../../agent/elicitation-router.js';
|
|
4
1
|
import type { ResponseMetadata } from '../../agent/types/message-types.js';
|
|
5
2
|
export type { CanUseTool } from '../../agent/types/sdk-types.js';
|
|
6
3
|
export type JsonValue = null | boolean | number | string | JsonValue[] | {
|
|
@@ -206,26 +203,6 @@ export interface SessionNotification {
|
|
|
206
203
|
sessionId: string;
|
|
207
204
|
update: SessionUpdate;
|
|
208
205
|
}
|
|
209
|
-
export type PermissionOptionKind = 'allow_once' | 'allow_always' | 'reject_once' | 'reject_always';
|
|
210
|
-
export interface PermissionOption {
|
|
211
|
-
optionId: string;
|
|
212
|
-
name: string;
|
|
213
|
-
kind: PermissionOptionKind;
|
|
214
|
-
}
|
|
215
|
-
export interface RequestPermissionRequest {
|
|
216
|
-
sessionId: string;
|
|
217
|
-
toolCall: ToolCallUpdate;
|
|
218
|
-
options: PermissionOption[];
|
|
219
|
-
}
|
|
220
|
-
export type RequestPermissionOutcome = {
|
|
221
|
-
outcome: 'selected';
|
|
222
|
-
optionId: string;
|
|
223
|
-
} | {
|
|
224
|
-
outcome: 'cancelled';
|
|
225
|
-
};
|
|
226
|
-
export interface RequestPermissionResponse {
|
|
227
|
-
outcome: RequestPermissionOutcome;
|
|
228
|
-
}
|
|
229
206
|
export interface TranslatorToolState {
|
|
230
207
|
name: string;
|
|
231
208
|
input?: JsonValue;
|
|
@@ -249,18 +226,3 @@ export interface FinishedTurn {
|
|
|
249
226
|
updates: SessionUpdate[];
|
|
250
227
|
stopReason: StopReason;
|
|
251
228
|
}
|
|
252
|
-
export interface AcpPermissionOptions {
|
|
253
|
-
skip: boolean;
|
|
254
|
-
emitToolCall(update: ToolCallStart): Promise<void>;
|
|
255
|
-
onCancelled(): void;
|
|
256
|
-
cwd?: string;
|
|
257
|
-
turnActive?(): boolean;
|
|
258
|
-
}
|
|
259
|
-
export interface AcpPermissionGate {
|
|
260
|
-
canUseTool: CanUseTool;
|
|
261
|
-
elicitationHandler?: ElicitationHandler;
|
|
262
|
-
cancelAll(): void;
|
|
263
|
-
wouldAsk?(toolName: string, input: Record<string, unknown>): boolean;
|
|
264
|
-
forChild?(origin: ChildToolOrigin | undefined): CanUseTool;
|
|
265
|
-
endTurn?(): Promise<void>;
|
|
266
|
-
}
|
|
@@ -32,7 +32,6 @@ export interface ChatActionOptions {
|
|
|
32
32
|
post?: string;
|
|
33
33
|
postPr?: string;
|
|
34
34
|
permissionMode?: PermissionMode;
|
|
35
|
-
dangerouslySkipPermissions?: boolean;
|
|
36
35
|
}
|
|
37
36
|
export declare function resolvePostTargets(post: string | undefined): PostTarget[];
|
|
38
37
|
export declare function resolveModelOptions(options: Pick<ChatActionOptions, 'thinking' | 'effort' | 'maxBudgetUsd' | 'taskBudget' | 'maxOutputTokens'>): {
|
|
@@ -29,7 +29,6 @@ export interface ChatSessionSetupParams {
|
|
|
29
29
|
mcpManager: McpManager | undefined;
|
|
30
30
|
resumeConfig: Record<string, unknown>;
|
|
31
31
|
permissionMode: PermissionMode | undefined;
|
|
32
|
-
dangerouslySkipPermissions: boolean | undefined;
|
|
33
32
|
maxTurns: number;
|
|
34
33
|
temperature: number | undefined;
|
|
35
34
|
baseUrl: string | undefined;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ChatClient, ChatRelayError, MuteStore } from '../../../global-chat/client-types.js';
|
|
2
|
+
import { type ChatViewState } from './global-chat-model.js';
|
|
3
|
+
export interface ActionContext {
|
|
4
|
+
state: ChatViewState;
|
|
5
|
+
client: ChatClient;
|
|
6
|
+
mutes: MuteStore;
|
|
7
|
+
paint: () => void;
|
|
8
|
+
isOpen: () => boolean;
|
|
9
|
+
}
|
|
10
|
+
export declare function sendChatLine(ctx: ActionContext): Promise<void>;
|
|
11
|
+
export declare function submitLine(ctx: ActionContext): Promise<void>;
|
|
12
|
+
export declare function relayErrorLine(error: ChatRelayError): string | null;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { RoomMode } from '../../../global-chat/protocol.js';
|
|
2
|
+
import { type ChatViewState } from './global-chat-model.js';
|
|
3
|
+
export interface ResolvedAuthor {
|
|
4
|
+
pubkey: string;
|
|
5
|
+
name: string;
|
|
6
|
+
tag: string;
|
|
7
|
+
}
|
|
8
|
+
export type ViewCommand = {
|
|
9
|
+
kind: 'help';
|
|
10
|
+
} | {
|
|
11
|
+
kind: 'rules';
|
|
12
|
+
} | {
|
|
13
|
+
kind: 'mutes';
|
|
14
|
+
} | {
|
|
15
|
+
kind: 'mute';
|
|
16
|
+
author: ResolvedAuthor;
|
|
17
|
+
} | {
|
|
18
|
+
kind: 'unmute';
|
|
19
|
+
pubkey: string;
|
|
20
|
+
display: string;
|
|
21
|
+
} | {
|
|
22
|
+
kind: 'report';
|
|
23
|
+
id: string;
|
|
24
|
+
n: number;
|
|
25
|
+
} | {
|
|
26
|
+
kind: 'ban';
|
|
27
|
+
pubkey: string;
|
|
28
|
+
display: string;
|
|
29
|
+
} | {
|
|
30
|
+
kind: 'unban';
|
|
31
|
+
pubkey: string;
|
|
32
|
+
} | {
|
|
33
|
+
kind: 'delete';
|
|
34
|
+
id: string;
|
|
35
|
+
n: number;
|
|
36
|
+
} | {
|
|
37
|
+
kind: 'mode';
|
|
38
|
+
mode: RoomMode;
|
|
39
|
+
} | {
|
|
40
|
+
kind: 'error';
|
|
41
|
+
message: string;
|
|
42
|
+
};
|
|
43
|
+
export declare const HELP_LINES: readonly string[];
|
|
44
|
+
export declare const RULES_LINES: readonly string[];
|
|
45
|
+
export declare function parseViewCommand(line: string, state: ChatViewState): ViewCommand;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export type ChatKey = {
|
|
2
|
+
kind: 'text';
|
|
3
|
+
text: string;
|
|
4
|
+
} | {
|
|
5
|
+
kind: 'enter';
|
|
6
|
+
} | {
|
|
7
|
+
kind: 'backspace';
|
|
8
|
+
} | {
|
|
9
|
+
kind: 'clear';
|
|
10
|
+
} | {
|
|
11
|
+
kind: 'escape';
|
|
12
|
+
} | {
|
|
13
|
+
kind: 'interrupt';
|
|
14
|
+
} | {
|
|
15
|
+
kind: 'pageUp';
|
|
16
|
+
} | {
|
|
17
|
+
kind: 'pageDown';
|
|
18
|
+
} | {
|
|
19
|
+
kind: 'lineUp';
|
|
20
|
+
} | {
|
|
21
|
+
kind: 'lineDown';
|
|
22
|
+
};
|
|
23
|
+
export declare function splitPending(s: string): {
|
|
24
|
+
ready: string;
|
|
25
|
+
pending: string;
|
|
26
|
+
};
|
|
27
|
+
export declare function parseKeys(input: Buffer | string): ChatKey[];
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ChatActionResult, ChatPostResult, IdentityResult } from '../../../global-chat/client-types.js';
|
|
2
|
+
export declare function formatWait(ms: number): string;
|
|
3
|
+
type Failure = Extract<ChatActionResult, {
|
|
4
|
+
ok: false;
|
|
5
|
+
}> | Extract<ChatPostResult, {
|
|
6
|
+
ok: false;
|
|
7
|
+
}>;
|
|
8
|
+
export declare function explainFailure(result: Failure, verb?: string): string;
|
|
9
|
+
export declare function explainIdentityFailure(result: Extract<IdentityResult, {
|
|
10
|
+
ok: false;
|
|
11
|
+
}>): string;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { type Badge, type Msg, type RoomMode } from '../../../global-chat/protocol.js';
|
|
2
|
+
import type { ChatConnectionStatus, ChatIdentity, ChatWelcome } from '../../../global-chat/client-types.js';
|
|
3
|
+
export declare const MAX_ENTRIES = 300;
|
|
4
|
+
export declare const MAX_INPUT_CHARS = 500;
|
|
5
|
+
export interface ChatMessageEntry {
|
|
6
|
+
kind: 'msg';
|
|
7
|
+
removed?: boolean;
|
|
8
|
+
seq: number;
|
|
9
|
+
n: number;
|
|
10
|
+
id: string;
|
|
11
|
+
pubkey: string;
|
|
12
|
+
name: string;
|
|
13
|
+
tag: string;
|
|
14
|
+
text: string;
|
|
15
|
+
ts: number;
|
|
16
|
+
badge?: Badge;
|
|
17
|
+
}
|
|
18
|
+
export interface ChatSystemEntry {
|
|
19
|
+
kind: 'system';
|
|
20
|
+
seq: number;
|
|
21
|
+
level: 'info' | 'error';
|
|
22
|
+
text: string;
|
|
23
|
+
}
|
|
24
|
+
export type ChatEntry = ChatMessageEntry | ChatSystemEntry;
|
|
25
|
+
export interface MuteEntry {
|
|
26
|
+
name: string;
|
|
27
|
+
tag: string;
|
|
28
|
+
}
|
|
29
|
+
export type ChatMe = ChatIdentity & {
|
|
30
|
+
badge?: Badge;
|
|
31
|
+
};
|
|
32
|
+
export interface ChatViewState {
|
|
33
|
+
entries: ChatEntry[];
|
|
34
|
+
nextSeq: number;
|
|
35
|
+
nextN: number;
|
|
36
|
+
scroll: number;
|
|
37
|
+
frozenSeq: number | null;
|
|
38
|
+
unseen: boolean;
|
|
39
|
+
input: string;
|
|
40
|
+
sending: boolean;
|
|
41
|
+
status: ChatConnectionStatus;
|
|
42
|
+
online: number | null;
|
|
43
|
+
mode: RoomMode;
|
|
44
|
+
me: ChatMe | null;
|
|
45
|
+
muted: Map<string, MuteEntry>;
|
|
46
|
+
banner: string | null;
|
|
47
|
+
}
|
|
48
|
+
export declare function createChatState(me?: ChatMe | null): ChatViewState;
|
|
49
|
+
export declare function tagForPubkey(pubkey: string): string;
|
|
50
|
+
export declare function addMessage(state: ChatViewState, msg: Msg): boolean;
|
|
51
|
+
export declare function addSystem(state: ChatViewState, text: string, level?: 'info' | 'error'): void;
|
|
52
|
+
export declare function applyWelcome(state: ChatViewState, welcome: ChatWelcome): void;
|
|
53
|
+
export declare function deleteMessage(state: ChatViewState, id: string): void;
|
|
54
|
+
export declare function setStatus(state: ChatViewState, status: ChatConnectionStatus): void;
|
|
55
|
+
export declare function setOnline(state: ChatViewState, online: number): void;
|
|
56
|
+
export declare function setMode(state: ChatViewState, mode: RoomMode): void;
|
|
57
|
+
export declare function cleanInputChunk(chunk: string): string;
|
|
58
|
+
export declare function appendInput(state: ChatViewState, chunk: string): boolean;
|
|
59
|
+
export declare function backspace(state: ChatViewState): void;
|
|
60
|
+
export declare function clearInput(state: ChatViewState): void;
|
|
61
|
+
export declare function beginSend(state: ChatViewState): string | null;
|
|
62
|
+
export declare function finishSend(state: ChatViewState, ok: boolean, restore: string): void;
|
|
63
|
+
export declare function scrollUp(state: ChatViewState, lines: number): void;
|
|
64
|
+
export declare function scrollDown(state: ChatViewState, lines: number): void;
|
|
65
|
+
export declare function clampScroll(state: ChatViewState, maxScroll: number): void;
|
|
66
|
+
export declare function mute(state: ChatViewState, pubkey: string, name: string, tag: string): void;
|
|
67
|
+
export declare function unmute(state: ChatViewState, pubkey: string): void;
|
|
68
|
+
export declare function findByN(state: ChatViewState, n: number): ChatMessageEntry | null;
|
|
69
|
+
export declare function findByDisplay(state: ChatViewState, name: string, tag: string): ChatMessageEntry | null;
|
|
70
|
+
export declare function findMutedByDisplay(state: ChatViewState, name: string, tag: string): string | null;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare const NOTICE_LINES: readonly string[];
|
|
2
|
+
export declare const NOTICE_PROMPT = "Join? Press y to agree and continue, n or Esc to go back.";
|
|
3
|
+
export declare const NOTICE_MIN_COLUMNS = 80;
|
|
4
|
+
export declare const NOTICE_MIN_ROWS: number;
|
|
5
|
+
export declare function renderNotice(cols: number, rows: number): string[];
|
|
6
|
+
export declare function nameFeedback(name: string): {
|
|
7
|
+
ok: boolean;
|
|
8
|
+
text: string;
|
|
9
|
+
};
|
|
10
|
+
export declare function renderNameScreen(input: string, error: string | null, busy: boolean, cols: number, rows: number): string[];
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { ChalkInstance } from 'chalk';
|
|
2
|
+
import type { ChatViewState } from './global-chat-model.js';
|
|
3
|
+
export declare const MIN_COLUMNS = 20;
|
|
4
|
+
export declare const MIN_ROWS = 6;
|
|
5
|
+
export declare const COUNTER_FROM: number;
|
|
6
|
+
export interface ChatFrame {
|
|
7
|
+
lines: string[];
|
|
8
|
+
maxScroll: number;
|
|
9
|
+
}
|
|
10
|
+
export declare function authorColor(pubkey: string, isMe: boolean): ChalkInstance;
|
|
11
|
+
export declare function mentionCells(text: string, myName: string | null): Array<{
|
|
12
|
+
g: string;
|
|
13
|
+
hi: boolean;
|
|
14
|
+
}>;
|
|
15
|
+
export declare function inputLine(state: ChatViewState, cols: number): string;
|
|
16
|
+
export declare function renderChat(state: ChatViewState, columns: number, rows: number): ChatFrame;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
export interface ChatCompositor {
|
|
2
|
+
suspendInput(): void;
|
|
3
|
+
resumeInput(): void;
|
|
4
|
+
repaint(): void;
|
|
5
|
+
}
|
|
6
|
+
export interface ChatStdin {
|
|
7
|
+
on(event: 'data', listener: (data: Buffer | string) => void): unknown;
|
|
8
|
+
removeListener(event: 'data', listener: (data: Buffer | string) => void): unknown;
|
|
9
|
+
setRawMode?(mode: boolean): unknown;
|
|
10
|
+
}
|
|
11
|
+
export interface ChatStdout {
|
|
12
|
+
write(chunk: string): unknown;
|
|
13
|
+
columns?: number;
|
|
14
|
+
rows?: number;
|
|
15
|
+
on(event: 'resize', listener: () => void): unknown;
|
|
16
|
+
removeListener(event: 'resize', listener: () => void): unknown;
|
|
17
|
+
}
|
|
18
|
+
export interface ChatTeardownGuards {
|
|
19
|
+
registerCleanup(fn: () => Promise<void>): () => void;
|
|
20
|
+
onProcessExit(fn: () => void): () => void;
|
|
21
|
+
}
|
|
22
|
+
export declare function onProcessExitOrSignal(fn: () => void): () => void;
|
|
23
|
+
export declare const defaultGuards: ChatTeardownGuards;
|
|
24
|
+
export declare const LEAVE_ALT_SCREEN = "\u001B[?25h\u001B[?1049l";
|
|
25
|
+
export declare const ENTER_ALT_SCREEN = "\u001B[?1049h\u001B[?25l\u001B[2J\u001B[H";
|
|
26
|
+
export interface Takeover {
|
|
27
|
+
restore(): void;
|
|
28
|
+
}
|
|
29
|
+
export declare function takeTerminal(params: {
|
|
30
|
+
compositor: ChatCompositor;
|
|
31
|
+
stdin: ChatStdin;
|
|
32
|
+
stdout: ChatStdout;
|
|
33
|
+
guards: ChatTeardownGuards;
|
|
34
|
+
afterEnter: () => void;
|
|
35
|
+
afterLeave: () => void;
|
|
36
|
+
onCrash: () => void;
|
|
37
|
+
}): Takeover;
|
|
38
|
+
export declare function paintFrame(stdout: ChatStdout, lines: readonly string[]): void;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { ChatClient, ChatIdentity, IdentityStore, MuteStore } from '../../../global-chat/client-types.js';
|
|
2
|
+
import { type ChatCompositor, type ChatStdin, type ChatStdout, type ChatTeardownGuards } from './global-chat-terminal.js';
|
|
3
|
+
export interface ChatClock {
|
|
4
|
+
schedule(fn: () => void, ms: number): () => void;
|
|
5
|
+
}
|
|
6
|
+
export declare const realClock: ChatClock;
|
|
7
|
+
export interface GlobalChatViewDeps {
|
|
8
|
+
compositor: ChatCompositor;
|
|
9
|
+
stdin: ChatStdin;
|
|
10
|
+
stdout: ChatStdout;
|
|
11
|
+
createClient: (identity: ChatIdentity) => ChatClient;
|
|
12
|
+
relayHost: string;
|
|
13
|
+
identity: IdentityStore;
|
|
14
|
+
mutes: MuteStore;
|
|
15
|
+
clock: ChatClock;
|
|
16
|
+
pauseRecording: () => void;
|
|
17
|
+
resumeRecording: () => void;
|
|
18
|
+
hasPendingWork?: () => boolean;
|
|
19
|
+
guards?: ChatTeardownGuards;
|
|
20
|
+
}
|
|
21
|
+
export type GlobalChatOutcome = 'left' | 'declined';
|
|
22
|
+
export declare function runGlobalChatView(deps: GlobalChatViewDeps): Promise<GlobalChatOutcome>;
|