@timurproko/a1 0.1.8-dev.299 → 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 (95) hide show
  1. package/README.md +16 -4
  2. package/bin/guardian.js +4 -3
  3. package/bin/ui.js +4 -2
  4. package/bin/update-recovery.js +3 -1
  5. package/dist/cli/dispatch.js +1 -1
  6. package/dist/composition/owned-ui.js +2 -1
  7. package/dist/features/launch/profile-paths.d.ts +2 -0
  8. package/dist/features/launch/profile-paths.js +11 -0
  9. package/dist/features/owned-ui/project-trust-prompt.js +1 -1
  10. package/dist/features/owned-ui/settings-app.js +1 -1
  11. package/dist/features/prompt-history/service.d.ts +31 -1
  12. package/dist/features/prompt-history/service.js +294 -129
  13. package/dist/features/prompt-history/store.d.ts +2 -1
  14. package/dist/features/prompt-history/store.js +17 -4
  15. package/dist/features/prompt-history/worker.js +6 -3
  16. package/dist/foundation/launch-context/index.d.ts +59 -0
  17. package/dist/foundation/launch-context/index.js +136 -0
  18. package/dist/foundation/launch-guardian/main.js +6 -4
  19. package/dist/foundation/release/bootstrap.d.ts +6 -1
  20. package/dist/foundation/release/bootstrap.js +59 -13
  21. package/dist/foundation/release/cohort-state.d.ts +1 -0
  22. package/dist/foundation/release/cohort-state.js +1 -0
  23. package/dist/foundation/release/dependency-certification-retention.d.ts +7 -0
  24. package/dist/foundation/release/dependency-certification-retention.js +88 -0
  25. package/dist/foundation/release/dependency-certification.d.ts +24 -0
  26. package/dist/foundation/release/dependency-certification.js +208 -0
  27. package/dist/foundation/release/dependency-layer.d.ts +3 -4
  28. package/dist/foundation/release/dependency-layer.js +6 -37
  29. package/dist/foundation/release/release-gc.js +74 -46
  30. package/dist/foundation/release/release-store.d.ts +2 -0
  31. package/dist/foundation/release/release-store.js +11 -3
  32. package/dist/foundation/release/release.d.ts +3 -1
  33. package/dist/foundation/release/release.js +7 -3
  34. package/dist/foundation/release/restart-certification.d.ts +1 -0
  35. package/dist/foundation/release/restart-certification.js +17 -1
  36. package/dist/foundation/release/update-recovery.d.ts +2 -0
  37. package/dist/foundation/release/update-recovery.js +4 -0
  38. package/dist/foundation/release/update.js +1 -1
  39. package/dist/foundation/release/warmup.d.ts +1 -1
  40. package/dist/foundation/release/warmup.js +18 -6
  41. package/dist/foundation/startup/startup-runtime.js +13 -11
  42. package/dist/foundation/supervision/main.js +8 -7
  43. package/dist/integrations/pi/components/owned-editor-ux.d.ts +2 -1
  44. package/dist/integrations/pi/components/owned-editor-ux.js +105 -30
  45. package/dist/integrations/pi/components/shell-editor-autocomplete.js +3 -0
  46. package/dist/integrations/pi/components/shell-presenters-info.d.ts +9 -2
  47. package/dist/integrations/pi/components/shell-presenters-info.js +35 -4
  48. package/dist/integrations/pi/components/shell-selectors-dialogs.d.ts +3 -2
  49. package/dist/integrations/pi/components/shell-selectors-dialogs.js +8 -5
  50. package/dist/integrations/pi/components/shell-shared-facade.d.ts +9 -2
  51. package/dist/integrations/pi/components/upstream/assets/earendil-image.json +12 -0
  52. package/dist/integrations/pi/components/upstream/components/earendil-announcement.js +25 -2
  53. package/dist/integrations/pi/engine/adapter.d.ts +33 -1
  54. package/dist/integrations/pi/engine/adapter.js +309 -112
  55. package/dist/integrations/pi/engine/changelog.d.ts +2 -0
  56. package/dist/integrations/pi/engine/changelog.js +63 -0
  57. package/dist/integrations/pi/engine/pending-delivery.d.ts +26 -0
  58. package/dist/integrations/pi/engine/pending-delivery.js +149 -0
  59. package/dist/integrations/pi/engine/resources/changelog.json +12 -0
  60. package/dist/integrations/pi/engine/workflow-controllers.d.ts +1 -1
  61. package/dist/integrations/pi/engine/workflows.d.ts +1 -1
  62. package/dist/integrations/pi/session-ui/prompt-chips.d.ts +3 -1
  63. package/dist/integrations/pi/session-ui/prompt-chips.js +74 -37
  64. package/dist/integrations/pi/session-ui/prompt-history-controller.d.ts +0 -2
  65. package/dist/integrations/pi/session-ui/prompt-history-controller.js +3 -8
  66. package/dist/integrations/pi/session-ui/session-shell-root.d.ts +26 -1
  67. package/dist/integrations/pi/session-ui/session-shell-root.js +70 -75
  68. package/dist/integrations/pi/session-ui/session-shell.d.ts +1 -1
  69. package/dist/integrations/pi/session-ui/session-shell.js +67 -13
  70. package/dist/integrations/pi/session-ui/session-viewport-controller.d.ts +7 -2
  71. package/dist/integrations/pi/session-ui/session-viewport-controller.js +25 -20
  72. package/dist/integrations/pi/session-ui/text-paste.d.ts +5 -0
  73. package/dist/integrations/pi/session-ui/text-paste.js +16 -0
  74. package/dist/integrations/pi/tui-runtime/damage-aware-terminal.d.ts +9 -2
  75. package/dist/integrations/pi/tui-runtime/damage-aware-terminal.js +87 -43
  76. package/dist/native/darwin-arm64/manifest.json +1 -1
  77. package/dist/native/linux-x64/manifest.json +1 -1
  78. package/dist/native/win32-x64/manifest.json +2 -2
  79. package/dist/native/win32-x64/process-guardian.exe +0 -0
  80. package/dist/product-identity.d.ts +1 -1
  81. package/dist/product-identity.js +2 -35
  82. package/dist/product-identity.json +1 -23
  83. package/dist/ui/components/transcript-viewport.d.ts +8 -0
  84. package/dist/ui/components/transcript-viewport.js +23 -2
  85. package/dist/ui/components/visible-hyperlinks.d.ts +7 -0
  86. package/dist/ui/components/visible-hyperlinks.js +1 -0
  87. package/dist/ui/settings/declarations.js +1 -0
  88. package/dist/ui/settings/sections.js +11 -1
  89. package/docs/architecture/boundaries.md +2 -1
  90. package/docs/architecture/internal-naming.md +91 -0
  91. package/docs/architecture/resource-and-data-policy.md +9 -4
  92. package/docs/architecture/toolchain.md +15 -1
  93. package/docs/features/prompt-history.md +39 -11
  94. package/docs/manual-code-streaming-cleanup.md +88 -0
  95. package/package.json +8 -3
