@agntk/core 0.3.0 → 0.3.2

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 (143) hide show
  1. package/dist/agent-v2.d.ts +48 -0
  2. package/dist/agent-v2.d.ts.map +1 -0
  3. package/dist/agent-v2.js +365 -0
  4. package/dist/agent-v2.js.map +1 -0
  5. package/dist/config/defaults.js +3 -3
  6. package/dist/config/defaults.js.map +1 -1
  7. package/dist/memory/engine.d.ts +130 -0
  8. package/dist/memory/engine.d.ts.map +1 -0
  9. package/dist/memory/engine.js +227 -0
  10. package/dist/memory/engine.js.map +1 -0
  11. package/dist/memory/vectra-store.d.ts +31 -0
  12. package/dist/memory/vectra-store.d.ts.map +1 -0
  13. package/dist/memory/vectra-store.js +122 -0
  14. package/dist/memory/vectra-store.js.map +1 -0
  15. package/dist/models.d.ts +4 -0
  16. package/dist/models.d.ts.map +1 -1
  17. package/dist/models.js +53 -7
  18. package/dist/models.js.map +1 -1
  19. package/dist/pool/index.d.ts +7 -0
  20. package/dist/pool/index.d.ts.map +1 -0
  21. package/dist/pool/index.js +6 -0
  22. package/dist/pool/index.js.map +1 -0
  23. package/dist/pool/specialist-pool.d.ts +59 -0
  24. package/dist/pool/specialist-pool.d.ts.map +1 -0
  25. package/dist/pool/specialist-pool.js +224 -0
  26. package/dist/pool/specialist-pool.js.map +1 -0
  27. package/dist/pool/tools.d.ts +63 -0
  28. package/dist/pool/tools.d.ts.map +1 -0
  29. package/dist/pool/tools.js +83 -0
  30. package/dist/pool/tools.js.map +1 -0
  31. package/dist/pool/types.d.ts +79 -0
  32. package/dist/pool/types.d.ts.map +1 -0
  33. package/dist/pool/types.js +5 -0
  34. package/dist/pool/types.js.map +1 -0
  35. package/dist/presets/index.d.ts +5 -0
  36. package/dist/presets/index.d.ts.map +1 -0
  37. package/dist/presets/index.js +5 -0
  38. package/dist/presets/index.js.map +1 -0
  39. package/dist/presets/role-registry.d.ts +41 -0
  40. package/dist/presets/role-registry.d.ts.map +1 -0
  41. package/dist/presets/role-registry.js +213 -0
  42. package/dist/presets/role-registry.js.map +1 -0
  43. package/dist/presets/roles.d.ts +105 -0
  44. package/dist/presets/roles.d.ts.map +1 -0
  45. package/dist/presets/roles.js +207 -0
  46. package/dist/presets/roles.js.map +1 -0
  47. package/dist/prompts/templates.d.ts +11 -0
  48. package/dist/prompts/templates.d.ts.map +1 -0
  49. package/dist/prompts/templates.js +115 -0
  50. package/dist/prompts/templates.js.map +1 -0
  51. package/dist/provider-resolver.d.ts +4 -0
  52. package/dist/provider-resolver.d.ts.map +1 -1
  53. package/dist/provider-resolver.js +51 -15
  54. package/dist/provider-resolver.js.map +1 -1
  55. package/dist/streaming/data-parts.d.ts +163 -0
  56. package/dist/streaming/data-parts.d.ts.map +1 -0
  57. package/dist/streaming/data-parts.js +14 -0
  58. package/dist/streaming/data-parts.js.map +1 -0
  59. package/dist/streaming/index.d.ts +8 -0
  60. package/dist/streaming/index.d.ts.map +1 -0
  61. package/dist/streaming/index.js +10 -0
  62. package/dist/streaming/index.js.map +1 -0
  63. package/dist/streaming/transient.d.ts +136 -0
  64. package/dist/streaming/transient.d.ts.map +1 -0
  65. package/dist/streaming/transient.js +201 -0
  66. package/dist/streaming/transient.js.map +1 -0
  67. package/dist/system-detect.d.ts +34 -12
  68. package/dist/system-detect.d.ts.map +1 -1
  69. package/dist/system-detect.js +154 -29
  70. package/dist/system-detect.js.map +1 -1
  71. package/dist/tools/factory.d.ts +109 -0
  72. package/dist/tools/factory.d.ts.map +1 -0
  73. package/dist/tools/factory.js +166 -0
  74. package/dist/tools/factory.js.map +1 -0
  75. package/dist/tools/provider.d.ts +97 -0
  76. package/dist/tools/provider.d.ts.map +1 -0
  77. package/dist/tools/provider.js +178 -0
  78. package/dist/tools/provider.js.map +1 -0
  79. package/dist/types/agent-v2.d.ts +83 -0
  80. package/dist/types/agent-v2.d.ts.map +1 -0
  81. package/dist/types/agent-v2.js +8 -0
  82. package/dist/types/agent-v2.js.map +1 -0
  83. package/dist/utils/logger.d.ts +35 -0
  84. package/dist/utils/logger.d.ts.map +1 -0
  85. package/dist/utils/logger.js +149 -0
  86. package/dist/utils/logger.js.map +1 -0
  87. package/dist/workflow/builders/adapt.d.ts +20 -0
  88. package/dist/workflow/builders/adapt.d.ts.map +1 -0
  89. package/dist/workflow/builders/adapt.js +33 -0
  90. package/dist/workflow/builders/adapt.js.map +1 -0
  91. package/dist/workflow/builders/index.d.ts +8 -0
  92. package/dist/workflow/builders/index.d.ts.map +1 -0
  93. package/dist/workflow/builders/index.js +7 -0
  94. package/dist/workflow/builders/index.js.map +1 -0
  95. package/dist/workflow/builders/parallel.d.ts +25 -0
  96. package/dist/workflow/builders/parallel.d.ts.map +1 -0
  97. package/dist/workflow/builders/parallel.js +60 -0
  98. package/dist/workflow/builders/parallel.js.map +1 -0
  99. package/dist/workflow/builders/pipeline.d.ts +22 -0
  100. package/dist/workflow/builders/pipeline.d.ts.map +1 -0
  101. package/dist/workflow/builders/pipeline.js +48 -0
  102. package/dist/workflow/builders/pipeline.js.map +1 -0
  103. package/dist/workflow/builders/types.d.ts +54 -0
  104. package/dist/workflow/builders/types.d.ts.map +1 -0
  105. package/dist/workflow/builders/types.js +5 -0
  106. package/dist/workflow/builders/types.js.map +1 -0
  107. package/dist/workflow/durable-agent.d.ts +128 -0
  108. package/dist/workflow/durable-agent.d.ts.map +1 -0
  109. package/dist/workflow/durable-agent.js +323 -0
  110. package/dist/workflow/durable-agent.js.map +1 -0
  111. package/dist/workflow/schedulers.d.ts +231 -0
  112. package/dist/workflow/schedulers.d.ts.map +1 -0
  113. package/dist/workflow/schedulers.js +250 -0
  114. package/dist/workflow/schedulers.js.map +1 -0
  115. package/dist/workflow/team/create-team.d.ts +34 -0
  116. package/dist/workflow/team/create-team.d.ts.map +1 -0
  117. package/dist/workflow/team/create-team.js +242 -0
  118. package/dist/workflow/team/create-team.js.map +1 -0
  119. package/dist/workflow/team/index.d.ts +9 -0
  120. package/dist/workflow/team/index.d.ts.map +1 -0
  121. package/dist/workflow/team/index.js +8 -0
  122. package/dist/workflow/team/index.js.map +1 -0
  123. package/dist/workflow/team/machines.d.ts +152 -0
  124. package/dist/workflow/team/machines.d.ts.map +1 -0
  125. package/dist/workflow/team/machines.js +197 -0
  126. package/dist/workflow/team/machines.js.map +1 -0
  127. package/dist/workflow/team/task-board.d.ts +47 -0
  128. package/dist/workflow/team/task-board.d.ts.map +1 -0
  129. package/dist/workflow/team/task-board.js +111 -0
  130. package/dist/workflow/team/task-board.js.map +1 -0
  131. package/dist/workflow/team/tools.d.ts +66 -0
  132. package/dist/workflow/team/tools.d.ts.map +1 -0
  133. package/dist/workflow/team/tools.js +100 -0
  134. package/dist/workflow/team/tools.js.map +1 -0
  135. package/dist/workflow/team/types.d.ts +109 -0
  136. package/dist/workflow/team/types.d.ts.map +1 -0
  137. package/dist/workflow/team/types.js +5 -0
  138. package/dist/workflow/team/types.js.map +1 -0
  139. package/dist/workflow/templates.d.ts +71 -0
  140. package/dist/workflow/templates.d.ts.map +1 -0
  141. package/dist/workflow/templates.js +132 -0
  142. package/dist/workflow/templates.js.map +1 -0
  143. package/package.json +1 -1
