@gfgghgftgffg/pi-goal-x-lean 0.1.0 → 0.1.2

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/MAINTENANCE.md CHANGED
@@ -1,35 +1,37 @@
1
1
  # Maintenance boundary
2
2
 
3
- The original facade depends on exact `pi-goal-x@0.34.1`; it does not copy the engine. The published package has no npm publication `gitHead`, so maintenance reviews exact npm tarballs with SHA-512 integrity, not an inferred Git commit. There is no external lean-author repository. Pi development verification uses 1.4.0; supported hosts must satisfy upstream peers (`>=1.4.0 <2.0.0`).
3
+ Keep this file in English.
4
+
5
+ The original facade depends on exact `pi-goal-x@0.34.2`; it does not copy the engine. The published package has no npm publication `gitHead`, so maintenance reviews exact npm tarballs with SHA-512 integrity, not an inferred Git commit. There is no external lean-author repository. Pi development verification uses 1.4.0; supported hosts must satisfy upstream peers (`>=1.4.0 <2.0.0`).
4
6
 
5
7
  ## Retained behavior
6
8
 
7
- Keep all eight upstream tool names, schemas except description annotations, prompt guidelines, lifecycle hooks, commands, shortcuts, renderers and tool profiles. Do not suppress `setActiveTools`, collapse names or truncate goal context: stopped-turn gates, progress classification, drafting, live-tail retention and provider-cache placement depend on them. Unknown new tools pass through unchanged until reviewed.
9
+ Keep all seven upstream tool names, schemas except description annotations, prompt guidelines, lifecycle hooks, commands, shortcuts, renderers and the fixed task-setting-dependent tool profile. Draft-state gating belongs to execution, not changing tool visibility. Do not suppress `setActiveTools`, collapse names or truncate goal context: stopped-turn gates, progress classification, drafting, live-tail retention and provider-cache placement depend on them. Unknown new tools pass through unchanged until reviewed.
8
10
 
9
11
  ## Integration contracts
10
12
 
11
13
  The optional `@gfgghgftgffg/pi-subagents-lean.context.v1` global service supplies the actual dist runner's AsyncLocalStorage child flag. Never copy child-context state, resolve an undeclared neighboring dependency or temporarily mutate `process.env`. A child registers only upstream goal-context filtering. Test the actual Pi loader and dist child-context identity; environment-marker tests alone are insufficient.
12
14
 
13
- ## Subagents/workflow 联动的副作用与边界
15
+ ## Subagents and workflow integration boundaries
14
16
 
15
- ### 子会话的目标所有权
17
+ ### Child-session goal ownership
16
18
 
17
- 本包读取 `pi-subagents-lean` 的 v1 只读接口:父会话运行 goal,子会话只过滤继承的 goal 控制消息,不安装 goal 工具、命令或调度器。因此,子角色即使原本允许 goal,也不能用这个组合独立创建或续跑目标。角色模型、工具权限和 Task Router 规则不变,也不会自动启用 Router。
19
+ This package reads the read-only v1 interface from `pi-subagents-lean`: the parent session runs goal, while child sessions only filter inherited goal-control messages and do not install goal tools, commands or a scheduler. Even a child role that normally allows goal cannot create or continue an independent goal through this combination. Role models, tool permissions and Task Router rules remain unchanged; Router is not enabled automatically.
18
20
 
19
- 检测到 subagents manager 却没有兼容 v1 服务时,goal 门面会报兼容性错误;旧版门面、只安装原版 subagents 或其它引擎不在该自动隔离保证内。接口不是跨进程/worker 的通用检测协议,详细契约见 subagents 包的 `MAINTENANCE.md`。
21
+ If a subagents manager is present without a compatible v1 service, the goal facade reports a compatibility error. Older facades, upstream-only subagents installations and other engines are outside this automatic isolation contract. The interface is not a general cross-process or worker detection protocol; see the subagents package's `MAINTENANCE.md` for its contract.
20
22
 
21
- ### 后台等待门禁
23
+ ### Background waiting guard
22
24
 
