Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ dist/
!openclaw.plugin.json
.openclaw
node_modules
.claude/
2 changes: 1 addition & 1 deletion lib/tools/admin/autoconfigure-models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*
* Queries available authenticated models and intelligently assigns them to DevClaw roles.
*/
import { jsonResult } from "openclaw/plugin-sdk";
import { jsonResult } from "../helpers.js";
import type { ToolContext } from "../../types.js";
import type { PluginContext, RunCommand } from "../../context.js";
import {
Expand Down
3 changes: 1 addition & 2 deletions lib/tools/admin/channel-link.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,11 @@
* (auto-detach). This is the primary way to switch which project a chat
* controls.
*/
import { jsonResult } from "openclaw/plugin-sdk";
import type { PluginContext } from "../../context.js";
import type { ToolContext } from "../../types.js";
import { readProjects, writeProjects, type Channel } from "../../projects/index.js";
import { log as auditLog } from "../../audit.js";
import { requireWorkspaceDir } from "../helpers.js";
import { jsonResult, requireWorkspaceDir } from "../helpers.js";

export function createChannelLinkTool(_ctx: PluginContext) {
return (toolCtx: ToolContext) => ({
Expand Down
3 changes: 1 addition & 2 deletions lib/tools/admin/channel-list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@
* Shows registered channels with their type, ID, name, and event subscriptions.
* Can list channels for a specific project or all projects.
*/
import { jsonResult } from "openclaw/plugin-sdk";
import type { PluginContext } from "../../context.js";
import type { ToolContext } from "../../types.js";
import { readProjects } from "../../projects/index.js";
import { requireWorkspaceDir } from "../helpers.js";
import { jsonResult, requireWorkspaceDir } from "../helpers.js";

export function createChannelListTool(_ctx: PluginContext) {
return (toolCtx: ToolContext) => ({
Expand Down
3 changes: 1 addition & 2 deletions lib/tools/admin/channel-unlink.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,11 @@
* exists and prevents removing the last channel from a project (projects must
* have at least one notification endpoint).
*/
import { jsonResult } from "openclaw/plugin-sdk";
import type { PluginContext } from "../../context.js";
import type { ToolContext } from "../../types.js";
import { readProjects, writeProjects } from "../../projects/index.js";
import { log as auditLog } from "../../audit.js";
import { requireWorkspaceDir } from "../helpers.js";
import { jsonResult, requireWorkspaceDir } from "../helpers.js";

export function createChannelUnlinkTool(_ctx: PluginContext) {
return (toolCtx: ToolContext) => ({
Expand Down
3 changes: 1 addition & 2 deletions lib/tools/admin/config-diff.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,9 @@
*/
import fs from "node:fs/promises";
import path from "node:path";
import { jsonResult } from "openclaw/plugin-sdk";
import type { ToolContext } from "../../types.js";
import type { PluginContext } from "../../context.js";
import { requireWorkspaceDir } from "../helpers.js";
import { jsonResult, requireWorkspaceDir } from "../helpers.js";
import { WORKFLOW_YAML_TEMPLATE } from "../../setup/templates.js";
import { DATA_DIR } from "../../setup/migrate-layout.js";

Expand Down
3 changes: 1 addition & 2 deletions lib/tools/admin/config-reset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,9 @@
*/
import fs from "node:fs/promises";
import path from "node:path";
import { jsonResult } from "openclaw/plugin-sdk";
import type { ToolContext } from "../../types.js";
import type { PluginContext } from "../../context.js";
import { requireWorkspaceDir } from "../helpers.js";
import { jsonResult, requireWorkspaceDir } from "../helpers.js";
import { backupAndWrite } from "../../setup/workspace.js";
import { WORKFLOW_YAML_TEMPLATE, DEFAULT_ROLE_INSTRUCTIONS } from "../../setup/templates.js";
import { getAllRoleIds } from "../../roles/index.js";
Expand Down
2 changes: 1 addition & 1 deletion lib/tools/admin/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
*/
import fs from "node:fs/promises";
import path from "node:path";
import { jsonResult } from "openclaw/plugin-sdk";
import { jsonResult } from "../helpers.js";
import type { ToolContext } from "../../types.js";
import type { PluginContext } from "../../context.js";
import { writeAllDefaults, backupAndWrite, fileExists } from "../../setup/workspace.js";
Expand Down
3 changes: 1 addition & 2 deletions lib/tools/admin/health.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,12 @@
*
* Read-only by default (surfaces issues). Pass fix=true to apply fixes.
*/
import { jsonResult } from "openclaw/plugin-sdk";
import type { PluginContext } from "../../context.js";
import type { ToolContext } from "../../types.js";
import { readProjects, getProject } from "../../projects/index.js";
import { log as auditLog } from "../../audit.js";
import { checkWorkerHealth, scanOrphanedLabels, fetchGatewaySessions, type HealthFix } from "../../services/heartbeat/health.js";
import { requireWorkspaceDir, resolveProvider } from "../helpers.js";
import { jsonResult, requireWorkspaceDir, resolveProvider } from "../helpers.js";

export function createHealthTool(ctx: PluginContext) {
return (toolCtx: ToolContext) => ({
Expand Down
2 changes: 1 addition & 1 deletion lib/tools/admin/onboard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*
* Returns step-by-step guidance. Call this before setup.
*/
import { jsonResult } from "openclaw/plugin-sdk";
import { jsonResult } from "../helpers.js";
import type { ToolContext } from "../../types.js";
import type { PluginContext } from "../../context.js";
import { isPluginConfigured, hasWorkspaceFiles, buildOnboardToolContext, buildReconfigContext } from "../../setup/onboarding.js";
Expand Down
2 changes: 1 addition & 1 deletion lib/tools/admin/project-register.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*
* Replaces the manual steps of running glab/gh label create + editing projects.json.
*/
import { jsonResult } from "openclaw/plugin-sdk";
import { jsonResult } from "../helpers.js";
import type { ToolContext } from "../../types.js";
import type { PluginContext } from "../../context.js";
import fs from "node:fs/promises";
Expand Down
3 changes: 1 addition & 2 deletions lib/tools/admin/project-status.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@
* workflow config, and execution settings. No issue-tracker API calls.
* Use `tasks_status` for live issue counts.
*/
import { jsonResult } from "openclaw/plugin-sdk";
import type { ToolContext } from "../../types.js";
import type { PluginContext } from "../../context.js";
import { requireWorkspaceDir, resolveChannelId, resolveProject } from "../helpers.js";
import { jsonResult, requireWorkspaceDir, resolveChannelId, resolveProject } from "../helpers.js";
import { ExecutionMode, StateType } from "../../workflow/index.js";
import { loadConfig } from "../../config/index.js";
import { loadInstanceName } from "../../instance.js";
Expand Down
2 changes: 1 addition & 1 deletion lib/tools/admin/setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Creates agent, configures model levels, writes workspace files.
* Thin wrapper around lib/setup/.
*/
import { jsonResult } from "openclaw/plugin-sdk";
import { jsonResult } from "../helpers.js";
import type { ToolContext } from "../../types.js";
import type { PluginContext } from "../../context.js";
import { runSetup, type SetupOpts } from "../../setup/index.js";
Expand Down
3 changes: 1 addition & 2 deletions lib/tools/admin/sync-labels.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,9 @@
* Calls provider.ensureLabel() directly instead of provider.ensureAllStateLabels()
* so that custom workflow states from workspace/project overrides are included.
*/
import { jsonResult } from "openclaw/plugin-sdk";
import type { ToolContext } from "../../types.js";
import type { PluginContext } from "../../context.js";
import { requireWorkspaceDir } from "../helpers.js";
import { jsonResult, requireWorkspaceDir } from "../helpers.js";
import { readProjects, getProject } from "../../projects/index.js";
import { createProvider } from "../../providers/index.js";
import { loadConfig } from "../../config/index.js";
Expand Down
3 changes: 1 addition & 2 deletions lib/tools/admin/workflow-guide.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,9 @@
*
* No parameters, no side effects — pure documentation.
*/
import { jsonResult } from "openclaw/plugin-sdk";
import type { PluginContext } from "../../context.js";
import type { ToolContext } from "../../types.js";
import { requireWorkspaceDir } from "../helpers.js";
import { jsonResult, requireWorkspaceDir } from "../helpers.js";
import { DATA_DIR } from "../../setup/migrate-layout.js";

export function createWorkflowGuideTool(_ctx: PluginContext) {
Expand Down
8 changes: 8 additions & 0 deletions lib/tools/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,14 @@
* project resolution, provider creation.
*/
import type { ToolContext } from "../types.js";

/**
* Wrap a payload as a tool result with pretty-printed JSON text.
* Replaces the removed `jsonResult` export from openclaw/plugin-sdk.
*/
export function jsonResult(payload: unknown): { content: { type: "text"; text: string }[]; details: unknown } {
return { content: [{ type: "text", text: JSON.stringify(payload, null, 2) }], details: payload };
}
import type { RunCommand } from "../context.js";
import { readProjects, getProject, type Project, type ProjectsData } from "../projects/index.js";
import { createProvider, type ProviderWithType } from "../providers/index.js";
Expand Down
3 changes: 1 addition & 2 deletions lib/tools/tasks/research-task.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,13 @@
* → architect calls work_finish(result="done") → "Researching" → "Done" (issue closed)
* → operator reviews created tasks in Planning, moves to "To Do" when ready
*/
import { jsonResult } from "openclaw/plugin-sdk";
import type { ToolContext } from "../../types.js";
import type { PluginContext } from "../../context.js";
import type { StateLabel } from "../../providers/provider.js";
import { getRoleWorker, countActiveSlots } from "../../projects/index.js";
import { dispatchTask } from "../../dispatch/index.js";
import { log as auditLog } from "../../audit.js";
import { requireWorkspaceDir, resolveChannelId, resolveProject, resolveProvider, autoAssignOwnerLabel, applyNotifyLabel } from "../helpers.js";
import { jsonResult, requireWorkspaceDir, resolveChannelId, resolveProject, resolveProvider, autoAssignOwnerLabel, applyNotifyLabel } from "../helpers.js";
import { loadConfig } from "../../config/index.js";
import { getActiveLabel } from "../../workflow/index.js";
import { selectLevel } from "../../roles/model-selector.js";
Expand Down
3 changes: 1 addition & 2 deletions lib/tools/tasks/task-attach.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,10 @@
* - Manually attach a local file to an issue
* - View attachment metadata and local paths
*/
import { jsonResult } from "openclaw/plugin-sdk";
import type { PluginContext } from "../../context.js";
import type { ToolContext } from "../../types.js";
import { log as auditLog } from "../../audit.js";
import { requireWorkspaceDir, resolveChannelId, resolveProject, resolveProvider, autoAssignOwnerLabel, applyNotifyLabel } from "../helpers.js";
import { jsonResult, requireWorkspaceDir, resolveChannelId, resolveProject, resolveProvider, autoAssignOwnerLabel, applyNotifyLabel } from "../helpers.js";
import {
listAttachments,
saveAttachment,
Expand Down
3 changes: 1 addition & 2 deletions lib/tools/tasks/task-comment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,10 @@
* - Developer worker posts implementation notes
* - Orchestrator adds summary comments
*/
import { jsonResult } from "openclaw/plugin-sdk";
import type { PluginContext } from "../../context.js";
import type { ToolContext } from "../../types.js";
import { log as auditLog } from "../../audit.js";
import { requireWorkspaceDir, resolveChannelId, resolveProject, resolveProvider, autoAssignOwnerLabel, applyNotifyLabel } from "../helpers.js";
import { jsonResult, requireWorkspaceDir, resolveChannelId, resolveProject, resolveProvider, autoAssignOwnerLabel, applyNotifyLabel } from "../helpers.js";
import { getAllRoleIds, getFallbackEmoji } from "../../roles/index.js";

/** Valid author roles for attribution — all registry roles + orchestrator */
Expand Down
3 changes: 1 addition & 2 deletions lib/tools/tasks/task-create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,11 @@
* - A sub-agent finds a bug and needs to file a follow-up issue
* - Breaking down an epic into smaller tasks
*/
import { jsonResult } from "openclaw/plugin-sdk";
import type { PluginContext } from "../../context.js";
import type { ToolContext } from "../../types.js";
import { log as auditLog } from "../../audit.js";
import { DEFAULT_WORKFLOW } from "../../workflow/index.js";
import { requireWorkspaceDir, resolveChannelId, resolveProject, resolveProvider, autoAssignOwnerLabel, applyNotifyLabel } from "../helpers.js";
import { jsonResult, requireWorkspaceDir, resolveChannelId, resolveProject, resolveProvider, autoAssignOwnerLabel, applyNotifyLabel } from "../helpers.js";

/** Derive the initial state label from the workflow config. */
const INITIAL_LABEL = DEFAULT_WORKFLOW.states[DEFAULT_WORKFLOW.initial].label;
Expand Down
3 changes: 1 addition & 2 deletions lib/tools/tasks/task-edit-body.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,12 @@
* DevClaw adds an explicit audit entry with who, when, and what changed.
* Optionally posts an auto-comment on the issue for traceability.
*/
import { jsonResult } from "openclaw/plugin-sdk";
import type { PluginContext } from "../../context.js";
import type { ToolContext } from "../../types.js";
import { log as auditLog } from "../../audit.js";
import { loadConfig } from "../../config/index.js";
import { getInitialStateLabel, getCurrentStateLabel } from "../../workflow/index.js";
import { requireWorkspaceDir, resolveChannelId, resolveProject, resolveProvider, autoAssignOwnerLabel, applyNotifyLabel } from "../helpers.js";
import { jsonResult, requireWorkspaceDir, resolveChannelId, resolveProject, resolveProvider, autoAssignOwnerLabel, applyNotifyLabel } from "../helpers.js";

export function createTaskEditBodyTool(ctx: PluginContext) {
return (toolCtx: ToolContext) => ({
Expand Down
3 changes: 1 addition & 2 deletions lib/tools/tasks/task-list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@
* Lists issues grouped by state label with optional filtering by state type,
* specific label, or text search. Supports terminal (closed) issues.
*/
import { jsonResult } from "openclaw/plugin-sdk";
import type { PluginContext } from "../../context.js";
import type { ToolContext } from "../../types.js";
import { log as auditLog } from "../../audit.js";
import { requireWorkspaceDir, resolveChannelId, resolveProject, resolveProvider } from "../helpers.js";
import { jsonResult, requireWorkspaceDir, resolveChannelId, resolveProject, resolveProvider } from "../helpers.js";
import { loadWorkflow, StateType, findStateByLabel } from "../../workflow/index.js";

export function createTaskListTool(ctx: PluginContext) {
Expand Down
3 changes: 1 addition & 2 deletions lib/tools/tasks/task-owner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@
* owns them for queue scanning and dispatch. Supports claiming a
* single issue or all unclaimed queued issues for a project.
*/
import { jsonResult } from "openclaw/plugin-sdk";
import type { PluginContext } from "../../context.js";
import type { ToolContext } from "../../types.js";
import { requireWorkspaceDir, resolveChannelId, resolveProject, resolveProvider } from "../helpers.js";
import { jsonResult, requireWorkspaceDir, resolveChannelId, resolveProject, resolveProvider } from "../helpers.js";
import { loadConfig } from "../../config/index.js";
import { loadInstanceName } from "../../instance.js";
import {
Expand Down
3 changes: 1 addition & 2 deletions lib/tools/tasks/task-set-level.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,12 @@
* applied as a role:level label and respected by the heartbeat when the
* issue is later advanced via task_start.
*/
import { jsonResult } from "openclaw/plugin-sdk";
import type { PluginContext } from "../../context.js";
import type { ToolContext } from "../../types.js";
import { log as auditLog } from "../../audit.js";
import { StateType, findStateByLabel, getCurrentStateLabel, getRoleLabelColor } from "../../workflow/index.js";
import { loadConfig } from "../../config/index.js";
import { requireWorkspaceDir, resolveChannelId, resolveProject, resolveProvider, autoAssignOwnerLabel, applyNotifyLabel } from "../helpers.js";
import { jsonResult, requireWorkspaceDir, resolveChannelId, resolveProject, resolveProvider, autoAssignOwnerLabel, applyNotifyLabel } from "../helpers.js";

export function createTaskSetLevelTool(ctx: PluginContext) {
return (toolCtx: ToolContext) => ({
Expand Down
3 changes: 1 addition & 2 deletions lib/tools/tasks/task-start.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
* The heartbeat is the sole dispatcher — this tool only places issues in
* queues, never dispatches workers directly.
*/
import { jsonResult } from "openclaw/plugin-sdk";
import type { PluginContext } from "../../context.js";
import type { ToolContext } from "../../types.js";
import { log as auditLog } from "../../audit.js";
Expand All @@ -26,7 +25,7 @@ import {
} from "../../workflow/index.js";
import { getLevelsForRole } from "../../roles/index.js";
import { loadConfig } from "../../config/index.js";
import { requireWorkspaceDir, resolveChannelId, resolveProject, resolveProvider, autoAssignOwnerLabel, applyNotifyLabel } from "../helpers.js";
import { jsonResult, requireWorkspaceDir, resolveChannelId, resolveProject, resolveProvider, autoAssignOwnerLabel, applyNotifyLabel } from "../helpers.js";

export function createTaskStartTool(ctx: PluginContext) {
return (toolCtx: ToolContext) => ({
Expand Down
3 changes: 1 addition & 2 deletions lib/tools/tasks/tasks-status.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,11 @@
* Fetches all non-terminal issues grouped by state type (hold, active, queue).
* Use `project_status` for instant local info, this tool for live issue data.
*/
import { jsonResult } from "openclaw/plugin-sdk";
import type { ToolContext } from "../../types.js";
import type { PluginContext } from "../../context.js";
import { log as auditLog } from "../../audit.js";
import { getStateLabelsByType } from "../../services/queue.js";
import { requireWorkspaceDir, resolveChannelId, resolveProject, resolveProvider } from "../helpers.js";
import { jsonResult, requireWorkspaceDir, resolveChannelId, resolveProject, resolveProvider } from "../helpers.js";
import { loadConfig } from "../../config/index.js";

type IssueSummary = { id: number; title: string; url: string };
Expand Down
3 changes: 1 addition & 2 deletions lib/tools/worker/work-finish.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
* All roles (including architect) use the standard pipeline via executeCompletion.
* Architect workflow: Researching → Done (done, closes issue), Researching → Refining (blocked).
*/
import { jsonResult } from "openclaw/plugin-sdk";
import { readFile } from "node:fs/promises";
import { join } from "node:path";
import type { ToolContext } from "../../types.js";
Expand All @@ -16,7 +15,7 @@ import { getRoleWorker, resolveRepoPath, findSlotByIssue } from "../../projects/
import { executeCompletion, getRule } from "../../services/pipeline.js";
import { log as auditLog } from "../../audit.js";
import { DATA_DIR } from "../../setup/migrate-layout.js";
import { requireWorkspaceDir, resolveChannelId, resolveProject, resolveProvider } from "../helpers.js";
import { jsonResult, requireWorkspaceDir, resolveChannelId, resolveProject, resolveProvider } from "../helpers.js";
import { getAllRoleIds, isValidResult, getCompletionResults } from "../../roles/index.js";
import { loadWorkflow } from "../../workflow/index.js";

Expand Down
8 changes: 8 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.