@sublang/playbook 6.0.0 → 7.0.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/README.md +14 -10
- package/docs/cli.md +102 -57
- package/docs/configuration.md +57 -16
- package/package.json +3 -1
- package/reference/sdlc/code.playbook/bin/launch-config.js +938 -0
- package/reference/sdlc/code.playbook/bin/playbook.js +145 -562
- package/reference/sdlc/code.playbook/bin/provision.js +84 -38
- package/reference/sdlc/code.playbook/bin/run.js +1171 -983
- package/reference/sdlc/code.playbook/bin/session-store.js +1169 -0
- package/reference/sdlc/code.playbook/playbook-captain.d.ts +70 -3
- package/reference/sdlc/code.playbook/playbook-captain.js +864 -68
- package/reference/sdlc/code.playbook/playbook-captain.ts +1296 -64
- package/reference/sdlc/code.playbook/playbook.config.template.yaml +4 -14
- package/reference/sdlc/decide.playbook/decide.playbook.js +77 -13
- package/reference/sdlc/decide.playbook/decide.playbook.ts +93 -14
- package/slc/link.md +35 -12
- package/src/runtime.d.ts +14 -2
- package/src/runtime.ts +26 -6
- package/src/xstate-playbook-runtime.js +64 -14
- package/src/xstate-playbook-runtime.ts +79 -13
- package/src/xstate-runtime.d.ts +19 -2
- package/src/xstate-runtime.js +359 -57
- package/src/xstate-runtime.ts +491 -71
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Captain } from '@sublang/cligent/tmux-play';
|
|
2
|
-
import type { PlaybookRuntime } from '@sublang/playbook/runtime';
|
|
1
|
+
import type { Captain, CaptainSession } from '@sublang/cligent/tmux-play';
|
|
2
|
+
import type { JsonValue, PlaybookRuntime, PlaybookRuntimeSnapshot } from '@sublang/playbook/runtime';
|
|
3
3
|
import { type CaptainControllerPort } from '../captain.playbook/captain.playbook.js';
|
|
4
4
|
import type { PlaybookSummaryPolicy, RegistryPlayer } from './code.registry.js';
|
|
5
5
|
export interface CreatePlaybookRuntimeOptions {
|
|
@@ -27,5 +27,72 @@ export interface PlaybookCaptainRegistryEntry {
|
|
|
27
27
|
validateOptions(captainOptions: unknown): unknown;
|
|
28
28
|
createRuntime(options: CreatePlaybookRuntimeOptions): PlaybookRuntime;
|
|
29
29
|
}
|
|
30
|
-
|
|
30
|
+
type PlaybookCaptainConversationSnapshot = {
|
|
31
|
+
readonly kind: 'unopened';
|
|
32
|
+
} | {
|
|
33
|
+
readonly kind: 'pinned';
|
|
34
|
+
readonly token: string;
|
|
35
|
+
} | {
|
|
36
|
+
readonly kind: 'needsSeeding';
|
|
37
|
+
};
|
|
38
|
+
interface PlaybookCaptainJournalRecord {
|
|
39
|
+
readonly seq: number;
|
|
40
|
+
readonly turnId: number;
|
|
41
|
+
readonly kind: 'boss' | 'reply' | 'handoff' | 'action' | 'outcome';
|
|
42
|
+
readonly payload: JsonValue;
|
|
43
|
+
}
|
|
44
|
+
interface PlaybookCaptainFrameSnapshot {
|
|
45
|
+
readonly playbookId: string;
|
|
46
|
+
readonly sessionId: string;
|
|
47
|
+
readonly rootSessionId: string;
|
|
48
|
+
readonly depth: number;
|
|
49
|
+
readonly parentSessionId?: string;
|
|
50
|
+
readonly parentCallId?: string;
|
|
51
|
+
readonly runtime: PlaybookRuntimeSnapshot;
|
|
52
|
+
}
|
|
53
|
+
interface PlaybookCaptainShellSnapshotFields {
|
|
54
|
+
readonly schemaVersion: 1;
|
|
55
|
+
readonly captain: {
|
|
56
|
+
readonly sessionId: string;
|
|
57
|
+
readonly runtime: PlaybookRuntimeSnapshot;
|
|
58
|
+
readonly conversation: PlaybookCaptainConversationSnapshot;
|
|
59
|
+
};
|
|
60
|
+
/** Every Captain and engagement UUID issued during this logical session. */
|
|
61
|
+
readonly issuedSessionIds: readonly string[];
|
|
62
|
+
readonly sequences: {
|
|
63
|
+
readonly turn: number;
|
|
64
|
+
readonly journal: number;
|
|
65
|
+
};
|
|
66
|
+
readonly journal: readonly PlaybookCaptainJournalRecord[];
|
|
67
|
+
readonly lastAction?: 'respond' | 'start' | 'switch' | 'dismiss' | 'deliver' | 'runtime';
|
|
68
|
+
readonly lastSettlementStatus?: 'ok' | 'rejected' | 'failed';
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Complete JSON-safe durable state for one Captain shell between Boss turns.
|
|
72
|
+
* The discriminated mode keeps chat snapshots free of stale engagement data.
|
|
73
|
+
*/
|
|
74
|
+
export type PlaybookCaptainShellSnapshot = PlaybookCaptainShellSnapshotFields & ({
|
|
75
|
+
readonly mode: 'chat';
|
|
76
|
+
readonly frames?: never;
|
|
77
|
+
readonly rootPlayerResumeTokens?: never;
|
|
78
|
+
readonly pendingBossQuestions?: never;
|
|
79
|
+
readonly lastError?: never;
|
|
80
|
+
} | {
|
|
81
|
+
readonly mode: 'engaged.parked';
|
|
82
|
+
/** Root-to-leaf engagement order. */
|
|
83
|
+
readonly frames: readonly PlaybookCaptainFrameSnapshot[];
|
|
84
|
+
/** Root-owned continuation, keyed by effective host-player id. */
|
|
85
|
+
readonly rootPlayerResumeTokens: Readonly<Record<string, string>>;
|
|
86
|
+
readonly pendingBossQuestions?: JsonValue;
|
|
87
|
+
readonly lastError?: {
|
|
88
|
+
readonly name: string;
|
|
89
|
+
readonly message: string;
|
|
90
|
+
};
|
|
91
|
+
});
|
|
92
|
+
/** tmux and headless front ends share this one durable Captain shell API. */
|
|
93
|
+
export interface PlaybookCaptainShell extends Captain {
|
|
94
|
+
exportSnapshot(): PlaybookCaptainShellSnapshot | undefined;
|
|
95
|
+
restore(session: CaptainSession, snapshot: PlaybookCaptainShellSnapshot): Promise<void>;
|
|
96
|
+
}
|
|
97
|
+
export declare function createPlaybookCaptainShell(options: unknown, deps?: PlaybookCaptainDeps): PlaybookCaptainShell;
|
|
31
98
|
export default createPlaybookCaptainShell;
|