@danypops/papyrus 0.44.8 → 0.44.9
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/package.json +1 -1
- package/src/{ports → artifact}/artifact-event-reader.ts +1 -1
- package/src/{artifact-relationship-view.ts → artifact/artifact-relationship-view.ts} +3 -3
- package/src/{ports → artifact}/artifact-store.ts +2 -2
- package/src/{artifact-subtree.ts → artifact/artifact-subtree.ts} +4 -4
- package/src/{ports → artifact}/artifact-trash-store.ts +2 -2
- package/src/{adapters → artifact}/sqlite-artifact-scope-store.ts +1 -1
- package/src/{adapters → artifact}/sqlite-artifact-store.ts +15 -15
- package/src/authority-registry.ts +3 -3
- package/src/cli.ts +5 -5
- package/src/client.ts +2 -2
- package/src/{daemon-state.ts → daemon/daemon-state.ts} +1 -1
- package/src/{daemon.ts → daemon/daemon.ts} +3 -3
- package/src/db.ts +1 -1
- package/src/{discussion-service.ts → discussion/discussion-service.ts} +7 -6
- package/src/domain-services.ts +5 -5
- package/src/{graph-projection-service.ts → graph-projection/graph-projection-service.ts} +6 -6
- package/src/{vehicle/artifact-trash-vehicle.ts → handlers/artifact-trash.ts} +4 -4
- package/src/{vehicle/discuss-vehicle.ts → handlers/discuss.ts} +4 -11
- package/src/{vehicle/docs-vehicle.ts → handlers/docs.ts} +3 -10
- package/src/{vehicle/notes-vehicle.ts → handlers/notes.ts} +3 -10
- package/src/{vehicle/playbooks-vehicle.ts → handlers/playbooks.ts} +10 -10
- package/src/{vehicle/papyrus-vehicle.ts → handlers/registry.ts} +16 -16
- package/src/{vehicle/rules-vehicle.ts → handlers/rules.ts} +3 -10
- package/src/{vehicle/artifact-vehicle-shared.ts → handlers/shared.ts} +5 -5
- package/src/{vehicle/tasks-vehicle.ts → handlers/tasks.ts} +6 -6
- package/src/index.ts +13 -13
- package/src/{log-service.ts → log/log-service.ts} +2 -2
- package/src/modules/discuss.ts +2 -2
- package/src/modules/docs.ts +3 -2
- package/src/modules/graph-projection.ts +4 -3
- package/src/modules/logs.ts +1 -1
- package/src/modules/notes.ts +1 -1
- package/src/modules/playbooks.ts +12 -11
- package/src/modules/rules.ts +3 -2
- package/src/modules/session-identity.ts +1 -1
- package/src/modules/tasks.ts +6 -5
- package/src/{note-service.ts → note/note-service.ts} +6 -6
- package/src/ops.ts +6 -6
- package/src/{playbook-definition.ts → playbook/playbook-definition.ts} +7 -6
- package/src/{playbook-execution.ts → playbook/playbook-execution.ts} +5 -4
- package/src/{workflow-execution.ts → playbook/workflow-execution.ts} +12 -12
- package/src/service.ts +29 -29
- package/src/{session-identity-service.ts → session-identity/session-identity-service.ts} +2 -2
- package/src/{ports → stores}/session-identity-store.ts +1 -1
- package/src/{adapters → stores}/sqlite-discussion-round-store.ts +1 -1
- package/src/{adapters → stores}/sqlite-gate-runner.ts +1 -1
- package/src/{adapters → stores}/sqlite-graph-projection-store.ts +1 -1
- package/src/{adapters → stores}/sqlite-log-store.ts +1 -1
- package/src/{adapters → stores}/sqlite-note-event-store.ts +1 -1
- package/src/{adapters → stores}/sqlite-session-identity-store.ts +1 -1
- package/src/{adapters → stores}/sqlite-task-event-store.ts +1 -1
- package/src/{adapters → stores}/sqlite-task-focus-store.ts +1 -1
- package/src/{adapters → stores}/sqlite-task-lease-store.ts +1 -1
- package/src/{adapters → stores}/sqlite-task-scope-store.ts +1 -1
- package/src/{task-context.ts → task/task-context.ts} +4 -4
- package/src/{task-execution.ts → task/task-execution.ts} +1 -1
- package/src/{task-graph-view.ts → task/task-graph-view.ts} +1 -1
- package/src/{task-relationship-view.ts → task/task-relationship-view.ts} +3 -3
- package/src/{task-service.ts → task/task-service.ts} +14 -14
- /package/src/{domain → artifact}/artifact-alias.ts +0 -0
- /package/src/{domain → artifact}/artifact-event.ts +0 -0
- /package/src/{ports → artifact}/artifact-scope-store.ts +0 -0
- /package/src/{domain → artifact}/artifact-trash.ts +0 -0
- /package/src/{domain → artifact}/artifact.ts +0 -0
- /package/src/{ports → artifact}/atomic-artifact-store.ts +0 -0
- /package/src/{log.ts → log/log.ts} +0 -0
- /package/src/{ports → stores}/discussion-round-store.ts +0 -0
- /package/src/{ports → stores}/gate-runner.ts +0 -0
- /package/src/{ports → stores}/graph-projection-store.ts +0 -0
- /package/src/{ports → stores}/graph-renderer.ts +0 -0
- /package/src/{ports → stores}/log-store.ts +0 -0
- /package/src/{ports → stores}/note-event-store.ts +0 -0
- /package/src/{ports → stores}/task-event-store.ts +0 -0
- /package/src/{ports → stores}/task-focus-store.ts +0 -0
- /package/src/{ports → stores}/task-lease-store.ts +0 -0
- /package/src/{ports → stores}/task-scope-store.ts +0 -0
package/src/modules/discuss.ts
CHANGED
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
* domain/discussion.ts and discussion-service.ts for the full design.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import type {
|
|
7
|
-
import type {
|
|
6
|
+
import type { ArtifactEventContext } from "../artifact/artifact-event.ts";
|
|
7
|
+
import type { Discussions } from "../discussion/discussion-service.ts";
|
|
8
8
|
import type { OperationDefinition } from "../module-registry.ts";
|
|
9
9
|
|
|
10
10
|
const MODULE_ID = "discuss";
|
package/src/modules/docs.ts
CHANGED
|
@@ -6,6 +6,9 @@
|
|
|
6
6
|
* Imports only src/domain-services.ts's Doc functions, which are already generic
|
|
7
7
|
* ArtifactStore-based with no other module's concrete class dependency.
|
|
8
8
|
*/
|
|
9
|
+
|
|
10
|
+
import type { ArtifactScopeStore } from "../artifact/artifact-scope-store.ts";
|
|
11
|
+
import type { ArtifactStore } from "../artifact/artifact-store.ts";
|
|
9
12
|
import type { AuthorityRegistry } from "../authority-registry.ts";
|
|
10
13
|
import {
|
|
11
14
|
assignDocumentProject,
|
|
@@ -18,8 +21,6 @@ import {
|
|
|
18
21
|
updateDocument,
|
|
19
22
|
} from "../domain-services.ts";
|
|
20
23
|
import type { OperationDefinition } from "../module-registry.ts";
|
|
21
|
-
import type { ArtifactScopeStore } from "../ports/artifact-scope-store.ts";
|
|
22
|
-
import type { ArtifactStore } from "../ports/artifact-store.ts";
|
|
23
24
|
|
|
24
25
|
const MODULE_ID = "docs";
|
|
25
26
|
|
|
@@ -5,6 +5,8 @@
|
|
|
5
5
|
* src/domain/graph-projection.ts and src/graph-projection-service.ts for the protocol
|
|
6
6
|
* itself; this file only parses/validates raw operation input into that typed shape.
|
|
7
7
|
*/
|
|
8
|
+
|
|
9
|
+
import type { ArtifactStore } from "../artifact/artifact-store.ts";
|
|
8
10
|
import type { AuthorityRegistry } from "../authority-registry.ts";
|
|
9
11
|
import type {
|
|
10
12
|
GRAPH_PROJECTION_SCHEMA_VERSION,
|
|
@@ -12,10 +14,9 @@ import type {
|
|
|
12
14
|
ProjectedArtifact,
|
|
13
15
|
ProjectedEdge,
|
|
14
16
|
} from "../domain/graph-projection.ts";
|
|
15
|
-
import { GraphProjection } from "../graph-projection-service.ts";
|
|
17
|
+
import { GraphProjection } from "../graph-projection/graph-projection-service.ts";
|
|
16
18
|
import type { OperationDefinition } from "../module-registry.ts";
|
|
17
|
-
import type {
|
|
18
|
-
import type { GraphProjectionStore } from "../ports/graph-projection-store.ts";
|
|
19
|
+
import type { GraphProjectionStore } from "../stores/graph-projection-store.ts";
|
|
19
20
|
|
|
20
21
|
const MODULE_ID = "graph_projection";
|
|
21
22
|
|
package/src/modules/logs.ts
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* comment on why `log` is not an Artifact kind).
|
|
7
7
|
*/
|
|
8
8
|
import type { JsonValue, LogLevel } from "../domain/log-entry.ts";
|
|
9
|
-
import type { Logs } from "../log-service.ts";
|
|
9
|
+
import type { Logs } from "../log/log-service.ts";
|
|
10
10
|
import type { OperationDefinition } from "../module-registry.ts";
|
|
11
11
|
|
|
12
12
|
const MODULE_ID = "logs";
|
package/src/modules/notes.ts
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
|
|
16
16
|
import type { NoteEventDirection } from "../domain/note-event.ts";
|
|
17
17
|
import type { OperationDefinition } from "../module-registry.ts";
|
|
18
|
-
import type { NoteDisposition, Notes } from "../note-service.ts";
|
|
18
|
+
import type { NoteDisposition, Notes } from "../note/note-service.ts";
|
|
19
19
|
|
|
20
20
|
const MODULE_ID = "notes";
|
|
21
21
|
|
package/src/modules/playbooks.ts
CHANGED
|
@@ -4,11 +4,14 @@
|
|
|
4
4
|
* A Playbook is prose-first, whole-artifact composition (contains/depends_on between real
|
|
5
5
|
* Playbook artifacts) rather than a raw JSON blueprint -- but its own step list can also
|
|
6
6
|
* declare Doc/Rule blueprints and typed arguments and nested pipeline calls. playbooks.invoke
|
|
7
|
-
* recycles the shared blueprint materialization engine (playbook-execution.ts compiles a
|
|
7
|
+
* recycles the shared blueprint materialization engine (playbook/playbook-execution.ts compiles a
|
|
8
8
|
* Playbook's steps and composition tree into a BlueprintDefinition, then hands off to
|
|
9
|
-
* workflow-execution.ts's shared core). See domain-services.ts's Playbook section and
|
|
10
|
-
* playbook-definition.ts for the full rationale.
|
|
9
|
+
* playbook/workflow-execution.ts's shared core). See domain-services.ts's Playbook section and
|
|
10
|
+
* playbook/playbook-definition.ts for the full rationale.
|
|
11
11
|
*/
|
|
12
|
+
|
|
13
|
+
import type { ArtifactScopeStore } from "../artifact/artifact-scope-store.ts";
|
|
14
|
+
import type { ArtifactStore } from "../artifact/artifact-store.ts";
|
|
12
15
|
import {
|
|
13
16
|
assignPlaybookProject,
|
|
14
17
|
containPlaybook,
|
|
@@ -23,13 +26,11 @@ import {
|
|
|
23
26
|
updatePlaybook,
|
|
24
27
|
} from "../domain-services.ts";
|
|
25
28
|
import type { OperationDefinition } from "../module-registry.ts";
|
|
26
|
-
import { invokePlaybook } from "../playbook-execution.ts";
|
|
27
|
-
import type {
|
|
28
|
-
import type {
|
|
29
|
-
import type {
|
|
30
|
-
import type {
|
|
31
|
-
import type { SessionIdentity } from "../session-identity-service.ts";
|
|
32
|
-
import type { Tasks } from "../task-service.ts";
|
|
29
|
+
import { invokePlaybook } from "../playbook/playbook-execution.ts";
|
|
30
|
+
import type { SessionIdentity } from "../session-identity/session-identity-service.ts";
|
|
31
|
+
import type { TaskEventStore } from "../stores/task-event-store.ts";
|
|
32
|
+
import type { TaskScopeStore } from "../stores/task-scope-store.ts";
|
|
33
|
+
import type { Tasks } from "../task/task-service.ts";
|
|
33
34
|
|
|
34
35
|
const MODULE_ID = "playbooks";
|
|
35
36
|
|
|
@@ -96,7 +97,7 @@ export interface PlaybooksModuleDeps {
|
|
|
96
97
|
scopes: TaskScopeStore;
|
|
97
98
|
/** Docs/Rules/Skills/Playbooks project scoping (distinct from `scopes`, which is Task-run project scoping for playbooks.invoke's materialized tasks). */
|
|
98
99
|
artifactScopes: ArtifactScopeStore;
|
|
99
|
-
/** Used for exactly one thing: focusing the entry task after a successful invoke -- the one safety-checked Tasks operation this module needs, not bulk graph construction (that goes straight through artifacts/events/scopes in playbook-execution.ts, mirroring workflow-execution.ts). */
|
|
100
|
+
/** Used for exactly one thing: focusing the entry task after a successful invoke -- the one safety-checked Tasks operation this module needs, not bulk graph construction (that goes straight through artifacts/events/scopes in playbook/playbook-execution.ts, mirroring playbook/workflow-execution.ts). */
|
|
100
101
|
tasks: Tasks;
|
|
101
102
|
/** Guards the same session_secret check tasks.focus's own operation enforces (guardFocusMutation in modules/tasks.ts) -- invoke's internal tasks.focus() call goes straight through the Tasks class, bypassing that operation wrapper entirely, so the check must be applied here instead of silently skipped. */
|
|
102
103
|
sessionIdentity: SessionIdentity;
|
package/src/modules/rules.ts
CHANGED
|
@@ -10,6 +10,9 @@
|
|
|
10
10
|
* into this module or introducing a premature "modules call each other through the
|
|
11
11
|
* registry" convention.
|
|
12
12
|
*/
|
|
13
|
+
|
|
14
|
+
import type { ArtifactScopeStore } from "../artifact/artifact-scope-store.ts";
|
|
15
|
+
import type { ArtifactStore } from "../artifact/artifact-store.ts";
|
|
13
16
|
import {
|
|
14
17
|
assignRuleProject,
|
|
15
18
|
createRule,
|
|
@@ -21,8 +24,6 @@ import {
|
|
|
21
24
|
updateRule,
|
|
22
25
|
} from "../domain-services.ts";
|
|
23
26
|
import type { OperationDefinition } from "../module-registry.ts";
|
|
24
|
-
import type { ArtifactScopeStore } from "../ports/artifact-scope-store.ts";
|
|
25
|
-
import type { ArtifactStore } from "../ports/artifact-store.ts";
|
|
26
27
|
|
|
27
28
|
const MODULE_ID = "rules";
|
|
28
29
|
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* precedent set by modules/logs.ts. See domain/session-identity.ts for the design rationale.
|
|
5
5
|
*/
|
|
6
6
|
import type { OperationDefinition } from "../module-registry.ts";
|
|
7
|
-
import type { SessionIdentity } from "../session-identity-service.ts";
|
|
7
|
+
import type { SessionIdentity } from "../session-identity/session-identity-service.ts";
|
|
8
8
|
|
|
9
9
|
const MODULE_ID = "session-identity";
|
|
10
10
|
|
package/src/modules/tasks.ts
CHANGED
|
@@ -18,15 +18,16 @@
|
|
|
18
18
|
* set by modules/notes.ts: a module does not import another module's infrastructure,
|
|
19
19
|
* including the composition root's own helpers.
|
|
20
20
|
*/
|
|
21
|
+
|
|
22
|
+
import type { ArtifactStore } from "../artifact/artifact-store.ts";
|
|
21
23
|
import type { Checklist } from "../domain/checklist.ts";
|
|
22
24
|
import type { TaskEventContext, TaskEventDirection, TaskEventFeedQuery } from "../domain/task-event.ts";
|
|
23
25
|
import type { TaskViewMode } from "../domain/task-scope.ts";
|
|
24
26
|
import type { OperationDefinition } from "../module-registry.ts";
|
|
25
|
-
import type {
|
|
26
|
-
import
|
|
27
|
-
import {
|
|
28
|
-
import {
|
|
29
|
-
import type { TaskStatus, Tasks } from "../task-service.ts";
|
|
27
|
+
import type { SessionIdentity } from "../session-identity/session-identity-service.ts";
|
|
28
|
+
import { taskContext } from "../task/task-context.ts";
|
|
29
|
+
import { projectTaskExecution } from "../task/task-execution.ts";
|
|
30
|
+
import type { TaskStatus, Tasks } from "../task/task-service.ts";
|
|
30
31
|
|
|
31
32
|
const MODULE_ID = "tasks";
|
|
32
33
|
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import type { Artifact } from "../artifact/artifact.ts";
|
|
2
|
+
import type { ArtifactStore } from "../artifact/artifact-store.ts";
|
|
3
|
+
import { requireAtomicArtifactStore } from "../artifact/atomic-artifact-store.ts";
|
|
1
4
|
import {
|
|
2
5
|
NOTE_BODY_MAX_CHARACTERS,
|
|
3
6
|
NOTE_LIST_DEFAULT_LIMIT,
|
|
@@ -6,12 +9,9 @@ import {
|
|
|
6
9
|
NOTE_REASON_MAX_CHARACTERS,
|
|
7
10
|
NOTE_TITLE_MAX_CHARACTERS,
|
|
8
11
|
TASK_PROJECT_ROOT_MAX_LENGTH,
|
|
9
|
-
} from "
|
|
10
|
-
import type {
|
|
11
|
-
import
|
|
12
|
-
import type { ArtifactStore } from "./ports/artifact-store.ts";
|
|
13
|
-
import { requireAtomicArtifactStore } from "./ports/atomic-artifact-store.ts";
|
|
14
|
-
import { InMemoryNoteEventStore, type NoteEventStore } from "./ports/note-event-store.ts";
|
|
12
|
+
} from "../constants.ts";
|
|
13
|
+
import type { AppendNoteEvent, NoteEventType, NoteHistoryPage, NoteHistoryQuery } from "../domain/note-event.ts";
|
|
14
|
+
import { InMemoryNoteEventStore, type NoteEventStore } from "../stores/note-event-store.ts";
|
|
15
15
|
|
|
16
16
|
export const NOTE_SUBTYPE = "note";
|
|
17
17
|
export const NOTE_DISPOSITIONS = ["completed", "duplicate", "declined", "superseded"] as const;
|
package/src/ops.ts
CHANGED
|
@@ -3,14 +3,14 @@
|
|
|
3
3
|
* Enforces the schema protocol (kinds, statuses, relations) via FK + app validation.
|
|
4
4
|
*/
|
|
5
5
|
import { createRequire } from "node:module";
|
|
6
|
+
import type { Artifact, ArtifactQuery, CreateArtifactInput, UpdateArtifactInput } from "./artifact/artifact.ts";
|
|
7
|
+
import { generateUniqueAlias, isValidAlias, slugify } from "./artifact/artifact-alias.ts";
|
|
8
|
+
import type { ArtifactTrashRecord } from "./artifact/artifact-trash.ts";
|
|
6
9
|
import { ARTIFACT_TRASH_RETENTION_MS, DEFAULT_STATUS_BY_KIND } from "./constants.ts";
|
|
7
10
|
import type { Db } from "./db.ts";
|
|
8
11
|
import { inTransaction } from "./db.ts";
|
|
9
|
-
import type { Artifact, ArtifactQuery, CreateArtifactInput, UpdateArtifactInput } from "./domain/artifact.ts";
|
|
10
|
-
import { generateUniqueAlias, isValidAlias, slugify } from "./domain/artifact-alias.ts";
|
|
11
|
-
import type { ArtifactTrashRecord } from "./domain/artifact-trash.ts";
|
|
12
12
|
|
|
13
|
-
export type { ArtifactTrashRecord } from "./
|
|
13
|
+
export type { ArtifactTrashRecord } from "./artifact/artifact-trash.ts";
|
|
14
14
|
|
|
15
15
|
import {
|
|
16
16
|
type AppendArtifactEvent,
|
|
@@ -21,10 +21,10 @@ import {
|
|
|
21
21
|
type ArtifactEventType,
|
|
22
22
|
normalizeArtifactEventQuery,
|
|
23
23
|
resolveArtifactEvent,
|
|
24
|
-
} from "./
|
|
24
|
+
} from "./artifact/artifact-event.ts";
|
|
25
25
|
import type { Gate, GateResult, GateRunOptions } from "./domain/gate.ts";
|
|
26
26
|
|
|
27
|
-
export type { Artifact } from "./
|
|
27
|
+
export type { Artifact } from "./artifact/artifact.ts";
|
|
28
28
|
export type { Gate, GateResult } from "./domain/gate.ts";
|
|
29
29
|
export type CreateInput = CreateArtifactInput;
|
|
30
30
|
|
|
@@ -18,12 +18,14 @@
|
|
|
18
18
|
* independently by workflow-execution.ts, exactly like a workflow-definition target's own
|
|
19
19
|
* nested pipeline step, since its target's own definition is not knowable at this compile time.
|
|
20
20
|
*/
|
|
21
|
+
|
|
22
|
+
import type { Artifact } from "../artifact/artifact.ts";
|
|
23
|
+
import type { ArtifactStore } from "../artifact/artifact-store.ts";
|
|
21
24
|
import {
|
|
22
25
|
PLAYBOOK_INVOCATION_MAX_CALL_DEPTH,
|
|
23
26
|
PLAYBOOK_INVOCATION_MAX_CREATED_TASKS,
|
|
24
27
|
PLAYBOOK_INVOCATION_MAX_LINKED_ARTIFACTS,
|
|
25
|
-
} from "
|
|
26
|
-
import type { Artifact } from "./domain/artifact.ts";
|
|
28
|
+
} from "../constants.ts";
|
|
27
29
|
import type {
|
|
28
30
|
BlueprintDefinition,
|
|
29
31
|
BlueprintInputDefinition,
|
|
@@ -31,10 +33,9 @@ import type {
|
|
|
31
33
|
DocBlueprint,
|
|
32
34
|
RuleBlueprint,
|
|
33
35
|
TaskBlueprint,
|
|
34
|
-
} from "
|
|
35
|
-
import { validateBlueprintDefinition } from "
|
|
36
|
-
import type { PlaybookArgument, PlaybookStep } from "
|
|
37
|
-
import type { ArtifactStore } from "./ports/artifact-store.ts";
|
|
36
|
+
} from "../domain/blueprint-definition.ts";
|
|
37
|
+
import { validateBlueprintDefinition } from "../domain/blueprint-definition.ts";
|
|
38
|
+
import type { PlaybookArgument, PlaybookStep } from "../domain-services.ts";
|
|
38
39
|
|
|
39
40
|
/** A non-composing edge touching a playbook node, to be mirrored onto that node's generated root task once real task ids exist -- e.g. a Rule `gates` this playbook, or this playbook `references`/`documents` a Doc. Direction is preserved exactly: `from`/`to` name whichever side is NOT the playbook, and `ownerIsFrom` says which side the playbook (now the generated root task) occupies. */
|
|
40
41
|
export interface PlaybookExternalLink {
|
|
@@ -7,11 +7,12 @@
|
|
|
7
7
|
* (via the existing Task Focus system-prompt pointer), which is what actually avoids the
|
|
8
8
|
* old text-dump problem: one page at a time, not the whole book at once.
|
|
9
9
|
*/
|
|
10
|
-
|
|
10
|
+
|
|
11
|
+
import type { ArtifactStore } from "../artifact/artifact-store.ts";
|
|
12
|
+
import { requireAtomicArtifactStore } from "../artifact/atomic-artifact-store.ts";
|
|
13
|
+
import type { BlueprintArgumentValue } from "../domain/blueprint-definition.ts";
|
|
14
|
+
import type { TaskExecutionPlan } from "../task/task-execution.ts";
|
|
11
15
|
import { compilePlaybookDefinition } from "./playbook-definition.ts";
|
|
12
|
-
import type { ArtifactStore } from "./ports/artifact-store.ts";
|
|
13
|
-
import { requireAtomicArtifactStore } from "./ports/atomic-artifact-store.ts";
|
|
14
|
-
import type { TaskExecutionPlan } from "./task-execution.ts";
|
|
15
16
|
import {
|
|
16
17
|
applyPlaybookExternalLinks,
|
|
17
18
|
materializeWorkflowDefinition,
|
|
@@ -1,28 +1,28 @@
|
|
|
1
1
|
import { randomUUID } from "node:crypto";
|
|
2
|
+
import type { Artifact } from "../artifact/artifact.ts";
|
|
3
|
+
import type { ArtifactStore } from "../artifact/artifact-store.ts";
|
|
4
|
+
import { requireAtomicArtifactStore } from "../artifact/atomic-artifact-store.ts";
|
|
2
5
|
import {
|
|
3
6
|
SKILL_MAX_RENDERED_BYTES,
|
|
4
7
|
SKILL_RUN_ID_MAX_LENGTH,
|
|
5
8
|
SKILL_WORKFLOW_MAX_NESTING_DEPTH,
|
|
6
9
|
TASK_EXECUTION_MAX_EDGES,
|
|
7
|
-
} from "
|
|
8
|
-
import type { Artifact } from "./domain/artifact.ts";
|
|
10
|
+
} from "../constants.ts";
|
|
9
11
|
import {
|
|
10
12
|
type BlueprintArgumentValue,
|
|
11
13
|
type BlueprintDefinition,
|
|
12
14
|
type CallBlueprint,
|
|
13
15
|
resolveBlueprintArguments,
|
|
14
16
|
validateBlueprintDefinition,
|
|
15
|
-
} from "
|
|
16
|
-
import { validateChecklist } from "
|
|
17
|
-
import type { TaskEventContext } from "
|
|
18
|
-
import { normalizeProjectRoot } from "
|
|
17
|
+
} from "../domain/blueprint-definition.ts";
|
|
18
|
+
import { validateChecklist } from "../domain/checklist.ts";
|
|
19
|
+
import type { TaskEventContext } from "../domain/task-event.ts";
|
|
20
|
+
import { normalizeProjectRoot } from "../domain/task-scope.ts";
|
|
21
|
+
import type { TaskEventStore } from "../stores/task-event-store.ts";
|
|
22
|
+
import type { TaskScopeStore } from "../stores/task-scope-store.ts";
|
|
23
|
+
import { projectTaskExecution, TaskExecutionBoundExceededError, type TaskExecutionPlan } from "../task/task-execution.ts";
|
|
24
|
+
import type { TaskGraph, TaskNode, TaskStatus } from "../task/task-service.ts";
|
|
19
25
|
import { compilePlaybookDefinition, type PlaybookExternalLink } from "./playbook-definition.ts";
|
|
20
|
-
import type { ArtifactStore } from "./ports/artifact-store.ts";
|
|
21
|
-
import { requireAtomicArtifactStore } from "./ports/atomic-artifact-store.ts";
|
|
22
|
-
import type { TaskEventStore } from "./ports/task-event-store.ts";
|
|
23
|
-
import type { TaskScopeStore } from "./ports/task-scope-store.ts";
|
|
24
|
-
import { projectTaskExecution, TaskExecutionBoundExceededError, type TaskExecutionPlan } from "./task-execution.ts";
|
|
25
|
-
import type { TaskGraph, TaskNode, TaskStatus } from "./task-service.ts";
|
|
26
26
|
|
|
27
27
|
const RUN_ID_PATTERN = /^[A-Za-z0-9][A-Za-z0-9_-]*$/;
|
|
28
28
|
const EXACT_PLACEHOLDER_PATTERN = /^{{\s*([A-Za-z][A-Za-z0-9_-]{0,63})\s*}}$/;
|
package/src/service.ts
CHANGED
|
@@ -2,29 +2,23 @@ import { VehicleError } from "@danypops/vehicle-core";
|
|
|
2
2
|
import type { VehicleRegistry } from "@danypops/vehicle-server";
|
|
3
3
|
import { createVehicleHttpApp } from "@danypops/vehicle-server/http";
|
|
4
4
|
import type { Logger } from "@danypops/vehicle-server/logging";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import { SQLiteSessionIdentityStore } from "./adapters/sqlite-session-identity-store.ts";
|
|
13
|
-
import { SQLiteTaskEventStore } from "./adapters/sqlite-task-event-store.ts";
|
|
14
|
-
import { SQLiteTaskFocusStore } from "./adapters/sqlite-task-focus-store.ts";
|
|
15
|
-
import { SQLiteTaskLeaseStore } from "./adapters/sqlite-task-lease-store.ts";
|
|
16
|
-
import { SQLiteTaskScopeStore } from "./adapters/sqlite-task-scope-store.ts";
|
|
17
|
-
import { removeArtifactSubtree } from "./artifact-subtree.ts";
|
|
5
|
+
import type { CreateArtifactInput } from "./artifact/artifact.ts";
|
|
6
|
+
import type { ArtifactEventReader } from "./artifact/artifact-event-reader.ts";
|
|
7
|
+
import type { ArtifactStore } from "./artifact/artifact-store.ts";
|
|
8
|
+
import { removeArtifactSubtree } from "./artifact/artifact-subtree.ts";
|
|
9
|
+
import type { ArtifactTrashStore } from "./artifact/artifact-trash-store.ts";
|
|
10
|
+
import { SQLiteArtifactScopeStore } from "./artifact/sqlite-artifact-scope-store.ts";
|
|
11
|
+
import { SQLiteArtifactStore } from "./artifact/sqlite-artifact-store.ts";
|
|
18
12
|
import { type AuthorityClaim, AuthorityRegistry, AuthorizedArtifactWriter } from "./authority-registry.ts";
|
|
19
13
|
import { SERVICE_MAX_BODY_BYTES, SQLITE_SCHEMA_VERSION } from "./constants.ts";
|
|
20
14
|
import { migrateDb, openDb, schemaVersion } from "./db.ts";
|
|
21
|
-
import { Discussions } from "./discussion-service.ts";
|
|
22
|
-
import type { CreateArtifactInput } from "./domain/artifact.ts";
|
|
15
|
+
import { Discussions } from "./discussion/discussion-service.ts";
|
|
23
16
|
import type { TaskEventContext } from "./domain/task-event.ts";
|
|
24
17
|
import type { TaskViewMode } from "./domain/task-scope.ts";
|
|
25
18
|
import { listInjectableRules } from "./domain-services.ts";
|
|
26
|
-
import {
|
|
27
|
-
import {
|
|
19
|
+
import { createPapyrusVehicleRegistry } from "./handlers/registry.ts";
|
|
20
|
+
import { logEvent } from "./log/log.ts";
|
|
21
|
+
import { Logs } from "./log/log-service.ts";
|
|
28
22
|
import { OperationRegistry } from "./module-registry.ts";
|
|
29
23
|
import { DISCUSS_OPERATION_NAMES, discussOperations } from "./modules/discuss.ts";
|
|
30
24
|
import { DOCS_OPERATION_NAMES, docsOperations } from "./modules/docs.ts";
|
|
@@ -35,16 +29,22 @@ import { PLAYBOOKS_OPERATION_NAMES, playbooksOperations } from "./modules/playbo
|
|
|
35
29
|
import { RULES_OPERATION_NAMES, rulesOperations } from "./modules/rules.ts";
|
|
36
30
|
import { SESSION_IDENTITY_OPERATION_NAMES, sessionIdentityOperations } from "./modules/session-identity.ts";
|
|
37
31
|
import { TASKS_OPERATION_NAMES, tasksOperations } from "./modules/tasks.ts";
|
|
38
|
-
import { NOTE_SUBTYPE, Notes } from "./note-service.ts";
|
|
39
|
-
import
|
|
40
|
-
import type {
|
|
41
|
-
import
|
|
42
|
-
import
|
|
43
|
-
import
|
|
44
|
-
import
|
|
45
|
-
import {
|
|
46
|
-
import {
|
|
47
|
-
import {
|
|
32
|
+
import { NOTE_SUBTYPE, Notes } from "./note/note-service.ts";
|
|
33
|
+
import { InvalidSessionSecretError, SessionIdentity } from "./session-identity/session-identity-service.ts";
|
|
34
|
+
import type { GateRunner } from "./stores/gate-runner.ts";
|
|
35
|
+
import { SQLiteDiscussionRoundStore } from "./stores/sqlite-discussion-round-store.ts";
|
|
36
|
+
import { SQLiteGateRunner } from "./stores/sqlite-gate-runner.ts";
|
|
37
|
+
import { SQLiteGraphProjectionStore } from "./stores/sqlite-graph-projection-store.ts";
|
|
38
|
+
import { SQLiteLogStore } from "./stores/sqlite-log-store.ts";
|
|
39
|
+
import { SQLiteNoteEventStore } from "./stores/sqlite-note-event-store.ts";
|
|
40
|
+
import { SQLiteSessionIdentityStore } from "./stores/sqlite-session-identity-store.ts";
|
|
41
|
+
import { SQLiteTaskEventStore } from "./stores/sqlite-task-event-store.ts";
|
|
42
|
+
import { SQLiteTaskFocusStore } from "./stores/sqlite-task-focus-store.ts";
|
|
43
|
+
import { SQLiteTaskLeaseStore } from "./stores/sqlite-task-lease-store.ts";
|
|
44
|
+
import { SQLiteTaskScopeStore } from "./stores/sqlite-task-scope-store.ts";
|
|
45
|
+
import type { TaskEventStore } from "./stores/task-event-store.ts";
|
|
46
|
+
import type { TaskScopeStore } from "./stores/task-scope-store.ts";
|
|
47
|
+
import { type TaskStatus, Tasks } from "./task/task-service.ts";
|
|
48
48
|
import { VERSION } from "./version.ts";
|
|
49
49
|
|
|
50
50
|
/**
|
|
@@ -217,7 +217,7 @@ export interface PapyrusService {
|
|
|
217
217
|
execute(operation: string, input?: OperationInput): Promise<unknown>;
|
|
218
218
|
/**
|
|
219
219
|
* Every domain migrated onto Vehicle, merged into one registry/one HTTP mount
|
|
220
|
-
* (see ./
|
|
220
|
+
* (see ./handlers/registry.ts) -- one honest VehicleOperation per real
|
|
221
221
|
* action, replacing the Pi extension's old `<domain>(action=X)` mega-tools.
|
|
222
222
|
* Not every domain is migrated yet -- see papyrus-vehicle.ts's own doc comment
|
|
223
223
|
* for what still isn't and why.
|
|
@@ -582,7 +582,7 @@ export function createApp(deps: {
|
|
|
582
582
|
/** Defaults to a no-op (createVehicleHttpApp's own default) -- daemon.ts wires vehicleLogger() so a failed invocation is actually logged, not silently discarded. */
|
|
583
583
|
logger?: Logger;
|
|
584
584
|
}): { fetch(request: Request): Promise<Response> } {
|
|
585
|
-
// Same Bearer token, daemon, and port as the rest of this API -- see ./
|
|
585
|
+
// Same Bearer token, daemon, and port as the rest of this API -- see ./handlers/registry.ts.
|
|
586
586
|
const vehicleApp = createVehicleHttpApp({ registry: deps.service.vehicle, token: deps.token, logger: deps.logger });
|
|
587
587
|
return {
|
|
588
588
|
async fetch(request: Request): Promise<Response> {
|
|
@@ -4,8 +4,8 @@ import {
|
|
|
4
4
|
releaseSessionIdentity,
|
|
5
5
|
verifySessionSecret,
|
|
6
6
|
} from "@danypops/vehicle-server/session-identity";
|
|
7
|
-
import { assertValidSessionId } from "
|
|
8
|
-
import type { SessionIdentityStore } from "
|
|
7
|
+
import { assertValidSessionId } from "../domain/session-identity.ts";
|
|
8
|
+
import type { SessionIdentityStore } from "../stores/session-identity-store.ts";
|
|
9
9
|
|
|
10
10
|
export interface RegisterSessionIdentityResult {
|
|
11
11
|
sessionId: string;
|
|
@@ -2,7 +2,7 @@ import type { SessionIdentityRecord, SessionIdentityStore as VehicleSessionIdent
|
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Papyrus's persistence port for @danypops/vehicle-server's storage-agnostic session-identity
|
|
5
|
-
* primitive -- re-exported under this project's own port naming convention (src/
|
|
5
|
+
* primitive -- re-exported under this project's own port naming convention (src/stores/*)
|
|
6
6
|
* rather than importing the vehicle-server interface name directly at every call site.
|
|
7
7
|
*/
|
|
8
8
|
export type SessionIdentityStore = VehicleSessionIdentityStore;
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
validateDiscussionContent,
|
|
10
10
|
validateDiscussionOptions,
|
|
11
11
|
} from "../domain/discussion.ts";
|
|
12
|
-
import type { DiscussionRoundStore } from "
|
|
12
|
+
import type { DiscussionRoundStore } from "./discussion-round-store.ts";
|
|
13
13
|
|
|
14
14
|
interface DiscussionRoundRow {
|
|
15
15
|
id: number;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Db } from "../db.ts";
|
|
2
2
|
import type { GateResult, GateRunOptions } from "../domain/gate.ts";
|
|
3
3
|
import { runGates, runGatesAsync } from "../ops.ts";
|
|
4
|
-
import type { GateRunner } from "
|
|
4
|
+
import type { GateRunner } from "./gate-runner.ts";
|
|
5
5
|
|
|
6
6
|
export class SQLiteGateRunner implements GateRunner {
|
|
7
7
|
constructor(private readonly db: Db) {}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Db } from "../db.ts";
|
|
2
2
|
import { inTransaction } from "../db.ts";
|
|
3
3
|
import type { ProjectionCheckpoint } from "../domain/graph-projection.ts";
|
|
4
|
-
import type { GraphProjectionStore } from "
|
|
4
|
+
import type { GraphProjectionStore } from "./graph-projection-store.ts";
|
|
5
5
|
|
|
6
6
|
export class SQLiteGraphProjectionStore implements GraphProjectionStore {
|
|
7
7
|
constructor(private readonly db: Db) {}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Db } from "../db.ts";
|
|
2
2
|
import type { JsonValue, LogEntry, LogLevel, LogSource } from "../domain/log-entry.ts";
|
|
3
|
-
import type { LogStore } from "
|
|
3
|
+
import type { LogStore } from "./log-store.ts";
|
|
4
4
|
|
|
5
5
|
interface SourceRow {
|
|
6
6
|
id: string;
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
normalizeNoteHistoryQuery,
|
|
9
9
|
validateNoteEvent,
|
|
10
10
|
} from "../domain/note-event.ts";
|
|
11
|
-
import type { NoteEventStore } from "
|
|
11
|
+
import type { NoteEventStore } from "./note-event-store.ts";
|
|
12
12
|
|
|
13
13
|
interface NoteEventRow {
|
|
14
14
|
id: number;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { SESSION_IDENTITY_MAX_ROWS } from "../constants.ts";
|
|
2
2
|
import type { Db } from "../db.ts";
|
|
3
3
|
import { inTransaction } from "../db.ts";
|
|
4
|
-
import type { SessionIdentityRecord, SessionIdentityStore } from "
|
|
4
|
+
import type { SessionIdentityRecord, SessionIdentityStore } from "./session-identity-store.ts";
|
|
5
5
|
|
|
6
6
|
export class SQLiteSessionIdentityStore implements SessionIdentityStore {
|
|
7
7
|
constructor(private readonly db: Db) {}
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
type TaskLifecycleStatus,
|
|
15
15
|
validateTaskEvent,
|
|
16
16
|
} from "../domain/task-event.ts";
|
|
17
|
-
import type { TaskEventStore } from "
|
|
17
|
+
import type { TaskEventStore } from "./task-event-store.ts";
|
|
18
18
|
|
|
19
19
|
interface TaskEventRow {
|
|
20
20
|
id: number;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { TASK_FOCUS_MAX_SCOPES } from "../constants.ts";
|
|
2
2
|
import type { Db } from "../db.ts";
|
|
3
3
|
import { inTransaction } from "../db.ts";
|
|
4
|
-
import { normalizeFocusScope, type TaskFocusState, type TaskFocusStatus, type TaskFocusStore } from "
|
|
4
|
+
import { normalizeFocusScope, type TaskFocusState, type TaskFocusStatus, type TaskFocusStore } from "./task-focus-store.ts";
|
|
5
5
|
|
|
6
6
|
export class SQLiteTaskFocusStore implements TaskFocusStore {
|
|
7
7
|
constructor(private readonly db: Db) {}
|
|
@@ -2,7 +2,7 @@ import { TASK_LEASE_DEFAULT_TTL_MS } from "../constants.ts";
|
|
|
2
2
|
import type { Db } from "../db.ts";
|
|
3
3
|
import { inTransaction } from "../db.ts";
|
|
4
4
|
import { isLeaseExpired, type TaskLease, validateLeaseNote, validateLeaseOwner, validateLeaseTtlMs } from "../domain/task-lease.ts";
|
|
5
|
-
import type { TaskLeaseStore } from "
|
|
5
|
+
import type { TaskLeaseStore } from "./task-lease-store.ts";
|
|
6
6
|
|
|
7
7
|
interface TaskLeaseRow {
|
|
8
8
|
task_id: string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Db } from "../db.ts";
|
|
2
2
|
import { inTransaction } from "../db.ts";
|
|
3
3
|
import type { TaskProjectScope, TaskScopeSource, TaskViewMode, TaskViewPreference } from "../domain/task-scope.ts";
|
|
4
|
-
import type { TaskScopeStore } from "
|
|
4
|
+
import type { TaskScopeStore } from "./task-scope-store.ts";
|
|
5
5
|
|
|
6
6
|
export class SQLiteTaskScopeStore implements TaskScopeStore {
|
|
7
7
|
constructor(private readonly db: Db) {}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type {
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
1
|
+
import type { Artifact } from "../artifact/artifact.ts";
|
|
2
|
+
import type { ArtifactStore } from "../artifact/artifact-store.ts";
|
|
3
|
+
import { TASK_CONTEXT_CURRENT_LIMIT, TASK_CONTEXT_REJECTED_LIMIT, TASK_RECONCILIATION_INSTRUCTION } from "../constants.ts";
|
|
4
|
+
import { DISCUSSION_SUBTYPE, readDiscussionExtra } from "../domain/discussion.ts";
|
|
5
5
|
|
|
6
6
|
interface Gate {
|
|
7
7
|
type?: unknown;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { TASK_EXECUTION_MAX_DEGREE, TASK_EXECUTION_MAX_EDGES, TASK_EXECUTION_MAX_NODES } from "
|
|
1
|
+
import { TASK_EXECUTION_MAX_DEGREE, TASK_EXECUTION_MAX_EDGES, TASK_EXECUTION_MAX_NODES } from "../constants.ts";
|
|
2
2
|
import type { TaskGraph } from "./task-service.ts";
|
|
3
3
|
|
|
4
4
|
/** A task execution graph is too large or too densely connected to process safely -- a distinct class (not a plain Error) so the Vehicle adapter layer can classify it into a capacity-category failure instead of an opaque handler-failed. */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { DisplayGraph, DisplayGraphEdge } from "
|
|
1
|
+
import type { DisplayGraph, DisplayGraphEdge } from "../domain/display-graph.ts";
|
|
2
2
|
import { projectTaskExecution, type TaskExecutionState } from "./task-execution.ts";
|
|
3
3
|
import type { TaskGraph } from "./task-service.ts";
|
|
4
4
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Artifact, ArtifactEdge } from "
|
|
2
|
-
import type { DisplayGraph, DisplayGraphEdge, DisplayGraphNode } from "
|
|
1
|
+
import type { Artifact, ArtifactEdge } from "../artifact/artifact.ts";
|
|
2
|
+
import type { DisplayGraph, DisplayGraphEdge, DisplayGraphNode } from "../domain/display-graph.ts";
|
|
3
3
|
import type { TaskGraph } from "./task-service.ts";
|
|
4
4
|
|
|
5
5
|
function normalizeEdge(edge: ArtifactEdge): DisplayGraphEdge {
|
|
@@ -9,7 +9,7 @@ function normalizeEdge(edge: ArtifactEdge): DisplayGraphEdge {
|
|
|
9
9
|
return { from: edge.from, to: edge.to, label: edge.relation };
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
/** Best-effort readable label from a bare id when no real title is known -- shared with artifact-relationship-view.ts's generic version of this same problem. */
|
|
12
|
+
/** Best-effort readable label from a bare id when no real title is known -- shared with artifact/artifact-relationship-view.ts's generic version of this same problem. */
|
|
13
13
|
export function fallbackLabel(id: string): string {
|
|
14
14
|
return id.replace(/-[a-z0-9]{4}$/i, "").replaceAll("-", " ");
|
|
15
15
|
}
|