@lazyingart/agintiflow 0.20.25 → 0.20.39

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.
Files changed (63) hide show
  1. package/README.md +9 -4
  2. package/docs/agent-runtime-pipe.md +5 -4
  3. package/docs/cli-i18n.md +1 -1
  4. package/docs/project-agent-lessons.md +1 -1
  5. package/docs/real-deepseek-capabilities.md +1 -1
  6. package/docs/self-development-supervision.md +1 -2
  7. package/docs/skills-and-tools.md +1 -1
  8. package/docs/supervised-capability-curriculum.md +111 -0
  9. package/package.json +9 -3
  10. package/public/app.js +4 -0
  11. package/references/backend-frontend-artifact-tunnel.md +3 -3
  12. package/references/general-task-capability-taxonomy.md +109 -0
  13. package/references/supervision-student-recursive-training.md +116 -0
  14. package/scripts/smoke-auto-update.js +96 -0
  15. package/scripts/smoke-auxiliary-tools.js +1 -0
  16. package/scripts/smoke-canvas-artifacts.js +67 -0
  17. package/scripts/smoke-capabilities.js +51 -2
  18. package/scripts/smoke-cli-chat.js +2 -0
  19. package/scripts/smoke-coding-tools.js +41 -0
  20. package/scripts/smoke-inbox.js +40 -1
  21. package/scripts/smoke-skills.js +53 -1
  22. package/scripts/smoke-toolchain-docker.js +1 -0
  23. package/scripts/smoke-web-api.js +6 -1
  24. package/skills/android/SKILL.md +2 -1
  25. package/skills/code-review/SKILL.md +24 -0
  26. package/skills/data-analysis/SKILL.md +29 -0
  27. package/skills/database/SKILL.md +27 -0
  28. package/skills/devops-deployment/SKILL.md +29 -0
  29. package/skills/docs-knowledge/SKILL.md +28 -0
  30. package/skills/dotnet-csharp/SKILL.md +24 -0
  31. package/skills/education-tutorial/SKILL.md +26 -0
  32. package/skills/go/SKILL.md +23 -0
  33. package/skills/ios-swift/SKILL.md +26 -0
  34. package/skills/java-jvm/SKILL.md +25 -0
  35. package/skills/php/SKILL.md +24 -0
  36. package/skills/presentation-slides/SKILL.md +26 -0
  37. package/skills/qa-testing/SKILL.md +27 -0
  38. package/skills/ruby/SKILL.md +24 -0
  39. package/skills/rust/SKILL.md +23 -0
  40. package/skills/security-review/SKILL.md +28 -0
  41. package/skills/supervision-student/SKILL.md +67 -0
  42. package/skills/writing-editing/SKILL.md +28 -0
  43. package/src/agent-runner.js +49 -7
  44. package/src/artifact-tunnel.js +75 -4
  45. package/src/auto-update.js +389 -0
  46. package/src/capabilities.js +6 -1
  47. package/src/cli.js +129 -14
  48. package/src/config.js +6 -2
  49. package/src/engineering-guidance.js +12 -2
  50. package/src/interactive-cli.js +42 -5
  51. package/src/model-client.js +2 -2
  52. package/src/model-routing.js +3 -1
  53. package/src/parallel-scouts.js +17 -1
  54. package/src/project.js +200 -20
  55. package/src/session-index.js +135 -0
  56. package/src/session-store.js +67 -3
  57. package/src/skill-library.js +16 -2
  58. package/src/sqlite.js +19 -0
  59. package/src/static-preview-server.js +8 -1
  60. package/src/task-profiles.js +318 -5
  61. package/src/web-db.js +58 -6
  62. package/src/workspace-tools.js +1 -0
  63. package/web.js +37 -11