package/README.md CHANGED
@@ -45,13 +45,25 @@ a1 pi # vanilla Pi oracle: ~/.pi/agent
45
45
  Unsupported commands exit quietly without launching anything. The removed
46
46
  `update:<preview>` forms are not aliases; use `update --develop`.
47
47
 
48
+ ## Prompt suggestions
49
+
50
+ Bare A1's `/settings` → Agent → Prompt suggestions controls faint next-prompt
51
+ predictions. It is enabled by default and uses one additional background request
52
+ with the selected model for eligible turns. Disabling it takes effect immediately.
53
+ Tab accepts a suggestion as editable text; Enter submits it afterward. The setting
54
+ remains stored in A1's profile, and `a1 pi` is unchanged.
55
+
48
56
  ## Prompt history
49
57
 
50
58
  Bare A1 recalls recent unique prompts across sessions with Up/Down. History is
51
- stored in a separate profile-local SQLite database under A1's application-data
52
- root, not `~/.a1/agent` or disposable caches. `/settings` → History controls
53
- persistence and the 10-100-entry limit (default 100), effective on next start.
54
- History is unencrypted user text; images are not reattached. See
59
+ stored in a separate profile-local SQLite database at
60
+ `~/.a1/data/history/<profile-id>.sqlite3`, or under `<A1_DATA_DIR>/history` when
61
+ explicitly overridden. Other application data stays in its existing location.
62
+ `/settings` History controls persistence and the 10-100-entry limit (default
63
+ 100), effective on next start. The new default starts fresh: old platform history
64
+ is neither imported nor automatically deleted. Ordinary upgrades and npm
65
+ uninstall/reinstall preserve saved history. History is unencrypted user text;
66
+ images are not reattached. See
55
67
  [prompt history](docs/features/prompt-history.md) for privacy, storage, and removal.
