@gajae-code/agent-core 0.11.4 → 0.11.6

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.
@@ -235,6 +235,12 @@ export interface HandoffOptions {
235
235
  /** Live agent tool list — same purpose. Forced to `toolChoice: "none"`. */
236
236
  tools?: AgentTool<any>[];
237
237
  customInstructions?: string;
238
+ /**
239
+ * Optional user-configured extension appended to the base handoff prompt.
240
+ * It SUPPLEMENTS the immutable base (safety/continuity structure); it never
241
+ * replaces `HANDOFF_DOCUMENT_PROMPT`.
242
+ */
243
+ promptExtension?: string;
238
244
  convertToLlm?: ConvertToLlm;
239
245
  initiatorOverride?: MessageAttribution;
240
246
  metadata?: Record<string, unknown>;
@@ -254,7 +260,7 @@ export interface HandoffOptions {
254
260
  /** Hint that websocket transport should be preferred when supported by the provider implementation. */
255
261
  preferWebsockets?: boolean;
256
262
  }
257
- export declare function renderHandoffPrompt(customInstructions?: string): string;
263
+ export declare function renderHandoffPrompt(customInstructions?: string, promptExtension?: string): string;
258
264
  export declare function generateHandoff(messages: AgentMessage[], model: Model, apiKey: string, options: HandoffOptions, signal?: AbortSignal): Promise<string>;
259
265
  export interface CompactionPreparation {
260
266
  /** UUID of first entry to keep */
@@ -82,6 +82,11 @@ export interface MCPToolSelectionEntry extends SessionEntryBase {
82
82
  /** MCP tool names selected for visibility in discovery mode. */
83
83
  selectedToolNames: string[];
84
84
  }
85
+ export interface DiscoveredBuiltinToolSelectionEntry extends SessionEntryBase {
86
+ type: "discovered_builtin_tool_selection";
87
+ /** Discoverable built-in tool names selected for visibility in discovery mode. */
88
+ selectedToolNames: string[];
89
+ }
85
90
  export interface SessionInitEntry extends SessionEntryBase {
86
91
  type: "session_init";
87
92
  /** Full system prompt sent to the model */
@@ -112,7 +117,7 @@ export interface ConfiguredModelChainEntry extends SessionEntryBase {
112
117
  }
113
118
  export interface CustomCompactionSessionEntries {
114
119
  }
115
- export type SessionEntry = SessionMessageEntry | ThinkingLevelChangeEntry | ModelChangeEntry | ServiceTierChangeEntry | CompactionEntry | BranchSummaryEntry | CustomEntry | CustomMessageEntry | LabelEntry | TtsrInjectionEntry | MCPToolSelectionEntry | SessionInitEntry | ModeChangeEntry | ConfiguredModelChainEntry | CustomCompactionSessionEntries[keyof CustomCompactionSessionEntries];
120
+ export type SessionEntry = SessionMessageEntry | ThinkingLevelChangeEntry | ModelChangeEntry | ServiceTierChangeEntry | CompactionEntry | BranchSummaryEntry | CustomEntry | CustomMessageEntry | LabelEntry | TtsrInjectionEntry | MCPToolSelectionEntry | DiscoveredBuiltinToolSelectionEntry | SessionInitEntry | ModeChangeEntry | ConfiguredModelChainEntry | CustomCompactionSessionEntries[keyof CustomCompactionSessionEntries];
116
121
  export interface ReadonlySessionManager {
117
122
  getBranch(leafId?: string | null): SessionEntry[];
118
123
  getEntry(id: string): SessionEntry | undefined;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "type": "module",
3
3
  "name": "@gajae-code/agent-core",
4
- "version": "0.11.4",
4
+ "version": "0.11.6",
5
5
  "description": "General-purpose agent with transport abstraction, state management, and attachment support",
6
6
  "homepage": "https://gajae-code.com",
7
7
  "author": "Yeachan-Heo and Gajae Code Contributors",
@@ -32,9 +32,9 @@
32
32
  "fmt": "biome format --write ."
33
33
  },
34
34
  "dependencies": {
35
- "@gajae-code/ai": "0.11.4",
36
- "@gajae-code/natives": "0.11.4",
37
- "@gajae-code/utils": "0.11.4",
35
+ "@gajae-code/ai": "0.11.6",
36
+ "@gajae-code/natives": "0.11.6",
37
+ "@gajae-code/utils": "0.11.6",
38
38
  "@opentelemetry/api": "^1.9.0"
39
39
  },
40
40
  "devDependencies": {
@@ -973,6 +973,12 @@ export interface HandoffOptions {
973
973
  /** Live agent tool list — same purpose. Forced to `toolChoice: "none"`. */
974
974
  tools?: AgentTool<any>[];
975
975
  customInstructions?: string;
976
+ /**
977
+ * Optional user-configured extension appended to the base handoff prompt.
978
+ * It SUPPLEMENTS the immutable base (safety/continuity structure); it never
979
+ * replaces `HANDOFF_DOCUMENT_PROMPT`.
980
+ */
981
+ promptExtension?: string;
976
982
  convertToLlm?: ConvertToLlm;
977
983
  initiatorOverride?: MessageAttribution;
978
984
  metadata?: Record<string, unknown>;
@@ -993,10 +999,11 @@ export interface HandoffOptions {
993
999
  preferWebsockets?: boolean;
994
1000
  }
995
1001
 
996
- export function renderHandoffPrompt(customInstructions?: string): string {
997
- if (!customInstructions) return HANDOFF_DOCUMENT_PROMPT;
1002
+ export function renderHandoffPrompt(customInstructions?: string, promptExtension?: string): string {
1003
+ if (!customInstructions && !promptExtension) return HANDOFF_DOCUMENT_PROMPT;
998
1004
  return prompt.render(handoffDocumentPrompt, {
999
1005
  additionalFocus: customInstructions,
1006
+ promptExtension,
1000
1007
  });
1001
1008
  }
1002
1009
 
@@ -1012,7 +1019,7 @@ export async function generateHandoff(
1012
1019
  ...llmMessages,
1013
1020
  {
1014
1021
  role: "user",
1015
- content: [{ type: "text", text: renderHandoffPrompt(options.customInstructions) }],
1022
+ content: [{ type: "text", text: renderHandoffPrompt(options.customInstructions, options.promptExtension) }],
1016
1023
  attribution: "agent",
1017
1024
  timestamp: Date.now(),
1018
1025
  },
@@ -95,6 +95,12 @@ export interface MCPToolSelectionEntry extends SessionEntryBase {
95
95
  selectedToolNames: string[];
96
96
  }
97
97
 
98
+ export interface DiscoveredBuiltinToolSelectionEntry extends SessionEntryBase {
99
+ type: "discovered_builtin_tool_selection";
100
+ /** Discoverable built-in tool names selected for visibility in discovery mode. */
101
+ selectedToolNames: string[];
102
+ }
103
+
98
104
  export interface SessionInitEntry extends SessionEntryBase {
99
105
  type: "session_init";
100
106
  /** Full system prompt sent to the model */
@@ -140,6 +146,7 @@ export type SessionEntry =
140
146
  | LabelEntry
141
147
  | TtsrInjectionEntry
142
148
  | MCPToolSelectionEntry
149
+ | DiscoveredBuiltinToolSelectionEntry
143
150
  | SessionInitEntry
144
151
  | ModeChangeEntry
145
152
  | ConfiguredModelChainEntry
@@ -42,6 +42,13 @@ Use exactly this structure:
42
42
  1. [What should happen next]
43
43
  </output>
44
44
 
45
+ {{#if promptExtension}}
46
+ <instruction>
47
+ Additional handoff guidance (supplements — does not replace — the required structure and critical rules above):
48
+ {{promptExtension}}
49
+ </instruction>
50
+ {{/if}}
51
+
45
52
  {{#if additionalFocus}}
46
53
  <instruction>
47
54
  Additional focus: {{additionalFocus}}