@timurproko/a1 0.1.8-dev.322 → 0.1.8-dev.332

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 (52) hide show
  1. package/dist/cli/dispatch.js +1 -1
  2. package/dist/features/owned-ui/project-trust-prompt.js +1 -1
  3. package/dist/features/owned-ui/settings-app.js +1 -1
  4. package/dist/features/prompt-history/service.d.ts +31 -1
  5. package/dist/features/prompt-history/service.js +294 -129
  6. package/dist/features/prompt-history/store.d.ts +2 -1
  7. package/dist/features/prompt-history/store.js +17 -4
  8. package/dist/features/prompt-history/worker.js +6 -3
  9. package/dist/foundation/launch-context/index.d.ts +36 -6
  10. package/dist/foundation/launch-context/index.js +64 -11
  11. package/dist/foundation/launch-guardian/main.js +2 -1
  12. package/dist/foundation/release/bootstrap.d.ts +5 -0
  13. package/dist/foundation/release/bootstrap.js +49 -9
  14. package/dist/foundation/release/cohort-state.js +0 -3
  15. package/dist/foundation/release/dependency-certification-retention.d.ts +7 -0
  16. package/dist/foundation/release/dependency-certification-retention.js +88 -0
  17. package/dist/foundation/release/dependency-certification.d.ts +24 -0
  18. package/dist/foundation/release/dependency-certification.js +208 -0
  19. package/dist/foundation/release/dependency-layer.d.ts +3 -4
  20. package/dist/foundation/release/dependency-layer.js +6 -37
  21. package/dist/foundation/release/release-gc.js +72 -44
  22. package/dist/foundation/release/release-store.d.ts +2 -0
  23. package/dist/foundation/release/release-store.js +4 -3
  24. package/dist/foundation/release/restart-certification.js +16 -5
  25. package/dist/foundation/release/update.js +1 -6
  26. package/dist/foundation/release/warmup.js +16 -5
  27. package/dist/integrations/pi/components/owned-editor-ux.d.ts +1 -1
  28. package/dist/integrations/pi/components/owned-editor-ux.js +51 -27
  29. package/dist/integrations/pi/engine/adapter.d.ts +20 -0
  30. package/dist/integrations/pi/engine/adapter.js +223 -87
  31. package/dist/integrations/pi/engine/pending-delivery.d.ts +26 -0
  32. package/dist/integrations/pi/engine/pending-delivery.js +149 -0
  33. package/dist/integrations/pi/session-ui/prompt-chips.js +38 -25
  34. package/dist/integrations/pi/session-ui/prompt-history-controller.d.ts +0 -2
  35. package/dist/integrations/pi/session-ui/prompt-history-controller.js +3 -8
  36. package/dist/integrations/pi/session-ui/session-shell-root.d.ts +1 -1
  37. package/dist/integrations/pi/session-ui/session-shell-root.js +5 -1
  38. package/dist/integrations/pi/session-ui/session-shell.js +9 -6
  39. package/dist/integrations/pi/session-ui/session-viewport-controller.d.ts +2 -2
  40. package/dist/integrations/pi/session-ui/session-viewport-controller.js +4 -5
  41. package/dist/integrations/pi/session-ui/text-paste.d.ts +5 -0
  42. package/dist/integrations/pi/session-ui/text-paste.js +16 -0
  43. package/dist/integrations/pi/tui-runtime/damage-aware-terminal.d.ts +2 -2
  44. package/dist/integrations/pi/tui-runtime/damage-aware-terminal.js +82 -39
  45. package/dist/native/darwin-arm64/manifest.json +1 -1
  46. package/dist/native/linux-x64/manifest.json +1 -1
  47. package/dist/native/win32-x64/manifest.json +2 -2
  48. package/dist/native/win32-x64/process-guardian.exe +0 -0
  49. package/dist/product-identity.json +1 -1
  50. package/docs/architecture/internal-naming.md +5 -3
  51. package/docs/manual-code-streaming-cleanup.md +88 -0
  52. package/package.json +1 -1
@@ -8,7 +8,7 @@ import type { PiShellClipboardContent, PiShellEditorTextRange } from "./shell-sh
8
8
  * Pi editor port and gives future interactions one registration point.
9
9
  */
