@oyasmi/pipiclaw 0.9.0-beta.8 → 0.9.0-beta.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/dist/agent/channel-runner.d.ts +1 -0
  2. package/dist/agent/channel-runner.js +21 -2
  3. package/dist/agent/index.d.ts +1 -1
  4. package/dist/agent/index.js +1 -1
  5. package/dist/agent/job-manager.d.ts +3 -3
  6. package/dist/agent/job-manager.js +0 -1
  7. package/dist/agent/runner-factory.d.ts +16 -4
  8. package/dist/agent/runner-factory.js +9 -23
  9. package/dist/agent/types.d.ts +9 -1
  10. package/dist/agent/types.js +3 -16
  11. package/dist/runtime/bootstrap.d.ts +10 -2
  12. package/dist/runtime/bootstrap.js +74 -50
  13. package/dist/runtime/channel-event.d.ts +41 -0
  14. package/dist/runtime/channel-event.js +1 -0
  15. package/dist/runtime/delivery.d.ts +3 -2
  16. package/dist/runtime/dingtalk.d.ts +9 -31
  17. package/dist/runtime/durable-dispatch.d.ts +3 -2
  18. package/dist/runtime/events.d.ts +3 -2
  19. package/dist/runtime/events.js +2 -3
  20. package/dist/runtime/task-commands.js +2 -2
  21. package/dist/runtime/task-driver.d.ts +7 -7
  22. package/dist/runtime/task-driver.js +1 -4
  23. package/dist/runtime/task-migration.js +1 -1
  24. package/dist/runtime/task-wake.d.ts +4 -4
  25. package/dist/settings.d.ts +0 -106
  26. package/dist/settings.js +0 -224
  27. package/dist/shared/types.d.ts +1 -0
  28. package/dist/shared/types.js +10 -1
  29. package/dist/subagents/external/run.js +2 -8
  30. package/dist/subagents/runs.d.ts +3 -3
  31. package/dist/subagents/runs.js +2 -12
  32. package/dist/subagents/tool.d.ts +11 -4
  33. package/dist/subagents/tool.js +1 -13
  34. package/dist/tasks/ledger.js +1 -1
  35. package/dist/{shared → tasks}/task-schedule.js +1 -1
  36. package/dist/tools/bash.js +1 -1
  37. package/dist/tools/event-manage.js +1 -4
  38. package/dist/tools/grep.js +2 -3
  39. package/dist/tools/job.js +5 -5
  40. package/dist/tools/memory-manage.js +3 -6
  41. package/dist/tools/session-search.js +0 -1
  42. package/dist/tools/skill-manage.js +3 -3
  43. package/dist/tools/subagent-manage.js +3 -3
  44. package/dist/tools/task-manage/shared.js +2 -2
  45. package/dist/tools/task-manage.js +1 -4
  46. package/dist/tools/web-fetch.js +0 -1
  47. package/dist/tui/app.js +4 -4
  48. package/package.json +1 -1
  49. /package/dist/{shared → tasks}/task-events.d.ts +0 -0
  50. /package/dist/{shared → tasks}/task-events.js +0 -0
  51. /package/dist/{shared → tasks}/task-schedule.d.ts +0 -0
@@ -2,8 +2,8 @@ import { readdir, readFile, stat } from "node:fs/promises";
2
2
  import { join } from "node:path";
3
3
  import { formatLocalTime, parseLocalTime } from "../shared/local-time.js";
4
4
  import { RecoverableToolError } from "../shared/recoverable-error.js";
5
- import { nextTaskWake } from "../shared/task-schedule.js";
6
5
  import { createDefaultTaskControl, parseTaskControl, taskPriorityRank } from "./control.js";
6
+ import { nextTaskWake } from "./task-schedule.js";
7
7
  import { normalizeStoredStatus, wasLegacyEscalated } from "./transitions.js";
