bopodev-agent-sdk 0.1.29 → 0.1.30
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/.turbo/turbo-build.log +1 -1
- package/.turbo/turbo-lint.log +1 -1
- package/.turbo/turbo-typecheck.log +1 -1
- package/dist/adapters/codex/src/server/quota.d.ts +2 -0
- package/dist/adapters/openclaw-gateway/src/cli/format-event.d.ts +1 -0
- package/dist/adapters/openclaw-gateway/src/cli/index.d.ts +1 -0
- package/dist/adapters/openclaw-gateway/src/index.d.ts +7 -0
- package/dist/adapters/openclaw-gateway/src/server/device-auth.d.ts +25 -0
- package/dist/adapters/openclaw-gateway/src/server/execute.d.ts +2 -0
- package/dist/adapters/openclaw-gateway/src/server/gateway-client.d.ts +56 -0
- package/dist/adapters/openclaw-gateway/src/server/index.d.ts +2 -0
- package/dist/adapters/openclaw-gateway/src/server/parse.d.ts +22 -0
- package/dist/adapters/openclaw-gateway/src/server/test.d.ts +2 -0
- package/dist/adapters/openclaw-gateway/src/ui/build-config.d.ts +3 -0
- package/dist/adapters/openclaw-gateway/src/ui/index.d.ts +2 -0
- package/dist/adapters/openclaw-gateway/src/ui/parse-stdout.d.ts +6 -0
- package/dist/adapters/opencode/src/index.d.ts +5 -1
- package/dist/agent-sdk/src/quota.d.ts +4 -0
- package/dist/agent-sdk/src/types.d.ts +9 -0
- package/dist/contracts/src/index.d.ts +38 -0
- package/package.json +2 -2
- package/src/adapters.ts +53 -5
- package/src/registry.ts +19 -4
- package/src/types.ts +9 -0
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
2
|
|
|
3
|
-
> bopodev-agent-sdk@0.1.
|
|
3
|
+
> bopodev-agent-sdk@0.1.30 build /Users/danielkrusenstrahle/Documents/Projects/Monorepo/bopohq/packages/agent-sdk
|
|
4
4
|
> tsc -p tsconfig.json --emitDeclarationOnly
|
|
5
5
|
|
package/.turbo/turbo-lint.log
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
|
|
2
|
-
> bopodev-agent-sdk@0.1.
|
|
2
|
+
> bopodev-agent-sdk@0.1.29 typecheck /Users/danielkrusenstrahle/Documents/Projects/Monorepo/bopohq/packages/agent-sdk
|
|
3
3
|
> tsc -p tsconfig.json --noEmit
|
|
4
4
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function formatStdoutEvent(line: string, debug: boolean): void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { formatStdoutEvent } from "./format-event";
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { AdapterMetadata, AdapterModule } from "../../../agent-sdk/src/types";
|
|
2
|
+
export declare const type: "openclaw_gateway";
|
|
3
|
+
export declare const label = "OpenClaw Gateway";
|
|
4
|
+
export declare const models: readonly [];
|
|
5
|
+
export declare const agentConfigurationDoc = "Use when:\n- You run a self-hosted [OpenClaw](https://docs.openclaw.ai/) gateway and want Bopo heartbeats to invoke `agent` / `agent.wait` over the documented WebSocket protocol.\n\nConfigure:\n- **Command**: WebSocket URL (e.g. `ws://127.0.0.1:18789`). Alternatively set `OPENCLAW_GATEWAY_URL` in runtime environment.\n- **Runtime environment**: `OPENCLAW_GATEWAY_TOKEN` or `OPENCLAW_GATEWAY_PASSWORD` (required). Optional: `OPENCLAW_AGENT_ID`, `OPENCLAW_SESSION_KEY`, `OPENCLAW_SESSION_KEY_STRATEGY` (`issue` | `run` | `fixed`), `OPENCLAW_AGENT_WAIT_MS`, `OPENCLAW_DEVICE_PRIVATE_KEY_PEM` (stable device identity), `BOPO_OPENCLAW_DISABLE_DEVICE_AUTH=1` only if your gateway explicitly allows insecure mode.\n\nDo not use when:\n- You need a local CLI subprocess adapter \u2014 use Codex, Claude Code, or OpenCode instead.";
|
|
6
|
+
export declare const metadata: AdapterMetadata;
|
|
7
|
+
export declare const openclawGatewayAdapterModule: AdapterModule;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export declare function publicKeyRawBase64UrlFromPem(publicKeyPem: string): string;
|
|
2
|
+
export declare function signDevicePayload(privateKeyPem: string, payload: string): string;
|
|
3
|
+
export type OpenClawDeviceIdentity = {
|
|
4
|
+
deviceId: string;
|
|
5
|
+
publicKeyPem: string;
|
|
6
|
+
privateKeyPem: string;
|
|
7
|
+
};
|
|
8
|
+
export declare function generateEphemeralDeviceIdentity(): OpenClawDeviceIdentity;
|
|
9
|
+
export declare function loadDeviceIdentityFromPrivateKeyPem(privateKeyPem: string): OpenClawDeviceIdentity;
|
|
10
|
+
/**
|
|
11
|
+
* OpenClaw gateway device signing payload (v3), compatible with gateway verification.
|
|
12
|
+
* @see https://docs.openclaw.ai/gateway/protocol
|
|
13
|
+
*/
|
|
14
|
+
export declare function buildOpenClawDeviceAuthPayloadV3(params: {
|
|
15
|
+
deviceId: string;
|
|
16
|
+
clientId: string;
|
|
17
|
+
clientMode: string;
|
|
18
|
+
role: string;
|
|
19
|
+
scopes: string[];
|
|
20
|
+
signedAtMs: number;
|
|
21
|
+
token?: string | null;
|
|
22
|
+
nonce: string;
|
|
23
|
+
platform?: string | null;
|
|
24
|
+
deviceFamily?: string | null;
|
|
25
|
+
}): string;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { type ParsedOpenClawSessionUsage } from "./parse";
|
|
2
|
+
export declare class GatewayResponseError extends Error {
|
|
3
|
+
readonly gatewayCode?: string;
|
|
4
|
+
readonly gatewayDetails?: unknown;
|
|
5
|
+
constructor(message: string, gatewayCode?: string, gatewayDetails?: unknown);
|
|
6
|
+
}
|
|
7
|
+
export type OpenClawGatewayRunOptions = {
|
|
8
|
+
gatewayUrl: string;
|
|
9
|
+
token?: string | null;
|
|
10
|
+
password?: string | null;
|
|
11
|
+
devicePrivateKeyPem?: string | null;
|
|
12
|
+
/** When true, omit `device` on `connect` (gateway must allow disabled device auth). */
|
|
13
|
+
disableDeviceAuth?: boolean;
|
|
14
|
+
agentId?: string | null;
|
|
15
|
+
/** For `sessionKeyStrategy: "fixed"` — OpenClaw session key string. */
|
|
16
|
+
openclawSessionKey?: string | null;
|
|
17
|
+
sessionKeyStrategy?: "issue" | "run" | "fixed";
|
|
18
|
+
primaryIssueId?: string | null;
|
|
19
|
+
/** OpenClaw `agent.timeout` (seconds). */
|
|
20
|
+
agentTimeoutSec?: number | null;
|
|
21
|
+
model?: string | null;
|
|
22
|
+
message: string;
|
|
23
|
+
idempotencyKey: string;
|
|
24
|
+
connectTimeoutMs: number;
|
|
25
|
+
agentWaitTimeoutMs: number;
|
|
26
|
+
onStdoutLine: (line: string) => void;
|
|
27
|
+
onTranscriptEvent?: (event: {
|
|
28
|
+
kind: "system" | "assistant" | "thinking" | "tool_call" | "tool_result" | "result" | "stderr";
|
|
29
|
+
label?: string;
|
|
30
|
+
text?: string;
|
|
31
|
+
payload?: string;
|
|
32
|
+
signalLevel?: "high" | "medium" | "low" | "noise";
|
|
33
|
+
groupKey?: string;
|
|
34
|
+
source?: "stdout" | "stderr";
|
|
35
|
+
}) => void;
|
|
36
|
+
abortSignal?: AbortSignal;
|
|
37
|
+
};
|
|
38
|
+
export type OpenClawGatewayRunResult = {
|
|
39
|
+
ok: boolean;
|
|
40
|
+
summary: string;
|
|
41
|
+
runId?: string;
|
|
42
|
+
timedOut?: boolean;
|
|
43
|
+
errorMessage?: string;
|
|
44
|
+
tokenInput: number;
|
|
45
|
+
tokenOutput: number;
|
|
46
|
+
/** Cache / context read tokens when reported by `sessions.usage`. */
|
|
47
|
+
cachedInputTokens: number;
|
|
48
|
+
usdCost: number;
|
|
49
|
+
model?: string | null;
|
|
50
|
+
/** Resolved OpenClaw runtime model provider (e.g. anthropic), when available. */
|
|
51
|
+
openclawModelProvider?: string | null;
|
|
52
|
+
provider?: string | null;
|
|
53
|
+
/** Where token/model/cost metadata came from, for traces. */
|
|
54
|
+
openclawUsageSource?: ParsedOpenClawSessionUsage["source"] | "none";
|
|
55
|
+
};
|
|
56
|
+
export declare function runOpenClawGatewayTurn(options: OpenClawGatewayRunOptions): Promise<OpenClawGatewayRunResult>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Parse OpenClaw gateway JSON payloads for session usage (tokens, model, cost).
|
|
3
|
+
* Shapes follow `sessions.list` / `sessions.usage` responses on the gateway WebSocket API.
|
|
4
|
+
*/
|
|
5
|
+
export type ParsedOpenClawSessionUsage = {
|
|
6
|
+
tokenInput: number;
|
|
7
|
+
tokenOutput: number;
|
|
8
|
+
cachedInputTokens: number;
|
|
9
|
+
usdCost: number;
|
|
10
|
+
model: string | null;
|
|
11
|
+
modelProvider: string | null;
|
|
12
|
+
source: "sessions.list" | "sessions.usage";
|
|
13
|
+
};
|
|
14
|
+
/** Match `GatewaySessionRow` from OpenClaw `sessions.list` (search + exact key). */
|
|
15
|
+
export declare function extractUsageFromSessionsList(payload: unknown, exactSessionKey: string): ParsedOpenClawSessionUsage | null;
|
|
16
|
+
/** Match `SessionUsageEntry` from OpenClaw `sessions.usage` when `key` is scoped. */
|
|
17
|
+
export declare function extractUsageFromSessionsUsage(payload: unknown, exactSessionKey: string): ParsedOpenClawSessionUsage | null;
|
|
18
|
+
/**
|
|
19
|
+
* Map OpenClaw session `modelProvider` strings to Bopo `pricingProviderType` when catalog pricing should apply.
|
|
20
|
+
* Returns `null` when unknown so heartbeat cost logic falls back to gateway-reported USD or `openclaw_gateway` defaults.
|
|
21
|
+
*/
|
|
22
|
+
export declare function mapOpenClawModelProviderToBopoPricingType(openclawProvider: string | null | undefined): string | null;
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import type { AdapterMetadata, AdapterModule } from "../../../agent-sdk/src/types";
|
|
2
2
|
export declare const type: "opencode";
|
|
3
3
|
export declare const label = "OpenCode";
|
|
4
|
-
|
|
4
|
+
/** Shown when `opencode models` is empty (e.g. CLI missing on the API host). Discovery merges on top of this. */
|
|
5
|
+
export declare const models: readonly [{
|
|
6
|
+
readonly id: "opencode/big-pickle";
|
|
7
|
+
readonly label: "Big Pickle";
|
|
8
|
+
}];
|
|
5
9
|
export declare const agentConfigurationDoc = "Use when:\n- You need OpenCode CLI execution with provider/model selection.\n- You want OpenCode session reuse.\n\nDo not use when:\n- No runtime model is configured.\n- The host cannot run OpenCode CLI.";
|
|
6
10
|
export declare const metadata: AdapterMetadata;
|
|
7
11
|
export declare const opencodeAdapterModule: AdapterModule;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { AgentProviderType, AdapterQuotaProbeResult, AgentRuntimeConfig } from "./types";
|
|
2
|
+
export declare function createUnsupportedQuotaProbeResult(providerType: AgentProviderType, message: string): AdapterQuotaProbeResult;
|
|
3
|
+
export declare function createAuthRequiredQuotaProbeResult(providerType: AgentProviderType, message: string): AdapterQuotaProbeResult;
|
|
4
|
+
export declare function resolveMergedEnv(runtime?: AgentRuntimeConfig): NodeJS.ProcessEnv;
|
|
@@ -79,6 +79,15 @@ export interface HeartbeatContext {
|
|
|
79
79
|
commentBody?: string | null;
|
|
80
80
|
issueIds?: string[];
|
|
81
81
|
};
|
|
82
|
+
/** Company agents (non-terminated), sorted by name; used for delegation and task routing hints. */
|
|
83
|
+
teamRoster?: Array<{
|
|
84
|
+
id: string;
|
|
85
|
+
name: string;
|
|
86
|
+
role: string;
|
|
87
|
+
title?: string | null;
|
|
88
|
+
capabilities?: string | null;
|
|
89
|
+
status: string;
|
|
90
|
+
}>;
|
|
82
91
|
}
|
|
83
92
|
/**
|
|
84
93
|
* Normalized usage contract produced by adapter execution.
|
|
@@ -405,6 +405,7 @@ export declare const TemplateManifestAgentSchema: z.ZodObject<{
|
|
|
405
405
|
general: "general";
|
|
406
406
|
}>>;
|
|
407
407
|
title: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
408
|
+
capabilities: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
408
409
|
name: z.ZodString;
|
|
409
410
|
providerType: z.ZodDefault<z.ZodLazy<z.ZodEnum<{
|
|
410
411
|
claude_code: "claude_code";
|
|
@@ -414,6 +415,7 @@ export declare const TemplateManifestAgentSchema: z.ZodObject<{
|
|
|
414
415
|
gemini_cli: "gemini_cli";
|
|
415
416
|
openai_api: "openai_api";
|
|
416
417
|
anthropic_api: "anthropic_api";
|
|
418
|
+
openclaw_gateway: "openclaw_gateway";
|
|
417
419
|
http: "http";
|
|
418
420
|
shell: "shell";
|
|
419
421
|
}>>>;
|
|
@@ -532,6 +534,7 @@ export declare const TemplateManifestSchema: z.ZodObject<{
|
|
|
532
534
|
general: "general";
|
|
533
535
|
}>>;
|
|
534
536
|
title: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
537
|
+
capabilities: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
535
538
|
name: z.ZodString;
|
|
536
539
|
providerType: z.ZodDefault<z.ZodLazy<z.ZodEnum<{
|
|
537
540
|
claude_code: "claude_code";
|
|
@@ -541,6 +544,7 @@ export declare const TemplateManifestSchema: z.ZodObject<{
|
|
|
541
544
|
gemini_cli: "gemini_cli";
|
|
542
545
|
openai_api: "openai_api";
|
|
543
546
|
anthropic_api: "anthropic_api";
|
|
547
|
+
openclaw_gateway: "openclaw_gateway";
|
|
544
548
|
http: "http";
|
|
545
549
|
shell: "shell";
|
|
546
550
|
}>>>;
|
|
@@ -692,6 +696,7 @@ export declare const TemplateSchema: z.ZodObject<{
|
|
|
692
696
|
general: "general";
|
|
693
697
|
}>>;
|
|
694
698
|
title: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
699
|
+
capabilities: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
695
700
|
name: z.ZodString;
|
|
696
701
|
providerType: z.ZodDefault<z.ZodLazy<z.ZodEnum<{
|
|
697
702
|
claude_code: "claude_code";
|
|
@@ -701,6 +706,7 @@ export declare const TemplateSchema: z.ZodObject<{
|
|
|
701
706
|
gemini_cli: "gemini_cli";
|
|
702
707
|
openai_api: "openai_api";
|
|
703
708
|
anthropic_api: "anthropic_api";
|
|
709
|
+
openclaw_gateway: "openclaw_gateway";
|
|
704
710
|
http: "http";
|
|
705
711
|
shell: "shell";
|
|
706
712
|
}>>>;
|
|
@@ -852,6 +858,7 @@ export declare const TemplateCreateRequestSchema: z.ZodObject<{
|
|
|
852
858
|
general: "general";
|
|
853
859
|
}>>;
|
|
854
860
|
title: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
861
|
+
capabilities: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
855
862
|
name: z.ZodString;
|
|
856
863
|
providerType: z.ZodDefault<z.ZodLazy<z.ZodEnum<{
|
|
857
864
|
claude_code: "claude_code";
|
|
@@ -861,6 +868,7 @@ export declare const TemplateCreateRequestSchema: z.ZodObject<{
|
|
|
861
868
|
gemini_cli: "gemini_cli";
|
|
862
869
|
openai_api: "openai_api";
|
|
863
870
|
anthropic_api: "anthropic_api";
|
|
871
|
+
openclaw_gateway: "openclaw_gateway";
|
|
864
872
|
http: "http";
|
|
865
873
|
shell: "shell";
|
|
866
874
|
}>>>;
|
|
@@ -1010,6 +1018,7 @@ export declare const TemplateUpdateRequestSchema: z.ZodObject<{
|
|
|
1010
1018
|
general: "general";
|
|
1011
1019
|
}>>;
|
|
1012
1020
|
title: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1021
|
+
capabilities: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1013
1022
|
name: z.ZodString;
|
|
1014
1023
|
providerType: z.ZodDefault<z.ZodLazy<z.ZodEnum<{
|
|
1015
1024
|
claude_code: "claude_code";
|
|
@@ -1019,6 +1028,7 @@ export declare const TemplateUpdateRequestSchema: z.ZodObject<{
|
|
|
1019
1028
|
gemini_cli: "gemini_cli";
|
|
1020
1029
|
openai_api: "openai_api";
|
|
1021
1030
|
anthropic_api: "anthropic_api";
|
|
1031
|
+
openclaw_gateway: "openclaw_gateway";
|
|
1022
1032
|
http: "http";
|
|
1023
1033
|
shell: "shell";
|
|
1024
1034
|
}>>>;
|
|
@@ -1219,6 +1229,7 @@ export declare const TemplateExportSchema: z.ZodObject<{
|
|
|
1219
1229
|
general: "general";
|
|
1220
1230
|
}>>;
|
|
1221
1231
|
title: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1232
|
+
capabilities: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1222
1233
|
name: z.ZodString;
|
|
1223
1234
|
providerType: z.ZodDefault<z.ZodLazy<z.ZodEnum<{
|
|
1224
1235
|
claude_code: "claude_code";
|
|
@@ -1228,6 +1239,7 @@ export declare const TemplateExportSchema: z.ZodObject<{
|
|
|
1228
1239
|
gemini_cli: "gemini_cli";
|
|
1229
1240
|
openai_api: "openai_api";
|
|
1230
1241
|
anthropic_api: "anthropic_api";
|
|
1242
|
+
openclaw_gateway: "openclaw_gateway";
|
|
1231
1243
|
http: "http";
|
|
1232
1244
|
shell: "shell";
|
|
1233
1245
|
}>>>;
|
|
@@ -1381,6 +1393,7 @@ export declare const TemplateImportRequestSchema: z.ZodObject<{
|
|
|
1381
1393
|
general: "general";
|
|
1382
1394
|
}>>;
|
|
1383
1395
|
title: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1396
|
+
capabilities: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1384
1397
|
name: z.ZodString;
|
|
1385
1398
|
providerType: z.ZodDefault<z.ZodLazy<z.ZodEnum<{
|
|
1386
1399
|
claude_code: "claude_code";
|
|
@@ -1390,6 +1403,7 @@ export declare const TemplateImportRequestSchema: z.ZodObject<{
|
|
|
1390
1403
|
gemini_cli: "gemini_cli";
|
|
1391
1404
|
openai_api: "openai_api";
|
|
1392
1405
|
anthropic_api: "anthropic_api";
|
|
1406
|
+
openclaw_gateway: "openclaw_gateway";
|
|
1393
1407
|
http: "http";
|
|
1394
1408
|
shell: "shell";
|
|
1395
1409
|
}>>>;
|
|
@@ -1520,6 +1534,7 @@ export declare const TemplateVersionSchema: z.ZodObject<{
|
|
|
1520
1534
|
general: "general";
|
|
1521
1535
|
}>>;
|
|
1522
1536
|
title: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1537
|
+
capabilities: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1523
1538
|
name: z.ZodString;
|
|
1524
1539
|
providerType: z.ZodDefault<z.ZodLazy<z.ZodEnum<{
|
|
1525
1540
|
claude_code: "claude_code";
|
|
@@ -1529,6 +1544,7 @@ export declare const TemplateVersionSchema: z.ZodObject<{
|
|
|
1529
1544
|
gemini_cli: "gemini_cli";
|
|
1530
1545
|
openai_api: "openai_api";
|
|
1531
1546
|
anthropic_api: "anthropic_api";
|
|
1547
|
+
openclaw_gateway: "openclaw_gateway";
|
|
1532
1548
|
http: "http";
|
|
1533
1549
|
shell: "shell";
|
|
1534
1550
|
}>>>;
|
|
@@ -1634,6 +1650,7 @@ export declare const ProviderTypeSchema: z.ZodEnum<{
|
|
|
1634
1650
|
gemini_cli: "gemini_cli";
|
|
1635
1651
|
openai_api: "openai_api";
|
|
1636
1652
|
anthropic_api: "anthropic_api";
|
|
1653
|
+
openclaw_gateway: "openclaw_gateway";
|
|
1637
1654
|
http: "http";
|
|
1638
1655
|
shell: "shell";
|
|
1639
1656
|
}>;
|
|
@@ -1832,6 +1849,7 @@ export declare const RunManagerReportSchema: z.ZodObject<{
|
|
|
1832
1849
|
gemini_cli: "gemini_cli";
|
|
1833
1850
|
openai_api: "openai_api";
|
|
1834
1851
|
anthropic_api: "anthropic_api";
|
|
1852
|
+
openclaw_gateway: "openclaw_gateway";
|
|
1835
1853
|
http: "http";
|
|
1836
1854
|
shell: "shell";
|
|
1837
1855
|
}>;
|
|
@@ -1909,6 +1927,7 @@ export declare const RunCompletionReportSchema: z.ZodObject<{
|
|
|
1909
1927
|
gemini_cli: "gemini_cli";
|
|
1910
1928
|
openai_api: "openai_api";
|
|
1911
1929
|
anthropic_api: "anthropic_api";
|
|
1930
|
+
openclaw_gateway: "openclaw_gateway";
|
|
1912
1931
|
http: "http";
|
|
1913
1932
|
shell: "shell";
|
|
1914
1933
|
}>;
|
|
@@ -2165,6 +2184,7 @@ export declare const AgentCreateRequestSchema: z.ZodObject<{
|
|
|
2165
2184
|
general: "general";
|
|
2166
2185
|
}>>;
|
|
2167
2186
|
title: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
2187
|
+
capabilities: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
2168
2188
|
name: z.ZodString;
|
|
2169
2189
|
providerType: z.ZodEnum<{
|
|
2170
2190
|
claude_code: "claude_code";
|
|
@@ -2174,6 +2194,7 @@ export declare const AgentCreateRequestSchema: z.ZodObject<{
|
|
|
2174
2194
|
gemini_cli: "gemini_cli";
|
|
2175
2195
|
openai_api: "openai_api";
|
|
2176
2196
|
anthropic_api: "anthropic_api";
|
|
2197
|
+
openclaw_gateway: "openclaw_gateway";
|
|
2177
2198
|
http: "http";
|
|
2178
2199
|
shell: "shell";
|
|
2179
2200
|
}>;
|
|
@@ -2209,10 +2230,12 @@ export declare const AgentCreateRequestSchema: z.ZodObject<{
|
|
|
2209
2230
|
gemini_cli: "gemini_cli";
|
|
2210
2231
|
openai_api: "openai_api";
|
|
2211
2232
|
anthropic_api: "anthropic_api";
|
|
2233
|
+
openclaw_gateway: "openclaw_gateway";
|
|
2212
2234
|
http: "http";
|
|
2213
2235
|
shell: "shell";
|
|
2214
2236
|
}>>>;
|
|
2215
2237
|
requestedRuntimeModel: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
2238
|
+
requestedCapabilities: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
2216
2239
|
}, z.core.$strip>>;
|
|
2217
2240
|
requestApproval: z.ZodDefault<z.ZodBoolean>;
|
|
2218
2241
|
runtimeConfig: z.ZodDefault<z.ZodObject<{
|
|
@@ -2257,6 +2280,7 @@ export declare const AgentUpdateRequestSchema: z.ZodObject<{
|
|
|
2257
2280
|
general: "general";
|
|
2258
2281
|
}>>>;
|
|
2259
2282
|
title: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
2283
|
+
capabilities: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
2260
2284
|
name: z.ZodOptional<z.ZodString>;
|
|
2261
2285
|
providerType: z.ZodOptional<z.ZodEnum<{
|
|
2262
2286
|
claude_code: "claude_code";
|
|
@@ -2266,6 +2290,7 @@ export declare const AgentUpdateRequestSchema: z.ZodObject<{
|
|
|
2266
2290
|
gemini_cli: "gemini_cli";
|
|
2267
2291
|
openai_api: "openai_api";
|
|
2268
2292
|
anthropic_api: "anthropic_api";
|
|
2293
|
+
openclaw_gateway: "openclaw_gateway";
|
|
2269
2294
|
http: "http";
|
|
2270
2295
|
shell: "shell";
|
|
2271
2296
|
}>>;
|
|
@@ -2322,6 +2347,7 @@ export declare const AgentSchema: z.ZodObject<{
|
|
|
2322
2347
|
general: "general";
|
|
2323
2348
|
}>>>;
|
|
2324
2349
|
title: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
2350
|
+
capabilities: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
2325
2351
|
name: z.ZodString;
|
|
2326
2352
|
providerType: z.ZodEnum<{
|
|
2327
2353
|
claude_code: "claude_code";
|
|
@@ -2331,6 +2357,7 @@ export declare const AgentSchema: z.ZodObject<{
|
|
|
2331
2357
|
gemini_cli: "gemini_cli";
|
|
2332
2358
|
openai_api: "openai_api";
|
|
2333
2359
|
anthropic_api: "anthropic_api";
|
|
2360
|
+
openclaw_gateway: "openclaw_gateway";
|
|
2334
2361
|
http: "http";
|
|
2335
2362
|
shell: "shell";
|
|
2336
2363
|
}>;
|
|
@@ -2828,6 +2855,7 @@ export declare const OfficeOccupantSchema: z.ZodObject<{
|
|
|
2828
2855
|
gemini_cli: "gemini_cli";
|
|
2829
2856
|
openai_api: "openai_api";
|
|
2830
2857
|
anthropic_api: "anthropic_api";
|
|
2858
|
+
openclaw_gateway: "openclaw_gateway";
|
|
2831
2859
|
http: "http";
|
|
2832
2860
|
shell: "shell";
|
|
2833
2861
|
}>>;
|
|
@@ -2875,6 +2903,7 @@ export declare const OfficeSpaceEventSchema: z.ZodDiscriminatedUnion<[z.ZodObjec
|
|
|
2875
2903
|
gemini_cli: "gemini_cli";
|
|
2876
2904
|
openai_api: "openai_api";
|
|
2877
2905
|
anthropic_api: "anthropic_api";
|
|
2906
|
+
openclaw_gateway: "openclaw_gateway";
|
|
2878
2907
|
http: "http";
|
|
2879
2908
|
shell: "shell";
|
|
2880
2909
|
}>>;
|
|
@@ -2921,6 +2950,7 @@ export declare const OfficeSpaceEventSchema: z.ZodDiscriminatedUnion<[z.ZodObjec
|
|
|
2921
2950
|
gemini_cli: "gemini_cli";
|
|
2922
2951
|
openai_api: "openai_api";
|
|
2923
2952
|
anthropic_api: "anthropic_api";
|
|
2953
|
+
openclaw_gateway: "openclaw_gateway";
|
|
2924
2954
|
http: "http";
|
|
2925
2955
|
shell: "shell";
|
|
2926
2956
|
}>>;
|
|
@@ -3214,6 +3244,7 @@ export declare const RealtimeEventEnvelopeSchema: z.ZodDiscriminatedUnion<[z.Zod
|
|
|
3214
3244
|
gemini_cli: "gemini_cli";
|
|
3215
3245
|
openai_api: "openai_api";
|
|
3216
3246
|
anthropic_api: "anthropic_api";
|
|
3247
|
+
openclaw_gateway: "openclaw_gateway";
|
|
3217
3248
|
http: "http";
|
|
3218
3249
|
shell: "shell";
|
|
3219
3250
|
}>>;
|
|
@@ -3260,6 +3291,7 @@ export declare const RealtimeEventEnvelopeSchema: z.ZodDiscriminatedUnion<[z.Zod
|
|
|
3260
3291
|
gemini_cli: "gemini_cli";
|
|
3261
3292
|
openai_api: "openai_api";
|
|
3262
3293
|
anthropic_api: "anthropic_api";
|
|
3294
|
+
openclaw_gateway: "openclaw_gateway";
|
|
3263
3295
|
http: "http";
|
|
3264
3296
|
shell: "shell";
|
|
3265
3297
|
}>>;
|
|
@@ -3641,6 +3673,7 @@ export declare const RealtimeEventMessageSchema: z.ZodDiscriminatedUnion<[z.ZodO
|
|
|
3641
3673
|
gemini_cli: "gemini_cli";
|
|
3642
3674
|
openai_api: "openai_api";
|
|
3643
3675
|
anthropic_api: "anthropic_api";
|
|
3676
|
+
openclaw_gateway: "openclaw_gateway";
|
|
3644
3677
|
http: "http";
|
|
3645
3678
|
shell: "shell";
|
|
3646
3679
|
}>>;
|
|
@@ -3687,6 +3720,7 @@ export declare const RealtimeEventMessageSchema: z.ZodDiscriminatedUnion<[z.ZodO
|
|
|
3687
3720
|
gemini_cli: "gemini_cli";
|
|
3688
3721
|
openai_api: "openai_api";
|
|
3689
3722
|
anthropic_api: "anthropic_api";
|
|
3723
|
+
openclaw_gateway: "openclaw_gateway";
|
|
3690
3724
|
http: "http";
|
|
3691
3725
|
shell: "shell";
|
|
3692
3726
|
}>>;
|
|
@@ -4070,6 +4104,7 @@ export declare const RealtimeMessageSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
|
4070
4104
|
gemini_cli: "gemini_cli";
|
|
4071
4105
|
openai_api: "openai_api";
|
|
4072
4106
|
anthropic_api: "anthropic_api";
|
|
4107
|
+
openclaw_gateway: "openclaw_gateway";
|
|
4073
4108
|
http: "http";
|
|
4074
4109
|
shell: "shell";
|
|
4075
4110
|
}>>;
|
|
@@ -4116,6 +4151,7 @@ export declare const RealtimeMessageSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
|
4116
4151
|
gemini_cli: "gemini_cli";
|
|
4117
4152
|
openai_api: "openai_api";
|
|
4118
4153
|
anthropic_api: "anthropic_api";
|
|
4154
|
+
openclaw_gateway: "openclaw_gateway";
|
|
4119
4155
|
http: "http";
|
|
4120
4156
|
shell: "shell";
|
|
4121
4157
|
}>>;
|
|
@@ -4386,6 +4422,7 @@ export declare const CostLedgerEntrySchema: z.ZodObject<{
|
|
|
4386
4422
|
gemini_cli: "gemini_cli";
|
|
4387
4423
|
openai_api: "openai_api";
|
|
4388
4424
|
anthropic_api: "anthropic_api";
|
|
4425
|
+
openclaw_gateway: "openclaw_gateway";
|
|
4389
4426
|
http: "http";
|
|
4390
4427
|
shell: "shell";
|
|
4391
4428
|
}>;
|
|
@@ -4668,6 +4705,7 @@ export declare const HeartbeatRunDetailSchema: z.ZodObject<{
|
|
|
4668
4705
|
gemini_cli: "gemini_cli";
|
|
4669
4706
|
openai_api: "openai_api";
|
|
4670
4707
|
anthropic_api: "anthropic_api";
|
|
4708
|
+
openclaw_gateway: "openclaw_gateway";
|
|
4671
4709
|
http: "http";
|
|
4672
4710
|
shell: "shell";
|
|
4673
4711
|
}>;
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bopodev-agent-sdk",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.30",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/index.ts",
|
|
7
7
|
"types": "src/index.ts",
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"bopodev-contracts": "0.1.
|
|
9
|
+
"bopodev-contracts": "0.1.30"
|
|
10
10
|
},
|
|
11
11
|
"scripts": {
|
|
12
12
|
"build": "tsc -p tsconfig.json --emitDeclarationOnly",
|
package/src/adapters.ts
CHANGED
|
@@ -686,6 +686,15 @@ const staticMetadata: AdapterMetadata[] = [
|
|
|
686
686
|
supportsThinkingEffort: false,
|
|
687
687
|
requiresRuntimeCwd: false
|
|
688
688
|
},
|
|
689
|
+
{
|
|
690
|
+
providerType: "openclaw_gateway",
|
|
691
|
+
label: "OpenClaw Gateway",
|
|
692
|
+
supportsModelSelection: false,
|
|
693
|
+
supportsEnvironmentTest: true,
|
|
694
|
+
supportsWebSearch: false,
|
|
695
|
+
supportsThinkingEffort: false,
|
|
696
|
+
requiresRuntimeCwd: false
|
|
697
|
+
},
|
|
689
698
|
{
|
|
690
699
|
providerType: "http",
|
|
691
700
|
label: "HTTP",
|
|
@@ -708,7 +717,7 @@ const staticMetadata: AdapterMetadata[] = [
|
|
|
708
717
|
|
|
709
718
|
const metadataByProviderType = new Map(staticMetadata.map((entry) => [entry.providerType, entry] as const));
|
|
710
719
|
|
|
711
|
-
const modelCatalog: Record<Exclude<AgentProviderType, "http" | "shell">, AdapterModelOption[]> = {
|
|
720
|
+
const modelCatalog: Record<Exclude<AgentProviderType, "http" | "shell" | "openclaw_gateway">, AdapterModelOption[]> = {
|
|
712
721
|
codex: [
|
|
713
722
|
{ id: "gpt-5.3-codex", label: "GPT-5.3 Codex" },
|
|
714
723
|
{ id: "gpt-5.4", label: "GPT-5.4" },
|
|
@@ -771,7 +780,7 @@ export async function listAdapterModels(
|
|
|
771
780
|
providerType: AgentProviderType,
|
|
772
781
|
runtime?: AgentRuntimeConfig
|
|
773
782
|
): Promise<AdapterModelOption[]> {
|
|
774
|
-
if (providerType === "http" || providerType === "shell") {
|
|
783
|
+
if (providerType === "http" || providerType === "shell" || providerType === "openclaw_gateway") {
|
|
775
784
|
return [];
|
|
776
785
|
}
|
|
777
786
|
if (providerType === "cursor") {
|
|
@@ -900,7 +909,10 @@ export async function testAdapterEnvironment(
|
|
|
900
909
|
|
|
901
910
|
function detectProviderCommandMismatch(providerType: AgentProviderType, command: string) {
|
|
902
911
|
const normalized = basename(command).toLowerCase();
|
|
903
|
-
const known: Record<
|
|
912
|
+
const known: Record<
|
|
913
|
+
Exclude<AgentProviderType, "http" | "shell" | "openai_api" | "anthropic_api" | "openclaw_gateway">,
|
|
914
|
+
string[]
|
|
915
|
+
> = {
|
|
904
916
|
claude_code: ["claude", "claude.exe", "claude.cmd"],
|
|
905
917
|
codex: ["codex", "codex.exe", "codex.cmd"],
|
|
906
918
|
cursor: ["cursor", "cursor.exe", "cursor.cmd"],
|
|
@@ -2700,9 +2712,43 @@ function composeBootstrapPreamble(context: HeartbeatContext): string {
|
|
|
2700
2712
|
return operating ? `${operating}${user}\n\n` : `${user}\n\n`;
|
|
2701
2713
|
}
|
|
2702
2714
|
|
|
2715
|
+
function formatTeamRosterSection(context: HeartbeatContext): string {
|
|
2716
|
+
const roster = context.teamRoster;
|
|
2717
|
+
if (!roster?.length) {
|
|
2718
|
+
return "";
|
|
2719
|
+
}
|
|
2720
|
+
const mode = resolveHeartbeatPromptModeForPrompt(context);
|
|
2721
|
+
const isCompact = mode === "compact";
|
|
2722
|
+
const clipCapabilities = (raw: string | null | undefined) => {
|
|
2723
|
+
const t = raw?.trim();
|
|
2724
|
+
if (!t) {
|
|
2725
|
+
return null;
|
|
2726
|
+
}
|
|
2727
|
+
if (isCompact && t.length > 200) {
|
|
2728
|
+
return `${t.slice(0, 200)}…`;
|
|
2729
|
+
}
|
|
2730
|
+
return t;
|
|
2731
|
+
};
|
|
2732
|
+
const lines = roster.map((member) => {
|
|
2733
|
+
const caps = clipCapabilities(member.capabilities);
|
|
2734
|
+
const parts = [member.id, member.name, member.role];
|
|
2735
|
+
const titled = member.title?.trim();
|
|
2736
|
+
if (titled) {
|
|
2737
|
+
parts.push(`title: ${titled}`);
|
|
2738
|
+
}
|
|
2739
|
+
if (caps) {
|
|
2740
|
+
parts.push(`capabilities: ${caps}`);
|
|
2741
|
+
}
|
|
2742
|
+
const you = member.id === context.agentId ? " (you)" : "";
|
|
2743
|
+
return `- ${parts.join(" | ")}${you}`;
|
|
2744
|
+
});
|
|
2745
|
+
return ["Team roster (for delegation):", ...lines, ""].join("\n");
|
|
2746
|
+
}
|
|
2747
|
+
|
|
2703
2748
|
function buildIdleMicroPrompt(context: HeartbeatContext): string {
|
|
2704
2749
|
const preamble = composeBootstrapPreamble(context);
|
|
2705
|
-
|
|
2750
|
+
const rosterBlock = formatTeamRosterSection(context);
|
|
2751
|
+
return `${preamble}${rosterBlock}Idle heartbeat (micro prompt): agent ${context.agentId} (${context.agent.name}) has no assigned issues this run. Summarize readiness in \`employee_comment\`; leave \`results\` empty unless you completed verifiable work. Use \`BOPODEV_*\` for control-plane API calls when needed.
|
|
2706
2752
|
|
|
2707
2753
|
${HEARTBEAT_JSON_SCHEMA_FOOTER}
|
|
2708
2754
|
`;
|
|
@@ -2844,6 +2890,8 @@ export function createPrompt(context: HeartbeatContext) {
|
|
|
2844
2890
|
: "- BOPODEV_REQUEST_HEADERS_JSON is missing. Report this as blocker."
|
|
2845
2891
|
].join("\n");
|
|
2846
2892
|
|
|
2893
|
+
const teamRosterBlock = formatTeamRosterSection(context);
|
|
2894
|
+
|
|
2847
2895
|
const executionDirectives = [
|
|
2848
2896
|
"Execution directives:",
|
|
2849
2897
|
"- You are running inside a BopoDev heartbeat for local repository work.",
|
|
@@ -2885,7 +2933,7 @@ Company:
|
|
|
2885
2933
|
- Name: ${context.company.name}
|
|
2886
2934
|
- Mission: ${context.company.mission ?? "No mission set"}
|
|
2887
2935
|
|
|
2888
|
-
Goal context:
|
|
2936
|
+
${teamRosterBlock}Goal context:
|
|
2889
2937
|
Company goals:
|
|
2890
2938
|
${companyGoals}
|
|
2891
2939
|
Project goals:
|
package/src/registry.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { dedupeModels } from "./adapters";
|
|
1
2
|
import type {
|
|
2
3
|
AdapterEnvironmentResult,
|
|
3
4
|
AdapterMetadata,
|
|
@@ -16,6 +17,7 @@ import { openaiapiAdapterModule } from "../../adapters/openai-api/src";
|
|
|
16
17
|
import { anthropicapiAdapterModule } from "../../adapters/anthropic-api/src";
|
|
17
18
|
import { httpAdapterModule } from "../../adapters/http/src";
|
|
18
19
|
import { shellAdapterModule } from "../../adapters/shell/src";
|
|
20
|
+
import { openclawGatewayAdapterModule } from "../../adapters/openclaw-gateway/src";
|
|
19
21
|
|
|
20
22
|
const adapterModules: Record<AgentProviderType, AdapterModule> = {
|
|
21
23
|
claude_code: claudecodeAdapterModule,
|
|
@@ -25,6 +27,7 @@ const adapterModules: Record<AgentProviderType, AdapterModule> = {
|
|
|
25
27
|
gemini_cli: geminiCliAdapterModule,
|
|
26
28
|
openai_api: openaiapiAdapterModule,
|
|
27
29
|
anthropic_api: anthropicapiAdapterModule,
|
|
30
|
+
openclaw_gateway: openclawGatewayAdapterModule,
|
|
28
31
|
http: httpAdapterModule,
|
|
29
32
|
shell: shellAdapterModule
|
|
30
33
|
};
|
|
@@ -62,6 +65,10 @@ const adapters: Record<AgentProviderType, AgentAdapter> = {
|
|
|
62
65
|
providerType: "anthropic_api",
|
|
63
66
|
execute: (context) => adapterModules.anthropic_api.server.execute(context)
|
|
64
67
|
},
|
|
68
|
+
openclaw_gateway: {
|
|
69
|
+
providerType: "openclaw_gateway",
|
|
70
|
+
execute: (context) => adapterModules.openclaw_gateway.server.execute(context)
|
|
71
|
+
},
|
|
65
72
|
http: {
|
|
66
73
|
providerType: "http",
|
|
67
74
|
execute: (context) => adapterModules.http.server.execute(context)
|
|
@@ -80,11 +87,19 @@ export async function getAdapterModels(
|
|
|
80
87
|
providerType: AgentProviderType,
|
|
81
88
|
runtime?: AgentRuntimeConfig
|
|
82
89
|
): Promise<AdapterModelOption[]> {
|
|
83
|
-
const
|
|
84
|
-
|
|
85
|
-
|
|
90
|
+
const mod = adapterModules[providerType];
|
|
91
|
+
const staticModels: AdapterModelOption[] = mod.models ? [...mod.models] : [];
|
|
92
|
+
const listModels = mod.server.listModels;
|
|
93
|
+
if (!listModels) {
|
|
94
|
+
return staticModels;
|
|
95
|
+
}
|
|
96
|
+
const discovered = await listModels(runtime);
|
|
97
|
+
const disc = Array.isArray(discovered) ? discovered : [];
|
|
98
|
+
if (disc.length > 0) {
|
|
99
|
+
return dedupeModels([...disc, ...staticModels]);
|
|
86
100
|
}
|
|
87
|
-
|
|
101
|
+
// Empty discovery (CLI missing, auth, timeout): keep static catalog so UIs are not stuck on client-only allowlists.
|
|
102
|
+
return staticModels.length > 0 ? staticModels : disc;
|
|
88
103
|
}
|
|
89
104
|
|
|
90
105
|
export function getAdapterMetadata(): AdapterMetadata[] {
|
package/src/types.ts
CHANGED
|
@@ -85,6 +85,15 @@ export interface HeartbeatContext {
|
|
|
85
85
|
commentBody?: string | null;
|
|
86
86
|
issueIds?: string[];
|
|
87
87
|
};
|
|
88
|
+
/** Company agents (non-terminated), sorted by name; used for delegation and task routing hints. */
|
|
89
|
+
teamRoster?: Array<{
|
|
90
|
+
id: string;
|
|
91
|
+
name: string;
|
|
92
|
+
role: string;
|
|
93
|
+
title?: string | null;
|
|
94
|
+
capabilities?: string | null;
|
|
95
|
+
status: string;
|
|
96
|
+
}>;
|
|
88
97
|
}
|
|
89
98
|
|
|
90
99
|
/**
|