@nones/agentflow-opencode 0.1.0 → 0.6.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.
- package/LICENSE +21 -0
- package/README.md +119 -39
- package/package.json +8 -1
- package/src/adapter.ts +122 -4
- package/src/index.ts +18 -0
- package/src/normalize.ts +291 -0
- package/src/provider-history.ts +342 -0
- package/src/transcript.ts +930 -0
- package/src/types.ts +28 -104
package/src/types.ts
CHANGED
|
@@ -1,113 +1,32 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
startsPerSecond?: number;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export interface AgentSpec {
|
|
21
|
-
id: string;
|
|
22
|
-
prompt: string;
|
|
23
|
-
cwd: string;
|
|
24
|
-
profile?: string;
|
|
25
|
-
model?: string;
|
|
26
|
-
settings?: Record<string, unknown>;
|
|
27
|
-
strategy?: string;
|
|
28
|
-
strategyInput?: unknown;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export type TurnStatus =
|
|
32
|
-
"succeeded" | "failed" | "interrupted" | "rate_limited";
|
|
33
|
-
|
|
34
|
-
export interface RateLimitInfo {
|
|
35
|
-
reason: "concurrency" | "rate" | "quota" | "unknown";
|
|
36
|
-
retryAfterMs?: number;
|
|
37
|
-
safeToRetry: boolean;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
export interface TurnResult {
|
|
41
|
-
status: TurnStatus;
|
|
42
|
-
text?: string;
|
|
43
|
-
error?: string;
|
|
44
|
-
rateLimit?: RateLimitInfo;
|
|
45
|
-
artifacts?: Record<string, unknown>;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
export interface ProviderEvent {
|
|
49
|
-
type: string;
|
|
50
|
-
data?: unknown;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
export interface TurnRequest {
|
|
54
|
-
sessionId: string;
|
|
55
|
-
turnId: string;
|
|
56
|
-
agent: AgentSpec;
|
|
57
|
-
profile: Profile;
|
|
58
|
-
prompt: string;
|
|
59
|
-
signal?: AbortSignal;
|
|
60
|
-
/** Receipt from an earlier, possibly ambiguous, submission. */
|
|
61
|
-
receipt?: string;
|
|
62
|
-
onReceipt?: (id: string) => void;
|
|
63
|
-
onEvent?: (event: ProviderEvent) => void;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
export interface SendRequest {
|
|
67
|
-
sessionId: string;
|
|
68
|
-
agent: AgentSpec;
|
|
69
|
-
profile: Profile;
|
|
70
|
-
prompt: string;
|
|
71
|
-
delivery: "steer" | "queue";
|
|
72
|
-
messageId: string;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
export interface CancelRequest {
|
|
76
|
-
sessionId: string;
|
|
77
|
-
agent: AgentSpec;
|
|
78
|
-
profile: Profile;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
export interface ProviderAdapter {
|
|
82
|
-
id: string;
|
|
83
|
-
open(
|
|
84
|
-
agent: AgentSpec,
|
|
85
|
-
profile: Profile,
|
|
86
|
-
session?: SessionConfiguration,
|
|
87
|
-
): Promise<string>;
|
|
88
|
-
turn(request: TurnRequest): Promise<TurnResult>;
|
|
89
|
-
reconcile?(request: TurnRequest): Promise<TurnResult | undefined>;
|
|
90
|
-
send(request: SendRequest): Promise<{ receipt?: string }>;
|
|
91
|
-
cancel(request: CancelRequest): Promise<void>;
|
|
92
|
-
doctor(profile: Profile): Promise<unknown>;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
export interface SessionPermission {
|
|
96
|
-
action: string;
|
|
97
|
-
resource: string;
|
|
98
|
-
effect: "allow" | "deny";
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
export interface SessionConfiguration {
|
|
102
|
-
instructions?: string;
|
|
103
|
-
permissions?: readonly SessionPermission[];
|
|
104
|
-
}
|
|
1
|
+
import type { Profile, ProviderModel } from "@nones/agentflow-core/types";
|
|
2
|
+
|
|
3
|
+
export type {
|
|
4
|
+
AgentSpec,
|
|
5
|
+
CancelRequest,
|
|
6
|
+
Profile,
|
|
7
|
+
ProviderAdapter,
|
|
8
|
+
ProviderEvent,
|
|
9
|
+
RateLimitInfo,
|
|
10
|
+
SendRequest,
|
|
11
|
+
SessionConfiguration,
|
|
12
|
+
SessionPermission,
|
|
13
|
+
TurnRequest,
|
|
14
|
+
TurnResult,
|
|
15
|
+
TurnStatus,
|
|
16
|
+
} from "@nones/agentflow-core/types";
|
|
105
17
|
|
|
106
18
|
export interface ModelRef {
|
|
107
19
|
providerID: string;
|
|
108
20
|
id: string;
|
|
109
21
|
}
|
|
110
22
|
|
|
23
|
+
/**
|
|
24
|
+
* One model the connected local endpoint exposes. `id` is the exact
|
|
25
|
+
* `provider/model` string usable verbatim in agent or profile configuration.
|
|
26
|
+
* `provider` is the separate provider id when it is known.
|
|
27
|
+
*/
|
|
28
|
+
export type ActiveModel = ProviderModel;
|
|
29
|
+
|
|
111
30
|
/**
|
|
112
31
|
* Authentication is always supplied as a reference. The HTTP client asks the
|
|
113
32
|
* trusted host application to resolve the reference; it never reads token
|
|
@@ -163,6 +82,11 @@ export interface OpenCodeProfileSettings {
|
|
|
163
82
|
headers?: Record<string, string>;
|
|
164
83
|
/** Disable SSE observation (message/wait polling is still used). */
|
|
165
84
|
eventStream?: boolean;
|
|
85
|
+
/**
|
|
86
|
+
* Opt in to mirroring normalized visible history into the host store. Off by
|
|
87
|
+
* default; `true` or `"enabled"` enable it, anything else leaves it off.
|
|
88
|
+
*/
|
|
89
|
+
historyIntake?: boolean | "enabled" | "disabled";
|
|
166
90
|
}
|
|
167
91
|
|
|
168
92
|
export interface OpenCodeAdapterOptions {
|