@oyasmi/pipiclaw 0.9.3-beta.5 → 0.9.3
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.en.md +1 -1
- package/README.md +1 -1
- package/dist/agent/channel-runner.d.ts +4 -8
- package/dist/agent/channel-runner.js +14 -34
- package/dist/agent/job-manager.d.ts +12 -0
- package/dist/agent/job-manager.js +42 -1
- package/dist/agent/prompt/sections.js +2 -2
- package/dist/agent/runner-factory.d.ts +2 -2
- package/dist/agent/types.d.ts +11 -7
- package/dist/channel/channel-index.d.ts +9 -2
- package/dist/channel/channel-index.js +25 -6
- package/dist/channel/project-scope-store.d.ts +20 -0
- package/dist/channel/project-scope-store.js +22 -7
- package/dist/commands/catalog.js +6 -12
- package/dist/events/event-commands.js +2 -2
- package/dist/events/events.d.ts +51 -30
- package/dist/events/events.js +70 -98
- package/dist/memory/journal.d.ts +2 -3
- package/dist/memory/journal.js +2 -3
- package/dist/memory/maintenance-tuning.d.ts +0 -1
- package/dist/memory/maintenance-tuning.js +0 -1
- package/dist/memory/scheduler.js +8 -16
- package/dist/memory/search.js +2 -3
- package/dist/memory/session-search.js +3 -9
- package/dist/memory/store.d.ts +1 -1
- package/dist/memory/store.js +9 -1
- package/dist/memory/task-digest.js +10 -11
- package/dist/memory/tombstones.js +2 -4
- package/dist/models/provider-login.d.ts +1 -1
- package/dist/models/provider-login.js +1 -1
- package/dist/playbooks/agent-delegation.md +6 -6
- package/dist/playbooks/background-jobs.md +1 -1
- package/dist/playbooks/event-scheduling.md +22 -13
- package/dist/playbooks/memory-and-learning.md +2 -2
- package/dist/playbooks/outbound-media.md +1 -1
- package/dist/playbooks/runtime-orientation.md +3 -3
- package/dist/playbooks/task-lead.md +82 -0
- package/dist/runtime/bootstrap.js +94 -187
- package/dist/runtime/durable-dispatch.js +30 -3
- package/dist/runtime/report-commands.d.ts +30 -0
- package/dist/runtime/report-commands.js +71 -0
- package/dist/runtime/subagent-commands.js +1 -1
- package/dist/runtime/task-commands.d.ts +0 -8
- package/dist/runtime/task-commands.js +48 -85
- package/dist/runtime/task-driver.d.ts +15 -10
- package/dist/runtime/task-driver.js +36 -41
- package/dist/runtime/task-migration.d.ts +23 -29
- package/dist/runtime/task-migration.js +364 -183
- package/dist/runtime/task-spawn.d.ts +24 -0
- package/dist/runtime/task-spawn.js +49 -0
- package/dist/runtime/task-wake.d.ts +33 -46
- package/dist/runtime/task-wake.js +15 -90
- package/dist/security/network.js +44 -9
- package/dist/settings.d.ts +1 -8
- package/dist/settings.js +1 -8
- package/dist/subagents/discovery.js +3 -15
- package/dist/subagents/external/run.d.ts +3 -1
- package/dist/subagents/external/run.js +2 -20
- package/dist/subagents/external/settlement.d.ts +4 -16
- package/dist/subagents/external/settlement.js +16 -67
- package/dist/subagents/runs.d.ts +15 -29
- package/dist/subagents/runs.js +70 -158
- package/dist/subagents/tool.d.ts +20 -4
- package/dist/subagents/tool.js +63 -87
- package/dist/subagents/verification-outcome.d.ts +13 -19
- package/dist/subagents/verification-outcome.js +8 -22
- package/dist/subagents/workspace-summary.d.ts +8 -0
- package/dist/subagents/workspace-summary.js +29 -0
- package/dist/tasks/board.d.ts +43 -0
- package/dist/tasks/board.js +134 -0
- package/dist/tasks/brief.d.ts +10 -5
- package/dist/tasks/brief.js +78 -26
- package/dist/tasks/budget.d.ts +13 -14
- package/dist/tasks/budget.js +21 -40
- package/dist/tasks/contract-input.d.ts +19 -0
- package/dist/tasks/contract-input.js +55 -0
- package/dist/tasks/create.d.ts +17 -0
- package/dist/tasks/create.js +36 -0
- package/dist/tasks/frontmatter.d.ts +20 -27
- package/dist/tasks/frontmatter.js +18 -31
- package/dist/tasks/ledger.d.ts +61 -117
- package/dist/tasks/ledger.js +78 -223
- package/dist/tasks/log.d.ts +62 -35
- package/dist/tasks/log.js +51 -29
- package/dist/tasks/session-path.d.ts +3 -3
- package/dist/tasks/session-path.js +4 -5
- package/dist/tasks/store.d.ts +27 -28
- package/dist/tasks/store.js +89 -83
- package/dist/tasks/ticket.d.ts +33 -66
- package/dist/tasks/ticket.js +31 -120
- package/dist/tasks/work-log.d.ts +20 -0
- package/dist/tasks/work-log.js +42 -0
- package/dist/tools/bash.d.ts +1 -1
- package/dist/tools/bash.js +1 -1
- package/dist/tools/event-manage.d.ts +16 -2
- package/dist/tools/event-manage.js +30 -12
- package/dist/tools/index.d.ts +5 -3
- package/dist/tools/index.js +5 -5
- package/dist/tools/registry.d.ts +6 -4
- package/dist/tools/registry.js +1 -4
- package/dist/tools/subagent-manage.js +4 -2
- package/dist/tools/task-manage/create.js +11 -27
- package/dist/tools/task-manage/lifecycle.d.ts +6 -7
- package/dist/tools/task-manage/lifecycle.js +23 -106
- package/dist/tools/task-manage/log-view.d.ts +3 -2
- package/dist/tools/task-manage/log-view.js +6 -6
- package/dist/tools/task-manage/schema.d.ts +10 -30
- package/dist/tools/task-manage/schema.js +33 -49
- package/dist/tools/task-manage/shared.d.ts +35 -42
- package/dist/tools/task-manage/shared.js +53 -192
- package/dist/tools/task-manage/step-end.d.ts +6 -6
- package/dist/tools/task-manage/step-end.js +61 -98
- package/dist/tools/task-manage/types.d.ts +8 -9
- package/dist/tools/task-manage.js +5 -5
- package/dist/tui/app.js +11 -38
- package/dist/tui/commands.d.ts +18 -8
- package/dist/tui/commands.js +2 -9
- package/dist/tui/turn-controller.d.ts +2 -14
- package/dist/tui/turn-controller.js +1 -17
- package/dist/web/client.js +9 -1
- package/examples/sub-agents/README.md +7 -4
- package/examples/sub-agents/agents/codex-flash.md +2 -2
- package/examples/sub-agents/agents/codex-high.md +1 -1
- package/examples/sub-agents/agents/codex-main.md +1 -1
- package/examples/sub-agents/agents/codex-review.md +23 -0
- package/examples/sub-agents/roles/verifier.md +1 -1
- package/package.json +1 -1
- package/dist/memory/maintenance-migration.d.ts +0 -5
- package/dist/memory/maintenance-migration.js +0 -91
- package/dist/memory/migrate.d.ts +0 -15
- package/dist/memory/migrate.js +0 -364
- package/dist/playbooks/task-loop.md +0 -90
- package/dist/tasks/artifact-subject.d.ts +0 -40
- package/dist/tasks/artifact-subject.js +0 -334
- package/dist/tasks/cycle.d.ts +0 -48
- package/dist/tasks/cycle.js +0 -94
- package/dist/tasks/rounds.d.ts +0 -41
- package/dist/tasks/rounds.js +0 -53
- package/dist/tasks/task-events.d.ts +0 -6
- package/dist/tasks/task-events.js +0 -14
- package/dist/tasks/task-schedule.d.ts +0 -18
- package/dist/tasks/task-schedule.js +0 -50
- package/dist/tasks/verification.d.ts +0 -114
- package/dist/tasks/verification.js +0 -226
package/dist/tui/app.js
CHANGED
|
@@ -13,20 +13,14 @@ import { prepareAppServices } from "../app-services.js";
|
|
|
13
13
|
import { ensureChannelDir } from "../channel/channel-paths.js";
|
|
14
14
|
import { ChannelStore } from "../channel/store.js";
|
|
15
15
|
import { renderBuiltInHelp } from "../commands/catalog.js";
|
|
16
|
-
import { handleEventsCommand } from "../events/event-commands.js";
|
|
17
16
|
import { createExecutor } from "../executor.js";
|
|
18
17
|
import * as log from "../log.js";
|
|
19
|
-
import { migrateMemoryMaintenanceStates } from "../memory/maintenance-migration.js";
|
|
20
18
|
import { BootstrapExitError, bootstrapAppHome, DEFAULT_BOOTSTRAP_PATHS, printBootstrapSummary, readCliVersion, } from "../runtime/app-home.js";
|
|
21
19
|
import { finalDeliveryOf, progressStyleOf } from "../runtime/dingtalk.js";
|
|
22
|
-
import {
|
|
23
|
-
import { handleSkillsCommand } from "../runtime/skill-commands.js";
|
|
24
|
-
import { handleSubagentsCommand } from "../runtime/subagent-commands.js";
|
|
25
|
-
import { handleTasksCommand } from "../runtime/task-commands.js";
|
|
20
|
+
import { runReportCommand } from "../runtime/report-commands.js";
|
|
26
21
|
import { flushSecurityLogs } from "../security/logger.js";
|
|
27
22
|
import { createSubAgentRuntime } from "../subagents/runs.js";
|
|
28
23
|
import { getUsageLedger } from "../usage/ledger.js";
|
|
29
|
-
import { parseUsageMode, renderUsageReport } from "../usage/render.js";
|
|
30
24
|
import { TUI_SLASH_COMMANDS } from "./commands.js";
|
|
31
25
|
import { createFrontend } from "./renderer.js";
|
|
32
26
|
import { createTerminalMediaSender } from "./terminal-media-sender.js";
|
|
@@ -101,7 +95,6 @@ export async function runTuiApp(options) {
|
|
|
101
95
|
const { settingsManager } = prepareAppServices(paths);
|
|
102
96
|
log.configureLogging(settingsManager.getLoggingSettings());
|
|
103
97
|
log.logStartup(paths.workspaceDir);
|
|
104
|
-
await migrateMemoryMaintenanceStates(paths.appHomeDir);
|
|
105
98
|
const channelDir = ensureChannelDir(paths.workspaceDir, channelId);
|
|
106
99
|
const store = new ChannelStore({ workingDir: paths.workspaceDir });
|
|
107
100
|
const jobs = createJobRuntime(createExecutor());
|
|
@@ -130,6 +123,7 @@ export async function runTuiApp(options) {
|
|
|
130
123
|
commands: TUI_SLASH_COMMANDS,
|
|
131
124
|
basePath: paths.workspaceDir,
|
|
132
125
|
});
|
|
126
|
+
const startedAt = Date.now();
|
|
133
127
|
const controller = new TurnController({
|
|
134
128
|
runner,
|
|
135
129
|
frontend,
|
|
@@ -138,42 +132,21 @@ export async function runTuiApp(options) {
|
|
|
138
132
|
channelId,
|
|
139
133
|
userName: safeUserName(),
|
|
140
134
|
renderHelp: (args) => renderBuiltInHelp(args),
|
|
141
|
-
|
|
142
|
-
runEvents: (args) => handleEventsCommand({ args, workspaceDir: paths.workspaceDir, historyPath: paths.eventHistoryPath }),
|
|
143
|
-
runTasks: (args) => handleTasksCommand({
|
|
144
|
-
args,
|
|
145
|
-
channelDir,
|
|
146
|
-
workspaceDir: paths.workspaceDir,
|
|
135
|
+
runReport: (name, args) => runReportCommand({
|
|
147
136
|
channelId,
|
|
148
|
-
|
|
149
|
-
runSubagents: (args) => handleSubagentsCommand({
|
|
150
|
-
runManager: runs.get(channelId),
|
|
151
|
-
args,
|
|
152
|
-
channelId,
|
|
153
|
-
discovery: runner.getSubAgentDiscoverySnapshot(),
|
|
154
|
-
}),
|
|
155
|
-
runSkills: (args) => handleSkillsCommand({ args, workspaceDir: paths.workspaceDir, appHomeDir: paths.appHomeDir, channelId }),
|
|
156
|
-
runProject: (args) => handleProjectCommand({
|
|
157
|
-
args,
|
|
158
|
-
channelId,
|
|
159
|
-
channelDir,
|
|
160
|
-
appHomeDir: paths.appHomeDir,
|
|
137
|
+
paths,
|
|
161
138
|
actor: "tui-command",
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
.map((record) => `subagent run \`${record.runId}\` (${record.agent})`),
|
|
169
|
-
...jobs.runningLines(channelId),
|
|
170
|
-
],
|
|
139
|
+
version: readCliVersion(),
|
|
140
|
+
startedAt,
|
|
141
|
+
peekRunner: () => runner,
|
|
142
|
+
getRunner: () => runner,
|
|
143
|
+
runManager: runs.get(channelId),
|
|
144
|
+
runningJobLines: () => jobs.runningLines(channelId),
|
|
171
145
|
onScopeChanged: async () => {
|
|
172
146
|
await runner.dispose();
|
|
173
147
|
runnerSlot.replace(buildRunner());
|
|
174
148
|
},
|
|
175
|
-
}),
|
|
176
|
-
statusInfo: { version: readCliVersion(), startedAt: Date.now() },
|
|
149
|
+
}, name, args),
|
|
177
150
|
});
|
|
178
151
|
try {
|
|
179
152
|
if (options.print) {
|
package/dist/tui/commands.d.ts
CHANGED
|
@@ -1,3 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TUI command dispatch.
|
|
3
|
+
*
|
|
4
|
+
* Transport-layer commands (`/help /stop /steer /followup /status /usage
|
|
5
|
+
* /events`, plus the TUI-only `/exit`) are handled locally and never reach the
|
|
6
|
+
* runner. Everything else — session commands (`/model /new /compact /session`)
|
|
7
|
+
* and plain messages — becomes a `run` intent; the SDK command extension handles
|
|
8
|
+
* session commands inside the turn (results are delivered back through the
|
|
9
|
+
* channel context), so the TUI gets them for free.
|
|
10
|
+
*
|
|
11
|
+
* `dispatch` is pure over its injected deps: it returns an intent the app acts
|
|
12
|
+
* on, and renders info-command text via the deps. Steer/followup semantics
|
|
13
|
+
* depend on whether a turn is running, which only the app knows — so those come
|
|
14
|
+
* back as intents rather than being applied here.
|
|
15
|
+
*/
|
|
16
|
+
import { type RuntimeCommandName } from "../commands/catalog.js";
|
|
1
17
|
export type DispatchOutcome =
|
|
2
18
|
/** Text to show the user immediately (help/status/usage/events output, or a hint). */
|
|
3
19
|
{
|
|
@@ -34,14 +50,8 @@ export type DispatchOutcome =
|
|
|
34
50
|
};
|
|
35
51
|
export interface DispatchDeps {
|
|
36
52
|
renderHelp(args?: string): string;
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
renderUsage(args: string): Promise<string>;
|
|
40
|
-
runEvents(args: string): Promise<string>;
|
|
41
|
-
runTasks(args: string): Promise<string>;
|
|
42
|
-
runSubagents(args: string): Promise<string>;
|
|
43
|
-
runProject(args: string): Promise<string>;
|
|
44
|
-
runSkills(args: string): Promise<string>;
|
|
53
|
+
/** The stateless report commands (`/status /context /usage /events /tasks /subagents /project /skills`). */
|
|
54
|
+
runReport(name: RuntimeCommandName, args: string): Promise<string>;
|
|
45
55
|
}
|
|
46
56
|
export declare function dispatch(input: string, deps: DispatchDeps): Promise<DispatchOutcome>;
|
|
47
57
|
/**
|
package/dist/tui/commands.js
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* depend on whether a turn is running, which only the app knows — so those come
|
|
14
14
|
* back as intents rather than being applied here.
|
|
15
15
|
*/
|
|
16
|
-
import { BUILT_IN_COMMANDS, parseBuiltInCommand, SESSION_COMMANDS } from "../commands/catalog.js";
|
|
16
|
+
import { BUILT_IN_COMMANDS, parseBuiltInCommand, SESSION_COMMANDS, } from "../commands/catalog.js";
|
|
17
17
|
export async function dispatch(input, deps) {
|
|
18
18
|
const trimmed = input.trim();
|
|
19
19
|
if (!trimmed)
|
|
@@ -30,21 +30,14 @@ export async function dispatch(input, deps) {
|
|
|
30
30
|
case "help":
|
|
31
31
|
return { kind: "reply", text: deps.renderHelp(command.args) };
|
|
32
32
|
case "status":
|
|
33
|
-
return { kind: "reply", text: deps.renderStatus() };
|
|
34
33
|
case "context":
|
|
35
|
-
return { kind: "reply", text: deps.renderContext(command.args) };
|
|
36
34
|
case "usage":
|
|
37
|
-
return { kind: "reply", text: await deps.renderUsage(command.args) };
|
|
38
35
|
case "events":
|
|
39
|
-
return { kind: "reply", text: await deps.runEvents(command.args) };
|
|
40
36
|
case "tasks":
|
|
41
|
-
return { kind: "reply", text: await deps.runTasks(command.args) };
|
|
42
37
|
case "subagents":
|
|
43
|
-
return { kind: "reply", text: await deps.runSubagents(command.args) };
|
|
44
38
|
case "project":
|
|
45
|
-
return { kind: "reply", text: await deps.runProject(command.args) };
|
|
46
39
|
case "skills":
|
|
47
|
-
return { kind: "reply", text: await deps.
|
|
40
|
+
return { kind: "reply", text: await deps.runReport(command.name, command.args) };
|
|
48
41
|
case "stop":
|
|
49
42
|
return { kind: "stop" };
|
|
50
43
|
case "steer":
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
*/
|
|
9
9
|
import type { AgentRunner } from "../agent/types.js";
|
|
10
10
|
import type { ChannelStore } from "../channel/store.js";
|
|
11
|
+
import { type DispatchDeps } from "./commands.js";
|
|
11
12
|
import type { Frontend } from "./renderer.js";
|
|
12
13
|
import { type DeliveryTraits } from "./terminal-context.js";
|
|
13
14
|
export interface TurnControllerDeps {
|
|
@@ -19,23 +20,10 @@ export interface TurnControllerDeps {
|
|
|
19
20
|
userName: string;
|
|
20
21
|
/** Info commands that do not depend on run state. */
|
|
21
22
|
renderHelp: (args?: string) => string;
|
|
22
|
-
|
|
23
|
-
runEvents: (args: string) => Promise<string>;
|
|
24
|
-
runTasks: (args: string) => Promise<string>;
|
|
25
|
-
runSubagents: (args: string) => Promise<string>;
|
|
26
|
-
runProject: (args: string) => Promise<string>;
|
|
27
|
-
runSkills: (args: string) => Promise<string>;
|
|
28
|
-
/** Static bits the status renderer needs alongside the live run state. */
|
|
29
|
-
statusInfo: {
|
|
30
|
-
version: string;
|
|
31
|
-
startedAt: number;
|
|
32
|
-
};
|
|
33
|
-
/** Injectable clock for deterministic Ctrl-C timing in tests. */
|
|
34
|
-
now?: () => number;
|
|
23
|
+
runReport: DispatchDeps["runReport"];
|
|
35
24
|
}
|
|
36
25
|
export declare class TurnController {
|
|
37
26
|
private readonly deps;
|
|
38
|
-
private readonly now;
|
|
39
27
|
private readonly dispatchDeps;
|
|
40
28
|
private currentTurn;
|
|
41
29
|
private readonly followups;
|
|
@@ -6,7 +6,6 @@
|
|
|
6
6
|
* Collaborators (runner, frontend, store) are injected so the machine can be
|
|
7
7
|
* unit-tested with fakes and a fake clock. `app.ts` builds the real ones.
|
|
8
8
|
*/
|
|
9
|
-
import { renderStatus } from "../agent/status-render.js";
|
|
10
9
|
import { formatBusyCommandList, formatUnknownCommandMessage, isSessionCommandName, slashCommandName, } from "../commands/catalog.js";
|
|
11
10
|
import * as log from "../log.js";
|
|
12
11
|
import { formatLocalTime } from "../shared/local-time.js";
|
|
@@ -29,22 +28,7 @@ export class TurnController {
|
|
|
29
28
|
this.exitResolve = resolve;
|
|
30
29
|
});
|
|
31
30
|
this.deps = deps;
|
|
32
|
-
this.
|
|
33
|
-
this.dispatchDeps = {
|
|
34
|
-
renderHelp: deps.renderHelp,
|
|
35
|
-
renderUsage: deps.renderUsage,
|
|
36
|
-
runEvents: deps.runEvents,
|
|
37
|
-
runTasks: deps.runTasks,
|
|
38
|
-
runSubagents: deps.runSubagents,
|
|
39
|
-
runProject: deps.runProject,
|
|
40
|
-
runSkills: deps.runSkills,
|
|
41
|
-
renderContext: (args) => this.deps.runner.renderContextReport(args),
|
|
42
|
-
renderStatus: () => renderStatus({
|
|
43
|
-
runner: this.deps.runner,
|
|
44
|
-
version: deps.statusInfo.version,
|
|
45
|
-
uptimeMs: this.now() - deps.statusInfo.startedAt,
|
|
46
|
-
}),
|
|
47
|
-
};
|
|
31
|
+
this.dispatchDeps = { renderHelp: deps.renderHelp, runReport: deps.runReport };
|
|
48
32
|
}
|
|
49
33
|
/** Interactive mode: wire input, run an optional first prompt, resolve on exit. */
|
|
50
34
|
startInteractive(initialPrompt) {
|
package/dist/web/client.js
CHANGED
|
@@ -113,6 +113,13 @@ export class WebHttpClient {
|
|
|
113
113
|
let currentUrl = buildUrlWithParams(options.url, options.params);
|
|
114
114
|
let method = options.method ?? "GET";
|
|
115
115
|
let data = options.data;
|
|
116
|
+
// `options.headers` is whatever the caller intended for the *original* origin — a
|
|
117
|
+
// provider's Authorization/X-Subscription-Token key, in the common case (R5). This manual
|
|
118
|
+
// redirect loop (maxRedirects: 0 below, precisely so the decision is ours to make) must not
|
|
119
|
+
// carry those headers across an origin change: unlike a browser's automatic redirect
|
|
120
|
+
// handling, axios does nothing here to strip them, so a redirect to a different origin
|
|
121
|
+
// would otherwise receive the same credentials the first hop got.
|
|
122
|
+
const credentialedOrigin = new URL(currentUrl).origin;
|
|
116
123
|
for (let redirectCount = 0; redirectCount <= maxRedirects; redirectCount++) {
|
|
117
124
|
let validatedAddress;
|
|
118
125
|
try {
|
|
@@ -144,6 +151,7 @@ export class WebHttpClient {
|
|
|
144
151
|
httpAgent = pinned;
|
|
145
152
|
}
|
|
146
153
|
}
|
|
154
|
+
const sameOrigin = new URL(currentUrl).origin === credentialedOrigin;
|
|
147
155
|
let response;
|
|
148
156
|
try {
|
|
149
157
|
response = await axios.request({
|
|
@@ -153,7 +161,7 @@ export class WebHttpClient {
|
|
|
153
161
|
headers: {
|
|
154
162
|
"User-Agent": WEB_USER_AGENT,
|
|
155
163
|
Accept: "*/*",
|
|
156
|
-
...options.headers,
|
|
164
|
+
...(sameOrigin ? options.headers : undefined),
|
|
157
165
|
},
|
|
158
166
|
responseType: "arraybuffer",
|
|
159
167
|
validateStatus: () => true,
|
|
@@ -37,9 +37,12 @@ cp "$PIPICLAW_PACKAGE_DIR"/examples/sub-agents/agents/*.md ~/.pipiclaw/workspace
|
|
|
37
37
|
| `codex-flash` | codex-cli | `gpt-5.6-luna` | medium | 是 | 最快最便宜,可读图片:明确、简单、重复的工作 |
|
|
38
38
|
| `glm-high` | claude-code | `glm-5.3` | high | 否 | 高智能档,额度宽松:高频使用不挤占 claude/codex 配额 |
|
|
39
39
|
| `glm-flash` | claude-code | `glm-5.3-flash` | medium | 是 | 最便宜,可读图片:大批量简单重复工作的首选 |
|
|
40
|
+
| `codex-review` | codex-cli | `gpt-6-astra` | high | 是 | 只读检查档:独立审查与 `purpose=verify`,在 CLI 的 read-only sandbox 中运行 |
|
|
40
41
|
|
|
41
42
|
三档的分工是这套配置的主要内容:**flash** 用于「做什么和怎么做都已清楚,只差有人去做」,可以大量派发;**main** 是主力,绝大多数实现、排查、文档都在这里,也包括 token 消耗很大的长任务;**high** 只留给这一轮真正需要新判断或取舍的工作。对已经定好的活派 high,只是更贵,不会更对。
|
|
42
43
|
|
|
44
|
+
`codex-review` 不属于这三档,它只做检查:read-only sandbox 是 codex 自己强制的边界,所以它改不了被检查的产物,也不占写锁,可以和其他工作并行。检查者尽量和实现者不是同一家模型——它检查 claude/glm 的产物最有价值;检查 codex 自己的产物时,可以另配一个 `claude --permission-mode plan` 的只读条目。它跑不了会写文件的测试或构建,这类检查要么先由实现者或主代理跑好、把输出交给它,要么换可写条目。
|
|
45
|
+
|
|
43
46
|
额度是真实约束:claude 和 codex 的订阅有周/月上限,GLM 只有 5 小时滚动限额、没有周月上限。所以简单重复的批量工作优先走 `glm-flash`,把受限额度留给难题。
|
|
44
47
|
|
|
45
48
|
### GLM 条目需要一个包装脚本
|
|
@@ -61,13 +64,13 @@ exec claude --dangerously-skip-permissions "$@"
|
|
|
61
64
|
|
|
62
65
|
留着它是因为这几条跨每一个任务都成立,漏掉的代价又很高(尤其是伪造绿色检查结果和把未验证写成已验证),而让主代理每次委派重打一遍既费 token 又会漂移。
|
|
63
66
|
|
|
64
|
-
要改就
|
|
67
|
+
要改就 8 个文件一起改。也可以整段删掉:runtime 允许外部条目的正文为空,此时不会生成 `system-prompt.txt`,claude-code 不追加 `--append-system-prompt-file`,codex 的 stdin 就是 task 本身。
|
|
65
68
|
|
|
66
69
|
## 这套配置的代价,别忽略
|
|
67
70
|
|
|
68
|
-
-
|
|
69
|
-
-
|
|
70
|
-
- **`
|
|
71
|
+
- **除 `codex-review` 外全部是放开权限的写条目。** 这 7 个条目都用 yolo 参数(`claude --dangerously-skip-permissions` / `codex exec --dangerously-bypass-approvals-and-sandbox`)并声明 `mutates: write`,没有 sandbox 兜底。实际边界只剩宿主账号和 `task` 里写明的范围,**必须在可信 checkout 和最小权限账号下使用**。
|
|
72
|
+
- **同一工作目录同时只容得下一个写委派。** `mutates: write` 会取目标工作区的排他 lease(含父子目录冲突),并行写必须各自 `git worktree`;`codex-review` 不取 lease。
|
|
73
|
+
- **`VERDICT` 是供参考的结论,不是门禁。** runtime 只把检查者的 PASS/FAIL 记到 run 和任务看板上。只有 `codex-review` 在结构上改不了产物;用可写条目做检查时,它可能动过产物。无论哪种,都要自己对照真实产物、diff 和检查输出再采信。
|
|
71
74
|
- **独立性不再由角色提示词提供。** 要评审或验收时,必须在 `task` 里写明"你是检查者,不修实现,不把实现者的总结当作预期行为的来源",并给出同一份验收口径和待检版本。换一个条目不会自动带来独立性。
|
|
72
75
|
|
|
73
76
|
## `roles/` 里的岗位角色
|
|
@@ -5,8 +5,8 @@ description: >-
|
|
|
5
5
|
runtime: external
|
|
6
6
|
harness: codex-cli
|
|
7
7
|
command: codex exec --dangerously-bypass-approvals-and-sandbox --skip-git-repo-check
|
|
8
|
-
model: gpt-
|
|
9
|
-
thinkingLevel:
|
|
8
|
+
model: gpt-6-luna
|
|
9
|
+
thinkingLevel: high
|
|
10
10
|
workload: heavy
|
|
11
11
|
mutates: write
|
|
12
12
|
maxWallTimeSec: 3600
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: codex-review
|
|
3
|
+
description: >-
|
|
4
|
+
只读检查档,成本中等,可接受图片输入:codex 在 read-only sandbox 中运行,改不了工作区、不占写锁。适合独立审查和 purpose=verify,尤其检查 claude/glm 的产物;跑不了要写文件的测试或构建。
|
|
5
|
+
runtime: external
|
|
6
|
+
harness: codex-cli
|
|
7
|
+
command: codex exec --sandbox read-only --skip-git-repo-check
|
|
8
|
+
model: gpt-6.1-sol
|
|
9
|
+
thinkingLevel: high
|
|
10
|
+
workload: heavy
|
|
11
|
+
mutates: read
|
|
12
|
+
maxWallTimeSec: 3600
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
- task 没有授权的动作不做:提交、推送、部署、发消息、写入外部系统或真实数据。
|
|
16
|
+
- 保护任务之外的既有改动,不覆盖、不回退、不顺带纳入;范围外的问题只报告。
|
|
17
|
+
- 能自己查清的缺口继续查;会实质改变目标、授权或数据边界又查不到的,停在最小阻塞点交回,不靠猜测补齐。
|
|
18
|
+
- 结论强度不超过证据;未运行、未复现、未验证的明确标注。
|
|
19
|
+
- 不编造数据、命令输出、文件内容或检查结果。
|
|
20
|
+
- 命令失败时保留真实输出,不通过削弱断言、跳过用例或改口径制造通过。
|
|
21
|
+
- 先给结论,再给支撑它的证据位置(`path:line`、命令与关键结果)和会影响判断的不确定项。
|
|
22
|
+
- 用证据位置代替大段原文或 diff;篇幅与任务复杂度匹配,长回复末尾补一句当前状态和必要的下一步。
|
|
23
|
+
- 用中文;代码、路径、命令、标识符和错误保持原文。
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: verifier
|
|
3
3
|
description: >-
|
|
4
|
-
对最终产物逐项核验完成标准,运行必要检查并报告通过、失败或阻塞的证据。允许临时取证产物,禁止修改被验收产品;完整任务验收使用 purpose=verify
|
|
4
|
+
对最终产物逐项核验完成标准,运行必要检查并报告通过、失败或阻塞的证据。允许临时取证产物,禁止修改被验收产品;完整任务验收使用 purpose=verify。
|
|
5
5
|
runtime: external
|
|
6
6
|
harness: codex-cli
|
|
7
7
|
command: codex exec --sandbox workspace-write --skip-git-repo-check
|
package/package.json
CHANGED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
/** Upgrade before starting channel readers/writers. Kept through the 0.9.3 upgrade window.
|
|
2
|
-
* Canonical state wins over an obsolete nested copy; old files are removed only after a
|
|
3
|
-
* successful canonical write. Failed I/O aborts startup so no cursor is silently discarded.
|
|
4
|
-
*/
|
|
5
|
-
export declare function migrateMemoryMaintenanceStates(appHomeDir: string): Promise<void>;
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
import { readdir, readFile, rmdir, unlink } from "node:fs/promises";
|
|
2
|
-
import { basename, dirname, join } from "node:path";
|
|
3
|
-
import { isChannelId } from "../channel/channel-paths.js";
|
|
4
|
-
import { writeFileAtomically } from "../shared/atomic-file.js";
|
|
5
|
-
import { isRecord } from "../shared/type-guards.js";
|
|
6
|
-
import { getMemoryMaintenanceStateDir, getMemoryMaintenanceStatePath } from "./maintenance-state.js";
|
|
7
|
-
/** Upgrade before starting channel readers/writers. Kept through the 0.9.3 upgrade window.
|
|
8
|
-
* Canonical state wins over an obsolete nested copy; old files are removed only after a
|
|
9
|
-
* successful canonical write. Failed I/O aborts startup so no cursor is silently discarded.
|
|
10
|
-
*/
|
|
11
|
-
export async function migrateMemoryMaintenanceStates(appHomeDir) {
|
|
12
|
-
const root = getMemoryMaintenanceStateDir(appHomeDir);
|
|
13
|
-
async function files(dir) {
|
|
14
|
-
const entries = await readdir(dir, { withFileTypes: true });
|
|
15
|
-
const result = [];
|
|
16
|
-
for (const entry of entries) {
|
|
17
|
-
const path = join(dir, entry.name);
|
|
18
|
-
if (entry.isDirectory())
|
|
19
|
-
result.push(...(await files(path)));
|
|
20
|
-
else if (entry.isFile() && entry.name.endsWith(".json"))
|
|
21
|
-
result.push(path);
|
|
22
|
-
}
|
|
23
|
-
return result;
|
|
24
|
-
}
|
|
25
|
-
let paths;
|
|
26
|
-
try {
|
|
27
|
-
paths = await files(root);
|
|
28
|
-
}
|
|
29
|
-
catch (error) {
|
|
30
|
-
if (error.code === "ENOENT")
|
|
31
|
-
return;
|
|
32
|
-
throw error;
|
|
33
|
-
}
|
|
34
|
-
for (const source of paths) {
|
|
35
|
-
let raw;
|
|
36
|
-
try {
|
|
37
|
-
raw = JSON.parse(await readFile(source, "utf8"));
|
|
38
|
-
}
|
|
39
|
-
catch (error) {
|
|
40
|
-
if (error instanceof SyntaxError)
|
|
41
|
-
continue; // normal reader diagnoses corrupt state
|
|
42
|
-
throw error;
|
|
43
|
-
}
|
|
44
|
-
if (!isRecord(raw))
|
|
45
|
-
continue;
|
|
46
|
-
const channelId = typeof raw.channelId === "string" ? raw.channelId : basename(source, ".json");
|
|
47
|
-
if (!isChannelId(channelId))
|
|
48
|
-
continue;
|
|
49
|
-
const target = getMemoryMaintenanceStatePath(appHomeDir, channelId);
|
|
50
|
-
if (source !== target && source !== join(root, `${channelId}.json`))
|
|
51
|
-
continue;
|
|
52
|
-
let canonicalExists = false;
|
|
53
|
-
if (source !== target) {
|
|
54
|
-
try {
|
|
55
|
-
const existing = JSON.parse(await readFile(target, "utf8"));
|
|
56
|
-
if (!isRecord(existing) || (existing.channelId !== undefined && existing.channelId !== channelId)) {
|
|
57
|
-
throw new Error(`Invalid memory maintenance state at ${target}; repair it before restarting. Legacy state retained at ${source}.`);
|
|
58
|
-
}
|
|
59
|
-
canonicalExists = true;
|
|
60
|
-
}
|
|
61
|
-
catch (error) {
|
|
62
|
-
if (error.code !== "ENOENT")
|
|
63
|
-
throw error;
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
const hasOldFields = "lastCheckpointAt" in raw || "lastCheckpointEntryId" in raw;
|
|
67
|
-
if (!canonicalExists && (source !== target || hasOldFields)) {
|
|
68
|
-
for (const [current, old] of [
|
|
69
|
-
["lastReflectAt", "lastCheckpointAt"],
|
|
70
|
-
["lastReflectedEntryId", "lastCheckpointEntryId"],
|
|
71
|
-
]) {
|
|
72
|
-
if (typeof raw[current] !== "string" || !raw[current].trim())
|
|
73
|
-
raw[current] = raw[old];
|
|
74
|
-
delete raw[old];
|
|
75
|
-
}
|
|
76
|
-
await writeFileAtomically(target, `${JSON.stringify({ ...raw, channelId }, null, 2)}\n`);
|
|
77
|
-
}
|
|
78
|
-
if (source !== target) {
|
|
79
|
-
await unlink(source);
|
|
80
|
-
// Empty legacy directories only; never remove unrelated state.
|
|
81
|
-
for (let dir = dirname(source); dir !== root; dir = dirname(dir)) {
|
|
82
|
-
try {
|
|
83
|
-
await rmdir(dir);
|
|
84
|
-
}
|
|
85
|
-
catch {
|
|
86
|
-
break;
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
}
|
package/dist/memory/migrate.d.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
export interface MigrationResult {
|
|
2
|
-
migrated: boolean;
|
|
3
|
-
reason?: string;
|
|
4
|
-
entries: number;
|
|
5
|
-
journalDays: number;
|
|
6
|
-
ongoingWorkItems: number;
|
|
7
|
-
tombstones: number;
|
|
8
|
-
}
|
|
9
|
-
export declare function getMigrationMarkerPath(channelDir: string): string;
|
|
10
|
-
export declare function isChannelMigratedToV2(channelDir: string): boolean;
|
|
11
|
-
export declare function migrateChannelMemoryToV2(channelDir: string, options?: {
|
|
12
|
-
today?: string;
|
|
13
|
-
}): Promise<MigrationResult>;
|
|
14
|
-
/** Reverse a migration: restore `.memory-v1/` originals, drop the v2 artifacts. */
|
|
15
|
-
export declare function rollbackChannelMemoryV2(channelDir: string): Promise<void>;
|