yarramate 0.16.0 → 0.18.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.
Files changed (49) hide show
  1. package/README.md +2 -1
  2. package/dist/adapters/graphify-cli.js +0 -0
  3. package/dist/adapters/likec4-cli.js +0 -0
  4. package/dist/adapters/mcp-cli.js +0 -0
  5. package/dist/adapters/visual/client.d.ts +74 -0
  6. package/dist/adapters/visual/client.js +448 -0
  7. package/dist/adapters/visual/likec4-compiler.d.ts +55 -0
  8. package/dist/adapters/visual/likec4-compiler.js +460 -0
  9. package/dist/adapters/visual/protocol-contract.d.ts +246 -0
  10. package/dist/adapters/visual/protocol-contract.js +19 -0
  11. package/dist/adapters/visual/protocol.d.ts +13 -0
  12. package/dist/adapters/visual/protocol.js +258 -0
  13. package/dist/adapters/visual/session-server.d.ts +130 -0
  14. package/dist/adapters/visual/session-server.js +1406 -0
  15. package/dist/adapters/visual/session-store.d.ts +126 -0
  16. package/dist/adapters/visual/session-store.js +755 -0
  17. package/dist/adapters/visual/wire.d.ts +93 -0
  18. package/dist/adapters/visual/wire.js +1 -0
  19. package/dist/adapters/visual-cli.d.ts +42 -0
  20. package/dist/adapters/visual-cli.js +274 -0
  21. package/dist/attestation-staleness.js +8 -1
  22. package/dist/cli.js +0 -0
  23. package/dist/compiler.d.ts +12 -0
  24. package/dist/compiler.js +46 -2
  25. package/dist/reconciliation.d.ts +17 -1
  26. package/dist/reconciliation.js +48 -1
  27. package/dist/rtm.d.ts +1 -0
  28. package/dist/rtm.js +9 -7
  29. package/dist/visual-app/assets/index-CGvC8e3R.css +1 -0
  30. package/dist/visual-app/assets/index-CXuW1tOj.js +209 -0
  31. package/dist/visual-app/index.html +18 -0
  32. package/docs/CONSUMING-YARRAMATE.md +49 -0
  33. package/package.json +25 -5
  34. package/schema/yarramate-ask-result.schema.json +4 -0
  35. package/schema/yarramate-document.schema.json +5 -0
  36. package/schema/yarramate-operations.schema.json +7 -1
  37. package/schema/yarramate-reconciliation-report.schema.json +36 -1
  38. package/schema/yarramate-visual-diagnostic-result.schema.json +67 -0
  39. package/schema/yarramate-visual-event.schema.json +255 -0
  40. package/schema/yarramate-visual-handoff.schema.json +120 -0
  41. package/schema/yarramate-visual-model.schema.json +111 -0
  42. package/schema/yarramate-visual-response.schema.json +230 -0
  43. package/schema/yarramate-visual-session-descriptor.schema.json +45 -0
  44. package/schema/yarramate-visual-session-request.schema.json +110 -0
  45. package/schema/yarramate-visual-session-started.schema.json +121 -0
  46. package/schema/yarramate-visual-status.schema.json +123 -0
  47. package/skills/yarramate-architecture/SKILL.md +28 -1
  48. package/skills/yarramate-architecture/references/native-authoring.md +15 -3
  49. package/skills/yarramate-architecture/references/visual-conversations.md +263 -0
