@fungi.computer/parakeet 0.1.0 → 0.2.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 (59) hide show
  1. package/README.md +45 -6
  2. package/dist/account-commands.js +3 -11
  3. package/dist/commands/advertised.d.ts +3 -1
  4. package/dist/commands/advertised.js +89 -4
  5. package/dist/commands/interactions.d.ts +22 -7
  6. package/dist/commands/interactions.js +41 -17
  7. package/dist/commands/slash.js +3 -5
  8. package/dist/commands/use-slash-commands.js +2 -2
  9. package/dist/components/AgentHead.d.ts +2 -0
  10. package/dist/components/AgentHead.js +5 -4
  11. package/dist/components/ChatComposer.d.ts +3 -1
  12. package/dist/components/ChatComposer.js +79 -15
  13. package/dist/components/ChatMessage.d.ts +4 -0
  14. package/dist/components/ChatMessage.js +6 -2
  15. package/dist/components/ClientRows.js +2 -2
  16. package/dist/components/InteractionPanel.d.ts +2 -4
  17. package/dist/components/InteractionPanel.js +2 -2
  18. package/dist/components/TimelineItem.d.ts +2 -0
  19. package/dist/components/TimelineItem.js +31 -7
  20. package/dist/conversation-opening.d.ts +47 -0
  21. package/dist/conversation-opening.js +173 -0
  22. package/dist/conversation.d.ts +47 -3
  23. package/dist/conversation.js +584 -86
  24. package/dist/core/author-labels.d.ts +2 -0
  25. package/dist/core/build-timeline.d.ts +4 -2
  26. package/dist/core/build-timeline.js +46 -7
  27. package/dist/core/client-actions.js +6 -3
  28. package/dist/core/client-timeline.d.ts +9 -2
  29. package/dist/core/client-timeline.js +15 -4
  30. package/dist/core/draft-storage.d.ts +63 -0
  31. package/dist/core/draft-storage.js +50 -0
  32. package/dist/core/model-identity.d.ts +2 -0
  33. package/dist/core/model-identity.js +6 -0
  34. package/dist/core/queued-recall.d.ts +35 -0
  35. package/dist/core/queued-recall.js +138 -0
  36. package/dist/core/session-projection.js +17 -0
  37. package/dist/core/session-query.d.ts +54 -11
  38. package/dist/core/session-query.js +38 -12
  39. package/dist/core/tool-groups.d.ts +1 -1
  40. package/dist/core/tool-groups.js +3 -1
  41. package/dist/core/tool-view.js +2 -1
  42. package/dist/core/use-timeline-item-key.d.ts +8 -0
  43. package/dist/core/use-timeline-item-key.js +29 -0
  44. package/dist/headless.d.ts +6 -4
  45. package/dist/headless.js +1 -1
  46. package/dist/index.d.ts +2 -2
  47. package/dist/index.js +1 -1
  48. package/dist/model-commands.js +64 -39
  49. package/dist/parakeet.js +17 -18
  50. package/dist/session-commands.d.ts +0 -9
  51. package/dist/session-commands.js +39 -68
  52. package/dist/session.d.ts +1 -1
  53. package/dist/store/types.d.ts +10 -4
  54. package/dist/styles.css +27 -12
  55. package/docs/api/commands/slash.md +24 -21
  56. package/docs/api/headless.md +375 -232
  57. package/docs/api/index.md +157 -45
  58. package/package.json +16 -10
  59. package/src/styles.css +0 -9
@@ -1,13 +1,15 @@
1
1
  import { type ParakeetAuthorOf } from "./core/author-labels.js";
2
- import { type PromptDelivery, type SessionContext, type SessionExtensionSlots, type SessionPendingPrompts } from "@fungi.computer/shiitake/client";
2
+ import { type PromptDelivery, type PromptCommand, type SessionContext, type SessionExtensionSlots, type SessionPendingPrompts } from "@fungi.computer/shiitake/client";
3
3
  import type { ClientEntryV1 } from "@fungi.computer/shiitake/client-entry";
4
4
  import { type ClientContribution } from "./core/client-contributions.js";
5
- import { type ParakeetInteractions } from "./commands/interactions.js";
5
+ import { type ParakeetInteractions, type ParakeetToast } from "./commands/interactions.js";
6
6
  import type { WhistleExecutionOutcome } from "@fungi.computer/whistle";
7
7
  import { type ReactNode } from "react";
8
8
  import { type SessionViewState } from "./core/session-view-state.js";
9
9
  import type { ParakeetSession } from "./session.js";
10
10
  import type { TimelineItem } from "./store/types.js";
11
+ import { type QueuedRecallState, type QueuedRecallOutcome } from "./core/queued-recall.js";
12
+ import { type ParakeetDraftIdentity, type ParakeetDraftStorage } from "./core/draft-storage.js";
11
13
  /** Stable model identity presented by the current Session. */
