oh-my-opencode 5.1.75 → 5.1.77

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 (101) hide show
  1. package/dist/cli/index.js +35367 -24312
  2. package/dist/cli/service-auth/commands.d.ts +1 -0
  3. package/dist/cli/service-auth/device-flow.d.ts +15 -3
  4. package/dist/cli/service-auth/device-name.d.ts +6 -0
  5. package/dist/cli/service-auth/keychain-helper/client.d.ts +9 -1
  6. package/dist/cli/service-auth/keychain-helper/darwin-backend.d.ts +7 -0
  7. package/dist/cli/service-auth/keychain-helper/darwin-read.d.ts +3 -1
  8. package/dist/cli/service-auth/keychain-helper/darwin-store.d.ts +3 -0
  9. package/dist/cli/service-auth/keychain-helper/dedicated-fake.test-support.d.ts +101 -0
  10. package/dist/cli/service-auth/keychain-helper/dedicated-store.d.ts +9 -0
  11. package/dist/cli/service-auth/keychain-helper/dedicated-switch.d.ts +35 -0
  12. package/dist/cli/service-auth/keychain-helper/pin.d.ts +3 -3
  13. package/dist/cli/service-auth/keystore.d.ts +6 -0
  14. package/dist/cli/service-auth/login-routes.d.ts +12 -0
  15. package/dist/cli/service-auth/machine-reconcile.d.ts +34 -0
  16. package/dist/cli/service-auth/protocol.d.ts +39 -1
  17. package/dist/cli/service-auth/replace-device.d.ts +11 -0
  18. package/dist/cli/service-auth/session.d.ts +5 -0
  19. package/dist/cli/service-auth/test-support.d.ts +2 -0
  20. package/dist/cli-node/index.js +35367 -24312
  21. package/dist/index.js +350 -232
  22. package/dist/skills/browser/runtime/omowright/manifest.json +1 -1
  23. package/dist/skills/data-scientist/references/visualization.md +1 -1
  24. package/dist/skills/frontend/SKILL.md +1 -1
  25. package/dist/skills/frontend/references/design/_INDEX.md +2 -0
  26. package/dist/skills/ulw-plan/references/full-workflow.md +3 -3
  27. package/dist/skills/ulw-plan/scripts/plan-templates.mjs +3 -3
  28. package/dist/skills/ulw-research/SKILL.md +1 -1
  29. package/dist/skills/visual-qa/SKILL.md +1 -1
  30. package/dist/tui.js +72 -24
  31. package/package.json +14 -14
  32. package/packages/omo-codex/plugin/.codex-plugin/plugin.json +1 -1
  33. package/packages/omo-codex/plugin/components/bootstrap/dist/cli.js +158 -174
  34. package/packages/omo-codex/plugin/components/bootstrap/hooks/hooks.json +1 -1
  35. package/packages/omo-codex/plugin/components/bootstrap/package.json +1 -1
  36. package/packages/omo-codex/plugin/components/comment-checker/hooks/hooks.json +1 -1
  37. package/packages/omo-codex/plugin/components/comment-checker/package.json +1 -1
  38. package/packages/omo-codex/plugin/components/git-bash/hooks/hooks.json +2 -2
  39. package/packages/omo-codex/plugin/components/git-bash/package.json +1 -1
  40. package/packages/omo-codex/plugin/components/lazycodex-executor-verify/hooks/hooks.json +1 -1
  41. package/packages/omo-codex/plugin/components/lazycodex-executor-verify/package.json +1 -1
  42. package/packages/omo-codex/plugin/components/lsp/dist/.omo-runtime-manifest.json +2 -2
  43. package/packages/omo-codex/plugin/components/lsp/hooks/hooks.json +2 -2
  44. package/packages/omo-codex/plugin/components/lsp/package.json +1 -1
  45. package/packages/omo-codex/plugin/components/rules/hooks/hooks.json +4 -4
  46. package/packages/omo-codex/plugin/components/rules/package.json +1 -1
  47. package/packages/omo-codex/plugin/components/teammode/hooks/hooks.json +1 -1
  48. package/packages/omo-codex/plugin/components/teammode/package.json +1 -1
  49. package/packages/omo-codex/plugin/components/telemetry/hooks/hooks.json +1 -1
  50. package/packages/omo-codex/plugin/components/telemetry/package.json +1 -1
  51. package/packages/omo-codex/plugin/components/ultrawork/agents/plan.toml +5 -6
  52. package/packages/omo-codex/plugin/components/ultrawork/hooks/hooks.json +1 -1
  53. package/packages/omo-codex/plugin/components/ultrawork/package.json +1 -1
  54. package/packages/omo-codex/plugin/components/ultrawork/skills/ulw-plan/references/full-workflow.md +2 -2
  55. package/packages/omo-codex/plugin/components/ultrawork/skills/ulw-plan/scripts/plan-templates.mjs +3 -3
  56. package/packages/omo-codex/plugin/components/ulw-execute-continuation/hooks/hooks.json +1 -1
  57. package/packages/omo-codex/plugin/components/ulw-execute-continuation/package.json +1 -1
  58. package/packages/omo-codex/plugin/components/ulw-loop/hooks/hooks.json +5 -5
  59. package/packages/omo-codex/plugin/components/ulw-loop/package.json +1 -1
  60. package/packages/omo-codex/plugin/components/ulw-loop/skills/ulw-loop/references/full-workflow.md +1 -1
  61. package/packages/omo-codex/plugin/hooks/post-compact-resetting-git-bash-mcp-reminder.json +1 -1
  62. package/packages/omo-codex/plugin/hooks/post-compact-resetting-lsp-diagnostics-cache.json +1 -1
  63. package/packages/omo-codex/plugin/hooks/post-compact-resetting-project-rule-cache.json +1 -1
  64. package/packages/omo-codex/plugin/hooks/post-tool-use-checking-comments.json +1 -1
  65. package/packages/omo-codex/plugin/hooks/post-tool-use-checking-lsp-diagnostics.json +1 -1
  66. package/packages/omo-codex/plugin/hooks/post-tool-use-checking-thread-title-hygiene.json +1 -1
  67. package/packages/omo-codex/plugin/hooks/post-tool-use-matching-project-rules.json +1 -1
  68. package/packages/omo-codex/plugin/hooks/post-tool-use-recording-spawn-admission.json +1 -1
  69. package/packages/omo-codex/plugin/hooks/pre-tool-use-enforcing-unlimited-goal-budget.json +1 -1
  70. package/packages/omo-codex/plugin/hooks/pre-tool-use-guarding-ulw-loop-spawns.json +1 -1
  71. package/packages/omo-codex/plugin/hooks/pre-tool-use-recommending-git-bash-mcp.json +1 -1
  72. package/packages/omo-codex/plugin/hooks/session-start-checking-auto-update.json +1 -1
  73. package/packages/omo-codex/plugin/hooks/session-start-checking-bootstrap-provisioning.json +1 -1
  74. package/packages/omo-codex/plugin/hooks/session-start-loading-project-rules.json +1 -1
  75. package/packages/omo-codex/plugin/hooks/session-start-recording-session-telemetry.json +1 -1
  76. package/packages/omo-codex/plugin/hooks/stop-checking-ulw-execute-continuation.json +1 -1
  77. package/packages/omo-codex/plugin/hooks/stop-checking-ulw-loop-resume.json +1 -1
  78. package/packages/omo-codex/plugin/hooks/subagent-stop-verifying-lazycodex-executor-evidence.json +1 -1
  79. package/packages/omo-codex/plugin/hooks/user-prompt-submit-checking-ultrawork-trigger.json +1 -1
  80. package/packages/omo-codex/plugin/hooks/user-prompt-submit-checking-ulw-loop-steering.json +1 -1
  81. package/packages/omo-codex/plugin/hooks/user-prompt-submit-loading-project-rules.json +1 -1
  82. package/packages/omo-codex/plugin/package-lock.json +12 -12
  83. package/packages/omo-codex/plugin/package.json +1 -1
  84. package/packages/omo-codex/plugin/skills/browser/runtime/omowright/manifest.json +1 -1
  85. package/packages/omo-codex/plugin/skills/data-scientist/references/visualization.md +1 -1
  86. package/packages/omo-codex/plugin/skills/frontend/SKILL.md +1 -1
  87. package/packages/omo-codex/plugin/skills/frontend/references/design/_INDEX.md +2 -0
  88. package/packages/omo-codex/plugin/skills/ulw-loop/references/full-workflow.md +1 -1
  89. package/packages/omo-codex/plugin/skills/ulw-plan/references/full-workflow.md +2 -2
  90. package/packages/omo-codex/plugin/skills/ulw-plan/scripts/plan-templates.mjs +3 -3
  91. package/packages/omo-codex/plugin/skills/ulw-research/SKILL.md +1 -1
  92. package/packages/omo-codex/plugin/skills/visual-qa/SKILL.md +1 -1
  93. package/packages/omo-codex/scripts/install-dist/install-local.mjs +16 -35
  94. package/packages/shared-skills/skills/browser/runtime/omowright/manifest.json +1 -1
  95. package/packages/shared-skills/skills/data-scientist/references/visualization.md +1 -1
  96. package/packages/shared-skills/skills/frontend/SKILL.md +1 -1
  97. package/packages/shared-skills/skills/frontend/references/design/_INDEX.md +2 -0
  98. package/packages/shared-skills/skills/ulw-plan/references/full-workflow.md +3 -3
  99. package/packages/shared-skills/skills/ulw-plan/scripts/plan-templates.mjs +3 -3
  100. package/packages/shared-skills/skills/ulw-research/SKILL.md +1 -1
  101. package/packages/shared-skills/skills/visual-qa/SKILL.md +1 -1
