@townco/agent 0.1.87 → 0.1.98

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 (32) hide show
  1. package/dist/acp-server/adapter.d.ts +49 -0
  2. package/dist/acp-server/adapter.js +693 -5
  3. package/dist/acp-server/http.d.ts +7 -0
  4. package/dist/acp-server/http.js +53 -6
  5. package/dist/definition/index.d.ts +29 -0
  6. package/dist/definition/index.js +24 -0
  7. package/dist/runner/agent-runner.d.ts +16 -1
  8. package/dist/runner/agent-runner.js +2 -1
  9. package/dist/runner/e2b-sandbox-manager.d.ts +18 -0
  10. package/dist/runner/e2b-sandbox-manager.js +99 -0
  11. package/dist/runner/hooks/executor.d.ts +3 -1
  12. package/dist/runner/hooks/executor.js +21 -1
  13. package/dist/runner/hooks/predefined/compaction-tool.js +67 -2
  14. package/dist/runner/hooks/types.d.ts +5 -0
  15. package/dist/runner/index.d.ts +11 -0
  16. package/dist/runner/langchain/index.d.ts +10 -0
  17. package/dist/runner/langchain/index.js +227 -7
  18. package/dist/runner/langchain/model-factory.js +28 -1
  19. package/dist/runner/langchain/tools/artifacts.js +6 -3
  20. package/dist/runner/langchain/tools/e2b.d.ts +48 -0
  21. package/dist/runner/langchain/tools/e2b.js +305 -0
  22. package/dist/runner/langchain/tools/filesystem.js +63 -0
  23. package/dist/runner/langchain/tools/subagent.d.ts +8 -0
  24. package/dist/runner/langchain/tools/subagent.js +76 -4
  25. package/dist/runner/langchain/tools/web_search.d.ts +36 -14
  26. package/dist/runner/langchain/tools/web_search.js +33 -2
  27. package/dist/runner/session-context.d.ts +20 -0
  28. package/dist/runner/session-context.js +54 -0
  29. package/dist/runner/tools.d.ts +2 -2
  30. package/dist/runner/tools.js +1 -0
  31. package/dist/tsconfig.tsbuildinfo +1 -1
  32. package/package.json +8 -7
@@ -11,6 +11,18 @@ export declare const SUBAGENT_MODE_KEY = "town.com/isSubagent";
11
11
  export interface SubagentModeExtension {
12
12
  [SUBAGENT_MODE_KEY]?: boolean;
13
13
  }
14
+ /**
15
+ * Citation source extracted from tool outputs (WebSearch, WebFetch, MCP tools)
16
+ */
17
+ export interface CitationSource {
18
+ id: string;
19
+ url: string;
20
+ title: string;
21
+ snippet?: string;
22
+ favicon?: string;
23
+ toolCallId: string;
24
+ sourceName?: string;
25
+ }
14
26
  /** Adapts an Agent to speak the ACP protocol */
15
27
  export declare class AgentAcpAdapter implements acp.Agent {
16
28
  private connection;
@@ -32,6 +44,8 @@ export declare class AgentAcpAdapter implements acp.Agent {
32
44
  /**
33
45
  * Extract tool metadata from the agent definition for exposing to clients.
34
46
  * This provides basic info about available tools without loading them fully.
47
+ * For tool groups (like town_e2b, filesystem), dynamically extracts children
48
+ * tools info from the actual tool factories.
35
49
  */
36
50
  private getToolsMetadata;
37
51
  /**
@@ -43,6 +57,30 @@ export declare class AgentAcpAdapter implements acp.Agent {
43
57
  * This provides info about subagents configured via makeSubagentsTool.
44
58
  */
45
59
  private getSubagentsMetadata;
60
+ /**
61
+ * Extract citation sources from tool output.
62
+ * Supports WebSearch (Exa results), WebFetch, library/document retrieval tools,
63
+ * and generic URL extraction from MCP tools.
64
+ */
65
+ private extractSourcesFromToolOutput;
66
+ /**
67
+ * Extract citation sources from a subagent result.
68
+ * The sources are already re-numbered by the runner with unique IDs (1001+, 2001+, etc.)
69
+ * to avoid conflicts with parent agent sources.
70
+ */
71
+ private extractSubagentSources;
72
+ /**
73
+ * Helper to derive favicon URL from a domain
74
+ */
75
+ private getFaviconUrl;
76
+ /**
77
+ * Helper to extract domain name from URL
78
+ */
79
+ private getSourceName;
80
+ /**
81
+ * Helper to extract URLs from text content
82
+ */
83
+ private extractUrlsFromText;
46
84
  private saveSessionToDisk;
47
85
  initialize(_params: acp.InitializeRequest): Promise<acp.InitializeResponse>;
48
86
  newSession(params: acp.NewSessionRequest): Promise<acp.NewSessionResponse>;
@@ -59,4 +97,15 @@ export declare class AgentAcpAdapter implements acp.Agent {
59
97
  private executeHooksIfConfigured;
60
98
  private _executeHooksImpl;
61
99
  cancel(params: acp.CancelNotification): Promise<void>;
100
+ /**
101
+ * Edit and resend a message from a specific point in the conversation.
102
+ * This truncates the session history to the specified user message
103
+ * and then prompts with the new content.
104
+ *
105
+ * @param sessionId - The session to edit
106
+ * @param userMessageIndex - The index of which user message to edit (0-based, counting only user messages)
107
+ * @param newPrompt - The new prompt content to send
108
+ * @returns PromptResponse from the agent
109
+ */
110
+ editAndResend(sessionId: string, userMessageIndex: number, newPrompt: acp.PromptRequest["prompt"]): Promise<acp.PromptResponse>;
62
111
  }