roboport 0.0.1

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 (51) hide show
  1. package/README.md +25 -0
  2. package/core/agent.d.ts +35 -0
  3. package/core/index.d.ts +9 -0
  4. package/core/mcp.d.ts +6 -0
  5. package/core/message.d.ts +36 -0
  6. package/core/model.d.ts +10 -0
  7. package/core/session.d.ts +75 -0
  8. package/core/skill.d.ts +11 -0
  9. package/core/stream.d.ts +33 -0
  10. package/core/tool.d.ts +77 -0
  11. package/env.d.ts +8 -0
  12. package/harness/claudeCode.d.ts +3 -0
  13. package/harness/codex.d.ts +3 -0
  14. package/harness/core.d.ts +7 -0
  15. package/harness/index.d.ts +5 -0
  16. package/harness/index.js +1512 -0
  17. package/harness/pi.d.ts +3 -0
  18. package/harness/shared.d.ts +33 -0
  19. package/harness/tools.d.ts +33 -0
  20. package/index.d.ts +2 -0
  21. package/index.js +537 -0
  22. package/mcp/auth.d.ts +40 -0
  23. package/mcp/clients/grafana.d.ts +17 -0
  24. package/mcp/clients/linear.d.ts +9 -0
  25. package/mcp/clients/tenderly.d.ts +11 -0
  26. package/mcp/core.d.ts +30 -0
  27. package/mcp/index.d.ts +4 -0
  28. package/mcp/index.js +1356 -0
  29. package/mcp/oauth.d.ts +36 -0
  30. package/mcp/servers/calculator.d.ts +1 -0
  31. package/mcp/storage.d.ts +29 -0
  32. package/models/anthropic.d.ts +15 -0
  33. package/models/google.d.ts +14 -0
  34. package/models/index.d.ts +6 -0
  35. package/models/index.js +2039 -0
  36. package/models/moonshot.d.ts +16 -0
  37. package/models/openai-codex-auth.d.ts +17 -0
  38. package/models/openai-compatible.d.ts +41 -0
  39. package/models/openai.d.ts +29 -0
  40. package/package.json +60 -0
  41. package/skills/index.d.ts +7 -0
  42. package/skills/index.js +1007 -0
  43. package/triggers/bus.d.ts +8 -0
  44. package/triggers/core.d.ts +14 -0
  45. package/triggers/index.d.ts +7 -0
  46. package/triggers/index.js +588 -0
  47. package/triggers/sources/cron.d.ts +29 -0
  48. package/triggers/sources/github.d.ts +148 -0
  49. package/triggers/sources/grafana.d.ts +37 -0
  50. package/triggers/sources/linear.d.ts +39 -0
  51. package/triggers/sources/telegram.d.ts +85 -0