@@ -0,0 +1,115 @@
1
+ /**
2
+ * @agntk/core - System Prompt Templates
3
+ * Core system prompts for agent behavior
4
+ *
5
+ * @deprecated Use `presets/role-registry.ts` instead. That module is the canonical
6
+ * source of truth for role prompts, used by `createAgent()` via `getRole()`.
7
+ * This file is kept for backward compatibility of public exports only.
8
+ */
9
+ export const systemPrompt = `You are an autonomous agent. Your purpose is to accomplish the user's goal using whatever approach makes sense.
10
+
11
+ # Philosophy
12
+
13
+ You have a mind and you have tools. Tools extend your thinking - use them fluidly as part of reasoning, not as separate mechanical steps.
14
+
15
+ There is no single correct workflow. Match your approach to the problem:
16
+ - Reason through it, gather information, reason more, then act
17
+ - Act immediately if the path is obvious
18
+ - Start one approach, realize it's wrong, switch to another
19
+ - Call multiple tools in parallel when they don't depend on each other
20
+
21
+ When something doesn't work, adapt. When you need information, go get it. When uncertain, reason carefully. When clear, act directly.
22
+
23
+ When errors occur, read them carefully. The error message usually points to the fix.
24
+
25
+ # Action
26
+
27
+ Do things, don't announce them. Instead of "I'll search for X", just search.
28
+
29
+ Be autonomous. Complete tasks without asking permission at every step. Only ask the user when you genuinely need information only they can provide.
30
+
31
+ # Thinking Out Loud
32
+
33
+ Before each action, briefly state:
34
+ - **Goal**: What am I trying to accomplish?
35
+ - **Approach**: Why is this the right tool/action?
36
+ - **Risk**: What could go wrong?
37
+
38
+ Keep it concise (1-2 sentences each). This helps the user understand your decisions.
39
+
40
+ # Efficiency
41
+
42
+ Complete tasks in the fewest steps possible:
43
+ - Think first: What's the most direct path to the goal?
44
+ - Use the right tool: Each tool's description explains when to use it
45
+ - Chain when independent: Call multiple tools in parallel when they don't depend on each other
46
+ - No random exploration: Every action should have a purpose
47
+
48
+ # Tools
49
+
50
+ You have access to consolidated tools with multiple actions. Use the action parameter to specify what to do:
51
+
52
+ **fs** - All file operations (read, write, edit, list, glob, grep, move, delete, info, mkdir)
53
+ **shell** - Execute shell commands (with allowlisting for repeated commands)
54
+ **web** - Search the internet (search) or fetch page content (fetch)
55
+ **memory** - Knowledge graph operations (add, search, episodes, fact, entity, related)
56
+
57
+ **delegate** - Parallel work: tool chains (steps), sub-agents (agent), or background processes (background)
58
+ **task** - Manage background tasks (status, output, cancel, list, cleanup)
59
+
60
+ Additional tools: plan, ask_user, task_complete
61
+
62
+ Each tool's description provides detailed guidance on when and how to use it. Read the descriptions to understand capabilities and constraints.
63
+
64
+ # Delegation
65
+
66
+ For complex work, use the delegate tool:
67
+ - **steps**: Execute multiple tool calls in sequence with dependency handling
68
+ - **agent**: Spawn a specialized sub-agent (coder/researcher/analyst)
69
+ - **background**: Start a long-running shell command
70
+
71
+ After delegating, use the task tool to monitor progress and retrieve output.
72
+
73
+ # Completion
74
+
75
+ Call task_complete when you have fully accomplished what the user asked for.
76
+
77
+ Only call task_complete when truly done - not planned, not partially done, but actually complete.
78
+ `;
79
+ export const rolePrompts = {
80
+ generic: systemPrompt,
81
+ coder: `${systemPrompt}
82
+
83
+ # Specialized Role: Code Implementation
84
+
85
+ You are a code implementation specialist. Your focus areas:
86
+ - Writing clean, maintainable code
87
+ - Following existing patterns in the codebase
88
+ - Making minimal, targeted changes
89
+ - Running tests to verify your changes work
90
+
91
+ Always read relevant code before making changes. Match the existing style.`,
92
+ researcher: `${systemPrompt}
93
+
94
+ # Specialized Role: Research
95
+
96
+ You are a research specialist. Your focus areas:
97
+ - Gathering comprehensive information on topics
98
+ - Evaluating source credibility
99
+ - Synthesizing findings into clear summaries
100
+ - Identifying key insights and patterns
101
+
102
+ Be thorough but efficient. Focus on actionable information.`,
103
+ analyst: `${systemPrompt}
104
+
105
+ # Specialized Role: Analysis
106
+
107
+ You are an analysis specialist. Your focus areas:
108
+ - Breaking down complex problems
109
+ - Identifying patterns and relationships
110
+ - Evaluating trade-offs and options
111
+ - Providing data-driven recommendations
112
+
113
+ Be systematic and logical. Support conclusions with evidence.`,
114
+ };
115
+ //# sourceMappingURL=templates.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"templates.js","sourceRoot":"","sources":["../../src/prompts/templates.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,MAAM,CAAC,MAAM,YAAY,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqE3B,CAAC;AAEF,MAAM,CAAC,MAAM,WAAW,GAA2B;IACjD,OAAO,EAAE,YAAY;IAErB,KAAK,EAAE,GAAG,YAAY;;;;;;;;;;2EAUmD;IAEzE,UAAU,EAAE,GAAG,YAAY;;;;;;;;;;4DAU+B;IAE1D,OAAO,EAAE,GAAG,YAAY;;;;;;;;;;8DAUoC;CAC7D,CAAC"}
@@ -16,6 +16,10 @@ export interface ResolvedProvider {
16
16
  isFree: boolean;
17
17
  /** When provider is 'ollama', hardware-aware model recommendations */
18
18
  ollamaModels?: OllamaModelRecommendation;
19
+ /** When provider is 'ollama', the list of models actually installed */
20
+ ollamaInstalledModels?: string[];
21
+ /** When Ollama was skipped despite running, explains why (for CLI display) */
22
+ ollamaSkipReason?: string;
19
23
  }
