@oneharness/sdk 0.26.1 → 0.27.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.
package/dist/index.d.ts CHANGED
@@ -1,4 +1,6 @@
1
1
  import type { ZodType } from "zod";
2
+ import type { CompactOptions } from "./generated/compact-options.js";
3
+ import type { CompactOutcome } from "./generated/compact-outcome.js";
2
4
  import type { ConfigOptions } from "./generated/config-options.js";
3
5
  import type { ConfigReport } from "./generated/config-report.js";
4
6
  import type { RunReport } from "./generated/contracts.js";
@@ -33,6 +35,8 @@ import type { UsageOptions } from "./generated/usage-options.js";
33
35
  import type { UsageReport } from "./generated/usage-report.js";
34
36
  export type { Capability, CapabilityMethod, FlagKind, OptionBinding, StdoutShape, UnlessResolution, } from "./generated/capabilities.js";
35
37
  export { CAPABILITIES } from "./generated/capabilities.js";
38
+ export type { CompactOptions } from "./generated/compact-options.js";
39
+ export type { CompactOutcome } from "./generated/compact-outcome.js";
36
40
  export type { ConfigOptions } from "./generated/config-options.js";
37
41
  export type { ConfigReport } from "./generated/config-report.js";
38
42
  export type { ActionEvent, BatchReport, FailureKind, FallbackReport, FallThrough, OutputFormat, RunReport, RunResult, SessionReport, Status, Usage, } from "./generated/contracts.js";
@@ -154,6 +158,15 @@ export declare class OneHarness {
154
158
  gate(options: GateOptions): Promise<string | null>;
155
159
  /** The read-write sibling of {@link gate}, driven by a rules file. */
156
160
  mock(options: MockOptions): Promise<string | null>;
161
+ /**
162
+ * Compact a named session now, through its harness's own compaction of a
163
+ * fork; the name continues the fork only once that completes.
164
+ *
165
+ * Every outcome is an answer, not a throw: `cancelled`, `failed` and
166
+ * `unsupported` leave the session exactly as it was, and a non-zero exit
167
+ * still yields the outcome.
168
+ */
169
+ compact(options: CompactOptions): Promise<CompactOutcome>;
157
170
  /**
158
171
  * Abort the in-flight turn of a `run --control` session, optionally
159
172
  * redirecting it with `input`.
package/dist/index.js CHANGED
@@ -2,7 +2,7 @@ import { spawn } from "node:child_process";
2
2
  import { createRequire } from "node:module";
3
3
  import { createInterface } from "node:readline";
4
4
  import { CAPABILITIES, } from "./generated/capabilities.js";
5
- import { ConfigOptionsSchema, ConfigReportSchema, DetectOptionsSchema, DetectReportSchema, GateOptionsSchema, HistoryClearOptionsSchema, HistoryClearReportSchema, HistoryListOptionsSchema, HistoryListSchema, HistoryLookupSchema, HistoryMigrateOptionsSchema, HistoryMigrateReportSchema, HistoryPointersOptionsSchema, HistoryPointersSchema, HistoryRecordSchema, HistoryReindexOptionsSchema, HistoryReindexReportSchema, HistoryShowEntriesSchema, HistoryStreamEnvelopeSchema, HistoryWatchOptionsSchema, InitOptionsSchema, InterruptOptionsSchema, InterruptResponseSchema, ListReportSchema, MockOptionsSchema, RunOptionsSchema, RunReportSchema, RunStreamEnvelopeSchema, SyncOptionsSchema, SyncReportSchema, UsageOptionsSchema, UsageReportSchema, } from "./generated/zod.js";
5
+ import { CompactOptionsSchema, CompactOutcomeSchema, ConfigOptionsSchema, ConfigReportSchema, DetectOptionsSchema, DetectReportSchema, GateOptionsSchema, HistoryClearOptionsSchema, HistoryClearReportSchema, HistoryListOptionsSchema, HistoryListSchema, HistoryLookupSchema, HistoryMigrateOptionsSchema, HistoryMigrateReportSchema, HistoryPointersOptionsSchema, HistoryPointersSchema, HistoryRecordSchema, HistoryReindexOptionsSchema, HistoryReindexReportSchema, HistoryShowEntriesSchema, HistoryStreamEnvelopeSchema, HistoryWatchOptionsSchema, InitOptionsSchema, InterruptOptionsSchema, InterruptResponseSchema, ListReportSchema, MockOptionsSchema, RunOptionsSchema, RunReportSchema, RunStreamEnvelopeSchema, SyncOptionsSchema, SyncReportSchema, UsageOptionsSchema, UsageReportSchema, } from "./generated/zod.js";
6
6
  export { CAPABILITIES } from "./generated/capabilities.js";
7
7
  export * from "./generated/zod.js";
8
8
  /**
@@ -482,6 +482,17 @@ export class OneHarness {
482
482
  const verdict = await invokeText(this.options, capabilityArguments("mock", input), input.event);
483
483
  return verdict.trim() === "" ? null : verdict;
484
484
  }
485
+ /**
486
+ * Compact a named session now, through its harness's own compaction of a
487
+ * fork; the name continues the fork only once that completes.
488
+ *
489
+ * Every outcome is an answer, not a throw: `cancelled`, `failed` and
490
+ * `unsupported` leave the session exactly as it was, and a non-zero exit
491
+ * still yields the outcome.
492
+ */
493
+ async compact(options) {
494
+ return await this.call("compact", options, CompactOptionsSchema, CompactOutcomeSchema, { acceptJsonOnNonzero: true });
495
+ }
485
496
  /**
486
497
  * Abort the in-flight turn of a `run --control` session, optionally
487
498
  * redirecting it with `input`.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oneharness/sdk",
3
- "version": "0.26.1",
3
+ "version": "0.27.1",
4
4
  "description": "Typed Node.js SDK for oneharness",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -19,7 +19,7 @@
19
19
  "node": ">=20"
20
20
  },
21
21
  "dependencies": {
22
- "oneharness-cli": "0.26.1",
22
+ "oneharness-cli": "0.27.1",
23
23
  "zod": "^4.4.3"
24
24
  }
25
25
  }