@oyasmi/pipiclaw 0.9.1 → 0.9.2-beta.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/dist/agent/channel-runner.d.ts +2 -1
- package/dist/agent/channel-runner.js +9 -5
- package/dist/agent/effect-ledger.js +9 -2
- package/dist/agent/job-manager.d.ts +4 -0
- package/dist/agent/job-manager.js +17 -2
- package/dist/agent/prompt/manifest.d.ts +1 -1
- package/dist/agent/prompt/manifest.js +1 -1
- package/dist/agent/prompt/sections.js +8 -5
- package/dist/agent/session-events.d.ts +2 -0
- package/dist/agent/session-events.js +29 -14
- package/dist/agent/turn-recovery.js +2 -2
- package/dist/agent/type-guards.js +5 -1
- package/dist/agent/workspace-resources.d.ts +2 -2
- package/dist/agent/workspace-resources.js +41 -3
- package/dist/executor.d.ts +14 -0
- package/dist/executor.js +96 -24
- package/dist/file-store.d.ts +96 -0
- package/dist/file-store.js +189 -0
- package/dist/memory/consolidation.js +2 -26
- package/dist/memory/files.js +7 -7
- package/dist/memory/maintenance-jobs.js +2 -34
- package/dist/memory/maintenance-state.js +2 -1
- package/dist/memory/recall.d.ts +10 -0
- package/dist/memory/recall.js +15 -7
- package/dist/memory/session-search.js +6 -22
- package/dist/memory/transcript.d.ts +10 -0
- package/dist/memory/transcript.js +39 -0
- package/dist/playbooks/agent-delegation.md +6 -4
- package/dist/playbooks/background-jobs.md +1 -1
- package/dist/playbooks/catalog.d.ts +1 -1
- package/dist/playbooks/catalog.js +1 -1
- package/dist/playbooks/event-scheduling.md +2 -0
- package/dist/playbooks/memory-and-learning.md +11 -11
- package/dist/playbooks/runtime-orientation.md +3 -3
- package/dist/playbooks/task-driving.md +5 -5
- package/dist/playbooks/task-planning.md +5 -5
- package/dist/runtime/app-home.js +1 -1
- package/dist/runtime/bootstrap.js +10 -0
- package/dist/runtime/dingtalk.js +3 -2
- package/dist/runtime/durable-dispatch.d.ts +26 -1
- package/dist/runtime/durable-dispatch.js +51 -5
- package/dist/runtime/event-commands.js +7 -16
- package/dist/runtime/events.d.ts +4 -2
- package/dist/runtime/events.js +15 -20
- package/dist/runtime/subagent-commands.js +1 -1
- package/dist/runtime/task-commands.d.ts +1 -1
- package/dist/runtime/task-commands.js +10 -10
- package/dist/runtime/task-driver.js +2 -2
- package/dist/security/block-message.d.ts +11 -0
- package/dist/security/block-message.js +12 -0
- package/dist/security/path-guard-check.d.ts +13 -0
- package/dist/security/path-guard-check.js +39 -0
- package/dist/security/path-guard.js +32 -14
- package/dist/settings.js +3 -2
- package/dist/shared/atomic-file.d.ts +17 -1
- package/dist/shared/atomic-file.js +50 -3
- package/dist/shared/duration.d.ts +2 -0
- package/dist/shared/duration.js +7 -0
- package/dist/shared/safe-id.d.ts +19 -0
- package/dist/shared/safe-id.js +24 -0
- package/dist/shared/text-utils.d.ts +1 -1
- package/dist/shared/text-utils.js +3 -8
- package/dist/shared/type-guards.d.ts +2 -0
- package/dist/shared/type-guards.js +4 -0
- package/dist/subagents/discovery.d.ts +44 -17
- package/dist/subagents/discovery.js +82 -111
- package/dist/subagents/external/claude-code.js +1 -3
- package/dist/subagents/external/harness.d.ts +1 -1
- package/dist/subagents/format.d.ts +3 -2
- package/dist/subagents/format.js +3 -7
- package/dist/subagents/runs.d.ts +1 -1
- package/dist/subagents/runs.js +4 -9
- package/dist/subagents/tool.d.ts +31 -19
- package/dist/subagents/tool.js +582 -561
- package/dist/subagents/workspace-lease.js +1 -1
- package/dist/tasks/control.js +7 -9
- package/dist/tasks/ledger.d.ts +2 -2
- package/dist/tasks/ledger.js +3 -7
- package/dist/tasks/transitions.d.ts +5 -1
- package/dist/tasks/transitions.js +2 -2
- package/dist/tools/bash.d.ts +0 -1
- package/dist/tools/bash.js +45 -40
- package/dist/tools/config.d.ts +6 -1
- package/dist/tools/config.js +9 -0
- package/dist/tools/edit.d.ts +2 -3
- package/dist/tools/edit.js +274 -86
- package/dist/tools/event-manage.d.ts +13 -7
- package/dist/tools/event-manage.js +52 -14
- package/dist/tools/glob-match.d.ts +11 -0
- package/dist/tools/glob-match.js +75 -0
- package/dist/tools/glob.d.ts +15 -0
- package/dist/tools/glob.js +113 -0
- package/dist/tools/grep.d.ts +0 -1
- package/dist/tools/grep.js +57 -42
- package/dist/tools/ignore-dirs.d.ts +6 -0
- package/dist/tools/ignore-dirs.js +15 -0
- package/dist/tools/index.d.ts +3 -0
- package/dist/tools/index.js +50 -40
- package/dist/tools/job.d.ts +0 -1
- package/dist/tools/job.js +1 -8
- package/dist/tools/line-index.d.ts +16 -0
- package/dist/tools/line-index.js +76 -0
- package/dist/tools/memory-manage.d.ts +20 -8
- package/dist/tools/memory-manage.js +65 -92
- package/dist/tools/presentation.d.ts +2 -0
- package/dist/tools/presentation.js +109 -0
- package/dist/tools/read.d.ts +2 -2
- package/dist/tools/read.js +97 -133
- package/dist/tools/registry.d.ts +4 -1
- package/dist/tools/registry.js +89 -22
- package/dist/tools/send-media.d.ts +6 -6
- package/dist/tools/send-media.js +16 -49
- package/dist/tools/session-search.d.ts +0 -1
- package/dist/tools/session-search.js +0 -1
- package/dist/tools/skill-security.d.ts +0 -2
- package/dist/tools/skill-security.js +0 -24
- package/dist/tools/skill.d.ts +31 -0
- package/dist/tools/skill.js +153 -0
- package/dist/tools/subagent-manage.d.ts +6 -5
- package/dist/tools/subagent-manage.js +47 -47
- package/dist/tools/task-manage/create.d.ts +2 -2
- package/dist/tools/task-manage/create.js +1 -3
- package/dist/tools/task-manage/lifecycle.d.ts +9 -6
- package/dist/tools/task-manage/lifecycle.js +49 -56
- package/dist/tools/task-manage/schema.d.ts +27 -15
- package/dist/tools/task-manage/schema.js +58 -74
- package/dist/tools/task-manage/shared.d.ts +11 -6
- package/dist/tools/task-manage/shared.js +30 -21
- package/dist/tools/task-manage/types.d.ts +14 -15
- package/dist/tools/task-manage/verification.d.ts +4 -4
- package/dist/tools/task-manage/verification.js +6 -8
- package/dist/tools/task-manage.d.ts +8 -11
- package/dist/tools/task-manage.js +63 -50
- package/dist/tools/tool-details.d.ts +17 -1
- package/dist/tools/tool-details.js +24 -0
- package/dist/tools/truncate.d.ts +5 -5
- package/dist/tools/truncate.js +5 -5
- package/dist/tools/web-fetch.d.ts +0 -1
- package/dist/tools/web-fetch.js +0 -1
- package/dist/tools/web-search.d.ts +0 -1
- package/dist/tools/web-search.js +0 -1
- package/dist/tools/write-content.d.ts +3 -3
- package/dist/tools/write-content.js +12 -51
- package/dist/tools/write.d.ts +2 -3
- package/dist/tools/write.js +3 -4
- package/dist/usage/ledger.js +7 -4
- package/package.json +1 -1
- package/dist/tools/skill-manage.d.ts +0 -41
- package/dist/tools/skill-manage.js +0 -232
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { type Readable, Writable } from "node:stream";
|
|
2
|
+
/**
|
|
3
|
+
* `FileStore` is the file-content counterpart to `Executor` (spec 044, D1): where `Executor` runs
|
|
4
|
+
* a shell command and captures its stdout/stderr, `FileStore` reads and writes file *content*
|
|
5
|
+
* directly over `node:fs`. File content must never be routed through argv, stdout, or stdin --
|
|
6
|
+
* that path forces every read/write through `Executor`'s bounded capture buffer, which silently
|
|
7
|
+
* truncates and can corrupt multi-byte text mid-stream (see the spec's F2/F3 evidence).
|
|
8
|
+
*
|
|
9
|
+
* All paths passed to a `FileStore` method are expected to be the absolute `resolvedPath` that
|
|
10
|
+
* `guardPath` already produced -- callers resolve a path exactly once and pass that same value to
|
|
11
|
+
* both the guard and the store (spec 044, D1.1).
|
|
12
|
+
*/
|
|
13
|
+
export interface FileStat {
|
|
14
|
+
size: number;
|
|
15
|
+
mtimeMs: number;
|
|
16
|
+
ino: number;
|
|
17
|
+
mode: number;
|
|
18
|
+
isDirectory: boolean;
|
|
19
|
+
isFile: boolean;
|
|
20
|
+
}
|
|
21
|
+
/** Lightweight fingerprint used to detect a concurrent write between a read and a later write-back (D2.4). */
|
|
22
|
+
export interface FileFingerprint {
|
|
23
|
+
size: number;
|
|
24
|
+
mtimeMs: number;
|
|
25
|
+
ino: number;
|
|
26
|
+
}
|
|
27
|
+
export declare function fingerprintOf(stat: FileStat): FileFingerprint;
|
|
28
|
+
export declare function fingerprintsEqual(a: FileFingerprint, b: FileFingerprint): boolean;
|
|
29
|
+
export interface DirectoryEntry {
|
|
30
|
+
/** Basename of the entry. */
|
|
31
|
+
name: string;
|
|
32
|
+
/** Path relative to the directory passed to `listDirectory`, using `/` separators. */
|
|
33
|
+
relativePath: string;
|
|
34
|
+
isDirectory: boolean;
|
|
35
|
+
}
|
|
36
|
+
export interface ReadBytesOptions {
|
|
37
|
+
start?: number;
|
|
38
|
+
maxBytes?: number;
|
|
39
|
+
signal?: AbortSignal;
|
|
40
|
+
}
|
|
41
|
+
export interface ReadBytesResult {
|
|
42
|
+
data: Buffer;
|
|
43
|
+
/** Whether this read reached the end of the file -- the caller's cue for "is there more?" (P2). */
|
|
44
|
+
eof: boolean;
|
|
45
|
+
stat: FileStat;
|
|
46
|
+
}
|
|
47
|
+
export interface WriteAtomicOptions {
|
|
48
|
+
createParentDir?: boolean;
|
|
49
|
+
/** Preserve the existing file's permission bits across the rename (see `shared/atomic-file.ts`). */
|
|
50
|
+
preserveMode?: boolean;
|
|
51
|
+
signal?: AbortSignal;
|
|
52
|
+
}
|
|
53
|
+
export interface ReplaceViaTempOptions {
|
|
54
|
+
preserveMode?: boolean;
|
|
55
|
+
signal?: AbortSignal;
|
|
56
|
+
}
|
|
57
|
+
export interface WalkFilesOptions {
|
|
58
|
+
/** Stop once this many file paths have been collected; the walk short-circuits, `truncated` says so. */
|
|
59
|
+
maxEntries: number;
|
|
60
|
+
/** Called with a directory's basename; returning true skips descending into it (never dereferenced). */
|
|
61
|
+
prune?: (dirName: string) => boolean;
|
|
62
|
+
signal?: AbortSignal;
|
|
63
|
+
}
|
|
64
|
+
export interface WalkFilesResult {
|
|
65
|
+
/** Regular-file paths only (never directories or symlinks), `/`-joined and relative to the walked root. */
|
|
66
|
+
files: string[];
|
|
67
|
+
/** True when `maxEntries` was hit before the walk finished -- the result is a partial, not the complete tree. */
|
|
68
|
+
truncated: boolean;
|
|
69
|
+
}
|
|
70
|
+
export interface FileStore {
|
|
71
|
+
/** ENOENT resolves to `undefined` rather than throwing. */
|
|
72
|
+
stat(path: string): Promise<FileStat | undefined>;
|
|
73
|
+
/** Single bounded read. `eof` tells the caller whether there is more file left to fetch. */
|
|
74
|
+
readBytes(path: string, opts?: ReadBytesOptions): Promise<ReadBytesResult>;
|
|
75
|
+
/** Streaming read, for `edit`'s large-file path and `read`'s line-index scan. */
|
|
76
|
+
openRead(path: string, opts?: {
|
|
77
|
+
start?: number;
|
|
78
|
+
end?: number;
|
|
79
|
+
}): Readable;
|
|
80
|
+
/** Write-temp-then-rename with fsync, mirroring `shared/atomic-file.ts`'s guarantees. */
|
|
81
|
+
writeAtomic(path: string, data: Buffer | string, opts?: WriteAtomicOptions): Promise<void>;
|
|
82
|
+
/** Streaming atomic replace: `produce` writes to a temp file; on success it is renamed over `path`. */
|
|
83
|
+
replaceViaTemp(path: string, produce: (out: Writable) => Promise<void>, opts?: ReplaceViaTempOptions): Promise<void>;
|
|
84
|
+
/** Depth-bounded directory listing, replacing the `find -maxdepth` shell-out. */
|
|
85
|
+
listDirectory(path: string, opts: {
|
|
86
|
+
maxDepth: number;
|
|
87
|
+
}): Promise<DirectoryEntry[]>;
|
|
88
|
+
/**
|
|
89
|
+
* Unbounded-depth file discovery for `glob`, replacing the `find` shell-out. Directories are
|
|
90
|
+
* pruned by `opts.prune` before being entered (so a huge `node_modules` is never walked at all,
|
|
91
|
+
* mirroring `grep`'s `--exclude-dir` push-down); symlinks (file or directory) are never followed,
|
|
92
|
+
* since `Dirent.isFile()`/`isDirectory()` reflect the link itself, not its target.
|
|
93
|
+
*/
|
|
94
|
+
walkFiles(path: string, opts: WalkFilesOptions): Promise<WalkFilesResult>;
|
|
95
|
+
}
|
|
96
|
+
export declare function createFileStore(): FileStore;
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
import { createReadStream } from "node:fs";
|
|
2
|
+
import { stat as fsStat, mkdir, open, readdir, rename, unlink } from "node:fs/promises";
|
|
3
|
+
import { dirname, join } from "node:path";
|
|
4
|
+
import { Writable } from "node:stream";
|
|
5
|
+
import { createAtomicTempPath, writeFileAtomically } from "./shared/atomic-file.js";
|
|
6
|
+
export function fingerprintOf(stat) {
|
|
7
|
+
return { size: stat.size, mtimeMs: stat.mtimeMs, ino: stat.ino };
|
|
8
|
+
}
|
|
9
|
+
export function fingerprintsEqual(a, b) {
|
|
10
|
+
return a.size === b.size && a.mtimeMs === b.mtimeMs && a.ino === b.ino;
|
|
11
|
+
}
|
|
12
|
+
export function createFileStore() {
|
|
13
|
+
return new HostFileStore();
|
|
14
|
+
}
|
|
15
|
+
function toFileStat(raw) {
|
|
16
|
+
return {
|
|
17
|
+
size: raw.size,
|
|
18
|
+
mtimeMs: raw.mtimeMs,
|
|
19
|
+
ino: raw.ino,
|
|
20
|
+
mode: raw.mode,
|
|
21
|
+
isDirectory: raw.isDirectory(),
|
|
22
|
+
isFile: raw.isFile(),
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
function throwIfAborted(signal) {
|
|
26
|
+
if (signal?.aborted) {
|
|
27
|
+
throw new Error("Aborted");
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
/** Best-effort directory fsync after a rename; mirrors `shared/atomic-file.ts`'s own tolerance. */
|
|
31
|
+
async function fsyncDir(dir) {
|
|
32
|
+
await open(dir, "r")
|
|
33
|
+
.then(async (dirHandle) => {
|
|
34
|
+
try {
|
|
35
|
+
await dirHandle.sync();
|
|
36
|
+
}
|
|
37
|
+
finally {
|
|
38
|
+
await dirHandle.close();
|
|
39
|
+
}
|
|
40
|
+
})
|
|
41
|
+
.catch(() => undefined);
|
|
42
|
+
}
|
|
43
|
+
class HostFileStore {
|
|
44
|
+
async stat(path) {
|
|
45
|
+
try {
|
|
46
|
+
return toFileStat(await fsStat(path));
|
|
47
|
+
}
|
|
48
|
+
catch (error) {
|
|
49
|
+
if (error.code === "ENOENT") {
|
|
50
|
+
return undefined;
|
|
51
|
+
}
|
|
52
|
+
throw error;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
async readBytes(path, opts = {}) {
|
|
56
|
+
throwIfAborted(opts.signal);
|
|
57
|
+
const handle = await open(path, "r");
|
|
58
|
+
try {
|
|
59
|
+
const stat = toFileStat(await handle.stat());
|
|
60
|
+
const start = Math.max(0, opts.start ?? 0);
|
|
61
|
+
const maxBytes = opts.maxBytes ?? Number.POSITIVE_INFINITY;
|
|
62
|
+
const available = Math.max(0, stat.size - start);
|
|
63
|
+
const toRead = Math.min(available, maxBytes);
|
|
64
|
+
const buffer = Buffer.alloc(toRead);
|
|
65
|
+
let readTotal = 0;
|
|
66
|
+
while (readTotal < toRead) {
|
|
67
|
+
throwIfAborted(opts.signal);
|
|
68
|
+
const { bytesRead } = await handle.read(buffer, readTotal, toRead - readTotal, start + readTotal);
|
|
69
|
+
if (bytesRead === 0) {
|
|
70
|
+
break;
|
|
71
|
+
}
|
|
72
|
+
readTotal += bytesRead;
|
|
73
|
+
}
|
|
74
|
+
const data = readTotal === buffer.length ? buffer : buffer.subarray(0, readTotal);
|
|
75
|
+
return { data, eof: start + readTotal >= stat.size, stat };
|
|
76
|
+
}
|
|
77
|
+
finally {
|
|
78
|
+
await handle.close();
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
openRead(path, opts = {}) {
|
|
82
|
+
return createReadStream(path, { start: opts.start, end: opts.end });
|
|
83
|
+
}
|
|
84
|
+
async writeAtomic(path, data, opts = {}) {
|
|
85
|
+
throwIfAborted(opts.signal);
|
|
86
|
+
if (opts.createParentDir) {
|
|
87
|
+
await mkdir(dirname(path), { recursive: true });
|
|
88
|
+
}
|
|
89
|
+
await writeFileAtomically(path, data, { preserveMode: opts.preserveMode });
|
|
90
|
+
}
|
|
91
|
+
async replaceViaTemp(path, produce, opts = {}) {
|
|
92
|
+
throwIfAborted(opts.signal);
|
|
93
|
+
const dir = dirname(path);
|
|
94
|
+
await mkdir(dir, { recursive: true });
|
|
95
|
+
const tempPath = createAtomicTempPath(path);
|
|
96
|
+
try {
|
|
97
|
+
const handle = await open(tempPath, "w");
|
|
98
|
+
try {
|
|
99
|
+
if (opts.preserveMode) {
|
|
100
|
+
const existing = await this.stat(path);
|
|
101
|
+
if (existing) {
|
|
102
|
+
await handle.chmod(existing.mode & 0o777);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
// `handle.createWriteStream()` closes the underlying `FileHandle` itself once the stream
|
|
106
|
+
// ends, so a subsequent `handle.sync()`/`handle.close()` on the same handle would throw
|
|
107
|
+
// "file closed". Write through `handle.write()` directly instead, keeping the handle
|
|
108
|
+
// under our own control until the explicit `sync()` + `close()` below.
|
|
109
|
+
const out = new Writable({
|
|
110
|
+
write(chunk, _encoding, callback) {
|
|
111
|
+
handle.write(chunk).then(() => callback(), (error) => callback(error instanceof Error ? error : new Error(String(error))));
|
|
112
|
+
},
|
|
113
|
+
});
|
|
114
|
+
await produce(out);
|
|
115
|
+
await new Promise((resolve, reject) => {
|
|
116
|
+
out.once("error", reject);
|
|
117
|
+
out.end(() => resolve());
|
|
118
|
+
});
|
|
119
|
+
await handle.sync();
|
|
120
|
+
}
|
|
121
|
+
finally {
|
|
122
|
+
await handle.close();
|
|
123
|
+
}
|
|
124
|
+
await rename(tempPath, path);
|
|
125
|
+
await fsyncDir(dir);
|
|
126
|
+
}
|
|
127
|
+
catch (error) {
|
|
128
|
+
await unlink(tempPath).catch(() => undefined);
|
|
129
|
+
throw error;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
async listDirectory(path, opts) {
|
|
133
|
+
const results = [];
|
|
134
|
+
const walk = async (currentDir, relPrefix, depth) => {
|
|
135
|
+
const entries = await readdir(currentDir, { withFileTypes: true });
|
|
136
|
+
for (const entry of entries) {
|
|
137
|
+
const relativePath = relPrefix ? `${relPrefix}/${entry.name}` : entry.name;
|
|
138
|
+
const isDirectory = entry.isDirectory();
|
|
139
|
+
results.push({ name: entry.name, relativePath, isDirectory });
|
|
140
|
+
if (isDirectory && depth < opts.maxDepth) {
|
|
141
|
+
await walk(join(currentDir, entry.name), relativePath, depth + 1);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
};
|
|
145
|
+
await walk(path, "", 1);
|
|
146
|
+
return results;
|
|
147
|
+
}
|
|
148
|
+
async walkFiles(path, opts) {
|
|
149
|
+
const files = [];
|
|
150
|
+
let truncated = false;
|
|
151
|
+
const walk = async (currentDir, relPrefix) => {
|
|
152
|
+
if (truncated)
|
|
153
|
+
return;
|
|
154
|
+
throwIfAborted(opts.signal);
|
|
155
|
+
let entries;
|
|
156
|
+
try {
|
|
157
|
+
entries = await readdir(currentDir, { withFileTypes: true });
|
|
158
|
+
}
|
|
159
|
+
catch {
|
|
160
|
+
// An unreadable directory (permission, or removed mid-walk) is skipped rather than
|
|
161
|
+
// failing the whole discovery -- one bad subtree must not blank out every other match.
|
|
162
|
+
return;
|
|
163
|
+
}
|
|
164
|
+
for (const entry of entries) {
|
|
165
|
+
if (truncated)
|
|
166
|
+
return;
|
|
167
|
+
const relativePath = relPrefix ? `${relPrefix}/${entry.name}` : entry.name;
|
|
168
|
+
if (entry.isDirectory()) {
|
|
169
|
+
if (opts.prune?.(entry.name))
|
|
170
|
+
continue;
|
|
171
|
+
await walk(join(currentDir, entry.name), relativePath);
|
|
172
|
+
continue;
|
|
173
|
+
}
|
|
174
|
+
// Symlinks (to files or directories) report false from both checks and are skipped: a
|
|
175
|
+
// glob result must never resolve outside the guarded root through a link the walk never
|
|
176
|
+
// asked permission to follow.
|
|
177
|
+
if (!entry.isFile())
|
|
178
|
+
continue;
|
|
179
|
+
files.push(relativePath);
|
|
180
|
+
if (files.length >= opts.maxEntries) {
|
|
181
|
+
truncated = true;
|
|
182
|
+
return;
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
};
|
|
186
|
+
await walk(path, "");
|
|
187
|
+
return { files, truncated };
|
|
188
|
+
}
|
|
189
|
+
}
|
|
@@ -8,7 +8,7 @@ import { readMemoryMetadata } from "./metadata.js";
|
|
|
8
8
|
import { classifyMemoryWrite, DEFAULT_MEMORY_AUTO_WRITE_CONFIDENCE, MAX_PROBATION_WRITES_PER_RUN, } from "./promotion.js";
|
|
9
9
|
import { MEMORY_INPUT_SAFETY_RULES } from "./prompt-safety.js";
|
|
10
10
|
import { runSidecarTask } from "./sidecar-worker.js";
|
|
11
|
-
import { sanitizeMessagesForMemory } from "./transcript.js";
|
|
11
|
+
import { hasMeaningfulExchange, sanitizeMessagesForMemory } from "./transcript.js";
|
|
12
12
|
const INLINE_TRANSCRIPT_MAX_CHARS = 28_000;
|
|
13
13
|
const MEMORY_CLEANUP_LENGTH_THRESHOLD = 5_000;
|
|
14
14
|
const MEMORY_UPDATE_BLOCK_THRESHOLD = 4;
|
|
@@ -73,30 +73,6 @@ function entriesAfterLatestCompactionBoundary(entries) {
|
|
|
73
73
|
function extractMessagesFromSessionEntries(entries) {
|
|
74
74
|
return entries.filter(isMessage).map((entry) => entry.message);
|
|
75
75
|
}
|
|
76
|
-
function hasMeaningfulMessages(messages) {
|
|
77
|
-
let meaningfulCount = 0;
|
|
78
|
-
for (const message of messages) {
|
|
79
|
-
if (message.role === "user") {
|
|
80
|
-
const text = typeof message.content === "string"
|
|
81
|
-
? message.content
|
|
82
|
-
: message.content.map((part) => (part.type === "text" ? part.text : "[image]")).join("\n");
|
|
83
|
-
if (text.trim())
|
|
84
|
-
meaningfulCount++;
|
|
85
|
-
}
|
|
86
|
-
else if (message.role === "assistant") {
|
|
87
|
-
const text = message.content
|
|
88
|
-
.filter((part) => part.type === "text")
|
|
89
|
-
.map((part) => part.text)
|
|
90
|
-
.join("\n");
|
|
91
|
-
if (text.trim())
|
|
92
|
-
meaningfulCount++;
|
|
93
|
-
}
|
|
94
|
-
if (meaningfulCount >= 2) {
|
|
95
|
-
return true;
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
return false;
|
|
99
|
-
}
|
|
100
76
|
function countMatchingSectionHeadings(content, prefix) {
|
|
101
77
|
return splitH2Sections(content).filter((section) => section.heading.startsWith(prefix)).length;
|
|
102
78
|
}
|
|
@@ -135,7 +111,7 @@ export async function runInlineConsolidation(options) {
|
|
|
135
111
|
const sourceEntries = options.sourceWindow?.entries ?? entriesAfterLatestCompactionBoundary(options.sessionEntries ?? []);
|
|
136
112
|
const relevantMessages = options.sourceWindow?.messages ??
|
|
137
113
|
(sourceEntries.length > 0 ? extractMessagesFromSessionEntries(sourceEntries) : options.messages);
|
|
138
|
-
if (!
|
|
114
|
+
if (!hasMeaningfulExchange(sanitizeMessagesForMemory(relevantMessages))) {
|
|
139
115
|
return {
|
|
140
116
|
skipped: true,
|
|
141
117
|
appendedMemoryEntries: 0,
|
package/dist/memory/files.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { createHash, randomBytes } from "crypto";
|
|
2
|
-
import { existsSync, mkdirSync
|
|
2
|
+
import { existsSync, mkdirSync } from "fs";
|
|
3
3
|
import { appendFile, copyFile, readdir, rename, rm, stat } from "fs/promises";
|
|
4
4
|
import { basename, join } from "path";
|
|
5
|
-
import { writeFileAtomically } from "../shared/atomic-file.js";
|
|
5
|
+
import { writeFileAtomically, writeFileAtomicallySync } from "../shared/atomic-file.js";
|
|
6
6
|
import { readOptionalTextFile } from "../shared/fs-utils.js";
|
|
7
|
-
import { formatLocalTime, localStampForFilename } from "../shared/local-time.js";
|
|
7
|
+
import { formatLocalTime, localStampForFilename, parseLocalTime } from "../shared/local-time.js";
|
|
8
8
|
import { syncMemoryMetadata } from "./metadata.js";
|
|
9
9
|
import { containsSecret, REDACTED_SECRET } from "./secret-redaction.js";
|
|
10
10
|
import { appendMemoryTombstone, hashMemoryContent, readMemoryTombstones } from "./tombstones.js";
|
|
@@ -92,7 +92,7 @@ export function parseUpdateHeadingTimestamp(heading) {
|
|
|
92
92
|
return undefined;
|
|
93
93
|
}
|
|
94
94
|
const timestamp = match[1].trim();
|
|
95
|
-
return
|
|
95
|
+
return parseLocalTime(timestamp) !== undefined ? timestamp : undefined;
|
|
96
96
|
}
|
|
97
97
|
/** Parse durable MEMORY.md bullet entries with stable ids for op-based edits. */
|
|
98
98
|
export function parseChannelMemoryEntries(content) {
|
|
@@ -339,13 +339,13 @@ export function ensureChannelMemoryFilesSync(channelDir) {
|
|
|
339
339
|
const sessionPath = getChannelSessionPath(channelDir);
|
|
340
340
|
mkdirSync(channelDir, { recursive: true });
|
|
341
341
|
if (!existsSync(memoryPath)) {
|
|
342
|
-
|
|
342
|
+
writeFileAtomicallySync(memoryPath, DEFAULT_CHANNEL_MEMORY);
|
|
343
343
|
}
|
|
344
344
|
if (!existsSync(historyPath)) {
|
|
345
|
-
|
|
345
|
+
writeFileAtomicallySync(historyPath, DEFAULT_CHANNEL_HISTORY);
|
|
346
346
|
}
|
|
347
347
|
if (!existsSync(sessionPath)) {
|
|
348
|
-
|
|
348
|
+
writeFileAtomicallySync(sessionPath, DEFAULT_CHANNEL_SESSION);
|
|
349
349
|
}
|
|
350
350
|
}
|
|
351
351
|
export async function readChannelMemory(channelDir) {
|
|
@@ -10,7 +10,7 @@ import { collectExpiredEntryIds, expireMemoryEntries } from "./probation.js";
|
|
|
10
10
|
import { appendMemoryReviewLog } from "./review-log.js";
|
|
11
11
|
import { updateChannelSessionMemory } from "./session.js";
|
|
12
12
|
import { buildIncrementalMemorySourceWindow } from "./source-window.js";
|
|
13
|
-
import { sanitizeMessagesForMemory } from "./transcript.js";
|
|
13
|
+
import { hasMeaningfulExchange, sanitizeMessagesForMemory } from "./transcript.js";
|
|
14
14
|
/** Evaluate `load` at most once, so a gate and the job body can share one expensive read. */
|
|
15
15
|
function once(load) {
|
|
16
16
|
let cached;
|
|
@@ -22,40 +22,8 @@ function once(load) {
|
|
|
22
22
|
function latestEntryId(entries) {
|
|
23
23
|
return entries.at(-1)?.id;
|
|
24
24
|
}
|
|
25
|
-
function messageToText(message) {
|
|
26
|
-
if (message.role === "user") {
|
|
27
|
-
return typeof message.content === "string"
|
|
28
|
-
? message.content
|
|
29
|
-
: message.content.map((part) => (part.type === "text" ? part.text : "[image]")).join("\n");
|
|
30
|
-
}
|
|
31
|
-
if (message.role === "assistant") {
|
|
32
|
-
return message.content
|
|
33
|
-
.map((part) => (part.type === "text" ? part.text : ""))
|
|
34
|
-
.filter(Boolean)
|
|
35
|
-
.join("\n");
|
|
36
|
-
}
|
|
37
|
-
return "";
|
|
38
|
-
}
|
|
39
25
|
function hasMeaningfulMessages(messages) {
|
|
40
|
-
|
|
41
|
-
let userSeen = false;
|
|
42
|
-
let assistantSeen = false;
|
|
43
|
-
for (const message of standardMessages) {
|
|
44
|
-
const text = messageToText(message).trim();
|
|
45
|
-
if (!text) {
|
|
46
|
-
continue;
|
|
47
|
-
}
|
|
48
|
-
if (message.role === "user") {
|
|
49
|
-
userSeen = true;
|
|
50
|
-
}
|
|
51
|
-
if (message.role === "assistant") {
|
|
52
|
-
assistantSeen = true;
|
|
53
|
-
}
|
|
54
|
-
if (userSeen && assistantSeen) {
|
|
55
|
-
return true;
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
return false;
|
|
26
|
+
return hasMeaningfulExchange(sanitizeMessagesForMemory(messages));
|
|
59
27
|
}
|
|
60
28
|
function makeRunOptions(input, usageCorrelationId) {
|
|
61
29
|
return {
|
|
@@ -2,6 +2,7 @@ import { readFile } from "node:fs/promises";
|
|
|
2
2
|
import { join } from "node:path";
|
|
3
3
|
import * as log from "../log.js";
|
|
4
4
|
import { writeFileAtomically } from "../shared/atomic-file.js";
|
|
5
|
+
import { parseLocalTime } from "../shared/local-time.js";
|
|
5
6
|
import { createSerialQueue } from "../shared/serial-queue.js";
|
|
6
7
|
import { errorMessage } from "../shared/text-utils.js";
|
|
7
8
|
const stateUpdateQueue = createSerialQueue();
|
|
@@ -37,7 +38,7 @@ function laterTimestamp(a, b) {
|
|
|
37
38
|
return b;
|
|
38
39
|
if (!b)
|
|
39
40
|
return a;
|
|
40
|
-
return
|
|
41
|
+
return (parseLocalTime(a) ?? -Infinity) >= (parseLocalTime(b) ?? -Infinity) ? a : b;
|
|
41
42
|
}
|
|
42
43
|
function normalizeState(channelId, value) {
|
|
43
44
|
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
package/dist/memory/recall.d.ts
CHANGED
|
@@ -46,4 +46,14 @@ export declare const MEMORY_RECALL_MAX_UNITS = 1800;
|
|
|
46
46
|
/** The most recent user turn, with injected memory/context wrappers stripped (see `transcript.ts`). */
|
|
47
47
|
export declare function findPreviousUserText(messages: AgentMessage[]): string | undefined;
|
|
48
48
|
export declare function tokenizeRecallText(text: string): string[];
|
|
49
|
+
/**
|
|
50
|
+
* Age-bucketed recency boost (≤1 day / ≤7 days / ≤30 days / older), scaled by `weights` — the
|
|
51
|
+
* bucket shape is shared with `session-search.ts`'s scoring, but the two scoring systems live on
|
|
52
|
+
* different magnitudes, so each caller supplies its own weights rather than sharing a fixed scale.
|
|
53
|
+
*/
|
|
54
|
+
export declare function recencyBoostByAge(timestamp: string | undefined, weights: {
|
|
55
|
+
day: number;
|
|
56
|
+
week: number;
|
|
57
|
+
month: number;
|
|
58
|
+
}): number;
|
|
49
59
|
export declare function recallRelevantMemory(request: RecallRequest): Promise<RecallResult>;
|
package/dist/memory/recall.js
CHANGED
|
@@ -383,22 +383,30 @@ function normalizeExactMatchQuery(query) {
|
|
|
383
383
|
const minLength = containsHanText(normalizedQuery) ? 2 : 4;
|
|
384
384
|
return normalizedQuery.length >= minLength ? normalizedQuery : "";
|
|
385
385
|
}
|
|
386
|
-
|
|
386
|
+
/**
|
|
387
|
+
* Age-bucketed recency boost (≤1 day / ≤7 days / ≤30 days / older), scaled by `weights` — the
|
|
388
|
+
* bucket shape is shared with `session-search.ts`'s scoring, but the two scoring systems live on
|
|
389
|
+
* different magnitudes, so each caller supplies its own weights rather than sharing a fixed scale.
|
|
390
|
+
*/
|
|
391
|
+
export function recencyBoostByAge(timestamp, weights) {
|
|
387
392
|
if (!timestamp)
|
|
388
393
|
return 0;
|
|
389
|
-
const timestampMs =
|
|
390
|
-
if (
|
|
394
|
+
const timestampMs = parseLocalTime(timestamp);
|
|
395
|
+
if (timestampMs === undefined)
|
|
391
396
|
return 0;
|
|
392
397
|
const ageMs = Date.now() - timestampMs;
|
|
393
398
|
const dayMs = 24 * 60 * 60 * 1000;
|
|
394
399
|
if (ageMs <= dayMs)
|
|
395
|
-
return
|
|
400
|
+
return weights.day;
|
|
396
401
|
if (ageMs <= 7 * dayMs)
|
|
397
|
-
return
|
|
402
|
+
return weights.week;
|
|
398
403
|
if (ageMs <= 30 * dayMs)
|
|
399
|
-
return
|
|
404
|
+
return weights.month;
|
|
400
405
|
return 0;
|
|
401
406
|
}
|
|
407
|
+
function computeRecencyBoost(timestamp) {
|
|
408
|
+
return recencyBoostByAge(timestamp, { day: 6, week: 4, month: 2 });
|
|
409
|
+
}
|
|
402
410
|
function detectQueryIntents(query) {
|
|
403
411
|
const intents = new Set();
|
|
404
412
|
if (/\b(now|current|currently|status)\b/i.test(query) || /(现在|当前|目前|正在|状态)/u.test(query)) {
|
|
@@ -653,7 +661,7 @@ function renderRecallResult(items, maxChars, maxUnits) {
|
|
|
653
661
|
}
|
|
654
662
|
const omittedCount = items.length - includedCount;
|
|
655
663
|
if (omittedCount > 0) {
|
|
656
|
-
clippedLines.push("", `[- ${omittedCount} more item(s) omitted for length; use
|
|
664
|
+
clippedLines.push("", `[- ${omittedCount} more item(s) omitted for length; use memory_search or session_search to look them up.]`);
|
|
657
665
|
}
|
|
658
666
|
clippedLines.push(closing);
|
|
659
667
|
return clippedLines.join("\n");
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { relative } from "node:path";
|
|
2
|
+
import { parseLocalTime } from "../shared/local-time.js";
|
|
2
3
|
import { clipText } from "../shared/text-utils.js";
|
|
3
|
-
import { tokenizeRecallText } from "./recall.js";
|
|
4
|
+
import { recencyBoostByAge, tokenizeRecallText } from "./recall.js";
|
|
4
5
|
import { buildSessionCorpus } from "./session-corpus.js";
|
|
5
6
|
import { runSidecarTask } from "./sidecar-worker.js";
|
|
6
7
|
const SESSION_SEARCH_SUMMARY_SYSTEM_PROMPT = `You summarize current-channel transcript search hits for Pipiclaw.
|
|
@@ -23,24 +24,7 @@ function normalizeRoleFilter(roleFilter) {
|
|
|
23
24
|
return new Set((roleFilter ?? []).map((role) => role.trim().toLowerCase()).filter(Boolean));
|
|
24
25
|
}
|
|
25
26
|
function computeRecencyBoost(timestamp) {
|
|
26
|
-
|
|
27
|
-
return 0;
|
|
28
|
-
}
|
|
29
|
-
const ms = Date.parse(timestamp);
|
|
30
|
-
if (!Number.isFinite(ms)) {
|
|
31
|
-
return 0;
|
|
32
|
-
}
|
|
33
|
-
const ageDays = Math.max(0, (Date.now() - ms) / 86_400_000);
|
|
34
|
-
if (ageDays <= 1) {
|
|
35
|
-
return 0.5;
|
|
36
|
-
}
|
|
37
|
-
if (ageDays <= 7) {
|
|
38
|
-
return 0.25;
|
|
39
|
-
}
|
|
40
|
-
if (ageDays <= 30) {
|
|
41
|
-
return 0.1;
|
|
42
|
-
}
|
|
43
|
-
return 0;
|
|
27
|
+
return recencyBoostByAge(timestamp, { day: 0.5, week: 0.25, month: 0.1 });
|
|
44
28
|
}
|
|
45
29
|
/**
|
|
46
30
|
* Tokenizing a document is by far the most expensive part of a search — a few milliseconds for a
|
|
@@ -89,9 +73,9 @@ function scoreDocument(document, lowerQuery, queryTokens) {
|
|
|
89
73
|
};
|
|
90
74
|
}
|
|
91
75
|
function sortRecentDocuments(a, b) {
|
|
92
|
-
const aTime = a.timestamp ?
|
|
93
|
-
const bTime = b.timestamp ?
|
|
94
|
-
return
|
|
76
|
+
const aTime = (a.timestamp ? parseLocalTime(a.timestamp) : undefined) ?? 0;
|
|
77
|
+
const bTime = (b.timestamp ? parseLocalTime(b.timestamp) : undefined) ?? 0;
|
|
78
|
+
return bTime - aTime;
|
|
95
79
|
}
|
|
96
80
|
async function summarizeHit(request, document, query) {
|
|
97
81
|
const fallback = clipText(document.text, request.maxCharsPerChunk, { headRatio: 0.65, omitHint: "\n[...]\n" });
|
|
@@ -7,3 +7,13 @@ export declare function stripInjectedMemoryContext(text: string): string;
|
|
|
7
7
|
* transcript, so recalled memory is never folded back into durable memory.
|
|
8
8
|
*/
|
|
9
9
|
export declare function sanitizeMessagesForMemory(messages: AgentMessage[]): Message[];
|
|
10
|
+
/** The displayable text of one user/assistant `Message`, or `""` for a role with no text content. */
|
|
11
|
+
export declare function messageText(message: Message): string;
|
|
12
|
+
/**
|
|
13
|
+
* True once the transcript contains a real back-and-forth — at least one user turn and one
|
|
14
|
+
* assistant turn that both carry non-empty text — rather than just a one-sided ping or a run of
|
|
15
|
+
* tool-only turns. This is the single bar for "worth running memory consolidation on"; it used to
|
|
16
|
+
* be answered two different ways in two different maintenance paths, which could reach opposite
|
|
17
|
+
* conclusions on the same short, hand-authored transcript.
|
|
18
|
+
*/
|
|
19
|
+
export declare function hasMeaningfulExchange(messages: Message[]): boolean;
|
|
@@ -52,3 +52,42 @@ export function sanitizeMessagesForMemory(messages) {
|
|
|
52
52
|
return message;
|
|
53
53
|
});
|
|
54
54
|
}
|
|
55
|
+
/** The displayable text of one user/assistant `Message`, or `""` for a role with no text content. */
|
|
56
|
+
export function messageText(message) {
|
|
57
|
+
if (message.role === "user") {
|
|
58
|
+
return typeof message.content === "string"
|
|
59
|
+
? message.content
|
|
60
|
+
: message.content.map((part) => (part.type === "text" ? part.text : "[image]")).join("\n");
|
|
61
|
+
}
|
|
62
|
+
if (message.role === "assistant") {
|
|
63
|
+
return message.content
|
|
64
|
+
.map((part) => (part.type === "text" ? part.text : ""))
|
|
65
|
+
.filter(Boolean)
|
|
66
|
+
.join("\n");
|
|
67
|
+
}
|
|
68
|
+
return "";
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* True once the transcript contains a real back-and-forth — at least one user turn and one
|
|
72
|
+
* assistant turn that both carry non-empty text — rather than just a one-sided ping or a run of
|
|
73
|
+
* tool-only turns. This is the single bar for "worth running memory consolidation on"; it used to
|
|
74
|
+
* be answered two different ways in two different maintenance paths, which could reach opposite
|
|
75
|
+
* conclusions on the same short, hand-authored transcript.
|
|
76
|
+
*/
|
|
77
|
+
export function hasMeaningfulExchange(messages) {
|
|
78
|
+
let userSeen = false;
|
|
79
|
+
let assistantSeen = false;
|
|
80
|
+
for (const message of messages) {
|
|
81
|
+
if (message.role !== "user" && message.role !== "assistant")
|
|
82
|
+
continue;
|
|
83
|
+
if (!messageText(message).trim())
|
|
84
|
+
continue;
|
|
85
|
+
if (message.role === "user")
|
|
86
|
+
userSeen = true;
|
|
87
|
+
if (message.role === "assistant")
|
|
88
|
+
assistantSeen = true;
|
|
89
|
+
if (userSeen && assistantSeen)
|
|
90
|
+
return true;
|
|
91
|
+
}
|
|
92
|
+
return false;
|
|
93
|
+
}
|
|
@@ -37,6 +37,8 @@ order: 60
|
|
|
37
37
|
|
|
38
38
|
`effort` 只是预算档位:对内置角色是轮次/工具调用/时钟三件套,对外部角色主要是放宽墙钟时间。它不会让执行者更聪明,替代不了写清楚的契约。
|
|
39
39
|
|
|
40
|
+
`thinkingLevel` 不传时,内置委派和外部 `purpose=verify` 默认 `medium`;外部 `purpose=work` 不传则完全不设,交给目标 CLI 自己的配置决定。
|
|
41
|
+
|
|
40
42
|
## 三、工作目录:每次委派现场决定
|
|
41
43
|
|
|
42
44
|
省略 `workingDirectory` 时委派落到**当前频道的项目目录**,也就是你此刻的工作面。角色文件里没有默认工作目录,也不会有——同一个角色这次改 A 仓库、下次改 B 仓库,写死一个默认值只会让人跳过该做的判断。
|
|
@@ -53,15 +55,15 @@ order: 60
|
|
|
53
55
|
|
|
54
56
|
1. **不要轮询,也不要用后台作业包一层等待。** 委派结束时 runtime 会唤醒本频道,带回状态、耗时、结果尾部和产物路径。这是 runtime 保证。
|
|
55
57
|
2. **立即结束当前回合。** 属于某个 task 时,派发就带上 `taskId`,并按 `task-driving.md` 把任务停泊为 `waiting`——runtime 按 run 记录里的 `taskId` 认领并恢复该任务。
|
|
56
|
-
3. 想看进度用 `
|
|
58
|
+
3. 想看进度用 `subagent_list`(用户命令:`/subagents list`),不要靠反复调用委派工具来"检查"。
|
|
57
59
|
4. 每个频道最多 6 个同时在跑的委派(宿主全局 20 个)。被上限拒绝时先等一个结束或 `cancel` 一个,不要改小任务再试。
|
|
58
60
|
5. daemon 重启时外部 run 通常继续跑,内置 run 会被判 `lost` 并唤醒说明;外部 run 若在进程 pid 真正落盘之前就重启,同样判 `lost`。`lost` 的含义是"结局未知":先查真实产物,再决定重派。重连恢复出的耗时前面带 `≈`,那是从产物文件估算的,不是实测值。
|
|
59
|
-
6. 外部 run 失败又看不出原因时,用 `
|
|
61
|
+
6. 外部 run 失败又看不出原因时,用 `subagent_run op=show <runId>` 自诊断:实际 argv、派发警告、适配器/CLI 版本、stderr 尾部都在里面,不要凭猜测重派。
|
|
60
62
|
|
|
61
63
|
## 五、纠偏与续接
|
|
62
64
|
|
|
63
|
-
- `
|
|
64
|
-
- `
|
|
65
|
+
- `subagent_run op=cancel <runId>`:提前终止。取消不产生唤醒,因为那是你自己的决定。用户的 `/stop` 也**不会**连带停止已派发的委派——停止一个正在写工作区的进程永远需要一次显式决定。
|
|
66
|
+
- `subagent_run op=follow_up <runId>`:在一个**已结束**的可续接外部 run(claude-code / codex-cli)上追加一轮,省掉重新交代上下文。它产生新的 `runId`,同样异步唤醒,走与首次派发相同的信封(运行时上下文、上下文块、verify 协议)。内置 run 和 `exec` 不支持续接,改为带着上一轮产出开一个新委派。角色的 `command`/`model`/`shell` 在两次派发之间变过时续接会被拒绝——把变化当作"开新任务"。
|
|
65
67
|
- 只在明确阻塞、循环、崩溃、需要纠偏或用户要求时才取消;耗时长本身不是理由。
|
|
66
68
|
|
|
67
69
|
## 六、产物与验收
|
|
@@ -23,7 +23,7 @@ order: 50
|
|
|
23
23
|
|
|
24
24
|
只有一种情况要自己收尾:`notify: false` 的 fire-and-forget 作业结束时不会叫你,得自己 `job op=list`。
|
|
25
25
|
|
|
26
|
-
作业属于某项长程任务时,启动就传 `taskId
|
|
26
|
+
作业属于某项长程任务时,启动就传 `taskId`,唤醒文本会点明归属;再用带 `note` 的 `task_update` 把任务停泊为 `waiting`(不设 wake,见 `task-driving.md`)。
|
|
27
27
|
|
|
28
28
|
## 硬约束
|
|
29
29
|
|
|
@@ -18,7 +18,7 @@ export interface RuntimePlaybookMetadata {
|
|
|
18
18
|
export declare function loadRuntimePlaybookCatalog(directory?: string): RuntimePlaybookMetadata[];
|
|
19
19
|
/**
|
|
20
20
|
* Drop playbooks whose mechanism is unreachable with the current tool set: the task
|
|
21
|
-
* playbooks are pure noise for a runtime with
|
|
21
|
+
* playbooks are pure noise for a runtime with the task_* tools switched off.
|
|
22
22
|
*/
|
|
23
23
|
export declare function selectRuntimePlaybooks(catalog: RuntimePlaybookMetadata[], toolNames: readonly string[]): RuntimePlaybookMetadata[];
|
|
24
24
|
/**
|