@oyasmi/pipiclaw 0.9.2-beta.3 → 0.9.2-beta.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -0
- package/dist/agent/channel-runner.d.ts +13 -18
- package/dist/agent/channel-runner.js +44 -90
- package/dist/agent/command-extension.js +1 -1
- package/dist/agent/context-budget.d.ts +8 -0
- package/dist/agent/context-budget.js +10 -2
- package/dist/agent/job-manager.d.ts +1 -1
- package/dist/agent/job-manager.js +6 -1
- package/dist/agent/prompt/builder.d.ts +0 -1
- package/dist/agent/prompt/builder.js +1 -14
- package/dist/agent/prompt/manifest.js +2 -1
- package/dist/agent/prompt/sections.js +1 -1
- package/dist/agent/runner-factory.d.ts +19 -1
- package/dist/agent/runner-factory.js +8 -1
- package/dist/agent/session-events.d.ts +2 -2
- package/dist/agent/turn-prompt.d.ts +35 -0
- package/dist/agent/turn-prompt.js +37 -0
- package/dist/agent/turn-recovery.js +1 -1
- package/dist/agent/turn-state.d.ts +60 -0
- package/dist/agent/turn-state.js +95 -0
- package/dist/agent/types.d.ts +3 -3
- package/dist/{runtime → channel}/channel-context.d.ts +6 -2
- package/dist/{runtime → channel}/channel-context.js +6 -2
- package/dist/channel/channel-paths.d.ts +16 -0
- package/dist/{runtime → channel}/channel-paths.js +20 -0
- package/dist/{agent/commands.d.ts → commands/catalog.d.ts} +16 -1
- package/dist/{agent/commands.js → commands/catalog.js} +30 -0
- package/dist/index.d.ts +1 -1
- package/dist/log.js +14 -5
- package/dist/main.js +29 -0
- package/dist/memory/commands.js +2 -2
- package/dist/memory/maintenance-state.d.ts +8 -0
- package/dist/memory/maintenance-state.js +47 -4
- package/dist/memory/scheduler.d.ts +6 -0
- package/dist/memory/scheduler.js +19 -16
- package/dist/playbooks/agent-delegation.md +2 -2
- package/dist/runtime/bootstrap.d.ts +2 -2
- package/dist/runtime/bootstrap.js +14 -6
- package/dist/runtime/delivery.d.ts +3 -3
- package/dist/runtime/dingtalk.d.ts +4 -4
- package/dist/runtime/dingtalk.js +2 -2
- package/dist/runtime/durable-dispatch.d.ts +7 -1
- package/dist/runtime/durable-dispatch.js +12 -2
- package/dist/runtime/event-commands.js +2 -2
- package/dist/runtime/events.d.ts +8 -1
- package/dist/runtime/events.js +15 -3
- package/dist/runtime/project-commands.js +2 -2
- package/dist/runtime/skill-commands.d.ts +27 -0
- package/dist/runtime/skill-commands.js +72 -0
- package/dist/runtime/subagent-commands.js +1 -1
- package/dist/runtime/task-commands.js +2 -2
- package/dist/runtime/task-driver.d.ts +5 -1
- package/dist/runtime/task-driver.js +13 -12
- package/dist/runtime/task-migration.js +3 -2
- package/dist/runtime/task-wake.d.ts +1 -1
- package/dist/runtime/task-wake.js +1 -1
- package/dist/settings.d.ts +1 -0
- package/dist/settings.js +69 -0
- package/dist/shared/token-estimate.d.ts +1 -0
- package/dist/shared/token-estimate.js +19 -0
- package/dist/subagents/runs.d.ts +9 -4
- package/dist/subagents/runs.js +107 -11
- package/dist/subagents/tool.js +4 -3
- package/dist/tools/glob-match.d.ts +25 -4
- package/dist/tools/glob-match.js +175 -53
- package/dist/tools/glob.js +5 -2
- package/dist/tools/index.d.ts +1 -1
- package/dist/tools/registry.d.ts +1 -1
- package/dist/tools/send-media.d.ts +1 -1
- package/dist/tools/skill.d.ts +15 -0
- package/dist/tools/skill.js +16 -8
- package/dist/tui/app.js +5 -3
- package/dist/tui/commands.d.ts +1 -0
- package/dist/tui/commands.js +3 -1
- package/dist/tui/terminal-context.d.ts +2 -2
- package/dist/tui/terminal-media-sender.d.ts +1 -1
- package/dist/tui/turn-controller.d.ts +2 -1
- package/dist/tui/turn-controller.js +2 -1
- package/examples/sub-agents/README.md +2 -2
- package/examples/sub-agents/explorer.md +4 -4
- package/examples/sub-agents/git-committer.md +3 -2
- package/examples/sub-agents/log-sifter.md +2 -2
- package/examples/sub-agents/verifier.md +1 -1
- package/examples/sub-agents/worker.md +3 -3
- package/package.json +1 -1
- package/dist/runtime/channel-paths.d.ts +0 -4
- /package/dist/{runtime → channel}/active-session-store.d.ts +0 -0
- /package/dist/{runtime → channel}/active-session-store.js +0 -0
- /package/dist/{runtime → channel}/channel-event.d.ts +0 -0
- /package/dist/{runtime → channel}/channel-event.js +0 -0
- /package/dist/{runtime → channel}/channel-index.d.ts +0 -0
- /package/dist/{runtime → channel}/channel-index.js +0 -0
- /package/dist/{runtime → channel}/project-scope-store.d.ts +0 -0
- /package/dist/{runtime → channel}/project-scope-store.js +0 -0
- /package/dist/{runtime → channel}/store.d.ts +0 -0
- /package/dist/{runtime → channel}/store.js +0 -0
- /package/dist/{agent → commands}/reply-limits.d.ts +0 -0
- /package/dist/{agent → commands}/reply-limits.js +0 -0
package/dist/tools/skill.js
CHANGED
|
@@ -85,7 +85,14 @@ export async function listWorkspaceSkills(options) {
|
|
|
85
85
|
}
|
|
86
86
|
return summaries;
|
|
87
87
|
}
|
|
88
|
-
|
|
88
|
+
/**
|
|
89
|
+
* Load one skill's `SKILL.md` bytes through the same path-guard every other file read goes
|
|
90
|
+
* through. Shared by the `skill` tool's `read` action and the `/skills show` runtime command
|
|
91
|
+
* (`src/runtime/skill-commands.ts`) — a `SKILL.md` that is itself a symlink pointing outside
|
|
92
|
+
* `workspace/skills/` (planted via `bash ln -s`, not via `name` -- `resolveSkillPath` already
|
|
93
|
+
* confines that) is caught here in both callers instead of being read verbatim.
|
|
94
|
+
*/
|
|
95
|
+
export async function loadWorkspaceSkillFile(options, name) {
|
|
89
96
|
const nameValidation = validateSkillName(name);
|
|
90
97
|
if (!nameValidation.ok) {
|
|
91
98
|
throw new RecoverableToolError(nameValidation.error ?? `Invalid skill name "${name}".`);
|
|
@@ -95,9 +102,6 @@ async function readWorkspaceSkill(options, name) {
|
|
|
95
102
|
if (!existsSync(rawPath)) {
|
|
96
103
|
throw new RecoverableToolError(`Workspace skill "${name}" does not exist. Use action "list" to see what's available.`);
|
|
97
104
|
}
|
|
98
|
-
// Runs the same path-guard every other read goes through: a `SKILL.md` that is itself a
|
|
99
|
-
// symlink pointing outside `workspace/skills/` (planted via `bash ln -s`, not via `name` --
|
|
100
|
-
// `resolveSkillPath` already confines that) is caught here instead of being read verbatim.
|
|
101
105
|
const securityConfig = options.securityConfig ?? DEFAULT_SECURITY_CONFIG;
|
|
102
106
|
const securityContext = options.securityContext ?? {
|
|
103
107
|
agentWorkspaceDir: options.workspaceDir,
|
|
@@ -113,16 +117,20 @@ async function readWorkspaceSkill(options, name) {
|
|
|
113
117
|
if (truncation.truncated) {
|
|
114
118
|
body += `\n\n[Truncated at ${formatSize(DEFAULT_MAX_BYTES)}. Use the read tool on ${target} to page through the rest.]`;
|
|
115
119
|
}
|
|
120
|
+
return { name, path: target, content: body, truncated: truncation.truncated };
|
|
121
|
+
}
|
|
122
|
+
async function readWorkspaceSkill(options, name) {
|
|
123
|
+
const file = await loadWorkspaceSkillFile(options, name);
|
|
116
124
|
// Mirrors the framing pi's own skill loader gives a model-invoked skill: the location and the
|
|
117
125
|
// relative-path rule are what let the model correctly `read` a skill's references/templates
|
|
118
126
|
// afterward, and are the whole reason `skill read` is worth more than a plain `read` call.
|
|
119
|
-
const envelope = `<skill name="${name}" location="${
|
|
120
|
-
`References are relative to ${dirname(
|
|
121
|
-
`${
|
|
127
|
+
const envelope = `<skill name="${file.name}" location="${file.path}">\n` +
|
|
128
|
+
`References are relative to ${dirname(file.path)}.\n\n` +
|
|
129
|
+
`${file.content}\n` +
|
|
122
130
|
`</skill>`;
|
|
123
131
|
return {
|
|
124
132
|
content: [{ type: "text", text: envelope }],
|
|
125
|
-
details: { action: "read", name, path:
|
|
133
|
+
details: { action: "read", name: file.name, path: file.path, truncated: file.truncated },
|
|
126
134
|
};
|
|
127
135
|
}
|
|
128
136
|
export function createSkillTool(options) {
|
package/dist/tui/app.js
CHANGED
|
@@ -7,18 +7,19 @@
|
|
|
7
7
|
* preparation shares `prepareAppServices` with the DingTalk path.
|
|
8
8
|
*/
|
|
9
9
|
import { userInfo } from "node:os";
|
|
10
|
-
import { renderBuiltInHelp } from "../agent/commands.js";
|
|
11
10
|
import { createRunner } from "../agent/index.js";
|
|
12
11
|
import { channelRunningJobLines } from "../agent/job-manager.js";
|
|
12
|
+
import { ensureChannelDir } from "../channel/channel-paths.js";
|
|
13
|
+
import { ChannelStore } from "../channel/store.js";
|
|
14
|
+
import { renderBuiltInHelp } from "../commands/catalog.js";
|
|
13
15
|
import * as log from "../log.js";
|
|
14
16
|
import { ensureChannelMemoryFilesSync } from "../memory/files.js";
|
|
15
17
|
import { BootstrapExitError, bootstrapAppHome, DEFAULT_BOOTSTRAP_PATHS, printBootstrapSummary, readCliVersion, } from "../runtime/app-home.js";
|
|
16
18
|
import { prepareAppServices } from "../runtime/bootstrap.js";
|
|
17
|
-
import { ensureChannelDir } from "../runtime/channel-paths.js";
|
|
18
19
|
import { finalDeliveryOf, progressStyleOf } from "../runtime/dingtalk.js";
|
|
19
20
|
import { handleEventsCommand } from "../runtime/event-commands.js";
|
|
20
21
|
import { handleProjectCommand } from "../runtime/project-commands.js";
|
|
21
|
-
import {
|
|
22
|
+
import { handleSkillsCommand } from "../runtime/skill-commands.js";
|
|
22
23
|
import { handleSubagentsCommand } from "../runtime/subagent-commands.js";
|
|
23
24
|
import { handleTasksCommand } from "../runtime/task-commands.js";
|
|
24
25
|
import { flushSecurityLogs } from "../security/logger.js";
|
|
@@ -141,6 +142,7 @@ export async function runTuiApp(options) {
|
|
|
141
142
|
channelId,
|
|
142
143
|
}),
|
|
143
144
|
runSubagents: (args) => handleSubagentsCommand({ args, channelId, discovery: runner.getSubAgentDiscoverySnapshot() }),
|
|
145
|
+
runSkills: (args) => handleSkillsCommand({ args, workspaceDir: paths.workspaceDir, appHomeDir: paths.appHomeDir, channelId }),
|
|
144
146
|
runProject: (args) => handleProjectCommand({
|
|
145
147
|
args,
|
|
146
148
|
channelId,
|
package/dist/tui/commands.d.ts
CHANGED
|
@@ -41,6 +41,7 @@ export interface DispatchDeps {
|
|
|
41
41
|
runTasks(args: string): Promise<string>;
|
|
42
42
|
runSubagents(args: string): Promise<string>;
|
|
43
43
|
runProject(args: string): Promise<string>;
|
|
44
|
+
runSkills(args: string): Promise<string>;
|
|
44
45
|
}
|
|
45
46
|
export declare function dispatch(input: string, deps: DispatchDeps): Promise<DispatchOutcome>;
|
|
46
47
|
/**
|
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 "../
|
|
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)
|
|
@@ -43,6 +43,8 @@ export async function dispatch(input, deps) {
|
|
|
43
43
|
return { kind: "reply", text: await deps.runSubagents(command.args) };
|
|
44
44
|
case "project":
|
|
45
45
|
return { kind: "reply", text: await deps.runProject(command.args) };
|
|
46
|
+
case "skills":
|
|
47
|
+
return { kind: "reply", text: await deps.runSkills(command.args) };
|
|
46
48
|
case "stop":
|
|
47
49
|
return { kind: "stop" };
|
|
48
50
|
case "steer":
|
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
* - `respond` / `respondPlain` archive when `shouldLog` is set;
|
|
10
10
|
* - `replaceMessage` / `deleteMessage` do not archive (they only re-render).
|
|
11
11
|
*/
|
|
12
|
-
import type { ChannelContext, FinalDelivery, ProgressStyle } from "../
|
|
13
|
-
import type { ChannelStore } from "../
|
|
12
|
+
import type { ChannelContext, FinalDelivery, ProgressStyle } from "../channel/channel-context.js";
|
|
13
|
+
import type { ChannelStore } from "../channel/store.js";
|
|
14
14
|
import type { TranscriptRenderer } from "./renderer.js";
|
|
15
15
|
/** The minimal per-turn input the terminal context needs (no DingTalk types). */
|
|
16
16
|
export interface TurnInput {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import type { MediaSender } from "../channel/channel-context.js";
|
|
1
2
|
import type { BootstrapIO } from "../runtime/app-home.js";
|
|
2
|
-
import type { MediaSender } from "../runtime/channel-context.js";
|
|
3
3
|
/**
|
|
4
4
|
* Terminal implementation of the `MediaSender` port. There is no chat surface to
|
|
5
5
|
* push a file to, and the bytes already came from a local file, so "sending" here
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* unit-tested with fakes and a fake clock. `app.ts` builds the real ones.
|
|
8
8
|
*/
|
|
9
9
|
import type { AgentRunner } from "../agent/types.js";
|
|
10
|
-
import type { ChannelStore } from "../
|
|
10
|
+
import type { ChannelStore } from "../channel/store.js";
|
|
11
11
|
import type { Frontend } from "./renderer.js";
|
|
12
12
|
import { type DeliveryTraits } from "./terminal-context.js";
|
|
13
13
|
export interface TurnControllerDeps {
|
|
@@ -24,6 +24,7 @@ export interface TurnControllerDeps {
|
|
|
24
24
|
runTasks: (args: string) => Promise<string>;
|
|
25
25
|
runSubagents: (args: string) => Promise<string>;
|
|
26
26
|
runProject: (args: string) => Promise<string>;
|
|
27
|
+
runSkills: (args: string) => Promise<string>;
|
|
27
28
|
/** Static bits the status renderer needs alongside the live run state. */
|
|
28
29
|
statusInfo: {
|
|
29
30
|
version: string;
|
|
@@ -6,8 +6,8 @@
|
|
|
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 { formatBusyCommandList, formatUnknownCommandMessage, isSessionCommandName, slashCommandName, } from "../agent/commands.js";
|
|
10
9
|
import { renderStatus } from "../agent/status-render.js";
|
|
10
|
+
import { formatBusyCommandList, formatUnknownCommandMessage, isSessionCommandName, slashCommandName, } from "../commands/catalog.js";
|
|
11
11
|
import * as log from "../log.js";
|
|
12
12
|
import { formatLocalTime } from "../shared/local-time.js";
|
|
13
13
|
import { errorMessage } from "../shared/text-utils.js";
|
|
@@ -37,6 +37,7 @@ export class TurnController {
|
|
|
37
37
|
runTasks: deps.runTasks,
|
|
38
38
|
runSubagents: deps.runSubagents,
|
|
39
39
|
runProject: deps.runProject,
|
|
40
|
+
runSkills: deps.runSkills,
|
|
40
41
|
renderContext: (args) => this.deps.runner.renderContextReport(args),
|
|
41
42
|
renderStatus: () => renderStatus({
|
|
42
43
|
runner: this.deps.runner,
|
|
@@ -51,9 +51,9 @@ reviewer 发现的问题回流给产出角色;verifier 失败回流给 builder
|
|
|
51
51
|
| `builder` | claude-code | `sonnet` | `write` | medium | 边界清晰、验收已定义的实现 + 单元测试 |
|
|
52
52
|
| `builder-hard` | claude-code | `opus` | `write` | xhigh | builder 已失败、根因难定位或多契约耦合的实现 |
|
|
53
53
|
| `reviewer` | codex-cli | `gpt-5.6-sol` | `read` | high | 与产出者分离的方案 / 代码 / 文档挑错,也可承担只读 `purpose=verify` |
|
|
54
|
-
| `verifier` | codex-cli | `gpt-5.6-luna` | `write` |
|
|
54
|
+
| `verifier` | codex-cli | `gpt-5.6-luna` | `write` | xhigh | 实际运行系统、复现、冒烟、回归、取证 |
|
|
55
55
|
| `scout` | codex-cli | `gpt-5.6-luna` | `read` | medium | 大仓库里的单点事实查询 |
|
|
56
|
-
| `worker` | codex-cli | `gpt-5.6-
|
|
56
|
+
| `worker` | codex-cli | `gpt-5.6-sol` | `write` | medium | 闭环外的数据对比、指标计算、批量处理、专项报告 |
|
|
57
57
|
| `documenter` | codex-cli | `gpt-5.6-luna` | `write` | high | 文档、变更记录和迁移说明;提交统一用 `git-committer` |
|
|
58
58
|
|
|
59
59
|
`planner` 用 Claude 的 `--permission-mode plan`,`reviewer` / `scout` 用 Codex 的 `--sandbox read-only`;三者的 `mutates: read` 都有目标 CLI 的权限模式支撑,而不只是提示词声明。它们不占工作区写锁,但评审仍应针对稳定的 diff / commit,不要一边让 builder 改同一工作树、一边评审移动中的目标。
|
|
@@ -12,10 +12,10 @@ memory: none
|
|
|
12
12
|
thinkingLevel: low
|
|
13
13
|
workload: light
|
|
14
14
|
mutates: read
|
|
15
|
-
maxTurns:
|
|
16
|
-
maxToolCalls:
|
|
17
|
-
maxWallTimeSec:
|
|
18
|
-
bashTimeoutSec:
|
|
15
|
+
maxTurns: 24
|
|
16
|
+
maxToolCalls: 64
|
|
17
|
+
maxWallTimeSec: 300
|
|
18
|
+
bashTimeoutSec: 120
|
|
19
19
|
---
|
|
20
20
|
|
|
21
21
|
你是代码探索者。你只读调查当前仓库,回答实现在哪里、组件如何连接、某个行为由什么代码产生。
|
|
@@ -11,8 +11,8 @@ memory: none
|
|
|
11
11
|
thinkingLevel: medium
|
|
12
12
|
workload: light
|
|
13
13
|
mutates: write
|
|
14
|
-
maxTurns:
|
|
15
|
-
maxToolCalls:
|
|
14
|
+
maxTurns: 24
|
|
15
|
+
maxToolCalls: 64
|
|
16
16
|
maxWallTimeSec: 600
|
|
17
17
|
bashTimeoutSec: 480
|
|
18
18
|
---
|
|
@@ -35,6 +35,7 @@ bashTimeoutSec: 480
|
|
|
35
35
|
- 正常提交并让仓库 hooks 运行。hook 失败就报告,不用 `--no-verify`,也不改代码绕过失败。
|
|
36
36
|
- 提交后用 `git show --stat --oneline HEAD` 核对内容并取交付所需的 hash 与路径;hook 改过文件的话再看一眼 `git status`,但不自行修复或补充暂存。
|
|
37
37
|
- 不 amend、rebase、merge、reset、切分支、操作 tag 或改写历史,除非任务逐项明确授权。
|
|
38
|
+
- 不在提交消息中添加类似 'Co-Authored-By:' 这样的签名
|
|
38
39
|
|
|
39
40
|
## Push 需单独授权
|
|
40
41
|
|
|
@@ -5,11 +5,11 @@ description: >-
|
|
|
5
5
|
runtime: external
|
|
6
6
|
harness: codex-cli
|
|
7
7
|
command: codex exec --sandbox workspace-write --skip-git-repo-check
|
|
8
|
-
model: gpt-5.6-
|
|
9
|
-
thinkingLevel:
|
|
8
|
+
model: gpt-5.6-sol
|
|
9
|
+
thinkingLevel: medium
|
|
10
10
|
workload: heavy
|
|
11
11
|
mutates: write
|
|
12
|
-
maxWallTimeSec:
|
|
12
|
+
maxWallTimeSec: 3600
|
|
13
13
|
---
|
|
14
14
|
|
|
15
15
|
你是通用任务执行者。你承接专用角色未覆盖的多步分析、转换和产出,说明口径与假设,并标出该交接的部分。
|
package/package.json
CHANGED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
export declare function isChannelId(value: string): boolean;
|
|
2
|
-
export declare function getChannelDirName(channelId: string): string;
|
|
3
|
-
export declare function getChannelDir(baseDir: string, channelId: string): string;
|
|
4
|
-
export declare function ensureChannelDir(baseDir: string, channelId: string): string;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|