@oxygen-agent/cli 1.987.20 → 1.1010.1

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 (176) hide show
  1. package/README.md +1 -1
  2. package/dist/admin-primary-providers-render.d.ts +0 -2
  3. package/dist/admin-primary-providers-render.js +1 -1
  4. package/dist/browser-login.js +1 -4
  5. package/dist/column-decision-options.d.ts +20 -0
  6. package/dist/column-decision-options.js +54 -0
  7. package/dist/command-manifest.d.ts +3 -2
  8. package/dist/command-manifest.js +25 -2
  9. package/dist/credentials.d.ts +1 -1
  10. package/dist/functions-commands.js +13 -9
  11. package/dist/help.d.ts +8 -0
  12. package/dist/help.js +46 -0
  13. package/dist/index.js +2751 -242
  14. package/dist/knowledge-mirror.d.ts +2 -2
  15. package/dist/runtime.d.ts +0 -15
  16. package/dist/runtime.js +1 -1
  17. package/dist/search-ai-filter-notice.d.ts +17 -0
  18. package/dist/search-ai-filter-notice.js +38 -0
  19. package/dist/session.d.ts +4 -3
  20. package/dist/skills.d.ts +8 -7
  21. package/dist/skills.js +58 -20
  22. package/dist/transcript.d.ts +2 -1
  23. package/dist/util.d.ts +10 -1
  24. package/dist/util.js +14 -2
  25. package/node_modules/@oxygen/cli-ugc/dist/commands.js +296 -140
  26. package/node_modules/@oxygen/cli-ugc/dist/field-parser.d.ts +9 -0
  27. package/node_modules/@oxygen/cli-ugc/dist/field-parser.js +34 -0
  28. package/node_modules/@oxygen/formula/dist/coerce.d.ts +10 -0
  29. package/node_modules/@oxygen/formula/dist/coerce.js +10 -0
  30. package/node_modules/@oxygen/formula/dist/formula-functions.js +65 -0
  31. package/node_modules/@oxygen/formula/dist/hash.d.ts +19 -0
  32. package/node_modules/@oxygen/formula/dist/hash.js +199 -0
  33. package/node_modules/@oxygen/formula/dist/value-cleaners.d.ts +6 -1
  34. package/node_modules/@oxygen/formula/dist/value-cleaners.js +10 -26
  35. package/node_modules/@oxygen/recipe-sdk/dist/index.d.ts +13 -0
  36. package/node_modules/@oxygen/shared/dist/array-utils.d.ts +5 -0
  37. package/node_modules/@oxygen/shared/dist/array-utils.js +11 -0
  38. package/node_modules/@oxygen/shared/dist/billing.d.ts +99 -22
  39. package/node_modules/@oxygen/shared/dist/billing.js +195 -40
  40. package/node_modules/@oxygen/shared/dist/byok-connect.js +5 -0
  41. package/node_modules/@oxygen/shared/dist/capability-discovery.d.ts +27 -0
  42. package/node_modules/@oxygen/shared/dist/capability-discovery.js +311 -28
  43. package/node_modules/@oxygen/shared/dist/cli-http-error.d.ts +8 -0
  44. package/node_modules/@oxygen/shared/dist/cli-http-error.js +8 -0
  45. package/node_modules/@oxygen/shared/dist/cli-result.js +1 -0
  46. package/node_modules/@oxygen/shared/dist/column-autofill.d.ts +52 -0
  47. package/node_modules/@oxygen/shared/dist/column-autofill.js +62 -0
  48. package/node_modules/@oxygen/shared/dist/column-decision.d.ts +50 -0
  49. package/node_modules/@oxygen/shared/dist/column-decision.js +228 -0
  50. package/node_modules/@oxygen/shared/dist/column-output-fields.js +2 -6
  51. package/node_modules/@oxygen/shared/dist/company-enrichment-fields.d.ts +113 -0
  52. package/node_modules/@oxygen/shared/dist/company-enrichment-fields.js +548 -0
  53. package/node_modules/@oxygen/shared/dist/copilot-skills.generated.d.ts +6 -6
  54. package/node_modules/@oxygen/shared/dist/copilot-skills.generated.js +6 -6
  55. package/node_modules/@oxygen/shared/dist/cutover-freeze.d.ts +26 -0
  56. package/node_modules/@oxygen/shared/dist/cutover-freeze.js +52 -0
  57. package/node_modules/@oxygen/shared/dist/data-suppliers.d.ts +57 -0
  58. package/node_modules/@oxygen/shared/dist/data-suppliers.js +59 -0
  59. package/node_modules/@oxygen/shared/dist/deploy-env.d.ts +74 -0
  60. package/node_modules/@oxygen/shared/dist/deploy-env.js +82 -0
  61. package/node_modules/@oxygen/shared/dist/dnc-rules.d.ts +130 -0
  62. package/node_modules/@oxygen/shared/dist/dnc-rules.js +221 -0
  63. package/node_modules/@oxygen/shared/dist/enrichment-intents.d.ts +107 -0
  64. package/node_modules/@oxygen/shared/dist/enrichment-intents.js +809 -0
  65. package/node_modules/@oxygen/shared/dist/error-message.d.ts +1 -0
  66. package/node_modules/@oxygen/shared/dist/error-message.js +3 -0
  67. package/node_modules/@oxygen/shared/dist/error-redaction.js +1 -3
  68. package/node_modules/@oxygen/shared/dist/external-write-policy.d.ts +33 -0
  69. package/node_modules/@oxygen/shared/dist/external-write-policy.js +68 -0
  70. package/node_modules/@oxygen/shared/dist/format-percent.d.ts +8 -0
  71. package/node_modules/@oxygen/shared/dist/format-percent.js +13 -0
  72. package/node_modules/@oxygen/shared/dist/freemail-domains.d.ts +81 -0
  73. package/node_modules/@oxygen/shared/dist/freemail-domains.js +157 -0
  74. package/node_modules/@oxygen/shared/dist/future-signup-lifecycle-projection.d.ts +1 -0
  75. package/node_modules/@oxygen/shared/dist/future-signup-lifecycle-projection.js +1 -1
  76. package/node_modules/@oxygen/shared/dist/hosted-ai.d.ts +60 -4
  77. package/node_modules/@oxygen/shared/dist/hosted-ai.js +125 -10
  78. package/node_modules/@oxygen/shared/dist/index.d.ts +15 -0
  79. package/node_modules/@oxygen/shared/dist/index.js +15 -0
  80. package/node_modules/@oxygen/shared/dist/json-path.js +1 -3
  81. package/node_modules/@oxygen/shared/dist/knowledge-bases.js +1 -3
  82. package/node_modules/@oxygen/shared/dist/knowledge-bootstrap.d.ts +2 -2
  83. package/node_modules/@oxygen/shared/dist/knowledge-bootstrap.js +2 -2
  84. package/node_modules/@oxygen/shared/dist/langfuse.d.ts +44 -1
  85. package/node_modules/@oxygen/shared/dist/langfuse.js +416 -14
  86. package/node_modules/@oxygen/shared/dist/linkedin-countries.d.ts +33 -0
  87. package/node_modules/@oxygen/shared/dist/linkedin-countries.js +361 -0
  88. package/node_modules/@oxygen/shared/dist/linkedin-country-timezones.d.ts +24 -0
  89. package/node_modules/@oxygen/shared/dist/linkedin-country-timezones.js +276 -0
  90. package/node_modules/@oxygen/shared/dist/linkedin-message-deletion.d.ts +2 -0
  91. package/node_modules/@oxygen/shared/dist/linkedin-message-deletion.js +5 -0
  92. package/node_modules/@oxygen/shared/dist/linkedin-post-keywords.d.ts +44 -0
  93. package/node_modules/@oxygen/shared/dist/linkedin-post-keywords.js +116 -0
  94. package/node_modules/@oxygen/shared/dist/linkedin-sequences.d.ts +96 -0
  95. package/node_modules/@oxygen/shared/dist/linkedin-sequences.js +123 -0
  96. package/node_modules/@oxygen/shared/dist/llm-durable-capture.d.ts +24 -0
  97. package/node_modules/@oxygen/shared/dist/llm-durable-capture.js +89 -0
  98. package/node_modules/@oxygen/shared/dist/llm-prompts.d.ts +75 -0
  99. package/node_modules/@oxygen/shared/dist/llm-prompts.js +161 -0
  100. package/node_modules/@oxygen/shared/dist/log-sink-selector.d.ts +39 -0
  101. package/node_modules/@oxygen/shared/dist/log-sink-selector.js +56 -0
  102. package/node_modules/@oxygen/shared/dist/log.d.ts +1 -0
  103. package/node_modules/@oxygen/shared/dist/log.js +6 -1
  104. package/node_modules/@oxygen/shared/dist/mailbox-egress-ownership.d.ts +90 -0
  105. package/node_modules/@oxygen/shared/dist/mailbox-egress-ownership.js +130 -0
  106. package/node_modules/@oxygen/shared/dist/object-storage.d.ts +17 -0
  107. package/node_modules/@oxygen/shared/dist/object-storage.js +21 -0
  108. package/node_modules/@oxygen/shared/dist/operational-telemetry.d.ts +24 -0
  109. package/node_modules/@oxygen/shared/dist/operational-telemetry.js +73 -0
  110. package/node_modules/@oxygen/shared/dist/otlp-log-sink.d.ts +79 -0
  111. package/node_modules/@oxygen/shared/dist/otlp-log-sink.js +366 -0
  112. package/node_modules/@oxygen/shared/dist/plan-capabilities.js +1 -0
  113. package/node_modules/@oxygen/shared/dist/plan-limits.d.ts +23 -22
  114. package/node_modules/@oxygen/shared/dist/plan-limits.js +45 -18
  115. package/node_modules/@oxygen/shared/dist/pricing-sheet.d.ts +48 -41
  116. package/node_modules/@oxygen/shared/dist/pricing-sheet.js +36 -25
  117. package/node_modules/@oxygen/shared/dist/pricing-snapshot.generated.d.ts +22 -22
  118. package/node_modules/@oxygen/shared/dist/pricing-snapshot.generated.js +40 -34
  119. package/node_modules/@oxygen/shared/dist/product-analytics-environment.js +9 -0
  120. package/node_modules/@oxygen/shared/dist/product-analytics-events.d.ts +36 -2
  121. package/node_modules/@oxygen/shared/dist/product-analytics-events.js +36 -1
  122. package/node_modules/@oxygen/shared/dist/rate-window.d.ts +5 -0
  123. package/node_modules/@oxygen/shared/dist/rate-window.js +8 -0
  124. package/node_modules/@oxygen/shared/dist/redaction.js +4 -1
  125. package/node_modules/@oxygen/shared/dist/research-output-contract.js +1 -3
  126. package/node_modules/@oxygen/shared/dist/scraper-lane-credential.d.ts +18 -0
  127. package/node_modules/@oxygen/shared/dist/scraper-lane-credential.js +23 -0
  128. package/node_modules/@oxygen/shared/dist/search-vocab.js +4 -5
  129. package/node_modules/@oxygen/shared/dist/select-options.js +6 -1
  130. package/node_modules/@oxygen/shared/dist/sequence-failures.js +1 -5
  131. package/node_modules/@oxygen/shared/dist/sequences.d.ts +23 -0
  132. package/node_modules/@oxygen/shared/dist/sequences.js +115 -5
  133. package/node_modules/@oxygen/shared/dist/signup-lead-payload.d.ts +80 -0
  134. package/node_modules/@oxygen/shared/dist/signup-lead-payload.js +198 -0
  135. package/node_modules/@oxygen/shared/dist/social-capabilities.d.ts +6 -0
  136. package/node_modules/@oxygen/shared/dist/social-capabilities.js +25 -16
  137. package/node_modules/@oxygen/shared/dist/social-post-metrics-core.d.ts +32 -0
  138. package/node_modules/@oxygen/shared/dist/social-post-metrics-core.js +32 -0
  139. package/node_modules/@oxygen/shared/dist/social-post-metrics-linkedin.d.ts +31 -0
  140. package/node_modules/@oxygen/shared/dist/social-post-metrics-linkedin.js +103 -0
  141. package/node_modules/@oxygen/shared/dist/social-post-metrics-series.d.ts +96 -0
  142. package/node_modules/@oxygen/shared/dist/social-post-metrics-series.js +213 -0
  143. package/node_modules/@oxygen/shared/dist/social-post-metrics-x.d.ts +13 -0
  144. package/node_modules/@oxygen/shared/dist/social-post-metrics-x.js +78 -0
  145. package/node_modules/@oxygen/shared/dist/social-post-metrics.d.ts +36 -0
  146. package/node_modules/@oxygen/shared/dist/social-post-metrics.js +51 -0
  147. package/node_modules/@oxygen/shared/dist/spend-safety.d.ts +22 -10
  148. package/node_modules/@oxygen/shared/dist/spend-safety.js +15 -21
  149. package/node_modules/@oxygen/shared/dist/sql-rows.d.ts +1 -0
  150. package/node_modules/@oxygen/shared/dist/sql-rows.js +3 -0
  151. package/node_modules/@oxygen/shared/dist/stripe-price-catalog.d.ts +36 -0
  152. package/node_modules/@oxygen/shared/dist/stripe-price-catalog.js +184 -0
  153. package/node_modules/@oxygen/shared/dist/stripe-subscription-kind.d.ts +41 -0
  154. package/node_modules/@oxygen/shared/dist/stripe-subscription-kind.js +44 -0
  155. package/node_modules/@oxygen/shared/dist/table-limits.d.ts +3 -0
  156. package/node_modules/@oxygen/shared/dist/table-limits.js +3 -0
  157. package/node_modules/@oxygen/shared/dist/telemetry-export-observer.d.ts +94 -0
  158. package/node_modules/@oxygen/shared/dist/telemetry-export-observer.js +298 -0
  159. package/node_modules/@oxygen/shared/dist/telemetry.d.ts +11 -0
  160. package/node_modules/@oxygen/shared/dist/telemetry.js +28 -2
  161. package/node_modules/@oxygen/shared/dist/type-guards.d.ts +22 -0
  162. package/node_modules/@oxygen/shared/dist/type-guards.js +35 -0
  163. package/node_modules/@oxygen/shared/dist/ugc.d.ts +22 -11
  164. package/node_modules/@oxygen/shared/dist/ugc.js +10 -0
  165. package/node_modules/@oxygen/shared/dist/value-readers.d.ts +21 -0
  166. package/node_modules/@oxygen/shared/dist/value-readers.js +59 -0
  167. package/node_modules/@oxygen/shared/dist/version.generated.d.ts +1 -0
  168. package/node_modules/@oxygen/shared/dist/version.generated.js +2 -0
  169. package/node_modules/@oxygen/shared/dist/version.js +8 -1
  170. package/node_modules/@oxygen/shared/dist/workspace-event-catalog.js +0 -23
  171. package/node_modules/@oxygen/shared/dist/workspace-file-storage.d.ts +29 -0
  172. package/node_modules/@oxygen/shared/dist/workspace-file-storage.js +31 -0
  173. package/node_modules/@oxygen/shared/package.json +59 -0
  174. package/node_modules/@oxygen/workflows/dist/graph/expression.js +2 -5
  175. package/node_modules/@oxygen/workflows/dist/graph/params.js +1 -1
  176. package/package.json +3 -2