12
14
  export type ParakeetModel = Readonly<{
13
15
  /** Provider model identifier. */
@@ -49,10 +51,16 @@ export type ParakeetObservation = Readonly<{
49
51
  }>;
50
52
  /** Stable history and replaceable work rendered by a conversation client. */
51
53
  export type TimelineController = Readonly<{
54
+ /** Remove one owner-admitted queued prompt, never the running turn or draft. */
55
+ cancelQueued: (commandId: string) => Promise<void>;
56
+ /** A queued-input gesture is waiting for its owner. */
57
+ cancellingQueued: boolean;
52
58
  /** Durable-backed rows whose identity is stable across progress revisions. */
53
59
  settled: readonly TimelineItem[];
54
60
  /** Replaceable progress, queued, and optimistic rows. */
55
61
  tail: readonly TimelineItem[];
62
+ /** Fixed committed Session positions resolved within the loaded history. */
63
+ positionAnchors: ReadonlyMap<number, string | null>;
56
64
  /** Last actually rendered durable row for each loaded command. */
57
65
  commandAnchors: ReadonlyMap<string, string>;
58
66
  /** Current owner-admitted prompts, independent of the visible history page. */
@@ -78,12 +86,35 @@ export type TimelineController = Readonly<{
78
86
  /** Accumulated durable usage. */
79
87
  usage?: ParakeetUsage | undefined;
80
88
  }>;
89
+ /** A host may proceed with restart only after the current journal committed. */
90
+ export type ParakeetDraftCheckpoint = Readonly<{
91
+ /** The latest draft is committed and restart may proceed. */
92
+ status: "saved";
93
+ }> | Readonly<{
94
+ /** Draft persistence failed; the host must not proceed with restart. */
95
+ status: "failed";
96
+ /** Storage failure explanation for the host. */
97
+ reason: string;
98
+ }>;
81
99
  /** Draft and prompt operations for the current conversation. */
82
100
  export type ComposerController = Readonly<{
83
101
  /** Stop the current turn. Queued prompts keep draining; the draft is unchanged. */
84
102
  cancel: () => Promise<void>;
85
103
  /** Current local input. */
86
104
  draft: string;
105
+ /** Image cargo restored with a queued prompt, carried through the same journal. */
106
+ images: PromptCommand["images"];
107
+ /** Shared composer reservation and recall outcome. */
108
+ recallState: QueuedRecallState;
109
+ /** Recall only when the host accepted a plain Up on empty, focused input. */
110
+ recall: () => Promise<QueuedRecallOutcome>;
111
+ /**
112
+ * Commit the latest draft and pending admissions synchronously, even through
113
+ * a callback captured before newer typing. Does not consume, send or withdraw.
114
+ * A resumed provider reads the same Session journal; never replay a copied
115
+ * draft over its newer state. A failed commit leaves the live draft untouched.
116
+ */
117
+ checkpointDraft: () => ParakeetDraftCheckpoint;
87
118
  /** Typed reason the latest prompt did not complete. */
88
119
  failure: "admission" | "failed" | "cancelled" | "interrupted" | undefined;
89
120
  /** Current send could not enter the bounded local admission queue. */
@@ -136,11 +167,24 @@ export type ParakeetReconnectOutcome = Readonly<{
136
167
  cause: string;
137
168
  }>;
138
169
  /** Own one renderer-neutral conversation scope over the existing query cache. */
139
- export declare function ParakeetProvider({ children, session, clients, interactionStore, authorOf, }: Readonly<{
170
+ export declare function ParakeetProvider({ children, session, clients, interactionStore, authorOf, onToast, draftStorage, draftIdentity, }: Readonly<{
140
171
  children: ReactNode;
141
172
  session: ParakeetSession;
142
173
  clients?: readonly ClientEntryV1[] | undefined;
143
174
  interactionStore?: ParakeetInteractions | undefined;
175
+ /** Show a transient message; the host owns the toast surface. */
176
+ onToast?: ((toast: ParakeetToast) => void) | undefined;
177
+ /**
178
+ * Browser localStorage when accessible, otherwise session-only drafts.
179
+ * Native hosts supply an atomic file adapter.
180
+ */
181
+ draftStorage?: ParakeetDraftStorage | undefined;
182
+ /**
183
+ * Hosts replacing transport endpoints must supply the durable owner pair.
184
+ * Otherwise the Session's logical address names its journal.
185
+ * Exactly one key is used; no previous-address lookup or migration occurs.
186
+ */
187
+ draftIdentity?: ParakeetDraftIdentity | undefined;
144
188
  /**
145
189
  * Read the author to show from a message's opaque host metadata. Absent,
146
190
  * lines show no author.