nx-kv 0.47.0 → 0.48.0
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/CHANGELOG.md +68 -25
- package/bin/kv.mjs +10 -7
- package/package.json +1 -1
- package/src/core/atomic-file.ts +46 -0
- package/src/core/attachmentdb/docs.ts +124 -0
- package/src/core/attachmentdb/ids.ts +112 -0
- package/src/core/attachmentdb/query.ts +230 -0
- package/src/core/attachmentdb/relations.ts +221 -0
- package/src/core/attachmentdb/resources.ts +260 -0
- package/src/core/attachstore.ts +360 -0
- package/src/core/db/bootstrap.ts +507 -0
- package/src/core/db/driver.ts +408 -0
- package/src/core/db/errors.ts +149 -0
- package/src/core/db/import-json/data.ts +193 -0
- package/src/core/db/import-json/extras.ts +77 -0
- package/src/core/db/import-json/links.ts +161 -0
- package/src/core/db/import-json/refs.ts +207 -0
- package/src/core/db/import-json/repos.ts +190 -0
- package/src/core/db/import-json/scan.ts +50 -0
- package/src/core/db/import-json/tasks.ts +366 -0
- package/src/core/db/import-json.ts +206 -0
- package/src/core/db/index.ts +147 -0
- package/src/core/db/migrations/index.ts +138 -0
- package/src/core/db/migrations/v2-data.ts +177 -0
- package/src/core/db/migrations/v4-data.ts +221 -0
- package/src/core/db/migrator.ts +233 -0
- package/src/core/db/seed-templates.ts +266 -0
- package/src/core/db/settings.ts +61 -0
- package/src/core/db/time.ts +98 -0
- package/src/core/db/tx.ts +209 -0
- package/src/core/db/verify.ts +317 -0
- package/src/core/db/version.ts +72 -0
- package/src/core/fileapi.ts +267 -0
- package/src/core/frontmatter.ts +70 -0
- package/src/core/fstree.ts +87 -0
- package/src/core/instruction-template.ts +357 -0
- package/src/core/keys.ts +32 -0
- package/src/core/kvapi.ts +237 -0
- package/src/core/localatt.ts +179 -0
- package/src/core/prompt.ts +60 -0
- package/src/core/topic-key.ts +43 -0
- package/src/core/workflow/edges.ts +28 -0
- package/src/core/workflow/layout.ts +118 -0
- package/src/core/workflow/lifecycle.ts +57 -0
- package/src/core/workflow/plugin-registry.ts +50 -0
- package/src/core/workflow/project.ts +108 -0
- package/src/core/workflow/readiness.ts +218 -0
- package/src/core/workflow/types.ts +175 -0
- package/src/core/zip.ts +178 -0
- package/src/modules/auth/actions/_manifest.generated.ts +26 -0
- package/src/modules/auth/actions/auth-login.ts +24 -0
- package/src/modules/auth/actions/auth-logout.ts +28 -0
- package/src/modules/auth/actions/auth-me.ts +28 -0
- package/src/modules/auth/actions/auth-status.ts +36 -0
- package/src/modules/auth/index.ts +24 -0
- package/src/modules/auth/schemas.ts +27 -0
- package/src/modules/auth/support.ts +28 -0
- package/src/modules/bundled/actions/_manifest.generated.ts +26 -0
- package/src/modules/bundled/actions/bundled-get.ts +29 -0
- package/src/modules/bundled/actions/bundled-groups.ts +33 -0
- package/src/modules/bundled/actions/bundled-install.ts +43 -0
- package/src/modules/bundled/actions/bundled-list.ts +37 -0
- package/src/modules/bundled/index.ts +24 -0
- package/src/modules/bundled/schemas.ts +32 -0
- package/src/modules/bundled/service.ts +377 -0
- package/src/modules/bundled/support.ts +70 -0
- package/src/modules/db/actions/_manifest.generated.ts +26 -0
- package/src/modules/db/actions/db-backup.ts +24 -0
- package/src/modules/db/actions/db-migrate.ts +24 -0
- package/src/modules/db/actions/db-status.ts +24 -0
- package/src/modules/db/actions/db-verify.ts +24 -0
- package/src/modules/db/index.ts +24 -0
- package/src/modules/db/schemas.ts +27 -0
- package/src/modules/db/service.ts +340 -0
- package/src/modules/docs/actions/_manifest.generated.ts +56 -0
- package/src/modules/docs/actions/doc-add.ts +30 -0
- package/src/modules/docs/actions/doc-attach-note.ts +25 -0
- package/src/modules/docs/actions/doc-attach.ts +25 -0
- package/src/modules/docs/actions/doc-attachments.ts +27 -0
- package/src/modules/docs/actions/doc-detach.ts +25 -0
- package/src/modules/docs/actions/doc-get.ts +27 -0
- package/src/modules/docs/actions/doc-list.ts +26 -0
- package/src/modules/docs/actions/doc-remove.ts +25 -0
- package/src/modules/docs/actions/doc-update.ts +30 -0
- package/src/modules/docs/actions/docs-bind.ts +26 -0
- package/src/modules/docs/actions/docs-index.ts +24 -0
- package/src/modules/docs/actions/docs-link.ts +27 -0
- package/src/modules/docs/actions/docs-notebind.ts +27 -0
- package/src/modules/docs/actions/docs-seed.ts +26 -0
- package/src/modules/docs/attach.ts +299 -0
- package/src/modules/docs/brief.ts +142 -0
- package/src/modules/docs/docref.ts +109 -0
- package/src/modules/docs/index.ts +25 -0
- package/src/modules/docs/knowledge.ts +628 -0
- package/src/modules/docs/links.ts +45 -0
- package/src/modules/docs/paths.ts +104 -0
- package/src/modules/docs/refs.ts +275 -0
- package/src/modules/docs/render.ts +85 -0
- package/src/modules/docs/repos-bridge.ts +13 -0
- package/src/modules/docs/schemas.ts +107 -0
- package/src/modules/docs/seed.ts +160 -0
- package/src/modules/docs/service.ts +255 -0
- package/src/modules/docs/store.ts +262 -0
- package/src/modules/file/actions/_manifest.generated.ts +38 -0
- package/src/modules/file/actions/file-content.ts +28 -0
- package/src/modules/file/actions/file-get.ts +25 -0
- package/src/modules/file/actions/file-list.ts +24 -0
- package/src/modules/file/actions/file-orphans.ts +24 -0
- package/src/modules/file/actions/file-prune.ts +24 -0
- package/src/modules/file/actions/file-remove.ts +25 -0
- package/src/modules/file/actions/file-sync.ts +24 -0
- package/src/modules/file/actions/file-upload.ts +24 -0
- package/src/modules/file/index.ts +24 -0
- package/src/modules/file/schemas.ts +61 -0
- package/src/modules/file/service.ts +449 -0
- package/src/modules/localtask/action-render.ts +203 -0
- package/src/modules/localtask/actions/_manifest.generated.ts +113 -0
- package/src/modules/localtask/actions/localtask-add.ts +48 -0
- package/src/modules/localtask/actions/localtask-attach-note.ts +29 -0
- package/src/modules/localtask/actions/localtask-attach.ts +38 -0
- package/src/modules/localtask/actions/localtask-attachments.ts +25 -0
- package/src/modules/localtask/actions/localtask-cancel.ts +26 -0
- package/src/modules/localtask/actions/localtask-cancelMany.ts +34 -0
- package/src/modules/localtask/actions/localtask-chain.ts +26 -0
- package/src/modules/localtask/actions/localtask-claim.ts +34 -0
- package/src/modules/localtask/actions/localtask-clone.ts +25 -0
- package/src/modules/localtask/actions/localtask-closeMany.ts +41 -0
- package/src/modules/localtask/actions/localtask-config.ts +64 -0
- package/src/modules/localtask/actions/localtask-detach.ts +31 -0
- package/src/modules/localtask/actions/localtask-done.ts +36 -0
- package/src/modules/localtask/actions/localtask-events.ts +31 -0
- package/src/modules/localtask/actions/localtask-fork.ts +25 -0
- package/src/modules/localtask/actions/localtask-get.ts +33 -0
- package/src/modules/localtask/actions/localtask-importRemote.ts +40 -0
- package/src/modules/localtask/actions/localtask-list.ts +26 -0
- package/src/modules/localtask/actions/localtask-presence.ts +28 -0
- package/src/modules/localtask/actions/localtask-preview.ts +45 -0
- package/src/modules/localtask/actions/localtask-prune.ts +28 -0
- package/src/modules/localtask/actions/localtask-remove.ts +27 -0
- package/src/modules/localtask/actions/localtask-removeMany.ts +32 -0
- package/src/modules/localtask/actions/localtask-reopen.ts +39 -0
- package/src/modules/localtask/actions/localtask-reorder.ts +33 -0
- package/src/modules/localtask/actions/localtask-task-restore.ts +27 -0
- package/src/modules/localtask/actions/localtask-timegoalLog.ts +37 -0
- package/src/modules/localtask/actions/localtask-topic-add.ts +26 -0
- package/src/modules/localtask/actions/localtask-topic-remove.ts +25 -0
- package/src/modules/localtask/actions/localtask-topic-removeMany.ts +26 -0
- package/src/modules/localtask/actions/localtask-update.ts +60 -0
- package/src/modules/localtask/actions/localtask-wait.ts +32 -0
- package/src/modules/localtask/actions/task-move.ts +50 -0
- package/src/modules/localtask/board-target.ts +190 -0
- package/src/modules/localtask/bus/index.ts +44 -0
- package/src/modules/localtask/deletion.ts +169 -0
- package/src/modules/localtask/engine.ts +59 -0
- package/src/modules/localtask/events.ts +250 -0
- package/src/modules/localtask/index.ts +25 -0
- package/src/modules/localtask/move-prims.ts +170 -0
- package/src/modules/localtask/move.ts +174 -0
- package/src/modules/localtask/mutator/index.ts +184 -0
- package/src/modules/localtask/mutator/validate.ts +59 -0
- package/src/modules/localtask/panel-guard.ts +199 -0
- package/src/modules/localtask/panel-presence.ts +361 -0
- package/src/modules/localtask/paths.ts +101 -0
- package/src/modules/localtask/remote-import.ts +159 -0
- package/src/modules/localtask/repo/goals.ts +186 -0
- package/src/modules/localtask/repo/links.ts +172 -0
- package/src/modules/localtask/repo/open.ts +74 -0
- package/src/modules/localtask/repo/presence.ts +126 -0
- package/src/modules/localtask/repo/rows.ts +204 -0
- package/src/modules/localtask/repo/settings.ts +402 -0
- package/src/modules/localtask/repo/snapshot.ts +173 -0
- package/src/modules/localtask/repo/tasks.ts +394 -0
- package/src/modules/localtask/repo/topics.ts +336 -0
- package/src/modules/localtask/repo-ctx.ts +33 -0
- package/src/modules/localtask/scheduler/index.ts +68 -0
- package/src/modules/localtask/scheduler/state-drive.ts +38 -0
- package/src/modules/localtask/schemas.ts +310 -0
- package/src/modules/localtask/service.ts +62 -0
- package/src/modules/localtask/store/file-adapter.ts +55 -0
- package/src/modules/localtask/store/index.ts +111 -0
- package/src/modules/localtask/store/memory-adapter.ts +37 -0
- package/src/modules/localtask/store-io.ts +77 -0
- package/src/modules/localtask/task-lifecycle.ts +461 -0
- package/src/modules/localtask/task-ops.ts +494 -0
- package/src/modules/localtask/task-remove.ts +366 -0
- package/src/modules/localtask/task-templates.ts +84 -0
- package/src/modules/localtask/task-view.ts +474 -0
- package/src/modules/localtask/topics.ts +197 -0
- package/src/modules/localtask/waiters.ts +86 -0
- package/src/modules/localtask/waiting.ts +82 -0
- package/src/modules/localtask/writes.ts +153 -0
- package/src/modules/repos/actions/_manifest.generated.ts +146 -0
- package/src/modules/repos/actions/board-add.ts +25 -0
- package/src/modules/repos/actions/board-assign.ts +27 -0
- package/src/modules/repos/actions/board-export.ts +24 -0
- package/src/modules/repos/actions/board-get.ts +27 -0
- package/src/modules/repos/actions/board-import.ts +40 -0
- package/src/modules/repos/actions/board-list.ts +26 -0
- package/src/modules/repos/actions/board-note.ts +27 -0
- package/src/modules/repos/actions/board-prefix.ts +27 -0
- package/src/modules/repos/actions/board-prune.ts +29 -0
- package/src/modules/repos/actions/board-rekey.ts +28 -0
- package/src/modules/repos/actions/board-remove.ts +25 -0
- package/src/modules/repos/actions/board-update.ts +25 -0
- package/src/modules/repos/actions/repo-add.ts +29 -0
- package/src/modules/repos/actions/repo-bind-topics.ts +36 -0
- package/src/modules/repos/actions/repo-bind.ts +27 -0
- package/src/modules/repos/actions/repo-clone.ts +25 -0
- package/src/modules/repos/actions/repo-detect.ts +33 -0
- package/src/modules/repos/actions/repo-doc-add.ts +25 -0
- package/src/modules/repos/actions/repo-doc-list.ts +34 -0
- package/src/modules/repos/actions/repo-doc-remove.ts +25 -0
- package/src/modules/repos/actions/repo-export.ts +32 -0
- package/src/modules/repos/actions/repo-get.ts +27 -0
- package/src/modules/repos/actions/repo-import-diff.ts +28 -0
- package/src/modules/repos/actions/repo-import.ts +35 -0
- package/src/modules/repos/actions/repo-key-migrate.ts +24 -0
- package/src/modules/repos/actions/repo-key-refresh.ts +25 -0
- package/src/modules/repos/actions/repo-key-set.ts +33 -0
- package/src/modules/repos/actions/repo-knowledge.ts +43 -0
- package/src/modules/repos/actions/repo-list.ts +26 -0
- package/src/modules/repos/actions/repo-open.ts +25 -0
- package/src/modules/repos/actions/repo-ref-add.ts +25 -0
- package/src/modules/repos/actions/repo-ref-backfill.ts +27 -0
- package/src/modules/repos/actions/repo-ref-check.ts +26 -0
- package/src/modules/repos/actions/repo-ref-clone.ts +36 -0
- package/src/modules/repos/actions/repo-ref-note.ts +25 -0
- package/src/modules/repos/actions/repo-ref-of.ts +27 -0
- package/src/modules/repos/actions/repo-ref-sync.ts +27 -0
- package/src/modules/repos/actions/repo-remote-check.ts +28 -0
- package/src/modules/repos/actions/repo-remote-list.ts +32 -0
- package/src/modules/repos/actions/repo-remote-pick.ts +25 -0
- package/src/modules/repos/actions/repo-remote.ts +38 -0
- package/src/modules/repos/actions/repo-remove.ts +25 -0
- package/src/modules/repos/actions/repo-scan.ts +41 -0
- package/src/modules/repos/actions/repo-update.ts +33 -0
- package/src/modules/repos/boards/core.ts +366 -0
- package/src/modules/repos/boards/docs.ts +82 -0
- package/src/modules/repos/boards/members.ts +306 -0
- package/src/modules/repos/boards/transfer.ts +214 -0
- package/src/modules/repos/cli/render.ts +184 -0
- package/src/modules/repos/git.ts +223 -0
- package/src/modules/repos/index.ts +25 -0
- package/src/modules/repos/keys.ts +262 -0
- package/src/modules/repos/ref-backfill.ts +219 -0
- package/src/modules/repos/ref.ts +680 -0
- package/src/modules/repos/remote.ts +262 -0
- package/src/modules/repos/repo/open.ts +93 -0
- package/src/modules/repos/repo/refs.ts +186 -0
- package/src/modules/repos/repo/repos.ts +242 -0
- package/src/modules/repos/repo/rows.ts +260 -0
- package/src/modules/repos/schemas.ts +310 -0
- package/src/modules/repos/service/bind-topics.ts +124 -0
- package/src/modules/repos/service/context.ts +229 -0
- package/src/modules/repos/service/crud.ts +404 -0
- package/src/modules/repos/service/identity.ts +212 -0
- package/src/modules/repos/service/store.ts +278 -0
- package/src/modules/repos/transfer/diff.ts +208 -0
- package/src/modules/repos/transfer/export.ts +287 -0
- package/src/modules/repos/transfer/import.ts +424 -0
- package/src/modules/repos/transfer/layout.ts +193 -0
- package/src/modules/repos/transfer/render.ts +75 -0
- package/src/modules/setting/actions/_manifest.generated.ts +20 -0
- package/src/modules/setting/actions/setting-get.ts +24 -0
- package/src/modules/setting/actions/setting-set.ts +24 -0
- package/src/modules/setting/index.ts +24 -0
- package/src/modules/setting/schemas.ts +18 -0
- package/src/modules/setting/service.ts +75 -0
- package/src/modules/tasktool/actions/_manifest.generated.ts +38 -0
- package/src/modules/tasktool/actions/timegoal-check.ts +30 -0
- package/src/modules/tasktool/actions/timegoal-clear.ts +25 -0
- package/src/modules/tasktool/actions/timegoal-list.ts +25 -0
- package/src/modules/tasktool/actions/timegoal-log.ts +37 -0
- package/src/modules/tasktool/actions/timegoal-prune.ts +28 -0
- package/src/modules/tasktool/actions/timegoal-set.ts +25 -0
- package/src/modules/tasktool/actions/timegoal-show.ts +28 -0
- package/src/modules/tasktool/actions/timegoal-update.ts +25 -0
- package/src/modules/tasktool/add.ts +129 -0
- package/src/modules/tasktool/attach-resource.ts +312 -0
- package/src/modules/tasktool/attach-template.ts +266 -0
- package/src/modules/tasktool/attach.ts +497 -0
- package/src/modules/tasktool/delivery-template.ts +222 -0
- package/src/modules/tasktool/delivery-text.ts +36 -0
- package/src/modules/tasktool/doc-inline.ts +85 -0
- package/src/modules/tasktool/facade/get.ts +54 -0
- package/src/modules/tasktool/facade/submit.ts +61 -0
- package/src/modules/tasktool/get.ts +46 -0
- package/src/modules/tasktool/group-store.ts +28 -0
- package/src/modules/tasktool/groupctx.ts +167 -0
- package/src/modules/tasktool/index.ts +24 -0
- package/src/modules/tasktool/panel-escort.ts +134 -0
- package/src/modules/tasktool/params.ts +34 -0
- package/src/modules/tasktool/plugins/base.ts +68 -0
- package/src/modules/tasktool/plugins/blockgoal.ts +24 -0
- package/src/modules/tasktool/plugins/container.ts +42 -0
- package/src/modules/tasktool/plugins/discover.ts +55 -0
- package/src/modules/tasktool/plugins/goal-template.ts +98 -0
- package/src/modules/tasktool/plugins/runtime.ts +73 -0
- package/src/modules/tasktool/plugins/taskgoal-store.ts +183 -0
- package/src/modules/tasktool/plugins/taskgoal.ts +17 -0
- package/src/modules/tasktool/plugins/timegoal-core-store.ts +161 -0
- package/src/modules/tasktool/plugins/timegoal-cwd-store.ts +455 -0
- package/src/modules/tasktool/plugins/timegoal-store.ts +81 -0
- package/src/modules/tasktool/plugins/timegoal-task-store.ts +356 -0
- package/src/modules/tasktool/plugins/timegoal.ts +51 -0
- package/src/modules/tasktool/plugins/waitgoal-config.ts +118 -0
- package/src/modules/tasktool/plugins/waitgoal.ts +77 -0
- package/src/modules/tasktool/preview.ts +105 -0
- package/src/modules/tasktool/schemas.ts +52 -0
- package/src/modules/tasktool/support.ts +100 -0
- package/src/modules/tasktool/system-blocks.ts +112 -0
- package/src/modules/tasktool/update.ts +79 -0
- package/src/modules/tasktool/wait.ts +574 -0
- package/src/modules/templates/actions/_manifest.generated.ts +29 -0
- package/src/modules/templates/actions/templates-add.ts +39 -0
- package/src/modules/templates/actions/templates-default.ts +39 -0
- package/src/modules/templates/actions/templates-list.ts +27 -0
- package/src/modules/templates/actions/templates-remove.ts +26 -0
- package/src/modules/templates/actions/templates-update.ts +34 -0
- package/src/modules/templates/index.ts +24 -0
- package/src/modules/templates/repo/open.ts +72 -0
- package/src/modules/templates/repo/templates.ts +155 -0
- package/src/modules/templates/schemas.ts +50 -0
- package/src/modules/templates/scope.ts +113 -0
- package/src/modules/templates/service.ts +359 -0
- package/src/modules/templates/support.ts +47 -0
- package/src/modules/todo/actions/_manifest.generated.ts +89 -0
- package/src/modules/todo/actions/group-add.ts +28 -0
- package/src/modules/todo/actions/group-current.ts +31 -0
- package/src/modules/todo/actions/group-get.ts +38 -0
- package/src/modules/todo/actions/group-list.ts +36 -0
- package/src/modules/todo/actions/group-members.ts +36 -0
- package/src/modules/todo/actions/group-remove.ts +39 -0
- package/src/modules/todo/actions/group-update.ts +30 -0
- package/src/modules/todo/actions/group-use.ts +38 -0
- package/src/modules/todo/actions/prompt-get.ts +25 -0
- package/src/modules/todo/actions/prompt-remove.ts +25 -0
- package/src/modules/todo/actions/prompt-set.ts +25 -0
- package/src/modules/todo/actions/todo-add.ts +27 -0
- package/src/modules/todo/actions/todo-archive.ts +27 -0
- package/src/modules/todo/actions/todo-attach.ts +24 -0
- package/src/modules/todo/actions/todo-attachments.ts +25 -0
- package/src/modules/todo/actions/todo-done.ts +24 -0
- package/src/modules/todo/actions/todo-freeze.ts +24 -0
- package/src/modules/todo/actions/todo-get.ts +25 -0
- package/src/modules/todo/actions/todo-list.ts +25 -0
- package/src/modules/todo/actions/todo-remove.ts +24 -0
- package/src/modules/todo/actions/todo-unfreeze.ts +26 -0
- package/src/modules/todo/actions/todo-update.ts +31 -0
- package/src/modules/todo/actions/topic-add.ts +25 -0
- package/src/modules/todo/actions/topic-list.ts +30 -0
- package/src/modules/todo/actions/topic-remove.ts +30 -0
- package/src/modules/todo/attachments.ts +194 -0
- package/src/modules/todo/group.ts +207 -0
- package/src/modules/todo/index.ts +26 -0
- package/src/modules/todo/locate.ts +103 -0
- package/src/modules/todo/schemas.ts +177 -0
- package/src/modules/todo/service.ts +476 -0
- package/src/modules/todo/store.ts +176 -0
- package/src/modules/todo/support.ts +93 -0
- package/src/runtime/action-decorator.ts +19 -8
- package/src/runtime/api.ts +2 -2
- package/src/runtime/cli.ts +3 -3
- package/src/runtime/codegen.ts +19 -12
- package/src/runtime/registry.ts +4 -3
- package/src/runtime/spec.ts +8 -3
- package/src/runtime/types/module.ts +4 -0
- package/src/runtime/zod-bridge.ts +14 -0
- package/src/shared/attach.ts +105 -0
- package/src/shared/doc-title.ts +65 -0
- package/src/shared/feedback-text.ts +261 -0
- package/src/shared/frontmatter.ts +107 -0
- package/src/shared/graph.ts +36 -0
- package/src/shared/prompt-blocks.ts +438 -0
- package/src/shared/repo-key.ts +57 -0
- package/src/shared/task-status.ts +108 -0
- package/src/shared/wikilink.ts +77 -0
- package/src/web/frontend/App.tsx +571 -0
- package/src/web/frontend/api/cli-tree.json +2553 -0
- package/src/web/frontend/api/client.generated.ts +1696 -1
- package/src/web/frontend/api/client.ts +57 -0
- package/src/web/frontend/app-context.tsx +56 -0
- package/src/web/frontend/components/Introduction/docs-modal.tsx +338 -0
- package/src/web/frontend/components/Introduction/index.tsx +65 -0
- package/src/web/frontend/components/Introduction/rail.tsx +169 -0
- package/src/web/frontend/components/Introduction/use-intro.ts +311 -0
- package/src/web/frontend/components/board/member-picker.tsx +290 -0
- package/src/web/frontend/components/button/index.tsx +150 -0
- package/src/web/frontend/components/cloud/editor.tsx +254 -0
- package/src/web/frontend/components/cloud/group-popup.tsx +198 -0
- package/src/web/frontend/components/cloud/markdown.tsx +60 -0
- package/src/web/frontend/components/cloud/upload.ts +157 -0
- package/src/web/frontend/components/doc/doc-head.tsx +269 -0
- package/src/web/frontend/components/icons.tsx +188 -0
- package/src/web/frontend/components/layout/breadcrumb.tsx +58 -0
- package/src/web/frontend/components/layout/crumbs.ts +155 -0
- package/src/web/frontend/components/layout/route-crumb.tsx +33 -0
- package/src/web/frontend/components/layout/route-history.ts +27 -0
- package/src/web/frontend/components/layout/side-resizer.tsx +126 -0
- package/src/web/frontend/components/layout/tabs.tsx +76 -0
- package/src/web/frontend/components/md/ack-rail.tsx +318 -0
- package/src/web/frontend/components/md/attach-area.tsx +430 -0
- package/src/web/frontend/components/md/attach-bar.tsx +31 -0
- package/src/web/frontend/components/md/attach-common.ts +222 -0
- package/src/web/frontend/components/md/attach-modal.tsx +491 -0
- package/src/web/frontend/components/md/attach-picker.tsx +367 -0
- package/src/web/frontend/components/md/attachments.ts +122 -0
- package/src/web/frontend/components/md/composer-launch.ts +105 -0
- package/src/web/frontend/components/md/composer-panel.tsx +369 -0
- package/src/web/frontend/components/md/find-bar.tsx +51 -0
- package/src/web/frontend/components/md/live-block.tsx +153 -0
- package/src/web/frontend/components/md/md-panes-helpers.ts +166 -0
- package/src/web/frontend/components/md/md-panes-keys.ts +212 -0
- package/src/web/frontend/components/md/md-panes-root.tsx +198 -0
- package/src/web/frontend/components/md/md-panes.tsx +528 -0
- package/src/web/frontend/components/md/sel-menu.tsx +106 -0
- package/src/web/frontend/components/md/shortcut-sheet.tsx +66 -0
- package/src/web/frontend/components/md/slash-menu.tsx +136 -0
- package/src/web/frontend/components/md/status-bar.tsx +60 -0
- package/src/web/frontend/components/md/task-chain.tsx +98 -0
- package/src/web/frontend/components/md/template-editor.tsx +129 -0
- package/src/web/frontend/components/md/tool-bar.tsx +331 -0
- package/src/web/frontend/components/md/use-live-preview.ts +304 -0
- package/src/web/frontend/components/md/use-slash-menu.ts +89 -0
- package/src/web/frontend/components/md/use-source-editor.ts +342 -0
- package/src/web/frontend/components/migrate/dialog.tsx +120 -0
- package/src/web/frontend/components/migrate/undo.tsx +73 -0
- package/src/web/frontend/components/migrate/use-move.ts +137 -0
- package/src/web/frontend/components/pager.tsx +90 -0
- package/src/web/frontend/components/popup/dismiss.ts +41 -0
- package/src/web/frontend/components/popup/index.tsx +350 -0
- package/src/web/frontend/components/repos/desc-modal.tsx +293 -0
- package/src/web/frontend/components/repos/get-loop-modal.tsx +292 -0
- package/src/web/frontend/components/repos/transfer-panel.tsx +521 -0
- package/src/web/frontend/components/sidebar/drag.ts +87 -0
- package/src/web/frontend/components/sidebar/index.tsx +407 -0
- package/src/web/frontend/components/sidebar/model.ts +253 -0
- package/src/web/frontend/components/sidebar/panel.tsx +213 -0
- package/src/web/frontend/components/sidebar/queue-nav.ts +56 -0
- package/src/web/frontend/components/sidebar/rescue-fab.tsx +84 -0
- package/src/web/frontend/components/sidebar/row-menu.tsx +136 -0
- package/src/web/frontend/components/sidebar/side-state.ts +58 -0
- package/src/web/frontend/components/sidebar/task-children.tsx +103 -0
- package/src/web/frontend/components/status-tag/index.tsx +43 -0
- package/src/web/frontend/components/status-tag/model.ts +61 -0
- package/src/web/frontend/components/task-panel/index.tsx +48 -0
- package/src/web/frontend/components/task-panel/layout.tsx +82 -0
- package/src/web/frontend/components/task-panel/page-shell.tsx +49 -0
- package/src/web/frontend/components/task-panel/task-row.tsx +227 -0
- package/src/web/frontend/components/toast/index.tsx +59 -0
- package/src/web/frontend/components/tool-acts/bar.tsx +174 -0
- package/src/web/frontend/components/tool-acts/dnd.ts +70 -0
- package/src/web/frontend/components/tool-acts/layout-panel.tsx +320 -0
- package/src/web/frontend/components/tool-acts/modules.ts +215 -0
- package/src/web/frontend/components/tool-acts/use-layout.ts +37 -0
- package/src/web/frontend/components/ui.tsx +119 -0
- package/src/web/frontend/index.html +1 -1
- package/src/web/frontend/main.tsx +20 -0
- package/src/web/frontend/modules/board/ack-nodes.ts +150 -0
- package/src/web/frontend/modules/board/ack-rail-pos.ts +73 -0
- package/src/web/frontend/modules/board/board-view.ts +302 -0
- package/src/web/frontend/modules/board/reopen-text.ts +90 -0
- package/src/web/frontend/modules/md/attach-mention.ts +81 -0
- package/src/web/frontend/modules/md/doc-store.ts +100 -0
- package/src/web/frontend/modules/md/lightbox.ts +114 -0
- package/src/web/frontend/modules/md/md-blocks.ts +260 -0
- package/src/web/frontend/modules/md/md-edit-ops.ts +435 -0
- package/src/web/frontend/modules/md/md-history.ts +129 -0
- package/src/web/frontend/modules/md/md-parse.ts +133 -0
- package/src/web/frontend/modules/md/md-render.ts +304 -0
- package/src/web/frontend/modules/md/progress-chain.ts +34 -0
- package/src/web/frontend/modules/md/progress-search.ts +117 -0
- package/src/web/frontend/modules/md/use-templates.ts +175 -0
- package/src/web/frontend/modules/prompts/placeholders.ts +106 -0
- package/src/web/frontend/modules/prompts/prompt-editor.tsx +174 -0
- package/src/web/frontend/page/cloud/index.tsx +535 -0
- package/src/web/frontend/page/dag/edges.ts +79 -0
- package/src/web/frontend/page/dag/head-bar.tsx +78 -0
- package/src/web/frontend/page/dag/index.tsx +520 -0
- package/src/web/frontend/page/dag/layout.ts +97 -0
- package/src/web/frontend/page/dag/model.ts +128 -0
- package/src/web/frontend/page/dag/node-card.tsx +156 -0
- package/src/web/frontend/page/dag/use-interactions.ts +155 -0
- package/src/web/frontend/page/dir/dag-editor.tsx +206 -0
- package/src/web/frontend/page/dir/deleted-panel.tsx +77 -0
- package/src/web/frontend/page/dir/index.tsx +557 -0
- package/src/web/frontend/page/dir/landing.tsx +463 -0
- package/src/web/frontend/page/dir/task-ack.ts +46 -0
- package/src/web/frontend/page/dir/task-actions.ts +450 -0
- package/src/web/frontend/page/dir/task-beside-header.tsx +22 -0
- package/src/web/frontend/page/dir/task-board-section.tsx +49 -0
- package/src/web/frontend/page/dir/task-chain.ts +190 -0
- package/src/web/frontend/page/dir/task-derived-ctx.ts +61 -0
- package/src/web/frontend/page/dir/task-dock-panel.tsx +283 -0
- package/src/web/frontend/page/dir/task-dock.ts +97 -0
- package/src/web/frontend/page/dir/task-feedback.ts +247 -0
- package/src/web/frontend/page/dir/task-goal-section.tsx +78 -0
- package/src/web/frontend/page/dir/task-goal.ts +51 -0
- package/src/web/frontend/page/dir/task-history-view.tsx +54 -0
- package/src/web/frontend/page/dir/task-not-found.tsx +34 -0
- package/src/web/frontend/page/dir/task-preview-modal.tsx +104 -0
- package/src/web/frontend/page/dir/task-sel-menu.ts +59 -0
- package/src/web/frontend/page/dir/task-status-bar.tsx +77 -0
- package/src/web/frontend/page/dir/task-utils.ts +257 -0
- package/src/web/frontend/page/dir/task.tsx +575 -0
- package/src/web/frontend/page/doc/index.tsx +632 -0
- package/src/web/frontend/page/group/index.tsx +698 -0
- package/src/web/frontend/page/overview/index.tsx +326 -0
- package/src/web/frontend/page/progress/index.tsx +545 -0
- package/src/web/frontend/page/refs/index.tsx +157 -0
- package/src/web/frontend/page/repos/bind-modals.tsx +138 -0
- package/src/web/frontend/page/repos/board-admin.tsx +246 -0
- package/src/web/frontend/page/repos/board-refs.tsx +108 -0
- package/src/web/frontend/page/repos/doc-search-modal.tsx +269 -0
- package/src/web/frontend/page/repos/filters-bar.tsx +54 -0
- package/src/web/frontend/page/repos/index.tsx +615 -0
- package/src/web/frontend/page/repos/pending-section.tsx +169 -0
- package/src/web/frontend/page/repos/ref-panel.tsx +441 -0
- package/src/web/frontend/page/repos/remote-modal.tsx +142 -0
- package/src/web/frontend/page/repos/repo-form-modal.tsx +252 -0
- package/src/web/frontend/page/repos/repo-table.tsx +411 -0
- package/src/web/frontend/page/settings/index.tsx +234 -0
- package/src/web/frontend/page/settings/prompt-template-params.ts +296 -0
- package/src/web/frontend/page/settings/prompt-templates-section.tsx +473 -0
- package/src/web/frontend/page/settings/sidebar-section.tsx +75 -0
- package/src/web/frontend/page/settings/task-templates-section.tsx +124 -0
- package/src/web/frontend/page/templates/index.tsx +280 -0
- package/src/web/frontend/page/templates/scope-chips.tsx +237 -0
- package/src/web/frontend/panels.tsx +248 -0
- package/src/web/frontend/prefs.ts +77 -0
- package/src/web/frontend/registry.ts +36 -0
- package/src/web/frontend/route-map.ts +47 -0
- package/src/web/frontend/routes/dir.ts +54 -0
- package/src/web/frontend/routes/doc-ref.ts +36 -0
- package/src/web/frontend/routes/doc.ts +45 -0
- package/src/web/frontend/routes/group.ts +37 -0
- package/src/web/frontend/routes/index.ts +40 -0
- package/src/web/frontend/routes/keys.ts +3 -0
- package/src/web/frontend/routes/static.ts +21 -0
- package/src/web/frontend/routes/templates.ts +65 -0
- package/src/web/frontend/routes/types.ts +43 -0
- package/src/web/frontend/store.tsx +96 -0
- package/src/web/frontend/styles-v2/views.css +24 -0
- package/src/web/frontend/types.ts +170 -0
- package/src/web/frontend/workspace/areas.ts +62 -0
- package/src/web/frontend/workspace/layout.ts +433 -0
- package/src/web/frontend/workspace/open.ts +284 -0
- package/src/web/frontend/workspace/panels.ts +447 -0
- package/src/web/public/assets/Introduction-aQCeCLrV.js +6 -0
- package/src/web/public/assets/app-context-BASCGAA-.js +1 -0
- package/src/web/public/assets/bar-B9WWmCpt.js +1 -0
- package/src/web/public/assets/board-view-DABoVkaA.js +1 -0
- package/src/web/public/assets/cloud-C4b8SU7C.js +3 -0
- package/src/web/public/assets/composer-launch-mK9Nr6mZ.js +1 -0
- package/src/web/public/assets/composer-panel-ByezS8Xv.js +1 -0
- package/src/web/public/assets/dag-jvrjx4i7.js +1 -0
- package/src/web/public/assets/deleted-panel-BcbtctNF.js +1 -0
- package/src/web/public/assets/dir-B82XBb1J.js +5 -0
- package/src/web/public/assets/frontmatter-CLLxCmTv.js +2 -0
- package/src/web/public/assets/graph-BTEfvFz6.js +1 -0
- package/src/web/public/assets/group-BPUOO_QM.js +2 -0
- package/src/web/public/assets/index-D8MvtVAm.js +2 -0
- package/src/web/public/assets/index-DP3qBv1o.css +1 -0
- package/src/web/public/assets/md-history-BqZvzWiD.js +39 -0
- package/src/web/public/assets/md-parse-b6GY5eBl.js +13 -0
- package/src/web/public/assets/member-picker-B5I7KuOR.js +1 -0
- package/src/web/public/assets/model-Bn2fG6CC.js +2 -0
- package/src/web/public/assets/overview-DMihuyzh.js +1 -0
- package/src/web/public/assets/progress-D-rMgz3w.js +3 -0
- package/src/web/public/assets/prompt-blocks-BovFd039.js +8 -0
- package/src/web/public/assets/refs-D21jmrn6.js +1 -0
- package/src/web/public/assets/repos-B94tMDGs.js +15 -0
- package/src/web/public/assets/route-crumb-CWVu80du.js +1 -0
- package/src/web/public/assets/settings-DgTt4JG5.js +1 -0
- package/src/web/public/assets/status-tag-DRl9E2Os.js +1 -0
- package/src/web/public/assets/task-B2x5GoV3.js +11 -0
- package/src/web/public/assets/task-status-DSrx0i66.js +1 -0
- package/src/web/public/assets/task-utils-By8gLpHY.js +12 -0
- package/src/web/public/assets/templates-Df__0k-F.js +1 -0
- package/src/web/public/assets/tool-bar-Cv7f6p4v.js +1 -0
- package/src/web/public/assets/upload-BcMhRsMn.js +1 -0
- package/src/web/public/assets/workspace-4tw7trV7.js +28 -0
- package/src/web/public/index.html +9 -9
- package/src/core/atomic-file.js +0 -45
- package/src/core/attachmentdb/docs.js +0 -116
- package/src/core/attachmentdb/ids.js +0 -96
- package/src/core/attachmentdb/query.js +0 -189
- package/src/core/attachmentdb/relations.js +0 -170
- package/src/core/attachmentdb/resources.js +0 -225
- package/src/core/attachstore.js +0 -312
- package/src/core/db/bootstrap.js +0 -424
- package/src/core/db/driver.js +0 -359
- package/src/core/db/errors.js +0 -144
- package/src/core/db/import-json/data.js +0 -140
- package/src/core/db/import-json/extras.js +0 -69
- package/src/core/db/import-json/links.js +0 -147
- package/src/core/db/import-json/refs.js +0 -183
- package/src/core/db/import-json/repos.js +0 -180
- package/src/core/db/import-json/scan.js +0 -35
- package/src/core/db/import-json/tasks.js +0 -317
- package/src/core/db/import-json.js +0 -194
- package/src/core/db/index.js +0 -122
- package/src/core/db/migrations/index.js +0 -110
- package/src/core/db/migrations/v2-data.js +0 -149
- package/src/core/db/migrations/v4-data.js +0 -193
- package/src/core/db/migrator.js +0 -203
- package/src/core/db/seed-templates.js +0 -265
- package/src/core/db/settings.js +0 -54
- package/src/core/db/time.js +0 -96
- package/src/core/db/tx.js +0 -188
- package/src/core/db/verify.js +0 -295
- package/src/core/db/version.js +0 -65
- package/src/core/fileapi.js +0 -243
- package/src/core/frontmatter.js +0 -65
- package/src/core/fstree.js +0 -74
- package/src/core/instruction-template.js +0 -341
- package/src/core/keys.js +0 -33
- package/src/core/kvapi.js +0 -203
- package/src/core/localatt.js +0 -156
- package/src/core/prompt.js +0 -60
- package/src/core/topic-key.js +0 -43
- package/src/core/workflow/edges.js +0 -31
- package/src/core/workflow/layout.js +0 -119
- package/src/core/workflow/lifecycle.js +0 -58
- package/src/core/workflow/plugin-registry.js +0 -47
- package/src/core/workflow/project.js +0 -112
- package/src/core/workflow/readiness.js +0 -226
- package/src/core/workflow/types.js +0 -190
- package/src/core/zip.js +0 -163
- package/src/modules/auth/index.js +0 -99
- package/src/modules/bundled/index.js +0 -187
- package/src/modules/bundled/service.js +0 -312
- package/src/modules/db/index.js +0 -54
- package/src/modules/db/service.js +0 -273
- package/src/modules/docs/attach.js +0 -226
- package/src/modules/docs/brief.js +0 -125
- package/src/modules/docs/docref.js +0 -94
- package/src/modules/docs/index.js +0 -228
- package/src/modules/docs/knowledge.js +0 -520
- package/src/modules/docs/links.js +0 -43
- package/src/modules/docs/paths.js +0 -103
- package/src/modules/docs/refs.js +0 -237
- package/src/modules/docs/render.js +0 -84
- package/src/modules/docs/repos-bridge.js +0 -11
- package/src/modules/docs/seed.js +0 -147
- package/src/modules/docs/service.js +0 -204
- package/src/modules/docs/store.js +0 -231
- package/src/modules/file/index.js +0 -123
- package/src/modules/file/service.js +0 -348
- package/src/modules/localtask/action-attach.js +0 -113
- package/src/modules/localtask/action-lifecycle.js +0 -207
- package/src/modules/localtask/action-maintenance.js +0 -130
- package/src/modules/localtask/action-move.js +0 -58
- package/src/modules/localtask/action-query.js +0 -46
- package/src/modules/localtask/action-remove.js +0 -116
- package/src/modules/localtask/action-render.js +0 -200
- package/src/modules/localtask/action-submit.js +0 -186
- package/src/modules/localtask/action-topics.js +0 -46
- package/src/modules/localtask/action-waiting.js +0 -95
- package/src/modules/localtask/board-target.js +0 -161
- package/src/modules/localtask/bus/index.js +0 -41
- package/src/modules/localtask/deletion.js +0 -133
- package/src/modules/localtask/engine.js +0 -49
- package/src/modules/localtask/events.js +0 -216
- package/src/modules/localtask/index.js +0 -60
- package/src/modules/localtask/move-prims.js +0 -128
- package/src/modules/localtask/move.js +0 -165
- package/src/modules/localtask/mutator/index.js +0 -153
- package/src/modules/localtask/mutator/validate.js +0 -53
- package/src/modules/localtask/panel-guard.js +0 -155
- package/src/modules/localtask/panel-presence.js +0 -322
- package/src/modules/localtask/paths.js +0 -87
- package/src/modules/localtask/remote-import.js +0 -137
- package/src/modules/localtask/repo/goals.js +0 -153
- package/src/modules/localtask/repo/links.js +0 -136
- package/src/modules/localtask/repo/open.js +0 -71
- package/src/modules/localtask/repo/presence.js +0 -117
- package/src/modules/localtask/repo/rows.js +0 -162
- package/src/modules/localtask/repo/settings.js +0 -384
- package/src/modules/localtask/repo/snapshot.js +0 -154
- package/src/modules/localtask/repo/tasks.js +0 -374
- package/src/modules/localtask/repo/topics.js +0 -293
- package/src/modules/localtask/repo-ctx.js +0 -23
- package/src/modules/localtask/scheduler/index.js +0 -55
- package/src/modules/localtask/scheduler/state-drive.js +0 -30
- package/src/modules/localtask/service.js +0 -62
- package/src/modules/localtask/store/file-adapter.js +0 -51
- package/src/modules/localtask/store/index.js +0 -99
- package/src/modules/localtask/store/memory-adapter.js +0 -26
- package/src/modules/localtask/store-io.js +0 -71
- package/src/modules/localtask/task-lifecycle.js +0 -448
- package/src/modules/localtask/task-ops.js +0 -444
- package/src/modules/localtask/task-remove.js +0 -313
- package/src/modules/localtask/task-templates.js +0 -84
- package/src/modules/localtask/task-view.js +0 -446
- package/src/modules/localtask/topics.js +0 -170
- package/src/modules/localtask/waiters.js +0 -63
- package/src/modules/localtask/waiting.js +0 -73
- package/src/modules/localtask/writes.js +0 -130
- package/src/modules/repos/boards/core.js +0 -255
- package/src/modules/repos/boards/docs.js +0 -53
- package/src/modules/repos/boards/members.js +0 -228
- package/src/modules/repos/boards/transfer.js +0 -159
- package/src/modules/repos/cli/board-actions.js +0 -177
- package/src/modules/repos/cli/ref-actions.js +0 -157
- package/src/modules/repos/cli/remote-actions.js +0 -141
- package/src/modules/repos/cli/render.js +0 -168
- package/src/modules/repos/cli/repo-actions.js +0 -199
- package/src/modules/repos/cli/transfer-actions.js +0 -105
- package/src/modules/repos/git.js +0 -0
- package/src/modules/repos/index.js +0 -47
- package/src/modules/repos/keys.js +0 -221
- package/src/modules/repos/ref-backfill.js +0 -172
- package/src/modules/repos/ref.js +0 -535
- package/src/modules/repos/remote.js +0 -175
- package/src/modules/repos/repo/open.js +0 -84
- package/src/modules/repos/repo/refs.js +0 -165
- package/src/modules/repos/repo/repos.js +0 -213
- package/src/modules/repos/repo/rows.js +0 -178
- package/src/modules/repos/service/bind-topics.js +0 -97
- package/src/modules/repos/service/context.js +0 -189
- package/src/modules/repos/service/crud.js +0 -345
- package/src/modules/repos/service/identity.js +0 -188
- package/src/modules/repos/service/store.js +0 -274
- package/src/modules/repos/transfer/diff.js +0 -126
- package/src/modules/repos/transfer/export.js +0 -223
- package/src/modules/repos/transfer/import.js +0 -377
- package/src/modules/repos/transfer/layout.js +0 -135
- package/src/modules/repos/transfer/render.js +0 -72
- package/src/modules/setting/index.js +0 -34
- package/src/modules/setting/service.js +0 -58
- package/src/modules/tasktool/add.js +0 -107
- package/src/modules/tasktool/attach-resource.js +0 -296
- package/src/modules/tasktool/attach-template.js +0 -266
- package/src/modules/tasktool/attach.js +0 -451
- package/src/modules/tasktool/delivery-template.js +0 -213
- package/src/modules/tasktool/delivery-text.js +0 -28
- package/src/modules/tasktool/doc-inline.js +0 -84
- package/src/modules/tasktool/facade/get.js +0 -46
- package/src/modules/tasktool/facade/submit.js +0 -49
- package/src/modules/tasktool/get.js +0 -38
- package/src/modules/tasktool/group-store.js +0 -28
- package/src/modules/tasktool/groupctx.js +0 -124
- package/src/modules/tasktool/index.js +0 -250
- package/src/modules/tasktool/panel-escort.js +0 -121
- package/src/modules/tasktool/params.js +0 -34
- package/src/modules/tasktool/plugins/base.js +0 -92
- package/src/modules/tasktool/plugins/blockgoal.js +0 -23
- package/src/modules/tasktool/plugins/container.js +0 -47
- package/src/modules/tasktool/plugins/discover.js +0 -45
- package/src/modules/tasktool/plugins/goal-template.js +0 -86
- package/src/modules/tasktool/plugins/runtime.js +0 -69
- package/src/modules/tasktool/plugins/taskgoal-store.js +0 -160
- package/src/modules/tasktool/plugins/taskgoal.js +0 -17
- package/src/modules/tasktool/plugins/timegoal-core-store.js +0 -151
- package/src/modules/tasktool/plugins/timegoal-cwd-store.js +0 -438
- package/src/modules/tasktool/plugins/timegoal-store.js +0 -81
- package/src/modules/tasktool/plugins/timegoal-task-store.js +0 -323
- package/src/modules/tasktool/plugins/timegoal.js +0 -51
- package/src/modules/tasktool/plugins/waitgoal-config.js +0 -84
- package/src/modules/tasktool/plugins/waitgoal.js +0 -75
- package/src/modules/tasktool/preview.js +0 -91
- package/src/modules/tasktool/system-blocks.js +0 -78
- package/src/modules/tasktool/update.js +0 -70
- package/src/modules/tasktool/wait.js +0 -532
- package/src/modules/templates/index.js +0 -189
- package/src/modules/templates/repo/open.js +0 -65
- package/src/modules/templates/repo/templates.js +0 -155
- package/src/modules/templates/scope.js +0 -107
- package/src/modules/templates/service.js +0 -311
- package/src/modules/todo/attachments.js +0 -149
- package/src/modules/todo/group.js +0 -194
- package/src/modules/todo/index.js +0 -365
- package/src/modules/todo/locate.js +0 -82
- package/src/modules/todo/service.js +0 -381
- package/src/modules/todo/store.js +0 -158
- package/src/shared/attach.js +0 -96
- package/src/shared/doc-title.js +0 -71
- package/src/shared/feedback-text.js +0 -245
- package/src/shared/frontmatter.js +0 -107
- package/src/shared/graph.js +0 -40
- package/src/shared/prompt-blocks.js +0 -374
- package/src/shared/repo-key.js +0 -57
- package/src/shared/task-status.js +0 -105
- package/src/shared/wikilink.js +0 -64
- package/src/web/frontend/App.jsx +0 -530
- package/src/web/frontend/api/client.js +0 -39
- package/src/web/frontend/app-context.jsx +0 -13
- package/src/web/frontend/components/Introduction/docs-modal.jsx +0 -306
- package/src/web/frontend/components/Introduction/index.jsx +0 -62
- package/src/web/frontend/components/Introduction/rail.jsx +0 -141
- package/src/web/frontend/components/Introduction/use-intro.js +0 -225
- package/src/web/frontend/components/board/member-picker.jsx +0 -262
- package/src/web/frontend/components/button/index.jsx +0 -118
- package/src/web/frontend/components/cloud/editor.jsx +0 -229
- package/src/web/frontend/components/cloud/group-popup.jsx +0 -173
- package/src/web/frontend/components/cloud/markdown.jsx +0 -53
- package/src/web/frontend/components/cloud/upload.js +0 -108
- package/src/web/frontend/components/doc/doc-head.jsx +0 -226
- package/src/web/frontend/components/icons.jsx +0 -176
- package/src/web/frontend/components/layout/breadcrumb.jsx +0 -49
- package/src/web/frontend/components/layout/crumbs.js +0 -132
- package/src/web/frontend/components/layout/route-crumb.jsx +0 -33
- package/src/web/frontend/components/layout/route-history.js +0 -27
- package/src/web/frontend/components/layout/side-resizer.jsx +0 -102
- package/src/web/frontend/components/layout/tabs.jsx +0 -58
- package/src/web/frontend/components/md/ack-rail.jsx +0 -273
- package/src/web/frontend/components/md/attach-area.jsx +0 -366
- package/src/web/frontend/components/md/attach-bar.jsx +0 -25
- package/src/web/frontend/components/md/attach-common.js +0 -108
- package/src/web/frontend/components/md/attach-modal.jsx +0 -429
- package/src/web/frontend/components/md/attach-picker.jsx +0 -304
- package/src/web/frontend/components/md/attachments.js +0 -106
- package/src/web/frontend/components/md/composer-launch.js +0 -68
- package/src/web/frontend/components/md/composer-panel.jsx +0 -354
- package/src/web/frontend/components/md/find-bar.jsx +0 -38
- package/src/web/frontend/components/md/live-block.jsx +0 -129
- package/src/web/frontend/components/md/md-panes-helpers.js +0 -95
- package/src/web/frontend/components/md/md-panes-keys.js +0 -193
- package/src/web/frontend/components/md/md-panes-root.jsx +0 -158
- package/src/web/frontend/components/md/md-panes.jsx +0 -471
- package/src/web/frontend/components/md/sel-menu.jsx +0 -88
- package/src/web/frontend/components/md/shortcut-sheet.jsx +0 -60
- package/src/web/frontend/components/md/slash-menu.jsx +0 -83
- package/src/web/frontend/components/md/status-bar.jsx +0 -46
- package/src/web/frontend/components/md/task-chain.jsx +0 -72
- package/src/web/frontend/components/md/template-editor.jsx +0 -120
- package/src/web/frontend/components/md/tool-bar.jsx +0 -262
- package/src/web/frontend/components/md/use-live-preview.js +0 -279
- package/src/web/frontend/components/md/use-slash-menu.js +0 -80
- package/src/web/frontend/components/md/use-source-editor.js +0 -297
- package/src/web/frontend/components/migrate/dialog.jsx +0 -90
- package/src/web/frontend/components/migrate/undo.jsx +0 -58
- package/src/web/frontend/components/migrate/use-move.js +0 -86
- package/src/web/frontend/components/pager.jsx +0 -71
- package/src/web/frontend/components/popup/dismiss.js +0 -32
- package/src/web/frontend/components/popup/index.jsx +0 -270
- package/src/web/frontend/components/repos/desc-modal.jsx +0 -250
- package/src/web/frontend/components/repos/get-loop-modal.jsx +0 -181
- package/src/web/frontend/components/repos/transfer-panel.jsx +0 -450
- package/src/web/frontend/components/sidebar/drag.js +0 -70
- package/src/web/frontend/components/sidebar/index.jsx +0 -362
- package/src/web/frontend/components/sidebar/model.js +0 -193
- package/src/web/frontend/components/sidebar/panel.jsx +0 -195
- package/src/web/frontend/components/sidebar/queue-nav.js +0 -40
- package/src/web/frontend/components/sidebar/rescue-fab.jsx +0 -78
- package/src/web/frontend/components/sidebar/row-menu.jsx +0 -103
- package/src/web/frontend/components/sidebar/side-state.js +0 -49
- package/src/web/frontend/components/sidebar/task-children.jsx +0 -89
- package/src/web/frontend/components/status-tag/index.jsx +0 -30
- package/src/web/frontend/components/status-tag/model.js +0 -53
- package/src/web/frontend/components/task-panel/index.jsx +0 -36
- package/src/web/frontend/components/task-panel/layout.jsx +0 -64
- package/src/web/frontend/components/task-panel/page-shell.jsx +0 -38
- package/src/web/frontend/components/task-panel/task-row.jsx +0 -170
- package/src/web/frontend/components/toast/index.jsx +0 -40
- package/src/web/frontend/components/tool-acts/bar.jsx +0 -156
- package/src/web/frontend/components/tool-acts/dnd.js +0 -59
- package/src/web/frontend/components/tool-acts/layout-panel.jsx +0 -289
- package/src/web/frontend/components/tool-acts/modules.js +0 -188
- package/src/web/frontend/components/tool-acts/use-layout.js +0 -27
- package/src/web/frontend/components/ui.jsx +0 -95
- package/src/web/frontend/main.jsx +0 -19
- package/src/web/frontend/modules/board/ack-nodes.js +0 -137
- package/src/web/frontend/modules/board/ack-rail-pos.js +0 -50
- package/src/web/frontend/modules/board/board-view.js +0 -255
- package/src/web/frontend/modules/board/reopen-text.js +0 -80
- package/src/web/frontend/modules/md/attach-mention.js +0 -59
- package/src/web/frontend/modules/md/doc-store.js +0 -78
- package/src/web/frontend/modules/md/lightbox.js +0 -97
- package/src/web/frontend/modules/md/md-blocks.js +0 -248
- package/src/web/frontend/modules/md/md-edit-ops.js +0 -367
- package/src/web/frontend/modules/md/md-history.js +0 -79
- package/src/web/frontend/modules/md/md-parse.js +0 -122
- package/src/web/frontend/modules/md/md-render.js +0 -281
- package/src/web/frontend/modules/md/progress-chain.js +0 -29
- package/src/web/frontend/modules/md/progress-search.js +0 -110
- package/src/web/frontend/modules/md/use-templates.js +0 -143
- package/src/web/frontend/modules/prompts/placeholders.js +0 -85
- package/src/web/frontend/modules/prompts/prompt-editor.jsx +0 -154
- package/src/web/frontend/page/cloud/index.jsx +0 -476
- package/src/web/frontend/page/dag/edges.js +0 -55
- package/src/web/frontend/page/dag/head-bar.jsx +0 -46
- package/src/web/frontend/page/dag/index.jsx +0 -497
- package/src/web/frontend/page/dag/layout.js +0 -83
- package/src/web/frontend/page/dag/model.js +0 -47
- package/src/web/frontend/page/dag/node-card.jsx +0 -123
- package/src/web/frontend/page/dag/use-interactions.js +0 -135
- package/src/web/frontend/page/dir/dag-editor.jsx +0 -171
- package/src/web/frontend/page/dir/deleted-panel.jsx +0 -63
- package/src/web/frontend/page/dir/index.jsx +0 -540
- package/src/web/frontend/page/dir/landing.jsx +0 -365
- package/src/web/frontend/page/dir/task-ack.js +0 -38
- package/src/web/frontend/page/dir/task-actions.js +0 -387
- package/src/web/frontend/page/dir/task-beside-header.jsx +0 -18
- package/src/web/frontend/page/dir/task-board-section.jsx +0 -38
- package/src/web/frontend/page/dir/task-chain.js +0 -172
- package/src/web/frontend/page/dir/task-derived-ctx.js +0 -46
- package/src/web/frontend/page/dir/task-dock-panel.jsx +0 -227
- package/src/web/frontend/page/dir/task-dock.js +0 -79
- package/src/web/frontend/page/dir/task-feedback.js +0 -207
- package/src/web/frontend/page/dir/task-goal-section.jsx +0 -55
- package/src/web/frontend/page/dir/task-goal.js +0 -41
- package/src/web/frontend/page/dir/task-history-view.jsx +0 -44
- package/src/web/frontend/page/dir/task-not-found.jsx +0 -23
- package/src/web/frontend/page/dir/task-preview-modal.jsx +0 -82
- package/src/web/frontend/page/dir/task-sel-menu.js +0 -54
- package/src/web/frontend/page/dir/task-status-bar.jsx +0 -61
- package/src/web/frontend/page/dir/task-utils.js +0 -7
- package/src/web/frontend/page/dir/task.jsx +0 -540
- package/src/web/frontend/page/doc/index.jsx +0 -554
- package/src/web/frontend/page/group/index.jsx +0 -603
- package/src/web/frontend/page/overview/index.jsx +0 -295
- package/src/web/frontend/page/progress/index.jsx +0 -480
- package/src/web/frontend/page/refs/index.jsx +0 -122
- package/src/web/frontend/page/repos/bind-modals.jsx +0 -118
- package/src/web/frontend/page/repos/board-admin.jsx +0 -226
- package/src/web/frontend/page/repos/board-refs.jsx +0 -97
- package/src/web/frontend/page/repos/doc-search-modal.jsx +0 -241
- package/src/web/frontend/page/repos/filters-bar.jsx +0 -44
- package/src/web/frontend/page/repos/index.jsx +0 -586
- package/src/web/frontend/page/repos/pending-section.jsx +0 -163
- package/src/web/frontend/page/repos/ref-panel.jsx +0 -406
- package/src/web/frontend/page/repos/remote-modal.jsx +0 -112
- package/src/web/frontend/page/repos/repo-form-modal.jsx +0 -219
- package/src/web/frontend/page/repos/repo-table.jsx +0 -222
- package/src/web/frontend/page/settings/index.jsx +0 -224
- package/src/web/frontend/page/settings/prompt-template-params.js +0 -286
- package/src/web/frontend/page/settings/prompt-templates-section.jsx +0 -427
- package/src/web/frontend/page/settings/sidebar-section.jsx +0 -72
- package/src/web/frontend/page/settings/task-templates-section.jsx +0 -115
- package/src/web/frontend/page/templates/index.jsx +0 -253
- package/src/web/frontend/page/templates/scope-chips.jsx +0 -211
- package/src/web/frontend/panels.jsx +0 -230
- package/src/web/frontend/prefs.js +0 -73
- package/src/web/frontend/registry.js +0 -27
- package/src/web/frontend/route-map.js +0 -209
- package/src/web/frontend/store.jsx +0 -74
- package/src/web/frontend/workspace/areas.js +0 -59
- package/src/web/frontend/workspace/layout.js +0 -399
- package/src/web/frontend/workspace/open.js +0 -246
- package/src/web/frontend/workspace/panels.js +0 -417
- package/src/web/public/assets/Introduction-BI8Ohz1l.js +0 -6
- package/src/web/public/assets/app-context-D7HAx67n.js +0 -1
- package/src/web/public/assets/bar-Jfji2mz3.js +0 -1
- package/src/web/public/assets/board-view-CZKZsyk-.js +0 -1
- package/src/web/public/assets/button-Cmo-6aoW.js +0 -1
- package/src/web/public/assets/cloud-cFewR3CF.js +0 -3
- package/src/web/public/assets/composer-launch-Bf4rXhLs.js +0 -1
- package/src/web/public/assets/composer-panel-CcK0D4Gd.js +0 -1
- package/src/web/public/assets/dag-BBtSqd-X.js +0 -1
- package/src/web/public/assets/deleted-panel-oN8YlGvq.js +0 -1
- package/src/web/public/assets/dir-BuAtw08k.js +0 -5
- package/src/web/public/assets/frontmatter-QvrjUNzF.js +0 -2
- package/src/web/public/assets/graph-DM-zDRdL.js +0 -1
- package/src/web/public/assets/group-FRUv4mQ6.js +0 -2
- package/src/web/public/assets/index-CyF6nNWE.js +0 -2
- package/src/web/public/assets/index-DGvBoOdp.css +0 -1
- package/src/web/public/assets/md-history-DErcpXhC.js +0 -39
- package/src/web/public/assets/md-parse-awNLHAzO.js +0 -13
- package/src/web/public/assets/member-picker-BAgkj36N.js +0 -1
- package/src/web/public/assets/model-DzdWfp14.js +0 -2
- package/src/web/public/assets/overview-DZHcrz4u.js +0 -1
- package/src/web/public/assets/progress-Bx0reVYl.js +0 -3
- package/src/web/public/assets/refs-BXIwmL5W.js +0 -1
- package/src/web/public/assets/reopen-text-BylkngqC.js +0 -12
- package/src/web/public/assets/repos-DYugJZpl.js +0 -15
- package/src/web/public/assets/route-crumb-C3Ce0rzR.js +0 -1
- package/src/web/public/assets/settings-Bpazt87u.js +0 -8
- package/src/web/public/assets/status-tag-CHCpOgMP.js +0 -1
- package/src/web/public/assets/task-G58spmPC.js +0 -11
- package/src/web/public/assets/task-status-BnymQMTw.js +0 -1
- package/src/web/public/assets/templates-Dr0CunY8.js +0 -1
- package/src/web/public/assets/tool-bar-BSIlsHln.js +0 -1
- package/src/web/public/assets/upload-BIMbGcCB.js +0 -1
- package/src/web/public/assets/workspace-C_5X2gIr.js +0 -28
- /package/src/core/{attachmentdb.js → attachmentdb.ts} +0 -0
- /package/src/core/db/{quiet.js → quiet.ts} +0 -0
- /package/src/core/workflow/{event-names.js → event-names.ts} +0 -0
- /package/src/modules/localtask/{action-flags.js → action-flags.ts} +0 -0
- /package/src/modules/localtask/{dag.js → dag.ts} +0 -0
- /package/src/modules/localtask/repo/{index.js → index.ts} +0 -0
- /package/src/modules/localtask/store/{topic-adapter.js → topic-adapter.ts} +0 -0
- /package/src/modules/repos/{boards.js → boards.ts} +0 -0
- /package/src/modules/repos/repo/{index.js → index.ts} +0 -0
- /package/src/modules/repos/{service.js → service.ts} +0 -0
- /package/src/modules/repos/{transfer.js → transfer.ts} +0 -0
- /package/src/modules/tasktool/facade/{index.js → index.ts} +0 -0
- /package/src/modules/tasktool/facade/{wait.js → wait.ts} +0 -0
- /package/src/modules/tasktool/{getloop.js → getloop.ts} +0 -0
- /package/src/modules/tasktool/plugins/{index.js → index.ts} +0 -0
- /package/src/modules/tasktool/{taskgoal.js → taskgoal.ts} +0 -0
- /package/src/modules/tasktool/{timegoal.js → timegoal.ts} +0 -0
- /package/src/modules/templates/repo/{index.js → index.ts} +0 -0
- /package/src/web/frontend/components/md/{doc-outline-rail.jsx → doc-outline-rail.tsx} +0 -0
- /package/src/web/frontend/{workspace.js → workspace.ts} +0 -0
- /package/src/web/public/assets/{button-DA4lNJeC.css → prompt-blocks-DA4lNJeC.css} +0 -0
|
@@ -1,446 +0,0 @@
|
|
|
1
|
-
// (#54 自 service.js 拆出)任务行/主题的只读视图与队列内关系原语:
|
|
2
|
-
// normalizeTask(含 ready 徽标)、topicView、跨队列依赖解析器(foreignResolver)、
|
|
3
|
-
// 队列内关系清单(queueRelationsOf)与搬家(relocateTask)。
|
|
4
|
-
import { badInput, notFound } from '../../core/errors.js';
|
|
5
|
-
import { sanitizeTaskGoal } from '../tasktool/taskgoal.js';
|
|
6
|
-
import { normalizeBlockBy, isReadyToClaim } from './dag.js';
|
|
7
|
-
import { isGlobalKey, topicKeyFor, resolveTaskKey } from './paths.js';
|
|
8
|
-
import { parseStampMs, stampNow } from './store-io.js';
|
|
9
|
-
import { topics as topicsRepo, tasks as tasksRepo, links as linksRepo, db } from './repo/index.js';
|
|
10
|
-
import { parseFrontmatter } from '../../shared/frontmatter.js';
|
|
11
|
-
import { isPending } from '../../shared/task-status.js';
|
|
12
|
-
// 领取耗时(秒):**发布 → 被领取**的时间差。
|
|
13
|
-
// 数据本来就在(createdAt / consumedAt),这里算成派生字段,省得每个使用方自己算,
|
|
14
|
-
// 也省得存一份会漂移的冗余副本。
|
|
15
|
-
// 只有真的被领走的才有值;还没被领的返回 null(那是"还在等",由使用方按当前时间算)。
|
|
16
|
-
function pickupSecOf(t) {
|
|
17
|
-
// 不再按 status 判:没被领过的行 consumedAt 本来就是空串,parseStampMs 会返回 NaN。
|
|
18
|
-
// (以前这里靠「status 是 consumed 或 archived」当闸门 —— 词表一改就成了第二个真值源。)
|
|
19
|
-
if (!t) return null;
|
|
20
|
-
const created = parseStampMs(t.createdAt);
|
|
21
|
-
const consumed = parseStampMs(t.consumedAt);
|
|
22
|
-
if (!Number.isFinite(created) || !Number.isFinite(consumed)) return null;
|
|
23
|
-
return Math.max(0, Math.round((consumed - created) / 1000));
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
// 跨队列依赖引用("topicKey:id")是**绝对地址**——任务搬家后依然有效;
|
|
27
|
-
// 本地数字 id 是**队列内相对地址**——搬走就断了。队列内语义的判定全靠这条分界。
|
|
28
|
-
const isForeignDep = (d) => typeof d === 'string' && d.includes(':');
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* 队列内语义的关系清单(跨队列搬任务搬不动的那些):
|
|
32
|
-
* - 自己的上游依赖(本地 id)
|
|
33
|
-
* - 自己是闸门(挡本队列后续任务)
|
|
34
|
-
* - 被本队列其他任务依赖(本地 id)
|
|
35
|
-
* 外来引用("topicKey:id")是绝对的,搬家后依然成立,不算 blocker。
|
|
36
|
-
*/
|
|
37
|
-
export function queueRelationsOf(topic, task) {
|
|
38
|
-
const rel = [];
|
|
39
|
-
const self = Number(task.id);
|
|
40
|
-
const localDeps = (task.blockBy || []).filter((d) => !isForeignDep(d) && Number(d) > 0);
|
|
41
|
-
if (localDeps.length) rel.push(`上游依赖 #${localDeps.map((d) => Number(d)).join(', #')}`);
|
|
42
|
-
if (task.blocksFollowing) rel.push('它是闸门(挡住本队列后续任务)');
|
|
43
|
-
const dependents = (topic.tasks || []).filter(
|
|
44
|
-
(x) => x !== task && !x.deletedAt && (x.blockBy || []).some((d) => !isForeignDep(d) && Number(d) === self),
|
|
45
|
-
);
|
|
46
|
-
if (dependents.length) rel.push(`被 #${dependents.map((x) => x.id).join(', #')} 依赖`);
|
|
47
|
-
return rel;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* 把任务行从源主题搬进目标主题(改归属项目 = 换队列,归属决定落点)。
|
|
52
|
-
* 同一主题 → 原样返回 null(不搬)。**必须在调用方的事务里**(updateTask 的搬家
|
|
53
|
-
* 与正文/时间目标写入是同一次落盘 —— repo 方法嵌套进外层 tx 自动降级 SAVEPOINT)。
|
|
54
|
-
*
|
|
55
|
-
* 引用修复:源队列里指向它的本地 id 依赖已被上游拒绝;跨队列引用(含源队列其他
|
|
56
|
-
* 任务对它的 "fromKey:oldSeq")在搬完统改写到新地址,编排连线不断。
|
|
57
|
-
* 撞号时目标队列按其 next_seq 重新编号(与 JSON 时代 nextTaskId 重编号一致)。
|
|
58
|
-
*/
|
|
59
|
-
/**
|
|
60
|
-
* 搬队列(T04 派生模型):旧任务软删 + cancelled;目标队列派生新任务
|
|
61
|
-
* (目标队列新 seq、进目标 order 数组尾),链 type='reopen' + ext_move_from
|
|
62
|
-
* 标记"这是搬队列不是真 reopen"。返回值同时带旧号与新号。
|
|
63
|
-
*
|
|
64
|
-
* 必须在调用方的事务里(updateTask 的搬家与正文/时间目标写入是同一次落盘)。
|
|
65
|
-
* 引用修复:本地 id 依赖在搬前已被守卫拒绝;跨队列引用(含指向旧地址的
|
|
66
|
-
* "fromKey:oldSeq")在搬完统改写到新地址。
|
|
67
|
-
*/
|
|
68
|
-
export function relocateTask(fromTopic, seq, moveTo) {
|
|
69
|
-
const toCwd = String(moveTo?.cwd || '').trim();
|
|
70
|
-
if (!toCwd) return null;
|
|
71
|
-
const toKey = topicKeyFor(toCwd);
|
|
72
|
-
if (toKey === fromTopic.key) return null;
|
|
73
|
-
const target = topicsRepo.ensureTopic(toKey, { cwd: toCwd, name: moveTo.name || '' });
|
|
74
|
-
const oldSeq = Number(seq);
|
|
75
|
-
const src = tasksRepo.getTaskRow(fromTopic.id, oldSeq);
|
|
76
|
-
if (!src) return null;
|
|
77
|
-
|
|
78
|
-
// 1. 派生新任务到目标队列(新 seq 由事务内 takeSeq 分配;round/正文/timegoal 跟着走)
|
|
79
|
-
const inserted = tasksRepo.insertTask(target.id, {
|
|
80
|
-
text: src.task.text,
|
|
81
|
-
status: src.task.status,
|
|
82
|
-
round: Number(src.task.reopenCount) + 1, // round 不变(搬队列不是新一轮)
|
|
83
|
-
fromSrc: src.task.from || '',
|
|
84
|
-
timegoal: src.task.timegoal || null,
|
|
85
|
-
createdAt: src.task.createdAt,
|
|
86
|
-
consumedAt: src.task.consumedAt || '',
|
|
87
|
-
completedAt: src.task.completedAt || '',
|
|
88
|
-
roundSummary: src.task.roundSummary || '',
|
|
89
|
-
moveFrom: { key: fromTopic.key, seq: oldSeq, at: stampNow() },
|
|
90
|
-
blocksFollowing: !!src.task.blocksFollowing,
|
|
91
|
-
blockBy: (src.task.blockBy || []).filter((d) => String(d).includes(':')).map(String),
|
|
92
|
-
});
|
|
93
|
-
const newId = inserted.id;
|
|
94
|
-
|
|
95
|
-
// 2. 源任务软删 + cancelled(tombstone:留一行"搬去哪了"的记录)
|
|
96
|
-
tasksRepo.updateTask(fromTopic.id, oldSeq, {
|
|
97
|
-
deletedAt: stampNow(),
|
|
98
|
-
status: 'cancelled',
|
|
99
|
-
moveFrom: { key: toKey, seq: newId, at: stampNow() },
|
|
100
|
-
});
|
|
101
|
-
|
|
102
|
-
// 3. 链:新 → 旧,type='reopen'(搬队列是派生的特例)
|
|
103
|
-
linksRepo.addLink({
|
|
104
|
-
srcId: Number(
|
|
105
|
-
(db().get('SELECT id FROM tasks WHERE topic_id = :t AND seq = :s', {
|
|
106
|
-
t: target.id,
|
|
107
|
-
s: newId,
|
|
108
|
-
}) || {}).id
|
|
109
|
-
),
|
|
110
|
-
dstId: src.row.id,
|
|
111
|
-
type: 'reopen',
|
|
112
|
-
note: 'moved to ' + toKey,
|
|
113
|
-
atMs: Date.now(),
|
|
114
|
-
});
|
|
115
|
-
|
|
116
|
-
// 4. 跨队列引用改写:指向旧地址的 "fromKey:oldSeq" → 新地址
|
|
117
|
-
for (const row of db().all('SELECT topic_id FROM tasks WHERE ext LIKE :pat', {
|
|
118
|
-
pat: '%' + fromTopic.key + ':' + oldSeq + '%',
|
|
119
|
-
})) {
|
|
120
|
-
for (const other of tasksRepo.listTaskRowsByTopic(Number(row.topic_id))) {
|
|
121
|
-
if (!Array.isArray(other.task.blockBy) || !other.task.blockBy.some((d) => String(d).includes(':'))) continue;
|
|
122
|
-
const from = fromTopic.key + ':' + oldSeq;
|
|
123
|
-
const to = toKey + ':' + newId;
|
|
124
|
-
if (!other.task.blockBy.some((d) => String(d) === from)) continue;
|
|
125
|
-
tasksRepo.updateTask(Number(row.topic_id), other.task.id, {
|
|
126
|
-
blockBy: other.task.blockBy.map((d) => (String(d) === from ? to : d)),
|
|
127
|
-
});
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
// 5. 队列顺序:源摘除、目标追加
|
|
132
|
-
topicsRepo.mutateOrder(fromTopic.key, (order) => order.filter((x) => x !== oldSeq));
|
|
133
|
-
topicsRepo.mutateOrder(toKey, (order) => {
|
|
134
|
-
const list = [...order];
|
|
135
|
-
const at = list.indexOf(newId);
|
|
136
|
-
if (at >= 0) list.splice(at, 1);
|
|
137
|
-
list.push(newId);
|
|
138
|
-
return list;
|
|
139
|
-
});
|
|
140
|
-
|
|
141
|
-
topicsRepo.updateTopic(fromTopic.key, { bumpRevision: true });
|
|
142
|
-
topicsRepo.updateTopic(toKey, { bumpRevision: true });
|
|
143
|
-
return {
|
|
144
|
-
topic: topicsRepo.getTopic(toKey),
|
|
145
|
-
task: tasksRepo.getTaskRow(target.id, newId).task,
|
|
146
|
-
oldId: oldSeq,
|
|
147
|
-
newId,
|
|
148
|
-
};
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
/** 跨队列 blockBy 解析:按 topicKey 找任务(已删/迁出走 null → fail-open)。
|
|
152
|
-
* T03:直接查库(不喂 store 快照)—— 依赖判定永远看最新一行。 */
|
|
153
|
-
export function foreignResolver() {
|
|
154
|
-
return (topicKey, taskId) => {
|
|
155
|
-
const topic = topicsRepo.getTopic(String(topicKey));
|
|
156
|
-
if (!topic) return null;
|
|
157
|
-
const task = (topic.tasks || []).find((x) => Number(x.id) === Number(taskId));
|
|
158
|
-
if (!task || task.deletedAt || task.migratedTo) return null;
|
|
159
|
-
return task;
|
|
160
|
-
};
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
// 组任务标注(#85 两种走向):正文 frontmatter 的 board 值——项目组「+ 新增任务」
|
|
164
|
-
// 预写、CLI add --board 落下来的都算。**物理队列不变**(agent 按项目目录领取照旧);
|
|
165
|
-
// 面板据此把组任务从**项目走向**的列表与计数里分流出去,组页仍按 board 归属认领。
|
|
166
|
-
// parseFrontmatter 不抛错(无块/坏块都回空对象),没有 board → ''(= 纯项目任务)。
|
|
167
|
-
function boardMarkOf(t) {
|
|
168
|
-
const fm = parseFrontmatter(String(t.text ?? ''));
|
|
169
|
-
return fm.board ? String(fm.board).trim() : '';
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
export function normalizeTask(t, siblings, readyOpts = {}) {
|
|
173
|
-
const blockBy = normalizeBlockBy(t.blockBy, t.id);
|
|
174
|
-
const blocksFollowing = !!t.blocksFollowing;
|
|
175
|
-
const base = {
|
|
176
|
-
id: Number(t.id) || 0,
|
|
177
|
-
text: String(t.text ?? ''),
|
|
178
|
-
// 状态词表:pending / claimed / done / cancelled(权威见 src/shared/task-status.js)。
|
|
179
|
-
// **不认识的词原样透出**,不做「归一成 pending」的兜底 —— 兜底等于把没见过的状态
|
|
180
|
-
// 变成可领取任务(agent 会把已交付的活儿再干一遍)。旧词(consumed/archived)在
|
|
181
|
-
// 过渡期会原样出现,跑一次 scripts/rewrite-json-status.mjs 即可消除。
|
|
182
|
-
status: String(t.status ?? '') || 'pending',
|
|
183
|
-
roundSummary: String(t.roundSummary ?? ''),
|
|
184
|
-
createdAt: String(t.createdAt ?? ''),
|
|
185
|
-
consumedAt: String(t.consumedAt ?? ''),
|
|
186
|
-
// 领取耗时:从发布到被领取过了多久(秒)。还没被领的是 null。
|
|
187
|
-
pickupSec: pickupSecOf(t),
|
|
188
|
-
// 领取审计:这条**从哪个池**被领走(local/global)、**被谁**领走(领取方的目录)。
|
|
189
|
-
claimedFrom: String(t.claimedFrom ?? ''),
|
|
190
|
-
claimedBy: String(t.claimedBy ?? ''),
|
|
191
|
-
claimedByName: String(t.claimedByName ?? ''),
|
|
192
|
-
// 软删除标记:删除不再不可逆(可 restore 回来)。词汇与同仓 timegoal 对齐
|
|
193
|
-
// (那边叫 archivedAt + 保留期 + purge)。
|
|
194
|
-
deletedAt: String(t.deletedAt ?? ''),
|
|
195
|
-
// 来源标记:云端清单迁入的任务带 'cloud'(面板据此渲染「来自云端」徽标)
|
|
196
|
-
from: String(t.from ?? ''),
|
|
197
|
-
// 组任务标注(#85):frontmatter.board 原样(面板创建写 board id,也可能有
|
|
198
|
-
// 手写 key/name);'' = 纯项目任务。分流判据只在标注,不重复解析正文。
|
|
199
|
-
boardMark: boardMarkOf(t),
|
|
200
|
-
// 迁出标记:本机 → 云端迁移后原条目保留在此,作为 tombstone(可撤销/移除)。
|
|
201
|
-
// 带 migratedTo 的任务**不再算待领取**(不会被派发给 agent,也不再进看板的
|
|
202
|
-
// 待领取列)——它只是一条「去哪了」的记录。结构 {side:'cloud', topic, targetId, at}。
|
|
203
|
-
migratedTo: t.migratedTo && typeof t.migratedTo === 'object' ? t.migratedTo : null,
|
|
204
|
-
// 任务级 timegoal 声明(add --duration/--goal-prompt 落下来的):
|
|
205
|
-
// { duration: '2h'(人类写法原文), prompt: '发布方附加要求' }。领取时刻起表
|
|
206
|
-
// (起点 = consumedAt,goal 落 timegoals.json 的任务维度),交付文本里带 check 指令。
|
|
207
|
-
timegoal: sanitizeTaskGoal(t.timegoal),
|
|
208
|
-
// 完成标记(localtask done 写入):带时间目标的任务未到点会被拒绝,写不进来。
|
|
209
|
-
completedAt: String(t.completedAt ?? ''),
|
|
210
|
-
// ─── 过渡别名(T03 之后删除)───────────────────────────────────────
|
|
211
|
-
// 词表统一后「交付完成」的规范叫法是 doneAt + feedback(库里是 done_at / feedback)。
|
|
212
|
-
// JSON 过渡期这两个字段还是 completedAt / roundSummary,这里给同一事实补上规范名,
|
|
213
|
-
// 让 API 使用方不必再记两套名字;**写路径只有旧名**,别名只读。
|
|
214
|
-
doneAt: String(t.completedAt ?? ''),
|
|
215
|
-
feedback: String(t.roundSummary ?? ''),
|
|
216
|
-
// 重开轨迹(#74):就地重开,历史进 history[];forkOf 仅兼容旧 #59/#69 派生数据。
|
|
217
|
-
// history 同任务内的链节点(origin / reopen / comment),点开可旁路查看
|
|
218
|
-
// forkOf 旧派生链('队列key:旧编号')——新 reopen 不再写
|
|
219
|
-
// forkKind 最近一次事件种类(reopen / comment),或旧派生种类
|
|
220
|
-
// supersededBy / archived* 旧归档残留字段
|
|
221
|
-
// 被取代标记:派生模型里 = 取代本任务的新任务编号(数字);迁移来的旧数据可能是对象
|
|
222
|
-
supersededBy:
|
|
223
|
-
typeof t.supersededBy === 'object' && t.supersededBy !== null
|
|
224
|
-
? t.supersededBy
|
|
225
|
-
: t.supersededBy != null && t.supersededBy !== ''
|
|
226
|
-
? Number(t.supersededBy) || t.supersededBy
|
|
227
|
-
: null,
|
|
228
|
-
archivedAt: String(t.archivedAt ?? ''),
|
|
229
|
-
archivedReason: String(t.archivedReason ?? ''),
|
|
230
|
-
reopenCount: Number(t.reopenCount) || 0,
|
|
231
|
-
// 派生子任务数(#144):>0 = 已有后续轮次/评论派生——反馈入口只在链尖显示
|
|
232
|
-
childCount: Number(t.childCount) || 0,
|
|
233
|
-
// 派生的「下一轮」数(#172):reopen 边数——>0 = 本条已被下一轮取代(不是链尖)。
|
|
234
|
-
// 进程面板据此只留链尖,旧轮次去任务链里看;comment / feedback 边(旁支新活)不计入。
|
|
235
|
-
childRoundCount: Number(t.childRoundCount) || 0,
|
|
236
|
-
// 链上第几轮(#122 进程面板「楼数」):根任务 = 1,派生 = 来源 + 1(schema 语义
|
|
237
|
-
// 见 v1.sql tasks.round)。库里存的是 round 列,JSON 形态只带 reopenCount = round-1
|
|
238
|
-
// (repo/rows.js),这里换算回来 —— 前端显示「第 N 楼」/按楼搜索不必再回溯链。
|
|
239
|
-
round: Math.max(1, (Number(t.reopenCount) || 0) + 1),
|
|
240
|
-
// DAG / 闸门(#34):blockBy=依赖 id;blocksFollowing=挡住数组其后所有 pending
|
|
241
|
-
blockBy,
|
|
242
|
-
blocksFollowing,
|
|
243
|
-
};
|
|
244
|
-
// ready:待领取且未被依赖/闸门挡住(面板徽标用);给 siblings 才算得准
|
|
245
|
-
// 跨队列依赖靠 readyOpts.resolveForeign(list/get 带 store 时传入)
|
|
246
|
-
if (Array.isArray(siblings) && base.status === 'pending' && !base.deletedAt && !base.migratedTo) {
|
|
247
|
-
base.ready = isReadyToClaim(t, siblings, readyOpts);
|
|
248
|
-
} else if (base.status === 'pending' && !base.deletedAt && !base.migratedTo) {
|
|
249
|
-
base.ready = blockBy.length === 0 && !blocksFollowing ? true : undefined;
|
|
250
|
-
} else {
|
|
251
|
-
base.ready = false;
|
|
252
|
-
}
|
|
253
|
-
return base;
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
// pending 的统一判据(**正判定**):`status === 'pending'` 且未删除、未迁出。
|
|
257
|
-
// 迁出(tombstone)不算活——它不会被派发,也不该阻塞主题删除或挡住 prune。
|
|
258
|
-
//
|
|
259
|
-
// 权威实现在 src/shared/task-status.js(前端与后端共用同一份),这里只做转发,
|
|
260
|
-
// 让 `import { isPending } from './task-view.js'` 的老调用点(deletion / move-prims /
|
|
261
|
-
// task-lifecycle)一行不用改。**别再在这里写第二份判断**。
|
|
262
|
-
export { isPending };
|
|
263
|
-
|
|
264
|
-
// 主题的截止时刻(epoch ms)。优先用 waitingUntilMs(毫秒精度,新数据都有),
|
|
265
|
-
// 老数据没有这个字段时才回退解析 waitingUntil 字符串(秒级精度)。
|
|
266
|
-
export function deadlineMsOf(t) {
|
|
267
|
-
if (!t) return NaN;
|
|
268
|
-
if (Number.isFinite(t.waitingUntilMs) && t.waitingUntilMs > 0) return t.waitingUntilMs;
|
|
269
|
-
return parseStampMs(t.waitingUntil);
|
|
270
|
-
}
|
|
271
|
-
|
|
272
|
-
// 主题是否「真的有人在等」——**必须看截止时刻,不能只看 waiting 标志**。
|
|
273
|
-
//
|
|
274
|
-
// waiting 标志由 wait 进程写入、结束时复位;跨进程可见,但 wait 被强杀
|
|
275
|
-
// (SIGKILL / 任务管理器杀 / 终端关掉 / 机器崩了)时 finally 不会执行,标志
|
|
276
|
-
// 就**永久残留**。曾出现过:gs-ac 的 wait 被杀后,标志一直挂着,面板永远显示
|
|
277
|
-
// 「等待中 已等 760:35 · 剩 0:00」,用户点「关闭」也没有进程来消费。
|
|
278
|
-
//
|
|
279
|
-
// 判据:waiting 为真**且**截止时刻还没过。截止时刻已过 = 那个 wait 本来也该
|
|
280
|
-
// 收尾了(超时),此时的 waiting 是残留,不是"有人正等着"。
|
|
281
|
-
//
|
|
282
|
-
// 唯一会误判的窗口:wait 进程还活着、但刚好卡在超时那一瞬(<1s)——那时
|
|
283
|
-
// 它下一拍就会自己收尾,短暂显示"已结束"无伤大雅。
|
|
284
|
-
export function isLiveWaiting(t, nowMs = Date.now()) {
|
|
285
|
-
if (!t || !t.waiting) return false;
|
|
286
|
-
const until = deadlineMsOf(t);
|
|
287
|
-
if (!Number.isFinite(until)) return false; // 没有截止时刻 = 脏数据,不算等待中
|
|
288
|
-
return until > nowMs;
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
export function topicView(t, repoCtx = null, readyOpts = {}) {
|
|
292
|
-
const tasks = t.tasks.map((x) => normalizeTask(x, t.tasks, readyOpts));
|
|
293
|
-
const live = isLiveWaiting(t);
|
|
294
|
-
return {
|
|
295
|
-
key: t.key,
|
|
296
|
-
cwd: t.cwd || '',
|
|
297
|
-
name: t.name || '',
|
|
298
|
-
summary: t.summary || '',
|
|
299
|
-
// 提交方(add --summary)留下的补充说明:与 agent 的「当前现状」分开存,
|
|
300
|
-
// 两个写入者不再抢同一个字段(以前谁后写谁覆盖,面板上的现状会乱跳)。
|
|
301
|
-
submitSummary: t.submitSummary || '',
|
|
302
|
-
// 这个队列被哪些路径用过(队列按目录名识别,同名目录共用)
|
|
303
|
-
cwds: Array.isArray(t.cwds) && t.cwds.length ? t.cwds.slice() : t.cwd ? [t.cwd] : [],
|
|
304
|
-
// 仓库上下文(来自 repos 模块的本地登记):目录路径对得上已登记仓库时,
|
|
305
|
-
// 把仓库信息带出来 —— agent 领任务时就知道这条任务属于哪个仓库、周围关联哪些看板。
|
|
306
|
-
// 对不上就是 null(没登记过的目录很正常,不该因此报错)。
|
|
307
|
-
repo: repoCtx || null,
|
|
308
|
-
// waiting 是**对外的真相**:僵尸标志在这里被抹平,面板才不会一直转圈
|
|
309
|
-
waiting: live,
|
|
310
|
-
// 残留标志单独透出,UI 可以说明"上次等待超时、进程已退出"而不是装作从没有过
|
|
311
|
-
staleWaiting: !!t.waiting && !live,
|
|
312
|
-
waitingUntil: t.waitingUntil || '',
|
|
313
|
-
waitingUntilMs: Number(t.waitingUntilMs) || 0,
|
|
314
|
-
waitingSince: t.waitingSince || '',
|
|
315
|
-
cancelRequested: !!t.cancelRequested,
|
|
316
|
-
isGlobal: isGlobalKey(t.key),
|
|
317
|
-
// 手动登记的目录(面板「添加目录」):空主题也不被 prune 清掉
|
|
318
|
-
manual: !!t.manual,
|
|
319
|
-
createdAt: t.createdAt,
|
|
320
|
-
updatedAt: t.updatedAt,
|
|
321
|
-
pending: tasks.filter(isPending).length,
|
|
322
|
-
// 开/关两个计数分开给(Kanboard 的 nb_open_tasks / nb_closed_tasks):
|
|
323
|
-
// 面板上「N 待领 · M 已领」比一个总数有用得多——一眼看出还剩多少活、已经干完多少。
|
|
324
|
-
// 词表统一后「已领」与「已交付」是两个词,计数也分开(旧口径把两者算在一起)。
|
|
325
|
-
claimed: tasks.filter((x) => x.status === 'claimed' && !x.deletedAt).length,
|
|
326
|
-
done: tasks.filter((x) => x.status === 'done' && !x.deletedAt).length,
|
|
327
|
-
// 软删除的条数(还在队列里,可恢复)
|
|
328
|
-
deleted: tasks.filter((x) => !!x.deletedAt).length,
|
|
329
|
-
total: tasks.length,
|
|
330
|
-
tasks,
|
|
331
|
-
};
|
|
332
|
-
}
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
// 任务链两套来源(#74 / 兼容 #69):
|
|
336
|
-
// history[] —— 同任务内就地重开/评论节点(主路径)
|
|
337
|
-
// forkOf 派生 —— 旧「新建任务」链(祖先 + 子任务)
|
|
338
|
-
// 三个原语:
|
|
339
|
-
// resolveForkRef —— 发布侧:裸数字(同主题)/'key:id'(跨主题)规范化 + 验证父任务存在
|
|
340
|
-
// forkRow —— 按引用取行(内部;软删/迁出不算存在)
|
|
341
|
-
// taskChain —— 查询侧:history 节点 + 祖先链 + 子任务
|
|
342
|
-
|
|
343
|
-
function forkRow(ref) {
|
|
344
|
-
const m = /^(.+):(\d+)$/.exec(String(ref || ''));
|
|
345
|
-
if (!m) return null;
|
|
346
|
-
const topic = topicsRepo.getTopic(m[1]);
|
|
347
|
-
if (!topic) return null;
|
|
348
|
-
const task = (topic.tasks || []).find(
|
|
349
|
-
(x) => Number(x.id) === Number(m[2]) && !x.deletedAt && !x.migratedTo,
|
|
350
|
-
);
|
|
351
|
-
return task ? { topic, task } : null;
|
|
352
|
-
}
|
|
353
|
-
|
|
354
|
-
/** 发布侧把 forkOf 引用规范化成 'key:id'。父任务不存在直接报错(链就是拿来查的,虚链没意义)。 */
|
|
355
|
-
export function resolveForkRef(raw, defaultKey) {
|
|
356
|
-
const s = String(raw ?? '').trim();
|
|
357
|
-
if (!s) throw badInput('forkOf 不能为空');
|
|
358
|
-
const m = /^(.+):(\d+)$/.exec(s);
|
|
359
|
-
const key = m ? m[1] : String(defaultKey || '');
|
|
360
|
-
const id = Number(m ? m[2] : s);
|
|
361
|
-
if (!key) throw badInput(`forkOf 跨主题引用必须带主题: ${s}('key:id')`);
|
|
362
|
-
if (!Number.isFinite(id) || id <= 0) {
|
|
363
|
-
throw badInput(`forkOf 无法解析: ${s}(裸数字=同主题父任务编号,或 'key:id'=跨主题)`);
|
|
364
|
-
}
|
|
365
|
-
if (!forkRow(`${key}:${id}`)) {
|
|
366
|
-
throw badInput(`forkOf 指向的任务不存在: ${key}:${id}`);
|
|
367
|
-
}
|
|
368
|
-
return `${key}:${id}`;
|
|
369
|
-
}
|
|
370
|
-
|
|
371
|
-
// 链条节点的人读视图:不吐正文全文(链上可能一长串),给首行节选。
|
|
372
|
-
function chainLite(topic, t) {
|
|
373
|
-
const firstLine =
|
|
374
|
-
String(t.text ?? '')
|
|
375
|
-
.split('\n')
|
|
376
|
-
.map((l) => l.trim())
|
|
377
|
-
.find(Boolean) || '';
|
|
378
|
-
return {
|
|
379
|
-
key: topic.key,
|
|
380
|
-
name: topic.name,
|
|
381
|
-
id: Number(t.id) || 0,
|
|
382
|
-
status: t.status,
|
|
383
|
-
forkKind: t.forkKind === 'reopen' || t.forkKind === 'comment' ? t.forkKind : '',
|
|
384
|
-
forkOf: String(t.forkOf ?? ''),
|
|
385
|
-
createdAt: String(t.createdAt ?? ''),
|
|
386
|
-
excerpt: firstLine.replace(/^#+\s*/, '').slice(0, 100),
|
|
387
|
-
};
|
|
388
|
-
}
|
|
389
|
-
|
|
390
|
-
/** 任务链查询(T04 派生模型):链 = task_links(唯一来源),不再读 history[] / forkOf。 */
|
|
391
|
-
export async function taskChain({ id, cwd, key } = {}) {
|
|
392
|
-
const k = resolveTaskKey({ key, cwd });
|
|
393
|
-
const want = Number(id);
|
|
394
|
-
if (!Number.isFinite(want) || want <= 0) throw badInput('缺少参数 --id <任务编号>');
|
|
395
|
-
const t = topicsRepo.getTopic(k);
|
|
396
|
-
if (!t) throw notFound('主题不存在: ' + k);
|
|
397
|
-
const self = (t.tasks || []).find((x) => Number(x.id) === want && !x.deletedAt && !x.migratedTo);
|
|
398
|
-
if (!self) throw notFound('任务不存在或已删除: #' + want);
|
|
399
|
-
|
|
400
|
-
const selfRow = tasksRepo.getTaskRow(t.id, want);
|
|
401
|
-
const { ancestors: ancestorLinks, descendants: descendantLinks } = linksRepo.chainOf(selfRow.row.id);
|
|
402
|
-
|
|
403
|
-
// 节点 = 链上每一代任务(每轮一条,seq 做面板 key),从根排到叶;自己是"当前尖"
|
|
404
|
-
// wrapper = getTaskRowById 的返回({ row, task });row.topicId 是主题内部 id
|
|
405
|
-
// 链边的类型(reopen=反馈轮次 / comment=评论旁支)从**边**上取:task_links 是链的
|
|
406
|
-
// 唯一来源,任务自身那个旧 forkKind 字段多半是空的——空着的话面板的链上每一格
|
|
407
|
-
// 都显示成「起点」,看不出哪一轮是反馈、哪一条是评论旁支(#172)。
|
|
408
|
-
const nodeOf = (wrapper, linkType) => {
|
|
409
|
-
const owner = topicsRepo.getTopicById(wrapper.row.topicId);
|
|
410
|
-
const lite = chainLite(owner || { key: k, name: t.name }, wrapper.task);
|
|
411
|
-
return {
|
|
412
|
-
...lite,
|
|
413
|
-
forkKind: linkType || lite.forkKind || '',
|
|
414
|
-
at: String(wrapper.task.createdAt || ''),
|
|
415
|
-
current: Number(wrapper.task.id) === Number(selfRow.task.id),
|
|
416
|
-
};
|
|
417
|
-
};
|
|
418
|
-
const upNodes = ancestorLinks.map((l) => nodeOf(tasksRepo.getTaskRowById(l.id), l.type));
|
|
419
|
-
const downNodes = descendantLinks.map((l) => nodeOf(tasksRepo.getTaskRowById(l.id), l.type));
|
|
420
|
-
const selfNode = nodeOf(selfRow);
|
|
421
|
-
// 根 → … → 自己 → … → 叶(自己是"当前尖";查询哪条,哪条就是尖)
|
|
422
|
-
const nodes = [...upNodes, selfNode, ...downNodes].map(
|
|
423
|
-
(n) => ({ ...n, current: n.id === Number(selfRow.task.id) || n.current })
|
|
424
|
-
);
|
|
425
|
-
|
|
426
|
-
// 祖先/子任务清单(旧字段形状保留:面板兼容)
|
|
427
|
-
const ancestors = upNodes.map((n) => ({ key: n.key, name: n.name, id: n.id, status: n.status, forkKind: n.forkKind || '', forkOf: '', createdAt: n.createdAt, excerpt: n.excerpt }));
|
|
428
|
-
const children = downNodes.map((n) => ({ key: n.key, name: n.name, id: n.id, status: n.status, forkKind: n.forkKind || '', forkOf: '', createdAt: n.createdAt, excerpt: n.excerpt }));
|
|
429
|
-
|
|
430
|
-
return {
|
|
431
|
-
status: 'ok',
|
|
432
|
-
key: k,
|
|
433
|
-
name: t.name,
|
|
434
|
-
id: want,
|
|
435
|
-
task: normalizeTask(self, t.tasks),
|
|
436
|
-
nodes,
|
|
437
|
-
ancestors,
|
|
438
|
-
children,
|
|
439
|
-
// T04:轮次与派生来源(CLI localtask chain 输出用)
|
|
440
|
-
round: (Number(self.reopenCount) || 0) + 1,
|
|
441
|
-
derivedFrom: upNodes.length
|
|
442
|
-
? `${upNodes.at(-1).id} @ ${upNodes.at(-1).name}(${ancestorLinks.at(-1)?.type || 'reopen'})`
|
|
443
|
-
: null,
|
|
444
|
-
childCount: children.length,
|
|
445
|
-
};
|
|
446
|
-
}
|
|
@@ -1,170 +0,0 @@
|
|
|
1
|
-
// (#54 自 service.js 拆出)主题级操作:设置视图/更新、目录登记(manual 常驻)、
|
|
2
|
-
// 总览(listTasks,全局池置顶)、prune 旧脏数据(与删除共用 deleteGuard 一套判定)。
|
|
3
|
-
//
|
|
4
|
-
// T03:存储切到 repo/(SQLite)。本文件不再直接读写任何存储形状 ——
|
|
5
|
-
// 读走 repo.topics 的 JSON 形态投影,写走窄方法(一个动作一个事务)。
|
|
6
|
-
import { badInput } from '../../core/errors.js';
|
|
7
|
-
import { normalizeCwd } from './paths.js';
|
|
8
|
-
import { normalizeSummary } from './store-io.js';
|
|
9
|
-
import { openLocaltaskStore as openStore, topics as topicsRepo, settings as settingsRepo, txw as tx } from './repo/index.js';
|
|
10
|
-
import { DEFAULT_TIMEOUT_SEC, MAX_TIMEOUT_SEC } from './repo/settings.js';
|
|
11
|
-
import { foreignResolver, isPending, topicView } from './task-view.js';
|
|
12
|
-
import { stripFrontmatter } from '../../shared/frontmatter.js';
|
|
13
|
-
import { deleteGuard } from './deletion.js';
|
|
14
|
-
import { repoContextIndex, repoCtxOf } from './repo-ctx.js';
|
|
15
|
-
|
|
16
|
-
// ─── 目录登记(面板「添加目录」)────────────────────────────────────
|
|
17
|
-
//
|
|
18
|
-
// wait/add 也会建主题,但那是**被动**创建:空主题会被 prune 当脏数据清掉。
|
|
19
|
-
// 手动登记的目录要能常驻(用户想先占个位、之后再绑 timegoal / 排任务),
|
|
20
|
-
// 所以打 `manual:true` 标记,prune 一律跳过。重复登记幂等(已存在则只刷新标记)。
|
|
21
|
-
export async function addTopic({ cwd: rawCwd, summary: rawSummary } = {}) {
|
|
22
|
-
if (rawCwd === undefined || rawCwd === null || !String(rawCwd).trim()) {
|
|
23
|
-
throw badInput('需要 --cwd "<工作目录>"');
|
|
24
|
-
}
|
|
25
|
-
const { key, cwd, name } = normalizeCwd(rawCwd);
|
|
26
|
-
const summary = normalizeSummary(rawSummary, { optional: true });
|
|
27
|
-
openStore();
|
|
28
|
-
const existed = !!topicsRepo.getTopicRow(key);
|
|
29
|
-
// --summary:登记时顺带写「现状摘要」(面板顶栏那一句的编辑入口也走这里)。
|
|
30
|
-
// 写进 submitSummary(提交方字段),不碰 agent 的 summary——与 add --summary 同一约定。
|
|
31
|
-
tx(() => {
|
|
32
|
-
topicsRepo.ensureTopic(key, { cwd, name });
|
|
33
|
-
topicsRepo.updateTopic(key, { manual: true, submitSummary: summary || '' });
|
|
34
|
-
});
|
|
35
|
-
return { status: 'ok', existed, key, name, cwd, topic: topicView(topicsRepo.getTopic(key)) };
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
// 总览:返回全部主题(面板据此分组展示与回填)+ 超时设置,按最近更新排序;
|
|
39
|
-
// 全局主题永远置顶(共享池是所有 worker 的候补来源,放最显眼处)。
|
|
40
|
-
//
|
|
41
|
-
// 注意:**全局主题不在这里凭空造**。全局池空着的时候库里就是没有它
|
|
42
|
-
// (它只有真的往池子里投过东西才存在)。看板层(board.js)负责补一行"全局任务池"
|
|
43
|
-
// 占位,保证用户永远找得到往全局池加任务的入口——服务层的契约保持原样。
|
|
44
|
-
export async function listTasks() {
|
|
45
|
-
openStore();
|
|
46
|
-
// 仓库上下文一次读一张表(逐主题读文件太浪费)
|
|
47
|
-
const repoIndex = await repoContextIndex();
|
|
48
|
-
const readyOpts = { resolveForeign: foreignResolver() };
|
|
49
|
-
const topics = topicsRepo
|
|
50
|
-
.listTopics()
|
|
51
|
-
.map((t) => topicView(t, repoCtxOf(repoIndex, t.cwd), readyOpts))
|
|
52
|
-
.sort(
|
|
53
|
-
(a, b) =>
|
|
54
|
-
Number(!!b.isGlobal) - Number(!!a.isGlobal) ||
|
|
55
|
-
String(b.updatedAt).localeCompare(String(a.updatedAt))
|
|
56
|
-
);
|
|
57
|
-
return {
|
|
58
|
-
topics,
|
|
59
|
-
waiting: topics.filter((t) => t.waiting).length,
|
|
60
|
-
settings: settingsRepo.settingsView(),
|
|
61
|
-
};
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
export async function getSettings() {
|
|
65
|
-
openStore();
|
|
66
|
-
return settingsRepo.settingsView();
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
// 清理旧脏数据:只动「非等待中」的主题——
|
|
70
|
-
// 1) 旧模型迁移来的无 cwd 主题(“旧数据,无目录”);
|
|
71
|
-
// 2) 空主题(没有任何任务);
|
|
72
|
-
// 3) allFinished 时,连同「已全部领取、无待领」的主题一起清。
|
|
73
|
-
// 等待中的主题与全局主题一律保留;dryRun 只报告不改动。
|
|
74
|
-
//
|
|
75
|
-
// **僵尸等待标志不算"等待中"**:wait 被强杀后残留的 waiting:true 会让主题
|
|
76
|
-
// 永远躲过清理(gs-ac 就这么卡住的)。用 isLiveWaiting 判定——截止已过 = 没人
|
|
77
|
-
// 在等 = 可以清。
|
|
78
|
-
export async function pruneTopics({ allFinished = false, dryRun = false } = {}) {
|
|
79
|
-
openStore();
|
|
80
|
-
const removed = [];
|
|
81
|
-
for (const t of topicsRepo.listTopics()) {
|
|
82
|
-
// prune 走同一套判定(scope:'prune'):全局共享池 / 等待中 / 手动登记 → 保留。
|
|
83
|
-
// (prune 是"清旧脏数据",不因未领取任务而跳过——它本来就只清空主题/旧模型主题。)
|
|
84
|
-
if (!deleteGuard(t, { force: false, key: t.key, scope: 'prune' }).ok) continue;
|
|
85
|
-
const tasks = t.tasks;
|
|
86
|
-
const hasPending = tasks.some(isPending);
|
|
87
|
-
const isLegacy = !t.cwd;
|
|
88
|
-
const isEmpty = tasks.length === 0;
|
|
89
|
-
const isFinished = allFinished && tasks.length > 0 && !hasPending;
|
|
90
|
-
if (isLegacy || isEmpty || isFinished) {
|
|
91
|
-
const reason = isLegacy ? '旧模型无目录' : isEmpty ? '空主题' : '已完成无待领';
|
|
92
|
-
removed.push({ key: t.key, name: t.name || t.key, cwd: t.cwd || '', reason });
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
if (!dryRun) {
|
|
96
|
-
for (const r of removed) topicsRepo.deleteTopic(r.key);
|
|
97
|
-
}
|
|
98
|
-
return { status: 'ok', dryRun: !!dryRun, count: removed.length, removed };
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
// 配置等待超时 / ack 汇报要求(页面可调)。超时推荐 180=3 分钟、最大 600=10 分钟;
|
|
102
|
-
// ackPrompt 写入 ack 区块的「命令行」模板并启用(done 指令与收尾要求只有这一个出口),
|
|
103
|
-
// 传 '' / [] 恢复内置、不传保持不变。
|
|
104
|
-
//
|
|
105
|
-
// blockTemplates:每区块独立模板列表 `{ [blockId]: { active, list } }`
|
|
106
|
-
// (结构见 shared/prompt-blocks.js 的 normalizeBlockTemplateLists)。
|
|
107
|
-
export async function updateSettings({ timeoutSec, ackPrompt, deliveryTemplate, attachTemplate, appendMode, blockTemplates } = {}) {
|
|
108
|
-
const hasTimeout = timeoutSec !== undefined && timeoutSec !== null;
|
|
109
|
-
const hasAck = ackPrompt !== undefined;
|
|
110
|
-
const hasDelivery = deliveryTemplate !== undefined;
|
|
111
|
-
const hasAttach = attachTemplate !== undefined;
|
|
112
|
-
const hasAppend = appendMode !== undefined;
|
|
113
|
-
const hasBlocks = blockTemplates !== undefined;
|
|
114
|
-
if (!hasTimeout && !hasAck && !hasDelivery && !hasAttach && !hasAppend && !hasBlocks) {
|
|
115
|
-
throw badInput(
|
|
116
|
-
'请至少指定一项:--timeout <秒>,或 --ack "<ack 提示词>",或 --append-mode,或 --block-templates "JSON 对象"'
|
|
117
|
-
);
|
|
118
|
-
}
|
|
119
|
-
if (hasTimeout) {
|
|
120
|
-
const n = Number(timeoutSec);
|
|
121
|
-
if (!Number.isFinite(n) || n <= 0) {
|
|
122
|
-
throw badInput(`超时时间需为 1-${MAX_TIMEOUT_SEC} 秒(推荐 ${DEFAULT_TIMEOUT_SEC})`);
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
openStore();
|
|
126
|
-
settingsRepo.setLtSettings({
|
|
127
|
-
timeoutSec: hasTimeout ? timeoutSec : undefined,
|
|
128
|
-
ackPrompt: hasAck ? ackPrompt : undefined,
|
|
129
|
-
deliveryTemplate: hasDelivery ? deliveryTemplate : undefined,
|
|
130
|
-
attachTemplate: hasAttach ? attachTemplate : undefined,
|
|
131
|
-
appendMode: hasAppend ? appendMode : undefined,
|
|
132
|
-
blockTemplates: hasBlocks ? blockTemplates : undefined,
|
|
133
|
-
});
|
|
134
|
-
return settingsRepo.settingsView();
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
/** 任务标题 = 去掉 frontmatter 后的首个非空行(去前导 #,截 80 字)。 */
|
|
138
|
-
function taskTitleOf(row) {
|
|
139
|
-
const body = String(stripFrontmatter(String((row && row.text) || ''))).trim();
|
|
140
|
-
const first = body.split(/\r?\n/).map((s) => s.trim()).find(Boolean) || '';
|
|
141
|
-
const title = first.replace(/^#+\s*/, '').trim().slice(0, 80);
|
|
142
|
-
return title || `任务 #${Number(row && row.id) || ''}`;
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
/**
|
|
146
|
-
* ext 区块数据:**同一主题**里仍处于 pending 的任务(不含当前刚领走的这条)。
|
|
147
|
-
*
|
|
148
|
-
* 范围口径:只看这条目录队列(global 任务看共享池),不跨主题汇总——agent 的
|
|
149
|
-
* 「还能领多少」指它接下来会从哪个队列取活,混进别的主题会虚报余量。
|
|
150
|
-
* 统计所有活跃 pending(含暂时被依赖挡住的),与面板上的 pending 数同口径;
|
|
151
|
-
* 「待领取」是队列里还压着的活,不只是此刻 ready 的活。
|
|
152
|
-
*
|
|
153
|
-
* 现算而不缓存:一次 getTopic + 内存过滤(同主题通常几十条),而队列会被面板 /
|
|
154
|
-
* 其他进程随时写入,缓存要么过期、要么还得做跨进程失效,代价高于这次读。
|
|
155
|
-
*
|
|
156
|
-
* @param {string} key 主题 key
|
|
157
|
-
* @param {number} [excludeId] 当前正在领取的任务号(不计入余量)
|
|
158
|
-
* @returns {Promise<{topic:string,count:number,list:Array<{id:number,title:string,topic:string}>}>}
|
|
159
|
-
*/
|
|
160
|
-
export async function pendingQueueInfo(key, excludeId) {
|
|
161
|
-
openStore();
|
|
162
|
-
const t = topicsRepo.getTopic(String(key || ''));
|
|
163
|
-
if (!t) return { topic: '', count: 0, list: [] };
|
|
164
|
-
const exclude = Number(excludeId) || 0;
|
|
165
|
-
const topic = t.name || t.key || '';
|
|
166
|
-
const list = (t.tasks || [])
|
|
167
|
-
.filter((x) => isPending(x) && Number(x.id) !== exclude)
|
|
168
|
-
.map((x) => ({ id: Number(x.id) || 0, title: taskTitleOf(x), topic }));
|
|
169
|
-
return { topic, count: list.length, list };
|
|
170
|
-
}
|