@@ -1,5 +1,5 @@
1
1
  export declare const GENERATED_MIRROR_FILE_HEADER = "<!-- generated by oxygen knowledge sync \u2014 local edits are overwritten -->";
2
- export type MirrorPageRecord = {
2
+ type MirrorPageRecord = {
3
3
  id: string;
4
4
  revision: number;
5
5
  /** sha256 hex of the exact bytes the server rendered and this client wrote. */
@@ -98,7 +98,7 @@ export declare function acquireMirrorLock(dir: string, options?: {
98
98
  export declare function releaseMirrorLock(dir: string): void;
99
99
  export declare function writeGeneratedIndexFile(dir: string, index: MirrorIndexSnapshot): void;
100
100
  export declare function writeGeneratedLogFile(dir: string, entries: MirrorLogEntry[]): void;
101
- export type MirrorPushCandidate = {
101
+ type MirrorPushCandidate = {
102
102
  slug: string;
103
103
  /** dirty = tracked page whose local bytes drifted; new = untracked local file. */
104
104
  kind: "dirty" | "new";
package/dist/runtime.d.ts CHANGED
@@ -1,20 +1,5 @@
1
1
  declare const DEV_CLI_BINARY = "oxygen-dev";
2
2
  declare const PROD_CLI_BINARY = "oxygen";
3
- /**
4
- * Pins a terminal to a *host*, not to a profile label.
5
- *
6
- * `OXYGEN_PROFILE=default` was the guard prescribed after the last profile drift
7
- * (OXY-4081), and it cannot work: `default` is a name, and `login` writes an
8
- * `apiUrl` into whatever name is active — so the profile called `default` became
9
- * dev and the pin followed it there (OXY-4109). Every credit balance, ticket, and
10
- * whoami then came back from dev looking exactly like a healthy production answer.
11
- *
12
- * The invariant that a staff runbook actually needs is the host it dialed. Set
13
- * `OXYGEN_REQUIRE_API_URL=https://oxygen-agent.com` and any command that resolves
14
- * somewhere else refuses to run instead of quietly answering from the wrong
15
- * environment.
16
- */
17
- export declare const REQUIRED_API_URL_ENV = "OXYGEN_REQUIRE_API_URL";
18
3
  export type CliBinaryName = typeof DEV_CLI_BINARY | typeof PROD_CLI_BINARY;
19
4
  /**
20
5
  * Where a command actually sent its request, and what put it there.
package/dist/runtime.js CHANGED
@@ -17,7 +17,7 @@ const PROD_CLI_BINARY = "oxygen";
17
17
  * somewhere else refuses to run instead of quietly answering from the wrong
18
18
  * environment.
19
19
  */
20
- export const REQUIRED_API_URL_ENV = "OXYGEN_REQUIRE_API_URL";
20
+ const REQUIRED_API_URL_ENV = "OXYGEN_REQUIRE_API_URL";
21
21
  export function resolveCliBinaryName(env = process.env, argv = process.argv) {
22
22
  const explicit = normalizeBinaryName(env.OXYGEN_CLI_BINARY ?? env.OXYGEN_CLI_NAME);
23
23
  if (explicit)
@@ -0,0 +1,17 @@
1
+ /**
2
+ * A charged search AI filter's run totals as one terminal line (ADR 0027,
3
+ * amendment 2026-09-25). `table-ingestions get` carries them under
4
+ * `ai_filter`; `table-ingestions wait` nests that response under
5
+ * `ingestionRun`. The blind baseline could not see what a filter kept and
6
+ * what it dropped, so the terminal says it next to the JSON.
7
+ *
8
+ * Matches and items the filter could not judge are both written to the table,
9
+ * so the line never sums them into one "kept": the blind acceptance
10
+ * (2026-09-25) read "kept 200, dropped 0" as 200 matches when 27 of them were
11
+ * never judged.
12
+ *
13
+ * Returns null unless the envelope carries run totals. The plan's and the dry
14
+ * run's `ai_filter` blocks are quotes without a `fetched` count, so they print
15
+ * nothing.
16
+ */
17
+ export declare function formatSearchAiFilterTotalsNotice(data: unknown): string | null;
@@ -0,0 +1,38 @@
1
+ import { isRecord } from "./util.js";
2
+ /**
3
+ * A charged search AI filter's run totals as one terminal line (ADR 0027,
4
+ * amendment 2026-09-25). `table-ingestions get` carries them under
5
+ * `ai_filter`; `table-ingestions wait` nests that response under
6
+ * `ingestionRun`. The blind baseline could not see what a filter kept and
7
+ * what it dropped, so the terminal says it next to the JSON.
8
+ *
9
+ * Matches and items the filter could not judge are both written to the table,
10
+ * so the line never sums them into one "kept": the blind acceptance
11
+ * (2026-09-25) read "kept 200, dropped 0" as 200 matches when 27 of them were
12
+ * never judged.
13
+ *
14
+ * Returns null unless the envelope carries run totals. The plan's and the dry
15
+ * run's `ai_filter` blocks are quotes without a `fetched` count, so they print
16
+ * nothing.
17
+ */
18
+ export function formatSearchAiFilterTotalsNotice(data) {
19
+ if (!isRecord(data))
20
+ return null;
21
+ const run = isRecord(data.ingestionRun) ? data.ingestionRun : data;
22
+ const totals = isRecord(run.ai_filter) ? run.ai_filter : null;
23
+ if (!totals || typeof totals.fetched !== "number")
24
+ return null;
25
+ const count = (value) => (typeof value === "number" && Number.isFinite(value) ? value : 0);
26
+ const matched = count(totals.kept_matched ?? totals.matched);
27
+ const unjudged = count(totals.kept_unjudged ?? totals.unclassified);
28
+ const credits = count(totals.credits_charged);
29
+ const parts = [
30
+ `${matched} matched`,
31
+ `${unjudged} could not be judged (kept, marked unclassified)`,
32
+ `${count(totals.dropped)} dropped`,
33
+ ];
34
+ const unavailable = typeof totals.unavailable_reason === "string" && totals.unavailable_reason
35
+ ? `. The filter did not run on some pages: ${totals.unavailable_reason}`
36
+ : "";
37
+ return `AI filter: fetched ${count(totals.fetched)}: ${parts.join(", ")}${credits > 0 ? `; ${credits} credits` : ""}${unavailable}`;
38
+ }
package/dist/session.d.ts CHANGED
@@ -1,17 +1,17 @@
1
1
  export type SessionStepStatus = "pending" | "running" | "completed" | "error" | "skipped";
2
- export type SessionStep = {
2
+ type SessionStep = {
3
3
  label: string;
4
4
  status: SessionStepStatus;
5
5
  startedAt: string | null;
6
6
  completedAt: string | null;
7
7
  };
8
- export type SessionStatusMessage = {
8
+ type SessionStatusMessage = {
9
9
  id: string;
10
10
  message: string;
11
11
  stepIndex: number | null;
12
12
  createdAt: string;
13
13
  };
14
- export type SessionOutput = {
14
+ type SessionOutput = {
15
15
  id: string;
16
16
  type: "csv" | "file" | "table";
17
17
  path: string | null;
@@ -54,3 +54,4 @@ export declare function addSessionOutput(input: {
54
54
  export declare function getSessionUsage(input: {
55
55
  sessionId?: string | null;
56
56
  }): Record<string, unknown>;
57
+ export {};
package/dist/skills.d.ts CHANGED
@@ -7,7 +7,8 @@ export type SkillsInstallOptions = {
7
7
  apiUrl?: string;
8
8
  agents?: string | string[];
9
9
  skill?: string;
10
- project?: boolean;
10
+ /** `true` for the current directory, or the project directory to install into. */
11
+ project?: boolean | string;
11
12
  copy?: boolean;
12
13
  };
13
14
  export type SkillsListOptions = {
@@ -33,12 +34,6 @@ export type AutomaticSkillsInstallResult = {
33
34
  details?: unknown;
34
35
  };
35
36
  };
36
- export type SkillsAccessResponse = {
37
- base_url: string;
38
- index_url: string;
39
- expires_at: string;
40
- skills_version?: string;
41
- };
42
37
  export type SkillsInstallSource = {
43
38
  authenticated: boolean;
44
39
  /** Base URL handed to `npx skills add` (tokenized when authenticated). */
@@ -72,6 +67,12 @@ options: SkillsInstallOptions, runtime?: {
72
67
  execFileSync?: ExecFileSyncLike;
73
68
  spawnSync?: SpawnSyncLike;
74
69
  } & SkillsSourceRuntime): Promise<Record<string, unknown>>;
70
+ /**
71
+ * `--project` is a bare flag for the current directory, or names the project
72
+ * directory to install into. `--project .` used to fail with "too many
73
+ * arguments" (2026-09-16 blind baseline) because the flag took no value.
74
+ */
75
+ export declare function resolveSkillProjectDir(project: boolean | string | undefined): string | null;
75
76
  export declare function runAutomaticSkillsInstall(options?: {
76
77
  apiUrl?: string;
77
78
  env?: NodeJS.ProcessEnv;
package/dist/skills.js CHANGED
@@ -2,7 +2,7 @@ import { spawnSync } from "node:child_process";
2
2
  import { existsSync, mkdirSync, mkdtempSync, readdirSync, rmSync, writeFileSync } from "node:fs";
3
3
  import { homedir, tmpdir } from "node:os";
4
4
  import { dirname, join, resolve } from "node:path";
5
- import { OxygenError, inferUserCapabilityRoute, serializeCapabilityRoute, toFailure, } from "@oxygen/shared";
5
+ import { OxygenError, errorMessage, inferUserCapabilityRoute, serializeCapabilityRoute, toFailure, } from "@oxygen/shared";
6
6
  import { defaultApiUrl, loadCredentials, normalizeApiUrl } from "./credentials.js";
7
7
  import { requestOxygen } from "./http-client.js";
8
8
  import { isRecord, readOption } from "./util.js";
@@ -226,7 +226,8 @@ options, runtime = {}) {
226
226
  const env = runtime.env ?? process.env;
227
227
  const platform = runtime.platform ?? process.platform;
228
228
  const spawn = runtime.spawnSync ?? wrapExecFileSync(runtime.execFileSync) ?? spawnSync;
229
- const installLocations = resolveSkillInstallLocations(agents, options.project === true, env);
229
+ const projectDir = resolveSkillProjectDir(options.project);
230
+ const installLocations = resolveSkillInstallLocations(agents, projectDir, env);
230
231
  // The vendored installer writes immediately once spawned. Tell humans and
231
232
  // agents the exact destination first so a default global install is never a
232
233
  // surprise, while keeping stdout as one stable JSON envelope under --json.
@@ -268,6 +269,8 @@ options, runtime = {}) {
268
269
  const result = spawn(invocation.executable, invocation.args, {
269
270
  encoding: "utf8",
270
271
  env,
272
+ // A project install lands relative to the installer's working directory.
273
+ ...(projectDir ? { cwd: projectDir } : {}),
271
274
  stdio: ["ignore", "pipe", "pipe"],
272
275
  windowsHide: true,
273
276
  ...(platform === "win32" ? { windowsVerbatimArguments: true } : {}),
@@ -342,11 +345,25 @@ options, runtime = {}) {
342
345
  summary: summarizeInstallOutcome(agents.length, skippedAgents.length, 0),
343
346
  };
344
347
  }
345
- function resolveSkillInstallLocations(agents, project, env) {
348
+ /**
349
+ * `--project` is a bare flag for the current directory, or names the project
350
+ * directory to install into. `--project .` used to fail with "too many
351
+ * arguments" (2026-09-16 blind baseline) because the flag took no value.
352
+ */
353
+ export function resolveSkillProjectDir(project) {
354
+ if (project === true)
355
+ return process.cwd();
356
+ if (typeof project === "string" && project.trim())
357
+ return resolve(project.trim());
358
+ return null;
359
+ }
360
+ function resolveSkillInstallLocations(agents, projectDir, env) {
361
+ const project = projectDir !== null;
362
+ const base = projectDir ?? process.cwd();
346
363
  const projectRoots = {
347
- codex: resolve(".agents", "skills"),
348
- "claude-code": resolve(".claude", "skills"),
349
- cursor: resolve(".agents", "skills"),
364
+ codex: resolve(base, ".agents", "skills"),
365
+ "claude-code": resolve(base, ".claude", "skills"),
366
+ cursor: resolve(base, ".agents", "skills"),
350
367
  };
351
368
  const globalRoots = {
352
369
  codex: join(env.CODEX_HOME?.trim() || join(homedir(), ".codex"), "skills"),
@@ -356,7 +373,7 @@ function resolveSkillInstallLocations(agents, project, env) {
356
373
  const roots = project ? projectRoots : globalRoots;
357
374
  return agents.map((agent) => ({
358
375
  agent,
359
- path: roots[agent] ?? (project ? resolve(".agents", "skills") : join(homedir(), ".agents", "skills")),
376
+ path: roots[agent] ?? (project ? resolve(base, ".agents", "skills") : join(homedir(), ".agents", "skills")),
360
377
  }));
361
378
  }
362
379
  /**
@@ -448,9 +465,6 @@ function stagingFailure(stage, details) {
448
465
  exitCode: 1,
449
466
  });
450
467
  }
451
- function errorMessage(error) {
452
- return error instanceof Error ? error.message : String(error);
453
- }
454
468
  // Best-effort resolution of a skill's declared prerequisite skills from the
455
469
  // index. Any failure (unreachable index, parse error, unknown skill) yields no
456
470
  // dependencies so a dependency lookup can never block or fail an install.
@@ -779,27 +793,51 @@ function scoreSkill(skill, tokens, recommendedSkills) {
779
793
  score += 400 - (routeIndex * 20);
780
794
  return score;
781
795
  }
796
+ /**
797
+ * Rank a skill's documents against the query tokens.
798
+ *
799
+ * An EXACT hit on a provider name, a path segment, or a tag outranks an
800
+ * incidental substring. Flat `includes` scoring made a query that literally
801
+ * names a provider lose to an unrelated document that merely contains the
802
+ * letters: measured 2026-09-21, `skills search "hubspot import segment
803
+ * do-not-contact suppression"` returned `provider-runbooks/bettercontact.md`
804
+ * and not `provider-runbooks/hubspot.md`, because "contact" is a substring of
805
+ * "bettercontact" and the alphabetical tie-break did the rest. A blind
806
+ * acceptance run lost its whole HubSpot fallback to that.
807
+ */
782
808
  function matchingSkillDocuments(skill, tokens) {
783
809
  if (tokens.length === 0)
784
810
  return [];
785
811
  return skill.documents
786
812
  .map((document) => ({
787
813
  document,
788
- score: tokens.reduce((total, token) => {
789
- const text = [
790
- document.path,
791
- document.title ?? "",
792
- document.kind ?? "",
793
- ...document.tags,
794
- ...document.providers,
795
- ].join(" ").toLowerCase();
796
- return total + (text.includes(token) ? 1 : 0);
797
- }, 0),
814
+ score: scoreSkillDocument(document, tokens),
798
815
  }))
799
816
  .filter((entry) => entry.score > 0)
800
817
  .sort((a, b) => b.score - a.score || a.document.path.localeCompare(b.document.path))
801
818
  .map((entry) => entry.document);
802
819
  }
820
+ function scoreSkillDocument(document, tokens) {
821
+ const exact = new Set([
822
+ ...document.providers.map((value) => value.toLowerCase()),
823
+ ...document.tags.map((value) => value.toLowerCase()),
824
+ // Path segments without the extension: "provider-runbooks/hubspot.md" ->
825
+ // "provider", "runbooks", "hubspot".
826
+ ...document.path.toLowerCase().replace(/\.[a-z0-9]+$/, "").split(/[^a-z0-9]+/),
827
+ ].filter(Boolean));
828
+ const substring = [
829
+ document.path,
830
+ document.title ?? "",
831
+ document.kind ?? "",
832
+ ...document.tags,
833
+ ...document.providers,
834
+ ].join(" ").toLowerCase();
835
+ return tokens.reduce((total, token) => {
836
+ if (exact.has(token))
837
+ return total + 5;
838
+ return total + (substring.includes(token) ? 1 : 0);
839
+ }, 0);
840
+ }
803
841
  function inspectSkillsInstaller() {
804
842
  const invocation = resolveCmdShimInvocation("npx", ["--version"], process.platform, process.env);
805
843
  const result = spawnSync(invocation.executable, invocation.args, {
@@ -1,4 +1,4 @@
1
- export type TranscriptSource = "claude_code" | "codex" | "cursor" | "file";
1
+ type TranscriptSource = "claude_code" | "codex" | "cursor" | "file";
2
2
  export type CapturedTranscript = {
3
3
  source: TranscriptSource;
4
4
  session_id: string | null;
@@ -19,3 +19,4 @@ export declare class TranscriptCaptureError extends Error {
19
19
  }
20
20
  export declare function captureCurrentTranscript(options?: CaptureOptions): CapturedTranscript | null;
21
21
  export declare function collectFeedbackEnvironment(): Record<string, string>;
22
+ export {};
package/dist/util.d.ts CHANGED
@@ -1,3 +1,12 @@
1
+ export { isRecord } from "@oxygen/shared";
1
2
  export declare function readOption(value: string | undefined): string | null;
2
- export declare function isRecord(value: unknown): value is Record<string, unknown>;
3
+ /**
4
+ * A flag whose ABSENCE and whose EMPTY value mean different things: absent
5
+ * leaves the field alone, `""` clears it. `readOption` folds both into `null`,
6
+ * which is how `crm tasks update --title x` used to send `priority: null,
7
+ * due_at: null, body: null, assignee_actor_id: null` and wipe a task's deadline
8
+ * and priority on every rename (dev, 2026-09-22) — and `crm notes update --pin`
9
+ * cleared the title the same way.
10
+ */
11
+ export declare function readClearableOption(value: string | undefined): string | null | undefined;
3
12
  export declare function readErrorMessage(error: unknown): string;
package/dist/util.js CHANGED
@@ -1,8 +1,20 @@
1
+ export { isRecord } from "@oxygen/shared";
1
2
  export function readOption(value) {
2
3
  return typeof value === "string" && value.trim() ? value.trim() : null;
3
4
  }
4
- export function isRecord(value) {
5
- return Boolean(value) && typeof value === "object" && !Array.isArray(value);
5
+ /**
6
+ * A flag whose ABSENCE and whose EMPTY value mean different things: absent
7
+ * leaves the field alone, `""` clears it. `readOption` folds both into `null`,
8
+ * which is how `crm tasks update --title x` used to send `priority: null,
9
+ * due_at: null, body: null, assignee_actor_id: null` and wipe a task's deadline
10
+ * and priority on every rename (dev, 2026-09-22) — and `crm notes update --pin`
11
+ * cleared the title the same way.
12
+ */
13
+ export function readClearableOption(value) {
14
+ if (value === undefined)
15
+ return undefined;
16
+ const trimmed = value.trim();
17
+ return trimmed ? trimmed : null;
6
18
  }
7
19
  export function readErrorMessage(error) {
8
20
  return error instanceof Error ? error.message : "unknown error";