@opencode_weave/weave 0.7.3 → 0.7.4-preview.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/README.md +3 -196
- package/dist/agents/tapestry/prompt-composer.d.ts +3 -1
- package/dist/config/schema.d.ts +3 -2
- package/dist/features/analytics/generate-metrics-report.d.ts +4 -4
- package/dist/features/analytics/index.d.ts +4 -3
- package/dist/features/analytics/plan-token-aggregator.d.ts +24 -1
- package/dist/features/analytics/quality-score.d.ts +30 -0
- package/dist/features/analytics/session-tracker.d.ts +5 -0
- package/dist/features/analytics/types.d.ts +51 -14
- package/dist/features/evals/evaluators/trajectory-assertion.d.ts +2 -0
- package/dist/features/evals/executors/github-models-api.d.ts +13 -0
- package/dist/features/evals/executors/model-response.d.ts +6 -1
- package/dist/features/evals/executors/prompt-renderer.d.ts +1 -1
- package/dist/features/evals/executors/trajectory-run.d.ts +3 -0
- package/dist/features/evals/index.d.ts +8 -5
- package/dist/features/evals/loader.d.ts +2 -1
- package/dist/features/evals/reporter.d.ts +1 -0
- package/dist/features/evals/runner.d.ts +1 -1
- package/dist/features/evals/schema.d.ts +65 -16
- package/dist/features/evals/storage.d.ts +2 -0
- package/dist/features/evals/types.d.ts +43 -2
- package/dist/features/skill-loader/loader.d.ts +2 -0
- package/dist/features/workflow/context.d.ts +2 -1
- package/dist/features/workflow/discovery.d.ts +6 -3
- package/dist/features/workflow/hook.d.ts +2 -0
- package/dist/hooks/compaction-todo-preserver.d.ts +20 -0
- package/dist/hooks/create-hooks.d.ts +4 -0
- package/dist/hooks/index.d.ts +6 -0
- package/dist/hooks/todo-continuation-enforcer.d.ts +25 -0
- package/dist/hooks/todo-description-override.d.ts +18 -0
- package/dist/hooks/todo-writer.d.ts +17 -0
- package/dist/index.js +820 -625
- package/dist/plugin/plugin-interface.d.ts +0 -1
- package/dist/plugin/types.d.ts +1 -1
- package/dist/shared/resolve-safe-path.d.ts +14 -0
- package/package.json +10 -8
- package/dist/features/analytics/suggestions.d.ts +0 -10
- package/dist/features/task-system/index.d.ts +0 -6
- package/dist/features/task-system/storage.d.ts +0 -38
- package/dist/features/task-system/todo-sync.d.ts +0 -38
- package/dist/features/task-system/tools/index.d.ts +0 -3
- package/dist/features/task-system/tools/task-create.d.ts +0 -9
- package/dist/features/task-system/tools/task-list.d.ts +0 -5
- package/dist/features/task-system/tools/task-update.d.ts +0 -7
- package/dist/features/task-system/types.d.ts +0 -63
package/dist/plugin/types.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Plugin, ToolDefinition } from "@opencode-ai/plugin";
|
|
2
2
|
export type PluginContext = Parameters<Plugin>[0];
|
|
3
3
|
export type PluginInstance = Awaited<ReturnType<Plugin>>;
|
|
4
|
-
export type PluginInterface = Required<Pick<PluginInstance, "tool" | "config" | "chat.message" | "chat.params" | "chat.headers" | "event" | "tool.execute.before" | "tool.execute.after" | "command.execute.before">>;
|
|
4
|
+
export type PluginInterface = Required<Pick<PluginInstance, "tool" | "config" | "chat.message" | "chat.params" | "chat.headers" | "event" | "tool.execute.before" | "tool.execute.after" | "command.execute.before" | "tool.definition" | "experimental.session.compacting">>;
|
|
5
5
|
export type ToolsRecord = Record<string, ToolDefinition>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Safely resolve a user-supplied directory path, ensuring it stays within the
|
|
3
|
+
* project root (sandbox). Returns the resolved absolute path, or null if the
|
|
4
|
+
* path escapes the sandbox.
|
|
5
|
+
*
|
|
6
|
+
* Security rules:
|
|
7
|
+
* - Absolute paths are rejected (must be relative to projectRoot)
|
|
8
|
+
* - Resolved path must start with projectRoot (prevents `../../` traversal)
|
|
9
|
+
*
|
|
10
|
+
* @param dir - User-supplied directory path (from config)
|
|
11
|
+
* @param projectRoot - Project root to resolve relative paths against and sandbox within
|
|
12
|
+
* @returns Resolved absolute path, or null if the path is rejected
|
|
13
|
+
*/
|
|
14
|
+
export declare function resolveSafePath(dir: string, projectRoot: string): string | null;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opencode_weave/weave",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.4-preview.1",
|
|
4
4
|
"description": "Weave — lean OpenCode plugin with multi-agent orchestration",
|
|
5
5
|
"author": "Weave",
|
|
6
6
|
"license": "MIT",
|
|
@@ -27,8 +27,10 @@
|
|
|
27
27
|
"typecheck": "tsc --noEmit",
|
|
28
28
|
"test": "bun test",
|
|
29
29
|
"eval": "bun run script/eval.ts",
|
|
30
|
-
"eval:smoke": "bun run script/eval.ts --suite
|
|
31
|
-
"eval:
|
|
30
|
+
"eval:smoke": "bun run script/eval.ts --suite prompt-smoke",
|
|
31
|
+
"eval:phase2": "bun run script/eval.ts --suite agent-routing",
|
|
32
|
+
"eval:coverage": "bun run script/verify-eval-coverage.ts",
|
|
33
|
+
"eval:trend": "bun run script/eval-trend-report.ts"
|
|
32
34
|
},
|
|
33
35
|
"keywords": [
|
|
34
36
|
"opencode",
|
|
@@ -41,15 +43,15 @@
|
|
|
41
43
|
"access": "public"
|
|
42
44
|
},
|
|
43
45
|
"dependencies": {
|
|
44
|
-
"@opencode-ai/plugin": "^1.
|
|
45
|
-
"@opencode-ai/sdk": "^1.
|
|
46
|
+
"@opencode-ai/plugin": "^1.3.3",
|
|
47
|
+
"@opencode-ai/sdk": "^1.3.3",
|
|
46
48
|
"jsonc-parser": "^3.3.1",
|
|
47
49
|
"picocolors": "^1.1.1",
|
|
48
50
|
"zod": "^4.0.0"
|
|
49
51
|
},
|
|
50
52
|
"devDependencies": {
|
|
51
|
-
"bun": "^1.3.
|
|
52
|
-
"bun-types": "^1.3.
|
|
53
|
-
"typescript": "^
|
|
53
|
+
"bun": "^1.3.11",
|
|
54
|
+
"bun-types": "^1.3.11",
|
|
55
|
+
"typescript": "^6.0.2"
|
|
54
56
|
}
|
|
55
57
|
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { SessionSummary, Suggestion } from "./types";
|
|
2
|
-
/**
|
|
3
|
-
* Generate suggestions based on session history.
|
|
4
|
-
* Analyzes tool usage patterns, delegation frequency, and workflow patterns.
|
|
5
|
-
*/
|
|
6
|
-
export declare function generateSuggestions(summaries: SessionSummary[]): Suggestion[];
|
|
7
|
-
/**
|
|
8
|
-
* Generate suggestions from stored session summaries for a project.
|
|
9
|
-
*/
|
|
10
|
-
export declare function getSuggestionsForProject(directory: string): Suggestion[];
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
export { createTaskCreateTool, createTaskUpdateTool, createTaskListTool } from "./tools";
|
|
2
|
-
export { TaskStatus, TaskObjectSchema, TaskStatusSchema } from "./types";
|
|
3
|
-
export type { TaskObject, TaskCreateInput, TaskUpdateInput, TaskListInput } from "./types";
|
|
4
|
-
export { getTaskDir, generateTaskId, readTask, writeTask, readAllTasks } from "./storage";
|
|
5
|
-
export { syncTaskToTodo, syncTaskTodoUpdate, syncAllTasksToTodos } from "./todo-sync";
|
|
6
|
-
export type { TodoWriter, TodoInfo } from "./todo-sync";
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { type TaskObject } from "./types";
|
|
2
|
-
/**
|
|
3
|
-
* Derive the task storage directory for a given project.
|
|
4
|
-
* Uses the opencode config dir (~/.config/opencode by default) + sanitized project slug.
|
|
5
|
-
*/
|
|
6
|
-
export declare function getTaskDir(directory: string, configDir?: string): string;
|
|
7
|
-
/** Generate a unique task ID */
|
|
8
|
-
export declare function generateTaskId(): string;
|
|
9
|
-
/**
|
|
10
|
-
* Read and parse a JSON file safely. Returns null for missing, corrupt, or invalid data.
|
|
11
|
-
*/
|
|
12
|
-
export declare function readJsonSafe<T>(filePath: string, schema: {
|
|
13
|
-
parse: (data: unknown) => T;
|
|
14
|
-
}): T | null;
|
|
15
|
-
/**
|
|
16
|
-
* Write JSON atomically: write to a temp file then rename.
|
|
17
|
-
* This prevents partial writes from corrupting the target file.
|
|
18
|
-
*/
|
|
19
|
-
export declare function writeJsonAtomic(filePath: string, data: unknown): void;
|
|
20
|
-
/**
|
|
21
|
-
* Acquire a file-based lock. Uses exclusive file creation (wx flag).
|
|
22
|
-
* Returns a release function on success, null on failure.
|
|
23
|
-
*
|
|
24
|
-
* Stale locks older than `staleThresholdMs` (default 30s) are automatically broken.
|
|
25
|
-
*/
|
|
26
|
-
export declare function acquireLock(lockPath: string, staleThresholdMs?: number): (() => void) | null;
|
|
27
|
-
/** Ensure a directory exists */
|
|
28
|
-
export declare function ensureDir(dirPath: string): void;
|
|
29
|
-
/** List task files (T-*.json) in the task directory */
|
|
30
|
-
export declare function listTaskFiles(taskDir: string): string[];
|
|
31
|
-
/** Get the file path for a task by ID */
|
|
32
|
-
export declare function getTaskFilePath(taskDir: string, taskId: string): string;
|
|
33
|
-
/** Read a single task from file storage */
|
|
34
|
-
export declare function readTask(taskDir: string, taskId: string): TaskObject | null;
|
|
35
|
-
/** Write a single task to file storage (atomic) */
|
|
36
|
-
export declare function writeTask(taskDir: string, task: TaskObject): void;
|
|
37
|
-
/** Read all tasks from a task directory */
|
|
38
|
-
export declare function readAllTasks(taskDir: string): TaskObject[];
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import type { TaskObject } from "./types";
|
|
2
|
-
/** TodoInfo matches the shape expected by OpenCode's todo sidebar */
|
|
3
|
-
export interface TodoInfo {
|
|
4
|
-
id?: string;
|
|
5
|
-
content: string;
|
|
6
|
-
status: "pending" | "in_progress" | "completed";
|
|
7
|
-
priority?: "high" | "medium" | "low";
|
|
8
|
-
}
|
|
9
|
-
/** TodoWriter interface — abstracts the OpenCode todo write API */
|
|
10
|
-
export interface TodoWriter {
|
|
11
|
-
read(sessionId: string): Promise<TodoInfo[]>;
|
|
12
|
-
update(sessionId: string, todos: TodoInfo[]): Promise<void>;
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* Map a TaskObject to a TodoInfo for the sidebar.
|
|
16
|
-
* Returns null for deleted tasks (they should be removed from the sidebar).
|
|
17
|
-
*/
|
|
18
|
-
export declare function syncTaskToTodo(task: TaskObject): TodoInfo | null;
|
|
19
|
-
/**
|
|
20
|
-
* Check if two todo items match by ID first, then by content as fallback.
|
|
21
|
-
*/
|
|
22
|
-
export declare function todosMatch(a: TodoInfo, b: TodoInfo): boolean;
|
|
23
|
-
/**
|
|
24
|
-
* Sync a single task to the todo sidebar.
|
|
25
|
-
* This is the anti-obliteration mechanism:
|
|
26
|
-
* 1. Read current todos
|
|
27
|
-
* 2. Filter out the matching item (by ID or content)
|
|
28
|
-
* 3. Push the updated item (or omit it if deleted)
|
|
29
|
-
* 4. Write back the full list
|
|
30
|
-
*
|
|
31
|
-
* Non-task todos (those not matching any task ID) survive intact.
|
|
32
|
-
*/
|
|
33
|
-
export declare function syncTaskTodoUpdate(writer: TodoWriter | null, sessionId: string, task: TaskObject): Promise<void>;
|
|
34
|
-
/**
|
|
35
|
-
* Sync all tasks to the todo sidebar, preserving non-task todos.
|
|
36
|
-
* Used for bulk reconciliation.
|
|
37
|
-
*/
|
|
38
|
-
export declare function syncAllTasksToTodos(writer: TodoWriter | null, sessionId: string, tasks: TaskObject[]): Promise<void>;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { type ToolDefinition } from "@opencode-ai/plugin";
|
|
2
|
-
import { type TodoWriter } from "../todo-sync";
|
|
3
|
-
declare const TASK_ID_PATTERN: RegExp;
|
|
4
|
-
export declare function createTaskCreateTool(options: {
|
|
5
|
-
directory: string;
|
|
6
|
-
configDir?: string;
|
|
7
|
-
todoWriter?: TodoWriter | null;
|
|
8
|
-
}): ToolDefinition;
|
|
9
|
-
export { TASK_ID_PATTERN };
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
/** Task status values */
|
|
3
|
-
export declare const TaskStatus: {
|
|
4
|
-
readonly PENDING: "pending";
|
|
5
|
-
readonly IN_PROGRESS: "in_progress";
|
|
6
|
-
readonly COMPLETED: "completed";
|
|
7
|
-
readonly DELETED: "deleted";
|
|
8
|
-
};
|
|
9
|
-
export type TaskStatus = (typeof TaskStatus)[keyof typeof TaskStatus];
|
|
10
|
-
export declare const TaskStatusSchema: z.ZodEnum<{
|
|
11
|
-
pending: "pending";
|
|
12
|
-
completed: "completed";
|
|
13
|
-
in_progress: "in_progress";
|
|
14
|
-
deleted: "deleted";
|
|
15
|
-
}>;
|
|
16
|
-
/**
|
|
17
|
-
* Core task object — simplified from OmO's schema.
|
|
18
|
-
* Drops: activeForm, owner, repoURL, parentID (per design decision D4).
|
|
19
|
-
*/
|
|
20
|
-
export declare const TaskObjectSchema: z.ZodObject<{
|
|
21
|
-
id: z.ZodString;
|
|
22
|
-
subject: z.ZodString;
|
|
23
|
-
description: z.ZodString;
|
|
24
|
-
status: z.ZodEnum<{
|
|
25
|
-
pending: "pending";
|
|
26
|
-
completed: "completed";
|
|
27
|
-
in_progress: "in_progress";
|
|
28
|
-
deleted: "deleted";
|
|
29
|
-
}>;
|
|
30
|
-
threadID: z.ZodString;
|
|
31
|
-
blocks: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
32
|
-
blockedBy: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
33
|
-
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
34
|
-
}, z.core.$strip>;
|
|
35
|
-
export type TaskObject = z.infer<typeof TaskObjectSchema>;
|
|
36
|
-
/** Input schema for task_create tool */
|
|
37
|
-
export declare const TaskCreateInputSchema: z.ZodObject<{
|
|
38
|
-
subject: z.ZodString;
|
|
39
|
-
description: z.ZodOptional<z.ZodString>;
|
|
40
|
-
blocks: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
41
|
-
blockedBy: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
42
|
-
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
43
|
-
}, z.core.$strip>;
|
|
44
|
-
export type TaskCreateInput = z.infer<typeof TaskCreateInputSchema>;
|
|
45
|
-
/** Input schema for task_update tool */
|
|
46
|
-
export declare const TaskUpdateInputSchema: z.ZodObject<{
|
|
47
|
-
id: z.ZodString;
|
|
48
|
-
subject: z.ZodOptional<z.ZodString>;
|
|
49
|
-
description: z.ZodOptional<z.ZodString>;
|
|
50
|
-
status: z.ZodOptional<z.ZodEnum<{
|
|
51
|
-
pending: "pending";
|
|
52
|
-
completed: "completed";
|
|
53
|
-
in_progress: "in_progress";
|
|
54
|
-
deleted: "deleted";
|
|
55
|
-
}>>;
|
|
56
|
-
addBlocks: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
57
|
-
addBlockedBy: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
58
|
-
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
59
|
-
}, z.core.$strip>;
|
|
60
|
-
export type TaskUpdateInput = z.infer<typeof TaskUpdateInputSchema>;
|
|
61
|
-
/** Input schema for task_list tool (no args needed for PoC) */
|
|
62
|
-
export declare const TaskListInputSchema: z.ZodObject<{}, z.core.$strip>;
|
|
63
|
-
export type TaskListInput = z.infer<typeof TaskListInputSchema>;
|