package/README.md ADDED
@@ -0,0 +1,25 @@
1
+ # roboport
2
+
3
+ Minimal TypeScript framework for building LLM agents.
4
+
5
+ ## Install
6
+
7
+ ```sh
8
+ bun add roboport zod
9
+ ```
10
+
11
+ `zod` is a peer dependency, declare it in your own dependencies when you define
12
+ Zod-backed tools.
13
+
14
+ ## Exports
15
+
16
+ - `roboport` — agent loop and core `Tool` / `Skill` / `Agent` / `Session` primitives
17
+ - `roboport/models` — `Model` adapters (Anthropic, Google, Moonshot, OpenAI, OpenAI-compatible)
18
+ - `roboport/mcp` — MCP client (transports, auth, server presets)
19
+ - `roboport/harness` — `Harness` bundle and standalone, reusable tools
20
+ - `roboport/skills` — opt-in skill bundle
21
+ - `roboport/triggers` — trigger primitive (cron + GitHub/Grafana/Linear/Telegram receivers)
22
+
23
+ ## Docs
24
+
25
+ See [github.com/Destiner/roboport](https://github.com/Destiner/roboport).
@@ -0,0 +1,35 @@
1
+ import type { Trigger, TriggerHandler } from '../triggers/core';
2
+ import type { McpClient } from './mcp';
3
+ import type { Message } from './message';
4
+ import type { Model } from './model';
5
+ import { Session } from './session';
6
+ import { Skill } from './skill';
7
+ import { Tool } from './tool';
8
+ declare class Agent {
9
+ model: Model;
10
+ system: string;
11
+ tools: Tool[];
12
+ skills: Skill[];
13
+ mcp: McpClient[];
14
+ cwd?: string;
15
+ private registrations;
16
+ private unsubs;
17
+ constructor({ model, system, tools, skills, mcp, cwd, }: {
18
+ model: Model;
19
+ system: string;
20
+ tools: Tool[];
21
+ skills: Skill[];
22
+ mcp?: McpClient[];
23
+ cwd?: string;
24
+ });
25
+ on<T>(trigger: Trigger<T>, handler: TriggerHandler<T>): void;
26
+ start(): Promise<void>;
27
+ stop(): Promise<void>;
28
+ buildSystem(allTools: Tool[]): string;
29
+ private buildSkillTool;
30
+ session(init?: {
31
+ messages?: Message[];
32
+ cwd?: string;
33
+ }): Session;
34
+ }
35
+ export { Agent };
@@ -0,0 +1,9 @@
1
+ import { Agent } from './agent';
2
+ import type { McpClient } from './mcp';
3
+ import type { Message, TextPart, ThinkingPart, ToolCallPart, ToolResultPart } from './message';
4
+ import { Model, type LiteralUnion, type ThinkingLevel } from './model';
5
+ import { Session, Turn, type TurnEvent } from './session';
6
+ import { Skill } from './skill';
7
+ import type { ModelStreamEvent } from './stream';
8
+ import { Tool, type CreateMessageParams, type CreateMessageResponse, type SearchHit, type SearchOptions, type SessionState, type StopReason, type ToolContext, type ToolRegistry } from './tool';
9
+ export { Agent, Model, Session, Skill, Tool, Turn, type CreateMessageParams, type CreateMessageResponse, type LiteralUnion, type McpClient, type Message, type ModelStreamEvent, type SearchHit, type SearchOptions, type SessionState, type StopReason, type TextPart, type ThinkingLevel, type ThinkingPart, type ToolCallPart, type ToolContext, type ToolRegistry, type ToolResultPart, type TurnEvent, };
package/core/mcp.d.ts ADDED
@@ -0,0 +1,6 @@
1
+ import type { Tool } from './tool';
2
+ interface McpClient {
3
+ connect(): Promise<Tool[]>;
4
+ disconnect(): Promise<void>;
5
+ }
6
+ export type { McpClient };
@@ -0,0 +1,36 @@
1
+ type TextPart = {
2
+ type: 'text';
3
+ text: string;
4
+ };
5
+ type ThinkingPart = {
6
+ type: 'thinking';
7
+ text: string;
8
+ signature?: string;
9
+ redactedData?: string;
10
+ };
11
+ type ToolCallPart = {
12
+ type: 'tool-call';
13
+ toolCallId: string;
14
+ toolName: string;
15
+ input: unknown;
16
+ };
17
+ type ToolResultPart = {
18
+ type: 'tool-result';
19
+ toolCallId: string;
20
+ toolName: string;
21
+ output: unknown;
22
+ };
23
+ type Message = {
24
+ role: 'system';
25
+ content: string;
26
+ } | {
27
+ role: 'user';
28
+ content: string | TextPart[];
29
+ } | {
30
+ role: 'assistant';
31
+ content: (TextPart | ThinkingPart | ToolCallPart)[];
32
+ } | {
33
+ role: 'tool';
34
+ content: ToolResultPart[];
35
+ };
36
+ export type { TextPart, ThinkingPart, ToolCallPart, ToolResultPart, Message };
@@ -0,0 +1,10 @@
1
+ import type { ModelStreamEvent } from './stream';
2
+ import type { CreateMessageParams, CreateMessageResponse, SearchHit, SearchOptions } from './tool';
3
+ type LiteralUnion<T extends string> = T | (string & {});
4
+ type ThinkingLevel = 'off' | 'minimal' | 'low' | 'medium' | 'high' | 'xhigh';
5
+ declare abstract class Model {
6
+ abstract streamMessage(params: CreateMessageParams): AsyncIterable<ModelStreamEvent>;
7
+ abstract searchWeb(query: string, opts?: SearchOptions): Promise<SearchHit[]>;
8
+ createMessage(params: CreateMessageParams): Promise<CreateMessageResponse>;
9
+ }
10
+ export { Model, type LiteralUnion, type ThinkingLevel };
@@ -0,0 +1,75 @@
1
+ import type { Message, TextPart } from './message';
2
+ type TurnEvent = {
3
+ type: 'message-start';
4
+ } | {
5
+ type: 'text-delta';
6
+ text: string;
7
+ } | {
8
+ type: 'text';
9
+ text: string;
10
+ } | {
11
+ type: 'thinking-delta';
12
+ text: string;
13
+ } | {
14
+ type: 'thinking';
15
+ text: string;
16
+ signature?: string;
17
+ } | {
18
+ type: 'tool-call';
19
+ toolCallId: string;
20
+ toolName: string;
21
+ input: unknown;
22
+ } | {
23
+ type: 'tool-result';
24
+ toolCallId: string;
25
+ toolName: string;
26
+ output: unknown;
27
+ isError: boolean;
28
+ } | {
29
+ type: 'message-end';
30
+ usage: {
31
+ inputTokens: number;
32
+ outputTokens: number;
33
+ };
34
+ } | {
35
+ type: 'turn-end';
36
+ } | {
37
+ type: 'error';
38
+ error: Error;
39
+ };
40
+ type TurnEmit = (event: TurnEvent) => void;
41
+ interface TurnRunContext {
42
+ emit: TurnEmit;
43
+ signal: AbortSignal;
44
+ }
45
+ type TurnRunner = (ctx: TurnRunContext) => Promise<Message[]>;
46
+ declare class Turn implements AsyncIterable<TurnEvent>, PromiseLike<Message[]> {
47
+ private queue;
48
+ private waiters;
49
+ private ended;
50
+ private iterated;
51
+ private resultPromise;
52
+ private abortController;
53
+ constructor(runner: TurnRunner);
54
+ private emit;
55
+ private close;
56
+ abort(reason?: string): void;
57
+ [Symbol.asyncIterator](): AsyncIterator<TurnEvent>;
58
+ then<TResult1 = Message[], TResult2 = never>(onfulfilled?: ((value: Message[]) => TResult1 | PromiseLike<TResult1>) | null | undefined, onrejected?: ((reason: unknown) => TResult2 | PromiseLike<TResult2>) | null | undefined): PromiseLike<TResult1 | TResult2>;
59
+ }
60
+ interface SessionInternals {
61
+ send(prompt: string | TextPart[]): Turn;
62
+ close(): Promise<void>;
63
+ }
64
+ declare class Session implements AsyncDisposable {
65
+ private internals;
66
+ private state;
67
+ constructor(internals: SessionInternals, state: {
68
+ messages: Message[];
69
+ });
70
+ get messages(): readonly Message[];
71
+ send(prompt: string | TextPart[]): Turn;
72
+ close(): Promise<void>;
73
+ [Symbol.asyncDispose](): Promise<void>;
74
+ }
75
+ export { Session, Turn, type SessionInternals, type TurnEmit, type TurnEvent, type TurnRunContext, type TurnRunner, };
@@ -0,0 +1,11 @@
1
+ declare class Skill {
2
+ name: string;
3
+ description: string;
4
+ content: string;
5
+ constructor({ name, description, content, }: {
6
+ name: string;
7
+ description: string;
8
+ content: string;
9
+ });
10
+ }
11
+ export { Skill };
@@ -0,0 +1,33 @@
1
+ import type { TextPart, ThinkingPart, ToolCallPart } from './message';
2
+ import type { StopReason } from './tool';
3
+ type ModelStreamEvent = {
4
+ type: 'text-delta';
5
+ text: string;
6
+ } | {
7
+ type: 'text-end';
8
+ text: string;
9
+ } | {
10
+ type: 'thinking-delta';
11
+ text: string;
12
+ } | {
13
+ type: 'thinking-end';
14
+ text: string;
15
+ signature?: string;
16
+ redactedData?: string;
17
+ } | {
18
+ type: 'tool-call';
19
+ toolCallId: string;
20
+ toolName: string;
21
+ input: unknown;
22
+ } | {
23
+ type: 'message-end';
24
+ id: string;
25
+ stopReason: StopReason;
26
+ usage: {
27
+ inputTokens: number;
28
+ outputTokens: number;
29
+ };
30
+ };
31
+ type AssistantContentPart = TextPart | ThinkingPart | ToolCallPart;
32
+ declare function readSse(response: Response): AsyncGenerator<unknown>;
33
+ export { readSse, type AssistantContentPart, type ModelStreamEvent };
package/core/tool.d.ts ADDED
@@ -0,0 +1,77 @@
1
+ import * as z4 from 'zod/v4/core';
2
+ import type { Message, TextPart, ThinkingPart, ToolCallPart } from './message';
3
+ type MaybePromise<T> = T | Promise<T>;
4
+ type StopReason = 'end_turn' | 'tool_use' | 'max_tokens' | 'stop_sequence' | 'pause_turn' | 'refusal';
5
+ interface SessionState {
6
+ messages: Message[];
7
+ store: Map<string, unknown>;
8
+ }
9
+ interface ToolRegistry {
10
+ loaded(): Tool[];
11
+ deferred(): Tool[];
12
+ load(names: string[]): {
13
+ loaded: Tool[];
14
+ missing: string[];
15
+ };
16
+ }
17
+ interface SearchHit {
18
+ title: string;
19
+ url?: string;
20
+ pageAge?: string;
21
+ text?: string;
22
+ }
23
+ interface SearchOptions {
24
+ allowedDomains?: string[];
25
+ blockedDomains?: string[];
26
+ maxUses?: number;
27
+ }
28
+ interface CreateMessageParams {
29
+ messages: Message[];
30
+ tools?: Tool[];
31
+ maxTokens?: number;
32
+ signal?: AbortSignal;
33
+ }
34
+ interface CreateMessageResponse {
35
+ id: string;
36
+ content: (TextPart | ThinkingPart | ToolCallPart)[];
37
+ stopReason: StopReason;
38
+ usage: {
39
+ inputTokens: number;
40
+ outputTokens: number;
41
+ };
42
+ }
43
+ interface ToolContext {
44
+ complete(prompt: string): Promise<string>;
45
+ searchWeb(query: string, opts?: SearchOptions): Promise<SearchHit[]>;
46
+ session: SessionState;
47
+ tools: ToolRegistry;
48
+ cwd: string;
49
+ }
50
+ type ZodToolInit<TSchema extends z4.$ZodType, TResult> = {
51
+ name: string;
52
+ description: string;
53
+ inputSchema: TSchema;
54
+ execute: (input: z4.output<TSchema>, ctx: ToolContext) => MaybePromise<TResult>;
55
+ deferred?: boolean;
56
+ };
57
+ type RawToolInit<TResult> = {
58
+ name: string;
59
+ description: string;
60
+ jsonSchema: object;
61
+ execute: (input: unknown, ctx: ToolContext) => MaybePromise<TResult>;
62
+ deferred?: boolean;
63
+ };
64
+ declare class Tool<TSchema extends z4.$ZodType = z4.$ZodType, TResult = unknown> {
65
+ name: string;
66
+ description: string;
67
+ inputSchema?: TSchema;
68
+ jsonSchema?: object;
69
+ execute: (input: unknown, ctx: ToolContext) => MaybePromise<TResult>;
70
+ deferred: boolean;
71
+ constructor(init: ZodToolInit<TSchema, TResult>);
72
+ constructor(init: RawToolInit<TResult>);
73
+ toJsonSchema(): object;
74
+ parse(input: unknown): unknown;
75
+ }
76
+ declare function createRegistry(tools: Tool[]): ToolRegistry;
77
+ export { Tool, createRegistry, type CreateMessageParams, type CreateMessageResponse, type SearchHit, type SearchOptions, type SessionState, type StopReason, type ToolContext, type ToolRegistry, };
package/env.d.ts ADDED
@@ -0,0 +1,8 @@
1
+ export declare const env: {
2
+ readonly anthropicApiKey: string | undefined;
3
+ readonly geminiApiKey: string | undefined;
4
+ readonly moonshotApiKey: string | undefined;
5
+ readonly openaiApiKey: string | undefined;
6
+ readonly openaiCodexAuthFile: string | undefined;
7
+ readonly codexHome: string | undefined;
8
+ };
@@ -0,0 +1,3 @@
1
+ import { Harness } from './core';
2
+ declare const harness: Harness;
3
+ export default harness;
@@ -0,0 +1,3 @@
1
+ import { Harness } from './core';
2
+ declare const harness: Harness;
3
+ export default harness;
@@ -0,0 +1,7 @@
1
+ import type { Tool } from '../core';
2
+ declare class Harness {
3
+ system: string;
4
+ tools: Tool[];
5
+ constructor(system: string, tools: Tool[]);
6
+ }
7
+ export { Harness };
@@ -0,0 +1,5 @@
1
+ import claudeCode from './claudeCode';
2
+ import codex from './codex';
3
+ import pi from './pi';
4
+ import { bash, editFile, readFile, webFetch, webSearch, writeFile } from './tools';
5
+ export { bash, claudeCode, codex, editFile, pi, readFile, webFetch, webSearch, writeFile, };