8
8
  const FRONTMATTER_FIELDS = [
9
9
  "status",
@@ -1,5 +1,5 @@
1
1
  import { Cron } from "croner";
2
- import { errorMessage } from "./text-utils.js";
2
+ import { errorMessage } from "../shared/text-utils.js";
3
3
  /**
4
4
  * The cron cadence of a recurring task lives in its `schedule` frontmatter key.
5
5
  * Cron is always interpreted in the host timezone — tasks (and events) follow the
@@ -152,7 +152,7 @@ export function createBashTool(executor, options = {}) {
152
152
  : "It runs off-turn and will NOT wake you when it finishes; check it with the job tool (op:poll/list)."),
153
153
  },
154
154
  ],
155
- details: { kind: "bash", async: { state: "running", jobId: job.id } },
155
+ details: { async: { state: "running", jobId: job.id } },
156
156
  };
157
157
  }
158
158
  const result = await executor.exec(effectiveCommand, { timeout: effectiveTimeout, signal });
@@ -170,10 +170,7 @@ export function createEventManageTool(options) {
170
170
  });
171
171
  return {
172
172
  content: [{ type: "text", text: JSON.stringify(result, null, 2) }],
173
- details: {
174
- kind: "event_manage",
175
- ...result,
176
- },
173
+ details: { ...result },
177
174
  };
178
175
  },
179
176
  };
@@ -203,7 +203,7 @@ export function createGrepTool(executor, options = {}) {
203
203
  text: `No matches found in ${scope}. Try a broader pattern, drop the glob, or widen the path.`,
204
204
  },
205
205
  ],
206
- details: { kind: "grep", matchCount: 0, fileCount: 0 },
206
+ details: { matchCount: 0, fileCount: 0 },
207
207
  };
208
208
  }
209
209
  files.sort((a, b) => a[0].localeCompare(b[0]));
@@ -219,7 +219,7 @@ export function createGrepTool(executor, options = {}) {
219
219
  text: `No more matching files (skip=${startOffset} is past the last of ${files.length}).`,
220
220
  },
221
221
  ],
222
- details: { kind: "grep", matchCount: 0, fileCount: files.length },
222
+ details: { matchCount: 0, fileCount: files.length },
223
223
  };
224
224
  }
225
225
  const blocks = [];
@@ -249,7 +249,6 @@ export function createGrepTool(executor, options = {}) {
249
249
  return {
250
250
  content: [{ type: "text", text: outputText }],
251
251
  details: {
252
- kind: "grep",
253
252
  matchCount: shownMatchCount,
254
253
  fileCount: files.length,
255
254
  shownFileCount: page.length,
package/dist/tools/job.js CHANGED
@@ -49,7 +49,7 @@ export function createJobTool(options) {
49
49
  const text = outcomes.map((outcome) => `- [${outcome.id}] ${outcome.status}`).join("\n");
50
50
  return {
51
51
  content: [{ type: "text", text: `Cancel results:\n${text}` }],
52
- details: { kind: "job", op: "cancel", outcomes },
52
+ details: { op: "cancel", outcomes },
53
53
  };
54
54
  }
55
55
  if (op === "list") {
@@ -57,12 +57,12 @@ export function createJobTool(options) {
57
57
  if (jobs.length === 0) {
58
58
  return {
59
59
  content: [{ type: "text", text: "No background jobs." }],
60
- details: { kind: "job", op: "list", jobs },
60
+ details: { op: "list", jobs },
61
61
  };
62
62
  }
63
63
  return {
64
64
  content: [{ type: "text", text: jobs.map(formatJobLine).join("\n") }],
65
- details: { kind: "job", op: "list", jobs },
65
+ details: { op: "list", jobs },
66
66
  };
67
67
  }
68
68
  // poll
@@ -70,7 +70,7 @@ export function createJobTool(options) {
70
70
  if (jobs.length === 0) {
71
71
  return {
72
72
  content: [{ type: "text", text: "No matching running jobs to wait for." }],
73
- details: { kind: "job", op: "poll", jobs },
73
+ details: { op: "poll", jobs },
74
74
  };
75
75
  }
76
76
  const finished = jobs.filter((job) => job.status !== "running");
@@ -85,7 +85,7 @@ export function createJobTool(options) {
85
85
  }
86
86
  return {
87
87
  content: [{ type: "text", text: parts.join("\n\n") }],
88
- details: { kind: "job", op: "poll", jobs },
88
+ details: { op: "poll", jobs },
89
89
  };
90
90
  },
91
91
  };
@@ -83,7 +83,7 @@ export function createMemoryManageTool(options) {
83
83
  rejectMissingArgument("save", "content", args);
84
84
  }
85
85
  if (containsSecret(trimmed)) {
86
- return textResult("This content looks like a credential or secret, so it was not saved. Store the secret in an approved secret manager and remember only its location.", { kind: "memory_manage", op: "save", saved: false, blockedReason: "secret" });
86
+ return textResult("This content looks like a credential or secret, so it was not saved. Store the secret in an approved secret manager and remember only its location.", { op: "save", saved: false, blockedReason: "secret" });
87
87
  }
88
88
  // Serialize through the shared channel memory queue so this never races with background
89
89
  // consolidation/maintenance on the same channel's files.
@@ -105,7 +105,6 @@ export function createMemoryManageTool(options) {
105
105
  ? `Saved to channel memory${kind ? ` (${kind})` : ""}.`
106
106
  : "That memory is already present; no duplicate was added.";
107
107
  return textResult(message, {
108
- kind: "memory_manage",
109
108
  op: "save",
110
109
  saved: result.added > 0 || result.skippedDuplicate > 0,
111
110
  });
@@ -134,13 +133,12 @@ export function createMemoryManageTool(options) {
134
133
  candidateStore: options.memoryCandidateStore,
135
134
  });
136
135
  if (items.length === 0) {
137
- return textResult(`No stored memory matched "${trimmed}". Try a broader query, or the fact may not be saved yet.`, { kind: "memory_manage", op: "search", resultCount: 0 });
136
+ return textResult(`No stored memory matched "${trimmed}". Try a broader query, or the fact may not be saved yet.`, { op: "search", resultCount: 0 });
138
137
  }
139
138
  const rendered = items
140
139
  .map((item, index) => `${index + 1}. [${item.source}/${item.title}] ${item.content}`)
141
140
  .join("\n");
142
141
  return textResult(`Found ${items.length} stored memory entr${items.length === 1 ? "y" : "ies"}:\n\n${rendered}`, {
143
- kind: "memory_manage",
144
142
  op: "search",
145
143
  resultCount: items.length,
146
144
  });
@@ -157,7 +155,6 @@ export function createMemoryManageTool(options) {
157
155
  const matches = entries.filter((entry) => entry.content === trimmed || entry.content.toLowerCase().includes(needle));
158
156
  if (matches.length === 0) {
159
157
  return textResult(`No stored memory entry matched "${trimmed}"; nothing was removed.`, {
160
- kind: "memory_manage",
161
158
  op: "forget",
162
159
  forgotten: false,
163
160
  });
@@ -180,7 +177,7 @@ export function createMemoryManageTool(options) {
180
177
  }).catch((error) => {
181
178
  log.logWarning(`Failed to append memory review log for channel ${options.channelId}`, errorMessage(error));
182
179
  });
183
- return textResult("Removed the entry from active channel memory. Its exact content and source transcript window are tombstoned against automatic replay; if the fact is stated again later, it may be learned as new. Original session history and retention backups are unchanged.", { kind: "memory_manage", op: "forget", forgotten: true, entryId: removed.id });
180
+ return textResult("Removed the entry from active channel memory. Its exact content and source transcript window are tombstoned against automatic replay; if the fact is stated again later, it may be learned as new. Original session history and retention backups are unchanged.", { op: "forget", forgotten: true, entryId: removed.id });
184
181
  }
185
182
  return {
186
183
  name: "memory_manage",
@@ -54,7 +54,6 @@ export function createSessionSearchTool(options) {
54
54
  },
55
55
  ],
56
56
  details: {
57
- kind: "session_search",
58
57
  resultCount: response.results.length,
59
58
  searchedDocuments: response.searchedDocuments,
60
59
  },
@@ -190,7 +190,7 @@ async function viewWorkspaceSkill(options, name, filePath) {
190
190
  }
191
191
  return {
192
192
  content: [{ type: "text", text: `Skill: ${name}\nPath: ${targetPath}\n\n${body}` }],
193
- details: { kind: "skill_manage", action: "view", name, path: targetPath, truncated: truncation.truncated },
193
+ details: { action: "view", name, path: targetPath, truncated: truncation.truncated },
194
194
  };
195
195
  }
196
196
  export function createSkillManageTool(options) {
@@ -205,7 +205,7 @@ export function createSkillManageTool(options) {
205
205
  const skills = await listWorkspaceSkills(options);
206
206
  return {
207
207
  content: [{ type: "text", text: JSON.stringify({ skills }) }],
208
- details: { kind: "skill_manage", action: "list", count: skills.length },
208
+ details: { action: "list", count: skills.length },
209
209
  };
210
210
  }
211
211
  if (!args.name) {
@@ -224,7 +224,7 @@ export function createSkillManageTool(options) {
224
224
  });
225
225
  return {
226
226
  content: [{ type: "text", text: JSON.stringify(result, null, 2) }],
227
- details: { kind: "skill_manage", ...result },
227
+ details: { ...result },
228
228
  };
229
229
  },
230
230
  };
@@ -67,7 +67,7 @@ export function createSubAgentManageTool(options) {
67
67
  }
68
68
  return {
69
69
  content: [{ type: "text", text: lines.join("\n") }],
70
- details: { kind: "subagent_manage", op, runs },
70
+ details: { op, runs },
71
71
  };
72
72
  }
73
73
  if (!runId) {
@@ -85,7 +85,7 @@ export function createSubAgentManageTool(options) {
85
85
  const status = await manager().cancel(resolvedRunId);
86
86
  return {
87
87
  content: [{ type: "text", text: `Cancel requested for run ${resolvedRunId}: ${status}` }],
88
- details: { kind: "subagent_manage", op, runId: resolvedRunId, status },
88
+ details: { op, runId: resolvedRunId, status },
89
89
  };
90
90
  }
91
91
  // follow_up
@@ -238,7 +238,7 @@ export function createSubAgentManageTool(options) {
238
238
  text: `Follow-up dispatched as runId=${newRunId} (resuming ${resolvedRunId}). This channel will be woken when it finishes.`,
239
239
  },
240
240
  ],
241
- details: { kind: "subagent_manage", op, runId: newRunId, resumedFrom: resolvedRunId },
241
+ details: { op, runId: newRunId, resumedFrom: resolvedRunId },
242
242
  };
243
243
  },
244
244
  };
@@ -4,11 +4,11 @@ import { join } from "node:path";
4
4
  import * as log from "../../log.js";
5
5
  import { parseScheduledEventContent } from "../../runtime/events.js";
6
6
  import { formatLocalTime, parseWakeInput } from "../../shared/local-time.js";
7
- import { taskEventPrefix } from "../../shared/task-events.js";
8
- import { nextTaskWake, validateTaskSchedule } from "../../shared/task-schedule.js";
9
7
  import { errorMessage } from "../../shared/text-utils.js";
10
8
  import { applyTaskControlPatch, createDefaultTaskControl } from "../../tasks/control.js";
11
9
  import { normalizeTaskFields, parseTaskFrontmatter, renderStandardTaskBody, renderTaskDocument, taskBody, upsertCurrentCycleCompletionEvidence, } from "../../tasks/ledger.js";
10
+ import { taskEventPrefix } from "../../tasks/task-events.js";
11
+ import { nextTaskWake, validateTaskSchedule } from "../../tasks/task-schedule.js";
12
12
  import { isSettableTaskStatus } from "../../tasks/transitions.js";
13
13
  import { RecoverableToolError } from "../tool-details.js";
14
14
  import { SETTABLE_STATUSES } from "./schema.js";
@@ -58,10 +58,7 @@ export function createTaskManageTool(options) {
58
58
  });
59
59
  return {
60
60
  content: [{ type: "text", text: JSON.stringify(result, null, 2) }],
61
- details: {
62
- kind: "task_manage",
63
- ...result,
64
- },
61
+ details: { ...result },
65
62
  };
66
63
  },
67
64
  };
@@ -40,7 +40,6 @@ function windowResult(body, offset, maxChars, url, fromCache) {
40
40
  return {
41
41
  content: [{ type: "text", text }],
42
42
  details: {
43
- kind: "web_fetch",
44
43
  url,
45
44
  offset: start,
46
45
  shownChars: slice.length,
package/dist/tui/app.js CHANGED
@@ -8,8 +8,7 @@
8
8
  */
9
9
  import { userInfo } from "node:os";
10
10
  import { renderBuiltInHelp } from "../agent/commands.js";
11
- import { getOrCreateRunner } from "../agent/index.js";
12
- import { resetRunner } from "../agent/runner-factory.js";
11
+ import { createRunner } from "../agent/index.js";
13
12
  import * as log from "../log.js";
14
13
  import { ensureChannelMemoryFilesSync } from "../memory/files.js";
15
14
  import { BootstrapExitError, bootstrapAppHome, DEFAULT_BOOTSTRAP_PATHS, printBootstrapSummary, readCliVersion, } from "../runtime/app-home.js";
@@ -78,10 +77,11 @@ export async function runTuiApp(options) {
78
77
  const channelDir = ensureChannelDir(paths.workspaceDir, channelId);
79
78
  ensureChannelMemoryFilesSync(channelDir);
80
79
  const store = new ChannelStore({ workingDir: paths.workspaceDir });
81
- const runner = getOrCreateRunner(channelId, channelDir, {
80
+ const runner = createRunner(channelId, channelDir, {
82
81
  appHomeDir: paths.appHomeDir,
83
82
  authConfigPath: paths.authConfigPath,
84
83
  modelsConfigPath: paths.modelsConfigPath,
84
+ settingsManager,
85
85
  mediaSender: createTerminalMediaSender(io),
86
86
  });
87
87
  const tuiSettings = settingsManager.getTuiSettings();
@@ -125,7 +125,7 @@ export async function runTuiApp(options) {
125
125
  }
126
126
  }
127
127
  finally {
128
- resetRunner(channelId);
128
+ await runner.dispose();
129
129
  await waitForStorageFlush(Promise.allSettled([store.close(), getUsageLedger().flush?.() ?? Promise.resolve(), flushSecurityLogs()]));
130
130
  await waitForStorageFlush(log.flushLogging());
131
131
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oyasmi/pipiclaw",
3
- "version": "0.9.0-beta.8",
3
+ "version": "0.9.0-beta.9",
4
4
  "description": "An AI assistant runtime for coding and team workflows, with DingTalk AI Cards, sub-agents, memory, and scheduled events.",
5
5
  "type": "module",
6
6
  "bin": {
File without changes
File without changes
File without changes