lark-agent-bridge 0.1.39
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.
- package/LICENSE +21 -0
- package/README.md +265 -0
- package/README.zh.md +265 -0
- package/bin/lark-agent-bridge.mjs +2 -0
- package/dist/agent/cursor/cursor-sdk-worker.js +702 -0
- package/dist/cli.js +7588 -0
- package/dist/index.d.ts +113 -0
- package/dist/index.js +721 -0
- package/package.json +72 -0
- package/vendor/cursor-sdk/LICENSE.md +3 -0
- package/vendor/cursor-sdk/README.md +23 -0
- package/vendor/cursor-sdk/dist/cjs/642.index.js +1 -0
- package/vendor/cursor-sdk/dist/cjs/agent.d.ts +170 -0
- package/vendor/cursor-sdk/dist/cjs/agent.d.ts.map +1 -0
- package/vendor/cursor-sdk/dist/cjs/analytics.d.ts +98 -0
- package/vendor/cursor-sdk/dist/cjs/analytics.d.ts.map +1 -0
- package/vendor/cursor-sdk/dist/cjs/artifacts.d.ts +6 -0
- package/vendor/cursor-sdk/dist/cjs/artifacts.d.ts.map +1 -0
- package/vendor/cursor-sdk/dist/cjs/cloud-agent.d.ts +47 -0
- package/vendor/cursor-sdk/dist/cjs/cloud-agent.d.ts.map +1 -0
- package/vendor/cursor-sdk/dist/cjs/cloud-api-client.d.ts +197 -0
- package/vendor/cursor-sdk/dist/cjs/cloud-api-client.d.ts.map +1 -0
- package/vendor/cursor-sdk/dist/cjs/cloud-executor.d.ts +14 -0
- package/vendor/cursor-sdk/dist/cjs/cloud-executor.d.ts.map +1 -0
- package/vendor/cursor-sdk/dist/cjs/cloud-mcp-utils.d.ts +4 -0
- package/vendor/cursor-sdk/dist/cjs/cloud-mcp-utils.d.ts.map +1 -0
- package/vendor/cursor-sdk/dist/cjs/core-adapter.d.ts +2 -0
- package/vendor/cursor-sdk/dist/cjs/core-adapter.d.ts.map +1 -0
- package/vendor/cursor-sdk/dist/cjs/errors.d.ts +135 -0
- package/vendor/cursor-sdk/dist/cjs/errors.d.ts.map +1 -0
- package/vendor/cursor-sdk/dist/cjs/executor-common.d.ts +16 -0
- package/vendor/cursor-sdk/dist/cjs/executor-common.d.ts.map +1 -0
- package/vendor/cursor-sdk/dist/cjs/executor-types.d.ts +65 -0
- package/vendor/cursor-sdk/dist/cjs/executor-types.d.ts.map +1 -0
- package/vendor/cursor-sdk/dist/cjs/index.d.ts +18 -0
- package/vendor/cursor-sdk/dist/cjs/index.d.ts.map +1 -0
- package/vendor/cursor-sdk/dist/cjs/index.js +8 -0
- package/vendor/cursor-sdk/dist/cjs/index.js.LICENSE.txt +285 -0
- package/vendor/cursor-sdk/dist/cjs/local-executor.d.ts +18 -0
- package/vendor/cursor-sdk/dist/cjs/local-executor.d.ts.map +1 -0
- package/vendor/cursor-sdk/dist/cjs/local-model-validation.d.ts +6 -0
- package/vendor/cursor-sdk/dist/cjs/local-model-validation.d.ts.map +1 -0
- package/vendor/cursor-sdk/dist/cjs/messages.d.ts +110 -0
- package/vendor/cursor-sdk/dist/cjs/messages.d.ts.map +1 -0
- package/vendor/cursor-sdk/dist/cjs/options.d.ts +145 -0
- package/vendor/cursor-sdk/dist/cjs/options.d.ts.map +1 -0
- package/vendor/cursor-sdk/dist/cjs/package.json +3 -0
- package/vendor/cursor-sdk/dist/cjs/platform.d.ts +71 -0
- package/vendor/cursor-sdk/dist/cjs/platform.d.ts.map +1 -0
- package/vendor/cursor-sdk/dist/cjs/prefetched-blobs.d.ts +13 -0
- package/vendor/cursor-sdk/dist/cjs/prefetched-blobs.d.ts.map +1 -0
- package/vendor/cursor-sdk/dist/cjs/public-api.d.ts +12 -0
- package/vendor/cursor-sdk/dist/cjs/public-api.d.ts.map +1 -0
- package/vendor/cursor-sdk/dist/cjs/run-event-tailer.d.ts +33 -0
- package/vendor/cursor-sdk/dist/cjs/run-event-tailer.d.ts.map +1 -0
- package/vendor/cursor-sdk/dist/cjs/run-interaction-accumulator.d.ts +33 -0
- package/vendor/cursor-sdk/dist/cjs/run-interaction-accumulator.d.ts.map +1 -0
- package/vendor/cursor-sdk/dist/cjs/run.d.ts +44 -0
- package/vendor/cursor-sdk/dist/cjs/run.d.ts.map +1 -0
- package/vendor/cursor-sdk/dist/cjs/sdk-statsig.d.ts +10 -0
- package/vendor/cursor-sdk/dist/cjs/sdk-statsig.d.ts.map +1 -0
- package/vendor/cursor-sdk/dist/cjs/stubs.d.ts +98 -0
- package/vendor/cursor-sdk/dist/cjs/stubs.d.ts.map +1 -0
- package/vendor/cursor-sdk/dist/cjs/subagent-conversion.d.ts +22 -0
- package/vendor/cursor-sdk/dist/cjs/subagent-conversion.d.ts.map +1 -0
- package/vendor/cursor-sdk/dist/cjs/tool-call-utils.d.ts +7 -0
- package/vendor/cursor-sdk/dist/cjs/tool-call-utils.d.ts.map +1 -0
- package/vendor/cursor-sdk/dist/cjs/types/conversation-types.d.ts +12062 -0
- package/vendor/cursor-sdk/dist/cjs/types/conversation-types.d.ts.map +1 -0
- package/vendor/cursor-sdk/dist/cjs/types/delta-types.d.ts +2 -0
- package/vendor/cursor-sdk/dist/cjs/types/delta-types.d.ts.map +1 -0
- package/vendor/cursor-sdk/dist/cjs/types/tool-call-types.d.ts +2 -0
- package/vendor/cursor-sdk/dist/cjs/types/tool-call-types.d.ts.map +1 -0
- package/vendor/cursor-sdk/dist/cjs/utils/conversation-utils.d.ts +3 -0
- package/vendor/cursor-sdk/dist/cjs/utils/conversation-utils.d.ts.map +1 -0
- package/vendor/cursor-sdk/dist/cjs/utils/logger.d.ts +12 -0
- package/vendor/cursor-sdk/dist/cjs/utils/logger.d.ts.map +1 -0
- package/vendor/cursor-sdk/dist/cjs/utils/message-schemas.d.ts +2 -0
- package/vendor/cursor-sdk/dist/cjs/utils/message-schemas.d.ts.map +1 -0
- package/vendor/cursor-sdk/dist/esm/642.index.js +1 -0
- package/vendor/cursor-sdk/dist/esm/agent.d.ts +170 -0
- package/vendor/cursor-sdk/dist/esm/agent.d.ts.map +1 -0
- package/vendor/cursor-sdk/dist/esm/analytics.d.ts +98 -0
- package/vendor/cursor-sdk/dist/esm/analytics.d.ts.map +1 -0
- package/vendor/cursor-sdk/dist/esm/artifacts.d.ts +6 -0
- package/vendor/cursor-sdk/dist/esm/artifacts.d.ts.map +1 -0
- package/vendor/cursor-sdk/dist/esm/cloud-agent.d.ts +47 -0
- package/vendor/cursor-sdk/dist/esm/cloud-agent.d.ts.map +1 -0
- package/vendor/cursor-sdk/dist/esm/cloud-api-client.d.ts +197 -0
- package/vendor/cursor-sdk/dist/esm/cloud-api-client.d.ts.map +1 -0
- package/vendor/cursor-sdk/dist/esm/cloud-executor.d.ts +14 -0
- package/vendor/cursor-sdk/dist/esm/cloud-executor.d.ts.map +1 -0
- package/vendor/cursor-sdk/dist/esm/cloud-mcp-utils.d.ts +4 -0
- package/vendor/cursor-sdk/dist/esm/cloud-mcp-utils.d.ts.map +1 -0
- package/vendor/cursor-sdk/dist/esm/core-adapter.d.ts +2 -0
- package/vendor/cursor-sdk/dist/esm/core-adapter.d.ts.map +1 -0
- package/vendor/cursor-sdk/dist/esm/errors.d.ts +135 -0
- package/vendor/cursor-sdk/dist/esm/errors.d.ts.map +1 -0
- package/vendor/cursor-sdk/dist/esm/executor-common.d.ts +16 -0
- package/vendor/cursor-sdk/dist/esm/executor-common.d.ts.map +1 -0
- package/vendor/cursor-sdk/dist/esm/executor-types.d.ts +65 -0
- package/vendor/cursor-sdk/dist/esm/executor-types.d.ts.map +1 -0
- package/vendor/cursor-sdk/dist/esm/index.d.ts +18 -0
- package/vendor/cursor-sdk/dist/esm/index.d.ts.map +1 -0
- package/vendor/cursor-sdk/dist/esm/index.js +8 -0
- package/vendor/cursor-sdk/dist/esm/index.js.LICENSE.txt +285 -0
- package/vendor/cursor-sdk/dist/esm/local-executor.d.ts +18 -0
- package/vendor/cursor-sdk/dist/esm/local-executor.d.ts.map +1 -0
- package/vendor/cursor-sdk/dist/esm/local-model-validation.d.ts +6 -0
- package/vendor/cursor-sdk/dist/esm/local-model-validation.d.ts.map +1 -0
- package/vendor/cursor-sdk/dist/esm/messages.d.ts +110 -0
- package/vendor/cursor-sdk/dist/esm/messages.d.ts.map +1 -0
- package/vendor/cursor-sdk/dist/esm/options.d.ts +145 -0
- package/vendor/cursor-sdk/dist/esm/options.d.ts.map +1 -0
- package/vendor/cursor-sdk/dist/esm/platform.d.ts +71 -0
- package/vendor/cursor-sdk/dist/esm/platform.d.ts.map +1 -0
- package/vendor/cursor-sdk/dist/esm/prefetched-blobs.d.ts +13 -0
- package/vendor/cursor-sdk/dist/esm/prefetched-blobs.d.ts.map +1 -0
- package/vendor/cursor-sdk/dist/esm/public-api.d.ts +12 -0
- package/vendor/cursor-sdk/dist/esm/public-api.d.ts.map +1 -0
- package/vendor/cursor-sdk/dist/esm/run-event-tailer.d.ts +33 -0
- package/vendor/cursor-sdk/dist/esm/run-event-tailer.d.ts.map +1 -0
- package/vendor/cursor-sdk/dist/esm/run-interaction-accumulator.d.ts +33 -0
- package/vendor/cursor-sdk/dist/esm/run-interaction-accumulator.d.ts.map +1 -0
- package/vendor/cursor-sdk/dist/esm/run.d.ts +44 -0
- package/vendor/cursor-sdk/dist/esm/run.d.ts.map +1 -0
- package/vendor/cursor-sdk/dist/esm/sdk-statsig.d.ts +10 -0
- package/vendor/cursor-sdk/dist/esm/sdk-statsig.d.ts.map +1 -0
- package/vendor/cursor-sdk/dist/esm/stubs.d.ts +98 -0
- package/vendor/cursor-sdk/dist/esm/stubs.d.ts.map +1 -0
- package/vendor/cursor-sdk/dist/esm/subagent-conversion.d.ts +22 -0
- package/vendor/cursor-sdk/dist/esm/subagent-conversion.d.ts.map +1 -0
- package/vendor/cursor-sdk/dist/esm/tool-call-utils.d.ts +7 -0
- package/vendor/cursor-sdk/dist/esm/tool-call-utils.d.ts.map +1 -0
- package/vendor/cursor-sdk/dist/esm/types/conversation-types.d.ts +12062 -0
- package/vendor/cursor-sdk/dist/esm/types/conversation-types.d.ts.map +1 -0
- package/vendor/cursor-sdk/dist/esm/types/delta-types.d.ts +2 -0
- package/vendor/cursor-sdk/dist/esm/types/delta-types.d.ts.map +1 -0
- package/vendor/cursor-sdk/dist/esm/types/tool-call-types.d.ts +2 -0
- package/vendor/cursor-sdk/dist/esm/types/tool-call-types.d.ts.map +1 -0
- package/vendor/cursor-sdk/dist/esm/utils/conversation-utils.d.ts +3 -0
- package/vendor/cursor-sdk/dist/esm/utils/conversation-utils.d.ts.map +1 -0
- package/vendor/cursor-sdk/dist/esm/utils/logger.d.ts +12 -0
- package/vendor/cursor-sdk/dist/esm/utils/logger.d.ts.map +1 -0
- package/vendor/cursor-sdk/dist/esm/utils/message-schemas.d.ts +2 -0
- package/vendor/cursor-sdk/dist/esm/utils/message-schemas.d.ts.map +1 -0
- package/vendor/cursor-sdk/package.json +77 -0
- package/vendor/cursor-sdk-linux-x64/README.md +5 -0
- package/vendor/cursor-sdk-linux-x64/bin/cursorsandbox +0 -0
- package/vendor/cursor-sdk-linux-x64/bin/rg +0 -0
- package/vendor/cursor-sdk-linux-x64/package.json +8 -0
- package/vendor/package/README.md +5 -0
- package/vendor/package/bin/cursorsandbox +0 -0
- package/vendor/package/bin/rg +0 -0
- package/vendor/package/package.json +25 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
type AgentEvent = {
|
|
2
|
+
type: 'system';
|
|
3
|
+
sessionId?: string;
|
|
4
|
+
cwd?: string;
|
|
5
|
+
model?: string;
|
|
6
|
+
} | {
|
|
7
|
+
type: 'text';
|
|
8
|
+
delta: string;
|
|
9
|
+
} | {
|
|
10
|
+
type: 'thinking';
|
|
11
|
+
delta: string;
|
|
12
|
+
} | {
|
|
13
|
+
type: 'progress';
|
|
14
|
+
label: string;
|
|
15
|
+
detail?: string;
|
|
16
|
+
phase?: 'starting' | 'thinking' | 'tool_running' | 'streaming';
|
|
17
|
+
} | {
|
|
18
|
+
type: 'tool_use';
|
|
19
|
+
id: string;
|
|
20
|
+
name: string;
|
|
21
|
+
input: unknown;
|
|
22
|
+
} | {
|
|
23
|
+
type: 'tool_result';
|
|
24
|
+
id: string;
|
|
25
|
+
output: string;
|
|
26
|
+
isError: boolean;
|
|
27
|
+
} | {
|
|
28
|
+
type: 'usage';
|
|
29
|
+
inputTokens?: number;
|
|
30
|
+
outputTokens?: number;
|
|
31
|
+
costUsd?: number;
|
|
32
|
+
} | {
|
|
33
|
+
type: 'done';
|
|
34
|
+
sessionId?: string;
|
|
35
|
+
} | {
|
|
36
|
+
type: 'error';
|
|
37
|
+
message: string;
|
|
38
|
+
fatal?: boolean;
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
type ToolStatus = 'running' | 'done' | 'error';
|
|
42
|
+
interface ToolEntry {
|
|
43
|
+
id: string;
|
|
44
|
+
name: string;
|
|
45
|
+
input: unknown;
|
|
46
|
+
status: ToolStatus;
|
|
47
|
+
output?: string;
|
|
48
|
+
}
|
|
49
|
+
type TodoStatus = 'pending' | 'in_progress' | 'completed' | 'cancelled';
|
|
50
|
+
interface TodoItem {
|
|
51
|
+
id: string;
|
|
52
|
+
content: string;
|
|
53
|
+
status: TodoStatus;
|
|
54
|
+
}
|
|
55
|
+
type Block = {
|
|
56
|
+
kind: 'text';
|
|
57
|
+
content: string;
|
|
58
|
+
streaming: boolean;
|
|
59
|
+
} | {
|
|
60
|
+
kind: 'tool';
|
|
61
|
+
tool: ToolEntry;
|
|
62
|
+
};
|
|
63
|
+
type FooterStatus = 'starting' | 'thinking' | 'tool_running' | 'streaming' | null;
|
|
64
|
+
type ActivityEntry = {
|
|
65
|
+
kind: 'phase';
|
|
66
|
+
phase: Exclude<FooterStatus, null>;
|
|
67
|
+
label?: string;
|
|
68
|
+
detail?: string;
|
|
69
|
+
} | {
|
|
70
|
+
kind: 'tool';
|
|
71
|
+
tool: ToolEntry;
|
|
72
|
+
};
|
|
73
|
+
type Terminal = 'running' | 'done' | 'interrupted' | 'error' | 'idle_timeout';
|
|
74
|
+
interface RunState {
|
|
75
|
+
runId?: string;
|
|
76
|
+
blocks: Block[];
|
|
77
|
+
todos: TodoItem[];
|
|
78
|
+
reasoning: {
|
|
79
|
+
content: string;
|
|
80
|
+
active: boolean;
|
|
81
|
+
};
|
|
82
|
+
footer: FooterStatus;
|
|
83
|
+
activity?: ActivityEntry;
|
|
84
|
+
terminal: Terminal;
|
|
85
|
+
errorMsg?: string;
|
|
86
|
+
startedAt: number;
|
|
87
|
+
updatedAt: number;
|
|
88
|
+
lastActivityAt: number;
|
|
89
|
+
/** Set when terminal === 'idle_timeout' — how long claude was idle before
|
|
90
|
+
* the watchdog gave up (so the message can say "N 分钟无响应"). */
|
|
91
|
+
idleTimeoutMinutes?: number;
|
|
92
|
+
}
|
|
93
|
+
declare function createInitialState(runId?: string): RunState;
|
|
94
|
+
declare const initialState: RunState;
|
|
95
|
+
declare function reduce(state: RunState, evt: AgentEvent): RunState;
|
|
96
|
+
declare function markInterrupted(state: RunState): RunState;
|
|
97
|
+
declare function finalizeIfRunning(state: RunState): RunState;
|
|
98
|
+
|
|
99
|
+
declare function renderCard(state: RunState): object;
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Render `RunState` as plain markdown text — used in `messageReply: 'text'`
|
|
103
|
+
* mode where we stream a markdown message instead of a card.
|
|
104
|
+
*
|
|
105
|
+
* Differences vs `renderCard`:
|
|
106
|
+
* - No collapsible panels, no buttons (markdown messages have neither)
|
|
107
|
+
* - Tool calls collapse to a single short line each (no body)
|
|
108
|
+
* - No reasoning / thinking output (no place to fold it; would be noise)
|
|
109
|
+
* - Footer is appended inline at the bottom while running
|
|
110
|
+
*/
|
|
111
|
+
declare function renderText(state: RunState): string;
|
|
112
|
+
|
|
113
|
+
export { type Block, type FooterStatus, type RunState, type Terminal, type TodoItem, type TodoStatus, type ToolEntry, type ToolStatus, createInitialState, finalizeIfRunning, initialState, markInterrupted, reduce, renderCard, renderText };
|