thoth-agents 0.12.0 → 0.13.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.
- package/README.md +11 -2
- package/dist/{chunk-SEF6PFM6.js → chunk-5MYXVRZZ.js} +132 -157
- package/dist/chunk-6O4GKDS7.js +207 -0
- package/dist/{chunk-QOA2AETX.js → chunk-NOLDFT7O.js} +3 -3
- package/dist/{chunk-7F33WUSD.js → chunk-VVYAQTYE.js} +2 -2
- package/dist/{chunk-NY2IPJ7V.js → chunk-YCWGTDFE.js} +531 -233
- package/dist/cli/index.js +6 -6
- package/dist/cli/opencode-profiles.d.ts +10 -0
- package/dist/cli/tui/index.js +3 -3
- package/dist/config/loader.d.ts +1 -4
- package/dist/config/schema.d.ts +0 -22
- package/dist/index.js +824 -30
- package/dist/opencode/context.d.ts +16 -0
- package/dist/opencode/profile-rpc-handlers.d.ts +3 -0
- package/dist/opencode/profile-rpc.d.ts +688 -0
- package/dist/opencode/profile-runtime.d.ts +3 -0
- package/dist/opencode/profile-sessions.d.ts +18 -0
- package/dist/opencode/profiles/editor.d.ts +44 -0
- package/dist/opencode/profiles/index.d.ts +18 -0
- package/dist/opencode/profiles/resolver.d.ts +12 -0
- package/dist/opencode/profiles/store.d.ts +63 -0
- package/dist/opencode/profiles/types.d.ts +26 -0
- package/dist/opencode/tool-overrides/evaluator.d.ts +13 -0
- package/dist/opencode/tool-overrides/index.d.ts +5 -0
- package/dist/opencode/tool-overrides/store.d.ts +38 -0
- package/dist/opencode/tool-overrides/types.d.ts +32 -0
- package/dist/opencode/tool-overrides/validation.d.ts +5 -0
- package/dist/opencode/tool-overrides/wildcard.d.ts +3 -0
- package/dist/opencode/tool-rpc-handlers.d.ts +3 -0
- package/dist/opencode/tool-rpc.d.ts +428 -0
- package/dist/pi.js +2 -2
- package/dist/tui/fixtures.d.ts +2 -0
- package/dist/tui/flow.d.ts +16 -0
- package/dist/tui/index.d.ts +7 -0
- package/dist/tui/index.js +1384 -0
- package/dist/tui/model.d.ts +84 -0
- package/dist/tui/tools/fixtures.d.ts +3 -0
- package/dist/tui/tools/flow.d.ts +11 -0
- package/dist/tui/tools/model.d.ts +97 -0
- package/package.json +5 -1
- package/plugin/.claude-plugin/plugin.json +1 -1
- package/plugin/.codex-plugin/plugin.json +1 -1
- package/thoth-agents.schema.json +0 -70
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
// src/opencode/profile-rpc.ts
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
var ProfileRoleSchema = z.enum([
|
|
4
|
+
"orchestrator",
|
|
5
|
+
"explorer",
|
|
6
|
+
"librarian",
|
|
7
|
+
"oracle",
|
|
8
|
+
"designer",
|
|
9
|
+
"worker"
|
|
10
|
+
]);
|
|
11
|
+
var ProfileScopeSchema = z.enum(["global", "project"]);
|
|
12
|
+
var SelectionScopeSchema = z.enum([
|
|
13
|
+
"session",
|
|
14
|
+
"project",
|
|
15
|
+
"global",
|
|
16
|
+
"default"
|
|
17
|
+
]);
|
|
18
|
+
var RoleModelSchema = z.object({
|
|
19
|
+
model: z.string().regex(/^[^/\s#]+\/[^\s#]+$/).optional(),
|
|
20
|
+
variant: z.string().regex(/^[^\s#]+$/).optional()
|
|
21
|
+
});
|
|
22
|
+
var ProfileSchema = z.object({
|
|
23
|
+
agents: z.partialRecord(ProfileRoleSchema, RoleModelSchema)
|
|
24
|
+
});
|
|
25
|
+
var name = z.string().trim().min(1);
|
|
26
|
+
var session = z.object({ sessionID: z.string().min(1) });
|
|
27
|
+
var optionalSession = session.partial();
|
|
28
|
+
var target = z.object({ scope: ProfileScopeSchema, name });
|
|
29
|
+
var selectionScope = z.enum(["session", "project", "global"]);
|
|
30
|
+
var ProfileEntrySchema = target.extend({
|
|
31
|
+
source: ProfileScopeSchema,
|
|
32
|
+
shadowed: z.boolean(),
|
|
33
|
+
profile: ProfileSchema,
|
|
34
|
+
/** Opaque per-profile token, including absence. Never construct in the client. */
|
|
35
|
+
revision: z.string()
|
|
36
|
+
});
|
|
37
|
+
var ProfileStateSchema = z.object({
|
|
38
|
+
profiles: z.array(ProfileEntrySchema),
|
|
39
|
+
defaultProfile: ProfileSchema,
|
|
40
|
+
roles: z.array(ProfileRoleSchema),
|
|
41
|
+
selections: z.object({
|
|
42
|
+
session: name.optional(),
|
|
43
|
+
project: name.optional(),
|
|
44
|
+
global: name.optional()
|
|
45
|
+
}),
|
|
46
|
+
effective: z.object({
|
|
47
|
+
name,
|
|
48
|
+
source: ProfileScopeSchema.optional(),
|
|
49
|
+
selectedBy: SelectionScopeSchema,
|
|
50
|
+
profile: ProfileSchema
|
|
51
|
+
}),
|
|
52
|
+
orchestrator: RoleModelSchema.optional(),
|
|
53
|
+
providers: z.array(
|
|
54
|
+
z.object({
|
|
55
|
+
id: z.string(),
|
|
56
|
+
name: z.string(),
|
|
57
|
+
models: z.array(
|
|
58
|
+
z.object({
|
|
59
|
+
id: z.string(),
|
|
60
|
+
name: z.string(),
|
|
61
|
+
variants: z.array(z.string())
|
|
62
|
+
})
|
|
63
|
+
)
|
|
64
|
+
})
|
|
65
|
+
),
|
|
66
|
+
warnings: z.array(z.string())
|
|
67
|
+
});
|
|
68
|
+
var ProfileErrorSchema = z.object({
|
|
69
|
+
code: z.enum([
|
|
70
|
+
"PROFILE_CONFLICT",
|
|
71
|
+
"PROFILE_SHADOWED",
|
|
72
|
+
"INVALID_REQUEST",
|
|
73
|
+
"MODEL_UNAVAILABLE",
|
|
74
|
+
"OPERATION_FAILED"
|
|
75
|
+
]),
|
|
76
|
+
message: z.string()
|
|
77
|
+
});
|
|
78
|
+
function result(value) {
|
|
79
|
+
return z.discriminatedUnion("ok", [
|
|
80
|
+
z.object({ ok: z.literal(true), value }),
|
|
81
|
+
z.object({ ok: z.literal(false), error: ProfileErrorSchema })
|
|
82
|
+
]);
|
|
83
|
+
}
|
|
84
|
+
var profileRpc = {
|
|
85
|
+
id: "thoth-model-profiles",
|
|
86
|
+
methods: {
|
|
87
|
+
state: { input: optionalSession, output: result(ProfileStateSchema) },
|
|
88
|
+
create: {
|
|
89
|
+
input: target.extend({ profile: ProfileSchema }),
|
|
90
|
+
output: result(z.object({ revision: z.string() }))
|
|
91
|
+
},
|
|
92
|
+
save: {
|
|
93
|
+
input: target.extend({
|
|
94
|
+
profile: ProfileSchema,
|
|
95
|
+
baseRevision: z.string()
|
|
96
|
+
}),
|
|
97
|
+
output: result(z.object({ revision: z.string() }))
|
|
98
|
+
},
|
|
99
|
+
rename: {
|
|
100
|
+
input: target.extend({ newName: name }),
|
|
101
|
+
output: result(z.object({}))
|
|
102
|
+
},
|
|
103
|
+
delete: { input: target, output: result(z.object({})) },
|
|
104
|
+
activate: {
|
|
105
|
+
input: optionalSession.extend({ scope: selectionScope, name }),
|
|
106
|
+
output: result(ProfileStateSchema)
|
|
107
|
+
},
|
|
108
|
+
clear: {
|
|
109
|
+
input: optionalSession.extend({ scope: selectionScope }),
|
|
110
|
+
output: result(ProfileStateSchema)
|
|
111
|
+
},
|
|
112
|
+
capture: { input: session, output: result(RoleModelSchema) }
|
|
113
|
+
},
|
|
114
|
+
events: {}
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
// src/opencode/tool-rpc.ts
|
|
118
|
+
import { z as z2 } from "zod";
|
|
119
|
+
var ToolRoleSchema = z2.enum([
|
|
120
|
+
"explorer",
|
|
121
|
+
"librarian",
|
|
122
|
+
"oracle",
|
|
123
|
+
"designer",
|
|
124
|
+
"worker"
|
|
125
|
+
]);
|
|
126
|
+
var ToolScopeSchema = z2.enum(["global", "project"]);
|
|
127
|
+
var ToolEffectSchema = z2.enum(["allow", "ask", "deny"]);
|
|
128
|
+
var ToolOriginSchema = z2.enum(["default", "global", "project"]);
|
|
129
|
+
var ActionOverrideSchema = z2.object({
|
|
130
|
+
action: z2.string().min(1).refine((action) => action.trim().length > 0, "Action must not be blank"),
|
|
131
|
+
effect: ToolEffectSchema
|
|
132
|
+
});
|
|
133
|
+
var scopeState = z2.object({
|
|
134
|
+
present: z2.boolean(),
|
|
135
|
+
/** Opaque whole-file revision, including when this role is absent. */
|
|
136
|
+
revision: z2.string(),
|
|
137
|
+
/** Ordered entries, including duplicates and patterns matching no inventory action. */
|
|
138
|
+
overrides: z2.array(
|
|
139
|
+
ActionOverrideSchema.extend({ matchCount: z2.number().int().nonnegative() })
|
|
140
|
+
)
|
|
141
|
+
});
|
|
142
|
+
var ToolStateSchema = z2.object({
|
|
143
|
+
specialists: z2.array(ToolRoleSchema),
|
|
144
|
+
inventory: z2.array(
|
|
145
|
+
z2.object({
|
|
146
|
+
action: z2.string(),
|
|
147
|
+
tools: z2.array(z2.string()),
|
|
148
|
+
locked: z2.boolean()
|
|
149
|
+
})
|
|
150
|
+
),
|
|
151
|
+
roles: z2.array(
|
|
152
|
+
z2.object({
|
|
153
|
+
role: ToolRoleSchema,
|
|
154
|
+
effectiveScope: ToolOriginSchema,
|
|
155
|
+
global: scopeState,
|
|
156
|
+
project: scopeState,
|
|
157
|
+
actions: z2.array(
|
|
158
|
+
z2.object({
|
|
159
|
+
action: z2.string(),
|
|
160
|
+
effect: ToolEffectSchema,
|
|
161
|
+
/** Effect from shipped role rules alone, before any scope overrides. */
|
|
162
|
+
baseEffect: ToolEffectSchema,
|
|
163
|
+
origin: ToolOriginSchema,
|
|
164
|
+
locked: z2.boolean()
|
|
165
|
+
})
|
|
166
|
+
)
|
|
167
|
+
})
|
|
168
|
+
),
|
|
169
|
+
warnings: z2.array(z2.string())
|
|
170
|
+
});
|
|
171
|
+
var ToolErrorSchema = z2.object({
|
|
172
|
+
code: z2.enum(["TOOLS_CONFLICT", "INVALID_REQUEST", "OPERATION_FAILED"]),
|
|
173
|
+
message: z2.string()
|
|
174
|
+
});
|
|
175
|
+
var result2 = z2.discriminatedUnion("ok", [
|
|
176
|
+
z2.object({ ok: z2.literal(true), value: ToolStateSchema }),
|
|
177
|
+
z2.object({ ok: z2.literal(false), error: ToolErrorSchema })
|
|
178
|
+
]);
|
|
179
|
+
var target2 = z2.object({
|
|
180
|
+
scope: ToolScopeSchema,
|
|
181
|
+
role: ToolRoleSchema,
|
|
182
|
+
baseRevision: z2.string()
|
|
183
|
+
});
|
|
184
|
+
var toolRpc = {
|
|
185
|
+
id: "thoth-tool-permissions",
|
|
186
|
+
methods: {
|
|
187
|
+
state: { input: z2.object({}), output: result2 },
|
|
188
|
+
save: {
|
|
189
|
+
input: target2.extend({
|
|
190
|
+
overrides: z2.array(
|
|
191
|
+
ActionOverrideSchema.refine(
|
|
192
|
+
(entry) => entry.action !== "subagent",
|
|
193
|
+
"The subagent action is locked"
|
|
194
|
+
)
|
|
195
|
+
)
|
|
196
|
+
}),
|
|
197
|
+
output: result2
|
|
198
|
+
},
|
|
199
|
+
reset: { input: target2, output: result2 }
|
|
200
|
+
},
|
|
201
|
+
events: {}
|
|
202
|
+
};
|
|
203
|
+
|
|
204
|
+
export {
|
|
205
|
+
profileRpc,
|
|
206
|
+
toolRpc
|
|
207
|
+
};
|
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
loadAgentPrompt,
|
|
17
17
|
renderAgentRoutingDescription,
|
|
18
18
|
renderRolePrompt
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-YCWGTDFE.js";
|
|
20
20
|
|
|
21
21
|
// src/agents/designer.ts
|
|
22
22
|
var DESIGNER_PROMPT = renderRolePrompt(
|
|
@@ -363,7 +363,7 @@ var SUBAGENT_FACTORIES = {
|
|
|
363
363
|
function createAgents(config) {
|
|
364
364
|
const protoSubAgents = Object.entries(SUBAGENT_FACTORIES).map(([name, factory]) => {
|
|
365
365
|
const override = getAgentOverride(config, name);
|
|
366
|
-
const prompts = loadAgentPrompt(name
|
|
366
|
+
const prompts = loadAgentPrompt(name);
|
|
367
367
|
const model = getPrimaryModelForPrompt(override?.model) ?? DEFAULT_MODELS[name];
|
|
368
368
|
const agent = factory(model, prompts.prompt, prompts.appendPrompt);
|
|
369
369
|
agent.description = renderAgentRoutingDescription(getAgentRole(name));
|
|
@@ -379,7 +379,7 @@ function createAgents(config) {
|
|
|
379
379
|
return agent;
|
|
380
380
|
});
|
|
381
381
|
const orchestratorOverride = getAgentOverride(config, "orchestrator");
|
|
382
|
-
const orchestratorPrompts = loadAgentPrompt("orchestrator"
|
|
382
|
+
const orchestratorPrompts = loadAgentPrompt("orchestrator");
|
|
383
383
|
const orchestrator = createOrchestratorAgent(
|
|
384
384
|
orchestratorOverride?.model ?? `openai/${OPENCODE_OPENAI_ORCHESTRATOR_PRESET.model}`,
|
|
385
385
|
orchestratorPrompts.prompt,
|
|
@@ -19,7 +19,7 @@ import {
|
|
|
19
19
|
renderAgentRoutingDescription,
|
|
20
20
|
renderPromptSection,
|
|
21
21
|
renderRolePrompt
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-YCWGTDFE.js";
|
|
23
23
|
|
|
24
24
|
// src/harness/writers/pi-agent.ts
|
|
25
25
|
var PI_MANAGED_OWNER = "thoth-agents";
|
|
@@ -733,7 +733,7 @@ function renderConfiguredRolePrompt({
|
|
|
733
733
|
config,
|
|
734
734
|
model
|
|
735
735
|
}) {
|
|
736
|
-
const promptOverrides = loadAgentPrompt(role
|
|
736
|
+
const promptOverrides = loadAgentPrompt(role);
|
|
737
737
|
const override = getAgentOverride(config, role);
|
|
738
738
|
const modelSection = createModelFamilySection(role, model);
|
|
739
739
|
const stepSection = createStepBudgetSection(override?.steps, role);
|