20
24
  /**
21
25
  * Resolve the best available provider.
@@ -1 +1 @@
1
- {"version":3,"file":"provider-resolver.d.ts","sourceRoot":"","sources":["../src/provider-resolver.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,EAAuC,KAAK,yBAAyB,EAAE,MAAM,iBAAiB,CAAC;AAQtG,MAAM,WAAW,gBAAgB;IAC/B,kDAAkD;IAClD,QAAQ,EAAE,MAAM,CAAC;IACjB,0DAA0D;IAC1D,MAAM,EAAE,MAAM,CAAC;IACf,uEAAuE;IACvE,MAAM,EAAE,OAAO,CAAC;IAChB,sEAAsE;IACtE,YAAY,CAAC,EAAE,yBAAyB,CAAC;CAC1C;AA2FD;;;;;;;;GAQG;AACH,wBAAsB,eAAe,IAAI,OAAO,CAAC,gBAAgB,CAAC,CAejE;AASD;;GAEG;AACH,wBAAsB,mBAAmB,IAAI,OAAO,CAAC,gBAAgB,CAAC,CAUrE;AAED;;GAEG;AACH,wBAAgB,kBAAkB,IAAI,IAAI,CAGzC"}
1
+ {"version":3,"file":"provider-resolver.d.ts","sourceRoot":"","sources":["../src/provider-resolver.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,EAAuC,KAAK,yBAAyB,EAAE,MAAM,iBAAiB,CAAC;AAQtG,MAAM,WAAW,gBAAgB;IAC/B,kDAAkD;IAClD,QAAQ,EAAE,MAAM,CAAC;IACjB,0DAA0D;IAC1D,MAAM,EAAE,MAAM,CAAC;IACf,uEAAuE;IACvE,MAAM,EAAE,OAAO,CAAC;IAChB,sEAAsE;IACtE,YAAY,CAAC,EAAE,yBAAyB,CAAC;IACzC,uEAAuE;IACvE,qBAAqB,CAAC,EAAE,MAAM,EAAE,CAAC;IACjC,8EAA8E;IAC9E,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B;AAoID;;;;;;;;GAQG;AACH,wBAAsB,eAAe,IAAI,OAAO,CAAC,gBAAgB,CAAC,CAiBjE;AASD;;GAEG;AACH,wBAAsB,mBAAmB,IAAI,OAAO,CAAC,gBAAgB,CAAC,CAUrE;AAED;;GAEG;AACH,wBAAgB,kBAAkB,IAAI,IAAI,CAGzC"}
@@ -28,6 +28,10 @@ function checkBYOK() {
28
28
  return null;
29
29
  }
30
30
  // ============================================================================
31
+ // Ollama Skip Reason (set by probeOllama, read by getFreeTier)
32
+ // ============================================================================
33
+ let _ollamaSkipReason = null;
34
+ // ============================================================================
31
35
  // Ollama Detection
32
36
  // ============================================================================
33
37
  /**
@@ -45,11 +49,16 @@ function checkOllamaExplicit() {
45
49
  }
46
50
  /**
47
51
  * Probe Ollama at localhost:11434 with a fast health check.
48
- * If Ollama is running, detect system hardware and recommend models.
52
+ * If Ollama is running AND has at least one model pulled, detect system
53
+ * hardware and recommend the best available models.
49
54
  * Returns within 500ms regardless of whether Ollama is running.
50
55
  */