10
10
  export interface OwnedEditorUxInterceptor {
11
- handleInput(data: string, next: () => void): void;
11
+ handleInput(data: string, next: (data?: string) => void): void;
12
12
  render(width: number, next: () => string[]): string[];
13
13
  reset(): void;
14
14
  handlePointer?(event: OwnedEditorPointerEvent): boolean;
@@ -8,15 +8,15 @@ export class OwnedEditorUxInterception {
8
8
  this.fallback = fallback;
9
9
  }
10
10
  handleInput(data) {
11
- const invoke = (index) => {
11
+ const invoke = (index, input) => {
12
12
  const interceptor = this.interceptors[index];
13
13
  if (interceptor === undefined) {
14
- this.fallback.handleInput(data);
14
+ this.fallback.handleInput(input);
15
15
  return;
16
16
  }
17
- interceptor.handleInput(data, () => invoke(index + 1));
17
+ interceptor.handleInput(input, (replacement = input) => invoke(index + 1, replacement));
18
18
  };
19
- invoke(0);
19
+ invoke(0, data);
20
20
  }
21
21
  render(width) {
22
22
  const invoke = (index) => {
@@ -65,6 +65,7 @@ class PromptSelectionInterceptor {
65
65
  #redoStack = [];
66
66
  #selectionRevision = 0;
67
67
  #pasteGeneration = 0;
68
+ #terminalPaste;
68
69
  #wordDirection;
69
70
  #geometry;
70
71
  constructor(editor, keybindings, options) {
@@ -74,6 +75,8 @@ class PromptSelectionInterceptor {
74
75
  installAtomicSegmentation(editor, options.atomicRanges, () => this.#wordDirection);
75
76
  }
76
77
  handleInput(data, next) {
78
+ if (this.#handleTerminalPaste(data, next))
79
+ return;
77
80
  if (this.keybindings.matches(data, "owned.editor.selectAll")) {
78
81
  this.#selectAll();
79
82
  return;
@@ -105,23 +108,6 @@ class PromptSelectionInterceptor {
105
108
  this.#redo();
106
109
  return;
107
110
  }
108
- const terminalPaste = bracketedPasteContent(data);
109
- if (terminalPaste !== undefined) {
110
- if (terminalPaste.length === 0) {
111
- this.pasteClipboard();
112
- return;
113
- }
114
- const transformed = this.options.transformPastedContent({ kind: "text", text: terminalPaste });
115
- if (transformed !== terminalPaste) {
116
- if (this.#orderedSelection() !== undefined)
117
- this.#replaceSelection(transformed);
118
- else
119
- this.editor.insertTextAtCursor(transformed);
120
- this.#redoStack = [];
121
- this.#requestRender();
122
- return;
123
- }
124
- }
125
111
  if (this.keybindings.matches(data, "tui.editor.undo")) {
126
112
  const before = this.#snapshot();
127
113
  this.#clearSelection(false);
@@ -291,7 +277,10 @@ class PromptSelectionInterceptor {
291
277
  this.#redoStack = [];
292
278
  this.#selectionRevision += 1;
293
279
  }
294
- cancelPendingPastes() { this.#pasteGeneration += 1; }
280
+ cancelPendingPastes() {
281
+ this.#pasteGeneration += 1;
282
+ this.#terminalPaste = undefined;
283
+ }
295
284
  hasSelection() {
296
285
  return this.#activeRange() !== undefined;
297
286
  }
@@ -450,6 +439,46 @@ class PromptSelectionInterceptor {
450
439
  this.#selectionRevision += 1;
451
440
  this.#requestRender();
452
441
  }
442
+ #handleTerminalPaste(data, next) {
443
+ const start = data.indexOf("\x1b[200~");
444
+ if (this.#terminalPaste === undefined) {
445
+ if (start < 0)
446
+ return false;
447
+ if (start > 0) {
448
+ const before = data.slice(0, start);
449
+ this.handleInput(before, (replacement = before) => next(replacement));
450
+ }
451
+ this.#terminalPaste = "";
452
+ data = data.slice(start + 6);
453
+ }
454
+ // Compatibility: the terminal's StdinBuffer assembles split opening delimiters;
455
+ // retain the body here too so editor-level chunks cannot allocate a native paste ID.
456
+ this.#terminalPaste += data;
457
+ const end = this.#terminalPaste.indexOf("\x1b[201~");
458
+ if (end < 0)
459
+ return true;
460
+ const text = this.#terminalPaste.slice(0, end);
461
+ const remaining = this.#terminalPaste.slice(end + 6);
462
+ this.#terminalPaste = undefined;
463
+ if (text.length === 0)
464
+ this.pasteClipboard();
465
+ else {
466
+ const transformed = this.options.transformPastedContent({ kind: "text", text });
467
+ if (transformed === text && this.#orderedSelection() === undefined)
468
+ next(`\x1b[200~${text}\x1b[201~`);
469
+ else {
470
+ if (this.#orderedSelection() !== undefined)
471
+ this.#replaceSelection(transformed);
472
+ else
473
+ this.editor.insertTextAtCursor(transformed);
474
+ this.#redoStack = [];
475
+ this.#requestRender();
476
+ }
477
+ }
478
+ if (remaining.length > 0)
479
+ this.handleInput(remaining, (replacement = remaining) => next(replacement));
480
+ return true;
481
+ }
453
482
  #pasteFromClipboard() {
454
483
  if (this.options.beginClipboardPaste !== undefined) {
455
484
  const generation = this.#pasteGeneration;
@@ -802,11 +831,6 @@ function isEditorSegment(value) {
802
831
  const input = Reflect.get(value, "input");
803
832
  return typeof segment === "string" && typeof index === "number" && typeof input === "string";
804
833
  }
805
- function bracketedPasteContent(data) {
806
- const start = data.indexOf("\u001b[200~");
807
- const end = data.indexOf("\u001b[201~", start + 6);
808
- return start < 0 || end < 0 ? undefined : data.slice(start + 6, end);
809
- }
810
834
  function insertedText(data) {
811
835
  if (!data || data.includes("\u001b[200~"))
812
836
  return undefined;
@@ -6,6 +6,10 @@ import { PiSettingsIntegration } from "./settings-integration.js";
6
6
  import type { PiSettingOwnerHandlers } from "./settings-effects.js";
7
7
  import type { PiProjectTrustPreflightPrompt } from "./project-trust-preflight.js";
8
8
  import type { AgentSettingOwner } from "../../../contracts/agent-engine/index.js";
9
+ /** Explicit flush failure when required delivery was interrupted rather than completed. */
10
+ export declare class EngineDeliveryError extends Error {
11
+ constructor();
12
+ }
9
13
  export interface PiEngineRuntimeFactoryInput {
10
14
  readonly cwd: string;
11
15
  readonly agentDir: string;
@@ -133,6 +137,8 @@ export declare class PiEngineAdapter implements OwnedUiPromptSuggestionGenerator
133
137
  setWorkflowInteractionHost(interaction: PiWorkflowInteractionHost): void;
134
138
  get sessionId(): string;
135
139
  get sessionGeneration(): number;
140
+ /** Actual session replacements, excluding delivery-only invalidation of callbacks. */
141
+ get sessionBindingGeneration(): number;
136
142
  get cwd(): string;
137
143
  get agentDir(): string;
138
144
  resolveTranscriptImage(assetId: string): OwnedUiImageAttachment | null;
@@ -142,6 +148,20 @@ export declare class PiEngineAdapter implements OwnedUiPromptSuggestionGenerator
142
148
  generate(request: OwnedUiPromptSuggestionRequest): Promise<OwnedUiPromptSuggestionResult>;
143
149
  start(): Promise<OwnedUiSessionViewModel>;
144
150
  onEvent(listener: (event: OwnedUiEvent) => void): () => void;
151
+ /** Developer-only pressure evidence; never mirrored into visible diagnostic/status arrays. */
152
+ deliveryDiagnostics(): {
153
+ overloads: number;
154
+ recovering: boolean;
155
+ pendingCommands: number;
156
+ reservedOutcomes: number;
157
+ invalidatedEvents: number;
158
+ pending: number;
159
+ bytes: number;
160
+ protected: number;
161
+ superseded: number;
162
+ peakNodes: number;
163
+ peakBytes: number;
164
+ };
145
165
  flushEvents(): Promise<void>;
146
166
  nonVisualResources(): readonly OwnedPiResourceSummary[];
147
167
  extensionResources(): readonly OwnedPiExtensionResourceSummary[];