@danypops/papyrus 0.36.0 → 0.36.1
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/modules/playbooks.ts +7 -2
- package/src/service.ts +1 -1
package/package.json
CHANGED
package/src/modules/playbooks.ts
CHANGED
|
@@ -28,6 +28,7 @@ import type { ArtifactStore } from "../ports/artifact-store.ts";
|
|
|
28
28
|
import type { TaskEventStore } from "../ports/task-event-store.ts";
|
|
29
29
|
import type { TaskScopeStore } from "../ports/task-scope-store.ts";
|
|
30
30
|
import { invokePlaybook } from "../playbook-execution.ts";
|
|
31
|
+
import type { SessionIdentity } from "../session-identity-service.ts";
|
|
31
32
|
import type { Tasks } from "../task-service.ts";
|
|
32
33
|
|
|
33
34
|
const MODULE_ID = "playbooks";
|
|
@@ -86,9 +87,11 @@ export interface PlaybooksModuleDeps {
|
|
|
86
87
|
artifactScopes: ArtifactScopeStore;
|
|
87
88
|
/** 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). */
|
|
88
89
|
tasks: Tasks;
|
|
90
|
+
/** 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. */
|
|
91
|
+
sessionIdentity: SessionIdentity;
|
|
89
92
|
}
|
|
90
93
|
|
|
91
|
-
export function playbooksOperations({ artifacts, events, scopes, artifactScopes, tasks }: PlaybooksModuleDeps): OperationDefinition[] {
|
|
94
|
+
export function playbooksOperations({ artifacts, events, scopes, artifactScopes, tasks, sessionIdentity }: PlaybooksModuleDeps): OperationDefinition[] {
|
|
92
95
|
const define = <Input, Output>(name: string, execute: (input: Input) => Output): OperationDefinition<Input, Output> => ({
|
|
93
96
|
name, moduleId: MODULE_ID, execute,
|
|
94
97
|
});
|
|
@@ -109,7 +112,9 @@ export function playbooksOperations({ artifacts, events, scopes, artifactScopes,
|
|
|
109
112
|
arguments: input["arguments"] as Record<string, unknown> | undefined,
|
|
110
113
|
}, { events, scopes, projectRoot: optionalString(input, "project_root"), context: eventContextFor(input, "playbook-run") });
|
|
111
114
|
if ("missingArguments" in result) return result;
|
|
112
|
-
|
|
115
|
+
const focusContext = eventContextFor(input, "playbook-run");
|
|
116
|
+
sessionIdentity.assertAuthorized(focusContext.sessionId, optionalString(input, "session_secret"));
|
|
117
|
+
tasks.focus(result.entryTaskId, focusContext);
|
|
113
118
|
return result;
|
|
114
119
|
}),
|
|
115
120
|
define("playbooks.enable", (input: OperationInput) => transitionPlaybook(artifacts, string(input, "id"), "enable", eventContext(input))),
|
package/src/service.ts
CHANGED
|
@@ -481,7 +481,7 @@ export function createPapyrusService(path: string): PapyrusService {
|
|
|
481
481
|
moduleRegistry.registerAll(docsOperations(artifacts, artifactScopes, authority));
|
|
482
482
|
moduleRegistry.registerAll(rulesOperations(artifacts, artifactScopes));
|
|
483
483
|
moduleRegistry.registerAll(skillsOperations({ artifacts, events, scopes, artifactScopes, authority }));
|
|
484
|
-
moduleRegistry.registerAll(playbooksOperations({ artifacts, events, scopes, artifactScopes, tasks }));
|
|
484
|
+
moduleRegistry.registerAll(playbooksOperations({ artifacts, events, scopes, artifactScopes, tasks, sessionIdentity }));
|
|
485
485
|
moduleRegistry.registerAll(graphProjectionOperations(artifacts, projections, authority));
|
|
486
486
|
const registry = handlers(artifacts, gates, tasks, notes, events, scopes, () => migrateDb(db), moduleRegistry, authority);
|
|
487
487
|
const state = (): SchemaState => {
|