@@ -0,0 +1,29 @@
1
+ ---
2
+ id: devops-deployment
3
+ label: DevOps Deployment And Runtime
4
+ description: Handle Docker, CI/CD, deployment, local services, ports, logs, environment setup, and runtime debugging.
5
+ triggers:
6
+ - devops
7
+ - docker
8
+ - deploy
9
+ - deployment
10
+ - ci cd
11
+ - service
12
+ - logs
13
+ - port
14
+ - environment
15
+ - nginx
16
+ tools:
17
+ - inspect_project
18
+ - read_file
19
+ - write_file
20
+ - apply_patch
21
+ - run_command
22
+ - web_search
23
+ ---
24
+ # DevOps Deployment And Runtime
25
+
26
+ Diagnose first with read-only evidence: versions, manifests, ports, logs, process status, and existing scripts. Prefer project-local scripts, Docker, or user-writable caches over host mutation.
27
+
28
+ Make setup idempotent and reversible. For long-running services, use tmux tools where available. If sudo, cloud credentials, or destructive infra changes are required, stop and provide a precise manual step.
29
+
@@ -0,0 +1,28 @@
1
+ ---
2
+ id: docs-knowledge
3
+ label: Documentation And Knowledge Base
4
+ description: Write or maintain README files, API docs, tutorials, changelogs, architecture notes, and user-facing documentation.
5
+ triggers:
6
+ - docs
7
+ - documentation
8
+ - readme
9
+ - tutorial
10
+ - guide
11
+ - changelog
12
+ - api docs
13
+ - knowledge base
14
+ tools:
15
+ - inspect_project
16
+ - search_files
17
+ - read_file
18
+ - write_file
19
+ - apply_patch
20
+ - run_command
21
+ - send_to_canvas
22
+ ---
23
+ # Documentation And Knowledge Base
24
+
25
+ Do not invent behavior when source files can be inspected. Read manifests, exported APIs, CLI help, tests, and examples before documenting commands or options.
26
+
27
+ Structure docs for a real reader: quick start, concepts, workflows, examples, troubleshooting, and reference. Verify important commands when safe and mark unverified assumptions explicitly.
28
+
@@ -0,0 +1,24 @@
1
+ ---
2
+ id: dotnet-csharp
3
+ label: .NET C# Development
4
+ description: Build, test, debug, and maintain .NET, C#, F#, ASP.NET, console, library, and test projects.
5
+ triggers:
6
+ - dotnet
7
+ - .net
8
+ - c#
9
+ - csharp
10
+ - asp.net
11
+ - nuget
12
+ tools:
13
+ - inspect_project
14
+ - search_files
15
+ - read_file
16
+ - apply_patch
17
+ - run_command
18
+ ---
19
+ # .NET C# Development
20
+
21
+ Inspect `.sln`, `.csproj`, `Program.cs`, controllers, appsettings, project references, and test projects before editing.
22
+
23
+ Use `dotnet restore`, `dotnet build`, and `dotnet test` when available. Keep `bin/`, `obj/`, and generated artifacts out of commits, and stop with evidence on missing SDK, private feed, or signing blockers.
24
+
@@ -0,0 +1,26 @@
1
+ ---
2
+ id: education-tutorial
3
+ label: Education Tutorials And Exercises
4
+ description: Create lessons, tutorials, courses, examples, quizzes, exercises, and learning materials.
5
+ triggers:
6
+ - education
7
+ - teach
8
+ - tutorial
9
+ - course
10
+ - lesson
11
+ - exercise
12
+ - quiz
13
+ - homework
14
+ tools:
15
+ - read_file
16
+ - write_file
17
+ - run_command
18
+ - web_search
19
+ - send_to_canvas
20
+ ---
21
+ # Education Tutorials And Exercises
22
+
23
+ Start from learner level and objective. Sequence concepts from concrete examples to explanation to practice.
24
+
25
+ Create durable lesson files with examples, exercises, answer keys, and verification steps. Test code/math examples when practical.
26
+
@@ -0,0 +1,23 @@
1
+ ---
2
+ id: go
3
+ label: Go Development
4
+ description: Build, test, debug, and maintain Go modules, CLIs, servers, packages, and tooling.
5
+ triggers:
6
+ - go
7
+ - golang
8
+ - go.mod
9
+ - go test
10
+ - gofmt
11
+ tools:
12
+ - inspect_project
13
+ - search_files
14
+ - read_file
15
+ - apply_patch
16
+ - run_command
17
+ ---
18
+ # Go Development
19
+
20
+ Inspect `go.mod`, commands under `cmd/`, packages under `internal/` or `pkg/`, and tests before editing.
21
+
22
+ Use `gofmt` on changed Go files and run focused `go test` commands, broadening to `go test ./...` when practical. Keep module/download noise out of commits and report missing Go/private module blockers precisely.
23
+
@@ -0,0 +1,26 @@
1
+ ---
2
+ id: ios-swift
3
+ label: iOS Swift Development
4
+ description: Build, test, debug, and package iOS, Swift, SwiftUI, Xcode, Swift Package Manager, simulator, and Apple-platform projects.
5
+ triggers:
6
+ - ios
7
+ - iphone
8
+ - ipad
9
+ - swift
10
+ - swiftui
11
+ - xcode
12
+ - simulator
13
+ tools:
14
+ - inspect_project
15
+ - search_files
16
+ - read_file
17
+ - apply_patch
18
+ - run_command
19
+ - send_to_canvas
20
+ ---
21
+ # iOS Swift Development
22
+
23
+ Inspect before editing: `Package.swift`, `.xcodeproj`, `.xcworkspace`, schemes, `Info.plist`, assets, signing settings, `xcodebuild -version`, and available simulators.
24
+
25
+ Prefer Swift Package Manager or project-local Xcode build commands. Verify with `swift test`, `xcodebuild build/test`, simulator launch, or a clear blocker when Xcode/signing/simulator access is unavailable. Save screenshots under durable workspace paths when a simulator is available.
26
+
@@ -0,0 +1,25 @@
1
+ ---
2
+ id: java-jvm
3
+ label: Java JVM Development
4
+ description: Build, test, debug, and maintain Java, Kotlin JVM, Maven, Gradle, Spring, and JUnit projects.
5
+ triggers:
6
+ - java
7
+ - jvm
8
+ - kotlin
9
+ - maven
10
+ - gradle
11
+ - spring
12
+ - junit
13
+ tools:
14
+ - inspect_project
15
+ - search_files
16
+ - read_file
17
+ - apply_patch
18
+ - run_command
19
+ ---
20
+ # Java JVM Development
21
+
22
+ Inspect the build system before editing: `pom.xml`, `build.gradle`, `settings.gradle`, wrapper files, modules, source sets, and tests.
23
+
24
+ Prefer project-local `./mvnw`, `./gradlew`, or existing Maven/Gradle commands. Run focused compile/test tasks first, keep generated `target/`, `build/`, and `.gradle/` artifacts out of commits, and stop on missing JDK or credential blockers with exact evidence.
25
+
@@ -0,0 +1,24 @@
1
+ ---
2
+ id: php
3
+ label: PHP Development
4
+ description: Build, test, debug, and maintain PHP, Composer, Laravel, Symfony, WordPress-style, CLI, and web projects.
5
+ triggers:
6
+ - php
7
+ - composer
8
+ - laravel
9
+ - symfony
10
+ - phpunit
11
+ - pest
12
+ tools:
13
+ - inspect_project
14
+ - search_files
15
+ - read_file
16
+ - apply_patch
17
+ - run_command
18
+ ---
19
+ # PHP Development
20
+
21
+ Inspect `composer.json`, framework config, routes, controllers, migrations, and tests before editing.
22
+
23
+ Use `php -l`, Composer scripts, PHPUnit, Pest, or framework test commands when available. Avoid global PHP extension or service changes unless explicitly approved, and keep `vendor/` out of commits.
24
+
@@ -0,0 +1,26 @@
1
+ ---
2
+ id: presentation-slides
3
+ label: Slides And Presentations
4
+ description: Create slide decks, pitch decks, posters, lecture materials, and presentation outlines.
5
+ triggers:
6
+ - slides
7
+ - presentation
8
+ - powerpoint
9
+ - pptx
10
+ - deck
11
+ - pitch deck
12
+ - poster
13
+ - lecture
14
+ tools:
15
+ - read_file
16
+ - write_file
17
+ - run_command
18
+ - send_to_canvas
19
+ - web_search
20
+ ---
21
+ # Slides And Presentations
22
+
23
+ Clarify audience, goal, length, and tone from context. Build a durable outline before slide text. Keep slides visually sparse: one message, one figure/table/story per slide when possible.
24
+
25
+ Use markdown, HTML, LaTeX beamer, PPTX tooling, or available local converters depending on the workspace. Save source plus exported artifacts when possible.
26
+
@@ -0,0 +1,27 @@
1
+ ---
2
+ id: qa-testing
3
+ label: QA Testing And CI Debugging
4
+ description: Reproduce bugs, repair failing tests, design regression checks, debug CI, and improve test coverage.
5
+ triggers:
6
+ - qa
7
+ - test
8
+ - testing
9
+ - failing test
10
+ - regression
11
+ - coverage
12
+ - ci
13
+ - github actions
14
+ tools:
15
+ - inspect_project
16
+ - search_files
17
+ - read_file
18
+ - apply_patch
19
+ - run_command
20
+ ---
21
+ # QA Testing And CI Debugging
22
+
23
+ Start by reproducing the failure with the narrowest command when a real failure exists. Capture the exact error and identify whether the failure is test expectation, product bug, setup issue, or flaky timing.
24
+
25
+ Patch the root cause, not the symptom. Add or update a regression test when it would have caught the issue. Run the focused test again, then a broader suite only when useful.
26
+
27
+ When the task is to create a QA/testing project from scratch, build a clean runnable project with meaningful tests. Do not invent staged bugs, misleading tests, or artificial failures unless the user explicitly asks for a bug-reproduction fixture. If an interrupted draft exists, remove stale generated artifacts and contradictory comments or README claims before committing.
@@ -0,0 +1,24 @@
1
+ ---
2
+ id: ruby
3
+ label: Ruby Development
4
+ description: Build, test, debug, and maintain Ruby, Rails, Bundler, gems, Rake, and RSpec/Minitest projects.
5
+ triggers:
6
+ - ruby
7
+ - rails
8
+ - gemfile
9
+ - bundler
10
+ - rake
11
+ - rspec
12
+ tools:
13
+ - inspect_project
14
+ - search_files
15
+ - read_file
16
+ - apply_patch
17
+ - run_command
18
+ ---
19
+ # Ruby Development
20
+
21
+ Inspect `Gemfile`, `.gemspec`, `Rakefile`, Rails routes/models/controllers, migrations, and tests before editing.
22
+
23
+ Use `bundle exec rake`, `bundle exec rspec`, or focused Ruby test commands when available. Keep `vendor/bundle`, logs, tmp, and generated artifacts out of commits, and report native gem or credential blockers precisely.
24
+
@@ -0,0 +1,23 @@
1
+ ---
2
+ id: rust
3
+ label: Rust Development
4
+ description: Build, test, debug, and maintain Rust crates, Cargo workspaces, CLIs, services, and libraries.
5
+ triggers:
6
+ - rust
7
+ - cargo
8
+ - crate
9
+ - borrow checker
10
+ - clippy
11
+ tools:
12
+ - inspect_project
13
+ - search_files
14
+ - read_file
15
+ - apply_patch
16
+ - run_command
17
+ ---
18
+ # Rust Development
19
+
20
+ Inspect `Cargo.toml`, workspace members, features, modules, examples, and tests before editing.
21
+
22
+ Prefer narrow `cargo check -p`, `cargo test -p`, or targeted test commands before broad workspace checks. Run `cargo fmt` when available, avoid unnecessary dependency churn, and explain safety/unsafe or lifetime tradeoffs clearly.
23
+
@@ -0,0 +1,28 @@
1
+ ---
2
+ id: security-review
3
+ label: Security Review
4
+ description: Review secrets, authentication, authorization, dependency risk, input validation, shell safety, and threat models.
5
+ triggers:
6
+ - security
7
+ - secret
8
+ - secrets
9
+ - auth
10
+ - authentication
11
+ - authorization
12
+ - vulnerability
13
+ - threat model
14
+ - dependency audit
15
+ tools:
16
+ - inspect_project
17
+ - search_files
18
+ - read_file
19
+ - apply_patch
20
+ - run_command
21
+ - web_search
22
+ ---
23
+ # Security Review
24
+
25
+ Never print secrets. Prefer redacted evidence and paths. Distinguish exploitable risk from style issues, and prioritize high-impact fixes.
26
+
27
+ Inspect auth boundaries, file/path handling, shell command construction, dependency manifests, and config defaults. Run available audit tools when safe, but do not treat scanners as a substitute for code review.
28
+
@@ -0,0 +1,67 @@
1
+ ---
2
+ id: supervision-student
3
+ label: Supervision Student Loop
4
+ description: Supervise another AgInTiFlow/student agent through tmux or session logs, verify its work independently, and convert failures into durable capability improvements.
5
+ triggers:
6
+ - supervision
7
+ - supervise
8
+ - supervisor
9
+ - student agent
10
+ - homework
11
+ - curriculum
12
+ - self supervision
13
+ - train agent
14
+ - tmux monitor
15
+ tools:
16
+ - tmux_list_sessions
17
+ - tmux_capture_pane
18
+ - tmux_send_keys
19
+ - tmux_start_session
20
+ - inspect_project
21
+ - search_files
22
+ - read_file
23
+ - apply_patch
24
+ - run_command
25
+ - send_to_canvas
26
+ ---
27
+ # Supervision Student Loop
28
+
29
+ Use this skill when AgInTiFlow is supervising another agent, a tmux session, or a long-running autonomous task.
30
+
31
+ ## Roles
32
+
33
+ - The student does the target project work.
34
+ - The supervisor gives normal user-level prompts, monitors progress, verifies evidence, and improves reusable capabilities.
35
+ - The supervisor should not directly implement the student's target project unless the user explicitly changes the assignment.
36
+
37
+ ## Loop
38
+
39
+ 1. Create or reuse a clean project folder and a named tmux/session id.
40
+ 2. Give the student a realistic task with imperfect prompting. Do not over-specify every implementation step.
41
+ 3. Define acceptance criteria before judging: files, build/test output, screenshots, commits, docs, UX, or source evidence.
42
+ 4. Monitor progress through tmux capture, session events, runtime logs, git status, and artifact lists.
43
+ 5. Verify the result externally. Do not trust the student's final summary by itself.
44
+ 6. If the student is blocked by missing reusable capability, improve AgInTiFlow itself: profile, skill, tool, command policy, model prompt, UI, docs, or smoke test.
45
+ 7. Resume the same student session with the updated AgInTiFlow and ask it to continue.
46
+ 8. Record the outcome in a homework ledger with evidence, flaws, fixes, and next test.
47
+
48
+ ## Evidence Checklist
49
+
50
+ - `git status --short` before and after.
51
+ - `git diff --stat` or commit log for intended changes.
52
+ - Build/test/check output from the actual toolchain.
53
+ - Durable output paths for screenshots, images, PDFs, reports, APKs, archives, and generated docs.
54
+ - Session `events.jsonl` snippets when tool use or artifact publication matters.
55
+ - A short postmortem: what failed, what capability was added, and what to test next.
56
+
57
+ ## Recursive Supervision
58
+
59
+ When training a supervisor agent, give it a smaller student to supervise. Grade the supervisor on whether it:
60
+
61
+ - Sets acceptance criteria.
62
+ - Gives compact prompts instead of doing the work.
63
+ - Verifies artifacts independently.
64
+ - Notices loops, false claims, missing files, bad git state, and tool failures.
65
+ - Converts recurring failures into reusable improvements.
66
+
67
+ The goal is not only a better worker. The goal is an agent that can supervise work, discover its own capability gaps, and request or implement durable upgrades.
@@ -0,0 +1,28 @@
1
+ ---
2
+ id: writing-editing
3
+ label: Writing Editing And Scriptwriting
4
+ description: Draft, edit, rewrite, structure, and polish articles, markdown, scripts, screenplays, books, novels, and creative or professional prose.
5
+ triggers:
6
+ - writing
7
+ - edit
8
+ - rewrite
9
+ - markdown
10
+ - blog
11
+ - article
12
+ - copywriting
13
+ - screenplay
14
+ - final draft
15
+ - script writing
16
+ tools:
17
+ - read_file
18
+ - write_file
19
+ - apply_patch
20
+ - web_search
21
+ - send_to_canvas
22
+ ---
23
+ # Writing Editing And Scriptwriting
24
+
25
+ Preserve the user's voice and purpose. For long work, create or update durable files: outline, draft, revision notes, style guide, and continuity notes.
26
+
27
+ For editing, identify the target audience, tone, format, and acceptance criteria before changing structure. For scripts/screenplays, track scenes, beats, characters, dialogue intent, and revision history.
28
+
@@ -15,7 +15,7 @@ import { normalizeWrapperName, runAgentWrapper, wrapperStatusText } from "./tool
15
15
  import { evaluateCommandPolicy } from "./command-policy.js";
