@gajae-code/coding-agent 0.2.1 → 0.2.3
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 +59 -1
- package/dist/types/cli/setup-cli.d.ts +1 -0
- package/dist/types/commands/contribution-prep.d.ts +18 -0
- package/dist/types/commands/deep-interview.d.ts +41 -0
- package/dist/types/commands/session.d.ts +24 -0
- package/dist/types/commands/setup.d.ts +3 -0
- package/dist/types/config/model-registry.d.ts +2 -2
- package/dist/types/config/models-config-schema.d.ts +17 -9
- package/dist/types/config/settings-schema.d.ts +37 -24
- package/dist/types/discovery/helpers.d.ts +2 -0
- package/dist/types/extensibility/extensions/types.d.ts +6 -0
- package/dist/types/gjc-runtime/deep-interview-runtime.d.ts +33 -0
- package/dist/types/gjc-runtime/goal-mode-request.d.ts +1 -1
- package/dist/types/gjc-runtime/launch-tmux.d.ts +12 -11
- package/dist/types/gjc-runtime/ralplan-runtime.d.ts +25 -0
- package/dist/types/gjc-runtime/state-runtime.d.ts +13 -0
- package/dist/types/gjc-runtime/team-runtime.d.ts +37 -5
- package/dist/types/gjc-runtime/tmux-common.d.ts +41 -0
- package/dist/types/gjc-runtime/tmux-sessions.d.ts +17 -0
- package/dist/types/goals/runtime.d.ts +3 -9
- package/dist/types/goals/state.d.ts +3 -6
- package/dist/types/goals/tools/goal-tool.d.ts +1 -69
- package/dist/types/hooks/skill-state.d.ts +5 -0
- package/dist/types/memories/index.d.ts +1 -1
- package/dist/types/memory-backend/local-backend.d.ts +3 -3
- package/dist/types/modes/components/hook-selector.d.ts +7 -0
- package/dist/types/modes/components/settings-selector.d.ts +0 -2
- package/dist/types/modes/components/status-line/types.d.ts +0 -3
- package/dist/types/modes/components/status-line.d.ts +0 -3
- package/dist/types/modes/controllers/command-controller.d.ts +1 -0
- package/dist/types/modes/interactive-mode.d.ts +1 -12
- package/dist/types/modes/theme/defaults/index.d.ts +0 -2
- package/dist/types/modes/theme/theme.d.ts +1 -2
- package/dist/types/modes/types.d.ts +1 -7
- package/dist/types/modes/utils/context-usage.d.ts +6 -2
- package/dist/types/sdk.d.ts +6 -2
- package/dist/types/session/agent-session.d.ts +47 -1
- package/dist/types/session/contribution-prep.d.ts +47 -0
- package/dist/types/session/session-manager.d.ts +3 -0
- package/dist/types/setup/model-onboarding-guidance.d.ts +1 -0
- package/dist/types/setup/provider-onboarding.d.ts +29 -5
- package/dist/types/skill-state/active-state.d.ts +30 -1
- package/dist/types/skill-state/deep-interview-mutation-guard.d.ts +6 -1
- package/dist/types/skill-state/initial-phase.d.ts +12 -0
- package/dist/types/skill-state/workflow-hud.d.ts +9 -4
- package/dist/types/skill-state/workflow-state-contract.d.ts +34 -0
- package/dist/types/task/executor.d.ts +2 -0
- package/dist/types/task/types.d.ts +11 -0
- package/dist/types/tools/index.d.ts +20 -1
- package/dist/types/tools/skill.d.ts +47 -0
- package/dist/types/utils/changelog.d.ts +18 -2
- package/package.json +7 -7
- package/src/cli/args.ts +3 -2
- package/src/cli/setup-cli.ts +26 -12
- package/src/cli.ts +7 -1
- package/src/commands/contribution-prep.ts +41 -0
- package/src/commands/deep-interview.ts +30 -23
- package/src/commands/launch.ts +10 -1
- package/src/commands/ralplan.ts +10 -22
- package/src/commands/session.ts +150 -0
- package/src/commands/setup.ts +2 -0
- package/src/commands/state.ts +15 -4
- package/src/commands/team.ts +23 -3
- package/src/config/model-registry.ts +10 -2
- package/src/config/models-config-schema.ts +120 -102
- package/src/config/settings-schema.ts +42 -25
- package/src/config.ts +1 -1
- package/src/defaults/gjc/skills/deep-interview/SKILL.md +32 -13
- package/src/defaults/gjc/skills/ralplan/SKILL.md +22 -2
- package/src/defaults/gjc/skills/team/SKILL.md +39 -7
- package/src/defaults/gjc/skills/ultragoal/SKILL.md +33 -25
- package/src/discovery/helpers.ts +24 -1
- package/src/eval/py/prelude.py +1 -1
- package/src/extensibility/extensions/types.ts +6 -0
- package/src/gjc-runtime/deep-interview-runtime.ts +546 -0
- package/src/gjc-runtime/goal-mode-request.ts +2 -19
- package/src/gjc-runtime/launch-tmux.ts +83 -43
- package/src/gjc-runtime/ralplan-runtime.ts +460 -0
- package/src/gjc-runtime/state-runtime.ts +731 -0
- package/src/gjc-runtime/team-runtime.ts +708 -52
- package/src/gjc-runtime/tmux-common.ts +119 -0
- package/src/gjc-runtime/tmux-sessions.ts +165 -0
- package/src/gjc-runtime/ultragoal-guard.ts +6 -3
- package/src/gjc-runtime/ultragoal-runtime.ts +5 -4
- package/src/goals/runtime.ts +38 -144
- package/src/goals/state.ts +36 -7
- package/src/goals/tools/goal-tool.ts +15 -172
- package/src/hooks/skill-state.ts +39 -18
- package/src/internal-urls/docs-index.generated.ts +5 -4
- package/src/internal-urls/memory-protocol.ts +3 -2
- package/src/main.ts +2 -3
- package/src/memories/index.ts +2 -1
- package/src/memory-backend/local-backend.ts +14 -6
- package/src/modes/components/hook-selector.ts +156 -1
- package/src/modes/components/settings-selector.ts +5 -12
- package/src/modes/components/skill-hud/render.ts +4 -0
- package/src/modes/components/status-line/segments.ts +5 -16
- package/src/modes/components/status-line/types.ts +0 -3
- package/src/modes/components/status-line.ts +0 -6
- package/src/modes/controllers/command-controller.ts +27 -4
- package/src/modes/controllers/extension-ui-controller.ts +1 -0
- package/src/modes/controllers/input-controller.ts +0 -15
- package/src/modes/controllers/selector-controller.ts +4 -11
- package/src/modes/interactive-mode.ts +18 -219
- package/src/modes/theme/defaults/dark-poimandres.json +0 -1
- package/src/modes/theme/defaults/light-poimandres.json +0 -1
- package/src/modes/theme/theme.ts +0 -6
- package/src/modes/types.ts +1 -7
- package/src/modes/utils/context-usage.ts +66 -17
- package/src/prompts/agents/architect.md +3 -0
- package/src/prompts/agents/executor.md +2 -0
- package/src/prompts/agents/frontmatter.md +1 -0
- package/src/prompts/goals/goal-continuation.md +1 -4
- package/src/prompts/goals/goal-mode-active.md +3 -5
- package/src/prompts/system/subagent-system-prompt.md +6 -0
- package/src/prompts/system/system-prompt.md +5 -7
- package/src/prompts/tools/goal.md +4 -4
- package/src/prompts/tools/skill.md +28 -0
- package/src/prompts/tools/task.md +3 -0
- package/src/sdk.ts +51 -11
- package/src/session/agent-session.ts +222 -21
- package/src/session/contribution-prep.ts +320 -0
- package/src/session/session-manager.ts +9 -1
- package/src/setup/model-onboarding-guidance.ts +6 -3
- package/src/setup/provider-onboarding.ts +177 -16
- package/src/skill-state/active-state.ts +188 -25
- package/src/skill-state/deep-interview-mutation-guard.ts +72 -21
- package/src/skill-state/initial-phase.ts +17 -0
- package/src/skill-state/workflow-hud.ts +23 -5
- package/src/skill-state/workflow-state-contract.ts +121 -0
- package/src/slash-commands/builtin-registry.ts +75 -25
- package/src/slash-commands/helpers/context-report.ts +123 -13
- package/src/task/agents.ts +1 -0
- package/src/task/commands.ts +1 -5
- package/src/task/executor.ts +9 -1
- package/src/task/index.ts +91 -4
- package/src/task/types.ts +6 -0
- package/src/tools/ask.ts +2 -0
- package/src/tools/gh.ts +212 -2
- package/src/tools/index.ts +25 -6
- package/src/tools/skill.ts +153 -0
- package/src/utils/changelog.ts +67 -44
- package/dist/types/commands/gjc-runtime-bridge.d.ts +0 -30
- package/dist/types/commands/question.d.ts +0 -7
- package/dist/types/modes/loop-limit.d.ts +0 -22
- package/src/commands/gjc-runtime-bridge.ts +0 -227
- package/src/commands/question.ts +0 -12
- package/src/modes/loop-limit.ts +0 -140
- package/src/prompts/commands/orchestrate.md +0 -49
- package/src/prompts/goals/goal-budget-limit.md +0 -16
- package/src/prompts/tools/create-goal.md +0 -3
- package/src/prompts/tools/get-goal.md +0 -3
- package/src/prompts/tools/update-goal.md +0 -3
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
export declare const GJC_DEFAULT_TMUX_SESSION = "gajae_code";
|
|
2
|
+
export declare const GJC_TMUX_SESSION_PREFIX = "gajae_code_";
|
|
3
|
+
export declare const GJC_TMUX_COMMAND_ENV = "GJC_TMUX_COMMAND";
|
|
4
|
+
export declare const GJC_TMUX_PROFILE_ENV = "GJC_TMUX_PROFILE";
|
|
5
|
+
export declare const GJC_TMUX_MOUSE_ENV = "GJC_MOUSE";
|
|
6
|
+
export declare const GJC_TMUX_PROFILE_OPTION = "@gjc-profile";
|
|
7
|
+
export declare const GJC_TMUX_PROFILE_VALUE = "1";
|
|
8
|
+
export declare const GJC_TMUX_BRANCH_OPTION = "@gjc-branch";
|
|
9
|
+
export declare const GJC_TMUX_BRANCH_SLUG_OPTION = "@gjc-branch-slug";
|
|
10
|
+
export declare const GJC_TMUX_PROJECT_OPTION = "@gjc-project";
|
|
11
|
+
export interface GjcTmuxProfileCommand {
|
|
12
|
+
description: string;
|
|
13
|
+
args: string[];
|
|
14
|
+
}
|
|
15
|
+
export interface TmuxCommandResult {
|
|
16
|
+
exitCode: number | null;
|
|
17
|
+
stdout?: string;
|
|
18
|
+
stderr?: string;
|
|
19
|
+
signalCode?: string | null;
|
|
20
|
+
}
|
|
21
|
+
export type TmuxCommandRunner = (args: string[]) => TmuxCommandResult;
|
|
22
|
+
export declare function envDisabled(value: string | undefined): boolean;
|
|
23
|
+
export declare function resolveGjcTmuxCommand(env?: NodeJS.ProcessEnv): string;
|
|
24
|
+
export declare function sanitizeTmuxToken(value: string): string;
|
|
25
|
+
export declare function buildGjcTmuxSessionSlug(value: string): string;
|
|
26
|
+
export declare function buildGjcTmuxSessionName(env?: NodeJS.ProcessEnv, context?: {
|
|
27
|
+
branch?: string | null;
|
|
28
|
+
now?: number;
|
|
29
|
+
id?: string;
|
|
30
|
+
}): string;
|
|
31
|
+
export declare function buildGjcTmuxRequiredProfileCommands(target: string, metadata?: {
|
|
32
|
+
branch?: string | null;
|
|
33
|
+
branchSlug?: string | null;
|
|
34
|
+
project?: string | null;
|
|
35
|
+
}): GjcTmuxProfileCommand[];
|
|
36
|
+
export declare function buildGjcTmuxProfileCommands(target: string, env?: NodeJS.ProcessEnv, metadata?: {
|
|
37
|
+
branch?: string | null;
|
|
38
|
+
branchSlug?: string | null;
|
|
39
|
+
project?: string | null;
|
|
40
|
+
}): GjcTmuxProfileCommand[];
|
|
41
|
+
export declare function normalizeTmuxCreatedAt(raw: string): string;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export interface GjcTmuxSessionStatus {
|
|
2
|
+
name: string;
|
|
3
|
+
attached: boolean;
|
|
4
|
+
windows: number;
|
|
5
|
+
panes: number;
|
|
6
|
+
bindings: string;
|
|
7
|
+
createdAt: string;
|
|
8
|
+
branch?: string;
|
|
9
|
+
branchSlug?: string;
|
|
10
|
+
project?: string;
|
|
11
|
+
}
|
|
12
|
+
export declare function listGjcTmuxSessions(env?: NodeJS.ProcessEnv): GjcTmuxSessionStatus[];
|
|
13
|
+
export declare function findGjcTmuxSessionByBranch(branch: string, env?: NodeJS.ProcessEnv, project?: string | null): GjcTmuxSessionStatus | undefined;
|
|
14
|
+
export declare function statusGjcTmuxSession(sessionName: string, env?: NodeJS.ProcessEnv): GjcTmuxSessionStatus;
|
|
15
|
+
export declare function createGjcTmuxSession(env?: NodeJS.ProcessEnv): GjcTmuxSessionStatus;
|
|
16
|
+
export declare function removeGjcTmuxSession(sessionName: string, env?: NodeJS.ProcessEnv): GjcTmuxSessionStatus;
|
|
17
|
+
export declare function attachGjcTmuxSession(sessionName: string, env?: NodeJS.ProcessEnv): never;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type Goal, type GoalModeState, type GoalRuntimeEvent, type GoalTokenUsage } from "./state";
|
|
2
2
|
export interface GoalRuntimeHost {
|
|
3
3
|
getState(): GoalModeState | undefined;
|
|
4
4
|
setState(state: GoalModeState | undefined): void;
|
|
@@ -24,16 +24,13 @@ export interface GoalWallClockSnapshot {
|
|
|
24
24
|
export interface GoalRuntimeSnapshot {
|
|
25
25
|
turnSnapshot?: GoalTurnSnapshot;
|
|
26
26
|
wallClock: GoalWallClockSnapshot;
|
|
27
|
-
budgetReportedFor?: string;
|
|
28
27
|
}
|
|
29
|
-
export type GoalPromptKind = "active" | "continuation"
|
|
30
|
-
export declare function remainingTokens(goal: Goal | null | undefined): number | null;
|
|
28
|
+
export type GoalPromptKind = "active" | "continuation";
|
|
31
29
|
export declare function escapeXmlText(input: string): string;
|
|
32
30
|
export declare function renderTrustedObjective(objective: string): string;
|
|
33
31
|
export declare function validateGoalObjective(objective: string, op: "create" | "replace"): string;
|
|
34
32
|
export declare function goalTokenDelta(current: GoalTokenUsage, baseline: GoalTokenUsage): number;
|
|
35
33
|
export declare function renderGoalPrompt(kind: GoalPromptKind, goal: Goal): string;
|
|
36
|
-
export declare function completionBudgetReport(goal: Goal): string | null;
|
|
37
34
|
export declare class GoalRuntime {
|
|
38
35
|
#private;
|
|
39
36
|
constructor(host: GoalRuntimeHost);
|
|
@@ -49,15 +46,12 @@ export declare class GoalRuntime {
|
|
|
49
46
|
reason?: "interrupted" | "internal";
|
|
50
47
|
}): Promise<void>;
|
|
51
48
|
onThreadResumed(): Promise<GoalModeState | undefined>;
|
|
52
|
-
|
|
53
|
-
flushUsage(steering: GoalBudgetSteering, currentUsage?: GoalTokenUsage): Promise<void>;
|
|
49
|
+
flushUsage(currentUsage?: GoalTokenUsage): Promise<void>;
|
|
54
50
|
createGoal(input: {
|
|
55
51
|
objective: string;
|
|
56
|
-
tokenBudget?: number;
|
|
57
52
|
}): Promise<GoalModeState>;
|
|
58
53
|
replaceGoal(input: {
|
|
59
54
|
objective: string;
|
|
60
|
-
tokenBudget?: number;
|
|
61
55
|
}): Promise<GoalModeState>;
|
|
62
56
|
resumeGoal(): Promise<GoalModeState>;
|
|
63
57
|
pauseGoal(): Promise<GoalModeState | undefined>;
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import type { UsageStatistics } from "../session/session-manager";
|
|
2
|
-
export type GoalStatus = "active" | "paused" | "
|
|
2
|
+
export type GoalStatus = "active" | "paused" | "complete" | "dropped";
|
|
3
3
|
export interface Goal {
|
|
4
4
|
id: string;
|
|
5
5
|
objective: string;
|
|
6
6
|
status: GoalStatus;
|
|
7
|
-
tokenBudget?: number;
|
|
8
7
|
tokensUsed: number;
|
|
9
8
|
timeUsedSeconds: number;
|
|
10
9
|
createdAt: number;
|
|
@@ -19,8 +18,6 @@ export interface GoalModeState {
|
|
|
19
18
|
export interface GoalToolDetails {
|
|
20
19
|
op: "create" | "get" | "complete" | "resume" | "drop";
|
|
21
20
|
goal?: Goal | null;
|
|
22
|
-
remainingTokens?: number | null;
|
|
23
|
-
completionBudgetReport?: string | null;
|
|
24
21
|
}
|
|
25
22
|
export type GoalRuntimeEvent = {
|
|
26
23
|
type: "goal_updated";
|
|
@@ -31,5 +28,5 @@ export type GoalRuntimeEvent = {
|
|
|
31
28
|
prompt: string;
|
|
32
29
|
};
|
|
33
30
|
export type GoalTokenUsage = Pick<UsageStatistics, "input" | "output" | "cacheRead" | "cacheWrite">;
|
|
34
|
-
export
|
|
35
|
-
export
|
|
31
|
+
export declare function normalizeGoal(candidate: unknown): Goal | null;
|
|
32
|
+
export declare function normalizeGoalModeState(candidate: GoalModeState | undefined): GoalModeState | undefined;
|
|
@@ -14,31 +14,12 @@ declare const goalSchema: z.ZodObject<{
|
|
|
14
14
|
resume: "resume";
|
|
15
15
|
}>;
|
|
16
16
|
objective: z.ZodOptional<z.ZodString>;
|
|
17
|
-
token_budget: z.ZodOptional<z.ZodNumber>;
|
|
18
|
-
}, z.core.$strip>;
|
|
19
|
-
declare const getGoalSchema: z.ZodObject<{}, z.core.$strip>;
|
|
20
|
-
declare const createGoalSchema: z.ZodObject<{
|
|
21
|
-
objective: z.ZodString;
|
|
22
|
-
token_budget: z.ZodOptional<z.ZodNumber>;
|
|
23
|
-
}, z.core.$strip>;
|
|
24
|
-
declare const updateGoalSchema: z.ZodObject<{
|
|
25
|
-
status: z.ZodEnum<{
|
|
26
|
-
complete: "complete";
|
|
27
|
-
dropped: "dropped";
|
|
28
|
-
}>;
|
|
29
17
|
}, z.core.$strip>;
|
|
30
18
|
export type GoalToolInput = z.infer<typeof goalSchema>;
|
|
31
|
-
export type GetGoalToolInput = z.infer<typeof getGoalSchema>;
|
|
32
|
-
export type CreateGoalToolInput = z.infer<typeof createGoalSchema>;
|
|
33
|
-
export type UpdateGoalToolInput = z.infer<typeof updateGoalSchema>;
|
|
34
19
|
export interface GoalToolResponse {
|
|
35
20
|
goal: Goal | null;
|
|
36
|
-
remainingTokens: number | null;
|
|
37
|
-
completionBudgetReport: string | null;
|
|
38
21
|
}
|
|
39
|
-
export declare function buildGoalToolResponse(goal: Goal | null | undefined
|
|
40
|
-
includeCompletionReport?: boolean;
|
|
41
|
-
}): GoalToolResponse;
|
|
22
|
+
export declare function buildGoalToolResponse(goal: Goal | null | undefined): GoalToolResponse;
|
|
42
23
|
export declare class GoalTool implements AgentTool<typeof goalSchema, GoalToolDetails> {
|
|
43
24
|
#private;
|
|
44
25
|
readonly name = "goal";
|
|
@@ -54,64 +35,15 @@ export declare class GoalTool implements AgentTool<typeof goalSchema, GoalToolDe
|
|
|
54
35
|
resume: "resume";
|
|
55
36
|
}>;
|
|
56
37
|
objective: z.ZodOptional<z.ZodString>;
|
|
57
|
-
token_budget: z.ZodOptional<z.ZodNumber>;
|
|
58
38
|
}, z.core.$strip>;
|
|
59
39
|
readonly strict = true;
|
|
60
40
|
readonly intent: "omit";
|
|
61
41
|
constructor(session: ToolSession);
|
|
62
42
|
execute(_toolCallId: string, params: GoalToolInput, _signal?: AbortSignal, _onUpdate?: AgentToolUpdateCallback<GoalToolDetails>, _context?: AgentToolContext): Promise<AgentToolResult<GoalToolDetails>>;
|
|
63
43
|
}
|
|
64
|
-
export declare class GetGoalTool implements AgentTool<typeof getGoalSchema, GoalToolDetails> {
|
|
65
|
-
#private;
|
|
66
|
-
readonly name = "get_goal";
|
|
67
|
-
readonly label = "Get Goal";
|
|
68
|
-
readonly loadMode: "essential";
|
|
69
|
-
readonly description: string;
|
|
70
|
-
readonly parameters: z.ZodObject<{}, z.core.$strip>;
|
|
71
|
-
readonly strict = true;
|
|
72
|
-
readonly intent: "omit";
|
|
73
|
-
static createIf(session: ToolSession): GetGoalTool | null;
|
|
74
|
-
constructor(session: ToolSession);
|
|
75
|
-
execute(_toolCallId: string, _params: GetGoalToolInput, _signal?: AbortSignal, _onUpdate?: AgentToolUpdateCallback<GoalToolDetails>, _context?: AgentToolContext): Promise<AgentToolResult<GoalToolDetails>>;
|
|
76
|
-
}
|
|
77
|
-
export declare class CreateGoalTool implements AgentTool<typeof createGoalSchema, GoalToolDetails> {
|
|
78
|
-
#private;
|
|
79
|
-
readonly name = "create_goal";
|
|
80
|
-
readonly label = "Create Goal";
|
|
81
|
-
readonly loadMode: "essential";
|
|
82
|
-
readonly description: string;
|
|
83
|
-
readonly parameters: z.ZodObject<{
|
|
84
|
-
objective: z.ZodString;
|
|
85
|
-
token_budget: z.ZodOptional<z.ZodNumber>;
|
|
86
|
-
}, z.core.$strip>;
|
|
87
|
-
readonly strict = true;
|
|
88
|
-
readonly intent: "omit";
|
|
89
|
-
static createIf(session: ToolSession): CreateGoalTool | null;
|
|
90
|
-
constructor(session: ToolSession);
|
|
91
|
-
execute(_toolCallId: string, params: CreateGoalToolInput, _signal?: AbortSignal, _onUpdate?: AgentToolUpdateCallback<GoalToolDetails>, _context?: AgentToolContext): Promise<AgentToolResult<GoalToolDetails>>;
|
|
92
|
-
}
|
|
93
|
-
export declare class UpdateGoalTool implements AgentTool<typeof updateGoalSchema, GoalToolDetails> {
|
|
94
|
-
#private;
|
|
95
|
-
readonly name = "update_goal";
|
|
96
|
-
readonly label = "Update Goal";
|
|
97
|
-
readonly loadMode: "essential";
|
|
98
|
-
readonly description: string;
|
|
99
|
-
readonly parameters: z.ZodObject<{
|
|
100
|
-
status: z.ZodEnum<{
|
|
101
|
-
complete: "complete";
|
|
102
|
-
dropped: "dropped";
|
|
103
|
-
}>;
|
|
104
|
-
}, z.core.$strip>;
|
|
105
|
-
readonly strict = true;
|
|
106
|
-
readonly intent: "omit";
|
|
107
|
-
static createIf(session: ToolSession): UpdateGoalTool | null;
|
|
108
|
-
constructor(session: ToolSession);
|
|
109
|
-
execute(_toolCallId: string, params: UpdateGoalToolInput, _signal?: AbortSignal, _onUpdate?: AgentToolUpdateCallback<GoalToolDetails>, _context?: AgentToolContext): Promise<AgentToolResult<GoalToolDetails>>;
|
|
110
|
-
}
|
|
111
44
|
interface GoalRenderArgs {
|
|
112
45
|
op?: GoalToolInput["op"];
|
|
113
46
|
objective?: string;
|
|
114
|
-
token_budget?: number;
|
|
115
47
|
}
|
|
116
48
|
export declare const goalToolRenderer: {
|
|
117
49
|
renderCall(args: GoalRenderArgs, _options: RenderResultOptions, uiTheme: Theme): Component;
|
|
@@ -50,6 +50,9 @@ export interface ModeState {
|
|
|
50
50
|
thread_id?: string;
|
|
51
51
|
cwd?: string;
|
|
52
52
|
updated_at?: string;
|
|
53
|
+
handoff_from?: string;
|
|
54
|
+
handoff_to?: string;
|
|
55
|
+
handoff_at?: string;
|
|
53
56
|
[key: string]: unknown;
|
|
54
57
|
}
|
|
55
58
|
export interface RecordSkillActivationInput {
|
|
@@ -79,6 +82,8 @@ export interface UserPromptSubmitStateInput {
|
|
|
79
82
|
export declare function detectSkillKeywords(text: string): SkillKeywordMatch[];
|
|
80
83
|
export declare function detectPrimarySkillKeyword(text: string): SkillKeywordMatch | null;
|
|
81
84
|
export declare function resolveGjcStateDir(cwd: string, stateDir?: string): string;
|
|
85
|
+
import { initialPhaseForSkill } from "../skill-state/initial-phase";
|
|
86
|
+
export { initialPhaseForSkill };
|
|
82
87
|
export declare function readVisibleSkillActiveState(cwd: string, sessionId?: string, stateDir?: string): Promise<SkillActiveState | null>;
|
|
83
88
|
export declare function recordSkillActivation(input: RecordSkillActivationInput): Promise<SkillActiveState | null>;
|
|
84
89
|
export declare function buildActiveUltragoalPromptContext(input: UserPromptSubmitStateInput): Promise<string | null>;
|
|
@@ -16,7 +16,7 @@ export declare function startMemoryStartupTask(options: {
|
|
|
16
16
|
/**
|
|
17
17
|
* Build memory usage instructions for prompt injection.
|
|
18
18
|
*/
|
|
19
|
-
export declare function buildMemoryToolDeveloperInstructions(agentDir: string, settings: Settings): Promise<string | undefined>;
|
|
19
|
+
export declare function buildMemoryToolDeveloperInstructions(agentDir: string, settings: Settings, session?: AgentSession): Promise<string | undefined>;
|
|
20
20
|
/**
|
|
21
21
|
* Clear all persisted memory state and generated artifacts.
|
|
22
22
|
*/
|
|
@@ -2,8 +2,8 @@ import type { MemoryBackend } from "./types";
|
|
|
2
2
|
/**
|
|
3
3
|
* Wraps the existing `memories/` module as a `MemoryBackend`.
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
5
|
+
* The local pipeline owns rollout summarisation, SQLite retention, and
|
|
6
|
+
* `memory_summary.md`. Prompt reads use the live session cwd when available so
|
|
7
|
+
* manual enqueue/rebuild and startup hydration address the same memory root.
|
|
8
8
|
*/
|
|
9
9
|
export declare const localBackend: MemoryBackend;
|
|
@@ -14,6 +14,13 @@ export interface HookSelectorOptions {
|
|
|
14
14
|
onRight?: () => void;
|
|
15
15
|
onExternalEditor?: () => void;
|
|
16
16
|
helpText?: string;
|
|
17
|
+
/**
|
|
18
|
+
* When true, the focused option's label wraps across multiple rows so the
|
|
19
|
+
* full text is visible. Non-focused options remain single-row with the
|
|
20
|
+
* existing `…` truncation hint. When unset/false, rendering is
|
|
21
|
+
* byte-identical to the previous implementation for all consumers.
|
|
22
|
+
*/
|
|
23
|
+
wrapFocused?: boolean;
|
|
17
24
|
}
|
|
18
25
|
export declare class HookSelectorComponent extends Container {
|
|
19
26
|
#private;
|
|
@@ -29,8 +29,6 @@ export interface StatusLinePreviewSettings {
|
|
|
29
29
|
export interface SettingsCallbacks {
|
|
30
30
|
/** Called when any setting value changes */
|
|
31
31
|
onChange: (path: SettingPath, newValue: unknown) => void;
|
|
32
|
-
/** Called for theme preview while browsing */
|
|
33
|
-
onThemePreview?: (theme: string) => void | Promise<void>;
|
|
34
32
|
/** Called for status line preview while configuring */
|
|
35
33
|
onStatusLinePreview?: (settings: StatusLinePreviewSettings) => void;
|
|
36
34
|
/** Get current rendered status line for inline preview */
|
|
@@ -44,9 +44,6 @@ export declare class StatusLineComponent implements Component {
|
|
|
44
44
|
enabled: boolean;
|
|
45
45
|
paused: boolean;
|
|
46
46
|
} | undefined): void;
|
|
47
|
-
setLoopModeStatus(status: {
|
|
48
|
-
enabled: boolean;
|
|
49
|
-
} | undefined): void;
|
|
50
47
|
setGoalModeStatus(status: {
|
|
51
48
|
enabled: boolean;
|
|
52
49
|
paused: boolean;
|
|
@@ -32,5 +32,6 @@ export declare class CommandController {
|
|
|
32
32
|
handleSkillCommand(skillPath: string, args: string): Promise<void>;
|
|
33
33
|
executeCompaction(customInstructionsOrOptions?: string | CompactOptions, isAuto?: boolean): Promise<CompactionOutcome>;
|
|
34
34
|
handleHandoffCommand(customInstructions?: string): Promise<void>;
|
|
35
|
+
handleContributionPrepCommand(customInstructions?: string): Promise<void>;
|
|
35
36
|
}
|
|
36
37
|
export declare function renderProviderSection(details: ProviderDetails, uiTheme: Pick<typeof theme, "fg">): string;
|
|
@@ -23,7 +23,6 @@ import type { HookInputComponent } from "./components/hook-input";
|
|
|
23
23
|
import type { HookSelectorComponent } from "./components/hook-selector";
|
|
24
24
|
import { StatusLineComponent } from "./components/status-line";
|
|
25
25
|
import type { ToolExecutionHandle } from "./components/tool-execution";
|
|
26
|
-
import { type LoopLimitRuntime } from "./loop-limit";
|
|
27
26
|
import { OAuthManualInputManager } from "./oauth-manual-input";
|
|
28
27
|
import type { Theme } from "./theme/theme";
|
|
29
28
|
import type { CompactionQueuedMessage, InteractiveModeContext, SubmittedUserInput, TodoItem, TodoPhase } from "./types";
|
|
@@ -69,9 +68,6 @@ export declare class InteractiveMode implements InteractiveModeContext {
|
|
|
69
68
|
goalModeEnabled: boolean;
|
|
70
69
|
goalModePaused: boolean;
|
|
71
70
|
planModePlanFilePath: string | undefined;
|
|
72
|
-
loopModeEnabled: boolean;
|
|
73
|
-
loopPrompt: string | undefined;
|
|
74
|
-
loopLimit: LoopLimitRuntime | undefined;
|
|
75
71
|
todoPhases: TodoPhase[];
|
|
76
72
|
hideThinkingBlock: boolean;
|
|
77
73
|
pendingImages: ImageContent[];
|
|
@@ -111,14 +107,6 @@ export declare class InteractiveMode implements InteractiveModeContext {
|
|
|
111
107
|
/** Reload slash commands and autocomplete for the provided working directory. */
|
|
112
108
|
refreshSlashCommandState(cwd?: string): Promise<void>;
|
|
113
109
|
getUserInput(): Promise<SubmittedUserInput>;
|
|
114
|
-
disableLoopMode(message?: string): void;
|
|
115
|
-
/**
|
|
116
|
-
* Pause the loop without exiting it: drops the captured prompt and any
|
|
117
|
-
* pending auto-resubmit. Loop mode stays enabled — the next prompt the
|
|
118
|
-
* user submits becomes the new loop prompt and resumes iteration.
|
|
119
|
-
*/
|
|
120
|
-
pauseLoop(): void;
|
|
121
|
-
handleLoopCommand(args?: string): Promise<void>;
|
|
122
110
|
recordLocalSubmission(text: string, imageCount?: number): () => void;
|
|
123
111
|
withLocalSubmission<T>(text: string, fn: () => Promise<T>, options?: {
|
|
124
112
|
imageCount?: number;
|
|
@@ -208,6 +196,7 @@ export declare class InteractiveMode implements InteractiveModeContext {
|
|
|
208
196
|
handleSSHCommand(text: string): Promise<void>;
|
|
209
197
|
handleCompactCommand(customInstructions?: string): Promise<CompactionOutcome>;
|
|
210
198
|
handleHandoffCommand(customInstructions?: string): Promise<void>;
|
|
199
|
+
handleContributionPrepCommand(customInstructions?: string): Promise<void>;
|
|
211
200
|
executeCompaction(customInstructionsOrOptions?: string | CompactOptions, isAuto?: boolean): Promise<CompactionOutcome>;
|
|
212
201
|
openInBrowser(urlOrPath: string): void;
|
|
213
202
|
showSettingsSelector(): void;
|
|
@@ -2921,7 +2921,6 @@ export declare const defaultThemes: {
|
|
|
2921
2921
|
"icon.plan": string;
|
|
2922
2922
|
"icon.goal": string;
|
|
2923
2923
|
"icon.pause": string;
|
|
2924
|
-
"icon.loop": string;
|
|
2925
2924
|
"icon.folder": string;
|
|
2926
2925
|
"icon.scratchFolder": string;
|
|
2927
2926
|
"icon.pi": string;
|
|
@@ -7439,7 +7438,6 @@ export declare const defaultThemes: {
|
|
|
7439
7438
|
"icon.plan": string;
|
|
7440
7439
|
"icon.goal": string;
|
|
7441
7440
|
"icon.pause": string;
|
|
7442
|
-
"icon.loop": string;
|
|
7443
7441
|
"icon.folder": string;
|
|
7444
7442
|
"icon.scratchFolder": string;
|
|
7445
7443
|
"icon.pi": string;
|
|
@@ -6,7 +6,7 @@ export type SymbolPreset = "unicode" | "nerd" | "ascii";
|
|
|
6
6
|
/**
|
|
7
7
|
* All available symbol keys organized by category.
|
|
8
8
|
*/
|
|
9
|
-
export type SymbolKey = "status.success" | "status.error" | "status.warning" | "status.info" | "status.pending" | "status.disabled" | "status.enabled" | "status.running" | "status.shadowed" | "status.aborted" | "nav.cursor" | "nav.selected" | "nav.expand" | "nav.collapse" | "nav.back" | "tree.branch" | "tree.last" | "tree.vertical" | "tree.horizontal" | "tree.hook" | "boxRound.topLeft" | "boxRound.topRight" | "boxRound.bottomLeft" | "boxRound.bottomRight" | "boxRound.horizontal" | "boxRound.vertical" | "boxSharp.topLeft" | "boxSharp.topRight" | "boxSharp.bottomLeft" | "boxSharp.bottomRight" | "boxSharp.horizontal" | "boxSharp.vertical" | "boxSharp.cross" | "boxSharp.teeDown" | "boxSharp.teeUp" | "boxSharp.teeRight" | "boxSharp.teeLeft" | "sep.powerline" | "sep.powerlineThin" | "sep.powerlineLeft" | "sep.powerlineRight" | "sep.powerlineThinLeft" | "sep.powerlineThinRight" | "sep.block" | "sep.space" | "sep.asciiLeft" | "sep.asciiRight" | "sep.dot" | "sep.slash" | "sep.pipe" | "icon.model" | "icon.plan" | "icon.goal" | "icon.pause" | "icon.
|
|
9
|
+
export type SymbolKey = "status.success" | "status.error" | "status.warning" | "status.info" | "status.pending" | "status.disabled" | "status.enabled" | "status.running" | "status.shadowed" | "status.aborted" | "nav.cursor" | "nav.selected" | "nav.expand" | "nav.collapse" | "nav.back" | "tree.branch" | "tree.last" | "tree.vertical" | "tree.horizontal" | "tree.hook" | "boxRound.topLeft" | "boxRound.topRight" | "boxRound.bottomLeft" | "boxRound.bottomRight" | "boxRound.horizontal" | "boxRound.vertical" | "boxSharp.topLeft" | "boxSharp.topRight" | "boxSharp.bottomLeft" | "boxSharp.bottomRight" | "boxSharp.horizontal" | "boxSharp.vertical" | "boxSharp.cross" | "boxSharp.teeDown" | "boxSharp.teeUp" | "boxSharp.teeRight" | "boxSharp.teeLeft" | "sep.powerline" | "sep.powerlineThin" | "sep.powerlineLeft" | "sep.powerlineRight" | "sep.powerlineThinLeft" | "sep.powerlineThinRight" | "sep.block" | "sep.space" | "sep.asciiLeft" | "sep.asciiRight" | "sep.dot" | "sep.slash" | "sep.pipe" | "icon.model" | "icon.plan" | "icon.goal" | "icon.pause" | "icon.folder" | "icon.scratchFolder" | "icon.file" | "icon.git" | "icon.branch" | "icon.pr" | "icon.tokens" | "icon.context" | "icon.cost" | "icon.time" | "icon.pi" | "icon.agents" | "icon.cache" | "icon.input" | "icon.output" | "icon.host" | "icon.session" | "icon.package" | "icon.warning" | "icon.rewind" | "icon.auto" | "icon.fast" | "icon.extensionSkill" | "icon.extensionTool" | "icon.extensionSlashCommand" | "icon.extensionMcp" | "icon.extensionRule" | "icon.extensionHook" | "icon.extensionPrompt" | "icon.extensionContextFile" | "icon.extensionInstruction" | "icon.mic" | "thinking.minimal" | "thinking.low" | "thinking.medium" | "thinking.high" | "thinking.xhigh" | "checkbox.checked" | "checkbox.unchecked" | "format.bullet" | "format.dash" | "format.bracketLeft" | "format.bracketRight" | "md.quoteBorder" | "md.hrChar" | "md.bullet" | "lang.default" | "lang.typescript" | "lang.javascript" | "lang.python" | "lang.rust" | "lang.go" | "lang.java" | "lang.c" | "lang.cpp" | "lang.csharp" | "lang.ruby" | "lang.php" | "lang.swift" | "lang.kotlin" | "lang.shell" | "lang.html" | "lang.css" | "lang.json" | "lang.yaml" | "lang.markdown" | "lang.sql" | "lang.docker" | "lang.lua" | "lang.text" | "lang.env" | "lang.toml" | "lang.xml" | "lang.ini" | "lang.conf" | "lang.log" | "lang.csv" | "lang.tsv" | "lang.image" | "lang.pdf" | "lang.archive" | "lang.binary" | "tab.appearance" | "tab.model" | "tab.interaction" | "tab.context" | "tab.editing" | "tab.tools" | "tab.memory" | "tab.tasks" | "tab.providers";
|
|
10
10
|
export type SpinnerType = "status" | "activity";
|
|
11
11
|
export type ThemeColor = "accent" | "border" | "borderAccent" | "borderMuted" | "success" | "error" | "warning" | "muted" | "dim" | "text" | "thinkingText" | "userMessageText" | "customMessageText" | "customMessageLabel" | "toolTitle" | "toolOutput" | "mdHeading" | "mdLink" | "mdLinkUrl" | "mdCode" | "mdCodeBlock" | "mdCodeBlockBorder" | "mdQuote" | "mdQuoteBorder" | "mdHr" | "mdListBullet" | "toolDiffAdded" | "toolDiffRemoved" | "toolDiffContext" | "syntaxComment" | "syntaxKeyword" | "syntaxFunction" | "syntaxVariable" | "syntaxString" | "syntaxNumber" | "syntaxType" | "syntaxOperator" | "syntaxPunctuation" | "thinkingOff" | "thinkingMinimal" | "thinkingLow" | "thinkingMedium" | "thinkingHigh" | "thinkingXhigh" | "bashMode" | "pythonMode" | "statusLineSep" | "statusLineModel" | "statusLinePath" | "statusLineGitClean" | "statusLineGitDirty" | "statusLineContext" | "statusLineSpend" | "statusLineStaged" | "statusLineDirty" | "statusLineUntracked" | "statusLineOutput" | "statusLineCost" | "statusLineSubagents";
|
|
12
12
|
/** Check if a string is a valid ThemeColor value */
|
|
@@ -110,7 +110,6 @@ export declare class Theme {
|
|
|
110
110
|
plan: string;
|
|
111
111
|
goal: string;
|
|
112
112
|
pause: string;
|
|
113
|
-
loop: string;
|
|
114
113
|
folder: string;
|
|
115
114
|
scratchFolder: string;
|
|
116
115
|
file: string;
|
|
@@ -22,7 +22,6 @@ import type { HookInputComponent } from "./components/hook-input";
|
|
|
22
22
|
import type { HookSelectorComponent } from "./components/hook-selector";
|
|
23
23
|
import type { StatusLineComponent } from "./components/status-line";
|
|
24
24
|
import type { ToolExecutionHandle } from "./components/tool-execution";
|
|
25
|
-
import type { LoopLimitRuntime } from "./loop-limit";
|
|
26
25
|
import type { OAuthManualInputManager } from "./oauth-manual-input";
|
|
27
26
|
import type { Theme } from "./theme/theme";
|
|
28
27
|
export type CompactionQueuedMessage = {
|
|
@@ -76,9 +75,6 @@ export interface InteractiveModeContext {
|
|
|
76
75
|
planModeEnabled: boolean;
|
|
77
76
|
goalModeEnabled: boolean;
|
|
78
77
|
goalModePaused: boolean;
|
|
79
|
-
loopModeEnabled: boolean;
|
|
80
|
-
loopPrompt?: string;
|
|
81
|
-
loopLimit?: LoopLimitRuntime;
|
|
82
78
|
planModePlanFilePath?: string;
|
|
83
79
|
hideThinkingBlock: boolean;
|
|
84
80
|
pendingImages: ImageContent[];
|
|
@@ -203,6 +199,7 @@ export interface InteractiveModeContext {
|
|
|
203
199
|
handleSSHCommand(text: string): Promise<void>;
|
|
204
200
|
handleCompactCommand(customInstructions?: string): Promise<CompactionOutcome>;
|
|
205
201
|
handleHandoffCommand(customInstructions?: string): Promise<void>;
|
|
202
|
+
handleContributionPrepCommand(customInstructions?: string): Promise<void>;
|
|
206
203
|
handleMoveCommand(targetPath: string): Promise<void>;
|
|
207
204
|
handleRenameCommand(title: string): Promise<void>;
|
|
208
205
|
handleMemoryCommand(text: string): Promise<void>;
|
|
@@ -249,9 +246,6 @@ export interface InteractiveModeContext {
|
|
|
249
246
|
registerExtensionShortcuts(): void;
|
|
250
247
|
handlePlanModeCommand(initialPrompt?: string): Promise<void>;
|
|
251
248
|
handleGoalModeCommand(rest?: string): Promise<void>;
|
|
252
|
-
handleLoopCommand(args?: string): Promise<void>;
|
|
253
|
-
disableLoopMode(): void;
|
|
254
|
-
pauseLoop(): void;
|
|
255
249
|
handlePlanApproval(details: PlanApprovalDetails): Promise<void>;
|
|
256
250
|
initHooksAndCustomTools(): Promise<void>;
|
|
257
251
|
emitCustomToolSessionEvent(reason: "start" | "switch" | "branch" | "tree" | "shutdown", previousSessionFile?: string): Promise<void>;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
import type { AgentMessage } from "@gajae-code/agent-core";
|
|
1
2
|
import type { Model } from "@gajae-code/ai";
|
|
2
3
|
import type { Skill } from "../../extensibility/skills";
|
|
3
4
|
import type { AgentSession } from "../../session/agent-session";
|
|
4
5
|
import type { Tool } from "../../tools";
|
|
5
6
|
import type { theme as Theme } from "../theme/theme";
|
|
6
|
-
type CategoryId = "systemPrompt" | "systemContext" | "
|
|
7
|
+
type CategoryId = "systemPrompt" | "systemContext" | "rules" | "tools" | "skills" | "messages" | "lastUserTurn";
|
|
7
8
|
interface CategoryInfo {
|
|
8
9
|
id: CategoryId;
|
|
9
10
|
label: string;
|
|
@@ -15,6 +16,7 @@ export interface ContextBreakdown {
|
|
|
15
16
|
model: Model | undefined;
|
|
16
17
|
contextWindow: number;
|
|
17
18
|
categories: CategoryInfo[];
|
|
19
|
+
lastUserTurnTokens: number;
|
|
18
20
|
usedTokens: number;
|
|
19
21
|
autoCompactBufferTokens: number;
|
|
20
22
|
freeTokens: number;
|
|
@@ -38,7 +40,9 @@ export declare function computeNonMessageTokens(session: AgentSession): number;
|
|
|
38
40
|
* Compute a breakdown of estimated context usage by category for the active
|
|
39
41
|
* session and model.
|
|
40
42
|
*/
|
|
41
|
-
export declare function computeContextBreakdown(session: AgentSession
|
|
43
|
+
export declare function computeContextBreakdown(session: AgentSession, options?: {
|
|
44
|
+
messages?: readonly AgentMessage[];
|
|
45
|
+
}): ContextBreakdown;
|
|
42
46
|
/**
|
|
43
47
|
* Render a colorful context-usage panel as ANSI text. Output is a series of
|
|
44
48
|
* lines pairing the grid (left) with the legend (right).
|
package/dist/types/sdk.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type AgentTelemetryConfig, type ThinkingLevel } from "@gajae-code/agent-core";
|
|
2
|
-
import { type Model } from "@gajae-code/ai";
|
|
2
|
+
import { type Model, type ProviderSessionState } from "@gajae-code/ai";
|
|
3
3
|
import { type Rule } from "./capability/rule";
|
|
4
4
|
import { ModelRegistry } from "./config/model-registry";
|
|
5
5
|
import { type ScopedModelSelection } from "./config/model-resolver";
|
|
@@ -15,7 +15,7 @@ import type { HindsightSessionState } from "./hindsight/state";
|
|
|
15
15
|
import { type LocalProtocolOptions } from "./internal-urls";
|
|
16
16
|
import { AgentRegistry } from "./registry/agent-registry";
|
|
17
17
|
import { MCPManager } from "./runtime-mcp";
|
|
18
|
-
import { AgentSession } from "./session/agent-session";
|
|
18
|
+
import { AgentSession, type ForkContextSeed } from "./session/agent-session";
|
|
19
19
|
import { AuthStorage } from "./session/auth-storage";
|
|
20
20
|
import { SessionManager } from "./session/session-manager";
|
|
21
21
|
import { type BuildSystemPromptResult } from "./system-prompt";
|
|
@@ -121,6 +121,10 @@ export interface CreateAgentSessionOptions {
|
|
|
121
121
|
* `@opentelemetry/api` package returns a no-op tracer in that case.
|
|
122
122
|
*/
|
|
123
123
|
telemetry?: AgentTelemetryConfig;
|
|
124
|
+
/** Optional fork-context seed used to initialize a child session before its first prompt. */
|
|
125
|
+
forkContextSeed?: ForkContextSeed;
|
|
126
|
+
/** Optional provider state override. Fork-context children should omit this by default. */
|
|
127
|
+
providerSessionState?: Map<string, ProviderSessionState>;
|
|
124
128
|
}
|
|
125
129
|
/** Result from createAgentSession */
|
|
126
130
|
export interface CreateAgentSessionResult {
|
|
@@ -12,9 +12,32 @@
|
|
|
12
12
|
*
|
|
13
13
|
* Modes use this class and add their own I/O layer on top.
|
|
14
14
|
*/
|
|
15
|
-
import { type Agent, type AgentEvent, type AgentMessage, type AgentState, type AgentTool, ThinkingLevel } from "@gajae-code/agent-core";
|
|
15
|
+
import { type Agent, type AgentEvent, type AgentMessage, type AgentState, type AgentTool, type StablePrefixSnapshot, ThinkingLevel } from "@gajae-code/agent-core";
|
|
16
16
|
import { type CompactionResult } from "@gajae-code/agent-core/compaction";
|
|
17
17
|
import type { AssistantMessage, Effort, ImageContent, Message, MessageAttribution, Model, ProviderSessionState, ServiceTier, SimpleStreamOptions, TextContent, ToolChoice, UsageReport } from "@gajae-code/ai";
|
|
18
|
+
export interface ForkContextSeedMetadata {
|
|
19
|
+
sourceSessionId: string;
|
|
20
|
+
parentMessageCount: number;
|
|
21
|
+
includedMessages: number;
|
|
22
|
+
skippedMessages: number;
|
|
23
|
+
approximateTokens: number;
|
|
24
|
+
maxMessages: number;
|
|
25
|
+
maxTokens: number;
|
|
26
|
+
skippedReasons: Record<string, number>;
|
|
27
|
+
}
|
|
28
|
+
export interface ForkContextSeed {
|
|
29
|
+
messages: Message[];
|
|
30
|
+
agentMessages: AgentMessage[];
|
|
31
|
+
metadata: ForkContextSeedMetadata;
|
|
32
|
+
cacheIdentity?: string;
|
|
33
|
+
appendOnlyPrefixSnapshot?: StablePrefixSnapshot;
|
|
34
|
+
}
|
|
35
|
+
export interface ForkContextSeedOptions {
|
|
36
|
+
maxMessages: number;
|
|
37
|
+
maxTokens: number;
|
|
38
|
+
cacheIdentity?: string;
|
|
39
|
+
signal?: AbortSignal;
|
|
40
|
+
}
|
|
18
41
|
import { type AsyncJob, type AsyncJobDeliveryState, AsyncJobManager } from "../async";
|
|
19
42
|
import type { Rule } from "../capability/rule";
|
|
20
43
|
import { type ModelRegistry } from "../config/model-registry";
|
|
@@ -42,6 +65,7 @@ import { type DiscoverableTool, type DiscoverableToolSearchIndex } from "../tool
|
|
|
42
65
|
import type { CheckpointState } from "../tools/checkpoint";
|
|
43
66
|
import { type TodoItem, type TodoPhase } from "../tools/todo-write";
|
|
44
67
|
import type { ClientBridge } from "./client-bridge";
|
|
68
|
+
import { type ContributionPrepOptions, type ContributionPrepResult } from "./contribution-prep";
|
|
45
69
|
import { type CustomMessage } from "./messages";
|
|
46
70
|
import type { BranchSummaryEntry, NewSessionOptions, SessionContext, SessionManager } from "./session-manager";
|
|
47
71
|
import { ToolChoiceQueue } from "./tool-choice-queue";
|
|
@@ -137,6 +161,8 @@ export interface AgentSessionConfig {
|
|
|
137
161
|
skillsSettings?: SkillsSettings;
|
|
138
162
|
/** Model registry for API key resolution and model discovery */
|
|
139
163
|
modelRegistry: ModelRegistry;
|
|
164
|
+
/** Task recursion depth for nested sessions. Top-level sessions use 0. */
|
|
165
|
+
taskDepth?: number;
|
|
140
166
|
/** Tool registry for LSP and settings */
|
|
141
167
|
toolRegistry?: Map<string, AgentTool>;
|
|
142
168
|
/** Current session pre-LLM message transform pipeline */
|
|
@@ -187,6 +213,10 @@ export interface AgentSessionConfig {
|
|
|
187
213
|
* **MUST NOT** dispose it on their own teardown.
|
|
188
214
|
*/
|
|
189
215
|
ownedAsyncJobManager?: AsyncJobManager;
|
|
216
|
+
/** Optional fork-context seed used to initialize a child session before its first prompt. */
|
|
217
|
+
forkContextSeed?: ForkContextSeed;
|
|
218
|
+
/** Optional provider state override. Fork-context children should omit this by default. */
|
|
219
|
+
providerSessionState?: Map<string, ProviderSessionState>;
|
|
190
220
|
/** Agent identity (registry id like "0-Main" or "3-Alice") used for IRC routing. */
|
|
191
221
|
agentId?: string;
|
|
192
222
|
/** Shared agent registry (for forwarding IRC observations to the main session UI). */
|
|
@@ -198,6 +228,8 @@ export interface AgentSessionConfig {
|
|
|
198
228
|
* so that credential sticky selection is consistent with the session's streaming calls.
|
|
199
229
|
*/
|
|
200
230
|
providerSessionId?: string;
|
|
231
|
+
/** Optional provider-facing cache identity, distinct from logical session identity. */
|
|
232
|
+
providerCacheSessionId?: string;
|
|
201
233
|
}
|
|
202
234
|
/** Options for AgentSession.prompt() */
|
|
203
235
|
export interface PromptOptions {
|
|
@@ -262,6 +294,7 @@ export declare class AgentSession {
|
|
|
262
294
|
readonly agent: Agent;
|
|
263
295
|
readonly sessionManager: SessionManager;
|
|
264
296
|
readonly settings: Settings;
|
|
297
|
+
readonly taskDepth: number;
|
|
265
298
|
readonly yieldQueue: YieldQueue;
|
|
266
299
|
readonly configWarnings: string[];
|
|
267
300
|
readonly rawSseDebugBuffer: RawSseDebugBuffer;
|
|
@@ -278,12 +311,24 @@ export declare class AgentSession {
|
|
|
278
311
|
setForcedToolChoice(toolName: string): void;
|
|
279
312
|
/** The tool-choice queue: forces forthcoming tool invocations and carries handlers. */
|
|
280
313
|
get toolChoiceQueue(): ToolChoiceQueue;
|
|
314
|
+
/** Current skill prompt executing in this session, if any. */
|
|
315
|
+
getActiveSkillState(): {
|
|
316
|
+
skill: string;
|
|
317
|
+
session_id?: string;
|
|
318
|
+
} | undefined;
|
|
319
|
+
/** Best-effort accessor for the active skill's `current_phase` field from
|
|
320
|
+
* its persisted mode-state file. Used by the `skill` tool to enforce the
|
|
321
|
+
* terminal-phase chain guard. Returns undefined when no active skill is
|
|
322
|
+
* recorded or the mode-state file is missing/unreadable; callers should
|
|
323
|
+
* treat undefined as a non-terminal phase (refuses to chain). */
|
|
324
|
+
getActiveSkillPhase(): string | undefined;
|
|
281
325
|
/** Peek the in-flight directive's invocation handler for use by the resolve tool. */
|
|
282
326
|
peekQueueInvoker(): ((input: unknown) => Promise<unknown> | unknown) | undefined;
|
|
283
327
|
peekStandingResolveHandler(): ((input: unknown) => Promise<unknown> | unknown) | undefined;
|
|
284
328
|
setStandingResolveHandler(handler: ((input: unknown) => Promise<unknown> | unknown) | null): void;
|
|
285
329
|
/** Provider-scoped mutable state store for transport/session caches. */
|
|
286
330
|
get providerSessionState(): Map<string, ProviderSessionState>;
|
|
331
|
+
buildForkContextSeed(options: ForkContextSeedOptions): Promise<ForkContextSeed>;
|
|
287
332
|
getHindsightSessionState(): HindsightSessionState | undefined;
|
|
288
333
|
setHindsightSessionState(state: HindsightSessionState | undefined): HindsightSessionState | undefined;
|
|
289
334
|
/** TTSR manager for time-traveling stream rules */
|
|
@@ -696,6 +741,7 @@ export declare class AgentSession {
|
|
|
696
741
|
* @returns The handoff document text, or undefined if cancelled/failed
|
|
697
742
|
*/
|
|
698
743
|
handoff(customInstructions?: string, options?: SessionHandoffOptions): Promise<HandoffResult | undefined>;
|
|
744
|
+
prepareContributionPrep(options?: ContributionPrepOptions): Promise<ContributionPrepResult>;
|
|
699
745
|
/**
|
|
700
746
|
* Toggle auto-compaction setting.
|
|
701
747
|
*/
|