@@ -11,6 +11,7 @@ type Options = {
11
11
  readonly accounts?: string;
12
12
  readonly device?: boolean;
13
13
  readonly browser?: boolean;
14
+ readonly replace?: boolean;
14
15
  readonly help?: boolean;
15
16
  };
16
17
  /** What the host adds to the account commands: its device service for an API origin (design D r9 sections 4-5). */
@@ -1,17 +1,29 @@
1
- import { type ChooseDevice, type Platform } from "./protocol";
1
+ import { type ChooseDevice, type MachineDevice, type Platform } from "./protocol";
2
2
  import type { Session } from "./session";
3
3
  export type DisplayCode = {
4
4
  readonly verificationUri: string;
5
5
  readonly userCode: string;
6
6
  readonly matchingCode: string;
7
7
  };
8
- export declare function loginDevice(session: Session, options: {
8
+ export type DeviceLoginOptions = {
9
9
  readonly name: string;
10
10
  readonly platform: Platform;
11
11
  readonly show: (code: DisplayCode) => void;
12
12
  readonly chooseDevice: ChooseDevice;
13
+ /**
14
+ * #14032: asked once when the service answers `machine_exists`, with the earlier device it names. True starts a new
15
+ * device code that asks the service to replace that device; false (or no callback) keeps the refusal.
16
+ */
17
+ readonly replaceDevice?: (existing: MachineDevice) => Promise<boolean>;
18
+ /** A replacement already agreed on another route (the browser sign-in's `machine_exists`): start with it. */
19
+ readonly replacing?: MachineDevice;
13
20
  /** This machine's hardware digest (#6503), sent only when the service advertises machine identity. */
14
21
  readonly machineDigest?: string;
15
22
  readonly now?: () => number;
16
23
  readonly sleep?: (ms: number) => Promise<void>;
17
- }): Promise<void>;
24
+ };
25
+ /** What a finished device sign-in reports: the earlier device the service signed out when this one replaced it. */
26
+ export type DeviceLoginResult = {
27
+ readonly replacedDeviceId?: string;
28
+ };
29
+ export declare function loginDevice(session: Session, options: DeviceLoginOptions): Promise<DeviceLoginResult>;
@@ -1,3 +1,9 @@
1
1
  import { type Platform } from "./protocol";
