@agentvault/grok-bridge 0.3.1 → 0.4.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.
package/dist/bridge.d.ts CHANGED
@@ -136,6 +136,15 @@ export declare function attachLifecycle(channel: LifecycleChannel, opts?: {
136
136
  onTerminal?: (reason: string, o: {
137
137
  restart: boolean;
138
138
  }) => void;
139
+ /** #913 item 2 — remove this agent's supervised service when its device is
140
+ * gone for good. Injected for tests; defaults to the real remover, because
141
+ * an opt-in default is a feature nobody gets.
142
+ *
143
+ * Every terminal reason is offered to it and IT decides. Filtering here as
144
+ * well would put the same rule in two files, and the two would eventually
145
+ * disagree — which is how `session_replaced` (device still alive) would end
146
+ * up removing a healthy install. */
147
+ selfUninstall?: (reason: string, env: NodeJS.ProcessEnv) => boolean;
139
148
  }): void;
140
149
  /**
141
150
  * How a ROOM turn is announced to the model (#366 / #499 Facet A).
package/dist/config.d.ts CHANGED
@@ -1,16 +1,3 @@
1
- /**
2
- * The one-paste install flag: enrol, install the supervised service, then EXIT so
3
- * the customer's terminal comes back.
4
- *
5
- * WIRE LITERAL. `packages/web/lib/framework-install.ts` emits this exact string in
6
- * the connect command. The two packages cannot import each other, so the only
7
- * tripwire is a test on each side that names the other — see config.test.ts
8
- * "freezes the wire literal".
9
- *
10
- * Deliberately "-" prefixed: loadConfig's token slot rejects "-" args, so adding a
11
- * flag can never be mistaken for an invite token.
12
- */
13
- export declare const INSTALL_FLAG = "--install";
14
1
  /** Informational flags. Handled BEFORE loadConfig in index.ts, because asking
15
2
  * "what version is this?" must not require an invite token. Listed here too so
16
3
  * the strict unknown-flag check does not reject them. */
@@ -35,12 +22,38 @@ export declare function parseInfoFlags(argv: string[]): {
35
22
  export declare function isEphemeralEntrypoint(entrypoint: string): boolean;
36
23
  /** Throw unless `entrypoint` is durable enough to bake into a supervised service. */
37
24
  export declare function assertInstallableEntrypoint(entrypoint: string): void;
25
+ /**
26
+ * #913 item 3 — the device id inside this data dir's credentials, or null.
27
+ *
28
+ * Lives HERE, beside CRED_FILES and BACKUP_FILE, because this module already
29
+ * owns the knowledge of which files hold credentials. `doctor` reading those
30
+ * names itself would make a second copy of the list, and the copy that is not
31
+ * next to the constant is the one that goes stale.
32
+ *
33
+ * Checks the same files in the same order as hasPersistedCreds, INCLUDING the
34
+ * .bak: a device_revoked wipe deletes agentvault.json and leaves the backup, so
35
+ * the .bak is exactly where the id lives for the machine most likely to be
36
+ * running doctor.
37
+ *
38
+ * Returns null rather than throwing on missing/unreadable/malformed input — a
39
+ * doctor that dies on one bad file reports nothing about the others.
40
+ */
41
+ export declare function readPersistedDeviceId(dataDir: string): string | null;
38
42
  export declare function hasPersistedCreds(dataDir: string): boolean;
39
43
  export declare function slugify(name: string): string;
40
44
  export type DataDirSource = "explicit" | "per-agent";
45
+ /** Where the agent name came from.
46
+ *
47
+ * #927's test for a safe default is: can a reader of the output tell the input
48
+ * was MISSING? A bare `agentName` cannot answer that — "Grok" reads the same
49
+ * whether the customer typed it or the bridge chose it. This field is what
50
+ * makes the two distinguishable, so callers can SAY which one happened. */
51
+ export type AgentNameSource = "supplied" | "defaulted";
41
52
  export declare function resolveDataDir(env: NodeJS.ProcessEnv): {
42
53
  dataDir: string;
43
54
  source: DataDirSource;
55
+ agentName: string;
56
+ agentNameSource: AgentNameSource;
44
57
  };
45
58
  export interface BridgeConfig {
46
59
  inviteToken: string;
@@ -48,6 +61,8 @@ export interface BridgeConfig {
48
61
  dataDirSource: DataDirSource;
49
62
  apiUrl: string;
50
63
  agentName: string;
64
+ /** Whether AV_AGENT_NAME was given, or the package default was used (#927). */
65
+ agentNameSource: AgentNameSource;
51
66
  roomFilter?: string;
52
67
  /** Per-agent filesystem sandbox. Always set: auto-defaults to a sibling of
53
68
  * the key/data dir unless AV_WORKSPACE_DIR overrides it. */
@@ -78,7 +93,6 @@ export interface BridgeConfig {
78
93
  /** Set by --install: enrol in the foreground, install the supervised service,
79
94
  * then EXIT so the customer's terminal returns. False leaves a bare run
80
95
  * byte-for-byte as it behaves today. */
81
- installAfterEnroll: boolean;
82
96
  /** --version / -v. index.ts answers these before loadConfig runs. */
83
97
  showVersion: boolean;
84
98
  /** --help / -h. Same. */