opensober 0.1.0

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 (79) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +147 -0
  3. package/README.zh-CN.md +144 -0
  4. package/dist/cli/doctor.d.ts +11 -0
  5. package/dist/cli/doctor.d.ts.map +1 -0
  6. package/dist/cli/format-error.d.ts +3 -0
  7. package/dist/cli/format-error.d.ts.map +1 -0
  8. package/dist/cli/index.d.ts +3 -0
  9. package/dist/cli/index.d.ts.map +1 -0
  10. package/dist/cli/index.js +29606 -0
  11. package/dist/cli/run.d.ts +15 -0
  12. package/dist/cli/run.d.ts.map +1 -0
  13. package/dist/config/defaults.d.ts +6 -0
  14. package/dist/config/defaults.d.ts.map +1 -0
  15. package/dist/config/discovery.d.ts +30 -0
  16. package/dist/config/discovery.d.ts.map +1 -0
  17. package/dist/config/extends.d.ts +25 -0
  18. package/dist/config/extends.d.ts.map +1 -0
  19. package/dist/config/loader.d.ts +9 -0
  20. package/dist/config/loader.d.ts.map +1 -0
  21. package/dist/config/merge.d.ts +10 -0
  22. package/dist/config/merge.d.ts.map +1 -0
  23. package/dist/config/prompt-source.d.ts +24 -0
  24. package/dist/config/prompt-source.d.ts.map +1 -0
  25. package/dist/config/schema.d.ts +127 -0
  26. package/dist/config/schema.d.ts.map +1 -0
  27. package/dist/config/types.d.ts +24 -0
  28. package/dist/config/types.d.ts.map +1 -0
  29. package/dist/hooks/context-injection.d.ts +25 -0
  30. package/dist/hooks/context-injection.d.ts.map +1 -0
  31. package/dist/hooks/index.d.ts +3 -0
  32. package/dist/hooks/index.d.ts.map +1 -0
  33. package/dist/hooks/truncation.d.ts +6 -0
  34. package/dist/hooks/truncation.d.ts.map +1 -0
  35. package/dist/index.d.ts +5 -0
  36. package/dist/index.d.ts.map +1 -0
  37. package/dist/index.js +28250 -0
  38. package/dist/meta.d.ts +3 -0
  39. package/dist/meta.d.ts.map +1 -0
  40. package/dist/opensober.schema.json +304 -0
  41. package/dist/plugin/register-agents.d.ts +4 -0
  42. package/dist/plugin/register-agents.d.ts.map +1 -0
  43. package/dist/shared/log.d.ts +9 -0
  44. package/dist/shared/log.d.ts.map +1 -0
  45. package/dist/tools/ast-grep/ast-grep-replace.d.ts +4 -0
  46. package/dist/tools/ast-grep/ast-grep-replace.d.ts.map +1 -0
  47. package/dist/tools/ast-grep/ast-grep-search.d.ts +4 -0
  48. package/dist/tools/ast-grep/ast-grep-search.d.ts.map +1 -0
  49. package/dist/tools/common/auth.d.ts +6 -0
  50. package/dist/tools/common/auth.d.ts.map +1 -0
  51. package/dist/tools/common/format.d.ts +17 -0
  52. package/dist/tools/common/format.d.ts.map +1 -0
  53. package/dist/tools/common/guards.d.ts +19 -0
  54. package/dist/tools/common/guards.d.ts.map +1 -0
  55. package/dist/tools/edit/edit.d.ts +4 -0
  56. package/dist/tools/edit/edit.d.ts.map +1 -0
  57. package/dist/tools/glob/glob.d.ts +4 -0
  58. package/dist/tools/glob/glob.d.ts.map +1 -0
  59. package/dist/tools/grep/grep.d.ts +4 -0
  60. package/dist/tools/grep/grep.d.ts.map +1 -0
  61. package/dist/tools/hashline-edit/annotate.d.ts +9 -0
  62. package/dist/tools/hashline-edit/annotate.d.ts.map +1 -0
  63. package/dist/tools/hashline-edit/apply.d.ts +22 -0
  64. package/dist/tools/hashline-edit/apply.d.ts.map +1 -0
  65. package/dist/tools/hashline-edit/file-meta.d.ts +13 -0
  66. package/dist/tools/hashline-edit/file-meta.d.ts.map +1 -0
  67. package/dist/tools/hashline-edit/hash.d.ts +3 -0
  68. package/dist/tools/hashline-edit/hash.d.ts.map +1 -0
  69. package/dist/tools/hashline-edit/index.d.ts +5 -0
  70. package/dist/tools/hashline-edit/index.d.ts.map +1 -0
  71. package/dist/tools/index.d.ts +16 -0
  72. package/dist/tools/index.d.ts.map +1 -0
  73. package/dist/tools/read/read.d.ts +4 -0
  74. package/dist/tools/read/read.d.ts.map +1 -0
  75. package/dist/tools/task/runner.d.ts +37 -0
  76. package/dist/tools/task/runner.d.ts.map +1 -0
  77. package/dist/tools/task/task.d.ts +5 -0
  78. package/dist/tools/task/task.d.ts.map +1 -0
  79. package/package.json +77 -0