2
2
  export declare function deviceName(host?: string): string;
3
+ /**
4
+ * Whether omo generated this device name itself (#13651): the pre-#14044 `omo CLI on <host>` label, the unnamed
5
+ * fallback, or the name built from the kernel hostname a Mac registered under before LocalHostName. Any other name is
6
+ * one the person chose, and omo never replaces it.
7
+ */
8
+ export declare function isGeneratedDeviceName(name: string): boolean;
3
9
  export declare function devicePlatform(): Platform;
@@ -1,9 +1,15 @@
1
1
  import { z } from "zod";
2
- export type HelperVerb = "read" | "approve" | "write" | "stage" | "retire" | "promote" | "remove";
2
+ export type HelperVerb = "read" | "approve" | "write" | "stage" | "retire" | "promote" | "remove" | "store-create" | "store-activate" | "store-deactivate" | "store-erase";
3
+ /**
4
+ * Which keychain a call reaches (#13116 design r2): absent is the login keychain (refused while OmO's own keychain is
5
+ * active), "omo" is OmO's own keychain while active, "omo-migrate" and "login" are the enable/disable copy steps only.
6
+ */
7
+ export type HelperStore = "omo" | "omo-migrate" | "login";
3
8
  export type HelperCall = {
4
9
  readonly verb: HelperVerb;
5
10
  readonly account: string;
6
11
  readonly value?: string;
12
+ readonly store?: HelperStore;
7
13
  };