16
16
  import { redactSensitiveText, redactValue } from "./redaction.js";
17
17
  import { executeWorkspaceTool, resolveWorkspacePath, summarizeWorkspaceTools, WORKSPACE_TOOL_NAMES } from "./workspace-tools.js";
18
- import { normalizeCanvasPayload } from "./artifact-tunnel.js";
18
+ import { normalizeCanvasPayload, persistCanvasPayloadFile } from "./artifact-tunnel.js";
19
19
  import { getTaskProfile } from "./task-profiles.js";
20
20
  import { generateImage, listAuxiliarySkills } from "./auxiliary-tools.js";
21
21
  import { engineeringGuidanceForTask } from "./engineering-guidance.js";
@@ -268,6 +268,8 @@ async function createInitialState(config, sessionId) {
268
268
  provider: config.provider,
269
269
  model: config.model,
270
270
  goal: config.goal,
271
+ baseDir: config.baseDir,
272
+ commandCwd: config.commandCwd,
271
273
  startUrl: config.startUrl,
272
274
  plan: "",
273
275
  stepsCompleted: 0,
@@ -332,14 +334,14 @@ async function createInitialState(config, sessionId) {
332
334
  `Task profile: ${taskProfile.label}. ${taskProfile.prompt}`,
333
335
  skillContext,
334
336
  engineeringGuidance,
335
- "A frontend canvas/artifacts tunnel exists. Use send_to_canvas when important markdown, diffs, screenshots, images, or workspace files should be highlighted in the UI. It is optional and ordinary final text can still go directly to finish.",
337
+ "A frontend canvas/artifacts tunnel exists. Use send_to_canvas when important markdown, diffs, screenshots, images, or workspace files should be highlighted in the UI. File paths sent to canvas are copied into session artifacts for durable preview, but user-requested outputs should also remain in a clear workspace path unless the user asked only for a temporary preview.",
336
338
  "For visual-output requests such as draw, plot, graph, chart, diagram, figure, image, or visualization, proactively publish a canvas artifact even when the user does not mention canvas. If workspace file tools are enabled, prefer creating a small SVG or markdown artifact and call send_to_canvas with selected=true.",
337
339
  "Work like a practical coding agent: orient with inspect_project/search/read, patch code with apply_patch, run safe checks when they add confidence, iterate on failures, and keep outputs inside the workspace.",
338
340
  "For large projects, decompose into useful files and milestones, identify entry points/tests/contracts first, implement a coherent minimal version, then iterate with checks rather than only describing what you would do.",
339
341
  "For website/app/code/LaTeX/Python/C/shell tasks, create or edit real workspace files, run available build/compile/test commands, and surface artifacts through the canvas when useful.",
340
342
  "For LaTeX/PDF tasks, check existing latexmk/pdflatex first and compile with the available host or Docker TeX toolchain before installing packages or rebuilding the sandbox.",
341
343
  "For research or web-search tasks, use browser tools or safe shell network tools when the current policy allows; cite or save useful sources in workspace notes when the task needs traceability.",
342
- "Use the canvas tunnel for outputs the user would likely want to inspect visually, such as figures, PDFs, screenshots, images, important markdown, or generated files.",
344
+ "Use the canvas tunnel for outputs the user would likely want to inspect visually, such as figures, PDFs, screenshots, images, important markdown, or generated files. When no save path is specified, choose a descriptive non-conflicting workspace path near the working directory and keep it there.",
343
345
  "For environment or system-maintenance work, use the configured sandbox and package policy; Docker workspace mode is the preferred place for installs and toolchain setup.",
344
346
  "For long-running work, create a durable checkpoint or artifact at each completed phase, then continue with the next concrete phase until the requested outcome is actually complete or blocked by a real dependency.",
345
347
  "If the user asks to open a generated local website or file, use open_workspace_file for a file or preview_workspace for a static site. Do not keep retrying the same localhost URL when a preview fails.",
@@ -737,7 +739,7 @@ async function captureSyntheticSnapshot(store, step, config) {
737
739
  config.allowWrapperTools
738
740
  ? `Agent wrappers available: selected=${normalizeWrapperName(config.preferredWrapper)}; ${wrapperStatusText()}`
739
741
  : "Agent wrappers disabled.",
740
- "Canvas/artifacts tunnel available through send_to_canvas.",
742
+ "Canvas/artifacts tunnel available through send_to_canvas. File paths sent to canvas are persisted into the session artifact store, but final user artifacts should still use clear durable workspace filenames.",
741
743
  "For draw/plot/graph/chart/diagram/figure requests, publish a canvas artifact proactively.",
742
744
  "For LaTeX/PDF requests, check latexmk/pdflatex first, publish the source and compiled PDF artifacts when available, and avoid reinstalling TeX when an existing toolchain works.",
743
745
  "Use open_url only if the task actually needs the web.",
@@ -1097,8 +1099,22 @@ async function executeTool(browserState, toolCall, snapshot, config, store, obse
1097
1099
  config
1098
1100
  );
1099
1101
  if (normalized.ok) {
1102
+ const persisted = await persistCanvasPayloadFile(normalized.payload, { config, store });
1103
+ if (!persisted.ok) {
1104
+ await store.appendEvent("canvas.persistence_failed", {
1105
+ toolName: "generate_image",
1106
+ reason: persisted.reason,
1107
+ path: normalized.payload.path,
1108
+ });
1109
+ observers.event("canvas.persistence_failed", {
1110
+ toolName: "generate_image",
1111
+ reason: persisted.reason,
1112
+ path: normalized.payload.path,
1113
+ });
1114
+ return result;
1115
+ }
1100
1116
  const canvasItem = {
1101
- ...normalized.payload,
1117
+ ...persisted.payload,
1102
1118
  toolName: "generate_image",
1103
1119
  commandCwd: config.commandCwd,
1104
1120
  };
@@ -1144,8 +1160,30 @@ async function executeTool(browserState, toolCall, snapshot, config, store, obse
1144
1160
  };
1145
1161
  }
1146
1162
 
1163
+ const persisted = await persistCanvasPayloadFile(normalized.payload, { config, store });
1164
+ if (!persisted.ok) {
1165
+ await store.appendEvent("tool.blocked", {
1166
+ toolName: "send_to_canvas",
1167
+ args: safeArgs,
1168
+ reason: persisted.reason,
1169
+ category: "canvas",
1170
+ });
1171
+ observers.event("tool.blocked", {
1172
+ toolName: "send_to_canvas",
1173
+ args: safeArgs,
1174
+ reason: persisted.reason,
1175
+ category: "canvas",
1176
+ });
1177
+ return {
1178
+ ok: false,
1179
+ blocked: true,
1180
+ reason: persisted.reason,
1181
+ toolName: "send_to_canvas",
1182
+ };
1183
+ }
1184
+
1147
1185
  const canvasItem = {
1148
- ...normalized.payload,
1186
+ ...persisted.payload,
1149
1187
  toolName: "send_to_canvas",
1150
1188
  commandCwd: config.commandCwd,
1151
1189
  };
@@ -1216,7 +1254,10 @@ export async function runAgent(config) {
1216
1254
  }
1217
1255
 
1218
1256
  const sessionId = config.resume || config.sessionId || `web-agent-${crypto.randomUUID()}`;
1219
- const store = new SessionStore(config.sessionsDir, sessionId);
1257
+ const store = new SessionStore(config.sessionsDir, sessionId, {
1258
+ projectRoot: config.baseDir,
1259
+ projectSessionsDir: config.projectSessionsDir,
1260
+ });
1220
1261
  const client = createClient(config);
1221
1262
  const observers = createObservers(config);
1222
1263
  const browserState = createBrowserState();
@@ -1353,6 +1394,7 @@ export async function runAgent(config) {
1353
1394
  emitConsole(config, `Routing: ${config.routingMode} (${config.routeReason})`, { kind: "meta" });
1354
1395
  emitConsole(config, `Workspace: ${config.commandCwd}`, { kind: "meta" });
1355
1396
  emitConsole(config, `Sessions: ${config.sessionsDir}`, { kind: "meta" });
1397
+ if (config.projectSessionsDir) emitConsole(config, `Project session index: ${config.projectSessionsDir}`, { kind: "meta" });
1356
1398
  if (config.useDockerSandbox) {
1357
1399
  emitConsole(
1358
1400
  config,