@a5c-ai/babysitter-sdk 0.0.186 → 0.0.187-staging.02a0ee21
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/cli/commands/costStats.d.ts +13 -0
- package/dist/cli/commands/costStats.d.ts.map +1 -0
- package/dist/cli/commands/costStats.js +319 -0
- package/dist/cli/commands/harnessPhase2.js +10 -10
- package/dist/cli/commands/instructions.d.ts.map +1 -1
- package/dist/cli/commands/instructions.js +5 -3
- package/dist/cli/main.d.ts.map +1 -1
- package/dist/cli/main.js +16 -1
- package/dist/config/defaults.d.ts +10 -0
- package/dist/config/defaults.d.ts.map +1 -1
- package/dist/config/defaults.js +19 -0
- package/dist/config/index.d.ts +1 -1
- package/dist/config/index.d.ts.map +1 -1
- package/dist/config/index.js +2 -1
- package/dist/cost/claudeCodeParser.d.ts +81 -0
- package/dist/cost/claudeCodeParser.d.ts.map +1 -0
- package/dist/cost/claudeCodeParser.js +232 -0
- package/dist/cost/collector.d.ts +42 -0
- package/dist/cost/collector.d.ts.map +1 -0
- package/dist/cost/collector.js +105 -0
- package/dist/cost/index.d.ts +18 -0
- package/dist/cost/index.d.ts.map +1 -0
- package/dist/cost/index.js +37 -0
- package/dist/cost/journal.d.ts +40 -0
- package/dist/cost/journal.d.ts.map +1 -0
- package/dist/cost/journal.js +137 -0
- package/dist/cost/types.d.ts +164 -0
- package/dist/cost/types.d.ts.map +1 -0
- package/dist/cost/types.js +231 -0
- package/dist/harness/claudeCode.js +1 -1
- package/dist/harness/cursor.js +1 -1
- package/dist/harness/discovery.d.ts.map +1 -1
- package/dist/harness/discovery.js +8 -1
- package/dist/harness/geminiCli.js +1 -1
- package/dist/harness/githubCopilot.js +1 -1
- package/dist/harness/index.d.ts +1 -0
- package/dist/harness/index.d.ts.map +1 -1
- package/dist/harness/index.js +3 -1
- package/dist/harness/invoker.d.ts.map +1 -1
- package/dist/harness/invoker.js +1 -0
- package/dist/harness/openclaw.d.ts +20 -0
- package/dist/harness/openclaw.d.ts.map +1 -0
- package/dist/harness/openclaw.js +338 -0
- package/dist/harness/opencode.d.ts.map +1 -1
- package/dist/harness/opencode.js +75 -5
- package/dist/harness/registry.d.ts.map +1 -1
- package/dist/harness/registry.js +2 -0
- package/dist/hooks/dispatcher.d.ts +9 -0
- package/dist/hooks/dispatcher.d.ts.map +1 -1
- package/dist/hooks/dispatcher.js +94 -0
- package/dist/hooks/index.d.ts +2 -1
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/index.js +2 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/logging/runLogger.js +2 -2
- package/dist/prompts/babysitterMdDiscovery.d.ts +38 -0
- package/dist/prompts/babysitterMdDiscovery.d.ts.map +1 -0
- package/dist/prompts/babysitterMdDiscovery.js +150 -0
- package/dist/prompts/compose.d.ts.map +1 -1
- package/dist/prompts/compose.js +5 -0
- package/dist/prompts/context.d.ts +4 -0
- package/dist/prompts/context.d.ts.map +1 -1
- package/dist/prompts/context.js +37 -0
- package/dist/prompts/index.d.ts +1 -1
- package/dist/prompts/index.d.ts.map +1 -1
- package/dist/prompts/index.js +2 -1
- package/dist/prompts/parts/index.d.ts +3 -0
- package/dist/prompts/parts/index.d.ts.map +1 -1
- package/dist/prompts/parts/index.js +7 -1
- package/dist/prompts/parts/parallelPhaseDetection.d.ts +6 -0
- package/dist/prompts/parts/parallelPhaseDetection.d.ts.map +1 -0
- package/dist/prompts/parts/parallelPhaseDetection.js +10 -0
- package/dist/prompts/parts/projectInstructions.d.ts +8 -0
- package/dist/prompts/parts/projectInstructions.d.ts.map +1 -0
- package/dist/prompts/parts/projectInstructions.js +28 -0
- package/dist/prompts/parts/runOverlapDetection.d.ts +6 -0
- package/dist/prompts/parts/runOverlapDetection.d.ts.map +1 -0
- package/dist/prompts/parts/runOverlapDetection.js +10 -0
- package/dist/prompts/templates/commands/doctor.md +9 -9
- package/dist/prompts/templates/intent-fidelity-checks.md +3 -1
- package/dist/prompts/templates/parallel-phase-detection.md +59 -0
- package/dist/prompts/templates/process-creation.md +9 -2
- package/dist/prompts/templates/process-guidelines.md +5 -2
- package/dist/prompts/templates/run-overlap-detection.md +63 -0
- package/dist/prompts/templates/task-examples.md +47 -0
- package/dist/prompts/templates/task-kinds.md +44 -2
- package/dist/runtime/intrinsics/breakpoint.d.ts.map +1 -1
- package/dist/runtime/intrinsics/breakpoint.js +20 -1
- package/dist/runtime/orchestrateIteration.d.ts.map +1 -1
- package/dist/runtime/orchestrateIteration.js +14 -0
- package/dist/session/types.d.ts +2 -0
- package/dist/session/types.d.ts.map +1 -1
- package/dist/storage/createRunDir.d.ts.map +1 -1
- package/dist/storage/createRunDir.js +2 -0
- package/dist/storage/icloudWarning.d.ts +6 -0
- package/dist/storage/icloudWarning.d.ts.map +1 -0
- package/dist/storage/icloudWarning.js +84 -0
- package/dist/storage/journal.d.ts.map +1 -1
- package/dist/storage/journal.js +2 -0
- package/package.json +1 -1
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cost tracking type definitions and pricing constants for Babysitter SDK.
|
|
3
|
+
*
|
|
4
|
+
* Covers Anthropic Claude API token usage structures as seen in Claude Code
|
|
5
|
+
* session JSONL files, plus aggregation interfaces for run-level and
|
|
6
|
+
* cross-run cost reporting.
|
|
7
|
+
*
|
|
8
|
+
* Pricing source: https://docs.anthropic.com/en/docs/about-claude/pricing
|
|
9
|
+
* Last verified: 2026-04-05
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* Token/cost data for a single API interaction (assistant message).
|
|
13
|
+
*
|
|
14
|
+
* Field names mirror the Anthropic API usage response shape, converted to
|
|
15
|
+
* camelCase for SDK consistency.
|
|
16
|
+
*/
|
|
17
|
+
export interface CostEventData {
|
|
18
|
+
/** Model identifier, e.g. "claude-opus-4-6", "claude-sonnet-4-6". */
|
|
19
|
+
model: string;
|
|
20
|
+
/** Base (non-cached) input tokens. */
|
|
21
|
+
inputTokens: number;
|
|
22
|
+
/** Output (completion) tokens. */
|
|
23
|
+
outputTokens: number;
|
|
24
|
+
/** Total cache-creation input tokens (sum of 5m + 1h buckets). */
|
|
25
|
+
cacheCreationTokens: number;
|
|
26
|
+
/** Tokens read from prompt cache (cache hits). */
|
|
27
|
+
cacheReadTokens: number;
|
|
28
|
+
/** Ephemeral 5-minute cache-creation input tokens. */
|
|
29
|
+
cacheCreation5mTokens: number;
|
|
30
|
+
/** Extended 1-hour cache-creation input tokens. */
|
|
31
|
+
cacheCreation1hTokens: number;
|
|
32
|
+
/** Service tier reported by the API (e.g. "standard"). */
|
|
33
|
+
serviceTier?: string;
|
|
34
|
+
/** Effect ID that produced this usage, when tracked inside a run. */
|
|
35
|
+
effectId?: string;
|
|
36
|
+
/** Task kind (e.g. "orchestrator_task", "node", "breakpoint"). */
|
|
37
|
+
taskKind?: string;
|
|
38
|
+
/** Wall-clock duration of the API call in milliseconds. */
|
|
39
|
+
durationMs?: number;
|
|
40
|
+
/** Computed cost in USD for this single event. */
|
|
41
|
+
costUsd?: number;
|
|
42
|
+
/** ISO-8601 timestamp of the event. */
|
|
43
|
+
timestamp?: string;
|
|
44
|
+
}
|
|
45
|
+
/** Per-model cost aggregation within a run. */
|
|
46
|
+
export interface ModelCostStats {
|
|
47
|
+
model: string;
|
|
48
|
+
eventCount: number;
|
|
49
|
+
inputTokens: number;
|
|
50
|
+
outputTokens: number;
|
|
51
|
+
cacheCreationTokens: number;
|
|
52
|
+
cacheReadTokens: number;
|
|
53
|
+
costUsd: number;
|
|
54
|
+
}
|
|
55
|
+
/** Per-task-kind cost aggregation within a run. */
|
|
56
|
+
export interface KindCostStats {
|
|
57
|
+
kind: string;
|
|
58
|
+
eventCount: number;
|
|
59
|
+
costUsd: number;
|
|
60
|
+
}
|
|
61
|
+
/** Cost summary for a single run. */
|
|
62
|
+
export interface RunCostStats {
|
|
63
|
+
runId: string;
|
|
64
|
+
date: string;
|
|
65
|
+
eventCount: number;
|
|
66
|
+
totalInputTokens: number;
|
|
67
|
+
totalOutputTokens: number;
|
|
68
|
+
totalCacheCreation: number;
|
|
69
|
+
totalCacheRead: number;
|
|
70
|
+
totalCostUsd: number;
|
|
71
|
+
byModel: Record<string, ModelCostStats>;
|
|
72
|
+
byKind: Record<string, KindCostStats>;
|
|
73
|
+
}
|
|
74
|
+
/** Aggregate cost summary across multiple runs. */
|
|
75
|
+
export interface AggregateCostStats {
|
|
76
|
+
totalRuns: number;
|
|
77
|
+
totalEvents: number;
|
|
78
|
+
totalInputTokens: number;
|
|
79
|
+
totalOutputTokens: number;
|
|
80
|
+
totalCacheCreation: number;
|
|
81
|
+
totalCacheRead: number;
|
|
82
|
+
totalCostUsd: number;
|
|
83
|
+
/** Overall cost including all token categories across all runs. */
|
|
84
|
+
overallCostUsd: number;
|
|
85
|
+
runs: RunCostStats[];
|
|
86
|
+
}
|
|
87
|
+
/** Per-million-token pricing for a single model. All values in USD. */
|
|
88
|
+
export interface ModelPricing {
|
|
89
|
+
/** Base (non-cached) input tokens, per 1M tokens. */
|
|
90
|
+
inputPer1M: number;
|
|
91
|
+
/** Output tokens, per 1M tokens. */
|
|
92
|
+
outputPer1M: number;
|
|
93
|
+
/**
|
|
94
|
+
* Cache-creation tokens, per 1M tokens.
|
|
95
|
+
*
|
|
96
|
+
* This is the blended/default rate used when the 5m vs 1h breakdown is
|
|
97
|
+
* unavailable. Defaults to the 5-minute cache write rate (1.25x input).
|
|
98
|
+
*/
|
|
99
|
+
cacheCreationPer1M: number;
|
|
100
|
+
/** Cache-read (hit) tokens, per 1M tokens (0.1x input). */
|
|
101
|
+
cacheReadPer1M: number;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Pricing table for known Claude models.
|
|
105
|
+
*
|
|
106
|
+
* Keys use the API model identifier format (e.g. "claude-opus-4-6").
|
|
107
|
+
* Pricing sourced from https://docs.anthropic.com/en/docs/about-claude/pricing
|
|
108
|
+
*
|
|
109
|
+
* Cache-creation rates default to the 5-minute write multiplier (1.25x input).
|
|
110
|
+
* For fine-grained 5m vs 1h cost splits, use {@link MODEL_PRICING_EXTENDED}.
|
|
111
|
+
*/
|
|
112
|
+
export declare const MODEL_PRICING: Record<string, ModelPricing>;
|
|
113
|
+
/**
|
|
114
|
+
* Extended pricing with separate 5-minute and 1-hour cache write rates.
|
|
115
|
+
*
|
|
116
|
+
* Use this when the event data provides the `cacheCreation5mTokens` /
|
|
117
|
+
* `cacheCreation1hTokens` breakdown (available via the `cache_creation`
|
|
118
|
+
* sub-object in the Anthropic API response).
|
|
119
|
+
*/
|
|
120
|
+
export interface ModelPricingExtended extends ModelPricing {
|
|
121
|
+
/** 5-minute cache write, per 1M tokens (1.25x input). */
|
|
122
|
+
cacheCreation5mPer1M: number;
|
|
123
|
+
/** 1-hour cache write, per 1M tokens (2x input). */
|
|
124
|
+
cacheCreation1hPer1M: number;
|
|
125
|
+
}
|
|
126
|
+
export declare const MODEL_PRICING_EXTENDED: Record<string, ModelPricingExtended>;
|
|
127
|
+
/**
|
|
128
|
+
* Calculate the USD cost for a single API interaction.
|
|
129
|
+
*
|
|
130
|
+
* Uses the blended cache-creation rate from {@link MODEL_PRICING}.
|
|
131
|
+
* For fine-grained 5m/1h splits, use {@link calculateCostUsdExtended}.
|
|
132
|
+
*
|
|
133
|
+
* @returns Cost in USD, or `undefined` if the model is unknown.
|
|
134
|
+
*/
|
|
135
|
+
export declare function calculateCostUsd(model: string, inputTokens: number, outputTokens: number, cacheCreationTokens: number, cacheReadTokens: number): number | undefined;
|
|
136
|
+
/**
|
|
137
|
+
* Calculate the USD cost with separate 5-minute and 1-hour cache write rates.
|
|
138
|
+
*
|
|
139
|
+
* Use when the Anthropic API response includes the `cache_creation` sub-object
|
|
140
|
+
* with `ephemeral_5m_input_tokens` and `ephemeral_1h_input_tokens`.
|
|
141
|
+
*
|
|
142
|
+
* @returns Cost in USD, or `undefined` if the model is unknown.
|
|
143
|
+
*/
|
|
144
|
+
export declare function calculateCostUsdExtended(model: string, inputTokens: number, outputTokens: number, cacheCreation5mTokens: number, cacheCreation1hTokens: number, cacheReadTokens: number): number | undefined;
|
|
145
|
+
/** Options for the cost:stats CLI command. */
|
|
146
|
+
export interface CostStatsOptions {
|
|
147
|
+
/** Show stats for a specific run. */
|
|
148
|
+
runId?: string;
|
|
149
|
+
/** Aggregate stats across all runs. */
|
|
150
|
+
all?: boolean;
|
|
151
|
+
/** Output JSON instead of a table. */
|
|
152
|
+
json?: boolean;
|
|
153
|
+
/** Custom runs directory. */
|
|
154
|
+
runsDir?: string;
|
|
155
|
+
/** Filter to a specific model. */
|
|
156
|
+
model?: string;
|
|
157
|
+
/** Filter to a specific task kind. */
|
|
158
|
+
kind?: string;
|
|
159
|
+
/** Only show runs after this ISO-8601 date. */
|
|
160
|
+
since?: string;
|
|
161
|
+
/** Only show runs before this ISO-8601 date. */
|
|
162
|
+
until?: string;
|
|
163
|
+
}
|
|
164
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/cost/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAMH;;;;;GAKG;AACH,MAAM,WAAW,aAAa;IAC5B,qEAAqE;IACrE,KAAK,EAAE,MAAM,CAAC;IAEd,sCAAsC;IACtC,WAAW,EAAE,MAAM,CAAC;IAEpB,kCAAkC;IAClC,YAAY,EAAE,MAAM,CAAC;IAErB,kEAAkE;IAClE,mBAAmB,EAAE,MAAM,CAAC;IAE5B,kDAAkD;IAClD,eAAe,EAAE,MAAM,CAAC;IAExB,sDAAsD;IACtD,qBAAqB,EAAE,MAAM,CAAC;IAE9B,mDAAmD;IACnD,qBAAqB,EAAE,MAAM,CAAC;IAE9B,0DAA0D;IAC1D,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB,qEAAqE;IACrE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB,kEAAkE;IAClE,Q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C;IACd,sCAAsC;IACtC,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,6BAA6B;IAC7B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,kCAAkC;IAClC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,sCAAsC;IACtC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,+CAA+C;IAC/C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,gDAAgD;IAChD,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB"}
|
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Cost tracking type definitions and pricing constants for Babysitter SDK.
|
|
4
|
+
*
|
|
5
|
+
* Covers Anthropic Claude API token usage structures as seen in Claude Code
|
|
6
|
+
* session JSONL files, plus aggregation interfaces for run-level and
|
|
7
|
+
* cross-run cost reporting.
|
|
8
|
+
*
|
|
9
|
+
* Pricing source: https://docs.anthropic.com/en/docs/about-claude/pricing
|
|
10
|
+
* Last verified: 2026-04-05
|
|
11
|
+
*/
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
exports.MODEL_PRICING_EXTENDED = exports.MODEL_PRICING = void 0;
|
|
14
|
+
exports.calculateCostUsd = calculateCostUsd;
|
|
15
|
+
exports.calculateCostUsdExtended = calculateCostUsdExtended;
|
|
16
|
+
/**
|
|
17
|
+
* Pricing table for known Claude models.
|
|
18
|
+
*
|
|
19
|
+
* Keys use the API model identifier format (e.g. "claude-opus-4-6").
|
|
20
|
+
* Pricing sourced from https://docs.anthropic.com/en/docs/about-claude/pricing
|
|
21
|
+
*
|
|
22
|
+
* Cache-creation rates default to the 5-minute write multiplier (1.25x input).
|
|
23
|
+
* For fine-grained 5m vs 1h cost splits, use {@link MODEL_PRICING_EXTENDED}.
|
|
24
|
+
*/
|
|
25
|
+
exports.MODEL_PRICING = {
|
|
26
|
+
// --- Opus family ---
|
|
27
|
+
"claude-opus-4-6": {
|
|
28
|
+
inputPer1M: 5,
|
|
29
|
+
outputPer1M: 25,
|
|
30
|
+
cacheCreationPer1M: 6.25, // 1.25x input
|
|
31
|
+
cacheReadPer1M: 0.5, // 0.1x input
|
|
32
|
+
},
|
|
33
|
+
"claude-opus-4-5": {
|
|
34
|
+
inputPer1M: 5,
|
|
35
|
+
outputPer1M: 25,
|
|
36
|
+
cacheCreationPer1M: 6.25,
|
|
37
|
+
cacheReadPer1M: 0.5,
|
|
38
|
+
},
|
|
39
|
+
"claude-opus-4-1": {
|
|
40
|
+
inputPer1M: 15,
|
|
41
|
+
outputPer1M: 75,
|
|
42
|
+
cacheCreationPer1M: 18.75,
|
|
43
|
+
cacheReadPer1M: 1.5,
|
|
44
|
+
},
|
|
45
|
+
"claude-opus-4-0": {
|
|
46
|
+
inputPer1M: 15,
|
|
47
|
+
outputPer1M: 75,
|
|
48
|
+
cacheCreationPer1M: 18.75,
|
|
49
|
+
cacheReadPer1M: 1.5,
|
|
50
|
+
},
|
|
51
|
+
// --- Sonnet family ---
|
|
52
|
+
"claude-sonnet-4-6": {
|
|
53
|
+
inputPer1M: 3,
|
|
54
|
+
outputPer1M: 15,
|
|
55
|
+
cacheCreationPer1M: 3.75,
|
|
56
|
+
cacheReadPer1M: 0.3,
|
|
57
|
+
},
|
|
58
|
+
"claude-sonnet-4-5": {
|
|
59
|
+
inputPer1M: 3,
|
|
60
|
+
outputPer1M: 15,
|
|
61
|
+
cacheCreationPer1M: 3.75,
|
|
62
|
+
cacheReadPer1M: 0.3,
|
|
63
|
+
},
|
|
64
|
+
"claude-sonnet-4-0": {
|
|
65
|
+
inputPer1M: 3,
|
|
66
|
+
outputPer1M: 15,
|
|
67
|
+
cacheCreationPer1M: 3.75,
|
|
68
|
+
cacheReadPer1M: 0.3,
|
|
69
|
+
},
|
|
70
|
+
// --- Haiku family ---
|
|
71
|
+
"claude-haiku-4-5": {
|
|
72
|
+
inputPer1M: 1,
|
|
73
|
+
outputPer1M: 5,
|
|
74
|
+
cacheCreationPer1M: 1.25,
|
|
75
|
+
cacheReadPer1M: 0.1,
|
|
76
|
+
},
|
|
77
|
+
"claude-haiku-3-5": {
|
|
78
|
+
inputPer1M: 0.8,
|
|
79
|
+
outputPer1M: 4,
|
|
80
|
+
cacheCreationPer1M: 1,
|
|
81
|
+
cacheReadPer1M: 0.08,
|
|
82
|
+
},
|
|
83
|
+
};
|
|
84
|
+
exports.MODEL_PRICING_EXTENDED = {
|
|
85
|
+
"claude-opus-4-6": {
|
|
86
|
+
inputPer1M: 5,
|
|
87
|
+
outputPer1M: 25,
|
|
88
|
+
cacheCreationPer1M: 6.25,
|
|
89
|
+
cacheCreation5mPer1M: 6.25,
|
|
90
|
+
cacheCreation1hPer1M: 10,
|
|
91
|
+
cacheReadPer1M: 0.5,
|
|
92
|
+
},
|
|
93
|
+
"claude-opus-4-5": {
|
|
94
|
+
inputPer1M: 5,
|
|
95
|
+
outputPer1M: 25,
|
|
96
|
+
cacheCreationPer1M: 6.25,
|
|
97
|
+
cacheCreation5mPer1M: 6.25,
|
|
98
|
+
cacheCreation1hPer1M: 10,
|
|
99
|
+
cacheReadPer1M: 0.5,
|
|
100
|
+
},
|
|
101
|
+
"claude-opus-4-1": {
|
|
102
|
+
inputPer1M: 15,
|
|
103
|
+
outputPer1M: 75,
|
|
104
|
+
cacheCreationPer1M: 18.75,
|
|
105
|
+
cacheCreation5mPer1M: 18.75,
|
|
106
|
+
cacheCreation1hPer1M: 30,
|
|
107
|
+
cacheReadPer1M: 1.5,
|
|
108
|
+
},
|
|
109
|
+
"claude-opus-4-0": {
|
|
110
|
+
inputPer1M: 15,
|
|
111
|
+
outputPer1M: 75,
|
|
112
|
+
cacheCreationPer1M: 18.75,
|
|
113
|
+
cacheCreation5mPer1M: 18.75,
|
|
114
|
+
cacheCreation1hPer1M: 30,
|
|
115
|
+
cacheReadPer1M: 1.5,
|
|
116
|
+
},
|
|
117
|
+
"claude-sonnet-4-6": {
|
|
118
|
+
inputPer1M: 3,
|
|
119
|
+
outputPer1M: 15,
|
|
120
|
+
cacheCreationPer1M: 3.75,
|
|
121
|
+
cacheCreation5mPer1M: 3.75,
|
|
122
|
+
cacheCreation1hPer1M: 6,
|
|
123
|
+
cacheReadPer1M: 0.3,
|
|
124
|
+
},
|
|
125
|
+
"claude-sonnet-4-5": {
|
|
126
|
+
inputPer1M: 3,
|
|
127
|
+
outputPer1M: 15,
|
|
128
|
+
cacheCreationPer1M: 3.75,
|
|
129
|
+
cacheCreation5mPer1M: 3.75,
|
|
130
|
+
cacheCreation1hPer1M: 6,
|
|
131
|
+
cacheReadPer1M: 0.3,
|
|
132
|
+
},
|
|
133
|
+
"claude-sonnet-4-0": {
|
|
134
|
+
inputPer1M: 3,
|
|
135
|
+
outputPer1M: 15,
|
|
136
|
+
cacheCreationPer1M: 3.75,
|
|
137
|
+
cacheCreation5mPer1M: 3.75,
|
|
138
|
+
cacheCreation1hPer1M: 6,
|
|
139
|
+
cacheReadPer1M: 0.3,
|
|
140
|
+
},
|
|
141
|
+
"claude-haiku-4-5": {
|
|
142
|
+
inputPer1M: 1,
|
|
143
|
+
outputPer1M: 5,
|
|
144
|
+
cacheCreationPer1M: 1.25,
|
|
145
|
+
cacheCreation5mPer1M: 1.25,
|
|
146
|
+
cacheCreation1hPer1M: 2,
|
|
147
|
+
cacheReadPer1M: 0.1,
|
|
148
|
+
},
|
|
149
|
+
"claude-haiku-3-5": {
|
|
150
|
+
inputPer1M: 0.8,
|
|
151
|
+
outputPer1M: 4,
|
|
152
|
+
cacheCreationPer1M: 1,
|
|
153
|
+
cacheCreation5mPer1M: 1,
|
|
154
|
+
cacheCreation1hPer1M: 1.6,
|
|
155
|
+
cacheReadPer1M: 0.08,
|
|
156
|
+
},
|
|
157
|
+
};
|
|
158
|
+
// ============================================================================
|
|
159
|
+
// Cost calculation
|
|
160
|
+
// ============================================================================
|
|
161
|
+
/**
|
|
162
|
+
* Resolve pricing for a model identifier.
|
|
163
|
+
*
|
|
164
|
+
* Handles common variations: the API may return "claude-opus-4-6-20260301"
|
|
165
|
+
* or similar dated suffixes. We strip the date and try progressively
|
|
166
|
+
* shorter prefixes until we find a match.
|
|
167
|
+
*/
|
|
168
|
+
function resolvePricing(model) {
|
|
169
|
+
// Direct match first.
|
|
170
|
+
if (exports.MODEL_PRICING[model])
|
|
171
|
+
return exports.MODEL_PRICING[model];
|
|
172
|
+
// Strip date suffix (e.g. "claude-opus-4-6-20260301" -> "claude-opus-4-6").
|
|
173
|
+
const withoutDate = model.replace(/-\d{8}$/, "");
|
|
174
|
+
if (exports.MODEL_PRICING[withoutDate])
|
|
175
|
+
return exports.MODEL_PRICING[withoutDate];
|
|
176
|
+
// Try prefix matching (longest first).
|
|
177
|
+
const keys = Object.keys(exports.MODEL_PRICING).sort((a, b) => b.length - a.length);
|
|
178
|
+
for (const key of keys) {
|
|
179
|
+
if (withoutDate.startsWith(key))
|
|
180
|
+
return exports.MODEL_PRICING[key];
|
|
181
|
+
}
|
|
182
|
+
return undefined;
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* Calculate the USD cost for a single API interaction.
|
|
186
|
+
*
|
|
187
|
+
* Uses the blended cache-creation rate from {@link MODEL_PRICING}.
|
|
188
|
+
* For fine-grained 5m/1h splits, use {@link calculateCostUsdExtended}.
|
|
189
|
+
*
|
|
190
|
+
* @returns Cost in USD, or `undefined` if the model is unknown.
|
|
191
|
+
*/
|
|
192
|
+
function calculateCostUsd(model, inputTokens, outputTokens, cacheCreationTokens, cacheReadTokens) {
|
|
193
|
+
const pricing = resolvePricing(model);
|
|
194
|
+
if (!pricing)
|
|
195
|
+
return undefined;
|
|
196
|
+
const cost = (inputTokens / 1_000_000) * pricing.inputPer1M +
|
|
197
|
+
(outputTokens / 1_000_000) * pricing.outputPer1M +
|
|
198
|
+
(cacheCreationTokens / 1_000_000) * pricing.cacheCreationPer1M +
|
|
199
|
+
(cacheReadTokens / 1_000_000) * pricing.cacheReadPer1M;
|
|
200
|
+
return Math.round(cost * 1_000_000) / 1_000_000; // 6 decimal places
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* Calculate the USD cost with separate 5-minute and 1-hour cache write rates.
|
|
204
|
+
*
|
|
205
|
+
* Use when the Anthropic API response includes the `cache_creation` sub-object
|
|
206
|
+
* with `ephemeral_5m_input_tokens` and `ephemeral_1h_input_tokens`.
|
|
207
|
+
*
|
|
208
|
+
* @returns Cost in USD, or `undefined` if the model is unknown.
|
|
209
|
+
*/
|
|
210
|
+
function calculateCostUsdExtended(model, inputTokens, outputTokens, cacheCreation5mTokens, cacheCreation1hTokens, cacheReadTokens) {
|
|
211
|
+
const pricing = exports.MODEL_PRICING_EXTENDED[model] ?? (() => {
|
|
212
|
+
// Fall back to base pricing with derived 1h rate (2x input).
|
|
213
|
+
const base = resolvePricing(model);
|
|
214
|
+
if (!base)
|
|
215
|
+
return undefined;
|
|
216
|
+
return {
|
|
217
|
+
...base,
|
|
218
|
+
cacheCreation5mPer1M: base.cacheCreationPer1M,
|
|
219
|
+
cacheCreation1hPer1M: base.inputPer1M * 2,
|
|
220
|
+
};
|
|
221
|
+
})();
|
|
222
|
+
if (!pricing)
|
|
223
|
+
return undefined;
|
|
224
|
+
const ext = pricing;
|
|
225
|
+
const cost = (inputTokens / 1_000_000) * ext.inputPer1M +
|
|
226
|
+
(outputTokens / 1_000_000) * ext.outputPer1M +
|
|
227
|
+
(cacheCreation5mTokens / 1_000_000) * ext.cacheCreation5mPer1M +
|
|
228
|
+
(cacheCreation1hTokens / 1_000_000) * ext.cacheCreation1hPer1M +
|
|
229
|
+
(cacheReadTokens / 1_000_000) * ext.cacheReadPer1M;
|
|
230
|
+
return Math.round(cost * 1_000_000) / 1_000_000;
|
|
231
|
+
}
|
|
@@ -64,7 +64,7 @@ const density_filter_1 = require("../compression/density-filter");
|
|
|
64
64
|
const library_cache_1 = require("../compression/library-cache");
|
|
65
65
|
const installSupport_1 = require("./installSupport");
|
|
66
66
|
function createHookLogger(hookName) {
|
|
67
|
-
const logDir =
|
|
67
|
+
const logDir = (0, config_1.getGlobalLogDir)();
|
|
68
68
|
const logFile = logDir ? path.join(logDir, `${hookName}.log`) : null;
|
|
69
69
|
const context = {};
|
|
70
70
|
if (logFile) {
|
package/dist/harness/cursor.js
CHANGED
|
@@ -82,7 +82,7 @@ const config_1 = require("../config");
|
|
|
82
82
|
// ---------------------------------------------------------------------------
|
|
83
83
|
const HARNESS_NAME = "cursor";
|
|
84
84
|
function createHookLogger(hookName) {
|
|
85
|
-
const logDir =
|
|
85
|
+
const logDir = (0, config_1.getGlobalLogDir)();
|
|
86
86
|
const logFile = logDir ? path.join(logDir, `${hookName}.log`) : null;
|
|
87
87
|
const context = {};
|
|
88
88
|
if (logFile) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"discovery.d.ts","sourceRoot":"","sources":["../../src/harness/discovery.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAMH,OAAO,KAAK,EAAE,sBAAsB,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAO9F,0DAA0D;AAC1D,UAAU,WAAW;IACnB,wDAAwD;IACxD,IAAI,EAAE,MAAM,CAAC;IACb,mDAAmD;IACnD,GAAG,EAAE,MAAM,CAAC;IACZ;;;;;OAKG;IACH,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,+CAA+C;IAC/C,YAAY,EAAE,iBAAiB,EAAE,CAAC;CACnC;AAMD,mDAAmD;AACnD,eAAO,MAAM,eAAe,EAAE,SAAS,WAAW,
|
|
1
|
+
{"version":3,"file":"discovery.d.ts","sourceRoot":"","sources":["../../src/harness/discovery.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAMH,OAAO,KAAK,EAAE,sBAAsB,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAO9F,0DAA0D;AAC1D,UAAU,WAAW;IACnB,wDAAwD;IACxD,IAAI,EAAE,MAAM,CAAC;IACb,mDAAmD;IACnD,GAAG,EAAE,MAAM,CAAC;IACZ;;;;;OAKG;IACH,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,+CAA+C;IAC/C,YAAY,EAAE,iBAAiB,EAAE,CAAC;CACnC;AAMD,mDAAmD;AACnD,eAAO,MAAM,eAAe,EAAE,SAAS,WAAW,EAkExC,CAAC;AA2CX;;;;;;;;GAQG;AACH,wBAAsB,iBAAiB,CACrC,OAAO,EAAE,MAAM,GACd,OAAO,CAAC;IAAE,SAAS,EAAE,OAAO,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,CA0BlE;AAMD;;;;;;;;;;;;;GAaG;AACH,wBAAsB,iBAAiB,IAAI,OAAO,CAAC,sBAAsB,EAAE,CAAC,CA6B3E;AAMD;;;;;;;;;;;GAWG;AACH,wBAAgB,mBAAmB,IAAI,mBAAmB,GAAG,IAAI,CAahE"}
|
|
@@ -100,7 +100,7 @@ exports.KNOWN_HARNESSES = [
|
|
|
100
100
|
{
|
|
101
101
|
name: "opencode",
|
|
102
102
|
cli: "opencode",
|
|
103
|
-
callerEnvVars: ["BABYSITTER_SESSION_ID", "OPENCODE_CONFIG"],
|
|
103
|
+
callerEnvVars: ["BABYSITTER_SESSION_ID", "OPENCODE_CONFIG", "ACCOMPLISH_TASK_ID", "OPENCODE_CONFIG_DIR"],
|
|
104
104
|
capabilities: [types_1.HarnessCapability.HeadlessPrompt],
|
|
105
105
|
},
|
|
106
106
|
{
|
|
@@ -109,6 +109,12 @@ exports.KNOWN_HARNESSES = [
|
|
|
109
109
|
callerEnvVars: ["OMP_SESSION_ID", "OMP_PLUGIN_ROOT"],
|
|
110
110
|
capabilities: [types_1.HarnessCapability.Programmatic, types_1.HarnessCapability.SessionBinding, types_1.HarnessCapability.HeadlessPrompt, types_1.HarnessCapability.Mcp],
|
|
111
111
|
},
|
|
112
|
+
{
|
|
113
|
+
name: "openclaw",
|
|
114
|
+
cli: "openclaw",
|
|
115
|
+
callerEnvVars: ["OPENCLAW_SHELL", "OPENCLAW_HOME"],
|
|
116
|
+
capabilities: [types_1.HarnessCapability.SessionBinding, types_1.HarnessCapability.Mcp, types_1.HarnessCapability.HeadlessPrompt],
|
|
117
|
+
},
|
|
112
118
|
{
|
|
113
119
|
name: "pi",
|
|
114
120
|
cli: "pi",
|
|
@@ -135,6 +141,7 @@ const CONFIG_PATHS = {
|
|
|
135
141
|
"github-copilot": [".copilot", ".github"],
|
|
136
142
|
cursor: [".cursor", ".cursorrules"],
|
|
137
143
|
opencode: [".opencode"],
|
|
144
|
+
openclaw: [".openclaw"],
|
|
138
145
|
};
|
|
139
146
|
/**
|
|
140
147
|
* Checks whether a harness config directory exists in cwd or home.
|
|
@@ -78,7 +78,7 @@ const config_1 = require("../config");
|
|
|
78
78
|
// ---------------------------------------------------------------------------
|
|
79
79
|
const HARNESS_NAME = "gemini-cli";
|
|
80
80
|
function createHookLogger(hookName) {
|
|
81
|
-
const logDir =
|
|
81
|
+
const logDir = (0, config_1.getGlobalLogDir)();
|
|
82
82
|
const logFile = logDir ? path.join(logDir, `${hookName}.log`) : null;
|
|
83
83
|
const context = {};
|
|
84
84
|
if (logFile) {
|
|
@@ -79,7 +79,7 @@ const config_1 = require("../config");
|
|
|
79
79
|
// ---------------------------------------------------------------------------
|
|
80
80
|
const HARNESS_NAME = "github-copilot";
|
|
81
81
|
function createHookLogger(hookName) {
|
|
82
|
-
const logDir =
|
|
82
|
+
const logDir = (0, config_1.getGlobalLogDir)();
|
|
83
83
|
const logFile = logDir ? path.join(logDir, `${hookName}.log`) : null;
|
|
84
84
|
const context = {};
|
|
85
85
|
if (logFile) {
|
package/dist/harness/index.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ export { createCursorAdapter } from "./cursor";
|
|
|
7
7
|
export { createGithubCopilotAdapter } from "./githubCopilot";
|
|
8
8
|
export { createPiAdapter } from "./pi";
|
|
9
9
|
export { createOhMyPiAdapter } from "./ohMyPi";
|
|
10
|
+
export { createOpenClawAdapter } from "./openclaw";
|
|
10
11
|
export { createOpenCodeAdapter } from "./opencode";
|
|
11
12
|
export { createInternalAdapter } from "./internal";
|
|
12
13
|
export { createPiSession, PiSessionHandle, type PiEventListener } from "./piWrapper";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/harness/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,cAAc,EACd,kBAAkB,EAClB,iBAAiB,EACjB,eAAe,EACf,sBAAsB,EACtB,mBAAmB,EACnB,oBAAoB,EACpB,mBAAmB,EACnB,qBAAqB,EACrB,oBAAoB,EACpB,gBAAgB,EAChB,cAAc,EACd,cAAc,GACf,MAAM,SAAS,CAAC;AAEjB,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAE5C,OAAO,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AACvD,OAAO,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAC7C,OAAO,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AACrD,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAC/C,OAAO,EAAE,0BAA0B,EAAE,MAAM,iBAAiB,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,MAAM,CAAC;AACvC,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAC/C,OAAO,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AACnD,OAAO,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AACnD,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,KAAK,eAAe,EAAE,MAAM,aAAa,CAAC;AACrF,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,EACL,aAAa,EACb,gBAAgB,EAChB,sBAAsB,EACtB,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,EAAE,MAAM,aAAa,CAAC;AACrF,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,EACL,aAAa,EACb,gBAAgB,EAChB,sBAAsB,EACtB,UAAU,EACV,UAAU,EACV,YAAY,GACb,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEzG,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAE7E,OAAO,EACL,4BAA4B,EAC5B,KAAK,kBAAkB,EACvB,KAAK,oBAAoB,EACzB,kBAAkB,GACnB,MAAM,gBAAgB,CAAC"}
|
package/dist/harness/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.AGENTIC_TOOL_NAMES = exports.createAgenticToolDefinitions = exports.HARNESS_CLI_MAP = exports.buildHarnessArgs = exports.invokeHarness = exports.KNOWN_HARNESSES = exports.checkCliAvailable = exports.detectCallerHarness = exports.discoverHarnesses = exports.resetAdapter = exports.setAdapter = exports.getAdapter = exports.listSupportedHarnesses = exports.getAdapterByName = exports.detectAdapter = exports.createCustomAdapter = exports.createNullAdapter = exports.PiSessionHandle = exports.createPiSession = exports.createInternalAdapter = exports.createOpenCodeAdapter = exports.createOhMyPiAdapter = exports.createPiAdapter = exports.createGithubCopilotAdapter = exports.createCursorAdapter = exports.createGeminiCliAdapter = exports.createCodexAdapter = exports.createClaudeCodeAdapter = exports.HarnessCapability = void 0;
|
|
3
|
+
exports.AGENTIC_TOOL_NAMES = exports.createAgenticToolDefinitions = exports.HARNESS_CLI_MAP = exports.buildHarnessArgs = exports.invokeHarness = exports.KNOWN_HARNESSES = exports.checkCliAvailable = exports.detectCallerHarness = exports.discoverHarnesses = exports.resetAdapter = exports.setAdapter = exports.getAdapter = exports.listSupportedHarnesses = exports.getAdapterByName = exports.detectAdapter = exports.createCustomAdapter = exports.createNullAdapter = exports.PiSessionHandle = exports.createPiSession = exports.createInternalAdapter = exports.createOpenCodeAdapter = exports.createOpenClawAdapter = exports.createOhMyPiAdapter = exports.createPiAdapter = exports.createGithubCopilotAdapter = exports.createCursorAdapter = exports.createGeminiCliAdapter = exports.createCodexAdapter = exports.createClaudeCodeAdapter = exports.HarnessCapability = void 0;
|
|
4
4
|
var types_1 = require("./types");
|
|
5
5
|
Object.defineProperty(exports, "HarnessCapability", { enumerable: true, get: function () { return types_1.HarnessCapability; } });
|
|
6
6
|
var claudeCode_1 = require("./claudeCode");
|
|
@@ -17,6 +17,8 @@ var pi_1 = require("./pi");
|
|
|
17
17
|
Object.defineProperty(exports, "createPiAdapter", { enumerable: true, get: function () { return pi_1.createPiAdapter; } });
|
|
18
18
|
var ohMyPi_1 = require("./ohMyPi");
|
|
19
19
|
Object.defineProperty(exports, "createOhMyPiAdapter", { enumerable: true, get: function () { return ohMyPi_1.createOhMyPiAdapter; } });
|
|
20
|
+
var openclaw_1 = require("./openclaw");
|
|
21
|
+
Object.defineProperty(exports, "createOpenClawAdapter", { enumerable: true, get: function () { return openclaw_1.createOpenClawAdapter; } });
|
|
20
22
|
var opencode_1 = require("./opencode");
|
|
21
23
|
Object.defineProperty(exports, "createOpenCodeAdapter", { enumerable: true, get: function () { return opencode_1.createOpenCodeAdapter; } });
|
|
22
24
|
var internal_1 = require("./internal");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"invoker.d.ts","sourceRoot":"","sources":["../../src/harness/invoker.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAMH,OAAO,KAAK,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AASzE,wDAAwD;AACxD,UAAU,cAAc;IACtB,wBAAwB;IACxB,GAAG,EAAE,MAAM,CAAC;IACZ,8DAA8D;IAC9D,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,kDAAkD;IAClD,aAAa,EAAE,OAAO,CAAC;IACvB,qEAAqE;IACrE,WAAW,CAAC,EAAE,YAAY,GAAG,MAAM,CAAC;IACpC,qEAAqE;IACrE,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;CACrB;AAQD;;GAEG;AACH,eAAO,MAAM,eAAe,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,
|
|
1
|
+
{"version":3,"file":"invoker.d.ts","sourceRoot":"","sources":["../../src/harness/invoker.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAMH,OAAO,KAAK,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AASzE,wDAAwD;AACxD,UAAU,cAAc;IACtB,wBAAwB;IACxB,GAAG,EAAE,MAAM,CAAC;IACZ,8DAA8D;IAC9D,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,kDAAkD;IAClD,aAAa,EAAE,OAAO,CAAC;IACvB,qEAAqE;IACrE,WAAW,CAAC,EAAE,YAAY,GAAG,MAAM,CAAC;IACpC,qEAAqE;IACrE,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;CACrB;AAQD;;GAEG;AACH,eAAO,MAAM,eAAe,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAgB3D,CAAC;AAuDX;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,oBAAoB,GAC5B,MAAM,EAAE,CA+BV;AASD;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,aAAa,CACjC,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,oBAAoB,GAC5B,OAAO,CAAC,mBAAmB,CAAC,CAqI9B"}
|
package/dist/harness/invoker.js
CHANGED
|
@@ -67,6 +67,7 @@ exports.HARNESS_CLI_MAP = {
|
|
|
67
67
|
"gemini-cli": { cli: "gemini", supportsModel: true, promptStyle: "flag" },
|
|
68
68
|
"github-copilot": { cli: "copilot", supportsModel: true, promptStyle: "flag" },
|
|
69
69
|
cursor: { cli: "cursor", supportsModel: true, promptStyle: "positional", baseArgs: ["agent"], workspaceFlag: "--workspace" },
|
|
70
|
+
openclaw: { cli: "openclaw", workspaceFlag: undefined, supportsModel: false, promptStyle: "flag", baseArgs: [] },
|
|
70
71
|
opencode: { cli: "opencode", supportsModel: true, promptStyle: "positional", baseArgs: ["run"] },
|
|
71
72
|
};
|
|
72
73
|
const PROGRAMMATIC_ONLY_HARNESSES = ["internal"];
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OpenClaw harness adapter.
|
|
3
|
+
*
|
|
4
|
+
* Centralizes all OpenClaw-specific behaviors:
|
|
5
|
+
* - Session ID resolution (BABYSITTER_SESSION_ID, OPENCLAW_SHELL context)
|
|
6
|
+
* - State directory conventions (global state dir by default)
|
|
7
|
+
* - Session binding (run:create -> state file with run association)
|
|
8
|
+
* - No stop hook (OpenClaw is a daemon with no stop-hook model)
|
|
9
|
+
* - Session-start hook handler (baseline state file + skill discovery context)
|
|
10
|
+
*
|
|
11
|
+
* OpenClaw characteristics:
|
|
12
|
+
* - Daemon/gateway model, CLI command: `openclaw`
|
|
13
|
+
* - Env vars: OPENCLAW_SHELL, OPENCLAW_HOME
|
|
14
|
+
* - Sessions use composite keys: `agent:<agentId>:<channel>:<type>:<id>`
|
|
15
|
+
* - NO stop-hook model — hooks are registered programmatically
|
|
16
|
+
* - Capabilities: SessionBinding, Mcp, HeadlessPrompt (NOT StopHook, NOT Programmatic)
|
|
17
|
+
*/
|
|
18
|
+
import type { HarnessAdapter } from "./types";
|
|
19
|
+
export declare function createOpenClawAdapter(): HarnessAdapter;
|
|
20
|
+
//# sourceMappingURL=openclaw.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"openclaw.d.ts","sourceRoot":"","sources":["../../src/harness/openclaw.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAaH,OAAO,KAAK,EACV,cAAc,EAMf,MAAM,SAAS,CAAC;AAwPjB,wBAAgB,qBAAqB,IAAI,cAAc,CAgItD"}
|