@agent-watch-ai/edge 0.3.1 → 0.5.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 (123) hide show
  1. package/CHANGELOG.md +75 -0
  2. package/README.md +10 -6
  3. package/SECURITY.md +7 -4
  4. package/dist/cli/constants/cli.constants.d.ts +2 -0
  5. package/dist/cli/constants/cli.constants.js +3 -1
  6. package/dist/cli/doctor.js +13 -2
  7. package/dist/cli/setup.js +138 -29
  8. package/dist/cli/toggle.js +5 -1
  9. package/dist/cli/types/cli.types.d.ts +6 -0
  10. package/dist/cli/uninstall.js +1 -1
  11. package/dist/cli.js +14 -3
  12. package/dist/config/config-store.d.ts +1 -1
  13. package/dist/config/config-store.js +2 -2
  14. package/dist/config/constants/config.constants.d.ts +4 -1
  15. package/dist/config/constants/config.constants.js +7 -2
  16. package/dist/config/repo-config.js +1 -1
  17. package/dist/config/schemas/config.schema.d.ts +113 -767
  18. package/dist/config/schemas/config.schema.js +17 -8
  19. package/dist/credentials/constants/credentials.constants.d.ts +8 -0
  20. package/dist/credentials/constants/credentials.constants.js +9 -1
  21. package/dist/credentials/credential-status.js +8 -4
  22. package/dist/credentials/credentials.d.ts +16 -2
  23. package/dist/credentials/credentials.js +30 -5
  24. package/dist/credentials/device-api.d.ts +10 -1
  25. package/dist/credentials/device-api.js +12 -1
  26. package/dist/credentials/identity.d.ts +12 -1
  27. package/dist/credentials/identity.js +12 -1
  28. package/dist/credentials/migration.d.ts +1 -1
  29. package/dist/credentials/migration.js +1 -1
  30. package/dist/credentials/schemas/device-api.schema.d.ts +4 -51
  31. package/dist/credentials/schemas/device-state.schema.d.ts +3 -38
  32. package/dist/credentials/sign-in.d.ts +14 -1
  33. package/dist/credentials/sign-in.js +24 -5
  34. package/dist/credentials/types/credentials.types.d.ts +12 -1
  35. package/dist/enforcement/decision-client.js +2 -1
  36. package/dist/enforcement/enforcement.js +7 -5
  37. package/dist/enforcement/types/enforcement.types.d.ts +2 -2
  38. package/dist/git/code-state.d.ts +33 -0
  39. package/dist/git/code-state.js +44 -0
  40. package/dist/git/constants/git.constants.d.ts +6 -0
  41. package/dist/git/constants/git.constants.js +6 -0
  42. package/dist/git/index.d.ts +2 -1
  43. package/dist/git/index.js +1 -0
  44. package/dist/git/types/git.types.d.ts +6 -0
  45. package/dist/pipeline/constants/pipeline.constants.d.ts +3 -0
  46. package/dist/pipeline/constants/pipeline.constants.js +3 -0
  47. package/dist/pipeline/hook-pipeline.js +56 -7
  48. package/dist/privacy/command-fingerprint.d.ts +42 -0
  49. package/dist/privacy/command-fingerprint.js +249 -0
  50. package/dist/privacy/constants/command-fingerprint.constants.d.ts +34 -0
  51. package/dist/privacy/constants/command-fingerprint.constants.js +38 -0
  52. package/dist/privacy/index.d.ts +3 -1
  53. package/dist/privacy/index.js +2 -0
  54. package/dist/privacy/product-capture.js +20 -0
  55. package/dist/privacy/types/privacy.types.d.ts +7 -0
  56. package/dist/providers/antigravity/antigravity.adapter.js +3 -0
  57. package/dist/providers/antigravity/schemas/antigravity.schema.d.ts +18 -492
  58. package/dist/providers/claude/claude.adapter.js +12 -1
  59. package/dist/providers/claude/constants/claude.constants.d.ts +6 -0
  60. package/dist/providers/claude/constants/claude.constants.js +6 -0
  61. package/dist/providers/claude/schemas/claude.schema.d.ts +1 -43
  62. package/dist/providers/codex/codex.adapter.js +14 -0
  63. package/dist/providers/codex/codex.otel.d.ts +12 -1
  64. package/dist/providers/codex/codex.otel.js +61 -11
  65. package/dist/providers/codex/constants/codex.otel.constants.d.ts +5 -0
  66. package/dist/providers/codex/constants/codex.otel.constants.js +5 -0
  67. package/dist/providers/codex/schemas/codex.schema.d.ts +1 -41
  68. package/dist/providers/constants/provider.constants.d.ts +8 -0
  69. package/dist/providers/constants/provider.constants.js +8 -0
  70. package/dist/providers/cursor/constants/cursor.constants.d.ts +2 -0
  71. package/dist/providers/cursor/constants/cursor.constants.js +2 -0
  72. package/dist/providers/cursor/cursor.adapter.js +84 -5
  73. package/dist/providers/cursor/schemas/cursor.schema.d.ts +5 -85
  74. package/dist/providers/gemini/constants/gemini.constants.d.ts +2 -0
  75. package/dist/providers/gemini/constants/gemini.constants.js +2 -0
  76. package/dist/providers/gemini/constants/gemini.otel.constants.d.ts +16 -1
  77. package/dist/providers/gemini/constants/gemini.otel.constants.js +16 -1
  78. package/dist/providers/gemini/gemini.detect.d.ts +11 -0
  79. package/dist/providers/gemini/gemini.detect.js +14 -1
  80. package/dist/providers/gemini/gemini.hooks.d.ts +3 -3
  81. package/dist/providers/gemini/gemini.hooks.js +5 -5
  82. package/dist/providers/gemini/gemini.otel.d.ts +14 -4
  83. package/dist/providers/gemini/gemini.otel.js +418 -107
  84. package/dist/providers/gemini/schemas/gemini.schema.d.ts +1 -49
  85. package/dist/providers/shared/bearer-rewrite.d.ts +19 -0
  86. package/dist/providers/shared/bearer-rewrite.js +46 -0
  87. package/dist/providers/shared/constants/tooling.constants.d.ts +6 -0
  88. package/dist/providers/shared/constants/tooling.constants.js +6 -0
  89. package/dist/providers/shared/event-builder.d.ts +17 -2
  90. package/dist/providers/shared/event-builder.js +43 -3
  91. package/dist/providers/shared/install-record.d.ts +2 -0
  92. package/dist/providers/shared/install-record.js +3 -2
  93. package/dist/providers/shared/tooling.d.ts +35 -0
  94. package/dist/providers/shared/tooling.js +61 -1
  95. package/dist/providers/shared/types/adapter.types.d.ts +18 -0
  96. package/dist/providers/types/provider.types.d.ts +24 -0
  97. package/dist/storage/atomic-file.d.ts +14 -0
  98. package/dist/storage/atomic-file.js +19 -0
  99. package/dist/storage/constants/storage.constants.d.ts +2 -0
  100. package/dist/storage/constants/storage.constants.js +2 -0
  101. package/dist/storage/schemas/storage.schema.d.ts +11 -175
  102. package/dist/storage/schemas/storage.schema.js +7 -1
  103. package/dist/transport/schemas/queue.schema.d.ts +1 -16
  104. package/dist/transport/schemas/queue.schema.js +1 -1
  105. package/dist/turns/constants/turns.constants.d.ts +17 -0
  106. package/dist/turns/constants/turns.constants.js +17 -0
  107. package/dist/turns/index.d.ts +3 -2
  108. package/dist/turns/index.js +1 -0
  109. package/dist/turns/tool-events.d.ts +15 -0
  110. package/dist/turns/tool-events.js +59 -0
  111. package/dist/turns/turn-state.js +2 -2
  112. package/dist/turns/turn-summary.d.ts +1 -1
  113. package/dist/turns/turn-summary.js +1 -0
  114. package/dist/turns/turn-tracker.js +138 -7
  115. package/dist/turns/types/turn-state.types.d.ts +28 -1
  116. package/dist/turns/types/turn-summary.types.d.ts +30 -0
  117. package/dist/turns/types/turn-tracker.types.d.ts +10 -0
  118. package/dist/turns/work-checkout.d.ts +5 -3
  119. package/dist/turns/work-checkout.js +46 -12
  120. package/docs/AUDIT_PROMPT.md +11 -0
  121. package/docs/DATA_HANDLING.md +69 -14
  122. package/docs/ENTERPRISE_DEPLOYMENT.md +21 -5
  123. package/package.json +9 -8