23
- - 仅接管 goal 为 active 时,经 `subagent(run/workflow)` 或原生 `Agent`/`SubagentWorkflow` 工具启动的委派。等待按整个父会话保守生效:任何已追踪任务未交回结果,都会挡住 goal 自动续跑和 `update_goal(status=complete)`;即使下一步与它无依赖,或已切换/新建另一个 goal,也不会自动放行。这会降低后台期间的自动推进能力。
24
- - 真正投递到父会话的完成通知,或通过结果工具成功读取完整的终态 Agent 结果,才解除对应等待;“后台任务已经结束”本身不够。workflow 阶段之间暂时没有活动子 Agent,也仍视为未交回。失败/停止的终态结果同样可以解除该轮等待,但不代表 goal 验收通过。通知有延迟时会多等一段;完成验收会在工具实际执行时再次检查,避免仅靠预检放过同批启动的任务。
25
- - 结果读取与 Agent `resume` 不允许并发,会返回冲突错误;请先读取结果,再在下一批工具调用中 resume。这个限制保守覆盖不同 Agent 的组合,因为句柄与 ID 可能指向同一 Agent,不能仅靠输入字符串判断。普通读取之间、全新任务启动之间不受这项限制。
26
- - resume 会复用 Agent ID,因此其通知还必须匹配本轮启动的 `<tool-use-id>`;仍为 `queued`/`running` 的通知不会解除等待。缺少或不匹配轮次标记时会继续等待,可在 resume 启动返回后通过结果工具读取终态 Agent 结果,不会用旧通知推断新轮已结束。
27
- - 后台任务卡住/暂停、通知丢失,或结果被外部 RPC 等未追踪入口消费并取消通知,都可能让等待一直保留。本门禁不新增超时、自行轮询或恢复调度器;Agent 的结果工具也不能读取 workflow ID 来补偿丢失的 workflow 通知。人工检查任务及 writer 状态;不要把 `/goal-resume` 或切换目标当成清除等待的方法。
28
- - CLI 启动的 workflow、mention、外部 RPC、其它扩展派发,以及 goal 未 active 时就已启动的工作不受本层追踪。等待记录仅存于当前父会话内存,重载、重启或会话恢复后不重建旧记录;不能据此判断旧委派是否已经停止。
29
- - 门禁不停止正在运行的任务,也不禁止用户正常输入或父 Agent 在当前轮次继续用工具。部分完成通知仍可能唤起父 Agent 处理结果,剩余任务继续阻挡自动续跑和最终完成;通知不会替用户恢复已暂停的 goal。
30
- - 本适配保留 subagents 原生通知,没有把通知改写为 `pi-goal:wake`。原生通知自行触发的父模型回合不受 goal 的 `maxAutonomousRuns` 额度限制;该额度不是全部模型调用的上限。上游严格模式的 [wait/wake 协议](https://github.com/tmonk/pi-goal-x/blob/main/docs/advanced-usage.md#background-producer-integration)仍保留,但不是本门禁的默认接入方式。
31
- - 门禁先于上游 `schedule` 运行,等待期间也会暂缓其中的 strict wait 截止检查;不能把 goal 的 wait deadline 当作准时超时或停止后台 writer 的保证。
32
- - 维护依赖包括上游私有 `_goalCore.scheduler.schedule/claim` 及 subagents 的任务 ID、结果文本头和通知 XML 轮次标记格式。调度方法缺失时拒绝加载 goal 门面;格式变化可能漏记任务或无法解除等待,不能保证都自动报错。因此固定依赖并在升级时回归验证。这不是无需维护的原生联动。
25
+ - Tracks only delegation launched while a goal is active through `subagent(run/workflow)` or the native `Agent` / `SubagentWorkflow` tools. Holds conservatively cover the entire parent session: any tracked work awaiting results blocks automatic goal continuation and `update_goal(status=complete)`, even for an unrelated next step or after switching to or creating another goal. This reduces autonomous progress while background work is pending.
26
+ - A completion notification delivered to the parent, or a successful result-tool read of the full terminal Agent result, releases the corresponding hold; merely finishing background execution does not. A workflow remains pending between stages even when no child Agent is active. Failed or stopped terminal results also release that run's hold but do not imply successful goal auditing. Delayed notifications extend the wait. Completion is checked again during tool execution so preflight alone cannot miss a launch in the same batch.
27
+ - Concurrent result reads and Agent `resume` calls are rejected as conflicts; read results first, then resume in the next tool batch. This restriction conservatively covers combinations involving different Agents because a handle and an ID may identify the same Agent. Concurrent reads and fresh launches are unaffected by this restriction.
28
+ - Resume reuses the Agent ID, so its notification must also match the current launch's `<tool-use-id>`. Notifications still marked `queued` or `running` do not release a hold. Missing or mismatched run markers leave it pending; after the resume launch returns, a terminal Agent result can be read through the result tool. An old notification never establishes that a new run has finished.
29
+ - Stalled or paused tasks, lost notifications, or result consumption through an untracked entry point such as external RPC that cancels the notification can leave a hold pending indefinitely. The guard adds no timeout, polling or recovery scheduler. The Agent result tool cannot read workflow IDs to compensate for lost workflow notifications. Inspect task and writer state manually; `/goal-resume` and switching goals do not clear holds.
30
+ - CLI-launched workflows, mentions, external RPC, other extensions' dispatch paths and work started before the goal became active are not tracked. Holds exist only in the current parent session's memory and are not reconstructed after reload, restart or session restoration. Missing holds do not establish that old delegated work has stopped.
31
+ - The guard does not stop running tasks, block normal user input or prevent the parent Agent from using tools in its current turn. Partial completion notifications can still wake the parent to handle results while remaining holds block automatic continuation and final completion. Notifications do not resume a paused goal on the user's behalf.
32
+ - This integration retains native subagents notifications rather than rewriting them as `pi-goal:wake`. Parent model turns triggered by those notifications are outside goal's `maxAutonomousRuns` allowance; that allowance is not a cap on all model calls. Upstream strict mode's [wait/wake protocol](https://github.com/tmonk/pi-goal-x/blob/main/docs/advanced-usage.md#background-producer-integration) remains available but is not this guard's default integration path.
33
+ - The guard runs before upstream `schedule` and also defers its strict-wait deadline checks while holds are pending. A goal wait deadline is not a punctual timeout or a guarantee that background writers will stop.
34
+ - Maintenance depends on upstream's private `_goalCore.scheduler.schedule/claim` methods and subagents task IDs, result-text headers and notification XML run markers. Missing scheduler methods prevent the goal facade from loading. Format changes can cause missed launches or unreleased holds without necessarily producing an automatic error. Keep dependencies pinned and rerun regressions on upgrades; this is not a maintenance-free native integration.
33
35
 
34
36
  ## Additional behavior boundaries
35
37
 
@@ -38,7 +40,15 @@ The optional `@gfgghgftgffg/pi-subagents-lean.context.v1` global service supplie
38
40
 
39
41
  ## Upstream snapshot limitation
40
42
 
41
- Both the original and facade entrypoints were verified to retain the old objective after an external in-place edit and `/goal-refresh` on pi-goal-x 0.34.1; shutdown can overwrite the edit. Keep the upstream-parity regression, do not fork the storage engine to hide it, and revise the limitation when upstream fixes it. Prefer `/goal-tweak`.
43
+ Both the original and facade entrypoints retain the old objective after an external in-place edit and `/goal-refresh`, observed on 0.34.1 and again in the staged 0.34.2 check. Shutdown can overwrite the edit (observed on 0.34.1). Keep the upstream-parity regression, do not fork the storage engine to hide it, and revise the limitation when upstream fixes it. Prefer `/goal-tweak`.
44
+
45
+ ## Review: 0.34.1 → 0.34.2
46
+
47
+ - Exact npm publication snapshots with SHA-512 in `sources.json`; neither a Git HEAD substitute nor a published changelog was used. The manifests retain the same Pi/typebox peers and Node requirement. The new `extensions/goal.ts` inlines the removed `goal-tools.ts` installer in the same registration order; formatting and terminal input move to dedicated modules. The facade still imports `goal.ts`, `goal-context.ts` and `goal-session-safety.ts`, receives `_goalCore`, and interposes on the same scheduler `schedule`/`claim` methods. No removed shim is restored.
48
+ - `goal-events.ts` now pauses at `agent_settled` for non-transient provider errors and after a configured retry limit is exhausted. `goal-scheduler.ts` saves the pause and clears continuation state; transient retries remain separate. `session_compact_failed` flushes buffered goal changes and warns without pausing; the next request after successful compaction still gets the goal resync delta. `/goal-resume [text]` forwards text as a follow-up when idle or steer when busy, before attempting to resume the goal. `runGoalRefresh` still has the same cache/refresh sequence; do not infer a storage fix from the version bump.
49
+ - `get_goal` keeps separate model text (`content[].text`), goal state (`details.goal`) and successful page payload (`details.page`); renderer output is not the tool response.
50
+ - Owner approved the upstream contract migration. `extensions/goal-tool-names.ts` and `extensions/goal-drafting.ts` remove `goal_question`, leaving `goal_questionnaire`, and replace the phase-dependent tool profile with a fixed, task-setting-dependent list. Draft gating moves into `goal-events.ts` and tool execution. `propose_goal_draft` removes `sisyphus` from its schema, strips the legacy argument in `prepareArguments`, and uses the mode of the user-started draft. The lean metadata drops the deleted tool and parameter instruction without suppressing the remaining upstream behavior.
51
+ - Migrated only version-specific tests: seven registrations and fixed profiles replace the old eight-tool phase expectations. Lifecycle, execution, audit, task evidence, upstream-parity, child-session and joint ABI assertions remain. The first check failed four stale profile assertions even against upstream 0.34.2; subsequent verification must run all gates before publication.
42
52
 
43
53
  ## Verification
44
54
 
package/README.md CHANGED
@@ -2,13 +2,12 @@
2
2
 
3
3
  [简体中文](README.zh-CN.md)
4
4
 
5
- A lightweight wrapper over [pi-goal-x](https://github.com/tmonk/pi-goal-x): persistent goals, automatic continuation and completion auditing with shorter tool text. The upstream engine is not copied.
5
+ A lightweight wrapper over [pi-goal-x](https://github.com/tmonk/pi-goal-x). The upstream engine is not copied. Compatible with [@tintinweb/pi-subagents](https://github.com/tintinweb/pi-subagents) and its workflows via `pi-subagents-lean`.
6
6
 
7
7
  ## Features
8
8
 
9
- - Keeps upstream tools, commands, UI, settings and goal-file formats.
10
- - Integrates with `pi-subagents-lean` so the parent manages the goal and child sessions are identified automatically, without per-role setup.
11
- - During goal execution, blocks automatic continuation and completion while background Agent/workflow work launched through `subagent` is awaiting results.
9
+ - Keeps the seven upstream tools, commands, UI, settings and goal-file formats. The active profile is fixed apart from the task setting; `goal_questionnaire` handles drafting and the user-started draft supplies the goal mode.
10
+ - Adds a small integration layer that keeps goals in the parent session and waits for tracked Agent/workflow results before automatic continuation or completion.
12
11
 
13
12
  ## Installation
14
13
 
@@ -31,13 +30,15 @@ For a Git checkout, use `node scripts/install-extension.mjs pi-goal-x-lean`.
31
30
 
32
31
  Confirm the plan to start. Use `/goal-direct` for direct creation, `/sisyphus` for ordered steps, `/goal-tweak` to revise, and `/goal-pause` / `/goal-resume` to pause or resume. See the [upstream guide](https://github.com/tmonk/pi-goal-x#readme) for all commands.
33
32
 
33
+ If a provider error cannot be retried, or a configured network-retry limit is exhausted, the goal pauses. Fix the provider issue, then use `/goal-resume [text]`; optional text is sent to the agent.
34
+
34
35
  ## Context footprint (character proxy)
35
36
 
36
37
  <!-- amox-measurement:start -->
37
38
  | Package | Registered character proxy |
38
39
  | --- | ---: |
39
- | @gfgghgftgffg/pi-goal-x-lean | 1535 |
40
- | pi-goal-x | 2096 |
40
+ | @gfgghgftgffg/pi-goal-x-lean | 1297 |
41
+ | pi-goal-x | 1691 |
41
42
 
42
43
  Fixed ceil(characters / 4), not provider billing tokens.
43
44
  <!-- amox-measurement:end -->
package/README.zh-CN.md CHANGED
@@ -2,13 +2,12 @@
2
2
 
3
3
  [English](README.md)
4
4
 
5
- [pi-goal-x](https://github.com/tmonk/pi-goal-x) 的轻量包装:保留持久目标、自动续跑和完成审计,精简工具文案,不复制上游引擎。
5
+ [pi-goal-x](https://github.com/tmonk/pi-goal-x) 的轻量包装,不复制上游引擎。通过 `pi-subagents-lean` 兼容 [@tintinweb/pi-subagents](https://github.com/tintinweb/pi-subagents) 及其 workflow。
6
6
 
7
7
  ## 功能
8
8
 
9
- - 保留上游工具、命令、界面、设置及目标文件格式。
10
- - 与 `pi-subagents-lean` 联用时自动识别子会话,由父 Agent 管理目标,无需逐个角色配置。
11
- - goal 执行期间,通过 `subagent` 启动的后台 Agent/workflow 未交回结果时,阻止自动续跑或完成验收。
9
+ - 保留上游七个工具、命令、界面、设置及目标文件格式。除任务开关外,激活工具列表固定;草稿提问使用 `goal_questionnaire`,目标模式由用户发起的草稿决定。
10
+ - 增加轻量联动层,让目标归父会话管理,并在已追踪的 Agent/workflow 交回结果前阻止自动续跑和完成验收。
12
11
 
13
12
  ## 安装
14
13
 
@@ -31,13 +30,15 @@ pi update --extensions
31
30
 
32
31
  确认计划后开始执行。直接创建用 `/goal-direct`,有序步骤用 `/sisyphus`,修订用 `/goal-tweak`,暂停和恢复用 `/goal-pause`、`/goal-resume`。完整命令见[上游文档](https://github.com/tmonk/pi-goal-x#readme)。
33
32
 
33
+ 遇到不可重试的服务商错误,或用尽配置的网络重试次数后,目标会暂停。修复问题后使用 `/goal-resume [文本]`;附带的文本会发送给 Agent。
34
+
34
35
  ## 上下文占用(字符代理)
35
36
 
36
37
  <!-- amox-measurement:start -->
37
38
  | Package | Registered character proxy |
38
39
  | --- | ---: |
39
- | @gfgghgftgffg/pi-goal-x-lean | 1535 |
40
- | pi-goal-x | 2096 |
40
+ | @gfgghgftgffg/pi-goal-x-lean | 1297 |
41
+ | pi-goal-x | 1691 |
41
42
 
42
43
  Fixed ceil(characters / 4), not provider billing tokens.
43
44
  <!-- amox-measurement:end -->
package/index.ts CHANGED
@@ -12,9 +12,8 @@ const DESCRIPTIONS: Record<string, string> = {
12
12
  update_goal: "Complete (audited), block, or pause a goal; reason required for blocked/paused. Alternatively declare continuation; wait requires strictExecutionContract and a future ISO deadline. Reuse wait_id/deadline on recheck.",
13
13
  set_goal_tasks: "Confirm a flat parent-linked task tree; matching IDs retain progress, removed IDs are deleted. block_completion defaults false. Confirmation stops the turn, then continues.",
14
14
  update_goal_task: "Update task_id/status or ordered atomic updates; one invalid entry rejects the batch. Evidence completes contracted tasks; reason is required to skip.",
15
- goal_question: "Ask one user-started drafting question. recommended is zero-based; allow_custom defaults true.",
16
15
  goal_questionnaire: "Ask a batch of user-started drafting questions. recommended is zero-based; allow_custom defaults true.",
17
- propose_goal_draft: "Confirm a draft before execution. Preserve objective for budget-only tweaks; token_budget=null removes the cap, omit retains it. auto_continue defaults true; sisyphus must match the user's mode.",
16
+ propose_goal_draft: "Confirm a draft before execution. Preserve objective for budget-only tweaks; token_budget=null removes the cap, omit retains it. auto_continue defaults true; the user-started draft determines the mode.",
18
17
  };
19
18
 
20
19
  // Visit schema positions only: a field named 'description' or an object-valued
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gfgghgftgffg/pi-goal-x-lean",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "type": "module",
5
5
  "description": "Lean tool metadata over the complete pi-goal-x runtime; preserves goal tools, commands, scheduling and auditing.",
6
6
  "license": "MIT",
@@ -47,7 +47,7 @@
47
47
  "check": "npm run typecheck && npm test"
48
48
  },
49
49
  "dependencies": {
50
- "pi-goal-x": "0.34.1"
50
+ "pi-goal-x": "0.34.2"
51
51
  },
52
52
  "peerDependencies": {
53
53
  "@earendil-works/pi-ai": ">=1.4.0 <2.0.0",