8
14
  declare const helperReplySchema: z.ZodObject<{
9
15
  owned: z.ZodOptional<z.ZodBoolean>;
@@ -29,6 +35,7 @@ declare const helperReplySchema: z.ZodObject<{
29
35
  skipped: z.ZodOptional<z.ZodBoolean>;
30
36
  slot: z.ZodOptional<z.ZodNumber>;
31
37
  error: z.ZodOptional<z.ZodEnum<{
38
+ acl: "acl";
32
39
  denied: "denied";
33
40
  exists: "exists";
34
41
  locked: "locked";
@@ -36,6 +43,7 @@ declare const helperReplySchema: z.ZodObject<{
36
43
  "not-owned": "not-owned";
37
44
  refused: "refused";
38
45
  store: "store";
46
+ "store-refused": "store-refused";
39
47
  }>>;
40
48
  reason: z.ZodOptional<z.ZodString>;
41
49
  status: z.ZodOptional<z.ZodNumber>;
@@ -1,3 +1,4 @@
1
+ import { DedicatedStoreError } from "../keystore";
1
2
  import { type HelperAccess } from "./access";
2
3
  import { type ApprovalCache } from "./approval-cache";
3
4
  import { type Row8bChoice } from "./darwin-read";
@@ -43,6 +44,8 @@ export type KeychainHelperOptions = {
43
44
  readonly cache?: ApprovalCache;
44
45
  readonly handOff?: () => Promise<boolean>;
45
46
  readonly noDialog?: boolean;
47
+ /** Whether OmO's own keychain is active (#13116); defaults to the marker under this user's home. */
48
+ readonly dedicatedStore?: () => boolean;
46
49
  };
47
50
  export type DarwinBackend = {
48
51
  /** The read every caller outside the session lock shares (it may show the one plain approval dialog). */
@@ -66,7 +69,11 @@ export declare function createDarwinBackend(options: {
66
69
  readonly cache?: ApprovalCache;
67
70
  readonly handOff?: () => Promise<boolean>;
68
71
  readonly noDialog?: boolean;
72
+ /** OmO's own keychain (#13116 r2 finding 1): every call names it, and nothing here reaches the login keychain. */
73
+ readonly dedicated?: boolean;
69
74
  }): DarwinBackend;
75
+ /** r2 finding 1: with OmO's own keychain active there is no helper-less path, so a missing helper is a hard error. */
76
+ export declare const dedicatedHelperMissing: () => DedicatedStoreError;
70
77
  /**
71
78
  * Without a verified helper, the read is today's, except for an item the helper owns (row 9b): today's read could
72
79
  * only reach it through a dialog, so by default this answers with the reinstall notice instead.
@@ -17,7 +17,9 @@ export type ReadResult = {
17
17
  * "password-dialog" asks anyway. Only the default may ship until the owner decides.
18
18
  */
19
19
  export type Row8bChoice = "re-login" | "password-dialog";
20
- export type ReadFailure = "locked" | "store" | "pending" | "denied";
20
+ export type ReadFailure = "locked" | "store" | "pending" | "denied" | "acl" | "dedicated";
21
+ /** Shown when the keychain is unlocked but this program is not on the item's access list. */
22
+ export declare const ACL_DENIAL_MESSAGE = "macOS Keychain refused access because this program is not on the sign-in's access list. The keychain is unlocked. Remove the omo-cli item in Keychain Access, then sign in again.";
21
23
  export declare class HelperReadError extends Error {
22
24
  readonly failure: ReadFailure;
23
25
  constructor(failure: ReadFailure, message: string);
@@ -20,6 +20,9 @@ export type LockedDarwinStore = {
20
20
  /** RULING-73: every retired slot holds a copy nothing here can remove; the user must delete them once. */
21
21
  export declare class HelperOldSlotsFull extends Error {
22
22
  }
23
+ /** Neither the helper nor this process may delete `<A>`: another program owns the item's access list (#13757). */
24
+ export declare class HelperItemNotOwned extends Error {
25
+ }
23
26
  /**
24
27
  * The session-lock view (design 3.3, 3.4, 3.6): every helper mutation is handed the lease; reads never prompt (an
25
28
  * approval comes from `prepare()` before the lock); recovery runs at the start of every section, migration only from
@@ -0,0 +1,101 @@
1
+ import type { HelperCall, HelperLease, HelperReply } from "./client";
2
+ import type { DedicatedStoreState } from "./dedicated-store";
3
+ /**
4
+ * The login keychain and OmO's own keychain behind one fake helper, with the routing the real helper enforces
5
+ * (packages/omo-native/keychain-helper/src/store-select.c, proven against the real helper by
6
+ * keychain-helper-dedicated.test.ts): no store field is refused while active, "omo" is refused while inactive,
7
+ * "omo-migrate" and "login" are the copy steps, and store-erase keeps a sign-in.
8
+ */
9
+ export declare function dedicatedFake(options?: {
10
+ readonly loginLocked?: boolean;
11
+ readonly state?: DedicatedStoreState;
12
+ /** The keychain file is gone but the folder remains (a crash inside an erase): only store-erase can open it. */
13
+ readonly keychainGone?: boolean;
14
+ /** A damaged store (wrong mode, bad key): every call that opens it is refused; deactivation still works. */
15
+ readonly damaged?: boolean;
16
+ }): {
17
+ login: {
18
+ items: Map<string, {
19
+ value: string;
20
+ owner: import("./fake-keychain.test-support").Owner;
21
+ partition: "ours" | "other" | "none";
22
+ marker: boolean;
23
+ cdat: number;
24
+ mdat: number;
25
+ }>;
26
+ events: string[];
27
+ stats: {
28
+ approves: number;
29
+ unleasedMutations: number;
30
+ };
31
+ secrets: import("../keystore").SecretApi;
32
+ secretsAs: (identity: import("./fake-keychain.test-support").Owner) => import("../keystore").SecretApi;
33
+ access: {
34
+ readonly kind: "ready";
35
+ readonly path: string;
36
+ readonly call: (call: HelperCall, lease?: HelperLease) => Promise<HelperReply>;
37
+ };
38
+ put: (name: string, value: string, owner: import("./fake-keychain.test-support").Owner, partition?: "none" | "other" | "ours") => Map<string, {
39
+ value: string;
40
+ owner: import("./fake-keychain.test-support").Owner;
41
+ partition: "ours" | "other" | "none";
42
+ marker: boolean;
43
+ cdat: number;
44
+ mdat: number;
45
+ }>;
46
+ cache: {
47
+ consume(current: import("./approval-cache").ItemAttributes): string | null;
48
+ deniedForBackground: () => boolean;
49
+ inFlight: () => Promise<import("./approval-cache").ApprovalAnswer> | null;
50
+ approve(run: () => Promise<import("./approval-cache").ApprovalAnswer>): Promise<import("./approval-cache").ApprovalAnswer>;
51
+ afterOwnWrite(value: string, readAttributes: () => Promise<import("./approval-cache").ItemAttributes | null>): Promise<void>;
52
+ drop(): void;
53
+ };
54
+ };
55
+ omo: {
56
+ items: Map<string, {
57
+ value: string;
58
+ owner: import("./fake-keychain.test-support").Owner;
59
+ partition: "ours" | "other" | "none";
60
+ marker: boolean;
61
+ cdat: number;
62
+ mdat: number;
63
+ }>;
64
+ events: string[];
65
+ stats: {
66
+ approves: number;
67
+ unleasedMutations: number;
68
+ };
69
+ secrets: import("../keystore").SecretApi;
70
+ secretsAs: (identity: import("./fake-keychain.test-support").Owner) => import("../keystore").SecretApi;
71
+ access: {
72
+ readonly kind: "ready";
73
+ readonly path: string;
74
+ readonly call: (call: HelperCall, lease?: HelperLease) => Promise<HelperReply>;
75
+ };
76
+ put: (name: string, value: string, owner: import("./fake-keychain.test-support").Owner, partition?: "none" | "other" | "ours") => Map<string, {
77
+ value: string;
78
+ owner: import("./fake-keychain.test-support").Owner;
79
+ partition: "ours" | "other" | "none";
80
+ marker: boolean;
81
+ cdat: number;
82
+ mdat: number;
83
+ }>;
84
+ cache: {
85
+ consume(current: import("./approval-cache").ItemAttributes): string | null;
86
+ deniedForBackground: () => boolean;
87
+ inFlight: () => Promise<import("./approval-cache").ApprovalAnswer> | null;
88
+ approve(run: () => Promise<import("./approval-cache").ApprovalAnswer>): Promise<import("./approval-cache").ApprovalAnswer>;
89
+ afterOwnWrite(value: string, readAttributes: () => Promise<import("./approval-cache").ItemAttributes | null>): Promise<void>;
90
+ drop(): void;
91
+ };
92
+ };
93
+ calls: HelperCall[];
94
+ access: {
95
+ readonly kind: "ready";
96
+ readonly path: string;
97
+ readonly call: (call: HelperCall, lease?: HelperLease) => Promise<HelperReply>;
98
+ };
99
+ state: () => DedicatedStoreState;
100
+ };
101
+ export declare const LEASE: HelperLease;
@@ -0,0 +1,9 @@
1
+ import type { HelperReply } from "./client";
2
+ export type DedicatedStoreState = "absent" | "inactive" | "active";
3
+ export declare const dedicatedStoreRoot: (home?: string) => string;
4
+ export declare function dedicatedStoreState(home?: string): DedicatedStoreState;
5
+ /**
6
+ * A refusal from the dedicated store, or an older helper refusing the store field (it predates #13116), as the one
7
+ * sentence the user acts on; null for any other reply.
8
+ */
9
+ export declare function dedicatedStoreRefusal(reply: HelperReply): string | null;
@@ -0,0 +1,35 @@
1
+ import type { HelperAccess } from "./access";
2
+ import type { HelperLease } from "./client";
3
+ import { type DedicatedStoreState } from "./dedicated-store";
4
+ /**
5
+ * Turning OmO's own keychain on and off (#13116 design r2, finding 2). Both run inside the credential lock that every
6
+ * refresh write takes, and the `active` marker is written last on enable and removed first on disable, so at every
7
+ * step exactly one store is authoritative: a crash leaves either the old store selected with the sign-in still in it,
8
+ * or the new one selected with the sign-in already copied and read back.
9
+ */
10
+ export type StoreSwitchDeps = {
11
+ readonly access: Extract<HelperAccess, {
12
+ kind: "ready";
13
+ }>;
14
+ readonly account: string;
15
+ readonly lease: HelperLease;
16
+ readonly state: () => DedicatedStoreState;
17
+ };
18
+ /** How the login keychain's sign-in was handled: moved, absent, or left there because it could not be read silently. */
19
+ export type EnableMove = "copied" | "none" | "kept-active" | "left-locked" | "left-unreadable";
20
+ export type EnableOutcome = {
21
+ readonly created: boolean;
22
+ readonly moved: EnableMove;
23
+ readonly loginLeftover: boolean;
24
+ };
25
+ export type DisableOutcome = {
26
+ readonly moved: "copied" | "none";
27
+ readonly erased: boolean;
28
+ readonly damagedLeftInPlace?: true;
29
+ };
30
+ export declare class StoreSwitchError extends Error {
31
+ }
32
+ export declare function storeSwitch(deps: StoreSwitchDeps): {
33
+ enable(): Promise<EnableOutcome>;
34
+ disable(discard: boolean): Promise<DisableOutcome>;
35
+ };
@@ -11,10 +11,10 @@ export type PinResult = {
11
11
  readonly reason: string;
12
12
  };
13
13
  /**
14
- * Copies a located helper into a directory only this process uses, makes the copy read-only, and verifies the COPY.
14
+ * Copies a located helper to a path determined by its bytes, makes the copy read-only, and verifies the COPY.
15
15
  * The process then spawns only that copy, so a file written to the original path later (a dev build, a broken
16
- * install) is never executed. The signature is inside the Mach-O, so the copy has the same designated requirement and
17
- * the same keychain access as the original (#11262 design 1: every copy at any path matches one ACL entry).
16
+ * install) is never executed. The same bytes keep the same path, including across processes, because a macOS
17
+ * trusted-application entry can name that path: a fresh random name on every launch never matches it.
18
18
  * One copy is kept per source file identity; a source that changes gets a fresh copy.
19
19
  */
20
20
  export declare function pinVerifiedCopy(source: string, verify: (path: string) => Promise<SignatureVerdict>, dir?: string): Promise<PinResult>;
@@ -39,8 +39,14 @@ export declare class CredentialStoreError extends SignInError {
39
39
  }
40
40
  export declare class KeychainLockedError extends CredentialStoreError {
41
41
  }
42
+ /** The keychain item's access list belongs to another program: unlocking does not help (#13757). */
43
+ export declare class KeychainItemNotOwnedError extends CredentialStoreError {
44
+ }
42
45
  export declare class SecretServiceUnavailableError extends CredentialStoreError {
43
46
  }
47
+ /** OmO's own keychain (#13116) refused or cannot be reached; its message names the fix and is never generalized. */
48
+ export declare class DedicatedStoreError extends CredentialStoreError {
49
+ }
44
50
  export declare class InvalidCredentialState extends SignInError {
45
51
  }
46
52
  /** The stored credential is no longer the identity and generation a caller captured. */
@@ -0,0 +1,12 @@
1
+ import { type DeviceLoginOptions, type DeviceLoginResult } from "./device-flow";
2
+ import { loginLoopback } from "./loopback";
3
+ import type { Session } from "./session";
4
+ /**
5
+ * `omo login`'s two routes: the browser sign-in when one is given, else (or when no browser opens) the device code.
6
+ * #14032: a browser sign-in refused with `machine_exists` gets the same replace decision as the device code, and an
7
+ * accepted replacement continues as a device-code replace sign-in, since only that request carries `replace`.
8
+ */
9
+ export declare function signInByRoute(session: Session, routes: {
10
+ readonly loopback?: Parameters<typeof loginLoopback>[1];
11
+ readonly device: DeviceLoginOptions;
12
+ }): Promise<DeviceLoginResult>;
@@ -0,0 +1,34 @@
1
+ import { type Credentials } from "./protocol";
2
+ /** The longest a refresh's caller waits for the post-refresh device fix-up before it gets its token anyway. */
3
+ export declare const DEVICE_FIXUP_BUDGET_MS = 5000;
4
+ /** This machine as the service should know it: its hardware digest (undefined when none can be read) and its name. */
5
+ export type MachineIdentity = {
6
+ readonly digest: () => Promise<string | undefined>;
7
+ readonly name: () => string;
8
+ /** The fix-up's overall budget; DEVICE_FIXUP_BUDGET_MS when absent. */
9
+ readonly budgetMs?: number;
10
+ };
11
+ export declare const thisMachine: MachineIdentity;
12
+ /** Where a machine_exists refusal is remembered: a non-secret note beside the account's signed-out marker. */
13
+ export declare const machineRefusalPath: (home: string, credential: string) => string;
14
+ /**
15
+ * After a refresh (#13651): a device signed in before machine identity binds itself to this machine once, and a label
16
+ * omo generated becomes the machine name once. The service's own device list says whether either is still owed, so a
17
+ * later refresh sends nothing. Never throws and never ends, revokes or replaces the sign-in: a machine_exists refusal is
18
+ * logged once and remembered locally, so later refreshes do not ask again until MACHINE_EXISTS_RETRY_MS has passed.
19
+ * Once `signal` aborts (the fix-up budget ran out) it settles at the next step and writes and logs nothing more.
20
+ */
21
+ export declare function reconcileDevice(options: {
22
+ readonly api: string;
23
+ readonly credentials: Credentials;
24
+ readonly machine: MachineIdentity;
25
+ readonly nowMs: number;
26
+ readonly request: (path: string, init: RequestInit) => Promise<unknown>;
27
+ readonly accountOf: (access: string) => Promise<string | undefined>;
28
+ /** Records the new name in the stored credential after the service accepted it. */
29
+ readonly renamed: (name: string) => Promise<void>;
30
+ readonly refusalPath: string;
31
+ readonly log: (line: string) => void;
32
+ /** The fix-up budget: every request is expected to abort on it, and the uncancellable steps are raced against it. */
33
+ readonly signal: AbortSignal;
34
+ }): Promise<void>;
@@ -40,6 +40,27 @@ export declare const grantSchema: z.ZodObject<{
40
40
  writerFloor: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<2>]>>;
41
41
  freshAuthorizationProof: z.ZodOptional<z.ZodString>;
42
42
  }, z.core.$strip>;
43
+ /** #14032: the device-token reply, which also names the earlier device a replace sign-in signed out. Never stored. */
44
+ export declare const deviceTokenGrantSchema: z.ZodObject<{
45
+ accessToken: z.ZodString;
46
+ accessTokenExpiresAt: z.ZodString;
47
+ refreshToken: z.ZodString;
48
+ device: z.ZodObject<{
49
+ id: z.ZodString;
50
+ name: z.ZodString;
51
+ }, z.core.$strip>;
52
+ offlineGrant: z.ZodOptional<z.ZodString>;
53
+ owner: z.ZodOptional<z.ZodObject<{
54
+ accountId: z.ZodString;
55
+ deviceId: z.ZodString;
56
+ familyId: z.ZodString;
57
+ generation: z.ZodNumber;
58
+ ownerHandle: z.ZodString;
59
+ }, z.core.$strip>>;
60
+ writerFloor: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<2>]>>;
61
+ freshAuthorizationProof: z.ZodOptional<z.ZodString>;
62
+ replacedDeviceId: z.ZodOptional<z.ZodString>;
63
+ }, z.core.$strip>;
43
64
  export declare const credentialSchema: z.ZodObject<{
44
65
  accessToken: z.ZodString;
45
66
  accessTokenExpiresAt: z.ZodString;
@@ -80,6 +101,20 @@ export declare const limitSchema: z.ZodObject<{
80
101
  used: z.ZodNumber;
81
102
  limit: z.ZodNumber;
82
103
  }, z.core.$strip>;
104
+ /** #14032: the earlier device a `machine_exists` refusal names, when the service names it. */
105
+ export declare const machineDeviceSchema: z.ZodObject<{
106
+ deviceId: z.ZodOptional<z.ZodString>;
107
+ deviceName: z.ZodOptional<z.ZodString>;
108
+ }, z.core.$strip>;
109
+ export type MachineDevice = z.infer<typeof machineDeviceSchema>;
110
+ /** #14032: a replace sign-in whose approved device is not this computer's (terminal: start a new sign-in). */
111
+ export declare const replaceMismatchSchema: z.ZodObject<{
112
+ reason: z.ZodLiteral<"replace_mismatch">;
113
+ }, z.core.$strip>;
114
+ export type RefusalContext = {
115
+ readonly machineDevice?: MachineDevice;
116
+ readonly replaceMismatch?: boolean;
117
+ };
83
118
  export declare const deviceListSchema: z.ZodObject<{
84
119
  devices: z.ZodArray<z.ZodObject<{
85
120
  id: z.ZodString;
@@ -101,13 +136,16 @@ export declare class ApiRefusal extends SignInError {
101
136
  #private;
102
137
  readonly status: number;
103
138
  readonly code: RefusalCode;
104
- constructor(code: string, status: number, detail?: z.infer<typeof limitSchema>, retryAfter?: string | null);
139
+ constructor(code: string, status: number, detail?: z.infer<typeof limitSchema>, retryAfter?: string | null, context?: RefusalContext);
105
140
  get detail(): {
106
141
  reason: "device_limit";
107
142
  managementToken: string;
108
143
  used: number;
109
144
  limit: number;
110
145
  } | undefined;
146
+ /** The earlier device a `machine_exists` refusal names; empty when the service names none. */
147
+ get machineDevice(): MachineDevice;
148
+ get replaceMismatch(): boolean;
111
149
  retryDelay(now: number, fallback: number): number;
112
150
  }
113
151
  export declare function parseReply<T>(schema: z.ZodType<T>, value: unknown): T;
@@ -0,0 +1,11 @@
1
+ import { type MachineDevice } from "./protocol";
2
+ /**
3
+ * #14032: whether `omo login` asks the service to replace this computer's earlier device. `--replace` agrees without a
4
+ * prompt; an interactive terminal asks, defaulting to No; a script without the flag keeps the refusal and names the flag.
5
+ */
6
+ export declare function decideReplace(options: {
7
+ readonly replace: boolean;
8
+ readonly interactive: boolean;
9
+ readonly confirm: (message: string) => Promise<boolean>;
10
+ readonly log: (line: string) => void;
11
+ }): (existing: MachineDevice) => Promise<boolean>;
@@ -1,6 +1,7 @@
1
1
  import type { CredentialOwner } from "./credential-owner";
2
2
  import { type CredentialStore, type LockedStore } from "./keystore";
3
3
  import { type ChooseDevice, type Credentials, SignInError } from "./protocol";
4
+ import { type MachineIdentity } from "./machine-reconcile";
4
5
  export declare class SessionEnded extends SignInError {
5
6
  readonly deviceRevoked: boolean;
6
7
  readonly code: string;
@@ -63,6 +64,10 @@ export declare function createSession(options: {
63
64
  readonly beforeKeysDiscarded: BeforeKeysDiscarded;
64
65
  /** This machine's device service; absent, no device service is told anything. */
65
66
  readonly deviceService?: DeviceServiceHandoff;
67
+ /** The machine a refreshed device binds to and is named after (#13651); this computer unless a test says otherwise. */
68
+ readonly machine?: MachineIdentity;
69
+ /** Where a post-refresh device fix-up reports a refusal; silent when absent (a TUI host must not write over its screen). */
70
+ readonly log?: (line: string) => void;
66
71
  }): {
67
72
  request: (path: string, init: RequestInit) => Promise<unknown>;
68
73
  signal: AbortSignal | undefined;
@@ -14,6 +14,8 @@ export declare const privateKeys: {
14
14
  sealingPrivateKey: string;
15
15
  };
16
16
  export declare const refusal: (code: string, detail?: unknown, status?: number) => Response;
17
+ /** A device list naming no device of this sign-in, so the post-refresh device fix-up (#13651) sends nothing more. */
18
+ export declare const noOwnDevice: (request: Request) => Response | undefined;
17
19
  export declare const limitDetail: {
18
20
  reason: string;
19
21
  managementToken: string;