@agentex/agent 0.0.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 (102) hide show
  1. package/README.md +167 -0
  2. package/dist/index.d.ts +5 -0
  3. package/dist/index.d.ts.map +1 -0
  4. package/dist/index.js +5 -0
  5. package/dist/index.js.map +1 -0
  6. package/dist/providers/claude/codec.d.ts +3 -0
  7. package/dist/providers/claude/codec.d.ts.map +1 -0
  8. package/dist/providers/claude/codec.js +43 -0
  9. package/dist/providers/claude/codec.js.map +1 -0
  10. package/dist/providers/claude/execute.d.ts +3 -0
  11. package/dist/providers/claude/execute.d.ts.map +1 -0
  12. package/dist/providers/claude/execute.js +224 -0
  13. package/dist/providers/claude/execute.js.map +1 -0
  14. package/dist/providers/claude/index.d.ts +3 -0
  15. package/dist/providers/claude/index.d.ts.map +1 -0
  16. package/dist/providers/claude/index.js +47 -0
  17. package/dist/providers/claude/index.js.map +1 -0
  18. package/dist/providers/claude/parse.d.ts +21 -0
  19. package/dist/providers/claude/parse.d.ts.map +1 -0
  20. package/dist/providers/claude/parse.js +247 -0
  21. package/dist/providers/claude/parse.js.map +1 -0
  22. package/dist/providers/claude/test.d.ts +3 -0
  23. package/dist/providers/claude/test.d.ts.map +1 -0
  24. package/dist/providers/claude/test.js +140 -0
  25. package/dist/providers/claude/test.js.map +1 -0
  26. package/dist/providers/codex/codec.d.ts +3 -0
  27. package/dist/providers/codex/codec.d.ts.map +1 -0
  28. package/dist/providers/codex/codec.js +47 -0
  29. package/dist/providers/codex/codec.js.map +1 -0
  30. package/dist/providers/codex/execute.d.ts +3 -0
  31. package/dist/providers/codex/execute.d.ts.map +1 -0
  32. package/dist/providers/codex/execute.js +215 -0
  33. package/dist/providers/codex/execute.js.map +1 -0
  34. package/dist/providers/codex/index.d.ts +3 -0
  35. package/dist/providers/codex/index.d.ts.map +1 -0
  36. package/dist/providers/codex/index.js +10 -0
  37. package/dist/providers/codex/index.js.map +1 -0
  38. package/dist/providers/codex/parse.d.ts +20 -0
  39. package/dist/providers/codex/parse.d.ts.map +1 -0
  40. package/dist/providers/codex/parse.js +202 -0
  41. package/dist/providers/codex/parse.js.map +1 -0
  42. package/dist/providers/codex/test.d.ts +3 -0
  43. package/dist/providers/codex/test.d.ts.map +1 -0
  44. package/dist/providers/codex/test.js +58 -0
  45. package/dist/providers/codex/test.js.map +1 -0
  46. package/dist/providers/openclaw/codec.d.ts +3 -0
  47. package/dist/providers/openclaw/codec.d.ts.map +1 -0
  48. package/dist/providers/openclaw/codec.js +41 -0
  49. package/dist/providers/openclaw/codec.js.map +1 -0
  50. package/dist/providers/openclaw/execute.d.ts +3 -0
  51. package/dist/providers/openclaw/execute.d.ts.map +1 -0
  52. package/dist/providers/openclaw/execute.js +138 -0
  53. package/dist/providers/openclaw/execute.js.map +1 -0
  54. package/dist/providers/openclaw/index.d.ts +3 -0
  55. package/dist/providers/openclaw/index.d.ts.map +1 -0
  56. package/dist/providers/openclaw/index.js +10 -0
  57. package/dist/providers/openclaw/index.js.map +1 -0
  58. package/dist/providers/openclaw/test.d.ts +3 -0
  59. package/dist/providers/openclaw/test.d.ts.map +1 -0
  60. package/dist/providers/openclaw/test.js +50 -0
  61. package/dist/providers/openclaw/test.js.map +1 -0
  62. package/dist/providers/process/execute.d.ts +3 -0
  63. package/dist/providers/process/execute.d.ts.map +1 -0
  64. package/dist/providers/process/execute.js +105 -0
  65. package/dist/providers/process/execute.js.map +1 -0
  66. package/dist/providers/process/index.d.ts +3 -0
  67. package/dist/providers/process/index.d.ts.map +1 -0
  68. package/dist/providers/process/index.js +49 -0
  69. package/dist/providers/process/index.js.map +1 -0
  70. package/dist/registry.d.ts +5 -0
  71. package/dist/registry.d.ts.map +1 -0
  72. package/dist/registry.js +25 -0
  73. package/dist/registry.js.map +1 -0
  74. package/dist/types.d.ts +121 -0
  75. package/dist/types.d.ts.map +1 -0
  76. package/dist/types.js +2 -0
  77. package/dist/types.js.map +1 -0
  78. package/dist/utils/binary.d.ts +9 -0
  79. package/dist/utils/binary.d.ts.map +1 -0
  80. package/dist/utils/binary.js +137 -0
  81. package/dist/utils/binary.js.map +1 -0
  82. package/dist/utils/env.d.ts +4 -0
  83. package/dist/utils/env.d.ts.map +1 -0
  84. package/dist/utils/env.js +39 -0
  85. package/dist/utils/env.js.map +1 -0
  86. package/dist/utils/process.d.ts +23 -0
  87. package/dist/utils/process.d.ts.map +1 -0
  88. package/dist/utils/process.js +144 -0
  89. package/dist/utils/process.js.map +1 -0
  90. package/dist/utils/skills.d.ts +4 -0
  91. package/dist/utils/skills.d.ts.map +1 -0
  92. package/dist/utils/skills.js +33 -0
  93. package/dist/utils/skills.js.map +1 -0
  94. package/dist/utils/template.d.ts +3 -0
  95. package/dist/utils/template.d.ts.map +1 -0
  96. package/dist/utils/template.js +17 -0
  97. package/dist/utils/template.js.map +1 -0
  98. package/dist/utils/uuid.d.ts +2 -0
  99. package/dist/utils/uuid.d.ts.map +1 -0
  100. package/dist/utils/uuid.js +2 -0
  101. package/dist/utils/uuid.js.map +1 -0
  102. package/package.json +48 -0
