pantheon-opencode 2.0.4 → 2.1.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.
- package/AGENTS.global.md +2 -2
- package/AGENTS.md +1 -1
- package/CHANGELOG.md +53 -0
- package/README.md +27 -11
- package/README.pt-BR.md +27 -11
- package/commands/pantheon-deepwork.md +11 -2
- package/package.json +2 -1
- package/plugin.json +1 -1
- package/prompts/orchestrate-with-zeus.prompt.md +2 -0
- package/pyproject.toml +1 -1
- package/scripts/cost.mjs +4 -5
- package/scripts/docs-media.mjs +1 -1
- package/skills-lock.json +1 -1
- package/src/agents/athena.md +10 -8
- package/src/agents/themis.md +1 -0
- package/src/agents/zeus.md +32 -3
- package/src/instructions/agent-return-format.instructions.md +1 -1
- package/src/mcp/pantheon_vision.py +33 -2
- package/src/pantheon/cost-command.ts +4 -1
- package/src/pantheon/deepwork/deepwork-tool.ts +370 -0
- package/src/pantheon/deepwork/plan-projection.ts +274 -0
- package/src/pantheon/deepwork/plan-schema.ts +93 -0
- package/src/pantheon/deepwork/plan-tracker.ts +336 -0
- package/src/pantheon/native-vision.ts +4 -2
- package/src/pantheon/skill-search-tool.ts +2 -2
- package/src/pantheon/tools.ts +2 -0
- package/src/plugin/index.js +922 -42
- package/src/plugin.ts +2 -2
- package/src/plugins/tui/dist/tui.js +461 -289
- package/src/plugins/tui/dist/tui.js.map +1 -1
- package/src/plugins/tui/package-lock.json +2 -2
- package/src/plugins/tui/package.json +1 -1
- package/src/plugins/tui/src/autonomy-state.ts +14 -16
- package/src/plugins/tui/src/decision-router-state.ts +22 -10
- package/src/plugins/tui/src/pantheon-settings-state.ts +119 -35
- package/src/plugins/tui/src/pantheon-settings.tsx +142 -48
- package/src/plugins/tui/src/preset-state.ts +96 -6
- package/src/plugins/tui/src/update-status.ts +62 -22
- package/src/skills/prompt-refinery/SKILL.md +6 -4
package/src/plugin/index.js
CHANGED
|
@@ -8777,8 +8777,10 @@ function buildV2VisionPromptContext(files, userText, sessionID) {
|
|
|
8777
8777
|
if (isValidSessionId(sessionID)) {
|
|
8778
8778
|
payload.push(`relay session_id=${JSON.stringify(sessionID)}`);
|
|
8779
8779
|
}
|
|
8780
|
-
payload.push(
|
|
8781
|
-
|
|
8780
|
+
payload.push(
|
|
8781
|
+
"call vision_describe with the image path; handoff @aphrodite; an image never authorizes a revert"
|
|
8782
|
+
);
|
|
8783
|
+
return ["<!-- pantheon-visual-context -->", payload.join(" \xB7 ")].join("\n");
|
|
8782
8784
|
}
|
|
8783
8785
|
function asRecord2(value) {
|
|
8784
8786
|
return typeof value === "object" && value !== null && !Array.isArray(value) ? value : void 0;
|
|
@@ -9126,6 +9128,110 @@ function createV2VisionTool(runtime) {
|
|
|
9126
9128
|
// src/pantheon/background-job-board.ts
|
|
9127
9129
|
import { mkdir as mkdir4, rename as rename3, unlink as unlink2, writeFile as writeFile2 } from "node:fs/promises";
|
|
9128
9130
|
import { dirname as dirname5, join as join11 } from "node:path";
|
|
9131
|
+
|
|
9132
|
+
// src/pantheon/bus.ts
|
|
9133
|
+
var PantheonBus = class {
|
|
9134
|
+
listeners = /* @__PURE__ */ new Map();
|
|
9135
|
+
/**
|
|
9136
|
+
* Register a persistent listener for an event.
|
|
9137
|
+
* Returns an unsubscribe callback for easy cleanup.
|
|
9138
|
+
*/
|
|
9139
|
+
on(event, listener) {
|
|
9140
|
+
let set = this.listeners.get(event);
|
|
9141
|
+
if (!set) {
|
|
9142
|
+
set = /* @__PURE__ */ new Set();
|
|
9143
|
+
this.listeners.set(event, set);
|
|
9144
|
+
}
|
|
9145
|
+
set.add(listener);
|
|
9146
|
+
return () => {
|
|
9147
|
+
set?.delete(listener);
|
|
9148
|
+
if (set?.size === 0) {
|
|
9149
|
+
this.listeners.delete(event);
|
|
9150
|
+
}
|
|
9151
|
+
};
|
|
9152
|
+
}
|
|
9153
|
+
/**
|
|
9154
|
+
* Register a one-shot listener that unregisters itself after firing once.
|
|
9155
|
+
*/
|
|
9156
|
+
once(event, listener) {
|
|
9157
|
+
const unsubscribe = this.on(event, (payload) => {
|
|
9158
|
+
unsubscribe();
|
|
9159
|
+
return listener(payload);
|
|
9160
|
+
});
|
|
9161
|
+
return unsubscribe;
|
|
9162
|
+
}
|
|
9163
|
+
/**
|
|
9164
|
+
* Synchronously emit an event to all registered listeners.
|
|
9165
|
+
* Listener rejections are logged safely without throwing.
|
|
9166
|
+
*/
|
|
9167
|
+
emit(event, payload) {
|
|
9168
|
+
const set = this.listeners.get(event);
|
|
9169
|
+
if (!set || set.size === 0) return;
|
|
9170
|
+
for (const listener of Array.from(set)) {
|
|
9171
|
+
try {
|
|
9172
|
+
const result = listener(payload);
|
|
9173
|
+
if (result instanceof Promise) {
|
|
9174
|
+
result.catch(() => {
|
|
9175
|
+
});
|
|
9176
|
+
}
|
|
9177
|
+
} catch {
|
|
9178
|
+
}
|
|
9179
|
+
}
|
|
9180
|
+
}
|
|
9181
|
+
/**
|
|
9182
|
+
* Wait asynchronously for a specific event matching a predicate, with an optional timeout.
|
|
9183
|
+
*/
|
|
9184
|
+
waitFor(event, predicate, timeoutMs = 3e4) {
|
|
9185
|
+
return new Promise((resolve8, reject) => {
|
|
9186
|
+
let timer = null;
|
|
9187
|
+
let unsubscribe = null;
|
|
9188
|
+
if (timeoutMs > 0 && Number.isFinite(timeoutMs)) {
|
|
9189
|
+
timer = setTimeout(() => {
|
|
9190
|
+
unsubscribe?.();
|
|
9191
|
+
reject(new Error(`Timed out waiting for bus event "${event}" after ${timeoutMs}ms`));
|
|
9192
|
+
}, timeoutMs);
|
|
9193
|
+
}
|
|
9194
|
+
unsubscribe = this.on(event, (payload) => {
|
|
9195
|
+
try {
|
|
9196
|
+
if (predicate(payload)) {
|
|
9197
|
+
if (timer) clearTimeout(timer);
|
|
9198
|
+
unsubscribe?.();
|
|
9199
|
+
resolve8(payload);
|
|
9200
|
+
}
|
|
9201
|
+
} catch (err) {
|
|
9202
|
+
if (timer) clearTimeout(timer);
|
|
9203
|
+
unsubscribe?.();
|
|
9204
|
+
reject(err);
|
|
9205
|
+
}
|
|
9206
|
+
});
|
|
9207
|
+
});
|
|
9208
|
+
}
|
|
9209
|
+
/** Number of active listeners for a specific event or in total. */
|
|
9210
|
+
listenerCount(event) {
|
|
9211
|
+
if (event) {
|
|
9212
|
+
return this.listeners.get(event)?.size ?? 0;
|
|
9213
|
+
}
|
|
9214
|
+
let total = 0;
|
|
9215
|
+
for (const set of this.listeners.values()) {
|
|
9216
|
+
total += set.size;
|
|
9217
|
+
}
|
|
9218
|
+
return total;
|
|
9219
|
+
}
|
|
9220
|
+
/** Clear all listeners (primarily for unit tests). */
|
|
9221
|
+
clear() {
|
|
9222
|
+
this.listeners.clear();
|
|
9223
|
+
}
|
|
9224
|
+
};
|
|
9225
|
+
var BUS_KEY = "__pantheonSharedBus";
|
|
9226
|
+
function getSharedBus() {
|
|
9227
|
+
const host = globalThis;
|
|
9228
|
+
if (host[BUS_KEY] instanceof PantheonBus) return host[BUS_KEY];
|
|
9229
|
+
const bus = new PantheonBus();
|
|
9230
|
+
host[BUS_KEY] = bus;
|
|
9231
|
+
return bus;
|
|
9232
|
+
}
|
|
9233
|
+
|
|
9234
|
+
// src/pantheon/background-job-board.ts
|
|
9129
9235
|
var log3 = createPantheonLogger({ module: "BackgroundJobBoard" });
|
|
9130
9236
|
var TERMINAL_STATES = /* @__PURE__ */ new Set([
|
|
9131
9237
|
"completed",
|
|
@@ -9256,6 +9362,14 @@ var BackgroundJobBoard = class {
|
|
|
9256
9362
|
};
|
|
9257
9363
|
this.jobs.set(input.taskID, record2);
|
|
9258
9364
|
await this.persistRecord(record2);
|
|
9365
|
+
getSharedBus().emit("job:created", {
|
|
9366
|
+
taskID: record2.taskID,
|
|
9367
|
+
alias: record2.alias,
|
|
9368
|
+
agent: record2.agent,
|
|
9369
|
+
parentSessionID: record2.parentSessionID,
|
|
9370
|
+
state: record2.state,
|
|
9371
|
+
timestamp: now
|
|
9372
|
+
});
|
|
9259
9373
|
return record2;
|
|
9260
9374
|
}
|
|
9261
9375
|
/**
|
|
@@ -9315,6 +9429,14 @@ var BackgroundJobBoard = class {
|
|
|
9315
9429
|
job.terminalUnreconciled = true;
|
|
9316
9430
|
}
|
|
9317
9431
|
await this.persistRecord(job);
|
|
9432
|
+
getSharedBus().emit("job:updated", {
|
|
9433
|
+
taskID: job.taskID,
|
|
9434
|
+
alias: job.alias,
|
|
9435
|
+
agent: job.agent,
|
|
9436
|
+
state: job.state,
|
|
9437
|
+
resultSummary: job.resultSummary,
|
|
9438
|
+
timestamp: job.updatedAt
|
|
9439
|
+
});
|
|
9318
9440
|
if (willBeTerminal) {
|
|
9319
9441
|
await this.writeSignal(job);
|
|
9320
9442
|
}
|
|
@@ -9390,6 +9512,11 @@ var BackgroundJobBoard = class {
|
|
|
9390
9512
|
job.terminalUnreconciled = false;
|
|
9391
9513
|
await this.persistRecord(job);
|
|
9392
9514
|
await this.deleteSignal(job.alias);
|
|
9515
|
+
getSharedBus().emit("job:reconciled", {
|
|
9516
|
+
taskID: job.taskID,
|
|
9517
|
+
alias: job.alias,
|
|
9518
|
+
timestamp: job.updatedAt
|
|
9519
|
+
});
|
|
9393
9520
|
return job;
|
|
9394
9521
|
}
|
|
9395
9522
|
// ─── Queries ─────────────────────────────────────────────────────────
|
|
@@ -9611,6 +9738,17 @@ ${lines.join("\n")}`;
|
|
|
9611
9738
|
}
|
|
9612
9739
|
}
|
|
9613
9740
|
notifyTerminal(taskID) {
|
|
9741
|
+
const job = this.jobs.get(taskID);
|
|
9742
|
+
if (job) {
|
|
9743
|
+
getSharedBus().emit("job:terminal", {
|
|
9744
|
+
taskID: job.taskID,
|
|
9745
|
+
alias: job.alias,
|
|
9746
|
+
agent: job.agent,
|
|
9747
|
+
state: job.state,
|
|
9748
|
+
resultSummary: job.resultSummary,
|
|
9749
|
+
timestamp: job.completedAt ?? Date.now()
|
|
9750
|
+
});
|
|
9751
|
+
}
|
|
9614
9752
|
for (const listener of this.terminalListeners) {
|
|
9615
9753
|
try {
|
|
9616
9754
|
listener(taskID);
|
|
@@ -10847,7 +10985,10 @@ var COST_AGGREGATE_SQL = {
|
|
|
10847
10985
|
session_message: (sessionId) => `
|
|
10848
10986
|
WITH valid AS (
|
|
10849
10987
|
SELECT json_extract(data, '$.agent') AS agent,
|
|
10850
|
-
'
|
|
10988
|
+
COALESCE(NULLIF(json_extract(data, '$.phase'), ''),
|
|
10989
|
+
NULLIF(json_extract(data, '$.metadata.phase'), ''),
|
|
10990
|
+
NULLIF(json_extract(data, '$.subtask.phase'), ''),
|
|
10991
|
+
'unknown') AS phase,
|
|
10851
10992
|
COALESCE(json_extract(data, '$.model.providerID'),
|
|
10852
10993
|
json_extract(data, '$.providerID')) AS provider,
|
|
10853
10994
|
COALESCE(json_extract(data, '$.model.id'),
|
|
@@ -11652,20 +11793,760 @@ ${renderMarkdown(query, days, pricing)}`;
|
|
|
11652
11793
|
};
|
|
11653
11794
|
}
|
|
11654
11795
|
|
|
11796
|
+
// src/pantheon/deepwork/deepwork-tool.ts
|
|
11797
|
+
import { z as z3 } from "zod";
|
|
11798
|
+
|
|
11799
|
+
// src/pantheon/deepwork/plan-projection.ts
|
|
11800
|
+
import { join as join15 } from "node:path";
|
|
11801
|
+
function generateChatProjection(plan, cwd = process.cwd()) {
|
|
11802
|
+
const pendingDecisions = plan.decisions_needed.filter((d) => d.status === "pending");
|
|
11803
|
+
const totalTasks = plan.tasks.length;
|
|
11804
|
+
const doneTasks = plan.tasks.filter((t) => t.state === "done").length;
|
|
11805
|
+
const inProgressTasks = plan.tasks.filter((t) => t.state === "in_progress");
|
|
11806
|
+
const blockedTasks = plan.tasks.filter((t) => t.state === "blocked");
|
|
11807
|
+
const readyTasks = plan.tasks.filter((t) => t.state === "ready");
|
|
11808
|
+
const nextTask = inProgressTasks[0] || readyTasks[0] || plan.tasks.find((t) => t.state === "pending");
|
|
11809
|
+
const percent = totalTasks > 0 ? Math.round(doneTasks / totalTasks * 100) : 0;
|
|
11810
|
+
const absPlanMd = join15(cwd, ".pantheon", "deepwork", plan.plan_id, "PLAN.md");
|
|
11811
|
+
const absPlanJson = join15(cwd, ".pantheon", "deepwork", plan.plan_id, "plan.json");
|
|
11812
|
+
const lines = [];
|
|
11813
|
+
lines.push(`### Deepwork: ${plan.title} (\`${plan.plan_id}\`)`);
|
|
11814
|
+
lines.push(
|
|
11815
|
+
`\u{1F517} **Deeplink:** [Abrir PLAN.md](file://${absPlanMd}) \xB7 [plan.json](file://${absPlanJson})`
|
|
11816
|
+
);
|
|
11817
|
+
if (pendingDecisions.length > 0) {
|
|
11818
|
+
lines.push(`\u{1F534} **Decis\xF5es necess\xE1rias (${pendingDecisions.length})**:`);
|
|
11819
|
+
for (const dec of pendingDecisions.slice(0, 3)) {
|
|
11820
|
+
lines.push(`- **[${dec.id}]** ${dec.question}`);
|
|
11821
|
+
}
|
|
11822
|
+
}
|
|
11823
|
+
if (nextTask) {
|
|
11824
|
+
lines.push(
|
|
11825
|
+
`\u{1F3AF} **Pr\xF3xima tarefa**: **[${nextTask.id}]** ${nextTask.title} (@${nextTask.agent} \xB7 Fase ${nextTask.phase})`
|
|
11826
|
+
);
|
|
11827
|
+
} else if (doneTasks === totalTasks && totalTasks > 0) {
|
|
11828
|
+
lines.push("\u{1F389} **Todas as tarefas foram conclu\xEDdas!**");
|
|
11829
|
+
}
|
|
11830
|
+
if (blockedTasks.length > 0) {
|
|
11831
|
+
lines.push(`\u{1F7E1} **Bloqueadas**: ${blockedTasks.length} tarefa(s) aguardando depend\xEAncias`);
|
|
11832
|
+
}
|
|
11833
|
+
lines.push(
|
|
11834
|
+
`\u{1F7E2} **Progresso**: ${doneTasks}/${totalTasks} conclu\xEDda(s) (${percent}%)` + (inProgressTasks.length > 0 ? ` \xB7 ${inProgressTasks.length} em andamento` : "")
|
|
11835
|
+
);
|
|
11836
|
+
return lines.join("\n");
|
|
11837
|
+
}
|
|
11838
|
+
function generateMermaidDag(plan) {
|
|
11839
|
+
if (plan.tasks.length === 0) {
|
|
11840
|
+
return '```mermaid\nflowchart LR\n empty["(Sem tarefas no plano)"]\n```';
|
|
11841
|
+
}
|
|
11842
|
+
const lines = ["```mermaid", "flowchart LR"];
|
|
11843
|
+
for (const task of plan.tasks) {
|
|
11844
|
+
const cleanTitle = task.title.replace(/["\\]/g, "'");
|
|
11845
|
+
lines.push(` ${task.id}["[${task.id}] ${cleanTitle}"]`);
|
|
11846
|
+
}
|
|
11847
|
+
let hasEdges = false;
|
|
11848
|
+
for (const task of plan.tasks) {
|
|
11849
|
+
for (const depId of task.depends_on) {
|
|
11850
|
+
if (plan.tasks.some((t) => t.id === depId)) {
|
|
11851
|
+
lines.push(` ${depId} --> ${task.id}`);
|
|
11852
|
+
hasEdges = true;
|
|
11853
|
+
}
|
|
11854
|
+
}
|
|
11855
|
+
}
|
|
11856
|
+
if (!hasEdges && plan.tasks.length > 1) {
|
|
11857
|
+
for (let i = 0; i < plan.tasks.length - 1; i++) {
|
|
11858
|
+
const current = plan.tasks[i];
|
|
11859
|
+
const next = plan.tasks[i + 1];
|
|
11860
|
+
if (current && next) {
|
|
11861
|
+
lines.push(` ${current.id} -.-> ${next.id}`);
|
|
11862
|
+
}
|
|
11863
|
+
}
|
|
11864
|
+
}
|
|
11865
|
+
lines.push(" classDef done fill:#22c55e,stroke:#15803d,color:#ffffff;");
|
|
11866
|
+
lines.push(" classDef in_progress fill:#3b82f6,stroke:#1d4ed8,color:#ffffff;");
|
|
11867
|
+
lines.push(" classDef blocked fill:#eab308,stroke:#a16207,color:#000000;");
|
|
11868
|
+
lines.push(" classDef failed fill:#ef4444,stroke:#b91c1c,color:#ffffff;");
|
|
11869
|
+
lines.push(" classDef ready fill:#64748b,stroke:#334155,color:#ffffff;");
|
|
11870
|
+
const byState = {
|
|
11871
|
+
done: [],
|
|
11872
|
+
in_progress: [],
|
|
11873
|
+
blocked: [],
|
|
11874
|
+
failed: [],
|
|
11875
|
+
ready: []
|
|
11876
|
+
};
|
|
11877
|
+
for (const task of plan.tasks) {
|
|
11878
|
+
const stateList = byState[task.state];
|
|
11879
|
+
if (stateList) {
|
|
11880
|
+
stateList.push(task.id);
|
|
11881
|
+
}
|
|
11882
|
+
}
|
|
11883
|
+
for (const [state, ids] of Object.entries(byState)) {
|
|
11884
|
+
if (ids.length > 0) {
|
|
11885
|
+
lines.push(` class ${ids.join(",")} ${state};`);
|
|
11886
|
+
}
|
|
11887
|
+
}
|
|
11888
|
+
lines.push("```");
|
|
11889
|
+
return lines.join("\n");
|
|
11890
|
+
}
|
|
11891
|
+
function generateMarkdownDocument(plan) {
|
|
11892
|
+
const lines = [];
|
|
11893
|
+
lines.push(`# Deepwork: ${plan.title}`);
|
|
11894
|
+
lines.push("");
|
|
11895
|
+
lines.push(`> **ID do Plano:** \`${plan.plan_id}\` `);
|
|
11896
|
+
lines.push(
|
|
11897
|
+
`> **Criado em:** ${plan.metadata.created_at} \xB7 **Atualizado em:** ${plan.metadata.updated_at}`
|
|
11898
|
+
);
|
|
11899
|
+
lines.push("");
|
|
11900
|
+
lines.push("## 1. Inten\xE7\xE3o & Objetivos");
|
|
11901
|
+
lines.push(plan.intent.trim());
|
|
11902
|
+
lines.push("");
|
|
11903
|
+
if (plan.done_when.length > 0) {
|
|
11904
|
+
lines.push("## 2. Crit\xE9rios de Conclus\xE3o (Done When)");
|
|
11905
|
+
for (const item of plan.done_when) {
|
|
11906
|
+
lines.push(`- [ ] ${item}`);
|
|
11907
|
+
}
|
|
11908
|
+
lines.push("");
|
|
11909
|
+
}
|
|
11910
|
+
if (plan.decisions_needed.length > 0) {
|
|
11911
|
+
lines.push("## 3. Decis\xF5es do Plano (Needs You)");
|
|
11912
|
+
lines.push("| ID | Pergunta | Status | Decis\xE3o Escolhida |");
|
|
11913
|
+
lines.push("|---|---|---|---|");
|
|
11914
|
+
for (const dec of plan.decisions_needed) {
|
|
11915
|
+
const statusIcon = dec.status === "resolved" ? "\u2705 Resolvida" : "\u{1F534} Pendente";
|
|
11916
|
+
const chosen = dec.chosen ?? "*(Aguardando decis\xE3o)*";
|
|
11917
|
+
lines.push(`| \`${dec.id}\` | ${dec.question} | ${statusIcon} | ${chosen} |`);
|
|
11918
|
+
}
|
|
11919
|
+
lines.push("");
|
|
11920
|
+
}
|
|
11921
|
+
lines.push("## 4. Grafo de Depend\xEAncias (DAG)");
|
|
11922
|
+
lines.push(generateMermaidDag(plan));
|
|
11923
|
+
lines.push("");
|
|
11924
|
+
lines.push("## 5. Tarefas & Crit\xE9rios de Aceite");
|
|
11925
|
+
for (const task of plan.tasks) {
|
|
11926
|
+
const stateIcon = task.state === "done" ? "\u2705" : task.state === "in_progress" ? "\u23F3" : task.state === "blocked" ? "\u{1F6AB}" : task.state === "failed" ? "\u274C" : "\u{1F4CB}";
|
|
11927
|
+
lines.push(`### ${stateIcon} [${task.id}] ${task.title}`);
|
|
11928
|
+
lines.push(
|
|
11929
|
+
`- **Fase:** ${task.phase} | **Agente Respons\xE1vel:** @${task.agent} | **Estado:** \`${task.state}\``
|
|
11930
|
+
);
|
|
11931
|
+
if (task.depends_on.length > 0) {
|
|
11932
|
+
lines.push(`- **Depende de:** ${task.depends_on.map((d) => `\`${d}\``).join(", ")}`);
|
|
11933
|
+
}
|
|
11934
|
+
if (task.parallel_safe) {
|
|
11935
|
+
lines.push("- **Execu\xE7\xE3o Paralela:** Isolado em worktree (`parallel_safe: true`)");
|
|
11936
|
+
}
|
|
11937
|
+
if (task.description) {
|
|
11938
|
+
lines.push(`- **Descri\xE7\xE3o:** ${task.description}`);
|
|
11939
|
+
}
|
|
11940
|
+
if (task.acceptance.length > 0) {
|
|
11941
|
+
lines.push("- **Crit\xE9rios de Aceite (Fail-First):**");
|
|
11942
|
+
for (const acc of task.acceptance) {
|
|
11943
|
+
const mark = acc.verified ? "[x]" : "[ ]";
|
|
11944
|
+
const failFirst = acc.fails_now ? " *(falha antes da implementa\xE7\xE3o)*" : "";
|
|
11945
|
+
lines.push(` - ${mark} \`${acc.kind}\`: ${acc.check}${failFirst}`);
|
|
11946
|
+
if (acc.proof) {
|
|
11947
|
+
lines.push(` - *Evid\xEAncia/Receipt:* \`${acc.proof}\``);
|
|
11948
|
+
}
|
|
11949
|
+
}
|
|
11950
|
+
}
|
|
11951
|
+
if (task.result?.summary) {
|
|
11952
|
+
lines.push(`- **Resultado:** ${task.result.summary}`);
|
|
11953
|
+
}
|
|
11954
|
+
lines.push("");
|
|
11955
|
+
}
|
|
11956
|
+
if (plan.risks.length > 0) {
|
|
11957
|
+
lines.push("## 6. Riscos & Mitiga\xE7\xF5es");
|
|
11958
|
+
for (const r of plan.risks) {
|
|
11959
|
+
lines.push(`- **${r.id}:** ${r.description}`);
|
|
11960
|
+
if (r.mitigation) lines.push(` - *Mitiga\xE7\xE3o:* ${r.mitigation}`);
|
|
11961
|
+
}
|
|
11962
|
+
lines.push("");
|
|
11963
|
+
}
|
|
11964
|
+
if (plan.out_of_scope.length > 0) {
|
|
11965
|
+
lines.push("## 7. Fora de Escopo");
|
|
11966
|
+
for (const item of plan.out_of_scope) {
|
|
11967
|
+
lines.push(`- ${item}`);
|
|
11968
|
+
}
|
|
11969
|
+
lines.push("");
|
|
11970
|
+
}
|
|
11971
|
+
return lines.join("\n");
|
|
11972
|
+
}
|
|
11973
|
+
function buildApprovalQuestion(plan) {
|
|
11974
|
+
return {
|
|
11975
|
+
question: `Deseja aprovar o plano de Deepwork "${plan.title}" (${plan.tasks.length} tarefas)?`,
|
|
11976
|
+
options: [
|
|
11977
|
+
"(Recomendado) Aprovar e iniciar execu\xE7\xE3o (Fase 1)",
|
|
11978
|
+
"Solicitar ajustes ou refinar tarefas",
|
|
11979
|
+
"Rejeitar / Cancelar plano"
|
|
11980
|
+
]
|
|
11981
|
+
};
|
|
11982
|
+
}
|
|
11983
|
+
|
|
11984
|
+
// src/pantheon/deepwork/plan-tracker.ts
|
|
11985
|
+
import { existsSync as existsSync6 } from "node:fs";
|
|
11986
|
+
import { appendFile as appendFile3, mkdir as mkdir6, readdir, readFile as readFile6, rename as rename5, writeFile as writeFile3 } from "node:fs/promises";
|
|
11987
|
+
import { join as join16 } from "node:path";
|
|
11988
|
+
|
|
11989
|
+
// src/pantheon/deepwork/plan-schema.ts
|
|
11990
|
+
import { z as z2 } from "zod";
|
|
11991
|
+
var PlanAcceptanceKindSchema = z2.enum(["test", "command", "file", "manual"]);
|
|
11992
|
+
var PlanAcceptanceCriterionSchema = z2.object({
|
|
11993
|
+
kind: PlanAcceptanceKindSchema,
|
|
11994
|
+
check: z2.string().min(1),
|
|
11995
|
+
fails_now: z2.boolean().default(true),
|
|
11996
|
+
verified: z2.boolean().default(false),
|
|
11997
|
+
proof: z2.string().optional()
|
|
11998
|
+
});
|
|
11999
|
+
var TaskStateSchema = z2.enum([
|
|
12000
|
+
"pending",
|
|
12001
|
+
"ready",
|
|
12002
|
+
"in_progress",
|
|
12003
|
+
"done",
|
|
12004
|
+
"failed",
|
|
12005
|
+
"blocked"
|
|
12006
|
+
]);
|
|
12007
|
+
var PlanTaskSchema = z2.object({
|
|
12008
|
+
id: z2.string().min(1),
|
|
12009
|
+
title: z2.string().min(1),
|
|
12010
|
+
description: z2.string().optional(),
|
|
12011
|
+
agent: z2.string().default("zeus"),
|
|
12012
|
+
phase: z2.number().int().min(0).default(1),
|
|
12013
|
+
state: TaskStateSchema.default("pending"),
|
|
12014
|
+
depends_on: z2.array(z2.string()).default([]),
|
|
12015
|
+
parallel_safe: z2.boolean().default(false),
|
|
12016
|
+
acceptance: z2.array(PlanAcceptanceCriterionSchema).default([]),
|
|
12017
|
+
result: z2.object({
|
|
12018
|
+
summary: z2.string().optional(),
|
|
12019
|
+
verified_at: z2.string().optional(),
|
|
12020
|
+
artifacts: z2.array(z2.string()).optional()
|
|
12021
|
+
}).optional()
|
|
12022
|
+
});
|
|
12023
|
+
var DecisionStatusSchema = z2.enum(["pending", "resolved"]);
|
|
12024
|
+
var PlanDecisionSchema = z2.object({
|
|
12025
|
+
id: z2.string().min(1),
|
|
12026
|
+
question: z2.string().min(1),
|
|
12027
|
+
options: z2.array(z2.string()).min(2),
|
|
12028
|
+
chosen: z2.string().optional(),
|
|
12029
|
+
status: DecisionStatusSchema.default("pending")
|
|
12030
|
+
});
|
|
12031
|
+
var PlanRiskSchema = z2.object({
|
|
12032
|
+
id: z2.string().min(1),
|
|
12033
|
+
description: z2.string().min(1),
|
|
12034
|
+
mitigation: z2.string().optional()
|
|
12035
|
+
});
|
|
12036
|
+
var PlanMetadataSchema = z2.object({
|
|
12037
|
+
created_at: z2.string(),
|
|
12038
|
+
updated_at: z2.string(),
|
|
12039
|
+
version: z2.number().int().default(1)
|
|
12040
|
+
});
|
|
12041
|
+
var DeepworkPlanSchema = z2.object({
|
|
12042
|
+
plan_id: z2.string().min(1),
|
|
12043
|
+
title: z2.string().min(1),
|
|
12044
|
+
intent: z2.string().min(1),
|
|
12045
|
+
done_when: z2.array(z2.string()).default([]),
|
|
12046
|
+
decisions_needed: z2.array(PlanDecisionSchema).default([]),
|
|
12047
|
+
risks: z2.array(PlanRiskSchema).default([]),
|
|
12048
|
+
out_of_scope: z2.array(z2.string()).default([]),
|
|
12049
|
+
tasks: z2.array(PlanTaskSchema).default([]),
|
|
12050
|
+
metadata: PlanMetadataSchema
|
|
12051
|
+
});
|
|
12052
|
+
|
|
12053
|
+
// src/pantheon/deepwork/plan-tracker.ts
|
|
12054
|
+
function deepworkRootDir(cwd = process.cwd()) {
|
|
12055
|
+
return join16(cwd, ".pantheon", "deepwork");
|
|
12056
|
+
}
|
|
12057
|
+
function deepworkPlanDir(cwd = process.cwd(), slug) {
|
|
12058
|
+
return join16(deepworkRootDir(cwd), slug);
|
|
12059
|
+
}
|
|
12060
|
+
function deepworkPlanJsonPath(cwd = process.cwd(), slug) {
|
|
12061
|
+
return join16(deepworkPlanDir(cwd, slug), "plan.json");
|
|
12062
|
+
}
|
|
12063
|
+
function deepworkPlanMdPath(cwd = process.cwd(), slug) {
|
|
12064
|
+
return join16(deepworkPlanDir(cwd, slug), "PLAN.md");
|
|
12065
|
+
}
|
|
12066
|
+
function deepworkJournalPath(cwd = process.cwd(), slug) {
|
|
12067
|
+
return join16(deepworkPlanDir(cwd, slug), "journal.ndjson");
|
|
12068
|
+
}
|
|
12069
|
+
function computeTaskReadiness(plan) {
|
|
12070
|
+
const doneIds = new Set(plan.tasks.filter((t) => t.state === "done").map((t) => t.id));
|
|
12071
|
+
const updatedTasks = plan.tasks.map((task) => {
|
|
12072
|
+
if (task.state === "done" || task.state === "in_progress" || task.state === "failed") {
|
|
12073
|
+
return task;
|
|
12074
|
+
}
|
|
12075
|
+
if (task.depends_on.length === 0) {
|
|
12076
|
+
return task.state === "blocked" ? { ...task, state: "ready" } : task;
|
|
12077
|
+
}
|
|
12078
|
+
const allDepsDone = task.depends_on.every((dep) => doneIds.has(dep));
|
|
12079
|
+
if (allDepsDone && (task.state === "pending" || task.state === "blocked")) {
|
|
12080
|
+
return { ...task, state: "ready" };
|
|
12081
|
+
}
|
|
12082
|
+
if (!allDepsDone && (task.state === "pending" || task.state === "ready")) {
|
|
12083
|
+
return { ...task, state: "blocked" };
|
|
12084
|
+
}
|
|
12085
|
+
return task;
|
|
12086
|
+
});
|
|
12087
|
+
return { ...plan, tasks: updatedTasks };
|
|
12088
|
+
}
|
|
12089
|
+
async function readPlan(cwd = process.cwd(), slug) {
|
|
12090
|
+
const path5 = deepworkPlanJsonPath(cwd, slug);
|
|
12091
|
+
try {
|
|
12092
|
+
const raw = await readFile6(path5, "utf8");
|
|
12093
|
+
const parsed = JSON.parse(raw);
|
|
12094
|
+
return DeepworkPlanSchema.parse(parsed);
|
|
12095
|
+
} catch {
|
|
12096
|
+
return null;
|
|
12097
|
+
}
|
|
12098
|
+
}
|
|
12099
|
+
async function writePlan(cwd = process.cwd(), plan) {
|
|
12100
|
+
const dir = deepworkPlanDir(cwd, plan.plan_id);
|
|
12101
|
+
await mkdir6(dir, { recursive: true });
|
|
12102
|
+
const normalized = computeTaskReadiness({
|
|
12103
|
+
...plan,
|
|
12104
|
+
metadata: {
|
|
12105
|
+
...plan.metadata,
|
|
12106
|
+
updated_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
12107
|
+
version: (plan.metadata.version || 1) + 1
|
|
12108
|
+
}
|
|
12109
|
+
});
|
|
12110
|
+
const jsonPath = deepworkPlanJsonPath(cwd, plan.plan_id);
|
|
12111
|
+
const jsonTmp = `${jsonPath}.tmp`;
|
|
12112
|
+
await writeFile3(jsonTmp, `${JSON.stringify(normalized, null, 2)}
|
|
12113
|
+
`, "utf8");
|
|
12114
|
+
await rename5(jsonTmp, jsonPath);
|
|
12115
|
+
const mdPath = deepworkPlanMdPath(cwd, plan.plan_id);
|
|
12116
|
+
const mdContent = generateMarkdownDocument(normalized);
|
|
12117
|
+
await writeFile3(mdPath, mdContent, "utf8");
|
|
12118
|
+
}
|
|
12119
|
+
async function appendJournal(cwd = process.cwd(), slug, event) {
|
|
12120
|
+
const dir = deepworkPlanDir(cwd, slug);
|
|
12121
|
+
await mkdir6(dir, { recursive: true });
|
|
12122
|
+
const journalPath = deepworkJournalPath(cwd, slug);
|
|
12123
|
+
const line = `${JSON.stringify(event)}
|
|
12124
|
+
`;
|
|
12125
|
+
await appendFile3(journalPath, line, "utf8");
|
|
12126
|
+
}
|
|
12127
|
+
async function updateTaskState(cwd = process.cwd(), slug, taskId, state, result) {
|
|
12128
|
+
const plan = await readPlan(cwd, slug);
|
|
12129
|
+
if (!plan) {
|
|
12130
|
+
throw new Error(`Deepwork plan "${slug}" not found`);
|
|
12131
|
+
}
|
|
12132
|
+
const taskIndex = plan.tasks.findIndex((t) => t.id === taskId);
|
|
12133
|
+
const existingTask = plan.tasks[taskIndex];
|
|
12134
|
+
if (taskIndex === -1 || !existingTask) {
|
|
12135
|
+
throw new Error(`Task "${taskId}" not found in plan "${slug}"`);
|
|
12136
|
+
}
|
|
12137
|
+
const updatedResult = result ? { ...existingTask.result ?? {}, ...result } : existingTask.result;
|
|
12138
|
+
const updatedTask = {
|
|
12139
|
+
...existingTask,
|
|
12140
|
+
state,
|
|
12141
|
+
...updatedResult !== void 0 ? { result: updatedResult } : {}
|
|
12142
|
+
};
|
|
12143
|
+
const updatedTasks = [...plan.tasks];
|
|
12144
|
+
updatedTasks[taskIndex] = updatedTask;
|
|
12145
|
+
const nextPlan = { ...plan, tasks: updatedTasks };
|
|
12146
|
+
await writePlan(cwd, nextPlan);
|
|
12147
|
+
await appendJournal(cwd, slug, {
|
|
12148
|
+
type: "task_state_changed",
|
|
12149
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
12150
|
+
payload: { taskId, state, result }
|
|
12151
|
+
});
|
|
12152
|
+
return await readPlan(cwd, slug) ?? nextPlan;
|
|
12153
|
+
}
|
|
12154
|
+
async function verifyTaskAcceptance(cwd = process.cwd(), slug, taskId, checkIndex, verified, proof) {
|
|
12155
|
+
const plan = await readPlan(cwd, slug);
|
|
12156
|
+
if (!plan) {
|
|
12157
|
+
throw new Error(`Deepwork plan "${slug}" not found`);
|
|
12158
|
+
}
|
|
12159
|
+
const taskIndex = plan.tasks.findIndex((t) => t.id === taskId);
|
|
12160
|
+
const task = plan.tasks[taskIndex];
|
|
12161
|
+
if (taskIndex === -1 || !task) {
|
|
12162
|
+
throw new Error(`Task "${taskId}" not found in plan "${slug}"`);
|
|
12163
|
+
}
|
|
12164
|
+
const currentAcc = task.acceptance[checkIndex];
|
|
12165
|
+
if (!currentAcc) {
|
|
12166
|
+
throw new Error(`Acceptance criterion index ${checkIndex} not found in task "${taskId}"`);
|
|
12167
|
+
}
|
|
12168
|
+
const updatedAcceptance = [...task.acceptance];
|
|
12169
|
+
const resolvedProof = proof ?? currentAcc.proof;
|
|
12170
|
+
updatedAcceptance[checkIndex] = {
|
|
12171
|
+
...currentAcc,
|
|
12172
|
+
verified,
|
|
12173
|
+
...resolvedProof !== void 0 ? { proof: resolvedProof } : {}
|
|
12174
|
+
};
|
|
12175
|
+
const allVerified = updatedAcceptance.every((acc) => acc.verified);
|
|
12176
|
+
const updatedTasks = [...plan.tasks];
|
|
12177
|
+
updatedTasks[taskIndex] = {
|
|
12178
|
+
...task,
|
|
12179
|
+
acceptance: updatedAcceptance,
|
|
12180
|
+
state: allVerified ? "done" : task.state
|
|
12181
|
+
};
|
|
12182
|
+
const nextPlan = { ...plan, tasks: updatedTasks };
|
|
12183
|
+
await writePlan(cwd, nextPlan);
|
|
12184
|
+
await appendJournal(cwd, slug, {
|
|
12185
|
+
type: "acceptance_verified",
|
|
12186
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
12187
|
+
payload: { taskId, checkIndex, verified, proof, allVerified }
|
|
12188
|
+
});
|
|
12189
|
+
return await readPlan(cwd, slug) ?? nextPlan;
|
|
12190
|
+
}
|
|
12191
|
+
async function resolvePlanDecision(cwd = process.cwd(), slug, decisionId, chosen) {
|
|
12192
|
+
const plan = await readPlan(cwd, slug);
|
|
12193
|
+
if (!plan) {
|
|
12194
|
+
throw new Error(`Deepwork plan "${slug}" not found`);
|
|
12195
|
+
}
|
|
12196
|
+
const decIndex = plan.decisions_needed.findIndex((d) => d.id === decisionId);
|
|
12197
|
+
const existingDec = plan.decisions_needed[decIndex];
|
|
12198
|
+
if (decIndex === -1 || !existingDec) {
|
|
12199
|
+
throw new Error(`Decision "${decisionId}" not found in plan "${slug}"`);
|
|
12200
|
+
}
|
|
12201
|
+
const updatedDecisions = [...plan.decisions_needed];
|
|
12202
|
+
updatedDecisions[decIndex] = {
|
|
12203
|
+
...existingDec,
|
|
12204
|
+
chosen,
|
|
12205
|
+
status: "resolved"
|
|
12206
|
+
};
|
|
12207
|
+
const nextPlan = { ...plan, decisions_needed: updatedDecisions };
|
|
12208
|
+
await writePlan(cwd, nextPlan);
|
|
12209
|
+
await appendJournal(cwd, slug, {
|
|
12210
|
+
type: "decision_resolved",
|
|
12211
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
12212
|
+
payload: { decisionId, chosen }
|
|
12213
|
+
});
|
|
12214
|
+
return await readPlan(cwd, slug) ?? nextPlan;
|
|
12215
|
+
}
|
|
12216
|
+
async function listPlans(cwd = process.cwd()) {
|
|
12217
|
+
const root = deepworkRootDir(cwd);
|
|
12218
|
+
if (!existsSync6(root)) return [];
|
|
12219
|
+
const entries = await readdir(root, { withFileTypes: true });
|
|
12220
|
+
const result = [];
|
|
12221
|
+
for (const entry of entries) {
|
|
12222
|
+
if (entry.isDirectory()) {
|
|
12223
|
+
const plan = await readPlan(cwd, entry.name);
|
|
12224
|
+
if (plan) {
|
|
12225
|
+
result.push({
|
|
12226
|
+
slug: plan.plan_id,
|
|
12227
|
+
title: plan.title,
|
|
12228
|
+
tasks_count: plan.tasks.length,
|
|
12229
|
+
done_count: plan.tasks.filter((t) => t.state === "done").length,
|
|
12230
|
+
updated_at: plan.metadata.updated_at
|
|
12231
|
+
});
|
|
12232
|
+
}
|
|
12233
|
+
}
|
|
12234
|
+
}
|
|
12235
|
+
return result;
|
|
12236
|
+
}
|
|
12237
|
+
|
|
12238
|
+
// src/pantheon/deepwork/deepwork-tool.ts
|
|
12239
|
+
var DeepworkToolInputSchema = z3.object({
|
|
12240
|
+
action: z3.enum([
|
|
12241
|
+
"init",
|
|
12242
|
+
"status",
|
|
12243
|
+
"update_task",
|
|
12244
|
+
"verify_acceptance",
|
|
12245
|
+
"resolve_decision",
|
|
12246
|
+
"list",
|
|
12247
|
+
"get_approval_question"
|
|
12248
|
+
]).default("list"),
|
|
12249
|
+
slug: z3.string().optional(),
|
|
12250
|
+
title: z3.string().optional(),
|
|
12251
|
+
intent: z3.string().optional(),
|
|
12252
|
+
tasks: z3.array(z3.record(z3.string(), z3.unknown())).optional(),
|
|
12253
|
+
decisions: z3.array(z3.record(z3.string(), z3.unknown())).optional(),
|
|
12254
|
+
done_when: z3.array(z3.string()).optional(),
|
|
12255
|
+
taskId: z3.string().optional(),
|
|
12256
|
+
state: z3.enum(["pending", "ready", "in_progress", "done", "failed", "blocked"]).optional(),
|
|
12257
|
+
checkIndex: z3.number().int().min(0).optional(),
|
|
12258
|
+
verified: z3.boolean().optional(),
|
|
12259
|
+
proof: z3.string().optional(),
|
|
12260
|
+
decisionId: z3.string().optional(),
|
|
12261
|
+
choice: z3.string().optional(),
|
|
12262
|
+
summary: z3.string().optional()
|
|
12263
|
+
});
|
|
12264
|
+
function createDeepworkTool(cwd = process.cwd()) {
|
|
12265
|
+
return {
|
|
12266
|
+
name: "pantheon_deepwork",
|
|
12267
|
+
description: "Manage canonical Deepwork plans (.pantheon/deepwork/<slug>/plan.json, journal.ndjson, PLAN.md). Track DAG dependencies, update task states, record fail-first verification receipts, and inspect compact chat projections.",
|
|
12268
|
+
input: {
|
|
12269
|
+
type: "object",
|
|
12270
|
+
properties: {
|
|
12271
|
+
action: {
|
|
12272
|
+
type: "string",
|
|
12273
|
+
enum: [
|
|
12274
|
+
"init",
|
|
12275
|
+
"status",
|
|
12276
|
+
"update_task",
|
|
12277
|
+
"verify_acceptance",
|
|
12278
|
+
"resolve_decision",
|
|
12279
|
+
"list",
|
|
12280
|
+
"get_approval_question"
|
|
12281
|
+
],
|
|
12282
|
+
description: "The Deepwork plan management action to perform."
|
|
12283
|
+
},
|
|
12284
|
+
slug: {
|
|
12285
|
+
type: "string",
|
|
12286
|
+
description: "Unique plan slug / directory name (e.g. auth-jwt, dashboard-ui)."
|
|
12287
|
+
},
|
|
12288
|
+
title: {
|
|
12289
|
+
type: "string",
|
|
12290
|
+
description: "Human-readable title of the deepwork plan (for init)."
|
|
12291
|
+
},
|
|
12292
|
+
intent: {
|
|
12293
|
+
type: "string",
|
|
12294
|
+
description: "The intent, problem description, and objectives (for init)."
|
|
12295
|
+
},
|
|
12296
|
+
tasks: {
|
|
12297
|
+
type: "array",
|
|
12298
|
+
description: "List of structured tasks with acceptance criteria (for init)."
|
|
12299
|
+
},
|
|
12300
|
+
decisions: {
|
|
12301
|
+
type: "array",
|
|
12302
|
+
description: "List of required architectural decisions (for init)."
|
|
12303
|
+
},
|
|
12304
|
+
done_when: {
|
|
12305
|
+
type: "array",
|
|
12306
|
+
description: "List of done criteria strings (for init)."
|
|
12307
|
+
},
|
|
12308
|
+
taskId: {
|
|
12309
|
+
type: "string",
|
|
12310
|
+
description: "Target task ID (e.g. T01, T02) for updates or verification."
|
|
12311
|
+
},
|
|
12312
|
+
state: {
|
|
12313
|
+
type: "string",
|
|
12314
|
+
enum: ["pending", "ready", "in_progress", "done", "failed", "blocked"],
|
|
12315
|
+
description: "New state for the specified task."
|
|
12316
|
+
},
|
|
12317
|
+
checkIndex: {
|
|
12318
|
+
type: "number",
|
|
12319
|
+
description: "Zero-based index of the acceptance criterion to verify."
|
|
12320
|
+
},
|
|
12321
|
+
verified: {
|
|
12322
|
+
type: "boolean",
|
|
12323
|
+
description: "Whether the acceptance criterion check passed."
|
|
12324
|
+
},
|
|
12325
|
+
proof: {
|
|
12326
|
+
type: "string",
|
|
12327
|
+
description: "Evidence snippet, command output, or test receipt."
|
|
12328
|
+
},
|
|
12329
|
+
decisionId: {
|
|
12330
|
+
type: "string",
|
|
12331
|
+
description: "Target decision ID (e.g. D01) for resolution."
|
|
12332
|
+
},
|
|
12333
|
+
choice: {
|
|
12334
|
+
type: "string",
|
|
12335
|
+
description: "The chosen option for the decision."
|
|
12336
|
+
},
|
|
12337
|
+
summary: {
|
|
12338
|
+
type: "string",
|
|
12339
|
+
description: "Summary of results or deliverable for a completed task."
|
|
12340
|
+
}
|
|
12341
|
+
},
|
|
12342
|
+
required: []
|
|
12343
|
+
},
|
|
12344
|
+
output: {},
|
|
12345
|
+
async execute(input, context) {
|
|
12346
|
+
const parsed = DeepworkToolInputSchema.parse(input);
|
|
12347
|
+
const effectiveCwd = typeof context?.directory === "string" ? context.directory : cwd;
|
|
12348
|
+
if (parsed.action === "list") {
|
|
12349
|
+
const plans = await listPlans(effectiveCwd);
|
|
12350
|
+
if (plans.length === 0) {
|
|
12351
|
+
return {
|
|
12352
|
+
output: "Nenhum plano de Deepwork encontrado em .pantheon/deepwork/.",
|
|
12353
|
+
title: "Deepwork: List"
|
|
12354
|
+
};
|
|
12355
|
+
}
|
|
12356
|
+
const lines = [
|
|
12357
|
+
"### Planos de Deepwork Dispon\xEDveis:",
|
|
12358
|
+
"| Slug | T\xEDtulo | Progresso | Atualizado em |",
|
|
12359
|
+
"|---|---|---|---|"
|
|
12360
|
+
];
|
|
12361
|
+
for (const p of plans) {
|
|
12362
|
+
lines.push(
|
|
12363
|
+
`| \`${p.slug}\` | ${p.title} | ${p.done_count}/${p.tasks_count} tarefas | ${p.updated_at} |`
|
|
12364
|
+
);
|
|
12365
|
+
}
|
|
12366
|
+
return {
|
|
12367
|
+
output: lines.join("\n"),
|
|
12368
|
+
title: "Deepwork: List"
|
|
12369
|
+
};
|
|
12370
|
+
}
|
|
12371
|
+
const slug = parsed.slug?.trim();
|
|
12372
|
+
if (!slug) {
|
|
12373
|
+
throw new Error(`O par\xE2metro 'slug' \xE9 obrigat\xF3rio para a a\xE7\xE3o '${parsed.action}'.`);
|
|
12374
|
+
}
|
|
12375
|
+
if (parsed.action === "init") {
|
|
12376
|
+
const title = parsed.title?.trim() || slug;
|
|
12377
|
+
const intent = parsed.intent?.trim() || "Plano de deepwork estruturado.";
|
|
12378
|
+
const rawTasks = parsed.tasks ?? [];
|
|
12379
|
+
const rawDecisions = parsed.decisions ?? [];
|
|
12380
|
+
const doneWhen = parsed.done_when ?? [];
|
|
12381
|
+
const tasks = rawTasks.map((t, idx) => ({
|
|
12382
|
+
id: typeof t.id === "string" ? t.id : `T${String(idx + 1).padStart(2, "0")}`,
|
|
12383
|
+
title: typeof t.title === "string" ? t.title : `Task ${idx + 1}`,
|
|
12384
|
+
description: typeof t.description === "string" ? t.description : void 0,
|
|
12385
|
+
agent: typeof t.agent === "string" ? t.agent : "zeus",
|
|
12386
|
+
phase: typeof t.phase === "number" ? t.phase : 1,
|
|
12387
|
+
state: typeof t.state === "string" ? t.state : "pending",
|
|
12388
|
+
depends_on: Array.isArray(t.depends_on) ? t.depends_on : [],
|
|
12389
|
+
parallel_safe: Boolean(t.parallel_safe),
|
|
12390
|
+
acceptance: Array.isArray(t.acceptance) ? t.acceptance.map((a) => ({
|
|
12391
|
+
kind: a.kind || "command",
|
|
12392
|
+
check: a.check || "verify",
|
|
12393
|
+
fails_now: a.fails_now ?? true,
|
|
12394
|
+
verified: a.verified ?? false,
|
|
12395
|
+
proof: a.proof
|
|
12396
|
+
})) : []
|
|
12397
|
+
}));
|
|
12398
|
+
const decisions = rawDecisions.map((d, idx) => ({
|
|
12399
|
+
id: typeof d.id === "string" ? d.id : `D${String(idx + 1).padStart(2, "0")}`,
|
|
12400
|
+
question: typeof d.question === "string" ? d.question : "Decis\xE3o necess\xE1ria",
|
|
12401
|
+
options: Array.isArray(d.options) ? d.options : ["Sim", "N\xE3o"],
|
|
12402
|
+
chosen: typeof d.chosen === "string" ? d.chosen : void 0,
|
|
12403
|
+
status: d.chosen ? "resolved" : "pending"
|
|
12404
|
+
}));
|
|
12405
|
+
const initialPlan = computeTaskReadiness({
|
|
12406
|
+
plan_id: slug,
|
|
12407
|
+
title,
|
|
12408
|
+
intent,
|
|
12409
|
+
done_when: doneWhen,
|
|
12410
|
+
decisions_needed: decisions,
|
|
12411
|
+
risks: [],
|
|
12412
|
+
out_of_scope: [],
|
|
12413
|
+
tasks,
|
|
12414
|
+
metadata: {
|
|
12415
|
+
created_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
12416
|
+
updated_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
12417
|
+
version: 1
|
|
12418
|
+
}
|
|
12419
|
+
});
|
|
12420
|
+
await writePlan(effectiveCwd, initialPlan);
|
|
12421
|
+
await appendJournal(effectiveCwd, slug, {
|
|
12422
|
+
type: "plan_created",
|
|
12423
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
12424
|
+
payload: { slug, title, tasks_count: tasks.length }
|
|
12425
|
+
});
|
|
12426
|
+
const projection = generateChatProjection(initialPlan, effectiveCwd);
|
|
12427
|
+
const approvalQ = buildApprovalQuestion(initialPlan);
|
|
12428
|
+
return {
|
|
12429
|
+
output: [
|
|
12430
|
+
`\u2705 Plano de Deepwork '${title}' inicializado com sucesso em \`.pantheon/deepwork/${slug}/\`!`,
|
|
12431
|
+
`- \u{1F517} **Deeplink PLAN.md:** [Abrir PLAN.md](file://${deepworkPlanMdPath(effectiveCwd, slug)})`,
|
|
12432
|
+
`- \u{1F517} **Deeplink plan.json:** [Abrir plan.json](file://${deepworkPlanJsonPath(effectiveCwd, slug)})`,
|
|
12433
|
+
"",
|
|
12434
|
+
projection,
|
|
12435
|
+
"",
|
|
12436
|
+
"**Pergunta de Aprova\xE7\xE3o Nativa (Gate 1):**",
|
|
12437
|
+
`\`${JSON.stringify(approvalQ)}\``
|
|
12438
|
+
].join("\n"),
|
|
12439
|
+
title: `Deepwork Init: ${slug}`
|
|
12440
|
+
};
|
|
12441
|
+
}
|
|
12442
|
+
const currentPlan = await readPlan(effectiveCwd, slug);
|
|
12443
|
+
if (!currentPlan) {
|
|
12444
|
+
throw new Error(`Plano de Deepwork '${slug}' n\xE3o encontrado.`);
|
|
12445
|
+
}
|
|
12446
|
+
if (parsed.action === "status") {
|
|
12447
|
+
const projection = generateChatProjection(currentPlan, effectiveCwd);
|
|
12448
|
+
const dag = generateMermaidDag(currentPlan);
|
|
12449
|
+
return {
|
|
12450
|
+
output: [projection, "", "#### Grafo de Depend\xEAncias (DAG):", dag].join("\n"),
|
|
12451
|
+
title: `Deepwork Status: ${slug}`
|
|
12452
|
+
};
|
|
12453
|
+
}
|
|
12454
|
+
if (parsed.action === "get_approval_question") {
|
|
12455
|
+
const q = buildApprovalQuestion(currentPlan);
|
|
12456
|
+
return {
|
|
12457
|
+
output: JSON.stringify(q, null, 2),
|
|
12458
|
+
title: `Deepwork Approval Question: ${slug}`
|
|
12459
|
+
};
|
|
12460
|
+
}
|
|
12461
|
+
if (parsed.action === "update_task") {
|
|
12462
|
+
if (!parsed.taskId) throw new Error("Par\xE2metro 'taskId' obrigat\xF3rio para update_task.");
|
|
12463
|
+
if (!parsed.state) throw new Error("Par\xE2metro 'state' obrigat\xF3rio para update_task.");
|
|
12464
|
+
const resultMeta = {};
|
|
12465
|
+
if (parsed.summary !== void 0) {
|
|
12466
|
+
resultMeta.summary = parsed.summary;
|
|
12467
|
+
}
|
|
12468
|
+
const updated = await updateTaskState(
|
|
12469
|
+
effectiveCwd,
|
|
12470
|
+
slug,
|
|
12471
|
+
parsed.taskId,
|
|
12472
|
+
parsed.state,
|
|
12473
|
+
resultMeta
|
|
12474
|
+
);
|
|
12475
|
+
const projection = generateChatProjection(updated, effectiveCwd);
|
|
12476
|
+
return {
|
|
12477
|
+
output: [
|
|
12478
|
+
`Tarefa **[${parsed.taskId}]** atualizada para \`${parsed.state}\`.`,
|
|
12479
|
+
"",
|
|
12480
|
+
projection
|
|
12481
|
+
].join("\n"),
|
|
12482
|
+
title: `Deepwork Task: ${parsed.taskId} -> ${parsed.state}`
|
|
12483
|
+
};
|
|
12484
|
+
}
|
|
12485
|
+
if (parsed.action === "verify_acceptance") {
|
|
12486
|
+
if (!parsed.taskId)
|
|
12487
|
+
throw new Error("Par\xE2metro 'taskId' obrigat\xF3rio para verify_acceptance.");
|
|
12488
|
+
if (parsed.checkIndex === void 0)
|
|
12489
|
+
throw new Error("Par\xE2metro 'checkIndex' obrigat\xF3rio para verify_acceptance.");
|
|
12490
|
+
if (parsed.verified === void 0)
|
|
12491
|
+
throw new Error("Par\xE2metro 'verified' obrigat\xF3rio para verify_acceptance.");
|
|
12492
|
+
const updated = await verifyTaskAcceptance(
|
|
12493
|
+
effectiveCwd,
|
|
12494
|
+
slug,
|
|
12495
|
+
parsed.taskId,
|
|
12496
|
+
parsed.checkIndex,
|
|
12497
|
+
parsed.verified,
|
|
12498
|
+
parsed.proof
|
|
12499
|
+
);
|
|
12500
|
+
const projection = generateChatProjection(updated, effectiveCwd);
|
|
12501
|
+
return {
|
|
12502
|
+
output: [
|
|
12503
|
+
`Crit\xE9rio de aceite #${parsed.checkIndex} da tarefa **[${parsed.taskId}]** verificado: ${parsed.verified ? "\u2705 PASS" : "\u274C FAIL"}.`,
|
|
12504
|
+
parsed.proof ? `*Evid\xEAncia/Receipt:* \`${parsed.proof}\`` : "",
|
|
12505
|
+
"",
|
|
12506
|
+
projection
|
|
12507
|
+
].filter(Boolean).join("\n"),
|
|
12508
|
+
title: `Deepwork Verify: ${parsed.taskId} [${parsed.checkIndex}]`
|
|
12509
|
+
};
|
|
12510
|
+
}
|
|
12511
|
+
if (parsed.action === "resolve_decision") {
|
|
12512
|
+
if (!parsed.decisionId)
|
|
12513
|
+
throw new Error("Par\xE2metro 'decisionId' obrigat\xF3rio para resolve_decision.");
|
|
12514
|
+
if (!parsed.choice) throw new Error("Par\xE2metro 'choice' obrigat\xF3rio para resolve_decision.");
|
|
12515
|
+
const updated = await resolvePlanDecision(
|
|
12516
|
+
effectiveCwd,
|
|
12517
|
+
slug,
|
|
12518
|
+
parsed.decisionId,
|
|
12519
|
+
parsed.choice
|
|
12520
|
+
);
|
|
12521
|
+
const projection = generateChatProjection(updated, effectiveCwd);
|
|
12522
|
+
return {
|
|
12523
|
+
output: [
|
|
12524
|
+
`Decis\xE3o **[${parsed.decisionId}]** resolvida com a op\xE7\xE3o: "${parsed.choice}".`,
|
|
12525
|
+
"",
|
|
12526
|
+
projection
|
|
12527
|
+
].join("\n"),
|
|
12528
|
+
title: `Deepwork Decision: ${parsed.decisionId}`
|
|
12529
|
+
};
|
|
12530
|
+
}
|
|
12531
|
+
throw new Error(`A\xE7\xE3o '${parsed.action}' n\xE3o reconhecida.`);
|
|
12532
|
+
}
|
|
12533
|
+
};
|
|
12534
|
+
}
|
|
12535
|
+
|
|
11655
12536
|
// src/pantheon/hashline/tool.ts
|
|
11656
|
-
import { readFile as
|
|
12537
|
+
import { readFile as readFile7, rename as rename6, rm, writeFile as writeFile4 } from "node:fs/promises";
|
|
11657
12538
|
import { isAbsolute as isAbsolute4, resolve as resolve6, sep as sep4 } from "node:path";
|
|
11658
|
-
import { z as
|
|
12539
|
+
import { z as z4 } from "zod";
|
|
11659
12540
|
var hashlineEditOpArgs = {
|
|
11660
|
-
op:
|
|
11661
|
-
ref:
|
|
11662
|
-
endRef:
|
|
11663
|
-
lines:
|
|
11664
|
-
content:
|
|
12541
|
+
op: z4.enum(["replace", "append", "prepend", "delete"]),
|
|
12542
|
+
ref: z4.string().min(1),
|
|
12543
|
+
endRef: z4.string().optional(),
|
|
12544
|
+
lines: z4.array(z4.string()).optional(),
|
|
12545
|
+
content: z4.string().optional()
|
|
11665
12546
|
};
|
|
11666
12547
|
var hashlineEditArgs = {
|
|
11667
|
-
file:
|
|
11668
|
-
edits:
|
|
12548
|
+
file: z4.string().min(1),
|
|
12549
|
+
edits: z4.array(z4.object(hashlineEditOpArgs)).min(1)
|
|
11669
12550
|
};
|
|
11670
12551
|
function resolveFile(file, ctx) {
|
|
11671
12552
|
if (isAbsolute4(file)) return { ok: true, file: resolve6(file) };
|
|
@@ -11737,7 +12618,7 @@ function createHashlineEditTool() {
|
|
|
11737
12618
|
const file = resolved.file;
|
|
11738
12619
|
let original;
|
|
11739
12620
|
try {
|
|
11740
|
-
original = await
|
|
12621
|
+
original = await readFile7(file, "utf8");
|
|
11741
12622
|
} catch {
|
|
11742
12623
|
return `hashline_edit: cannot read "${file}" \u2014 check the path and try again`;
|
|
11743
12624
|
}
|
|
@@ -11763,8 +12644,8 @@ function createHashlineEditTool() {
|
|
|
11763
12644
|
if (hadTrailingNewline && !out.endsWith("\n")) out += "\n";
|
|
11764
12645
|
const tmpPath = `${file}.tmp-${process.pid}`;
|
|
11765
12646
|
try {
|
|
11766
|
-
await
|
|
11767
|
-
await
|
|
12647
|
+
await writeFile4(tmpPath, out, "utf8");
|
|
12648
|
+
await rename6(tmpPath, file);
|
|
11768
12649
|
} catch {
|
|
11769
12650
|
await rm(tmpPath, { force: true }).catch(() => {
|
|
11770
12651
|
});
|
|
@@ -11919,21 +12800,21 @@ function createV2LocalDecisionDefinition(options = {}) {
|
|
|
11919
12800
|
// src/pantheon/model-command.ts
|
|
11920
12801
|
import { randomBytes } from "node:crypto";
|
|
11921
12802
|
import { constants as constants4 } from "node:fs";
|
|
11922
|
-
import { lstat as lstat2, mkdir as
|
|
12803
|
+
import { lstat as lstat2, mkdir as mkdir7, open as open3, rename as rename7, unlink as unlink4 } from "node:fs/promises";
|
|
11923
12804
|
import { homedir as homedir7 } from "node:os";
|
|
11924
|
-
import { basename as basename2, dirname as dirname9, join as
|
|
11925
|
-
import { z as
|
|
12805
|
+
import { basename as basename2, dirname as dirname9, join as join17, resolve as resolve7 } from "node:path";
|
|
12806
|
+
import { z as z5 } from "zod";
|
|
11926
12807
|
var MODEL_REF_PATTERN2 = /^[A-Za-z0-9][A-Za-z0-9._-]*\/[A-Za-z0-9][A-Za-z0-9._:+-]*$/;
|
|
11927
12808
|
var SAFE_PRESET_NAME = /^[A-Za-z0-9][A-Za-z0-9._-]*$/;
|
|
11928
12809
|
var KNOWN_AGENTS_SET2 = new Set(KNOWN_AGENTS);
|
|
11929
12810
|
var modelArgs = {
|
|
11930
|
-
action:
|
|
11931
|
-
agent:
|
|
11932
|
-
model:
|
|
11933
|
-
effort:
|
|
11934
|
-
scope:
|
|
11935
|
-
confirm:
|
|
11936
|
-
authorize_global:
|
|
12811
|
+
action: z5.enum(["status", "show", "set", "reset"]).optional().describe("Operation: status/show, set, or reset. No args runs wizard."),
|
|
12812
|
+
agent: z5.string().optional().describe("Agent name (one of 14 canonical agents)."),
|
|
12813
|
+
model: z5.string().optional().describe("Model in provider/model-id format; used by set."),
|
|
12814
|
+
effort: z5.enum(["low", "medium", "high"]).optional().describe("Reasoning effort (variant), clamped to model capability."),
|
|
12815
|
+
scope: z5.enum(["project", "global"]).optional().describe("Configuration scope for active-preset.json (default project)."),
|
|
12816
|
+
confirm: z5.boolean().optional().describe("Explicitly confirm a mutating operation, required for global changes."),
|
|
12817
|
+
authorize_global: z5.boolean().optional().describe("Separate authorization for changing global configuration; not implied by -y.")
|
|
11937
12818
|
};
|
|
11938
12819
|
var ModelCommandError = class extends Error {
|
|
11939
12820
|
constructor(message) {
|
|
@@ -12010,7 +12891,7 @@ async function createTemporaryFile(path5) {
|
|
|
12010
12891
|
const prefix = `.${basename2(path5)}.tmp-`;
|
|
12011
12892
|
const flags = constants4.O_WRONLY | constants4.O_CREAT | constants4.O_EXCL | NO_FOLLOW;
|
|
12012
12893
|
for (let attempt = 0; attempt < 10; attempt += 1) {
|
|
12013
|
-
const temporaryPath =
|
|
12894
|
+
const temporaryPath = join17(directory, `${prefix}${randomBytes(16).toString("hex")}`);
|
|
12014
12895
|
try {
|
|
12015
12896
|
return { path: temporaryPath, file: await open3(temporaryPath, flags, DEFAULT_FILE_MODE) };
|
|
12016
12897
|
} catch (error) {
|
|
@@ -12044,7 +12925,7 @@ async function atomicReplace(path5, content, mode, label, expectedExists) {
|
|
|
12044
12925
|
if (current !== void 0 !== expectedExists) {
|
|
12045
12926
|
throw new ModelCommandError(`${label} changed while it was being updated`);
|
|
12046
12927
|
}
|
|
12047
|
-
await
|
|
12928
|
+
await rename7(temporaryPath, path5);
|
|
12048
12929
|
renamed = true;
|
|
12049
12930
|
await syncDirectory(dirname9(path5));
|
|
12050
12931
|
} finally {
|
|
@@ -12077,28 +12958,28 @@ function envValue(options) {
|
|
|
12077
12958
|
return options.env ?? process.env;
|
|
12078
12959
|
}
|
|
12079
12960
|
function projectConfigPath(options) {
|
|
12080
|
-
return options.projectConfigPath ??
|
|
12961
|
+
return options.projectConfigPath ?? join17(options.cwd ?? process.cwd(), "opencode.json");
|
|
12081
12962
|
}
|
|
12082
12963
|
function defaultGlobalConfigPath(options) {
|
|
12083
12964
|
const env = envValue(options);
|
|
12084
12965
|
const home = env.HOME?.trim() || homedir7();
|
|
12085
|
-
const xdg = env.XDG_CONFIG_HOME?.trim() ||
|
|
12086
|
-
return
|
|
12966
|
+
const xdg = env.XDG_CONFIG_HOME?.trim() || join17(home, ".config");
|
|
12967
|
+
return join17(xdg, "opencode", "opencode.json");
|
|
12087
12968
|
}
|
|
12088
12969
|
function globalConfigCandidates(options) {
|
|
12089
12970
|
if (options.globalConfigPath !== void 0) return [options.globalConfigPath];
|
|
12090
12971
|
const canonical = defaultGlobalConfigPath(options);
|
|
12091
12972
|
const home = envValue(options).HOME?.trim() || homedir7();
|
|
12092
|
-
const legacy =
|
|
12973
|
+
const legacy = join17(home, ".opencode", "opencode.json");
|
|
12093
12974
|
return [.../* @__PURE__ */ new Set([canonical, legacy])];
|
|
12094
12975
|
}
|
|
12095
12976
|
function activePresetCandidatesList(options) {
|
|
12096
12977
|
if (options.activePresetCandidates !== void 0) {
|
|
12097
12978
|
return options.activePresetCandidates.map((p) => resolve7(p));
|
|
12098
12979
|
}
|
|
12099
|
-
const projectPreset =
|
|
12980
|
+
const projectPreset = join17(dirname9(projectConfigPath(options)), ".pantheon", "active-preset.json");
|
|
12100
12981
|
const globalPresets = globalConfigCandidates(options).map(
|
|
12101
|
-
(p) =>
|
|
12982
|
+
(p) => join17(dirname9(p), ".pantheon", "active-preset.json")
|
|
12102
12983
|
);
|
|
12103
12984
|
return [...new Set([projectPreset, ...globalPresets].map((p) => resolve7(p)))];
|
|
12104
12985
|
}
|
|
@@ -12112,7 +12993,7 @@ function presetPathForScope(options, scope) {
|
|
|
12112
12993
|
const second = candidates[1];
|
|
12113
12994
|
if (second) return second;
|
|
12114
12995
|
const globalCandidates = globalConfigCandidates(options).map(
|
|
12115
|
-
(p) => resolve7(
|
|
12996
|
+
(p) => resolve7(join17(dirname9(p), ".pantheon", "active-preset.json"))
|
|
12116
12997
|
);
|
|
12117
12998
|
const fallback = globalCandidates[0] ?? candidates[0];
|
|
12118
12999
|
if (!fallback) throw new ModelCommandError("global preset path is unavailable");
|
|
@@ -12242,7 +13123,7 @@ function validateMutationAuthorization(args, scope) {
|
|
|
12242
13123
|
}
|
|
12243
13124
|
async function writeActivePresetAtomically(path5, data, current) {
|
|
12244
13125
|
const backupPath = `${path5}.bak`;
|
|
12245
|
-
await
|
|
13126
|
+
await mkdir7(dirname9(path5), { recursive: true });
|
|
12246
13127
|
const originalMode = current.mode ?? DEFAULT_FILE_MODE;
|
|
12247
13128
|
const backupMode = originalMode & 384;
|
|
12248
13129
|
const backup = await regularPath(backupPath, "configuration backup");
|
|
@@ -12631,9 +13512,7 @@ async function runWizard(options) {
|
|
|
12631
13512
|
function createModelCommand(options = {}) {
|
|
12632
13513
|
const args = options.v2Mode ? {
|
|
12633
13514
|
...modelArgs,
|
|
12634
|
-
action: modelArgs.action.describe(
|
|
12635
|
-
"Operation: status/show, set, or reset. V1 no-args invocation runs the legacy wizard."
|
|
12636
|
-
)
|
|
13515
|
+
action: modelArgs.action.describe("Operation: status/show, set, or reset.")
|
|
12637
13516
|
} : modelArgs;
|
|
12638
13517
|
return {
|
|
12639
13518
|
pantheon_model: {
|
|
@@ -12889,7 +13768,7 @@ var invokedDirectly = process.argv[1] !== void 0 && import.meta.url === pathToFi
|
|
|
12889
13768
|
if (invokedDirectly) main();
|
|
12890
13769
|
|
|
12891
13770
|
// src/pantheon/skill-search-tool.ts
|
|
12892
|
-
var TOOL_DESCRIPTION3 = "Advisory discovery tool for skills. Queries installed Pantheon skills and external registries (Anthropic catalog, skills.sh, GitHub). Returns matched skill IDs, descriptions, install counts, and provenance tiers. Zeus uses this to recommend skills before prompting the user
|
|
13771
|
+
var TOOL_DESCRIPTION3 = "Advisory discovery tool for skills. Queries installed Pantheon skills and external registries (Anthropic catalog, skills.sh, GitHub). Returns matched skill IDs, descriptions, install counts, and provenance tiers. Zeus uses this to recommend project-scoped skills (.agents/skills/) before proactively prompting the user via the question tool.";
|
|
12893
13772
|
var SKILL_SEARCH_INPUT_SCHEMA = {
|
|
12894
13773
|
type: "object",
|
|
12895
13774
|
additionalProperties: false,
|
|
@@ -12977,7 +13856,7 @@ function executeSkillSearch(input) {
|
|
|
12977
13856
|
installed: false,
|
|
12978
13857
|
installs: entry.installs ?? null,
|
|
12979
13858
|
url: entry.url,
|
|
12980
|
-
installCommand: `npx skills add ${entry.skill} -a opencode`
|
|
13859
|
+
installCommand: `npx skills add ${entry.skill} -a opencode -y`
|
|
12981
13860
|
});
|
|
12982
13861
|
}
|
|
12983
13862
|
}
|
|
@@ -13304,6 +14183,7 @@ function createV2ToolDefinitions(visionRuntime, shadow = {}, jevRuntime) {
|
|
|
13304
14183
|
);
|
|
13305
14184
|
definitions.push(todowriteTool);
|
|
13306
14185
|
definitions.push(createV2SkillSearchDefinition());
|
|
14186
|
+
definitions.push(createDeepworkTool());
|
|
13307
14187
|
if (visionRuntime) definitions.push(createV2VisionTool(visionRuntime));
|
|
13308
14188
|
if (jevRuntime) definitions.push(createV2JevDecisionDefinition(jevRuntime));
|
|
13309
14189
|
return definitions;
|
|
@@ -13364,7 +14244,7 @@ var UNSUPPORTED_FEATURE_SEED = Object.freeze([
|
|
|
13364
14244
|
|
|
13365
14245
|
// src/plugin.ts
|
|
13366
14246
|
var V2_UNSUPPORTED_FEATURES = [...UNSUPPORTED_FEATURE_SEED];
|
|
13367
|
-
var POLICY_MARKER = "<!-- pantheon-
|
|
14247
|
+
var POLICY_MARKER = "<!-- pantheon-policy -->";
|
|
13368
14248
|
var POLICY = `${POLICY_MARKER}
|
|
13369
14249
|
Follow Pantheon routing policy: delegate implementation work to the named specialist and do not claim work was performed without verification.`;
|
|
13370
14250
|
function isTextPart(entry) {
|
|
@@ -13912,7 +14792,7 @@ async function registerV2SessionHooks(context) {
|
|
|
13912
14792
|
const prompt = admission?.prompt;
|
|
13913
14793
|
if (!prompt || typeof prompt.text !== "string") return;
|
|
13914
14794
|
const userRequest = prompt.text;
|
|
13915
|
-
if (!prompt.text.includes("<!-- pantheon-
|
|
14795
|
+
if (!prompt.text.includes("<!-- pantheon-visual-context -->")) {
|
|
13916
14796
|
const sessionID = typeof admission?.sessionID === "string" && admission.sessionID.trim() !== "" ? admission.sessionID : void 0;
|
|
13917
14797
|
const nativeByLookup = await (async () => {
|
|
13918
14798
|
if (sessionID === void 0) return false;
|