package/dist/meta.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ export declare const NAME = "opensober";
2
+ export declare const VERSION = "0.1.0";
3
+ //# sourceMappingURL=meta.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"meta.d.ts","sourceRoot":"","sources":["../src/meta.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,IAAI,cAAc,CAAA;AAC/B,eAAO,MAAM,OAAO,UAAU,CAAA"}
@@ -0,0 +1,304 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "type": "object",
4
+ "properties": {
5
+ "$schema": {
6
+ "type": "string"
7
+ },
8
+ "version": {
9
+ "default": 1,
10
+ "type": "number",
11
+ "const": 1
12
+ },
13
+ "model": {
14
+ "type": "string",
15
+ "minLength": 1
16
+ },
17
+ "agents": {
18
+ "default": {},
19
+ "type": "object",
20
+ "propertyNames": {
21
+ "type": "string",
22
+ "pattern": "^[a-z][a-z0-9-]*$"
23
+ },
24
+ "additionalProperties": {
25
+ "type": "object",
26
+ "properties": {
27
+ "extends": {
28
+ "type": "string",
29
+ "pattern": "^[a-z][a-z0-9-]*$"
30
+ },
31
+ "readonly": {
32
+ "type": "boolean"
33
+ },
34
+ "can_delegate": {
35
+ "type": "boolean"
36
+ },
37
+ "model": {
38
+ "type": "string",
39
+ "minLength": 1
40
+ },
41
+ "effort": {
42
+ "type": "string",
43
+ "enum": [
44
+ "low",
45
+ "medium",
46
+ "high"
47
+ ]
48
+ },
49
+ "thinking": {
50
+ "type": "object",
51
+ "properties": {
52
+ "type": {
53
+ "type": "string",
54
+ "const": "enabled"
55
+ },
56
+ "budgetTokens": {
57
+ "type": "integer",
58
+ "exclusiveMinimum": 0,
59
+ "maximum": 9007199254740991
60
+ }
61
+ },
62
+ "required": [
63
+ "type",
64
+ "budgetTokens"
65
+ ],
66
+ "additionalProperties": false
67
+ },
68
+ "prompt": {
69
+ "type": "string"
70
+ },
71
+ "prompt_append": {
72
+ "type": "string"
73
+ },
74
+ "tools": {
75
+ "type": "object",
76
+ "properties": {
77
+ "allow": {
78
+ "type": "array",
79
+ "items": {
80
+ "type": "string"
81
+ }
82
+ },
83
+ "deny": {
84
+ "type": "array",
85
+ "items": {
86
+ "type": "string"
87
+ }
88
+ }
89
+ },
90
+ "additionalProperties": false
91
+ },
92
+ "description": {
93
+ "type": "string"
94
+ }
95
+ },
96
+ "additionalProperties": false
97
+ }
98
+ },
99
+ "tools": {
100
+ "default": {
101
+ "disabled": []
102
+ },
103
+ "type": "object",
104
+ "properties": {
105
+ "hashline_edit": {
106
+ "type": "object",
107
+ "properties": {
108
+ "enabled": {
109
+ "default": true,
110
+ "type": "boolean"
111
+ },
112
+ "hash_algorithm": {
113
+ "default": "sha1",
114
+ "type": "string",
115
+ "enum": [
116
+ "sha1",
117
+ "sha256"
118
+ ]
119
+ },
120
+ "reject_on_stale": {
121
+ "default": true,
122
+ "type": "boolean"
123
+ },
124
+ "context_lines": {
125
+ "default": 3,
126
+ "type": "integer",
127
+ "minimum": 0,
128
+ "maximum": 20
129
+ }
130
+ },
131
+ "required": [
132
+ "enabled",
133
+ "hash_algorithm",
134
+ "reject_on_stale",
135
+ "context_lines"
136
+ ],
137
+ "additionalProperties": false
138
+ },
139
+ "disabled": {
140
+ "default": [],
141
+ "type": "array",
142
+ "items": {
143
+ "type": "string"
144
+ }
145
+ }
146
+ },
147
+ "required": [
148
+ "disabled"
149
+ ],
150
+ "additionalProperties": false
151
+ },
152
+ "hooks": {
153
+ "default": {
154
+ "disabled": []
155
+ },
156
+ "type": "object",
157
+ "properties": {
158
+ "disabled": {
159
+ "default": [],
160
+ "type": "array",
161
+ "items": {
162
+ "type": "string"
163
+ }
164
+ }
165
+ },
166
+ "required": [
167
+ "disabled"
168
+ ],
169
+ "additionalProperties": false
170
+ },
171
+ "mcp": {
172
+ "default": {
173
+ "disabled": []
174
+ },
175
+ "type": "object",
176
+ "properties": {
177
+ "disabled": {
178
+ "default": [],
179
+ "type": "array",
180
+ "items": {
181
+ "type": "string"
182
+ }
183
+ }
184
+ },
185
+ "required": [
186
+ "disabled"
187
+ ],
188
+ "additionalProperties": false
189
+ },
190
+ "skills": {
191
+ "default": {
192
+ "disabled": [],
193
+ "paths": []
194
+ },
195
+ "type": "object",
196
+ "properties": {
197
+ "disabled": {
198
+ "default": [],
199
+ "type": "array",
200
+ "items": {
201
+ "type": "string"
202
+ }
203
+ },
204
+ "paths": {
205
+ "default": [],
206
+ "type": "array",
207
+ "items": {
208
+ "type": "string"
209
+ }
210
+ }
211
+ },
212
+ "required": [
213
+ "disabled",
214
+ "paths"
215
+ ],
216
+ "additionalProperties": false
217
+ },
218
+ "claude_code": {
219
+ "default": {
220
+ "commands": true,
221
+ "skills": true,
222
+ "agents": true,
223
+ "mcp": true,
224
+ "hooks": true
225
+ },
226
+ "type": "object",
227
+ "properties": {
228
+ "commands": {
229
+ "default": true,
230
+ "type": "boolean"
231
+ },
232
+ "skills": {
233
+ "default": true,
234
+ "type": "boolean"
235
+ },
236
+ "agents": {
237
+ "default": true,
238
+ "type": "boolean"
239
+ },
240
+ "mcp": {
241
+ "default": true,
242
+ "type": "boolean"
243
+ },
244
+ "hooks": {
245
+ "default": true,
246
+ "type": "boolean"
247
+ }
248
+ },
249
+ "required": [
250
+ "commands",
251
+ "skills",
252
+ "agents",
253
+ "mcp",
254
+ "hooks"
255
+ ],
256
+ "additionalProperties": false
257
+ },
258
+ "logging": {
259
+ "default": {
260
+ "level": "info"
261
+ },
262
+ "type": "object",
263
+ "properties": {
264
+ "level": {
265
+ "default": "info",
266
+ "type": "string",
267
+ "enum": [
268
+ "debug",
269
+ "info",
270
+ "warn",
271
+ "error"
272
+ ]
273
+ },
274
+ "state_dir": {
275
+ "type": "string"
276
+ }
277
+ },
278
+ "required": [
279
+ "level"
280
+ ],
281
+ "additionalProperties": false
282
+ },
283
+ "experimental": {
284
+ "default": {},
285
+ "type": "object",
286
+ "propertyNames": {
287
+ "type": "string"
288
+ },
289
+ "additionalProperties": {}
290
+ }
291
+ },
292
+ "required": [
293
+ "version",
294
+ "agents",
295
+ "tools",
296
+ "hooks",
297
+ "mcp",
298
+ "skills",
299
+ "claude_code",
300
+ "logging",
301
+ "experimental"
302
+ ],
303
+ "additionalProperties": false
304
+ }
@@ -0,0 +1,4 @@
1
+ import type { Config } from "@opencode-ai/plugin";
2
+ import type { ResolvedConfig } from "../config/types";
3
+ export declare function registerAgents(openCodeConfig: Config, ourConfig: ResolvedConfig, configDir: string): void;
4
+ //# sourceMappingURL=register-agents.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"register-agents.d.ts","sourceRoot":"","sources":["../../src/plugin/register-agents.ts"],"names":[],"mappings":"AAuBA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAA;AAGjD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAA;AAOrD,wBAAgB,cAAc,CAC5B,cAAc,EAAE,MAAM,EACtB,SAAS,EAAE,cAAc,EACzB,SAAS,EAAE,MAAM,GAChB,IAAI,CAUN"}
@@ -0,0 +1,9 @@
1
+ export interface Logger {
2
+ readonly path: string;
3
+ debug(msg: string, data?: unknown): void;
4
+ info(msg: string, data?: unknown): void;
5
+ warn(msg: string, data?: unknown): void;
6
+ error(msg: string, data?: unknown): void;
7
+ }
8
+ export declare function createLogger(sessionId: string): Logger;
9
+ //# sourceMappingURL=log.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"log.d.ts","sourceRoot":"","sources":["../../src/shared/log.ts"],"names":[],"mappings":"AA4CA,MAAM,WAAW,MAAM;IACrB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,KAAK,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,GAAG,IAAI,CAAA;IACxC,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,GAAG,IAAI,CAAA;IACvC,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,GAAG,IAAI,CAAA;IACvC,KAAK,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,GAAG,IAAI,CAAA;CACzC;AAED,wBAAgB,YAAY,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CA0BtD"}
@@ -0,0 +1,4 @@
1
+ import { type ToolDefinition } from "@opencode-ai/plugin";
2
+ import type { ResolvedConfig } from "../../config/types";
3
+ export declare function createAstGrepReplaceTool(_config: ResolvedConfig): ToolDefinition;
4
+ //# sourceMappingURL=ast-grep-replace.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ast-grep-replace.d.ts","sourceRoot":"","sources":["../../../src/tools/ast-grep/ast-grep-replace.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,KAAK,cAAc,EAAQ,MAAM,qBAAqB,CAAA;AAC/D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA;AAoCxD,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,cAAc,GAAG,cAAc,CAqGhF"}
@@ -0,0 +1,4 @@
1
+ import { type ToolDefinition } from "@opencode-ai/plugin";
2
+ import type { ResolvedConfig } from "../../config/types";
3
+ export declare function createAstGrepSearchTool(_config: ResolvedConfig): ToolDefinition;
4
+ //# sourceMappingURL=ast-grep-search.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ast-grep-search.d.ts","sourceRoot":"","sources":["../../../src/tools/ast-grep/ast-grep-search.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,KAAK,cAAc,EAAQ,MAAM,qBAAqB,CAAA;AAC/D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA;AAiBxD,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,cAAc,GAAG,cAAc,CA0D/E"}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Inject HTTP Basic Auth into the opencode SDK client if OPENCODE_SERVER_PASSWORD
3
+ * is set. No-op otherwise. Tries 3 injection paths in order; warns on total failure.
4
+ */
5
+ export declare function injectServerAuth(client: unknown): void;
6
+ //# sourceMappingURL=auth.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../../src/tools/common/auth.ts"],"names":[],"mappings":"AAkEA;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI,CAkBtD"}
@@ -0,0 +1,17 @@
1
+ export declare function formatBytes(bytes: number): string;
2
+ export interface KVRow {
3
+ readonly key: string;
4
+ readonly value: string;
5
+ }
6
+ /**
7
+ * Render a block of `key: value` rows with a 2-space indent and keys right-padded
8
+ * so the values land in a single aligned column. Returns "" for an empty rows array.
9
+ */
10
+ export declare function formatKeyValueBlock(rows: readonly KVRow[], indent?: string): string;
11
+ /**
12
+ * Collapse whitespace and clamp to `maxLen` characters. If truncation happens,
13
+ * a single ellipsis ("…") is appended. Used for prompt/text previews where the
14
+ * full content would bloat a tool-output header.
15
+ */
16
+ export declare function truncatePreview(text: string, maxLen: number): string;
17
+ //# sourceMappingURL=format.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"format.d.ts","sourceRoot":"","sources":["../../../src/tools/common/format.ts"],"names":[],"mappings":"AASA,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAMjD;AAED,MAAM,WAAW,KAAK;IACpB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;IACpB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;CACvB;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,SAAS,KAAK,EAAE,EAAE,MAAM,SAAO,GAAG,MAAM,CASjF;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAIpE"}
@@ -0,0 +1,19 @@
1
+ import type { ResolvedConfig } from "../../config/types";
2
+ export declare class ToolPermissionError extends Error {
3
+ constructor(message: string);
4
+ }
5
+ /**
6
+ * Throws ToolPermissionError if the caller agent is readonly.
7
+ * Call this at the top of every write-class tool's execute().
8
+ */
9
+ export declare function assertCanWrite(callerAgent: string, config: ResolvedConfig): void;
10
+ /**
11
+ * Throws ToolPermissionError unless the caller is allowed to delegate to the target.
12
+ * Two checks, in this order:
13
+ * 1. caller.can_delegate === true
14
+ * 2. if caller.readonly === true, target.readonly must also be true
15
+ * (readonly taint — a readonly agent cannot escape its sandbox by delegating
16
+ * to a writable one).
17
+ */
18
+ export declare function assertCanDelegate(callerAgent: string, targetAgent: string, config: ResolvedConfig): void;
19
+ //# sourceMappingURL=guards.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"guards.d.ts","sourceRoot":"","sources":["../../../src/tools/common/guards.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA;AAExD,qBAAa,mBAAoB,SAAQ,KAAK;gBAChC,OAAO,EAAE,MAAM;CAI5B;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,cAAc,GAAG,IAAI,CAYhF;AAED;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAC/B,WAAW,EAAE,MAAM,EACnB,WAAW,EAAE,MAAM,EACnB,MAAM,EAAE,cAAc,GACrB,IAAI,CAsBN"}
@@ -0,0 +1,4 @@
1
+ import { type ToolDefinition } from "@opencode-ai/plugin";
2
+ import type { ResolvedConfig } from "../../config/types";
3
+ export declare function createEditTool(config: ResolvedConfig): ToolDefinition;
4
+ //# sourceMappingURL=edit.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"edit.d.ts","sourceRoot":"","sources":["../../../src/tools/edit/edit.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAE,KAAK,cAAc,EAAQ,MAAM,qBAAqB,CAAA;AAC/D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA;AA4FxD,wBAAgB,cAAc,CAAC,MAAM,EAAE,cAAc,GAAG,cAAc,CAqCrE"}
@@ -0,0 +1,4 @@
1
+ import { type ToolDefinition } from "@opencode-ai/plugin";
2
+ import type { ResolvedConfig } from "../../config/types";
3
+ export declare function createGlobTool(_config: ResolvedConfig): ToolDefinition;
4
+ //# sourceMappingURL=glob.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"glob.d.ts","sourceRoot":"","sources":["../../../src/tools/glob/glob.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,KAAK,cAAc,EAAQ,MAAM,qBAAqB,CAAA;AAC/D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA;AAMxD,wBAAgB,cAAc,CAAC,OAAO,EAAE,cAAc,GAAG,cAAc,CAqCtE"}
@@ -0,0 +1,4 @@
1
+ import { type ToolDefinition } from "@opencode-ai/plugin";
2
+ import type { ResolvedConfig } from "../../config/types";
3
+ export declare function createGrepTool(_config: ResolvedConfig): ToolDefinition;
4
+ //# sourceMappingURL=grep.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"grep.d.ts","sourceRoot":"","sources":["../../../src/tools/grep/grep.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,KAAK,cAAc,EAAQ,MAAM,qBAAqB,CAAA;AAC/D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA;AAmBxD,wBAAgB,cAAc,CAAC,OAAO,EAAE,cAAc,GAAG,cAAc,CA8DtE"}
@@ -0,0 +1,9 @@
1
+ import { type HashAlgorithm } from "./hash";
2
+ export interface AnnotatedRead {
3
+ /** Text to show the agent: one annotated row per source line, joined by "\n". */
4
+ readonly annotated: string;
5
+ /** 1-indexed lineNum -> 8-char hex hash, useful for tools that want to verify later. */
6
+ readonly hashes: ReadonlyMap<number, string>;
7
+ }
8
+ export declare function annotate(text: string, algorithm: HashAlgorithm): AnnotatedRead;
9
+ //# sourceMappingURL=annotate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"annotate.d.ts","sourceRoot":"","sources":["../../../src/tools/hashline-edit/annotate.ts"],"names":[],"mappings":"AAWA,OAAO,EAAmB,KAAK,aAAa,EAAE,MAAM,QAAQ,CAAA;AAI5D,MAAM,WAAW,aAAa;IAC5B,iFAAiF;IACjF,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;IAC1B,wFAAwF;IACxF,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAC7C;AAED,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,aAAa,GAAG,aAAa,CAc9E"}
@@ -0,0 +1,22 @@
1
+ import { type FileMetadata } from "./file-meta";
2
+ import { type HashAlgorithm } from "./hash";
3
+ export interface EditInstruction {
4
+ /** 1-indexed inclusive [startLine, endLine]. */
5
+ readonly lines: readonly [number, number];
6
+ /** One hash per line in the range, in order. */
7
+ readonly expected_hashes: readonly string[];
8
+ /** Replacement text. "" deletes; multi-line strings expand into multiple lines. */
9
+ readonly replacement: string;
10
+ }
11
+ export declare class HashMismatchError extends Error {
12
+ constructor(message: string);
13
+ }
14
+ export declare class EditRangeError extends Error {
15
+ constructor(message: string);
16
+ }
17
+ export declare class EditOverlapError extends Error {
18
+ constructor(message: string);
19
+ }
20
+ export declare function applyEdits(text: string, edits: readonly EditInstruction[], algorithm: HashAlgorithm): string;
21
+ export type { FileMetadata };
22
+ //# sourceMappingURL=apply.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"apply.d.ts","sourceRoot":"","sources":["../../../src/tools/hashline-edit/apply.ts"],"names":[],"mappings":"AAqBA,OAAO,EAAE,KAAK,YAAY,EAA8B,MAAM,aAAa,CAAA;AAC3E,OAAO,EAAmB,KAAK,aAAa,EAAE,MAAM,QAAQ,CAAA;AAE5D,MAAM,WAAW,eAAe;IAC9B,gDAAgD;IAChD,QAAQ,CAAC,KAAK,EAAE,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IACzC,gDAAgD;IAChD,QAAQ,CAAC,eAAe,EAAE,SAAS,MAAM,EAAE,CAAA;IAC3C,mFAAmF;IACnF,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAA;CAC7B;AAED,qBAAa,iBAAkB,SAAQ,KAAK;gBAC9B,OAAO,EAAE,MAAM;CAI5B;AAED,qBAAa,cAAe,SAAQ,KAAK;gBAC3B,OAAO,EAAE,MAAM;CAI5B;AAED,qBAAa,gBAAiB,SAAQ,KAAK;gBAC7B,OAAO,EAAE,MAAM;CAI5B;AA2ED,wBAAgB,UAAU,CACxB,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,SAAS,eAAe,EAAE,EACjC,SAAS,EAAE,aAAa,GACvB,MAAM,CA0BR;AAGD,YAAY,EAAE,YAAY,EAAE,CAAA"}
@@ -0,0 +1,13 @@
1
+ export interface FileMetadata {
2
+ readonly hasBOM: boolean;
3
+ readonly newline: "\n" | "\r\n";
4
+ readonly trailingNewline: boolean;
5
+ }
6
+ export interface ParsedFile {
7
+ readonly meta: FileMetadata;
8
+ /** Each line's text only — no trailing newline characters. */
9
+ readonly lines: readonly string[];
10
+ }
11
+ export declare function parseFile(text: string): ParsedFile;
12
+ export declare function reconstructFile(lines: readonly string[], meta: FileMetadata): string;
13
+ //# sourceMappingURL=file-meta.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"file-meta.d.ts","sourceRoot":"","sources":["../../../src/tools/hashline-edit/file-meta.ts"],"names":[],"mappings":"AAiBA,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAA;IACxB,QAAQ,CAAC,OAAO,EAAE,IAAI,GAAG,MAAM,CAAA;IAC/B,QAAQ,CAAC,eAAe,EAAE,OAAO,CAAA;CAClC;AAED,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,IAAI,EAAE,YAAY,CAAA;IAC3B,8DAA8D;IAC9D,QAAQ,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAA;CAClC;AAQD,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU,CAclD;AAED,wBAAgB,eAAe,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,EAAE,IAAI,EAAE,YAAY,GAAG,MAAM,CAIpF"}
@@ -0,0 +1,3 @@
1
+ export type HashAlgorithm = "sha1" | "sha256";
2
+ export declare function computeLineHash(line: string, algorithm: HashAlgorithm): string;
3
+ //# sourceMappingURL=hash.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hash.d.ts","sourceRoot":"","sources":["../../../src/tools/hashline-edit/hash.ts"],"names":[],"mappings":"AAUA,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,QAAQ,CAAA;AAI7C,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,aAAa,GAAG,MAAM,CAE9E"}
@@ -0,0 +1,5 @@
1
+ export { type AnnotatedRead, annotate } from "./annotate";
2
+ export { applyEdits, type EditInstruction, EditOverlapError, EditRangeError, HashMismatchError, } from "./apply";
3
+ export { type FileMetadata, type ParsedFile, parseFile, reconstructFile, } from "./file-meta";
4
+ export { computeLineHash, type HashAlgorithm } from "./hash";
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/tools/hashline-edit/index.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,KAAK,aAAa,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AACzD,OAAO,EACL,UAAU,EACV,KAAK,eAAe,EACpB,gBAAgB,EAChB,cAAc,EACd,iBAAiB,GAClB,MAAM,SAAS,CAAA;AAChB,OAAO,EACL,KAAK,YAAY,EACjB,KAAK,UAAU,EACf,SAAS,EACT,eAAe,GAChB,MAAM,aAAa,CAAA;AACpB,OAAO,EAAE,eAAe,EAAE,KAAK,aAAa,EAAE,MAAM,QAAQ,CAAA"}
@@ -0,0 +1,16 @@
1
+ import type { ToolDefinition } from "@opencode-ai/plugin";
2
+ import type { OpencodeClient } from "@opencode-ai/sdk";
3
+ import type { ResolvedConfig } from "../config/types";
4
+ /** Names of tools opensober ships in v1. Used by the CLI's summary view and by doctor. */
5
+ export declare const TOOL_NAMES: readonly ["read", "edit", "task", "grep", "glob", "ast_grep_search", "ast_grep_replace"];
6
+ export type ToolName = (typeof TOOL_NAMES)[number];
7
+ /** Runtime dependencies that tools need beyond config. */
8
+ export interface ToolDependencies {
9
+ readonly client: OpencodeClient;
10
+ }
11
+ export declare function createTools(config: ResolvedConfig, deps: ToolDependencies): Partial<Record<ToolName, ToolDefinition>>;
12
+ export { assertCanDelegate, assertCanWrite, ToolPermissionError } from "./common/guards";
13
+ export { createEditTool } from "./edit/edit";
14
+ export { createReadTool } from "./read/read";
15
+ export { createTaskTool } from "./task/task";
16
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AACzD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AACtD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAA;AASrD,0FAA0F;AAC1F,eAAO,MAAM,UAAU,0FAQb,CAAA;AACV,MAAM,MAAM,QAAQ,GAAG,CAAC,OAAO,UAAU,CAAC,CAAC,MAAM,CAAC,CAAA;AAElD,0DAA0D;AAC1D,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,MAAM,EAAE,cAAc,CAAA;CAChC;AAED,wBAAgB,WAAW,CACzB,MAAM,EAAE,cAAc,EACtB,IAAI,EAAE,gBAAgB,GACrB,OAAO,CAAC,MAAM,CAAC,QAAQ,EAAE,cAAc,CAAC,CAAC,CAkB3C;AAED,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAA;AACxF,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAC5C,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAC5C,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA"}
@@ -0,0 +1,4 @@
1
+ import { type ToolDefinition } from "@opencode-ai/plugin";
2
+ import type { ResolvedConfig } from "../../config/types";
3
+ export declare function createReadTool(config: ResolvedConfig): ToolDefinition;
4
+ //# sourceMappingURL=read.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"read.d.ts","sourceRoot":"","sources":["../../../src/tools/read/read.ts"],"names":[],"mappings":"AAkBA,OAAO,EAAE,KAAK,cAAc,EAAQ,MAAM,qBAAqB,CAAA;AAC/D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA;AAmBxD,wBAAgB,cAAc,CAAC,MAAM,EAAE,cAAc,GAAG,cAAc,CA2CrE"}
@@ -0,0 +1,37 @@
1
+ import type { OpencodeClient } from "@opencode-ai/sdk";
2
+ export interface RunChildOptions {
3
+ readonly parentSessionID: string;
4
+ readonly targetAgent: string;
5
+ readonly prompt: string;
6
+ readonly abort: AbortSignal;
7
+ readonly directory: string;
8
+ readonly maxTurns?: number;
9
+ readonly maxPollWaitMs?: number;
10
+ readonly pollIntervalMs?: number;
11
+ }
12
+ export interface RunChildResult {
13
+ readonly childSessionID: string;
14
+ readonly text: string;
15
+ readonly model?: string | undefined;
16
+ readonly cost?: number | undefined;
17
+ readonly tokens?: {
18
+ input: number;
19
+ output: number;
20
+ } | undefined;
21
+ readonly durationMs: number;
22
+ readonly turns: number;
23
+ }
24
+ export declare class TaskAbortedError extends Error {
25
+ constructor(message?: string);
26
+ }
27
+ export declare class TaskTimeoutError extends Error {
28
+ constructor(message: string);
29
+ }
30
+ export declare class TaskMaxTurnsError extends Error {
31
+ constructor(message: string);
32
+ }
33
+ export declare class TaskExecutionError extends Error {
34
+ constructor(message: string);
35
+ }
36
+ export declare function runChildSession(client: OpencodeClient, opts: RunChildOptions): Promise<RunChildResult>;
37
+ //# sourceMappingURL=runner.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runner.d.ts","sourceRoot":"","sources":["../../../src/tools/task/runner.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAMtD,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAA;IAChC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAA;IAC5B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAA;IAC3B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;IAE1B,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;IAC1B,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,CAAA;IAC/B,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,CAAA;CACjC;AAED,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAA;IAC/B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IACnC,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAClC,QAAQ,CAAC,MAAM,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,GAAG,SAAS,CAAA;IAC/D,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAA;IAC3B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;CACvB;AAED,qBAAa,gBAAiB,SAAQ,KAAK;gBAC7B,OAAO,SAA6B;CAIjD;AAED,qBAAa,gBAAiB,SAAQ,KAAK;gBAC7B,OAAO,EAAE,MAAM;CAI5B;AAED,qBAAa,iBAAkB,SAAQ,KAAK;gBAC9B,OAAO,EAAE,MAAM;CAI5B;AAED,qBAAa,kBAAmB,SAAQ,KAAK;gBAC/B,OAAO,EAAE,MAAM;CAI5B;AAwED,wBAAsB,eAAe,CACnC,MAAM,EAAE,cAAc,EACtB,IAAI,EAAE,eAAe,GACpB,OAAO,CAAC,cAAc,CAAC,CAoHzB"}
@@ -0,0 +1,5 @@
1
+ import { type ToolDefinition } from "@opencode-ai/plugin";
2
+ import type { ResolvedConfig } from "../../config/types";
3
+ import type { ToolDependencies } from "../index";
4
+ export declare function createTaskTool(config: ResolvedConfig, deps: ToolDependencies): ToolDefinition;
5
+ //# sourceMappingURL=task.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"task.d.ts","sourceRoot":"","sources":["../../../src/tools/task/task.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,KAAK,cAAc,EAAQ,MAAM,qBAAqB,CAAA;AAC/D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA;AAGxD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAA;AAehD,wBAAgB,cAAc,CAAC,MAAM,EAAE,cAAc,EAAE,IAAI,EAAE,gBAAgB,GAAG,cAAc,CA2B7F"}