@gajae-code/coding-agent 0.7.3 → 0.7.4

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.
Files changed (117) hide show
  1. package/CHANGELOG.md +48 -0
  2. package/bin/gjc.js +4 -0
  3. package/dist/types/cli/plugin-cli.d.ts +2 -0
  4. package/dist/types/commands/plugin.d.ts +6 -0
  5. package/dist/types/commands/session.d.ts +6 -0
  6. package/dist/types/config/model-profile-activation.d.ts +8 -1
  7. package/dist/types/extensibility/gjc-plugins/compiler.d.ts +19 -0
  8. package/dist/types/extensibility/gjc-plugins/constrained-hooks.d.ts +29 -0
  9. package/dist/types/extensibility/gjc-plugins/index.d.ts +9 -0
  10. package/dist/types/extensibility/gjc-plugins/injection.d.ts +9 -0
  11. package/dist/types/extensibility/gjc-plugins/installer.d.ts +13 -0
  12. package/dist/types/extensibility/gjc-plugins/mcp-policy.d.ts +26 -0
  13. package/dist/types/extensibility/gjc-plugins/observability.d.ts +27 -0
  14. package/dist/types/extensibility/gjc-plugins/prompt-appendix.d.ts +16 -0
  15. package/dist/types/extensibility/gjc-plugins/registry.d.ts +32 -0
  16. package/dist/types/extensibility/gjc-plugins/runtime-adapters.d.ts +64 -0
  17. package/dist/types/extensibility/gjc-plugins/session-validation.d.ts +42 -0
  18. package/dist/types/extensibility/gjc-plugins/types.d.ts +158 -2
  19. package/dist/types/extensibility/gjc-plugins/validation.d.ts +8 -1
  20. package/dist/types/gjc-runtime/launch-tmux.d.ts +1 -0
  21. package/dist/types/gjc-runtime/psmux-detect.d.ts +78 -0
  22. package/dist/types/gjc-runtime/team-runtime.d.ts +2 -0
  23. package/dist/types/gjc-runtime/tmux-common.d.ts +20 -1
  24. package/dist/types/gjc-runtime/tmux-sessions.d.ts +18 -0
  25. package/dist/types/main.d.ts +2 -0
  26. package/dist/types/modes/components/model-selector.d.ts +6 -0
  27. package/dist/types/notifications/html-format.d.ts +11 -0
  28. package/dist/types/notifications/index.d.ts +149 -1
  29. package/dist/types/notifications/lifecycle-commands.d.ts +72 -0
  30. package/dist/types/notifications/lifecycle-control-runtime.d.ts +98 -0
  31. package/dist/types/notifications/lifecycle-orchestrator.d.ts +144 -0
  32. package/dist/types/notifications/rate-limit-pool.d.ts +2 -0
  33. package/dist/types/notifications/recent-activity.d.ts +35 -0
  34. package/dist/types/notifications/telegram-daemon.d.ts +60 -0
  35. package/dist/types/notifications/telegram-reference.d.ts +3 -1
  36. package/dist/types/notifications/topic-registry.d.ts +10 -9
  37. package/dist/types/runtime-mcp/types.d.ts +7 -0
  38. package/dist/types/sdk.d.ts +2 -0
  39. package/dist/types/session/agent-session.d.ts +14 -4
  40. package/dist/types/session/blob-store.d.ts +25 -0
  41. package/dist/types/session/session-manager.d.ts +57 -0
  42. package/dist/types/slash-commands/helpers/fast-status-report.d.ts +6 -0
  43. package/dist/types/system-prompt.d.ts +2 -0
  44. package/dist/types/task/executor.d.ts +9 -1
  45. package/dist/types/tools/index.d.ts +3 -1
  46. package/dist/types/utils/changelog.d.ts +1 -0
  47. package/package.json +11 -9
  48. package/scripts/g004-tmux-smoke.ts +100 -0
  49. package/scripts/g005-daemon-smoke.ts +181 -0
  50. package/scripts/g011-daemon-path-smoke.ts +153 -0
  51. package/src/cli/plugin-cli.ts +66 -3
  52. package/src/cli.ts +21 -4
  53. package/src/commands/plugin.ts +4 -0
  54. package/src/commands/session.ts +18 -0
  55. package/src/config/model-profile-activation.ts +55 -7
  56. package/src/defaults/gjc/extensions/grok-cli-vendor/biome.json +1 -1
  57. package/src/defaults/gjc/skills/deep-interview/SKILL.md +3 -3
  58. package/src/defaults/gjc/skills/team/SKILL.md +5 -4
  59. package/src/defaults/gjc/skills/ultragoal/SKILL.md +41 -13
  60. package/src/export/html/index.ts +2 -2
  61. package/src/extensibility/gjc-plugins/compiler.ts +351 -0
  62. package/src/extensibility/gjc-plugins/constrained-hooks.ts +170 -0
  63. package/src/extensibility/gjc-plugins/index.ts +9 -0
  64. package/src/extensibility/gjc-plugins/injection.ts +109 -0
  65. package/src/extensibility/gjc-plugins/installer.ts +434 -0
  66. package/src/extensibility/gjc-plugins/loader.ts +3 -1
  67. package/src/extensibility/gjc-plugins/mcp-policy.ts +239 -0
  68. package/src/extensibility/gjc-plugins/observability.ts +84 -0
  69. package/src/extensibility/gjc-plugins/paths.ts +1 -1
  70. package/src/extensibility/gjc-plugins/prompt-appendix.ts +109 -0
  71. package/src/extensibility/gjc-plugins/registry.ts +180 -0
  72. package/src/extensibility/gjc-plugins/runtime-adapters.ts +234 -0
  73. package/src/extensibility/gjc-plugins/schema.ts +250 -20
  74. package/src/extensibility/gjc-plugins/session-validation.ts +147 -0
  75. package/src/extensibility/gjc-plugins/types.ts +199 -3
  76. package/src/extensibility/gjc-plugins/validation.ts +80 -0
  77. package/src/extensibility/skills.ts +15 -0
  78. package/src/gjc-runtime/launch-tmux.ts +61 -7
  79. package/src/gjc-runtime/psmux-detect.ts +239 -0
  80. package/src/gjc-runtime/team-runtime.ts +56 -23
  81. package/src/gjc-runtime/tmux-common.ts +27 -2
  82. package/src/gjc-runtime/tmux-sessions.ts +51 -1
  83. package/src/gjc-runtime/ultragoal-runtime.ts +75 -15
  84. package/src/internal-urls/docs-index.generated.ts +5 -4
  85. package/src/main.ts +14 -3
  86. package/src/modes/components/hook-editor.ts +1 -1
  87. package/src/modes/components/hook-selector.ts +67 -43
  88. package/src/modes/components/model-selector.ts +44 -11
  89. package/src/modes/controllers/extension-ui-controller.ts +0 -27
  90. package/src/modes/controllers/selector-controller.ts +50 -11
  91. package/src/modes/interactive-mode.ts +2 -0
  92. package/src/modes/utils/hotkeys-markdown.ts +1 -1
  93. package/src/notifications/html-format.ts +38 -0
  94. package/src/notifications/index.ts +242 -12
  95. package/src/notifications/lifecycle-commands.ts +228 -0
  96. package/src/notifications/lifecycle-control-runtime.ts +400 -0
  97. package/src/notifications/lifecycle-orchestrator.ts +358 -0
  98. package/src/notifications/rate-limit-pool.ts +19 -0
  99. package/src/notifications/recent-activity.ts +132 -0
  100. package/src/notifications/telegram-daemon.ts +433 -8
  101. package/src/notifications/telegram-reference.ts +25 -7
  102. package/src/notifications/topic-registry.ts +18 -9
  103. package/src/prompts/agents/executor.md +2 -2
  104. package/src/runtime-mcp/transports/stdio.ts +38 -4
  105. package/src/runtime-mcp/types.ts +7 -0
  106. package/src/sdk.ts +157 -10
  107. package/src/session/agent-session.ts +166 -74
  108. package/src/session/blob-store.ts +196 -8
  109. package/src/session/session-manager.ts +678 -7
  110. package/src/slash-commands/builtin-registry.ts +23 -3
  111. package/src/slash-commands/helpers/fast-status-report.ts +13 -3
  112. package/src/system-prompt.ts +9 -0
  113. package/src/task/executor.ts +31 -7
  114. package/src/task/index.ts +2 -0
  115. package/src/tools/ask.ts +5 -1
  116. package/src/tools/index.ts +3 -1
  117. package/src/utils/changelog.ts +8 -0