@@ -0,0 +1,138 @@
1
+ import { uuidv7 } from "../../utils/uuid.js";
2
+ export async function executeOpenclawAdapter(ctx) {
3
+ const runId = ctx.runId ?? uuidv7();
4
+ const model = ctx.model ?? ctx.config?.model;
5
+ const config = ctx.config ?? {};
6
+ const startedAt = new Date().toISOString();
7
+ const startMs = Date.now();
8
+ const gatewayUrl = config.command?.trim() || "http://localhost:3001";
9
+ const endpoint = gatewayUrl.replace(/\/$/, "") + "/api/agent/run";
10
+ // Extract session key from session params
11
+ const sessionKey = ctx.sessionParams
12
+ ? ctx.sessionParams["sessionKey"] ??
13
+ ctx.sessionParams["session_key"] ??
14
+ null
15
+ : null;
16
+ const body = JSON.stringify({
17
+ prompt: ctx.prompt,
18
+ ...(sessionKey ? { sessionKey } : {}),
19
+ ...(model ? { model: model } : {}),
20
+ });
21
+ try {
22
+ const abortController = new AbortController();
23
+ let timeoutHandle = null;
24
+ if (config.timeoutSec && config.timeoutSec > 0) {
25
+ timeoutHandle = setTimeout(() => {
26
+ abortController.abort();
27
+ }, config.timeoutSec * 1000);
28
+ }
29
+ const response = await fetch(endpoint, {
30
+ method: "POST",
31
+ headers: { "Content-Type": "application/json" },
32
+ body,
33
+ signal: abortController.signal,
34
+ });
35
+ if (timeoutHandle)
36
+ clearTimeout(timeoutHandle);
37
+ if (!response.ok) {
38
+ const errorText = await response.text().catch(() => "");
39
+ return {
40
+ runId,
41
+ exitCode: 1,
42
+ signal: null,
43
+ timedOut: false,
44
+ startedAt,
45
+ completedAt: new Date().toISOString(),
46
+ durationMs: Date.now() - startMs,
47
+ errorMessage: `OpenClaw gateway returned ${response.status}: ${errorText}`,
48
+ errorCode: response.status === 401 ? "auth_required" : null,
49
+ costUsd: null,
50
+ model: model ?? null,
51
+ summary: null,
52
+ sessionParams: sessionKey ? { sessionKey, gatewayUrl } : null,
53
+ sessionDisplayId: sessionKey,
54
+ clearSession: false,
55
+ billingType: null,
56
+ };
57
+ }
58
+ const result = await response.json();
59
+ const newSessionKey = typeof result["sessionKey"] === "string" ? result["sessionKey"] : sessionKey;
60
+ const summary = typeof result["summary"] === "string" ? result["summary"]
61
+ : typeof result["result"] === "string" ? result["result"]
62
+ : typeof result["output"] === "string" ? result["output"]
63
+ : null;
64
+ // Emit result as stream event
65
+ if (ctx.onEvent && summary) {
66
+ try {
67
+ await ctx.onEvent({
68
+ type: "result",
69
+ text: summary,
70
+ cost: null,
71
+ isError: false,
72
+ timestamp: new Date().toISOString(),
73
+ });
74
+ }
75
+ catch { /* swallow */ }
76
+ }
77
+ return {
78
+ runId,
79
+ exitCode: 0,
80
+ signal: null,
81
+ timedOut: false,
82
+ startedAt,
83
+ completedAt: new Date().toISOString(),
84
+ durationMs: Date.now() - startMs,
85
+ errorMessage: null,
86
+ errorCode: null,
87
+ costUsd: typeof result["costUsd"] === "number" ? result["costUsd"] : null,
88
+ model: typeof result["model"] === "string" ? result["model"] : model ?? null,
89
+ summary,
90
+ sessionParams: newSessionKey ? { sessionKey: newSessionKey, gatewayUrl } : null,
91
+ sessionDisplayId: newSessionKey,
92
+ clearSession: false,
93
+ billingType: null,
94
+ raw: result,
95
+ };
96
+ }
97
+ catch (err) {
98
+ if (err instanceof Error && err.name === "AbortError") {
99
+ return {
100
+ runId,
101
+ exitCode: null,
102
+ signal: null,
103
+ timedOut: true,
104
+ startedAt,
105
+ completedAt: new Date().toISOString(),
106
+ durationMs: Date.now() - startMs,
107
+ errorMessage: `Timed out after ${config.timeoutSec ?? 0}s`,
108
+ errorCode: "timeout",
109
+ costUsd: null,
110
+ model: model ?? null,
111
+ summary: null,
112
+ sessionParams: sessionKey ? { sessionKey, gatewayUrl } : null,
113
+ sessionDisplayId: sessionKey,
114
+ clearSession: false,
115
+ billingType: null,
116
+ };
117
+ }
118
+ return {
119
+ runId,
120
+ exitCode: null,
121
+ signal: null,
122
+ timedOut: false,
123
+ startedAt,
124
+ completedAt: new Date().toISOString(),
125
+ durationMs: Date.now() - startMs,
126
+ errorMessage: err instanceof Error ? err.message : "OpenClaw execution failed",
127
+ errorCode: null,
128
+ costUsd: null,
129
+ model: model ?? null,
130
+ summary: null,
131
+ sessionParams: null,
132
+ sessionDisplayId: null,
133
+ clearSession: false,
134
+ billingType: null,
135
+ };
136
+ }
137
+ }
138
+ //# sourceMappingURL=execute.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"execute.js","sourceRoot":"","sources":["../../../src/providers/openclaw/execute.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAE7C,MAAM,CAAC,KAAK,UAAU,sBAAsB,CAAC,GAAqB;IAChE,MAAM,KAAK,GAAG,GAAG,CAAC,KAAK,IAAI,MAAM,EAAE,CAAC;IACpC,MAAM,KAAK,GAAG,GAAG,CAAC,KAAK,IAAI,GAAG,CAAC,MAAM,EAAE,KAAK,CAAC;IAC7C,MAAM,MAAM,GAAG,GAAG,CAAC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AC,CAAC,2BAA2B;YAC9E,SAAS,EAAE,IAAI;YACf,OAAO,EAAE,IAAI;YACb,KAAK,EAAE,KAAK,IAAI,IAAI;YACpB,OAAO,EAAE,IAAI;YACb,aAAa,EAAE,IAAI;YACnB,gBAAgB,EAAE,IAAI;YACtB,YAAY,EAAE,KAAK;YACnB,WAAW,EAAE,IAAI;SAClB,CAAC;IACJ,CAAC;AACH,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { ProviderModule } from "../../types.js";
2
+ export declare const openclawAdapter: ProviderModule;
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/providers/openclaw/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAKrD,eAAO,MAAM,eAAe,EAAE,cAK7B,CAAC"}
@@ -0,0 +1,10 @@
1
+ import { executeOpenclawAdapter } from "./execute.js";
2
+ import { testOpenclawEnvironment } from "./test.js";
3
+ import { openclawSessionCodec } from "./codec.js";
4
+ export const openclawAdapter = {
5
+ type: "openclaw",
6
+ execute: executeOpenclawAdapter,
7
+ testEnvironment: testOpenclawEnvironment,
8
+ sessionCodec: openclawSessionCodec,
9
+ };
10
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/providers/openclaw/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AACtD,OAAO,EAAE,uBAAuB,EAAE,MAAM,WAAW,CAAC;AACpD,OAAO,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAElD,MAAM,CAAC,MAAM,eAAe,GAAmB;IAC7C,IAAI,EAAE,UAAU;IAChB,OAAO,EAAE,sBAAsB;IAC/B,eAAe,EAAE,uBAAuB;IACxC,YAAY,EAAE,oBAAoB;CACnC,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { EnvironmentTestContext, EnvironmentTestResult } from "../../types.js";
2
+ export declare function testOpenclawEnvironment(ctx: EnvironmentTestContext): Promise<EnvironmentTestResult>;
3
+ //# sourceMappingURL=test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"test.d.ts","sourceRoot":"","sources":["../../../src/providers/openclaw/test.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AAEpF,wBAAsB,uBAAuB,CAC3C,GAAG,EAAE,sBAAsB,GAC1B,OAAO,CAAC,qBAAqB,CAAC,CAkDhC"}
@@ -0,0 +1,50 @@
1
+ export async function testOpenclawEnvironment(ctx) {
2
+ const config = (ctx.config ?? {});
3
+ const gatewayUrl = typeof config["command"] === "string" && config["command"].trim()
4
+ ? config["command"].trim()
5
+ : "http://localhost:3001";
6
+ try {
7
+ const healthUrl = gatewayUrl.replace(/\/$/, "") + "/health";
8
+ const response = await fetch(healthUrl, {
9
+ signal: AbortSignal.timeout(5000),
10
+ });
11
+ if (response.ok) {
12
+ return {
13
+ providerType: ctx.providerType,
14
+ status: "pass",
15
+ checks: [{
16
+ code: "openclaw_gateway_reachable",
17
+ level: "info",
18
+ message: `OpenClaw gateway is reachable at ${gatewayUrl}`,
19
+ }],
20
+ testedAt: new Date().toISOString(),
21
+ };
22
+ }
23
+ return {
24
+ providerType: ctx.providerType,
25
+ status: "warn",
26
+ checks: [{
27
+ code: "openclaw_gateway_unhealthy",
28
+ level: "warn",
29
+ message: `OpenClaw gateway returned status ${response.status}`,
30
+ hint: `Check that the OpenClaw gateway at ${gatewayUrl} is running and healthy.`,
31
+ }],
32
+ testedAt: new Date().toISOString(),
33
+ };
34
+ }
35
+ catch (err) {
36
+ return {
37
+ providerType: ctx.providerType,
38
+ status: "fail",
39
+ checks: [{
40
+ code: "openclaw_gateway_unreachable",
41
+ level: "error",
42
+ message: `Cannot reach OpenClaw gateway at ${gatewayUrl}`,
43
+ detail: err instanceof Error ? err.message : String(err),
44
+ hint: `Ensure the OpenClaw gateway is running at ${gatewayUrl}.`,
45
+ }],
46
+ testedAt: new Date().toISOString(),
47
+ };
48
+ }
49
+ }
50
+ //# sourceMappingURL=test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"test.js","sourceRoot":"","sources":["../../../src/providers/openclaw/test.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,KAAK,UAAU,uBAAuB,CAC3C,GAA2B;IAE3B,MAAM,MAAM,GAAG,CAAC,GAAG,CAAC,MAAM,IAAI,EAAE,CAA4B,CAAC;IAC7D,MAAM,UAAU,GAAG,OAAO,MAAM,CAAC,SAAS,CAAC,KAAK,QAAQ,IAAI,MAAM,CAAC,SAAS,CAAC,CAAC,IAAI,EAAE;QAClF,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,IAAI,EAAE;QAC1B,CAAC,CAAC,uBAAuB,CAAC;IAE5B,IAAI,CAAC;QACH,MAAM,SAAS,GAAG,UAAU,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,GAAG,SAAS,CAAC;QAC5D,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,SAAS,EAAE;YACtC,MAAM,EAAE,WAAW,CAAC,OAAO,CAAC,IAAI,CAAC;SAClC,CAAC,CAAC;QAEH,IAAI,QAAQ,CAAC,EAAE,EAAE,CAAC;YAChB,OAAO;gBACL,YAAY,EAAE,GAAG,CAAC,YAAY;gBAC9B,MAAM,EAAE,MAAM;gBACd,MAAM,EAAE,CAAC;wBACP,IAAI,EAAE,4BAA4B;wBAClC,KAAK,EAAE,MAAM;wBACb,OAAO,EAAE,oCAAoC,UAAU,EAAE;qBAC1D,CAAC;gBACF,QAAQ,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;aACnC,CAAC;QACJ,CAAC;QAED,OAAO;YACL,YAAY,EAAE,GAAG,CAAC,YAAY;YAC9B,MAAM,EAAE,MAAM;YACd,MAAM,EAAE,CAAC;oBACP,IAAI,EAAE,4BAA4B;oBAClC,KAAK,EAAE,MAAM;oBACb,OAAO,EAAE,oCAAoC,QAAQ,CAAC,MAAM,EAAE;oBAC9D,IAAI,EAAE,sCAAsC,UAAU,0BAA0B;iBACjF,CAAC;YACF,QAAQ,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;SACnC,CAAC;IACJ,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,OAAO;YACL,YAAY,EAAE,GAAG,CAAC,YAAY;YAC9B,MAAM,EAAE,MAAM;YACd,MAAM,EAAE,CAAC;oBACP,IAAI,EAAE,8BAA8B;oBACpC,KAAK,EAAE,OAAO;oBACd,OAAO,EAAE,oCAAoC,UAAU,EAAE;oBACzD,MAAM,EAAE,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC;oBACxD,IAAI,EAAE,6CAA6C,UAAU,GAAG;iBACjE,CAAC;YACF,QAAQ,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;SACnC,CAAC;IACJ,CAAC;AACH,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { ExecutionContext, ExecutionResult } from "../../types.js";
2
+ export declare function executeProcessAdapter(ctx: ExecutionContext): Promise<ExecutionResult>;
3
+ //# sourceMappingURL=execute.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"execute.d.ts","sourceRoot":"","sources":["../../../src/providers/process/execute.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAMxE,wBAAsB,qBAAqB,CAAC,GAAG,EAAE,gBAAgB,GAAG,OAAO,CAAC,eAAe,CAAC,CAoG3F"}
@@ -0,0 +1,105 @@
1
+ import { ensureCommandResolvable } from "../../utils/binary.js";
2
+ import { buildEnv, ensurePathInEnv } from "../../utils/env.js";
3
+ import { runChildProcess, deriveErrorCode } from "../../utils/process.js";
4
+ import { uuidv7 } from "../../utils/uuid.js";
5
+ export async function executeProcessAdapter(ctx) {
6
+ const runId = ctx.runId ?? uuidv7();
7
+ const cwd = ctx.cwd ?? process.cwd();
8
+ const config = ctx.config ?? {};
9
+ const startedAt = new Date().toISOString();
10
+ const startMs = Date.now();
11
+ const command = config.command;
12
+ if (!command) {
13
+ return {
14
+ runId,
15
+ exitCode: null,
16
+ signal: null,
17
+ timedOut: false,
18
+ startedAt,
19
+ completedAt: new Date().toISOString(),
20
+ durationMs: Date.now() - startMs,
21
+ errorMessage: 'Process adapter requires config.command to be set.',
22
+ errorCode: "binary_not_found",
23
+ costUsd: null,
24
+ model: null,
25
+ summary: null,
26
+ sessionParams: null,
27
+ sessionDisplayId: null,
28
+ clearSession: false,
29
+ billingType: null,
30
+ };
31
+ }
32
+ let resolvedBinary;
33
+ try {
34
+ resolvedBinary = await ensureCommandResolvable(command);
35
+ }
36
+ catch (err) {
37
+ return {
38
+ runId,
39
+ exitCode: null,
40
+ signal: null,
41
+ timedOut: false,
42
+ startedAt,
43
+ completedAt: new Date().toISOString(),
44
+ durationMs: Date.now() - startMs,
45
+ errorMessage: err instanceof Error ? err.message : "Command not found",
46
+ errorCode: "binary_not_found",
47
+ costUsd: null,
48
+ model: null,
49
+ summary: null,
50
+ sessionParams: null,
51
+ sessionDisplayId: null,
52
+ clearSession: false,
53
+ billingType: null,
54
+ };
55
+ }
56
+ const env = buildEnv(ctx.env);
57
+ ensurePathInEnv(env);
58
+ const proc = await runChildProcess({
59
+ runId,
60
+ command: resolvedBinary.bin,
61
+ args: [...resolvedBinary.prefixArgs, ...(config.extraArgs ?? [])],
62
+ cwd,
63
+ env,
64
+ stdin: ctx.prompt,
65
+ timeoutSec: config.timeoutSec,
66
+ graceSec: config.graceSec,
67
+ onOutput: ctx.onOutput ? async (stream, chunk) => {
68
+ try {
69
+ await ctx.onOutput(stream, chunk);
70
+ }
71
+ catch { /* swallow */ }
72
+ } : undefined,
73
+ });
74
+ const errorCode = deriveErrorCode(proc);
75
+ const errorMessage = (() => {
76
+ if (proc.timedOut)
77
+ return `Timed out after ${config.timeoutSec ?? 0}s`;
78
+ if ((proc.exitCode ?? 0) !== 0) {
79
+ const stderrLine = proc.stderr.split(/\r?\n/).map((l) => l.trim()).find(Boolean);
80
+ return stderrLine ?? `Process exited with code ${proc.exitCode ?? -1}`;
81
+ }
82
+ return null;
83
+ })();
84
+ const completedAt = new Date().toISOString();
85
+ return {
86
+ runId,
87
+ exitCode: proc.exitCode,
88
+ signal: proc.signal ?? null,
89
+ timedOut: proc.timedOut,
90
+ startedAt,
91
+ completedAt,
92
+ durationMs: new Date(completedAt).getTime() - startMs,
93
+ errorMessage,
94
+ errorCode,
95
+ costUsd: null,
96
+ model: null,
97
+ summary: proc.stdout.trim() || null,
98
+ sessionParams: null,
99
+ sessionDisplayId: null,
100
+ clearSession: false,
101
+ billingType: null,
102
+ raw: null,
103
+ };
104
+ }
105
+ //# sourceMappingURL=execute.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"execute.js","sourceRoot":"","sources":["../../../src/providers/process/execute.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAChE,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAC/D,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAC1E,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAE7C,MAAM,CAAC,KAAK,UAAU,qBAAqB,CAAC,GAAqB;IAC/D,MAAM,KAAK,GAAG,GAAG,CAAC,KAAK,IAAI,MAAM,EAAE,CAAC;IACpC,MAAM,GAAG,GAAG,GAAG,CAAC,GAAG,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC;IACrC,MAAM,MAAM,GAAG,GAAG,CAAC,MAAM,IAAI,EAAE,CAAC;IAChC,MAAM,SAAS,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,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YACjF,OAAO,UAAU,IAAI,4BAA4B,IAAI,CAAC,QAAQ,IAAI,CAAC,CAAC,EAAE,CAAC;QACzE,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC,CAAC,EAAE,CAAC;IAEL,MAAM,WAAW,GAAG,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;IAC7C,OAAO;QACL,KAAK;QACL,QAAQ,EAAE,IAAI,CAAC,QAAQ;QACvB,MAAM,EAAE,IAAI,CAAC,MAAM,IAAI,IAAI;QAC3B,QAAQ,EAAE,IAAI,CAAC,QAAQ;QACvB,SAAS;QACT,WAAW;QACX,UAAU,EAAE,IAAI,IAAI,CAAC,WAAW,CAAC,CAAC,OAAO,EAAE,GAAG,OAAO;QACrD,YAAY;QACZ,SAAS;QACT,OAAO,EAAE,IAAI;QACb,KAAK,EAAE,IAAI;QACX,OAAO,EAAE,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,IAAI;QACnC,aAAa,EAAE,IAAI;QACnB,gBAAgB,EAAE,IAAI;QACtB,YAAY,EAAE,KAAK;QACnB,WAAW,EAAE,IAAI;QACjB,GAAG,EAAE,IAAI;KACV,CAAC;AACJ,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { ProviderModule } from "../../types.js";
2
+ export declare const processAdapter: ProviderModule;
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/providers/process/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAiD,MAAM,gBAAgB,CAAC;AA+CpG,eAAO,MAAM,cAAc,EAAE,cAI5B,CAAC"}
@@ -0,0 +1,49 @@
1
+ import { executeProcessAdapter } from "./execute.js";
2
+ import { ensureCommandResolvable } from "../../utils/binary.js";
3
+ async function testProcessEnvironment(ctx) {
4
+ const config = (ctx.config ?? {});
5
+ const command = typeof config["command"] === "string" ? config["command"] : null;
6
+ if (!command) {
7
+ return {
8
+ providerType: ctx.providerType,
9
+ status: "fail",
10
+ checks: [{
11
+ code: "process_command_missing",
12
+ level: "error",
13
+ message: "Process adapter requires config.command to be set.",
14
+ }],
15
+ testedAt: new Date().toISOString(),
16
+ };
17
+ }
18
+ try {
19
+ await ensureCommandResolvable(command);
20
+ return {
21
+ providerType: ctx.providerType,
22
+ status: "pass",
23
+ checks: [{
24
+ code: "process_command_resolvable",
25
+ level: "info",
26
+ message: `Command is resolvable: ${command}`,
27
+ }],
28
+ testedAt: new Date().toISOString(),
29
+ };
30
+ }
31
+ catch (err) {
32
+ return {
33
+ providerType: ctx.providerType,
34
+ status: "fail",
35
+ checks: [{
36
+ code: "process_command_unresolvable",
37
+ level: "error",
38
+ message: err instanceof Error ? err.message : "Command not found",
39
+ }],
40
+ testedAt: new Date().toISOString(),
41
+ };
42
+ }
43
+ }
44
+ export const processAdapter = {
45
+ type: "process",
46
+ execute: executeProcessAdapter,
47
+ testEnvironment: testProcessEnvironment,
48
+ };
49
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/providers/process/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAEhE,KAAK,UAAU,sBAAsB,CAAC,GAA2B;IAC/D,MAAM,MAAM,GAAG,CAAC,GAAG,CAAC,MAAM,IAAI,EAAE,CAA4B,CAAC;IAC7D,MAAM,OAAO,GAAG,OAAO,MAAM,CAAC,SAAS,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IAEjF,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,OAAO;YACL,YAAY,EAAE,GAAG,CAAC,YAAY;YAC9B,MAAM,EAAE,MAAM;YACd,MAAM,EAAE,CAAC;oBACP,IAAI,EAAE,yBAAyB;oBAC/B,KAAK,EAAE,OAAO;oBACd,OAAO,EAAE,oDAAoD;iBAC9D,CAAC;YACF,QAAQ,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;SACnC,CAAC;IACJ,CAAC;IAED,IAAI,CAAC;QACH,MAAM,uBAAuB,CAAC,OAAO,CAAC,CAAC;QACvC,OAAO;YACL,YAAY,EAAE,GAAG,CAAC,YAAY;YAC9B,MAAM,EAAE,MAAM;YACd,MAAM,EAAE,CAAC;oBACP,IAAI,EAAE,4BAA4B;oBAClC,KAAK,EAAE,MAAM;oBACb,OAAO,EAAE,0BAA0B,OAAO,EAAE;iBAC7C,CAAC;YACF,QAAQ,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;SACnC,CAAC;IACJ,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,OAAO;YACL,YAAY,EAAE,GAAG,CAAC,YAAY;YAC9B,MAAM,EAAE,MAAM;YACd,MAAM,EAAE,CAAC;oBACP,IAAI,EAAE,8BAA8B;oBACpC,KAAK,EAAE,OAAO;oBACd,OAAO,EAAE,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,mBAAmB;iBAClE,CAAC;YACF,QAAQ,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;SACnC,CAAC;IACJ,CAAC;AACH,CAAC;AAED,MAAM,CAAC,MAAM,cAAc,GAAmB;IAC5C,IAAI,EAAE,SAAS;IACf,OAAO,EAAE,qBAAqB;IAC9B,eAAe,EAAE,sBAAsB;CACxC,CAAC"}
@@ -0,0 +1,5 @@
1
+ import type { ProviderModule } from "./types.js";
2
+ export declare function getProvider(type: string): ProviderModule;
3
+ export declare function listProviders(): string[];
4
+ export declare function registerProvider(provider: ProviderModule): void;
5
+ //# sourceMappingURL=registry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../src/registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAcjD,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,cAAc,CAOxD;AAED,wBAAgB,aAAa,IAAI,MAAM,EAAE,CAExC;AAED,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,cAAc,GAAG,IAAI,CAE/D"}
@@ -0,0 +1,25 @@
1
+ import { claudeAdapter } from "./providers/claude/index.js";
2
+ import { codexAdapter } from "./providers/codex/index.js";
3
+ import { openclawAdapter } from "./providers/openclaw/index.js";
4
+ import { processAdapter } from "./providers/process/index.js";
5
+ const providers = new Map();
6
+ // Pre-register built-in providers
7
+ providers.set("claude", claudeAdapter);
8
+ providers.set("codex", codexAdapter);
9
+ providers.set("openclaw", openclawAdapter);
10
+ providers.set("process", processAdapter);
11
+ export function getProvider(type) {
12
+ const provider = providers.get(type);
13
+ if (!provider) {
14
+ const available = [...providers.keys()].join(", ");
15
+ throw new Error(`Unknown provider type "${type}". Available: ${available}`);
16
+ }
17
+ return provider;
18
+ }
19
+ export function listProviders() {
20
+ return [...providers.keys()];
21
+ }
22
+ export function registerProvider(provider) {
23
+ providers.set(provider.type, provider);
24
+ }
25
+ //# sourceMappingURL=registry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registry.js","sourceRoot":"","sources":["../src/registry.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAE9D,MAAM,SAAS,GAAG,IAAI,GAAG,EAA0B,CAAC;AAEpD,kCAAkC;AAClC,SAAS,CAAC,GAAG,CAAC,QAAQ,EAAE,aAAa,CAAC,CAAC;AACvC,SAAS,CAAC,GAAG,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;AACrC,SAAS,CAAC,GAAG,CAAC,UAAU,EAAE,eAAe,CAAC,CAAC;AAC3C,SAAS,CAAC,GAAG,CAAC,SAAS,EAAE,cAAc,CAAC,CAAC;AAEzC,MAAM,UAAU,WAAW,CAAC,IAAY;IACtC,MAAM,QAAQ,GAAG,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IACrC,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,MAAM,SAAS,GAAG,CAAC,GAAG,SAAS,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACnD,MAAM,IAAI,KAAK,CAAC,0BAA0B,IAAI,iBAAiB,SAAS,EAAE,CAAC,CAAC;IAC9E,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED,MAAM,UAAU,aAAa;IAC3B,OAAO,CAAC,GAAG,SAAS,CAAC,IAAI,EAAE,CAAC,CAAC;AAC/B,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,QAAwB;IACvD,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;AACzC,CAAC"}
@@ -0,0 +1,121 @@
1
+ export interface ProviderModule {
2
+ type: string;
3
+ execute(ctx: ExecutionContext): Promise<ExecutionResult>;
4
+ testEnvironment(ctx: EnvironmentTestContext): Promise<EnvironmentTestResult>;
5
+ sessionCodec?: SessionCodec;
6
+ listModels?(): Promise<ProviderModel[]>;
7
+ }
8
+ export interface ExecutionContext {
9
+ prompt: string;
10
+ model?: string;
11
+ runId?: string;
12
+ cwd?: string;
13
+ env?: Record<string, string>;
14
+ sessionParams?: Record<string, unknown> | null;
15
+ config?: ProviderConfig;
16
+ onOutput?: (stream: "stdout" | "stderr", chunk: string) => void | Promise<void>;
17
+ onEvent?: (event: StreamEvent) => void | Promise<void>;
18
+ }
19
+ export interface ProviderConfig {
20
+ command?: string;
21
+ model?: string;
22
+ effort?: string;
23
+ maxTurns?: number;
24
+ timeoutSec?: number;
25
+ graceSec?: number;
26
+ skipPermissions?: boolean;
27
+ skillDirs?: string[];
28
+ instructionsFile?: string;
29
+ mcpServers?: McpServerConfig[];
30
+ extraArgs?: string[];
31
+ }
32
+ export interface ExecutionResult {
33
+ runId: string;
34
+ exitCode: number | null;
35
+ signal: string | null;
36
+ timedOut: boolean;
37
+ startedAt: string;
38
+ completedAt: string;
39
+ durationMs: number;
40
+ errorMessage: string | null;
41
+ errorCode: string | null;
42
+ usage?: {
43
+ inputTokens: number;
44
+ outputTokens: number;
45
+ cachedInputTokens?: number;
46
+ };
47
+ costUsd: number | null;
48
+ model: string | null;
49
+ summary: string | null;
50
+ sessionParams: Record<string, unknown> | null;
51
+ sessionDisplayId: string | null;
52
+ clearSession: boolean;
53
+ billingType: "api" | "subscription" | null;
54
+ raw?: Record<string, unknown> | null;
55
+ }
56
+ export type StreamEvent = {
57
+ type: "system";
58
+ subtype: string;
59
+ sessionId: string | null;
60
+ model: string | null;
61
+ timestamp: string;
62
+ } | {
63
+ type: "assistant";
64
+ text: string;
65
+ timestamp: string;
66
+ } | {
67
+ type: "thinking";
68
+ text: string;
69
+ timestamp: string;
70
+ } | {
71
+ type: "tool_call";
72
+ name: string;
73
+ input: unknown;
74
+ timestamp: string;
75
+ } | {
76
+ type: "tool_result";
77
+ toolCallId: string;
78
+ content: string;
79
+ isError: boolean;
80
+ timestamp: string;
81
+ } | {
82
+ type: "result";
83
+ text: string;
84
+ cost: number | null;
85
+ isError: boolean;
86
+ timestamp: string;
87
+ };
88
+ export interface SessionCodec {
89
+ deserialize(raw: unknown): Record<string, unknown> | null;
90
+ serialize(params: Record<string, unknown> | null): Record<string, unknown> | null;
91
+ getDisplayId?(params: Record<string, unknown> | null): string | null;
92
+ }
93
+ export interface EnvironmentTestContext {
94
+ providerType: string;
95
+ config?: Record<string, unknown>;
96
+ }
97
+ export interface EnvironmentTestResult {
98
+ providerType: string;
99
+ status: "pass" | "warn" | "fail";
100
+ checks: EnvironmentCheck[];
101
+ testedAt: string;
102
+ }
103
+ export interface EnvironmentCheck {
104
+ code: string;
105
+ level: "info" | "warn" | "error";
106
+ message: string;
107
+ detail?: string;
108
+ hint?: string;
109
+ }
110
+ export interface ProviderModel {
111
+ id: string;
112
+ name: string;
113
+ provider?: string;
114
+ }
115
+ export interface McpServerConfig {
116
+ name: string;
117
+ command: string;
118
+ args?: string[];
119
+ env?: Record<string, string>;
120
+ }
121
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AACA,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,GAAG,EAAE,gBAAgB,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;IACzD,eAAe,CAAC,GAAG,EAAE,sBAAsB,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAAC;IAC7E,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B,UAAU,CAAC,IAAI,OAAO,CAAC,aAAa,EAAE,CAAC,CAAC;CACzC;AAGD,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC7B,aAAa,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IAC/C,MAAM,CAAC,EAAE,cAAc,CAAC;IACxB,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,QAAQ,GAAG,QAAQ,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACh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oot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,9 @@
1
+ export interface ResolvedBinary {
2
+ bin: string;
3
+ prefixArgs: string[];
4
+ }
5
+ export declare function resolveWindowsCmdShim(cmdPath: string): Promise<ResolvedBinary | null>;
6
+ export declare function findBinary(name: string, configOverride?: string): Promise<ResolvedBinary>;
7
+ export declare function ensureCommandResolvable(command: string): Promise<ResolvedBinary>;
8
+ export declare function clearBinaryCache(): void;
9
+ //# sourceMappingURL=binary.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"binary.d.ts","sourceRoot":"","sources":["../../src/utils/binary.ts"],"names":[],"mappings":"AAKA,MAAM,WAAW,cAAc;IAC7B,GAAG,EAAE,MAAM,CAAC;IACZ,UAAU,EAAE,MAAM,EAAE,CAAC;CACtB;AAoDD,wBAAsB,qBAAqB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,GAAG,IAAI,CAAC,CAgB3F;AAED,wBAAsB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,cAAc,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC,CA6D/F;AAED,wBAAsB,uBAAuB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC,CAUtF;AAED,wBAAgB,gBAAgB,IAAI,IAAI,CAEvC"}