56
68
 
57
69
  ## Extensions
package/bin/guardian.js CHANGED
@@ -3,13 +3,14 @@
3
3
  const startup = await import("../dist/foundation/startup/index.js");
4
4
  startup.enableEnvironmentCompileCache(process.env);
5
5
  await startup.markStartupPhase(process.env, "guardian-start");
6
- const { fileURLToPath } = await import("node:url");
7
6
  const { resolve } = await import("node:path");
8
7
  const { parseSessionSelection } = await import("../dist/foundation/lifecycle/index.js");
9
8
  const { runLaunchGuardian } = await import("../dist/foundation/launch-guardian/index.js");
10
9
 
11
- const releaseRoot = process.env.A1_RELEASE_ROOT ?? fileURLToPath(new URL("..", import.meta.url));
12
- const profileId = process.env.A1_LAUNCH_PROFILE ?? "a1";
10
+ const { readLaunchContext } = await import("../dist/foundation/launch-context/index.js");
11
+ const launchContext = readLaunchContext(process.env, "release");
12
+ const releaseRoot = launchContext.releaseRoot;
13
+ const profileId = readLaunchContext(process.env, "profile").launchProfile;
13
14
 
14
15
  Promise.resolve().then(() => runLaunchGuardian({
15
16
  sessionSelection: parseSessionSelection(process.argv.slice(2)),
package/bin/ui.js CHANGED
@@ -2,14 +2,16 @@
2
2
 
3
3
  const startup = await import("../dist/foundation/startup/index.js");
4
4
  startup.enableEnvironmentCompileCache(process.env);
5
- const profile = process.env.A1_LAUNCH_PROFILE ?? "a1";
5
+ const { readLaunchContext } = await import("../dist/foundation/launch-context/index.js");
6
+ const launchContext = readLaunchContext(process.env, "profile");
7
+ const profile = launchContext.launchProfile;
6
8
  const { installFatalExit } = await import("../dist/foundation/terminal-cleanup/index.js");
7
9
  const { resolveProductPaths } = await import("../dist/foundation/lifecycle/index.js");
8
10
  const { join } = await import("node:path");
9
11
  let runningApplication;
10
12
  const fatal = profile === "a1" ? installFatalExit({
11
13
  directory: join(resolveProductPaths().runtimeDir, "crashes"),
12
- releaseId: process.env.A1_RELEASE_ID,
14
+ releaseId: launchContext.releaseId,
13
15
  dispose: () => runningApplication?.dispose(),
14
16
  }) : undefined;
15
17
  // Performance: begin the exact launch graph together while the trace write is pending.
@@ -140,6 +140,7 @@ async function runRecoveredCommand(value, arguments_) {
140
140
 
141
141
  async function readCapsule(path) {
142
142
  const value = JSON.parse(await readFile(path, "utf8"));
143
+ if (value.launchContract !== "neutral-launch-v1") throw new Error("Unsupported private recovery contract; stop existing processes and install directly with npm. Preserve settings, sessions, and history.");
143
144
  if (value.schema !== SCHEMA || typeof value.transactionId !== "string" || typeof value.packageName !== "string"
144
145
  || typeof value.packageName !== "string" || !value.packageName.includes("/") || typeof value.targetVersion !== "string" || typeof value.packageRoot !== "string" || typeof value.globalRoot !== "string"
145
146
  || typeof value.launcherRoot !== "string" || !Array.isArray(value.launchers) || typeof value.priorReleaseId !== "string" || typeof value.priorReleaseRoot !== "string"
@@ -178,6 +179,7 @@ async function readCapsule(path) {
178
179
  assertDirectChild(releasesRoot, priorReleaseRoot);
179
180
  if (priorReleaseRoot.split(sep).at(-1) !== value.priorReleaseId) throw new Error("A1 update recovery prior release identity is invalid");
180
181
  const priorManifest = JSON.parse(await readFile(resolve(priorReleaseRoot, value.releaseManifestName), "utf8"));
182
+ if (priorManifest.launchContract !== "neutral-launch-v1") throw new Error("Unsupported prior private launch contract; manual cutover is required.");
181
183
  if (priorManifest.releaseId !== value.priorReleaseId || priorManifest.contentDigest !== value.priorContentDigest) {
182
184
  throw new Error("A1 update recovery prior release manifest is invalid");
183
185
  }
@@ -190,7 +192,7 @@ async function installedTargetEntry(value) {
190
192
  try {
191
193
  const manifest = JSON.parse(await readFile(resolve(value.packageRoot, "package.json"), "utf8"));
192
194
  const entry = resolve(value.packageRoot, "bin", "cli.js");
193
- if (manifest.name !== value.packageName || manifest.version !== value.targetVersion || !(await lstat(entry)).isFile()) return null;
195
+ if (manifest.privateLaunchContract !== "neutral-launch-v1" || manifest.name !== value.packageName || manifest.version !== value.targetVersion || !(await lstat(entry)).isFile()) return null;
194
196
  return entry;
195
197
  } catch { return null; }
196
198
  }
@@ -212,7 +212,7 @@ function pinnedPiUpdateError() {
212
212
  message: [
213
213
  PRODUCT_TEXT.diagnostic("pins its certified Pi runtime and cannot update it independently."),
214
214
  "Use:",
215
- ` ${PRODUCT_TEXT.commandName} update Update A1`,
215
+ ` ${PRODUCT_TEXT.commandName} update Update a1`,
216
216
  ` ${PRODUCT_TEXT.commandName} pi update --extensions Update Pi-compatible packages`,
217
217
  ` ${PRODUCT_TEXT.commandName} pi update --models Refresh model catalogs`,
218
218
  ].join("\n"),
@@ -1,4 +1,5 @@
1
1
  import { PromptHistoryService } from "../features/prompt-history/index.js";
2
+ import { resolvePromptHistoryDataDir } from "../features/launch/index.js";
2
3
  import { resolveProductPaths } from "../foundation/lifecycle/index.js";
3
4
  import { applyConfiguredPiTheme, getAvailablePiThemes, loadHistoryEditor } from "../integrations/pi/components/index.js";
4
5
  import { createPiEngineAdapter, } from "../integrations/pi/engine/index.js";
@@ -47,7 +48,7 @@ export async function composeOwnedUi(options = {}) {
47
48
  const promptHistory = settings === null || !ownedSurfaces || settings.value("promptHistoryEnabled") === false ? null : {
48
49
  limit: typeof historyLimit === "number" ? historyLimit : 100,
49
50
  store: new PromptHistoryService({
50
- dataDir: resolveProductPaths().dataDir,
51
+ dataDir: resolvePromptHistoryDataDir(),
51
52
  profileRoot: adapter.agentDir,
52
53
  limit: typeof historyLimit === "number" ? historyLimit : 100,
53
54
  }),
@@ -11,4 +11,6 @@ export interface LaunchProfilePathOptions {
11
11
  readonly platform?: NodeJS.Platform;
12
12
  }
13
13
  export declare function resolveLaunchProfilePaths(options?: LaunchProfilePathOptions): LaunchProfilePaths;
14
+ /** Select history storage without relocating control state or probing former stores. */
15
+ export declare function resolvePromptHistoryDataDir(options?: LaunchProfilePathOptions): string;
14
16
  export declare function configurationRootForProfile(profileId: LaunchProfileId, paths: LaunchProfilePaths): string | null;
@@ -1,6 +1,7 @@
1
1
  import { homedir } from "node:os";
2
2
  import { posix, win32 } from "node:path";
3
3
  import { PRODUCT_IDENTITY } from "../../product-identity.js";
4
+ import { resolveProductPaths } from "../../foundation/lifecycle/index.js";
4
5
  export function resolveLaunchProfilePaths(options = {}) {
5
6
  const environment = options.environment ?? process.env;
6
7
  const path = options.platform === "win32" || (options.platform === undefined && process.platform === "win32") ? win32 : posix;
@@ -13,6 +14,16 @@ export function resolveLaunchProfilePaths(options = {}) {
13
14
  agentProfile,
14
15
  });
15
16
  }
17
+ /** Select history storage without relocating control state or probing former stores. */
18
+ export function resolvePromptHistoryDataDir(options = {}) {
19
+ const environment = options.environment ?? process.env;
20
+ const platform = options.platform ?? process.platform;
21
+ if (environment[PRODUCT_IDENTITY.environment.dataDir] !== undefined) {
22
+ return resolveProductPaths(environment, platform).dataDir;
23
+ }
24
+ const path = platform === "win32" ? win32 : posix;
25
+ return path.join(resolveLaunchProfilePaths(options).managedStateRoot, "data");
26
+ }
16
27
  export function configurationRootForProfile(profileId, paths) {
17
28
  return profileId === "a1" ? paths.agentProfile : null;
18
29
  }
@@ -37,7 +37,7 @@ export function createConsoleProjectTrustPrompt(options = {}) {
37
37
  `${BOLD}${ACCENT}Trust project folder?${RESET_FG}${RESET_BOLD}`,
38
38
  cwd,
39
39
  "",
40
- "This allows A1 to load project settings and resources, install missing project packages, and execute project extensions.",
40
+ "This allows a1 to load project settings and resources, install missing project packages, and execute project extensions.",
41
41
  "",
42
42
  optionRow("Trust", selected === 0),
43
43
  optionRow("Do not trust", selected === 1),
@@ -628,7 +628,7 @@ export class SettingsApp {
628
628
  const open = this.#structured;
629
629
  if (open !== null)
630
630
  return this.#dialogLines(open, width, theme);
631
- const hint = this.#interruptArmed ? "press ctrl+c again to exit A1" : SETTINGS_SHORTCUTS.hint(SCOPE);
631
+ const hint = this.#interruptArmed ? "press ctrl+c again to exit a1" : SETTINGS_SHORTCUTS.hint(SCOPE);
632
632
  const status = renderStatusLine({ hint, report: this.#notice }, width, theme);
633
633
  const input = this.#filter;
634
634
  if (input === null)
@@ -1,6 +1,12 @@
1
1
  import type { Worker } from "node:worker_threads";
2
2
  import { type PromptHistoryFailure, type PromptHistoryPort, type PromptHistoryResult, type PromptHistorySnapshot, type PromptHistorySubmission } from "../../contracts/owned-ui/index.js";
3
- /** Owns a finite asynchronous history queue; storage faults never throw into prompt dispatch. */
3
+ export type HistoryRecoveryState = "starting" | "ready" | "recovering" | "blocked-storage" | "closing" | "closed";
4
+ export interface HistoryClock {
5
+ now(): number;
6
+ setTimeout(callback: () => void, milliseconds: number): ReturnType<typeof setTimeout>;
7
+ clearTimeout(timer: ReturnType<typeof setTimeout> | undefined): void;
8
+ }
9
+ /** One generation owns storage work; only proven non-commits may be retried. No default output sink. */
4
10
  export declare class PromptHistoryService implements PromptHistoryPort {
5
11
  #private;
6
12
  readonly options: {
@@ -8,13 +14,37 @@ export declare class PromptHistoryService implements PromptHistoryPort {
8
14
  profileRoot: string;
9
15
  limit: number;
10
16
  createWorker?: () => Worker;
17
+ clock?: HistoryClock;
18
+ random?: () => number;
11
19
  };
12
20
  constructor(options: {
13
21
  dataDir: string;
14
22
  profileRoot: string;
15
23
  limit: number;
16
24
  createWorker?: () => Worker;
25
+ clock?: HistoryClock;
26
+ random?: () => number;
17
27
  });
28
+ /** Explicit developer inspection: bounded classified counters, never exception or prompt payloads. */
29
+ diagnostics(): {
30
+ state: HistoryRecoveryState;
31
+ generation: number;
32
+ attempts: number;
33
+ recoveries: number;
34
+ pending: number;
35
+ bytes: number;
36
+ active: boolean;
37
+ timers: number;
38
+ failures: {
39
+ schema?: number;
40
+ shutdown?: number;
41
+ unavailable?: number;
42
+ busy?: number;
43
+ capacity?: number;
44
+ oversized?: number;
45
+ corrupt?: number;
46
+ };
47
+ };
18
48
  start(): void;
19
49
  record(submission: PromptHistorySubmission): Promise<PromptHistoryResult>;
20
50
  refresh(): void;