@@ -0,0 +1,126 @@
1
+ import { type VisualAuthority, type VisualDiagnostic, type VisualEvent, type VisualFreezeReason, type VisualHandoff, type VisualModel, type VisualResponse, type VisualSessionDescriptor, type VisualSessionRequest, type VisualTerminationReason } from './protocol.js';
2
+ export declare const VISUAL_SESSION_MARKER_FORMAT: 'yarramate/visual-session-marker/v1';
3
+ export declare const VISUAL_ACTIVE_MODEL_FORMAT: 'yarramate/visual-active-model/v1';
4
+ /**
5
+ * Upper bound on how many orphaned sessions one `start` prunes. Cleanup runs on
6
+ * the critical path of a new session, so a directory full of orphans must cost
7
+ * a bounded amount of work; the remainder is collected by the next start.
8
+ */
9
+ export declare const VISUAL_SESSION_PRUNE_LIMIT = 64;
10
+ /**
11
+ * Whether a journaled event requires an agent turn. Navigation is journaled for
12
+ * context but only interrupts the agent when the browser marked it as needing
13
+ * attention. The runtime shares this definition rather than restating it, so
14
+ * the queue the server bounds and the events recovery replays cannot diverge.
15
+ */
16
+ export declare const isActionableVisualEvent: (event: VisualEvent) => boolean;
17
+ export interface VisualSessionPaths {
18
+ readonly root: string;
19
+ readonly marker: string;
20
+ readonly descriptor: string;
21
+ readonly journal: string;
22
+ readonly candidates: string;
23
+ readonly activeModel: string;
24
+ }
25
+ export interface SessionDependencies {
26
+ readonly baseDir: string;
27
+ readonly now: () => Date;
28
+ readonly randomBytes: (size: number) => Buffer;
29
+ }
30
+ /**
31
+ * What the runtime needs to mint one terminal event. It is the same clock and
32
+ * the same random source the session was created with, so a test drives the
33
+ * closing record exactly as it drives every other one.
34
+ */
35
+ export type TerminalEventDependencies = Omit<SessionDependencies, 'baseDir'>;
36
+ /**
37
+ * The only session state that outlives the runtime process. Recovery never
38
+ * resumes the server or the compiler, so the marker carries the session
39
+ * identity, its age for pruning, and the authority label the handoff must
40
+ * report — and deliberately not the candidate model or the compiler vector.
41
+ */
42
+ export interface VisualSessionMarker {
43
+ readonly format: typeof VISUAL_SESSION_MARKER_FORMAT;
44
+ readonly id: string;
45
+ readonly createdAt: string;
46
+ readonly authority: VisualAuthority;
47
+ }
48
+ /**
49
+ * Last-good rendering pointer. It names a staged candidate directory instead of
50
+ * embedding the model so the swap is a single rename of a small file.
51
+ */
52
+ export interface VisualActiveModel {
53
+ readonly format: typeof VISUAL_ACTIVE_MODEL_FORMAT;
54
+ readonly candidate: string;
55
+ readonly authority: VisualAuthority;
56
+ readonly initialView: string;
57
+ readonly promotedAt: string;
58
+ }
59
+ export interface VisualSessionCreated {
60
+ readonly paths: VisualSessionPaths;
61
+ readonly browserToken: string;
62
+ readonly agentToken: string;
63
+ }
64
+ export interface VisualAppendAccepted {
65
+ readonly ok: true;
66
+ readonly lastSequence: number;
67
+ readonly transcriptBytes: number;
68
+ readonly duplicate: boolean;
69
+ }
70
+ export interface VisualAppendRejected {
71
+ readonly ok: false;
72
+ readonly freeze?: VisualFreezeReason;
73
+ readonly diagnostics: readonly VisualDiagnostic[];
74
+ }
75
+ export type VisualAppendResult = VisualAppendAccepted | VisualAppendRejected;
76
+ export interface ModelPromotion {
77
+ readonly model: VisualModel;
78
+ readonly now: () => Date;
79
+ readonly compile: (candidateDir: string) => Promise<readonly VisualDiagnostic[]>;
80
+ }
81
+ export interface ModelPromotionResult {
82
+ readonly promoted: boolean;
83
+ readonly candidate: string;
84
+ readonly candidateDir: string;
85
+ readonly diagnostics: readonly VisualDiagnostic[];
86
+ }
87
+ export declare const visualSessionPaths: (root: string) => VisualSessionPaths;
88
+ export declare const createVisualSession: (request: VisualSessionRequest, deps: SessionDependencies) => Promise<VisualSessionCreated>;
89
+ /**
90
+ * Publishes the agent's entry point into a live session. The descriptor is the
91
+ * only file that carries the agent capability, so it is written with the same
92
+ * private write-then-rename every other session document uses, and only after
93
+ * the marker confirms the descriptor describes this session and no other.
94
+ */
95
+ export declare const writeVisualSessionDescriptor: (paths: VisualSessionPaths, descriptor: VisualSessionDescriptor) => Promise<void>;
96
+ export declare const appendVisualEvent: (paths: VisualSessionPaths, event: VisualEvent) => Promise<VisualAppendResult>;
97
+ export declare const appendVisualResponse: (paths: VisualSessionPaths, response: VisualResponse) => Promise<VisualAppendResult>;
98
+ /**
99
+ * Journals the one record that closes a session, and answers with the record a
100
+ * session already has. Every terminal cause — a reviewer's End, a failed child,
101
+ * a browser that never came back, a cancellation, a restart collecting what a
102
+ * dead runtime left — converges here, so a session ends exactly once no matter
103
+ * how many of them fire.
104
+ */
105
+ export declare const appendTerminalEvent: (paths: VisualSessionPaths, reason: VisualTerminationReason, deps: TerminalEventDependencies) => Promise<VisualEvent>;
106
+ export declare const readActionableEventsAfter: (paths: VisualSessionPaths, sequence: number) => Promise<readonly VisualEvent[]>;
107
+ export declare const recoverVisualSession: (paths: VisualSessionPaths, includeTranscript?: boolean) => Promise<VisualHandoff>;
108
+ export declare const readActiveVisualModel: (paths: VisualSessionPaths) => Promise<VisualActiveModel | undefined>;
109
+ export declare const promoteCompiledModel: (paths: VisualSessionPaths, promotion: ModelPromotion) => Promise<ModelPromotionResult>;
110
+ /**
111
+ * Recovers the handoff and only then deletes the session, so cleanup can never
112
+ * be the step that loses confirmed state. Returns `undefined` when the session
113
+ * is already gone, which makes a repeated stop idempotent.
114
+ */
115
+ export declare const removeVisualSession: (paths: VisualSessionPaths, includeTranscript?: boolean) => Promise<VisualHandoff | undefined>;
116
+ /**
117
+ * Removes orphaned sessions a previous runtime left behind. Only directories
118
+ * carrying a marker that names them are touched, and never more than `limit`
119
+ * per pass; the least recently active go first.
120
+ *
121
+ * Staleness is measured against what the session last wrote, not against the
122
+ * marker's creation time: a conversation that has run for two days is the
123
+ * working case, and deleting it under a live runtime would destroy the
124
+ * transcript the agent is still appending to.
125
+ */
126
+ export declare const pruneStaleVisualSessions: (baseDir: string, now: Date, limit?: number) => Promise<readonly string[]>;