@gajae-code/ai 0.16.7 → 0.17.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +44 -1
- package/dist/types/auth-storage.d.ts +23 -4
- package/dist/types/models.d.ts +14 -0
- package/dist/types/provider-models/special.d.ts +12 -0
- package/dist/types/providers/anthropic.d.ts +1 -1
- package/dist/types/providers/cursor.d.ts +33 -21
- package/dist/types/providers/devin-acp.d.ts +157 -0
- package/dist/types/providers/google-gemini-headers.d.ts +1 -1
- package/dist/types/providers/mock.d.ts +2 -0
- package/dist/types/providers/openai-responses-shared.d.ts +21 -1
- package/dist/types/providers/register-builtins.d.ts +1 -0
- package/dist/types/types.d.ts +52 -11
- package/dist/types/utils/block-symbols.d.ts +15 -5
- package/dist/types/utils/fallback-transport.d.ts +4 -1
- package/dist/types/utils.d.ts +13 -0
- package/package.json +4 -3
- package/src/api-registry.ts +1 -0
- package/src/auth-broker/redact.ts +10 -2
- package/src/auth-gateway/server.ts +56 -3
- package/src/auth-storage.ts +330 -116
- package/src/model-manager.ts +21 -2
- package/src/models.d.ts +14 -0
- package/src/models.json +117 -0
- package/src/models.ts +18 -0
- package/src/provider-models/descriptors.ts +7 -0
- package/src/provider-models/openai-compat.ts +14 -0
- package/src/provider-models/special.ts +39 -0
- package/src/providers/anthropic.d.ts +1 -1
- package/src/providers/anthropic.ts +1 -1
- package/src/providers/azure-openai-responses.ts +10 -1
- package/src/providers/cursor.d.ts +33 -21
- package/src/providers/cursor.ts +2024 -508
- package/src/providers/devin-acp.d.ts +157 -0
- package/src/providers/devin-acp.ts +1103 -0
- package/src/providers/google-gemini-headers.d.ts +1 -1
- package/src/providers/google-gemini-headers.ts +1 -1
- package/src/providers/mock.ts +16 -1
- package/src/providers/openai-chat-server.ts +3 -3
- package/src/providers/openai-codex-responses.ts +27 -17
- package/src/providers/openai-responses-server.ts +5 -5
- package/src/providers/openai-responses-shared.d.ts +21 -1
- package/src/providers/openai-responses-shared.ts +60 -6
- package/src/providers/openai-responses.ts +10 -1
- package/src/providers/register-builtins.d.ts +1 -0
- package/src/providers/register-builtins.ts +21 -1
- package/src/stream.ts +14 -0
- package/src/types.d.ts +52 -11
- package/src/types.ts +70 -8
- package/src/utils/block-symbols.d.ts +15 -5
- package/src/utils/block-symbols.ts +16 -6
- package/src/utils/discovery/cursor.ts +3 -2
- package/src/utils/fallback-transport.d.ts +4 -1
- package/src/utils/fallback-transport.ts +12 -5
- package/src/utils.d.ts +13 -0
- package/src/utils.ts +17 -0
- package/dist/types/utils/codex-entitlement.d.ts +0 -22
- package/src/utils/codex-entitlement.d.ts +0 -22
- package/src/utils/codex-entitlement.ts +0 -57
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Devin CLI provider — an ACP (Agent Client Protocol) client.
|
|
3
|
+
*
|
|
4
|
+
* Devin CLI exposes no raw model-inference endpoint. Its programmatic surface is
|
|
5
|
+
* `devin acp`: an Agent Client Protocol server over stdio that runs the whole
|
|
6
|
+
* agent (https://docs.devin.ai/cli/reference/commands#devin-acp). GJC therefore
|
|
7
|
+
* speaks ACP as the *client* and treats Devin as an agent-level provider:
|
|
8
|
+
*
|
|
9
|
+
* - GJC spawns `devin acp` and speaks ACP over the child's stdio.
|
|
10
|
+
* - One ACP session is reused for the lifetime of a GJC conversation, keyed by
|
|
11
|
+
* `providerSessionId` and stored in `providerSessionState`; `close()` kills
|
|
12
|
+
* the child process at session teardown.
|
|
13
|
+
* - Devin owns conversation history, so only the newest user turn is forwarded.
|
|
14
|
+
* - Devin executes its own tools. `session/update` tool calls are rendered as
|
|
15
|
+
* display-only `toolCall` blocks and every turn terminates with
|
|
16
|
+
* `stopReason: "stop"`, so GJC never re-executes a Devin tool call.
|
|
17
|
+
* - `session/request_permission` is answered from an explicit policy, never
|
|
18
|
+
* silently: see {@link DevinAcpPermissionMode}.
|
|
19
|
+
*
|
|
20
|
+
* Boundary (documented in docs/devin-provider.md): GJC tools, skills, workflows,
|
|
21
|
+
* hooks, and permission prompts for GJC's own tools do not apply inside a Devin
|
|
22
|
+
* turn; GJC maintenance work (compaction, handoff, branch summaries) and utility
|
|
23
|
+
* one-shots are refused rather than forwarded to Devin; and Devin bills its own
|
|
24
|
+
* account/ACU usage.
|
|
25
|
+
*/
|
|
26
|
+
import { type ContentBlock, type PermissionOption, type SessionConfigOption, type StopReason } from "@agentclientprotocol/sdk";
|
|
27
|
+
import type { AssistantMessageEventStream as AssistantMessageEventStreamType, Context, Model, StreamOptions } from "../types";
|
|
28
|
+
/** Environment variable overriding the Devin executable GJC spawns. */
|
|
29
|
+
export declare const DEVIN_ACP_CLI_ENV = "GJC_DEVIN_CLI_PATH";
|
|
30
|
+
/** Environment variable selecting how GJC answers Devin permission requests. */
|
|
31
|
+
export declare const DEVIN_ACP_PERMISSION_MODE_ENV = "GJC_DEVIN_PERMISSION_MODE";
|
|
32
|
+
/** Executable that serves `devin acp` when nothing overrides it. */
|
|
33
|
+
export declare const DEVIN_ACP_DEFAULT_CLI = "devin";
|
|
34
|
+
/**
|
|
35
|
+
* Placeholder base URL. The ACP transport never issues an HTTP request, but a
|
|
36
|
+
* model record must carry a non-empty base URL through the model registry.
|
|
37
|
+
*/
|
|
38
|
+
export declare const DEVIN_ACP_BASE_URL = "acp://devin-cli";
|
|
39
|
+
/**
|
|
40
|
+
* Conservative catalog defaults. ACP exposes no per-model token metadata, and
|
|
41
|
+
* GJC never sends conversation history to an ACP agent, so these values are
|
|
42
|
+
* display-only for this provider rather than a transport budget.
|
|
43
|
+
*/
|
|
44
|
+
export declare const DEVIN_ACP_CONTEXT_WINDOW = 200000;
|
|
45
|
+
export declare const DEVIN_ACP_MAX_TOKENS = 64000;
|
|
46
|
+
/**
|
|
47
|
+
* How GJC answers Devin's `session/request_permission` prompts.
|
|
48
|
+
*
|
|
49
|
+
* - `"allow"` (default) selects `allow_once`. A request that offers no
|
|
50
|
+
* `allow_once` is cancelled: GJC never grants a persistent approval on its own.
|
|
51
|
+
* - `"deny"` selects `reject_once` before `reject_always`.
|
|
52
|
+
*
|
|
53
|
+
* Neither mode escalates persistently on its own, and an unrecognized
|
|
54
|
+
* `GJC_DEVIN_PERMISSION_MODE` value fails closed to `"deny"`.
|
|
55
|
+
*/
|
|
56
|
+
export type DevinAcpPermissionMode = "allow" | "deny";
|
|
57
|
+
/** A permission request Devin raised for one of its own tool calls. */
|
|
58
|
+
export interface DevinAcpPermissionRequest {
|
|
59
|
+
sessionId: string;
|
|
60
|
+
toolCallId: string;
|
|
61
|
+
title: string;
|
|
62
|
+
kind?: string;
|
|
63
|
+
rawInput?: unknown;
|
|
64
|
+
options: ReadonlyArray<{
|
|
65
|
+
optionId: string;
|
|
66
|
+
name: string;
|
|
67
|
+
kind: string;
|
|
68
|
+
}>;
|
|
69
|
+
}
|
|
70
|
+
/** Selected option id, or `cancelled` to answer with ACP `outcome: cancelled`. */
|
|
71
|
+
export type DevinAcpPermissionDecision = {
|
|
72
|
+
optionId: string;
|
|
73
|
+
} | {
|
|
74
|
+
cancelled: true;
|
|
75
|
+
};
|
|
76
|
+
/** Explicit decision callback; replaces the built-in permission mode policy. */
|
|
77
|
+
export type DevinAcpPermissionHandler = (request: DevinAcpPermissionRequest) => Promise<DevinAcpPermissionDecision> | DevinAcpPermissionDecision;
|
|
78
|
+
/** Provider configuration threaded through `StreamOptions.devinAcp`. */
|
|
79
|
+
export interface DevinAcpConfig {
|
|
80
|
+
/** Executable serving `devin acp`. Defaults to {@link DEVIN_ACP_CLI_ENV} or `devin`. */
|
|
81
|
+
cliPath?: string;
|
|
82
|
+
/** Extra argv inserted before the `acp` verb. */
|
|
83
|
+
cliArgs?: readonly string[];
|
|
84
|
+
/** Working directory for the agent process. Defaults to `process.cwd()`. */
|
|
85
|
+
cwd?: string;
|
|
86
|
+
/**
|
|
87
|
+
* Overrides the permission policy for this request. Any value other than
|
|
88
|
+
* `"allow"` fails closed to `"deny"`, including out-of-type values from
|
|
89
|
+
* untyped callers.
|
|
90
|
+
*/
|
|
91
|
+
permissionMode?: DevinAcpPermissionMode;
|
|
92
|
+
/** Explicit permission decisions. When absent, the configured mode decides. */
|
|
93
|
+
permissionHandler?: DevinAcpPermissionHandler;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Devin ACP stream options. Every provider-specific field lives on
|
|
97
|
+
* `StreamOptions.devinAcp`; the alias exists so `ApiOptionsMap` can name this
|
|
98
|
+
* API's option type like every other API does.
|
|
99
|
+
*/
|
|
100
|
+
export type DevinAcpOptions = StreamOptions;
|
|
101
|
+
/** Map an ACP tool kind to the display tool name GJC renders. */
|
|
102
|
+
export declare function devinAcpDisplayToolName(kind: string | null | undefined, name?: string | null): string;
|
|
103
|
+
/**
|
|
104
|
+
* Copy a tool-call `rawInput` payload into a transcript-safe `arguments` record.
|
|
105
|
+
*
|
|
106
|
+
* ACP payloads arrive through JSON-RPC, so they are already JSON-shaped; this
|
|
107
|
+
* only wraps non-objects and refuses to stage an unbounded payload.
|
|
108
|
+
*/
|
|
109
|
+
export declare function devinAcpToolArguments(rawInput: unknown): Record<string, unknown>;
|
|
110
|
+
/** Map an ACP prompt stop reason onto GJC's assistant stop reason. */
|
|
111
|
+
export declare function devinAcpStopReason(stopReason: StopReason): "stop" | "length" | "aborted";
|
|
112
|
+
/** Flatten ACP select option groups into `{ id, name }` model entries. */
|
|
113
|
+
export declare function devinAcpSelectOptions(options: Extract<SessionConfigOption, {
|
|
114
|
+
type: "select";
|
|
115
|
+
}>["options"]): Array<{
|
|
116
|
+
id: string;
|
|
117
|
+
name: string;
|
|
118
|
+
}>;
|
|
119
|
+
/**
|
|
120
|
+
* Select the option matching the configured policy.
|
|
121
|
+
*
|
|
122
|
+
* `allow` grants a single action and never a persistent one: when the agent
|
|
123
|
+
* offers no `allow_once`, the request is cancelled rather than escalated to
|
|
124
|
+
* `allow_always`. `deny` may fall back to `reject_always`, because a persistent
|
|
125
|
+
* refusal only reduces what the agent may do.
|
|
126
|
+
*/
|
|
127
|
+
export declare function devinAcpSelectPermissionOption(options: ReadonlyArray<PermissionOption>, mode: DevinAcpPermissionMode): {
|
|
128
|
+
optionId: string;
|
|
129
|
+
} | null;
|
|
130
|
+
/** Resolve the permission policy from an explicit config value or the environment. */
|
|
131
|
+
export declare function devinAcpResolvePermissionMode(configured: DevinAcpPermissionMode | undefined, env?: Record<string, string | undefined>): DevinAcpPermissionMode;
|
|
132
|
+
/** Build the ACP prompt content blocks for the newest user turn. */
|
|
133
|
+
export declare function devinAcpPromptBlocks(context: Context, supportsImages: boolean): ContentBlock[];
|
|
134
|
+
/**
|
|
135
|
+
* Stable identity for the cached ACP child.
|
|
136
|
+
*
|
|
137
|
+
* `cwd` is part of the identity on purpose: `/move` changes `process.cwd()`, and a
|
|
138
|
+
* cached child keeps the directory it was spawned in, so a cwd change must miss the
|
|
139
|
+
* cache and respawn instead of running Devin's tools in the abandoned tree.
|
|
140
|
+
*/
|
|
141
|
+
export declare function devinAcpBridgeIdentity(conversationId: string | undefined, cwd: string, argv: readonly string[]): string;
|
|
142
|
+
export declare const streamDevinAcp: (model: Model<"devin-acp">, context: Context, options?: DevinAcpOptions) => AssistantMessageEventStreamType;
|
|
143
|
+
/**
|
|
144
|
+
* Discover the account's Devin models over ACP.
|
|
145
|
+
*
|
|
146
|
+
* `devin models list --format json` is deliberately not parsed: its schema is
|
|
147
|
+
* undocumented, while the session's own `model` config option is the
|
|
148
|
+
* authoritative ACP surface for the authenticated account and enterprise
|
|
149
|
+
* allowlists. Returns `null` when the CLI is missing, unauthenticated, or the
|
|
150
|
+
* agent advertises no model selector — which the model registry treats as
|
|
151
|
+
* "no dynamic models".
|
|
152
|
+
*/
|
|
153
|
+
export declare function fetchDevinAcpModels(config?: {
|
|
154
|
+
cliPath?: string;
|
|
155
|
+
cliArgs?: readonly string[];
|
|
156
|
+
cwd?: string;
|
|
157
|
+
}): Promise<Model<"devin-acp">[] | null>;
|