@@ -4,7 +4,7 @@ import { asRecord } from '../../core/object.js';
4
4
  import { findExecutable } from '../../core/which.js';
5
5
  import { readJsonFile } from '../../storage/json-file.js';
6
6
  import { HOOK_COMMAND_MARKER } from '../constants/provider.constants.js';
7
- import { GEMINI_CLI_VAR, GEMINI_EXECUTABLES, GEMINI_HOME_DIR, GEMINI_HOME_VAR, GEMINI_SETTINGS_FILE } from './constants/gemini.constants.js';
7
+ import { GEMINI_CLI_VAR, GEMINI_ENV_FILE, GEMINI_EXECUTABLES, GEMINI_HOME_DIR, GEMINI_HOME_VAR, GEMINI_SETTINGS_FILE } from './constants/gemini.constants.js';
8
8
  /**
9
9
  * Gemini CLI's configuration root.
10
10
  *
@@ -23,6 +23,19 @@ function geminiHome(env) {
23
23
  export function geminiSettingsPath(env) {
24
24
  return path.join(geminiHome(env), GEMINI_SETTINGS_FILE);
25
25
  }
26
+ /**
27
+ * Where native telemetry is configured.
28
+ *
29
+ * Gemini CLI 0.63+ loads `~/.gemini/.env` into its process at start (for a
30
+ * trusted folder) but does not apply the settings.json `env` block, and its
31
+ * `telemetry` settings have no header option for the bearer.
32
+ *
33
+ * @param env - Environment supplying HOME and GEMINI_HOME.
34
+ * @returns Absolute path of the `.env` beside `settings.json`.
35
+ */
36
+ export function geminiEnvPath(env) {
37
+ return path.join(geminiHome(env), GEMINI_ENV_FILE);
38
+ }
26
39
  /**
27
40
  * Whether Gemini CLI is installed here, and whether our hooks are registered.
28
41
  *
@@ -11,9 +11,9 @@ export declare function installGeminiHooks(context: SetupContext): Promise<Setup
11
11
  /**
12
12
  * Remove AgentWatch's hooks from Gemini CLI's `settings.json`.
13
13
  *
14
- * The agent is forgotten entirely rather than just having its hook fields
15
- * cleared: Gemini's hooks and its telemetry live in the same file, so once that
16
- * file has nothing of ours left there is nothing to describe.
14
+ * Only the hook fields are cleared: the telemetry record lives on, since
15
+ * telemetry is in `~/.gemini/.env` and its uninstall needs to know which lines
16
+ * and which file mode are ours.
17
17
  *
18
18
  * @param context - Environment, paths and current install state.
19
19
  * @returns Whether the file changed, what to tell the user, and the next
@@ -2,7 +2,7 @@ import { asRecord } from '../../core/object.js';
2
2
  import { backupFile } from '../../storage/atomic-file.js';
3
3
  import { readJsonFile } from '../../storage/json-file.js';
4
4
  import { registerOurHandlers, stripOurHandlers, sweepUnregisteredEvents, withHooksBlock, writeJsonValidated } from '../shared/hook-config.js';
5
- import { withHookInstall, withoutAgent } from '../shared/install-record.js';
5
+ import { withHookInstall, withoutHookInstall } from '../shared/install-record.js';
6
6
  import { geminiSettingsPath } from './gemini.detect.js';
7
7
  import { GEMINI_HOOK_EVENTS, GEMINI_HOOK_TIMEOUT_MILLISECONDS, GEMINI_MATCHED_EVENTS, GEMINI_PROVIDER_ID } from './constants/gemini.constants.js';
8
8
  export { GEMINI_HOOK_EVENTS } from './constants/gemini.constants.js';
@@ -46,9 +46,9 @@ export async function installGeminiHooks(context) {
46
46
  /**
47
47
  * Remove AgentWatch's hooks from Gemini CLI's `settings.json`.
48
48
  *
49
- * The agent is forgotten entirely rather than just having its hook fields
50
- * cleared: Gemini's hooks and its telemetry live in the same file, so once that
51
- * file has nothing of ours left there is nothing to describe.
49
+ * Only the hook fields are cleared: the telemetry record lives on, since
50
+ * telemetry is in `~/.gemini/.env` and its uninstall needs to know which lines
51
+ * and which file mode are ours.
52
52
  *
53
53
  * @param context - Environment, paths and current install state.
54
54
  * @returns Whether the file changed, what to tell the user, and the next
@@ -57,7 +57,7 @@ export async function installGeminiHooks(context) {
57
57
  export async function uninstallGeminiHooks(context) {
58
58
  const settingsPath = geminiSettingsPath(context.env);
59
59
  const read = await readJsonFile(settingsPath);
60
- const forgotten = withoutAgent(context.installState, GEMINI_PROVIDER_ID);
60
+ const forgotten = withoutHookInstall(context.installState, GEMINI_PROVIDER_ID);
61
61
  if (read.state === 'missing') {
62
62
  return { ok: true, changed: false, messages: ['no Gemini settings file'], installState: forgotten };
63
63
  }
@@ -1,7 +1,7 @@
1
1
  import type { Env } from '../../core/types/core.types.js';
2
2
  import type { AgentWatchConfig, OtelSignalName } from '../../config/types/config.types.js';
3
- import type { NativeTelemetryConfigurator, NativeTelemetryStatus, SetupContext, SetupOutcome } from '../types/provider.types.js';
4
- /** Configures Gemini CLI's own OTLP export. */
3
+ import type { BearerRewriteContext, NativeTelemetryConfigurator, NativeTelemetryStatus, SetupContext, SetupOutcome } from '../types/provider.types.js';
4
+ /** Configures Gemini CLI's own OTLP export, through `~/.gemini/.env` and settings.json. */
5
5
  export declare class GeminiOtelConfigurator implements NativeTelemetryConfigurator {
6
6
  /**
7
7
  * Whether this agent can export native telemetry at all.
@@ -18,7 +18,7 @@ export declare class GeminiOtelConfigurator implements NativeTelemetryConfigurat
18
18
  */
19
19
  inspect(context: SetupContext): Promise<NativeTelemetryStatus>;
20
20
  /**
21
- * Write the telemetry configuration into Gemini CLI's settings.
21
+ * Write the telemetry configuration into Gemini CLI's `.env`.
22
22
  *
23
23
  * @param context - Environment, paths, config and install state.
24
24
  * @returns Whether the file changed, what to tell the user, and the next
@@ -29,7 +29,7 @@ export declare class GeminiOtelConfigurator implements NativeTelemetryConfigurat
29
29
  * Remove the telemetry configuration AgentWatch wrote.
30
30
  *
31
31
  * @param context - Environment, paths, config and install state.
32
- * @returns Whether the file changed, what to tell the user, and the next
32
+ * @returns Whether a file changed, what to tell the user, and the next
33
33
  * install state.
34
34
  */
35
35
  uninstall(context: SetupContext): Promise<SetupOutcome>;
@@ -47,6 +47,16 @@ export declare class GeminiOtelConfigurator implements NativeTelemetryConfigurat
47
47
  * @returns The outcome.
48
48
  */
49
49
  private configureDisabled;
50
+ /**
51
+ * Swap the bearer in our `OTEL_EXPORTER_OTLP_HEADERS` line for the current one.
52
+ *
53
+ * Only when a setup recorded the key as ours, and only the bearer in that
54
+ * line changes. No backup: one per rotation would collect copies of every token.
55
+ *
56
+ * @param context - The recorded file, its contents as read, install state and the current bearer.
57
+ * @returns True when the file was rewritten.
58
+ */
59
+ rewriteBearer(context: BearerRewriteContext): Promise<boolean>;
50
60
  /**
51
61
  * Signals Gemini was asked for but will not be given under current consent.
52
62
  *