51
56
  async function probeOllama() {
52
- const baseUrl = process.env['OLLAMA_BASE_URL'] || 'http://localhost:11434';
57
+ // Strip trailing path segments (/api, /v1, etc.) the probe needs the raw Ollama host.
58
+ // Users may set OLLAMA_BASE_URL to "http://localhost:11434/api" or "/v1" for the AI SDK,
59
+ // but the native Ollama API lives at the root (e.g. /api/tags, not /api/api/tags).
60
+ const rawUrl = process.env['OLLAMA_BASE_URL'] || 'http://localhost:11434';
61
+ const baseUrl = rawUrl.replace(/\/(api|v1)\/?$/, '');
53
62
  const controller = new AbortController();
54
63
  const timeout = setTimeout(() => controller.abort(), 500);
55
64
  try {
@@ -58,19 +67,41 @@ async function probeOllama() {
58
67
  method: 'GET',
59
68
  });
60
69
  clearTimeout(timeout);
61
- if (response.ok) {
62
- // Ollama is running — detect hardware and pick best model tier
63
- const sysProfile = detectSystem();
64
- const models = recommendOllamaModels(sysProfile);
65
- log.info('Ollama detected', { baseUrl, tier: models.tier, reason: models.reason });
66
- return {
67
- provider: 'ollama',
68
- source: `ollama (${baseUrl})`,
69
- isFree: false,
70
- ollamaModels: models,
71
- };
70
+ if (!response.ok)
71
+ return null;
72
+ // Parse which models are actually installed
73
+ const data = (await response.json());
74
+ const installedModels = (data.models || []).map((m) => m.name.toLowerCase());
75
+ if (installedModels.length === 0) {
76
+ log.info('Ollama running but no models installed', { baseUrl });
77
+ return null;
72
78
  }
73
- return null;
79
+ // Detect hardware and recommend the best model from what's actually installed
80
+ const sysProfile = detectSystem();
81
+ const recommendation = recommendOllamaModels(sysProfile, installedModels);
82
+ // If no usable models found (all sub-8b, no cloud), skip Ollama
83
+ if (recommendation.noUsableModels) {
84
+ _ollamaSkipReason =
85
+ 'Ollama running but no 8b+ model found.\n' +
86
+ ' Run `ollama pull qwen3-coder:30b` for local, or `ollama pull qwen3-coder:480b-cloud` for cloud.\n' +
87
+ ' Using free tier for now.';
88
+ log.info('Ollama skipped — no usable models', { baseUrl, installed: installedModels });
89
+ return null;
90
+ }
91
+ log.info('Ollama detected', {
92
+ baseUrl,
93
+ tier: recommendation.tier,
94
+ standard: recommendation.standard,
95
+ installed: installedModels,
96
+ reason: recommendation.reason,
97
+ });
98
+ return {
99
+ provider: 'ollama',
100
+ source: `ollama (${baseUrl})`,
101
+ isFree: false,
102
+ ollamaModels: recommendation,
103
+ ollamaInstalledModels: installedModels,
104
+ };
74
105
  }
75
106
  catch {
76
107
  clearTimeout(timeout);
@@ -83,7 +114,11 @@ async function probeOllama() {
83
114
  // ============================================================================
84
115
  function getFreeTier() {
85
116
  log.info('Using agntk free tier');
86
- return { provider: 'agntk-free', source: 'free tier (Cerebras)', isFree: true };
117
+ const result = { provider: 'agntk-free', source: 'free tier (Cerebras)', isFree: true };
118
+ if (_ollamaSkipReason) {
119
+ result.ollamaSkipReason = _ollamaSkipReason;
120
+ }
121
+ return result;
87
122
  }
88
123
  // ============================================================================
89
124
  // Main Cascade
@@ -98,6 +133,7 @@ function getFreeTier() {
98
133
  * 4. Free tier fallback (sync, instant)
99
134
  */
100
135
  export async function resolveProvider() {
136
+ _ollamaSkipReason = null;
101
137
  // 1. BYOK — instant
102
138
  const byok = checkBYOK();
103
139
  if (byok)
@@ -1 +1 @@
1
- {"version":3,"file":"provider-resolver.js","sourceRoot":"","sources":["../src/provider-resolver.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAE,YAAY,EAAE,qBAAqB,EAAkC,MAAM,iBAAiB,CAAC;AAEtG,MAAM,GAAG,GAAG,YAAY,CAAC,+BAA+B,CAAC,CAAC;AAiB1D,+EAA+E;AAC/E,iCAAiC;AACjC,+EAA+E;AAE/E,MAAM,SAAS,GAAG;IAChB,EAAE,GAAG,EAAE,oBAAoB,EAAE,QAAQ,EAAE,YAAY,EAAE;IACrD,EAAE,GAAG,EAAE,gBAAgB,EAAE,QAAQ,EAAE,QAAQ,EAAE;IAC7C,EAAE,GAAG,EAAE,kBAAkB,EAAE,QAAQ,EAAE,UAAU,EAAE;CACzC,CAAC;AAEX,SAAS,SAAS;IAChB,KAAK,MAAM,EAAE,GAAG,EAAE,QAAQ,EAAE,IAAI,SAAS,EAAE,CAAC;QAC1C,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QAC7B,IAAI,GAAG,IAAI,GAAG,CAAC,IAAI,EAAE,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACjC,GAAG,CAAC,IAAI,CAAC,mBAAmB,EAAE,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,CAAC;YACjD,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC;QAClD,CAAC;IACH,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED,+EAA+E;AAC/E,mBAAmB;AACnB,+EAA+E;A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E/E,IAAI,cAAc,GAA4B,IAAI,CAAC;AACnD,IAAI,cAAc,GAAqC,IAAI,CAAC;AAE5D;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,mBAAmB;IACvC,IAAI,cAAc;QAAE,OAAO,cAAc,CAAC;IAC1C,IAAI,cAAc;QAAE,OAAO,cAAc,CAAC;IAE1C,cAAc,GAAG,eAAe,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE;QAC5C,cAAc,GAAG,CAAC,CAAC;QACnB,OAAO,CAAC,CAAC;IACX,CAAC,CAAC,CAAC;IAEH,OAAO,cAAc,CAAC;AACxB,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,kBAAkB;IAChC,cAAc,GAAG,IAAI,CAAC;IACtB,cAAc,GAAG,IAAI,CAAC;AACxB,CAAC"}
@@ -0,0 +1,163 @@
1
+ /**
2
+ * @fileoverview Custom data part types for AI SDK streaming.
3
+ * These types define the shape of transient data streamed during agent execution.
4
+ *
5
+ * Usage with AI SDK:
6
+ * ```typescript
7
+ * import type { DataStreamWriter } from 'ai';
8
+ *
9
+ * const writer: DataStreamWriter = ...;
10
+ * writer.writeData({ type: 'file-content', data: { path: '/foo.ts', content: '...', truncated: false } });
11
+ * ```
12
+ */
13
+ /**
14
+ * Union type of all custom data parts supported by the agent SDK.
15
+ * These are streamed transiently and not persisted to conversation context.
16
+ */
17
+ export type AgentDataParts = {
18
+ /**
19
+ * Streaming output from a spawned sub-agent.
20
+ * Displayed as nested collapsible in UI.
21
+ */
22
+ 'sub-agent-stream': SubAgentStreamData;
23
+ /**
24
+ * Search results from grep/glob/codebase search.
25
+ */
26
+ 'search-result': SearchResultData;
27
+ /**
28
+ * File content streamed transiently (not added to context).
29
+ */
30
+ 'file-content': FileContentData;
31
+ /**
32
+ * Shell command execution output.
33
+ */
34
+ 'shell-output': ShellOutputData;
35
+ /**
36
+ * Progress indicator for long-running tools.
37
+ */
38
+ 'tool-progress': ToolProgressData;
39
+ /**
40
+ * Reasoning/thinking step from deep reasoning tool.
41
+ */
42
+ 'reasoning-step': ReasoningStepData;
43
+ /**
44
+ * Memory retrieval results.
45
+ */
46
+ 'memory-result': MemoryResultData;
47
+ };
48
+ /** Sub-agent streaming data. */
49
+ export interface SubAgentStreamData {
50
+ /** Unique identifier for the sub-agent instance. */
51
+ agentId: string;
52
+ /** Role of the sub-agent. */
53
+ role: string;
54
+ /** Streamed text content. */
55
+ text: string;
56
+ /** Status of the sub-agent stream. */
57
+ status: 'streaming' | 'complete' | 'error';
58
+ /** Error message if status is 'error'. */
59
+ error?: string;
60
+ }
61
+ /** Search result data from file/code search. */
62
+ export interface SearchResultData {
63
+ /** File path relative to workspace root. */
64
+ path: string;
65
+ /** Matched content snippet. */
66
+ content: string;
67
+ /** Number of matches in the file. */
68
+ matches: number;
69
+ /** Line number of the first match. */
70
+ line?: number;
71
+ /** Search pattern used. */
72
+ pattern?: string;
73
+ }
74
+ /** File content data for transient streaming. */
75
+ export interface FileContentData {
76
+ /** Absolute or relative file path. */
77
+ path: string;
78
+ /** File content. */
79
+ content: string;
80
+ /** Whether content was truncated due to size limits. */
81
+ truncated: boolean;
82
+ /** Total file size in bytes. */
83
+ totalBytes?: number;
84
+ /** MIME type of the file. */
85
+ mimeType?: string;
86
+ /** Language identifier for syntax highlighting. */
87
+ language?: string;
88
+ /** Line range if partial content. */
89
+ lineRange?: {
90
+ start: number;
91
+ end: number;
92
+ };
93
+ }
94
+ /** Shell command output data. */
95
+ export interface ShellOutputData {
96
+ /** Command that was executed. */
97
+ command: string;
98
+ /** Command output (stdout + stderr). */
99
+ output: string;
100
+ /** Exit code of the command. */
101
+ exitCode: number;
102
+ /** Working directory where command was executed. */
103
+ cwd?: string;
104
+ /** Whether output was truncated. */
105
+ truncated?: boolean;
106
+ /** Execution duration in milliseconds. */
107
+ durationMs?: number;
108
+ }
109
+ /** Tool progress indicator data. */
110
+ export interface ToolProgressData {
111
+ /** Name of the tool being executed. */
112
+ toolName: string;
113
+ /** Progress percentage (0-100). */
114
+ progress: number;
115
+ /** Human-readable progress message. */
116
+ message: string;
117
+ /** Estimated time remaining in milliseconds. */
118
+ estimatedRemaining?: number;
119
+ /** Current step/total steps format. */
120
+ step?: {
121
+ current: number;
122
+ total: number;
123
+ };
124
+ }
125
+ /** Reasoning step from deep reasoning tool. */
126
+ export interface ReasoningStepData {
127
+ /** Step number in the reasoning chain. */
128
+ stepNumber: number;
129
+ /** Total estimated steps. */
130
+ totalSteps: number;
131
+ /** The reasoning thought content. */
132
+ thought: string;
133
+ /** Whether this is a revision of a previous thought. */
134
+ isRevision?: boolean;
135
+ /** Which thought number is being revised. */
136
+ revisesThought?: number;
137
+ /** Branch identifier for alternative reasoning paths. */
138
+ branchId?: string;
139
+ }
140
+ /** Memory retrieval result data. */
141
+ export interface MemoryResultData {
142
+ /** Memory entry content. */
143
+ content: string;
144
+ /** Similarity score (0-1). */
145
+ score: number;
146
+ /** Metadata associated with the memory. */
147
+ metadata?: Record<string, unknown>;
148
+ /** When the memory was stored. */
149
+ timestamp?: string;
150
+ }
151
+ /** Type helper to get data type for a specific part type. */
152
+ export type DataPartType<K extends keyof AgentDataParts> = AgentDataParts[K];
153
+ /** Type helper for creating typed data parts. */
154
+ export interface TypedDataPart<K extends keyof AgentDataParts> {
155
+ type: K;
156
+ id?: string;
157
+ data: AgentDataParts[K];
158
+ }
159
+ /** Union of all possible data parts. */
160
+ export type AnyDataPart = {
161
+ [K in keyof AgentDataParts]: TypedDataPart<K>;
162
+ }[keyof AgentDataParts];
163
+ //# sourceMappingURL=data-parts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"data-parts.d.ts","sourceRoot":"","sources":["../../src/streaming/data-parts.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAMH;;;GAGG;AACH,MAAM,MAAM,cAAc,GAAG;IAC3B;;;OAGG;IACH,kBAAkB,EAAE,kBAAkB,CAAC;IAEvC;;OAEG;IACH,eAAe,EAAE,gBAAgB,CAAC;IA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,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAEnC,kCAAkC;IAClC,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAMD,6DAA6D;AAC7D,MAAM,MAAM,YAAY,CAAC,CAAC,SAAS,MAAM,cAAc,IAAI,cAAc,CAAC,CAAC,CAAC,CAAC;AAE7E,iDAAiD;AACjD,MAAM,WAAW,aAAa,CAAC,CAAC,SAAS,MAAM,cAAc;IAC3D,IAAI,EAAE,CAAC,CAAC;IACR,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,cAAc,CAAC,CAAC,CAAC,CAAC;CACzB;AAED,wCAAwC;AACxC,MAAM,MAAM,WAAW,GAAG;KACvB,CAAC,IAAI,MAAM,cAAc,GAAG,aAAa,CAAC,CAAC,CAAC;CAC9C,CAAC,MAAM,cAAc,CAAC,CAAC"}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * @fileoverview Custom data part types for AI SDK streaming.
3
+ * These types define the shape of transient data streamed during agent execution.
4
+ *
5
+ * Usage with AI SDK:
6
+ * ```typescript
7
+ * import type { DataStreamWriter } from 'ai';
8
+ *
9
+ * const writer: DataStreamWriter = ...;
10
+ * writer.writeData({ type: 'file-content', data: { path: '/foo.ts', content: '...', truncated: false } });
11
+ * ```
12
+ */
13
+ export {};
14
+ //# sourceMappingURL=data-parts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"data-parts.js","sourceRoot":"","sources":["../../src/streaming/data-parts.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * @agntk/core - Streaming Module
3
+ *
4
+ * Exports for transient streaming and custom data parts.
5
+ */
6
+ export { type AgentDataParts, type SubAgentStreamData, type SearchResultData, type FileContentData, type ShellOutputData, type ToolProgressData, type ReasoningStepData, type MemoryResultData, type DataPartType, type TypedDataPart, type AnyDataPart, } from './data-parts.js';
7
+ export { withTransientStreaming, writeTransient, streamTransient, streamFileContent, streamShellOutput, streamSearchResult, streamProgress, streamReasoningStep, streamSubAgent, type TransientStreamWriter, type TransientToolContext, } from './transient.js';
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/streaming/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EACL,KAAK,cAAc,EACnB,KAAK,kBAAkB,EACvB,KAAK,gBAAgB,EACrB,KAAK,eAAe,EACpB,KAAK,eAAe,EACpB,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EACrB,KAAK,YAAY,EACjB,KAAK,aAAa,EAClB,KAAK,WAAW,GACjB,MAAM,cAAc,CAAC;AAGtB,OAAO,EACL,sBAAsB,EACtB,cAAc,EACd,eAAe,EACf,iBAAiB,EACjB,iBAAiB,EACjB,kBAAkB,EAClB,cAAc,EACd,mBAAmB,EACnB,cAAc,EACd,KAAK,qBAAqB,EAC1B,KAAK,oBAAoB,GAC1B,MAAM,aAAa,CAAC"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * @agntk/core - Streaming Module
3
+ *
4
+ * Exports for transient streaming and custom data parts.
5
+ */
6
+ // Data part types
7
+ export {} from './data-parts.js';
8
+ // Transient streaming
9
+ export { withTransientStreaming, writeTransient, streamTransient, streamFileContent, streamShellOutput, streamSearchResult, streamProgress, streamReasoningStep, streamSubAgent, } from './transient.js';
10
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/streaming/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,kBAAkB;AAClB,OAAO,EAYN,MAAM,cAAc,CAAC;AAEtB,sBAAsB;AACtB,OAAO,EACL,sBAAsB,EACtB,cAAc,EACd,eAAe,EACf,iBAAiB,EACjB,iBAAiB,EACjB,kBAAkB,EAClB,cAAc,EACd,mBAAmB,EACnB,cAAc,GAGf,MAAM,aAAa,CAAC"}
@@ -0,0 +1,136 @@
1
+ /**
2
+ * @agntk/core - Transient Streaming Infrastructure
3
+ *
4
+ * Enables tools to stream data to the UI without persisting to conversation context.
5
+ * This keeps the context window lean while providing rich UI feedback.
6
+ */
7
+ import type { Tool } from 'ai';
8
+ import type { ToolContext } from '../types/lifecycle.js';
9
+ import type { AgentDataParts } from './data-parts.js';
10
+ /**
11
+ * Interface for UI stream writer.
12
+ * Compatible with AI SDK's DataStreamWriter.
13
+ */
14
+ export interface TransientStreamWriter {
15
+ writeData(data: unknown): void;
16
+ }
17
+ /**
18
+ * Enhanced tool context with transient streaming capabilities.
19
+ * Uses intersection type to extend ToolContext without conflicts.
20
+ */
21
+ export type TransientToolContext = ToolContext & {
22
+ /** Helper to stream typed transient data */
23
+ stream: <K extends keyof AgentDataParts>(type: K, data: AgentDataParts[K]) => void;
24
+ };
25
+ /**
26
+ * Tool set is a record of tools keyed by name.
27
+ */
28
+ type ToolSet = Record<string, Tool>;
29
+ /**
30
+ * Wrap tools to enable transient streaming.
31
+ *
32
+ * Tools wrapped with this function will have access to a `stream()` helper
33
+ * in their context that allows streaming data to the UI without adding
34
+ * it to the conversation context.
35
+ *
36
+ * @param tools - Record of tools to wrap
37
+ * @param writer - Stream writer for sending data to the client
38
+ * @returns Wrapped tools with transient streaming enabled
39
+ *
40
+ * @example
41
+ * ```typescript
42
+ * const wrappedTools = withTransientStreaming(myTools, dataStream);
43
+ *
44
+ * // Inside a tool's execute function:
45
+ * execute: async (input, ctx) => {
46
+ * ctx.stream('file-content', {
47
+ * path: input.path,
48
+ * content: fileContent,
49
+ * truncated: false,
50
+ * });
51
+ * return `Read ${input.path}`;
52
+ * }
53
+ * ```
54
+ */
55
+ export declare function withTransientStreaming(tools: ToolSet, writer: TransientStreamWriter): ToolSet;
56
+ /**
57
+ * Stream typed transient data to the UI.
58
+ *
59
+ * @param writer - Stream writer instance
60
+ * @param type - Data part type
61
+ * @param data - Data to stream
62
+ */
63
+ export declare function writeTransient<K extends keyof AgentDataParts>(writer: TransientStreamWriter, type: K, data: AgentDataParts[K]): void;
64
+ /**
65
+ * Helper for tools to stream transient data from within their execute function.
66
+ *
67
+ * @param ctx - Tool context (must have writer)
68
+ * @param type - Data part type
69
+ * @param data - Data to stream
70
+ *
71
+ * @example
72
+ * ```typescript
73
+ * // Inside a tool's execute function:
74
+ * streamTransient(ctx, 'shell-output', {
75
+ * command: 'npm test',
76
+ * output: result.stdout,
77
+ * exitCode: result.code,
78
+ * });
79
+ * ```
80
+ */
81
+ export declare function streamTransient<K extends keyof AgentDataParts>(ctx: ToolContext, type: K, data: AgentDataParts[K]): void;
82
+ /**
83
+ * Stream file content transiently.
84
+ */
85
+ export declare function streamFileContent(ctx: ToolContext, path: string, content: string, options?: {
86
+ truncated?: boolean;
87
+ totalBytes?: number;
88
+ language?: string;
89
+ lineRange?: {
90
+ start: number;
91
+ end: number;
92
+ };
93
+ }): void;
94
+ /**
95
+ * Stream shell output transiently.
96
+ */
97
+ export declare function streamShellOutput(ctx: ToolContext, command: string, output: string, exitCode: number, options?: {
98
+ cwd?: string;
99
+ truncated?: boolean;
100
+ durationMs?: number;
101
+ }): void;
102
+ /**
103
+ * Stream search results transiently.
104
+ */
105
+ export declare function streamSearchResult(ctx: ToolContext, path: string, content: string, matches: number, options?: {
106
+ line?: number;
107
+ pattern?: string;
108
+ }): void;
109
+ /**
110
+ * Stream tool progress update transiently.
111
+ */
112
+ export declare function streamProgress(ctx: ToolContext, toolName: string, progress: number, message: string, options?: {
113
+ estimatedRemaining?: number;
114
+ step?: {
115
+ current: number;
116
+ total: number;
117
+ };
118
+ }): void;
119
+ /**
120
+ * Stream reasoning step transiently.
121
+ *
122
+ * @internal Forward-designed for CLI streaming feature. No production callers yet.
123
+ */
124
+ export declare function streamReasoningStep(ctx: ToolContext, stepNumber: number, totalSteps: number, thought: string, options?: {
125
+ isRevision?: boolean;
126
+ revisesThought?: number;
127
+ branchId?: string;
128
+ }): void;
129
+ /**
130
+ * Stream sub-agent output transiently.
131
+ *
132
+ * @internal Forward-designed for CLI streaming feature. No production callers yet.
133
+ */
134
+ export declare function streamSubAgent(ctx: ToolContext, agentId: string, role: string, text: string, status: 'streaming' | 'complete' | 'error', error?: string): void;
135
+ export {};
136
+ //# sourceMappingURL=transient.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transient.d.ts","sourceRoot":"","sources":["../../src/streaming/transient.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,IAAI,CAAC;AAE/B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,KAAK,EAAE,cAAc,EAAe,MAAM,cAAc,CAAC;AAQhE;;;GAGG;AACH,MAAM,WAAW,qBAAqB;IACpC,SAAS,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,CAAC;CAChC;AAED;;;GAGG;AACH,MAAM,MAAM,oBAAoB,GAAG,WAAW,GAAG;IAC/C,4CAA4C;IAC5C,MAAM,EAAE,CAAC,CAAC,SAAS,MAAM,cAAc,EACrC,IAAI,EAAE,CAAC,EACP,IAAI,EAAE,cAAc,CAAC,CAAC,CAAC,KACpB,IAAI,CAAC;CACX,CAAC;AAEF;;GAEG;AACH,KAAK,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;AAMpC;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,sBAAsB,CACpC,KAAK,EAAE,OAAO,EACd,MAAM,EAAE,qBAAqB,GAC5B,OAAO,CAQT;AA+CD;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,CAAC,SAAS,MAAM,cAAc,EAC3D,MAAM,EAAE,qBAAqB,EAC7B,IAAI,EAAE,CAAC,EACP,IAAI,EAAE,cAAc,CAAC,CAAC,CAAC,GACtB,IAAI,CAUN;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,eAAe,CAAC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