@@ -6,6 +6,7 @@ import { getOAuthProviders } from "@gajae-code/ai/utils/oauth";
6
6
  import { Spacer, Text } from "@gajae-code/tui";
7
7
  import { setProjectDir } from "@gajae-code/utils";
8
8
  import { jobElapsedMs } from "../async";
9
+ import { materializeActiveModelProfileAssignment } from "../config/model-profile-activation";
9
10
  import {
10
11
  GJC_MODEL_ASSIGNMENT_TARGET_IDS,
11
12
  GJC_MODEL_ASSIGNMENT_TARGETS,
@@ -298,6 +299,12 @@ const BUILTIN_SLASH_COMMAND_REGISTRY: ReadonlyArray<SlashCommandSpec> = [
298
299
  selector: selection.selector,
299
300
  thinkingLevel: selection.thinkingLevel,
300
301
  });
302
+ materializeActiveModelProfileAssignment({
303
+ session: runtime.session,
304
+ settings: runtime.settings,
305
+ role: parsedArgs.targetId,
306
+ selector: persistedSelector,
307
+ });
301
308
  if (selection.thinkingLevel) {
302
309
  runtime.session.setThinkingLevel(selection.thinkingLevel);
303
310
  }
@@ -316,10 +323,23 @@ const BUILTIN_SLASH_COMMAND_REGISTRY: ReadonlyArray<SlashCommandSpec> = [
316
323
  selection.thinkingLevel ??
317
324
  extractExplicitThinkingSelector(overrides[parsedArgs.targetId], runtime.settings);
318
325
  const roleSelector = formatModelSelectorValue(selection.selector, thinkingLevel);
319
- runtime.settings.set("task.agentModelOverrides", {
320
- ...overrides,
321
- [parsedArgs.targetId]: roleSelector,
326
+ const materializedProfile = materializeActiveModelProfileAssignment({
327
+ session: runtime.session,
328
+ settings: runtime.settings,
329
+ role: parsedArgs.targetId,
330
+ selector: roleSelector,
322
331
  });
332
+ if (!materializedProfile) {
333
+ const target = GJC_MODEL_ASSIGNMENT_TARGETS[parsedArgs.targetId];
334
+ if (target.settingsPath === "modelRoles") {
335
+ runtime.settings.setModelRole(parsedArgs.targetId, roleSelector);
336
+ } else {
337
+ runtime.settings.set("task.agentModelOverrides", {
338
+ ...overrides,
339
+ [parsedArgs.targetId]: roleSelector,
340
+ });
341
+ }
342
+ }
323
343
  runtime.settings.getStorage()?.recordModelUsage(`${selection.model.provider}/${selection.model.id}`);
324
344
  await runtime.output(`${parsedArgs.targetId} agent model set to ${roleSelector}.`);
325
345
  }
@@ -56,6 +56,12 @@ export interface FastStatusSessionLike {
56
56
  readonly model?: Model;
57
57
  /** Fast predicate against the main session tier (current model + `modelRoles`). */
58
58
  isFastForProvider(provider?: string): boolean;
59
+ /**
60
+ * Current-model EFFECTIVE fast state (intent minus any provider auto-disable).
61
+ * Used for the current-model row so it matches what the next request does.
62
+ * Optional so lightweight fakes can omit it; falls back to `isFastForProvider`.
63
+ */
64
+ isFastModeActive?(): boolean;
59
65
  /** Fast predicate against the effective subagent tier (`task.agentModelOverrides` roles). */
60
66
  isFastForSubagentProvider(provider?: string): boolean;
61
67
  resolveRoleModelWithThinking(role: string): { model?: Model };
@@ -95,9 +101,13 @@ export interface BuildFastStatusReportArgs {
95
101
  */
96
102
  export function buildFastStatusReport(args: BuildFastStatusReportArgs): string {
97
103
  const { session, roleTargets, iconFast, formatInactive } = args;
98
- const rows: FastStatusRow[] = [
99
- { label: "현재 모델", model: session.model, fast: session.isFastForProvider(session.model?.provider) },
100
- ];
104
+ // Current-model row uses the EFFECTIVE predicate (intent minus any provider
105
+ // auto-disable) so it matches the next request; `modelRoles` rows below stay
106
+ // on pure intent. Fall back to intent when a fake omits `isFastModeActive`.
107
+ const currentFast = session.isFastModeActive
108
+ ? session.isFastModeActive()
109
+ : session.isFastForProvider(session.model?.provider);
110
+ const rows: FastStatusRow[] = [{ label: "현재 모델", model: session.model, fast: currentFast }];
101
111
  for (const target of roleTargets) {
102
112
  const resolved = session.resolveRoleModelWithThinking(target.id);
103
113
  if (resolved.model) {
@@ -336,6 +336,8 @@ export interface BuildSystemPromptOptions {
336
336
  toolNames?: string[];
337
337
  /** Text to append to system prompt. */
338
338
  appendSystemPrompt?: string;
339
+ /** Rendered GJC plugin system-appendix blocks (lower-authority, appended last). */
340
+ pluginAppendices?: string;
339
341
  /** Repeat full tool descriptions in system prompt. Default: false */
340
342
  repeatToolDescriptions?: boolean;
341
343
  /** Skills settings for discovery. */
@@ -380,6 +382,7 @@ export async function buildSystemPrompt(options: BuildSystemPromptOptions = {}):
380
382
  customPrompt,
381
383
  tools,
382
384
  appendSystemPrompt,
385
+ pluginAppendices,
383
386
  repeatToolDescriptions = false,
384
387
  skillsSettings,
385
388
  toolNames: providedToolNames,
@@ -579,5 +582,11 @@ export async function buildSystemPrompt(options: BuildSystemPromptOptions = {}):
579
582
  systemPrompt.push(projectPrompt);
580
583
  }
581
584
 
585
+ // Plugin system appendices are appended last as a lower-authority block; they
586
+ // can never override base/project/developer instructions above them.
587
+ if (pluginAppendices?.trim()) {
588
+ systemPrompt.push(pluginAppendices.trim());
589
+ }
590
+
582
591
  return { systemPrompt };
583
592
  }
@@ -9,6 +9,7 @@ import * as fs from "node:fs/promises";
9
9
  import path from "node:path";
10
10
  import type { AgentEvent, AgentIdentity, AgentTelemetryConfig, ThinkingLevel } from "@gajae-code/agent-core";
11
11
  import { recordHandoff, resolveTelemetry } from "@gajae-code/agent-core";
12
+ import type { ServiceTier } from "@gajae-code/ai";
12
13
  import { type JsonSchemaValidationIssue, validateJsonSchemaValue } from "@gajae-code/ai/utils/schema";
13
14
  import { logger, prompt, untilAborted } from "@gajae-code/utils";
14
15
  import { AsyncJobManager } from "../async";
@@ -19,7 +20,7 @@ import { Settings } from "../config/settings";
19
20
  import { SETTINGS_SCHEMA, type SettingPath } from "../config/settings-schema";
20
21
  import { runExtensionCompact, runExtensionSetModel } from "../extensibility/extensions/compact-handler";
21
22
  import { getSessionSlashCommands } from "../extensibility/extensions/get-commands-handler";
22
- import { buildAgentSubskillInjection } from "../extensibility/gjc-plugins";
23
+ import { buildAgentSubskillInjection, renderAgentPromptAdditions } from "../extensibility/gjc-plugins";
23
24
  import { buildSkillPromptMessage, type Skill } from "../extensibility/skills";
24
25
  import type { HindsightSessionState } from "../hindsight/state";
25
26
  import type { LocalProtocolOptions } from "../internal-urls";
@@ -146,6 +147,13 @@ export interface ExecutorOptions {
146
147
  authStorage?: AuthStorage;
147
148
  modelRegistry?: ModelRegistry;
148
149
  settings?: Settings;
150
+ /**
151
+ * Live service-tier intent of the parent session (`AgentSession.serviceTier`),
152
+ * used as the inherited tier when `task.serviceTier === "inherit"`. Passing the
153
+ * live value (not the stale settings snapshot) lets a runtime `/fast on` reach
154
+ * subagents, and a main-model fast-mode auto-disable does not clobber it.
155
+ */
156
+ inheritedServiceTier?: ServiceTier;
149
157
  /** Override local:// protocol options so subagent shares parent's local:// root */
150
158
  localProtocolOptions?: LocalProtocolOptions;
151
159
  /**
@@ -482,15 +490,19 @@ function getUsageTokens(usage: unknown): number {
482
490
  return firstNumberField(record, ["totalTokens", "total_tokens"]) ?? 0;
483
491
  }
484
492
 
485
- export function createSubagentSettings(baseSettings: Settings): Settings {
493
+ export function createSubagentSettings(baseSettings: Settings, inheritedServiceTier?: ServiceTier): Settings {
486
494
  const snapshot: Partial<Record<SettingPath, unknown>> = {};
487
495
  for (const key of Object.keys(SETTINGS_SCHEMA) as SettingPath[]) {
488
496
  snapshot[key] = baseSettings.get(key);
489
497
  }
490
- // Subagent-scoped service-tier override: "inherit" keeps the snapshotted main
491
- // session tier; any explicit value applies only to subagent sessions.
498
+ // Subagent-scoped service-tier override: "inherit" uses the parent session's
499
+ // LIVE intent (so a runtime `/fast on` reaches subagents and a main-model
500
+ // fast-mode auto-disable never clobbers it); any explicit value applies only
501
+ // to subagent sessions and wins over inherited intent.
492
502
  const taskServiceTier = baseSettings.get("task.serviceTier");
493
- if (taskServiceTier !== "inherit") {
503
+ if (taskServiceTier === "inherit") {
504
+ snapshot.serviceTier = inheritedServiceTier ?? "none";
505
+ } else {
494
506
  snapshot.serviceTier = taskServiceTier;
495
507
  }
496
508
  return Settings.isolated({
@@ -571,7 +583,7 @@ export async function runSubprocess(options: ExecutorOptions): Promise<SingleRes
571
583
  }
572
584
 
573
585
  const settings = options.settings ?? Settings.isolated();
574
- const subagentSettings = createSubagentSettings(settings);
586
+ const subagentSettings = createSubagentSettings(settings, options.inheritedServiceTier);
575
587
  const maxRecursionDepth = settings.get("task.maxRecursionDepth") ?? 2;
576
588
  const maxRuntimeMs = Math.max(0, Math.trunc(Number(settings.get("task.maxRuntimeMs") ?? 0) || 0));
577
589
  const parentDepth = options.taskDepth ?? 0;
@@ -1229,6 +1241,13 @@ export async function runSubprocess(options: ExecutorOptions): Promise<SingleRes
1229
1241
  agentName: agent.name,
1230
1242
  });
1231
1243
 
1244
+ let agentPromptAdditions = { appendix: "", advertisement: "" };
1245
+ try {
1246
+ agentPromptAdditions = await renderAgentPromptAdditions({ cwd, agentName: agent.name });
1247
+ } catch (error) {
1248
+ logger.warn("Failed to render GJC plugin agent prompt additions", { error });
1249
+ }
1250
+
1232
1251
  const { session } = await awaitAbortable(
1233
1252
  createAgentSession({
1234
1253
  cwd: worktree ?? cwd,
@@ -1259,7 +1278,12 @@ export async function runSubprocess(options: ExecutorOptions): Promise<SingleRes
1259
1278
  ircSelfId: ircEnabled ? id : "",
1260
1279
  forkContext: forkContextNotice,
1261
1280
  });
1262
- const promptWithSubskills = `${subagentPrompt}${agentSubskillBlock}`;
1281
+ // Order: base agent prompt -> agent appendix -> Tier-1 advertisement -> Tier-2 body.
1282
+ const appendixPart = agentPromptAdditions.appendix ? `\n\n${agentPromptAdditions.appendix}` : "";
1283
+ const advertPart = agentPromptAdditions.advertisement
1284
+ ? `\n\n${agentPromptAdditions.advertisement}`
1285
+ : "";
1286
+ const promptWithSubskills = `${subagentPrompt}${appendixPart}${advertPart}${agentSubskillBlock}`;
1263
1287
  return defaultPrompt.length === 0
1264
1288
  ? [promptWithSubskills]
1265
1289
  : [...defaultPrompt.slice(0, -1), promptWithSubskills, defaultPrompt[defaultPrompt.length - 1]];
package/src/task/index.ts CHANGED
@@ -1311,6 +1311,7 @@ export class TaskTool implements AgentTool<TaskToolSchemaInstance, TaskToolDetai
1311
1311
  authStorage: this.session.authStorage,
1312
1312
  modelRegistry: this.session.modelRegistry,
1313
1313
  settings: this.session.settings,
1314
+ inheritedServiceTier: this.session.serviceTier,
1314
1315
  contextFiles,
1315
1316
  skills: availableSkills,
1316
1317
  autoloadSkills: resolvedAutoloadSkills,
@@ -1372,6 +1373,7 @@ export class TaskTool implements AgentTool<TaskToolSchemaInstance, TaskToolDetai
1372
1373
  authStorage: this.session.authStorage,
1373
1374
  modelRegistry: this.session.modelRegistry,
1374
1375
  settings: this.session.settings,
1376
+ inheritedServiceTier: this.session.serviceTier,
1375
1377
  contextFiles,
1376
1378
  skills: availableSkills,
1377
1379
  autoloadSkills: resolvedAutoloadSkills,
package/src/tools/ask.ts CHANGED
@@ -260,7 +260,11 @@ async function askSingleQuestion(
260
260
  ? "up/down navigate enter select ←/→ question esc cancel"
261
261
  : "up/down navigate enter select esc cancel";
262
262
  const helpText =
263
- scrollTitleRows === undefined ? baseHelpText : `${baseHelpText} wheel/PgUp/PgDn scroll question`;
263
+ scrollTitleRows === undefined
264
+ ? baseHelpText
265
+ : navigation
266
+ ? "↑/↓ select enter ←/→ question esc PgUp/PgDn/Ctrl+u/d: question · Wheel: transcript"
267
+ : "↑/↓ select enter esc PgUp/PgDn/Ctrl+u/d: question · Wheel: transcript";
264
268
  const dialogOptions = {
265
269
  initialIndex,
266
270
  timeout,
@@ -1,5 +1,5 @@
1
1
  import type { AgentTelemetryConfig, AgentTool } from "@gajae-code/agent-core";
2
- import type { Model, ToolChoice } from "@gajae-code/ai";
2
+ import type { Model, ServiceTier, ToolChoice } from "@gajae-code/ai";
3
3
  import { $env, $flag, logger } from "@gajae-code/utils";
4
4
  import type { PromptTemplate } from "../config/prompt-templates";
5
5
  import type { Settings } from "../config/settings";
@@ -222,6 +222,8 @@ export interface ToolSession {
222
222
  agentOutputManager?: AgentOutputManager;
223
223
  /** Settings instance for passing to subagents */
224
224
  settings: Settings;
225
+ /** Live service-tier intent of the parent session, inherited by `inherit` subagents. */
226
+ serviceTier?: ServiceTier;
225
227
  /** Plan mode state (if active) */
226
228
  getPlanModeState?: () => PlanModeState | undefined;
227
229
  /** Goal mode state (if active or paused) */
@@ -92,6 +92,14 @@ export function getDisplayChangelogEntries(): ChangelogEntry[] {
92
92
  return parseChangelogContent(CHANGELOG_TEXT);
93
93
  }
94
94
 
95
+ export function getInstalledVersionChangelogEntry(
96
+ entries: readonly ChangelogEntry[],
97
+ installedVersion: string,
98
+ ): ChangelogEntry | undefined {
99
+ const [major = 0, minor = 0, patch = 0] = installedVersion.split(".").map(Number);
100
+ return entries.find(entry => entry.major === major && entry.minor === minor && entry.patch === patch) ?? entries[0];
101
+ }
102
+
95
103
  /**
96
104
  * Compare versions. Returns: -1 if v1 < v2, 0 if v1 === v2, 1 if v1 > v2
97
105
  */