pythinker-code 0.55.0__py3-none-any.whl → 0.57.0__py3-none-any.whl
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.
- pythinker_code/CHANGELOG.md +45 -0
- pythinker_code/agents/default/system.md +2 -2
- pythinker_code/background/manager.py +5 -1
- pythinker_code/background/worker.py +6 -1
- pythinker_code/benchmark/__init__.py +5 -0
- pythinker_code/benchmark/activity.py +88 -0
- pythinker_code/benchmark/bundled/__init__.py +1 -0
- pythinker_code/benchmark/bundled/suites/__init__.py +1 -0
- pythinker_code/benchmark/bundled/suites/pythinker-core.json +11 -0
- pythinker_code/benchmark/bundled/suites/pythinker-smoke.json +10 -0
- pythinker_code/benchmark/bundled/tasks/__init__.py +1 -0
- pythinker_code/benchmark/bundled/tasks/core-atomic-transfer.json +21 -0
- pythinker_code/benchmark/bundled/tasks/core-dedup-order.json +21 -0
- pythinker_code/benchmark/bundled/tasks/core-explicit-none-metadata.json +21 -0
- pythinker_code/benchmark/bundled/tasks/core-safe-path-join.json +21 -0
- pythinker_code/benchmark/bundled/tasks/smoke-add-small-function.json +21 -0
- pythinker_code/benchmark/bundled/tasks/smoke-edit-readme.json +20 -0
- pythinker_code/benchmark/bundled/tasks/smoke-fix-python-test.json +21 -0
- pythinker_code/benchmark/commands.py +633 -0
- pythinker_code/benchmark/compare.py +72 -0
- pythinker_code/benchmark/discovery.py +169 -0
- pythinker_code/benchmark/environment.py +74 -0
- pythinker_code/benchmark/errors.py +57 -0
- pythinker_code/benchmark/estimate.py +69 -0
- pythinker_code/benchmark/export.py +69 -0
- pythinker_code/benchmark/records.py +191 -0
- pythinker_code/benchmark/redact.py +46 -0
- pythinker_code/benchmark/report.py +143 -0
- pythinker_code/benchmark/runner.py +425 -0
- pythinker_code/benchmark/suites.py +82 -0
- pythinker_code/benchmark/swe.py +193 -0
- pythinker_code/benchmark/tasks.py +186 -0
- pythinker_code/benchmark/types.py +11 -0
- pythinker_code/config.py +15 -0
- pythinker_code/soul/dynamic_injections/active_skills.py +131 -0
- pythinker_code/soul/pythinkersoul.py +4 -0
- pythinker_code/soul/slash.py +75 -0
- pythinker_code/tools/workflow/display.py +3 -3
- pythinker_code/tools/workflow/engine.py +16 -0
- pythinker_code/ui/shell/__init__.py +40 -14
- pythinker_code/ui/shell/focus_model.py +105 -0
- pythinker_code/ui/shell/focus_surface.py +94 -0
- pythinker_code/ui/shell/prompt.py +224 -5
- pythinker_code/ui/shell/slash.py +1 -0
- pythinker_code/ui/shell/sync_output.py +5 -1
- pythinker_code/ui/shell/tui/__init__.py +17 -0
- pythinker_code/ui/shell/tui/components.py +94 -0
- pythinker_code/ui/shell/tui/diff.py +37 -0
- pythinker_code/ui/shell/tui/scene.py +20 -0
- pythinker_code/ui/shell/tui/scheduler.py +23 -0
- pythinker_code/ui/shell/tui/width.py +16 -0
- pythinker_code/ui/shell/update_orchestrator.py +10 -0
- pythinker_code/ui/shell/visualize/__init__.py +8 -0
- pythinker_code/ui/shell/visualize/_blocks.py +81 -2
- pythinker_code/ui/shell/visualize/_interactive.py +109 -7
- pythinker_code/ui/shell/visualize/_live_view.py +96 -6
- pythinker_code/utils/pyinstaller.py +1 -0
- pythinker_code/utils/slashcmd.py +2 -1
- pythinker_code/web/static/assets/architecture-7EHR7CIX-CFMeP6t3.js +1 -0
- pythinker_code/web/static/assets/{architectureDiagram-3BPJPVTR-DLLSoTpu.js → architectureDiagram-3BPJPVTR-CMjTHbQr.js} +1 -1
- pythinker_code/web/static/assets/{blockDiagram-GPEHLZMM-BMip2JLF.js → blockDiagram-GPEHLZMM-DbNV66qZ.js} +1 -1
- pythinker_code/web/static/assets/{bootstrap-zfqecxAo.js → bootstrap-DHJiVjsg.js} +5 -5
- pythinker_code/web/static/assets/{c4Diagram-AAUBKEIU-CTmq_IS4.js → c4Diagram-AAUBKEIU-_L7KfhiY.js} +1 -1
- pythinker_code/web/static/assets/channel-CIonX3Sg.js +1 -0
- pythinker_code/web/static/assets/{chunk-2J33WTMH-DZ9aKIQs.js → chunk-2J33WTMH-Dsc-vkPL.js} +1 -1
- pythinker_code/web/static/assets/{chunk-3OPIFGDE-nRcjvWO-.js → chunk-3OPIFGDE-DkPxKRGJ.js} +1 -1
- pythinker_code/web/static/assets/{chunk-5ZQYHXKU-p4jMRqNu.js → chunk-5ZQYHXKU-DKsi-Xj_.js} +1 -1
- pythinker_code/web/static/assets/{chunk-727SXJPM-BCjC7IyI.js → chunk-727SXJPM-DusG3GJh.js} +1 -1
- pythinker_code/web/static/assets/{chunk-AQP2D5EJ-D6DdchUd.js → chunk-AQP2D5EJ-F4_a1a4u.js} +1 -1
- pythinker_code/web/static/assets/{chunk-CSCIHK7Q-D7xaFpY5.js → chunk-CSCIHK7Q-9L6bDdXh.js} +1 -1
- pythinker_code/web/static/assets/{chunk-JAPRZBRM-BkjZ9hSg.js → chunk-JAPRZBRM-BavSbd1t.js} +4 -4
- pythinker_code/web/static/assets/{chunk-KSCS5N6A-BSojGa-z.js → chunk-KSCS5N6A-D9NmS9a_.js} +1 -1
- pythinker_code/web/static/assets/{chunk-L5ZTLDWV-BGQB79u6.js → chunk-L5ZTLDWV-BSMfQ2IM.js} +1 -1
- pythinker_code/web/static/assets/{chunk-LZXEDZCA-DYA0QmuY.js → chunk-LZXEDZCA-r4sJTTgY.js} +2 -2
- pythinker_code/web/static/assets/{chunk-ND2GUHAM-R7T05mR0.js → chunk-ND2GUHAM-BL7ERbud.js} +1 -1
- pythinker_code/web/static/assets/{chunk-NZK2D7GU-BNiMhMEH.js → chunk-NZK2D7GU-G9jWyqp3.js} +1 -1
- pythinker_code/web/static/assets/{chunk-O5CBEL6O-CcEuUOFS.js → chunk-O5CBEL6O-QBSTZ593.js} +1 -1
- pythinker_code/web/static/assets/{chunk-WU5MYG2G-DapbJuCk.js → chunk-WU5MYG2G-DYANwips.js} +1 -1
- pythinker_code/web/static/assets/classDiagram-4FO5ZUOK-I2Og_7hO.js +1 -0
- pythinker_code/web/static/assets/classDiagram-v2-Q7XG4LA2-I2Og_7hO.js +1 -0
- pythinker_code/web/static/assets/{code-block-IT6T5CEO-D1LArb8Q.js → code-block-IT6T5CEO-uNhBh7Jk.js} +1 -1
- pythinker_code/web/static/assets/{dagre-BM42HDAG-xXhE-OZT.js → dagre-BM42HDAG-Cb91t8pu.js} +1 -1
- pythinker_code/web/static/assets/{diagram-2AECGRRQ-AsQzl1as.js → diagram-2AECGRRQ-CLZIVQzB.js} +1 -1
- pythinker_code/web/static/assets/{diagram-5GNKFQAL-iRrPZ0Ax.js → diagram-5GNKFQAL-B6DPBt7v.js} +1 -1
- pythinker_code/web/static/assets/{diagram-KO2AKTUF-RnY60fk2.js → diagram-KO2AKTUF-vb7QYejh.js} +1 -1
- pythinker_code/web/static/assets/{diagram-LMA3HP47-DGdJ8GDe.js → diagram-LMA3HP47-DdFQHXp3.js} +1 -1
- pythinker_code/web/static/assets/{diagram-OG6HWLK6-CbyRKoIq.js → diagram-OG6HWLK6-nJ1_wWcq.js} +1 -1
- pythinker_code/web/static/assets/{dist-D0z2kckA.js → dist-D1EQtQ8U.js} +1 -1
- pythinker_code/web/static/assets/{erDiagram-TEJ5UH35-bBHr-GVV.js → erDiagram-TEJ5UH35-sZ8vCcB8.js} +1 -1
- pythinker_code/web/static/assets/eventmodeling-FCH6USID-Nxb8XybE.js +1 -0
- pythinker_code/web/static/assets/{flowDiagram-I6XJVG4X-CLOhR3l_.js → flowDiagram-I6XJVG4X-NagVrMCI.js} +1 -1
- pythinker_code/web/static/assets/{ganttDiagram-6RSMTGT7-CU_TAii8.js → ganttDiagram-6RSMTGT7-D-1_XhUQ.js} +1 -1
- pythinker_code/web/static/assets/{gitGraph-WXDBUCRP-BBkPObG0.js → gitGraph-WXDBUCRP-DT3QZQPP.js} +1 -1
- pythinker_code/web/static/assets/{gitGraphDiagram-PVQCEYII-BN8Wzp-s.js → gitGraphDiagram-PVQCEYII-D8r0djS7.js} +1 -1
- pythinker_code/web/static/assets/{index-olOEkzgp.js → index-2eH9dBB3.js} +2 -2
- pythinker_code/web/static/assets/{info-J43DQDTF-ClVpw99Z.js → info-J43DQDTF-CsKNLP2n.js} +1 -1
- pythinker_code/web/static/assets/{infoDiagram-5YYISTIA-CwXy_rRM.js → infoDiagram-5YYISTIA-CIiPQAr1.js} +1 -1
- pythinker_code/web/static/assets/{ishikawaDiagram-YF4QCWOH-BQD-_4DR.js → ishikawaDiagram-YF4QCWOH-B0xZv1Ps.js} +1 -1
- pythinker_code/web/static/assets/{journeyDiagram-JHISSGLW-iZ30P8Ge.js → journeyDiagram-JHISSGLW-CSiKJ4Vm.js} +1 -1
- pythinker_code/web/static/assets/{kanban-definition-UN3LZRKU-e--jRi7n.js → kanban-definition-UN3LZRKU-BYVbc39d.js} +1 -1
- pythinker_code/web/static/assets/{line-D_FSsRgE.js → line-DHysIuAr.js} +1 -1
- pythinker_code/web/static/assets/mermaid-VLURNSYL-BepD7Trl.js +1 -0
- pythinker_code/web/static/assets/{mermaid-parser.core-DsHOq9qM.js → mermaid-parser.core-1Xw2pmTV.js} +2 -2
- pythinker_code/web/static/assets/{mermaid.core-BDrm7W63.js → mermaid.core-yguwm67R.js} +3 -3
- pythinker_code/web/static/assets/{mindmap-definition-RKZ34NQL-CtkDG9id.js → mindmap-definition-RKZ34NQL-BzbokPP4.js} +1 -1
- pythinker_code/web/static/assets/{packet-YPE3B663-BvuZzsut.js → packet-YPE3B663-DvwZvo4I.js} +1 -1
- pythinker_code/web/static/assets/{pie-LRSECV5Y-Ch6VEb1M.js → pie-LRSECV5Y-D3m6fHWL.js} +1 -1
- pythinker_code/web/static/assets/{pieDiagram-4H26LBE5-DiWyXXsC.js → pieDiagram-4H26LBE5-Ds6AGwnk.js} +1 -1
- pythinker_code/web/static/assets/{quadrantDiagram-W4KKPZXB-DiB8zIUe.js → quadrantDiagram-W4KKPZXB-DX8m3F04.js} +1 -1
- pythinker_code/web/static/assets/{radar-GUYGQ44K-QeforG_Z.js → radar-GUYGQ44K-Bma1Der9.js} +1 -1
- pythinker_code/web/static/assets/{requirementDiagram-4Y6WPE33-lGVvwA8b.js → requirementDiagram-4Y6WPE33-OcYBKZGh.js} +1 -1
- pythinker_code/web/static/assets/{sankeyDiagram-5OEKKPKP-MzBMGSLu.js → sankeyDiagram-5OEKKPKP-qZTKBl0U.js} +1 -1
- pythinker_code/web/static/assets/{sequenceDiagram-3UESZ5HK-B4_B3aHH.js → sequenceDiagram-3UESZ5HK-Dat3afNR.js} +1 -1
- pythinker_code/web/static/assets/{stateDiagram-AJRCARHV-CEd1AKaO.js → stateDiagram-AJRCARHV-C25VdSrM.js} +1 -1
- pythinker_code/web/static/assets/stateDiagram-v2-BHNVJYJU-CH7hdLfc.js +1 -0
- pythinker_code/web/static/assets/{timeline-definition-PNZ67QCA-CL5c_XDm.js → timeline-definition-PNZ67QCA-BO52-l4o.js} +1 -1
- pythinker_code/web/static/assets/{treeView-BLDUP644-B8WdOz2P.js → treeView-BLDUP644-wTS6XClR.js} +1 -1
- pythinker_code/web/static/assets/{treemap-LRROVOQU-Bh-QvFT4.js → treemap-LRROVOQU-H-Ce4Zv7.js} +1 -1
- pythinker_code/web/static/assets/{vennDiagram-CIIHVFJN-CPxet2G9.js → vennDiagram-CIIHVFJN-C8VDHwNL.js} +1 -1
- pythinker_code/web/static/assets/{wardley-L42UT6IY-Cjh-pB2w.js → wardley-L42UT6IY-CWdFDSTM.js} +1 -1
- pythinker_code/web/static/assets/{wardleyDiagram-YWT4CUSO-DVrFQcq7.js → wardleyDiagram-YWT4CUSO-Cl1J0nhW.js} +1 -1
- pythinker_code/web/static/assets/{xychartDiagram-2RQKCTM6-BSxRHMDQ.js → xychartDiagram-2RQKCTM6-DY3utX2b.js} +1 -1
- pythinker_code/web/static/index.html +1 -1
- {pythinker_code-0.55.0.dist-info → pythinker_code-0.57.0.dist-info}/METADATA +47 -27
- {pythinker_code-0.55.0.dist-info → pythinker_code-0.57.0.dist-info}/RECORD +129 -91
- pythinker_code/web/static/assets/architecture-7EHR7CIX-Ji0TtuXL.js +0 -1
- pythinker_code/web/static/assets/channel-C2MgjsLm.js +0 -1
- pythinker_code/web/static/assets/classDiagram-4FO5ZUOK-ByvEWoQt.js +0 -1
- pythinker_code/web/static/assets/classDiagram-v2-Q7XG4LA2-ByvEWoQt.js +0 -1
- pythinker_code/web/static/assets/eventmodeling-FCH6USID-CWEQMbKI.js +0 -1
- pythinker_code/web/static/assets/mermaid-VLURNSYL-BCkPnhm1.js +0 -1
- pythinker_code/web/static/assets/stateDiagram-v2-BHNVJYJU-ydn4EzOz.js +0 -1
- {pythinker_code-0.55.0.dist-info → pythinker_code-0.57.0.dist-info}/WHEEL +0 -0
- {pythinker_code-0.55.0.dist-info → pythinker_code-0.57.0.dist-info}/entry_points.txt +0 -0
- {pythinker_code-0.55.0.dist-info → pythinker_code-0.57.0.dist-info}/licenses/LICENSE +0 -0
- {pythinker_code-0.55.0.dist-info → pythinker_code-0.57.0.dist-info}/licenses/NOTICE +0 -0
pythinker_code/CHANGELOG.md
CHANGED
|
@@ -15,6 +15,51 @@ GitHub Releases page; `0.8.0` is the new starting line.
|
|
|
15
15
|
|
|
16
16
|
## Unreleased
|
|
17
17
|
|
|
18
|
+
## 0.57.0 (2026-07-05)
|
|
19
|
+
|
|
20
|
+
- **No more ghost/duplicate input prompt while the agent works.** After
|
|
21
|
+
submitting a prompt, the input card no longer fossilizes above the stream as
|
|
22
|
+
a second, ghostly prompt. The prompt bar and top border now stay visible
|
|
23
|
+
through turn-start and lazy-load frames, and running-agent output renders
|
|
24
|
+
through a stable diff-rendered scene (ported from Pi) so the input card no
|
|
25
|
+
longer jumps. An experimental Focus TUI mode (`tui.focus_mode`) pins the
|
|
26
|
+
composer and hides file activity behind a compact live shelf for a cleaner
|
|
27
|
+
fullscreen view, and active subagent tool work now surfaces in the pinned
|
|
28
|
+
status tail instead of a generic composing spinner.
|
|
29
|
+
- **Added a native `/benchmark` command suite.** Run deterministic local
|
|
30
|
+
Pythinker model evaluations with bundled smoke tasks and SWE-style JSONL
|
|
31
|
+
tasks (`/benchmark:swe`), plus `/benchmark compare`, `/benchmark export`,
|
|
32
|
+
and `/benchmark discover` actions that produce replayable artifacts,
|
|
33
|
+
activity metrics, and branded markdown reports.
|
|
34
|
+
- **Hardened benchmark and skill security edges.** SWE verification commands
|
|
35
|
+
are shape-validated before execution, benchmark discovery requires explicit
|
|
36
|
+
network opt-in, run IDs avoid clock collisions, runtime overrides restore
|
|
37
|
+
after setup failures, and active-skill deactivation failures now surface
|
|
38
|
+
instead of being swallowed. Explicitly invoked skills stay active across
|
|
39
|
+
later turns through a compact reminder until stopped by name or
|
|
40
|
+
"normal mode".
|
|
41
|
+
|
|
42
|
+
Upgrade with `pythinker update`, `pip install --upgrade pythinker-code==0.57.0`, or use the native installer for your platform from the [Releases page](https://github.com/Pythoughts-labs/pythinker-code/releases/latest).
|
|
43
|
+
|
|
44
|
+
## 0.56.0 (2026-07-02)
|
|
45
|
+
|
|
46
|
+
- **Windows shell UI recovers from mid-session console blanking.** The TUI's
|
|
47
|
+
transcript and input box could go blank mid-session until a terminal restart;
|
|
48
|
+
child processes spawned by the Shell tool, background tasks, and `!` commands
|
|
49
|
+
no longer attach to the interactive console (`CREATE_NO_WINDOW`), and the
|
|
50
|
+
prompt renderer now forces an absolute repaint after terminal resizes and
|
|
51
|
+
failed scrollback handoffs instead of diffing against a stale frame.
|
|
52
|
+
- **Workflow progress rendering and lifecycle fixes.** Progress display no
|
|
53
|
+
longer duplicates agents once truncated by the per-phase display cap,
|
|
54
|
+
`agent()` coroutines are no longer leaked when `parallel()` rejects its
|
|
55
|
+
arguments, and a 1000-agent lifetime backstop now guards against runaway
|
|
56
|
+
workflow loops.
|
|
57
|
+
- **Stale update-success notice cleared after downgrading.** Restarting into
|
|
58
|
+
an older Homebrew install no longer leaves a permanent "Restart to apply"
|
|
59
|
+
banner — the `/update` command surfaces again as expected.
|
|
60
|
+
|
|
61
|
+
Upgrade with `pythinker update`, `pip install --upgrade pythinker-code==0.56.0`, or use the native installer for your platform from the [Releases page](https://github.com/Pythoughts-labs/pythinker-code/releases/latest).
|
|
62
|
+
|
|
18
63
|
## 0.55.0 (2026-06-30)
|
|
19
64
|
|
|
20
65
|
- **Local-model reliability fixes for compaction, Qwen3 reasoning, and stuck loops.**
|
|
@@ -127,7 +127,7 @@ Default to `ImplementAndJudge` for non-trivial scoped edits (see §4.4); reserve
|
|
|
127
127
|
|
|
128
128
|
**Background shell** (root agent only). Launch long-running commands via `Shell` with `run_in_background=true` and a short `description`; the system notifies you at terminal states. `TaskList` re-enumerates active tasks (especially after context compaction); `TaskOutput` gives non-blocking snapshots (`block=true` only to intentionally wait); `TaskStop` cancels. After starting a background task, default to returning control to the user. The only task-management slash command for users is `/task` — never invent subcommands like `/task list` or `/tasks`. Subagents and sessions without these tools must not assume background-task control.
|
|
129
129
|
|
|
130
|
-
**Skills (`ReadSkill`).** Load a skill's exact instructions before applying its workflow — mandatory for `review-pr`, `diagnose-ci-failures`, `fix-errors`, `implement-specs`, `spec-driven-implementation`, `check-impl-against-spec`, `resolve-merge-conflicts`, and `create-pr`. Read skill details only when needed, to conserve context. Catalog and scope precedence in §12.
|
|
130
|
+
**Skills (`ReadSkill`).** Load a skill's exact instructions before applying its workflow — mandatory for `review-pr`, `diagnose-ci-failures`, `fix-errors`, `implement-specs`, `spec-driven-implementation`, `check-impl-against-spec`, `resolve-merge-conflicts`, and `create-pr`. If the user explicitly invokes or names a skill as an active mode, keep applying that loaded skill until they ask to stop it or return to normal mode. Read skill details only when needed, to conserve context. Catalog and scope precedence in §12.
|
|
131
131
|
|
|
132
132
|
**Inline `/command` references.** Slash commands execute only as their own message starting with `/`. A `/command` or `/skill:<name>` mentioned mid-message did not auto-run, but it still expresses intent — act on it rather than leading your reply by reporting it as failed. For `/plan`, call `EnterPlanMode` (a real tool in your toolset, not just prose); for `/goal`, pursue the described objective until it is verifiably done; for `/skill:<name>`, load it via `ReadSkill` and apply it; for other guidance commands, apply the equivalent guidance yourself. Mention invoking the real command only when genuinely needed. Never silently drop such a reference.
|
|
133
133
|
|
|
@@ -259,4 +259,4 @@ Skills are reusable, self-contained capability directories, each with a `SKILL.m
|
|
|
259
259
|
|
|
260
260
|
${PYTHINKER_SKILLS}
|
|
261
261
|
|
|
262
|
-
Identify the skills relevant to the current task and read their `SKILL.md` before applying the workflow (§5). If a skill `<name>` has a companion `<name>-local`, treat it as local project specialization applied after the core skill. Read skill details only when needed, to conserve the context window.
|
|
262
|
+
Identify the skills relevant to the current task and read their `SKILL.md` before applying the workflow (§5). If a skill `<name>` has a companion `<name>-local`, treat it as local project specialization applied after the core skill. Read skill details only when needed, to conserve the context window.
|
|
@@ -12,6 +12,7 @@ from pathlib import Path
|
|
|
12
12
|
from typing import TYPE_CHECKING, Any, Literal
|
|
13
13
|
|
|
14
14
|
from pythinker_host.local import local_host
|
|
15
|
+
from pythinker_host.windows import windows_console_detach_flags
|
|
15
16
|
|
|
16
17
|
from pythinker_code.config import BackgroundConfig
|
|
17
18
|
from pythinker_code.notifications import NotificationEvent, NotificationManager
|
|
@@ -243,7 +244,10 @@ class BackgroundTaskManager:
|
|
|
243
244
|
"cwd": str(task_dir),
|
|
244
245
|
}
|
|
245
246
|
if os.name == "nt":
|
|
246
|
-
|
|
247
|
+
# CREATE_NO_WINDOW: don't share the interactive console — a child
|
|
248
|
+
# touching it via the Win32 console API bypasses DEVNULL stdio and
|
|
249
|
+
# can blank the parent TUI until terminal restart.
|
|
250
|
+
kwargs["creationflags"] = windows_console_detach_flags()
|
|
247
251
|
else:
|
|
248
252
|
kwargs["start_new_session"] = True
|
|
249
253
|
|
|
@@ -9,6 +9,8 @@ import time
|
|
|
9
9
|
from pathlib import Path
|
|
10
10
|
from typing import Any
|
|
11
11
|
|
|
12
|
+
from pythinker_host.windows import windows_console_detach_flags
|
|
13
|
+
|
|
12
14
|
from pythinker_code.utils.logging import logger
|
|
13
15
|
from pythinker_code.utils.subprocess_env import get_clean_env, scrub_secret_env
|
|
14
16
|
|
|
@@ -185,7 +187,10 @@ async def run_background_task_worker(
|
|
|
185
187
|
"env": scrub_secret_env(get_clean_env()) if spec.scrub_secrets else get_clean_env(),
|
|
186
188
|
}
|
|
187
189
|
if os.name == "nt":
|
|
188
|
-
|
|
190
|
+
# CREATE_NO_WINDOW: don't share the interactive console — a child
|
|
191
|
+
# touching it via the Win32 console API bypasses the redirected
|
|
192
|
+
# stdio and can blank the parent TUI until terminal restart.
|
|
193
|
+
spawn_kwargs["creationflags"] = windows_console_detach_flags()
|
|
189
194
|
else:
|
|
190
195
|
spawn_kwargs["start_new_session"] = True
|
|
191
196
|
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import difflib
|
|
4
|
+
import json
|
|
5
|
+
from collections.abc import Mapping
|
|
6
|
+
from pathlib import Path
|
|
7
|
+
from typing import cast
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def summarize_benchmark_activity(
|
|
11
|
+
before: Mapping[str, str],
|
|
12
|
+
after: Mapping[str, str],
|
|
13
|
+
wire_file: Path,
|
|
14
|
+
wire_offset: int,
|
|
15
|
+
) -> dict[str, object]:
|
|
16
|
+
added, removed = _changed_line_counts(before, after)
|
|
17
|
+
tool_calls_by_name = _tool_calls_by_name(wire_file, wire_offset)
|
|
18
|
+
shell_tool_calls = sum(
|
|
19
|
+
count for name, count in tool_calls_by_name.items() if name.casefold() in {"bash", "shell"}
|
|
20
|
+
)
|
|
21
|
+
return {
|
|
22
|
+
"changed_files_count": len(_changed_file_names(before, after)),
|
|
23
|
+
"added_lines": added,
|
|
24
|
+
"removed_lines": removed,
|
|
25
|
+
"tool_calls_by_name": dict(sorted(tool_calls_by_name.items())),
|
|
26
|
+
"shell_tool_calls": shell_tool_calls,
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
def _changed_file_names(before: Mapping[str, str], after: Mapping[str, str]) -> set[str]:
|
|
31
|
+
names = set(before) | set(after)
|
|
32
|
+
return {name for name in names if before.get(name) != after.get(name)}
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
def _changed_line_counts(before: Mapping[str, str], after: Mapping[str, str]) -> tuple[int, int]:
|
|
36
|
+
added = 0
|
|
37
|
+
removed = 0
|
|
38
|
+
for name in sorted(_changed_file_names(before, after)):
|
|
39
|
+
diff = difflib.ndiff(
|
|
40
|
+
before.get(name, "").splitlines(),
|
|
41
|
+
after.get(name, "").splitlines(),
|
|
42
|
+
)
|
|
43
|
+
for line in diff:
|
|
44
|
+
if line.startswith("+ "):
|
|
45
|
+
added += 1
|
|
46
|
+
elif line.startswith("- "):
|
|
47
|
+
removed += 1
|
|
48
|
+
return added, removed
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
def _tool_calls_by_name(wire_file: Path, offset: int) -> dict[str, int]:
|
|
52
|
+
counts: dict[str, int] = {}
|
|
53
|
+
if not wire_file.exists():
|
|
54
|
+
return counts
|
|
55
|
+
try:
|
|
56
|
+
with wire_file.open("r", encoding="utf-8", errors="replace") as f:
|
|
57
|
+
f.seek(offset)
|
|
58
|
+
for line in f:
|
|
59
|
+
try:
|
|
60
|
+
raw: object = json.loads(line)
|
|
61
|
+
except json.JSONDecodeError:
|
|
62
|
+
continue
|
|
63
|
+
if not isinstance(raw, dict):
|
|
64
|
+
continue
|
|
65
|
+
message = cast(dict[str, object], raw).get("message")
|
|
66
|
+
if not isinstance(message, dict):
|
|
67
|
+
continue
|
|
68
|
+
message_data = cast(dict[str, object], message)
|
|
69
|
+
if message_data.get("type") != "ToolCall":
|
|
70
|
+
continue
|
|
71
|
+
payload = message_data.get("payload")
|
|
72
|
+
if not isinstance(payload, dict):
|
|
73
|
+
continue
|
|
74
|
+
name = _tool_name(cast(dict[str, object], payload))
|
|
75
|
+
if isinstance(name, str) and name:
|
|
76
|
+
counts[name] = counts.get(name, 0) + 1
|
|
77
|
+
except OSError:
|
|
78
|
+
return {}
|
|
79
|
+
return counts
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
def _tool_name(payload: Mapping[str, object]) -> str | None:
|
|
83
|
+
function = payload.get("function")
|
|
84
|
+
if isinstance(function, dict):
|
|
85
|
+
name = cast(dict[str, object], function).get("name")
|
|
86
|
+
return name if isinstance(name, str) else None
|
|
87
|
+
legacy_name = payload.get("name")
|
|
88
|
+
return legacy_name if isinstance(legacy_name, str) else None
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""Bundled benchmark definitions."""
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""Bundled benchmark suites."""
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "pythinker-core",
|
|
3
|
+
"title": "Pythinker Core Suite",
|
|
4
|
+
"description": "Deterministic local coding tasks covering common agent benchmark failure modes.",
|
|
5
|
+
"tasks": [
|
|
6
|
+
"core-atomic-transfer",
|
|
7
|
+
"core-dedup-order",
|
|
8
|
+
"core-explicit-none-metadata",
|
|
9
|
+
"core-safe-path-join"
|
|
10
|
+
]
|
|
11
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""Bundled benchmark tasks."""
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "core-atomic-transfer",
|
|
3
|
+
"title": "Atomic Ledger Transfer",
|
|
4
|
+
"description": "Fix a money-transfer bug without leaving partial state behind.",
|
|
5
|
+
"prompt": "Fix ledger.py. Ledger.transfer(src, dst, amount) must move funds atomically: reject missing source accounts, missing destination accounts, non-positive amounts, and insufficient funds without changing any balance. Keep the public API minimal.",
|
|
6
|
+
"workspace": {
|
|
7
|
+
"files": {
|
|
8
|
+
"ledger.py": "class Ledger:\n def __init__(self, balances):\n self.balances = dict(balances)\n\n def transfer(self, src, dst, amount):\n self.balances[src] -= amount\n if self.balances[src] < 0:\n raise ValueError('insufficient funds')\n self.balances[dst] += amount\n",
|
|
9
|
+
"test_ledger.py": "import pytest\n\nfrom ledger import Ledger\n\n\ndef test_transfer_moves_funds():\n ledger = Ledger({'a': 10, 'b': 1})\n ledger.transfer('a', 'b', 4)\n assert ledger.balances == {'a': 6, 'b': 5}\n\n\ndef test_insufficient_funds_rolls_back():\n ledger = Ledger({'a': 3, 'b': 1})\n with pytest.raises(ValueError):\n ledger.transfer('a', 'b', 5)\n assert ledger.balances == {'a': 3, 'b': 1}\n\n\ndef test_missing_destination_does_not_create_accounts():\n ledger = Ledger({'a': 3})\n with pytest.raises((KeyError, ValueError)):\n ledger.transfer('a', 'missing', 1)\n assert ledger.balances == {'a': 3}\n\n\ndef test_missing_source_rolls_back():\n ledger = Ledger({'a': 3, 'b': 1})\n with pytest.raises((KeyError, ValueError)):\n ledger.transfer('missing', 'b', 1)\n assert ledger.balances == {'a': 3, 'b': 1}\n\n\n@pytest.mark.parametrize('amount', [0, -1])\ndef test_non_positive_amount_rejected(amount):\n ledger = Ledger({'a': 3, 'b': 1})\n with pytest.raises(ValueError):\n ledger.transfer('a', 'b', amount)\n assert ledger.balances == {'a': 3, 'b': 1}\n\n\ndef test_non_positive_amount_checked_before_accounts():\n ledger = Ledger({'a': 3, 'b': 1})\n with pytest.raises(ValueError):\n ledger.transfer('missing', 'b', -1)\n assert ledger.balances == {'a': 3, 'b': 1}\n"
|
|
10
|
+
}
|
|
11
|
+
},
|
|
12
|
+
"verification": {
|
|
13
|
+
"type": "command",
|
|
14
|
+
"command": "python -m pytest test_ledger.py -q"
|
|
15
|
+
},
|
|
16
|
+
"limits": {
|
|
17
|
+
"timeout_seconds": 180,
|
|
18
|
+
"max_steps": 60
|
|
19
|
+
},
|
|
20
|
+
"tags": ["core", "python", "state", "deterministic"]
|
|
21
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "core-dedup-order",
|
|
3
|
+
"title": "Stable Deduplication",
|
|
4
|
+
"description": "Preserve first-seen order while removing duplicates.",
|
|
5
|
+
"prompt": "Fix seqkit.py. unique(items) must return unique values from any iterable in first-seen order. It must support unhashable values such as dictionaries and must not mutate the input.",
|
|
6
|
+
"workspace": {
|
|
7
|
+
"files": {
|
|
8
|
+
"seqkit.py": "def unique(items):\n return sorted(set(items))\n",
|
|
9
|
+
"test_seqkit.py": "from seqkit import unique\n\n\ndef test_unique_preserves_first_seen_order():\n assert unique(['b', 'a', 'b', 'c', 'a']) == ['b', 'a', 'c']\n\n\ndef test_unique_supports_unhashable_dicts():\n first = {'id': 1, 'name': 'first'}\n duplicate = {'id': 1, 'name': 'first'}\n second = {'id': 2, 'name': 'second'}\n assert unique([first, duplicate, second, first]) == [first, second]\n\n\ndef test_unique_does_not_mutate_input():\n values = ['b', 'a', 'b']\n assert unique(values) == ['b', 'a']\n assert values == ['b', 'a', 'b']\n\n\ndef test_unique_accepts_generators():\n assert unique(x for x in ['a', 'a', 'b']) == ['a', 'b']\n\n\ndef test_unique_keeps_falsey_values_distinct():\n assert unique([0, False, '', None, 0, None]) == [0, '', None]\n"
|
|
10
|
+
}
|
|
11
|
+
},
|
|
12
|
+
"verification": {
|
|
13
|
+
"type": "command",
|
|
14
|
+
"command": "python -m pytest test_seqkit.py -q"
|
|
15
|
+
},
|
|
16
|
+
"limits": {
|
|
17
|
+
"timeout_seconds": 180,
|
|
18
|
+
"max_steps": 60
|
|
19
|
+
},
|
|
20
|
+
"tags": ["core", "python", "algorithm", "deterministic"]
|
|
21
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "core-explicit-none-metadata",
|
|
3
|
+
"title": "Explicit None Metadata",
|
|
4
|
+
"description": "Distinguish omitted metadata from explicit None.",
|
|
5
|
+
"prompt": "Fix metadata.py. build_driver_info must distinguish omitted name/version from explicitly passing None: omitted fields use defaults, explicit None suppresses that field, and if both are explicitly None the result is empty. Other explicit falsey values, such as empty string, False, or 0, must be preserved.",
|
|
6
|
+
"workspace": {
|
|
7
|
+
"files": {
|
|
8
|
+
"metadata.py": "DEFAULT_NAME = 'pythinker-client'\nDEFAULT_VERSION = '1.0'\n\n\ndef build_driver_info(name=None, version=None):\n return {\n 'name': name or DEFAULT_NAME,\n 'version': version or DEFAULT_VERSION,\n }\n",
|
|
9
|
+
"test_metadata.py": "from metadata import build_driver_info\n\n\ndef test_omitted_fields_use_defaults():\n assert build_driver_info() == {'name': 'pythinker-client', 'version': '1.0'}\n\n\ndef test_explicit_none_suppresses_one_field():\n assert build_driver_info(name=None) == {'version': '1.0'}\n assert build_driver_info(version=None) == {'name': 'pythinker-client'}\n\n\ndef test_explicit_none_for_both_fields_returns_empty_metadata():\n assert build_driver_info(name=None, version=None) == {}\n\n\ndef test_explicit_values_are_used():\n assert build_driver_info(name='wrapper', version='2.5') == {'name': 'wrapper', 'version': '2.5'}\n\n\ndef test_falsey_explicit_values_are_preserved():\n assert build_driver_info(name='', version='0') == {'name': '', 'version': '0'}\n assert build_driver_info(name=False, version=0) == {'name': False, 'version': 0}\n assert build_driver_info(name=None, version='') == {'version': ''}\n"
|
|
10
|
+
}
|
|
11
|
+
},
|
|
12
|
+
"verification": {
|
|
13
|
+
"type": "command",
|
|
14
|
+
"command": "python -m pytest test_metadata.py -q"
|
|
15
|
+
},
|
|
16
|
+
"limits": {
|
|
17
|
+
"timeout_seconds": 180,
|
|
18
|
+
"max_steps": 60
|
|
19
|
+
},
|
|
20
|
+
"tags": ["core", "python", "api-semantics", "deterministic"]
|
|
21
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "core-safe-path-join",
|
|
3
|
+
"title": "Safe Path Join",
|
|
4
|
+
"description": "Reject path traversal while keeping normal relative paths usable.",
|
|
5
|
+
"prompt": "Fix paths.py. safe_join(root, user_path) must return a Path inside root for normal relative paths, and reject absolute paths, sibling-prefix paths, parent traversal, or symlink traversal outside root with ValueError.",
|
|
6
|
+
"workspace": {
|
|
7
|
+
"files": {
|
|
8
|
+
"paths.py": "from pathlib import Path\n\n\ndef safe_join(root, user_path):\n return Path(root) / user_path\n",
|
|
9
|
+
"test_paths.py": "from pathlib import Path\n\nimport pytest\n\nfrom paths import safe_join\n\n\ndef test_safe_join_allows_nested_relative_path(tmp_path):\n root = tmp_path / 'root'\n root.mkdir()\n assert safe_join(root, 'logs/app.txt') == root.resolve() / 'logs/app.txt'\n\n\ndef test_safe_join_allows_root_relative_path(tmp_path):\n root = tmp_path / 'root'\n root.mkdir()\n assert safe_join(root, '.') == root.resolve()\n\n\ndef test_safe_join_rejects_parent_traversal(tmp_path):\n root = tmp_path / 'root'\n root.mkdir()\n with pytest.raises(ValueError):\n safe_join(root, '../secret.txt')\n\n\ndef test_safe_join_rejects_absolute_path(tmp_path):\n root = tmp_path / 'root'\n root.mkdir()\n with pytest.raises(ValueError):\n safe_join(root, Path('/tmp/secret.txt'))\n\n\ndef test_safe_join_rejects_sibling_prefix_absolute_path(tmp_path):\n root = tmp_path / 'root'\n sibling = tmp_path / 'root-sibling'\n root.mkdir()\n sibling.mkdir()\n with pytest.raises(ValueError):\n safe_join(root, sibling / 'secret.txt')\n\n\ndef test_safe_join_rejects_symlink_escape(tmp_path):\n root = tmp_path / 'root'\n outside = tmp_path / 'outside'\n root.mkdir()\n outside.mkdir()\n link = root / 'link'\n try:\n link.symlink_to(outside, target_is_directory=True)\n except OSError:\n pytest.skip('symlinks unavailable')\n with pytest.raises(ValueError):\n safe_join(root, 'link/secret.txt')\n"
|
|
10
|
+
}
|
|
11
|
+
},
|
|
12
|
+
"verification": {
|
|
13
|
+
"type": "command",
|
|
14
|
+
"command": "python -m pytest test_paths.py -q"
|
|
15
|
+
},
|
|
16
|
+
"limits": {
|
|
17
|
+
"timeout_seconds": 180,
|
|
18
|
+
"max_steps": 60
|
|
19
|
+
},
|
|
20
|
+
"tags": ["core", "python", "security", "deterministic"]
|
|
21
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "smoke-add-small-function",
|
|
3
|
+
"title": "Add Small Function",
|
|
4
|
+
"description": "Add a tiny function required by a deterministic check.",
|
|
5
|
+
"prompt": "Add a slugify(text) function to strings.py. It should lowercase text, strip leading/trailing whitespace, and replace spaces with hyphens.",
|
|
6
|
+
"workspace": {
|
|
7
|
+
"files": {
|
|
8
|
+
"strings.py": "",
|
|
9
|
+
"test_strings.py": "from strings import slugify\n\n\ndef test_slugify():\n assert slugify(' Hello Benchmark ') == 'hello-benchmark'\n"
|
|
10
|
+
}
|
|
11
|
+
},
|
|
12
|
+
"verification": {
|
|
13
|
+
"type": "command",
|
|
14
|
+
"command": "python -m pytest test_strings.py -q"
|
|
15
|
+
},
|
|
16
|
+
"limits": {
|
|
17
|
+
"timeout_seconds": 120,
|
|
18
|
+
"max_steps": 30
|
|
19
|
+
},
|
|
20
|
+
"tags": ["smoke", "offline", "deterministic"]
|
|
21
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "smoke-edit-readme",
|
|
3
|
+
"title": "Edit README",
|
|
4
|
+
"description": "Update a README with a requested sentence.",
|
|
5
|
+
"prompt": "Update README.md to include a short sentence explaining that this project is used for a Pythinker benchmark smoke test.",
|
|
6
|
+
"workspace": {
|
|
7
|
+
"files": {
|
|
8
|
+
"README.md": "# Example Project\n\n"
|
|
9
|
+
}
|
|
10
|
+
},
|
|
11
|
+
"verification": {
|
|
12
|
+
"type": "command",
|
|
13
|
+
"command": "python - <<'PY'\nfrom pathlib import Path\ntext = Path('README.md').read_text(encoding='utf-8')\nassert 'Pythinker benchmark smoke test' in text\nPY"
|
|
14
|
+
},
|
|
15
|
+
"limits": {
|
|
16
|
+
"timeout_seconds": 120,
|
|
17
|
+
"max_steps": 30
|
|
18
|
+
},
|
|
19
|
+
"tags": ["smoke", "offline", "deterministic"]
|
|
20
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "smoke-fix-python-test",
|
|
3
|
+
"title": "Fix Python Test",
|
|
4
|
+
"description": "Fix a small Python function so the included test passes.",
|
|
5
|
+
"prompt": "Fix calc.py so python -m pytest test_calc.py passes. Keep the change minimal.",
|
|
6
|
+
"workspace": {
|
|
7
|
+
"files": {
|
|
8
|
+
"calc.py": "def add(a, b):\n return a - b\n",
|
|
9
|
+
"test_calc.py": "from calc import add\n\n\ndef test_add():\n assert add(2, 3) == 5\n"
|
|
10
|
+
}
|
|
11
|
+
},
|
|
12
|
+
"verification": {
|
|
13
|
+
"type": "command",
|
|
14
|
+
"command": "python -m pytest test_calc.py -q"
|
|
15
|
+
},
|
|
16
|
+
"limits": {
|
|
17
|
+
"timeout_seconds": 120,
|
|
18
|
+
"max_steps": 30
|
|
19
|
+
},
|
|
20
|
+
"tags": ["smoke", "offline", "deterministic"]
|
|
21
|
+
}
|