axexec 1.6.0 → 1.7.0

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 (48) hide show
  1. package/README.md +32 -22
  2. package/dist/agents/copilot/stream-session.js +8 -7
  3. package/dist/agents/copilot/watch-session.js +3 -1
  4. package/dist/agents/opencode/adapter.js +8 -1
  5. package/dist/agents/opencode/build-permission-environment.d.ts +17 -0
  6. package/dist/agents/opencode/build-permission-environment.js +31 -0
  7. package/dist/agents/opencode/parse-sse-event.js +3 -1
  8. package/dist/agents/opencode/spawn-server.js +12 -1
  9. package/dist/build-agent-environment.js +8 -0
  10. package/dist/build-execution-metadata.d.ts +1 -2
  11. package/dist/build-execution-metadata.js +1 -1
  12. package/dist/cli.d.ts +5 -6
  13. package/dist/cli.js +81 -60
  14. package/dist/credentials/get-credential-environment.d.ts +1 -1
  15. package/dist/credentials/get-credential-environment.js +1 -1
  16. package/dist/credentials/install-credentials.d.ts +3 -4
  17. package/dist/credentials/install-credentials.js +5 -3
  18. package/dist/credentials/write-agent-credentials.d.ts +4 -2
  19. package/dist/credentials/write-agent-credentials.js +1 -6
  20. package/dist/execute-agent.d.ts +1 -2
  21. package/dist/execute-agent.js +1 -0
  22. package/dist/format-zod-error.d.ts +6 -0
  23. package/dist/format-zod-error.js +12 -0
  24. package/dist/index.d.ts +1 -1
  25. package/dist/parse-credentials.d.ts +1 -2
  26. package/dist/parse-credentials.js +7 -6
  27. package/dist/read-credentials-file.d.ts +13 -0
  28. package/dist/read-credentials-file.js +39 -0
  29. package/dist/read-stdin.d.ts +5 -0
  30. package/dist/read-stdin.js +11 -0
  31. package/dist/resolve-credentials.d.ts +21 -0
  32. package/dist/resolve-credentials.js +23 -0
  33. package/dist/resolve-output-mode.d.ts +15 -1
  34. package/dist/resolve-output-mode.js +16 -1
  35. package/dist/resolve-prompt.d.ts +22 -0
  36. package/dist/resolve-prompt.js +23 -0
  37. package/dist/run-agent.d.ts +4 -1
  38. package/dist/run-agent.js +47 -6
  39. package/dist/types/run-result.d.ts +5 -2
  40. package/dist/validate-cwd.d.ts +11 -0
  41. package/dist/validate-cwd.js +24 -0
  42. package/dist/validate-opencode-options.d.ts +19 -0
  43. package/dist/validate-opencode-options.js +58 -0
  44. package/dist/validate-stdin-usage.d.ts +18 -0
  45. package/dist/validate-stdin-usage.js +28 -0
  46. package/package.json +1 -1
  47. package/dist/credentials/credentials.d.ts +0 -39
  48. package/dist/credentials/credentials.js +0 -73
@@ -1,39 +0,0 @@
1
- /**
2
- * Credential schema and parser.
3
- *
4
- * Temporary local copy of the axshared credentials schema.
5
- * Remove once axshared exports an equivalent parser with matching validation.
6
- */
7
- import { z } from "zod";
8
- /** Zod schema for Credentials */
9
- declare const Credentials: z.ZodObject<{
10
- agent: z.ZodEnum<{
11
- claude: "claude";
12
- codex: "codex";
13
- gemini: "gemini";
14
- opencode: "opencode";
15
- copilot: "copilot";
16
- }>;
17
- type: z.ZodEnum<{
18
- "oauth-credentials": "oauth-credentials";
19
- "oauth-token": "oauth-token";
20
- "api-key": "api-key";
21
- }>;
22
- provider: z.ZodOptional<z.ZodString>;
23
- data: z.ZodRecord<z.ZodString, z.ZodUnknown>;
24
- }, z.core.$strip>;
25
- type Credentials = z.infer<typeof Credentials>;
26
- type ParseCredentialsResult = {
27
- ok: true;
28
- credentials: Credentials;
29
- } | {
30
- ok: false;
31
- error: string;
32
- };
33
- /**
34
- * Parse and validate credentials from unknown input.
35
- *
36
- * @returns Validated Credentials or error details
37
- */
38
- declare function parseCredentials(input: unknown): ParseCredentialsResult;
39
- export { Credentials, parseCredentials };
@@ -1,73 +0,0 @@
1
- /**
2
- * Credential schema and parser.
3
- *
4
- * Temporary local copy of the axshared credentials schema.
5
- * Remove once axshared exports an equivalent parser with matching validation.
6
- */
7
- import { z } from "zod";
8
- import { AGENT_CLIS } from "axshared";
9
- import { resolveStringField } from "./resolve-string-field.js";
10
- /** Credential storage types */
11
- const CREDENTIAL_TYPES = [
12
- "oauth-credentials",
13
- "oauth-token",
14
- "api-key",
15
- ];
16
- /** Zod schema for credential type validation and parsing */
17
- const CredentialType = z.enum(CREDENTIAL_TYPES);
18
- /** Zod schema for Credentials */
19
- const Credentials = z
20
- .object({
21
- /** Agent this credential belongs to */
22
- agent: z.enum(AGENT_CLIS),
23
- /** Credential storage type */
24
- type: CredentialType,
25
- /** Provider identifier for multi-provider agents like OpenCode */
26
- provider: z.string().trim().min(1).optional(),
27
- /** The actual credential data (format depends on type and agent) */
28
- data: z.record(z.string(), z.unknown()),
29
- })
30
- .superRefine((value, context) => {
31
- if (value.type === "api-key") {
32
- const apiKey = resolveStringField(value.data, "apiKey", "key");
33
- if (!apiKey) {
34
- context.addIssue({
35
- code: "custom",
36
- path: ["data"],
37
- message: 'api-key credentials require "apiKey" or "key"',
38
- });
39
- }
40
- }
41
- if (value.type === "oauth-token") {
42
- const oauthToken = resolveStringField(value.data, "oauthToken", "token");
43
- if (!oauthToken) {
44
- context.addIssue({
45
- code: "custom",
46
- path: ["data"],
47
- message: 'oauth-token credentials require "oauthToken" or "token"',
48
- });
49
- }
50
- }
51
- // oauth-credentials payloads are provider-specific and intentionally
52
- // not validated beyond basic schema checks here.
53
- });
54
- function formatParseError(error) {
55
- return error.issues
56
- .map((issue) => {
57
- const path = issue.path.length > 0 ? issue.path.map(String).join(".") : "root";
58
- return `${path}: ${issue.message}`;
59
- })
60
- .join("; ");
61
- }
62
- /**
63
- * Parse and validate credentials from unknown input.
64
- *
65
- * @returns Validated Credentials or error details
66
- */
67
- function parseCredentials(input) {
68
- const result = Credentials.safeParse(input);
69
- if (result.success)
70
- return { ok: true, credentials: result.data };
71
- return { ok: false, error: formatParseError(result.error) };
72
- }
73
- export { Credentials, parseCredentials };