@sctg/cline-shared 3.84.0-beta.20260524130712

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 (83) hide show
  1. package/README.md +47 -0
  2. package/dist/agent.d.ts +388 -0
  3. package/dist/agents/index.d.ts +1 -0
  4. package/dist/agents/types.d.ts +967 -0
  5. package/dist/automation/index.d.ts +3 -0
  6. package/dist/automation/index.js +65 -0
  7. package/dist/automation/schemas.d.ts +89 -0
  8. package/dist/automation/types.d.ts +151 -0
  9. package/dist/connectors/events.d.ts +93 -0
  10. package/dist/connectors/options.d.ts +174 -0
  11. package/dist/cron/cron-spec-types.d.ts +94 -0
  12. package/dist/cron/index.d.ts +1 -0
  13. package/dist/db/index.d.ts +2 -0
  14. package/dist/db/index.js +80 -0
  15. package/dist/db/sqlite-db.d.ts +24 -0
  16. package/dist/dispose.d.ts +13 -0
  17. package/dist/extensions/context.d.ts +76 -0
  18. package/dist/extensions/contribution-registry.d.ts +195 -0
  19. package/dist/extensions/plugin.d.ts +1 -0
  20. package/dist/hooks/contracts.d.ts +9 -0
  21. package/dist/hooks/events.d.ts +194 -0
  22. package/dist/hub.d.ts +470 -0
  23. package/dist/index.browser.d.ts +61 -0
  24. package/dist/index.browser.js +76 -0
  25. package/dist/index.d.ts +69 -0
  26. package/dist/index.js +163 -0
  27. package/dist/llms/ai-sdk-format.d.ts +55 -0
  28. package/dist/llms/gateway.d.ts +145 -0
  29. package/dist/llms/messages.d.ts +149 -0
  30. package/dist/llms/model-info.d.ts +120 -0
  31. package/dist/llms/reasoning-effort.d.ts +21 -0
  32. package/dist/llms/requests.d.ts +2 -0
  33. package/dist/llms/tokens.d.ts +7 -0
  34. package/dist/llms/tools.d.ts +86 -0
  35. package/dist/logging/logger.d.ts +37 -0
  36. package/dist/parse/error.d.ts +2 -0
  37. package/dist/parse/headers/utils.d.ts +1 -0
  38. package/dist/parse/json.d.ts +3 -0
  39. package/dist/parse/shell.d.ts +2 -0
  40. package/dist/parse/string.d.ts +4 -0
  41. package/dist/parse/time.d.ts +9 -0
  42. package/dist/parse/zod.d.ts +12 -0
  43. package/dist/prompt/cline.d.ts +24 -0
  44. package/dist/prompt/format.d.ts +11 -0
  45. package/dist/prompt/system.d.ts +2 -0
  46. package/dist/remote-config/artifact-store.d.ts +13 -0
  47. package/dist/remote-config/blob-storage.d.ts +47 -0
  48. package/dist/remote-config/bundle.d.ts +136 -0
  49. package/dist/remote-config/constants.d.ts +5 -0
  50. package/dist/remote-config/index.d.ts +9 -0
  51. package/dist/remote-config/index.js +76 -0
  52. package/dist/remote-config/materializer.d.ts +4 -0
  53. package/dist/remote-config/paths.d.ts +10 -0
  54. package/dist/remote-config/runtime.d.ts +20 -0
  55. package/dist/remote-config/schema.d.ts +408 -0
  56. package/dist/remote-config/telemetry.d.ts +9 -0
  57. package/dist/rpc/index.d.ts +5 -0
  58. package/dist/rpc/runtime.d.ts +322 -0
  59. package/dist/rpc/team-progress.d.ts +53 -0
  60. package/dist/runtime/build-env.d.ts +13 -0
  61. package/dist/runtime/cline-environment.d.ts +17 -0
  62. package/dist/runtime/hub-daemon-env.d.ts +2 -0
  63. package/dist/services/telemetry-config.d.ts +6 -0
  64. package/dist/services/telemetry.d.ts +133 -0
  65. package/dist/session/hook-context.d.ts +12 -0
  66. package/dist/session/index.d.ts +1 -0
  67. package/dist/session/records.d.ts +31 -0
  68. package/dist/session/runtime-config.d.ts +26 -0
  69. package/dist/session/runtime-env.d.ts +8 -0
  70. package/dist/session/workspace.d.ts +28 -0
  71. package/dist/storage/index.d.ts +2 -0
  72. package/dist/storage/index.js +1 -0
  73. package/dist/storage/path-resolution.d.ts +11 -0
  74. package/dist/storage/paths.d.ts +86 -0
  75. package/dist/team/index.d.ts +2 -0
  76. package/dist/team/schema.d.ts +411 -0
  77. package/dist/team/types.d.ts +196 -0
  78. package/dist/tools/create.d.ts +22 -0
  79. package/dist/types/auth.d.ts +20 -0
  80. package/dist/types/index.d.ts +2 -0
  81. package/dist/types/vcr.d.ts +14 -0
  82. package/dist/vcr.d.ts +41 -0
  83. package/package.json +63 -0
@@ -0,0 +1,196 @@
1
+ /**
2
+ * Team data types and interfaces.
3
+ *
4
+ * These are the pure data-shape contracts for the multi-agent team system.
5
+ * They intentionally avoid referencing @cline/agents types so that shared
6
+ * can remain dependency-free of the agents package.
7
+ */
8
+ export type TeamTaskStatus = "pending" | "in_progress" | "blocked" | "completed";
9
+ export interface TeamTask {
10
+ id: string;
11
+ title: string;
12
+ description: string;
13
+ status: TeamTaskStatus;
14
+ createdAt: Date;
15
+ updatedAt: Date;
16
+ createdBy: string;
17
+ assignee?: string;
18
+ dependsOn: string[];
19
+ summary?: string;
20
+ }
21
+ export interface TeamTaskListItem extends TeamTask {
22
+ isReady: boolean;
23
+ blockedBy: string[];
24
+ }
25
+ export type MissionLogKind = "progress" | "handoff" | "blocked" | "decision" | "done" | "error";
26
+ export interface MissionLogEntry {
27
+ id: string;
28
+ ts: Date;
29
+ teamId: string;
30
+ agentId: string;
31
+ taskId?: string;
32
+ kind: MissionLogKind;
33
+ summary: string;
34
+ evidence?: string[];
35
+ nextAction?: string;
36
+ }
37
+ export interface TeamMailboxMessage {
38
+ id: string;
39
+ teamId: string;
40
+ fromAgentId: string;
41
+ toAgentId: string;
42
+ subject: string;
43
+ body: string;
44
+ taskId?: string;
45
+ sentAt: Date;
46
+ readAt?: Date;
47
+ }
48
+ export interface TeamMemberSnapshot {
49
+ agentId: string;
50
+ role: "lead" | "teammate";
51
+ description?: string;
52
+ status: "idle" | "running" | "stopped";
53
+ }
54
+ export interface TeammateLifecycleSpec {
55
+ rolePrompt: string;
56
+ modelId?: string;
57
+ maxIterations?: number;
58
+ runtimeAgentId?: string;
59
+ conversationId?: string;
60
+ parentAgentId?: string | null;
61
+ }
62
+ export type TeamRunStatus = "queued" | "running" | "completed" | "failed" | "cancelled" | "interrupted";
63
+ /**
64
+ * Shared representation of a teammate run record.
65
+ *
66
+ * The `result` field is typed as `unknown` at the shared contract level
67
+ * because the concrete type (`AgentResult`) lives in `@cline/agents`.
68
+ * Consuming packages narrow this via their own type assertions.
69
+ */
70
+ export interface TeamRunRecord {
71
+ id: string;
72
+ agentId: string;
73
+ taskId?: string;
74
+ status: TeamRunStatus;
75
+ message: string;
76
+ priority: number;
77
+ retryCount: number;
78
+ maxRetries: number;
79
+ nextAttemptAt?: Date;
80
+ continueConversation?: boolean;
81
+ startedAt: Date;
82
+ endedAt?: Date;
83
+ leaseOwner?: string;
84
+ heartbeatAt?: Date;
85
+ lastProgressAt?: Date;
86
+ lastProgressMessage?: string;
87
+ currentActivity?: string;
88
+ result?: unknown;
89
+ error?: string;
90
+ }
91
+ export type TeamOutcomeStatus = "draft" | "in_review" | "finalized";
92
+ export interface TeamOutcome {
93
+ id: string;
94
+ teamId: string;
95
+ title: string;
96
+ status: TeamOutcomeStatus;
97
+ requiredSections: string[];
98
+ createdBy: string;
99
+ createdAt: Date;
100
+ finalizedAt?: Date;
101
+ }
102
+ export type TeamOutcomeFragmentStatus = "draft" | "reviewed" | "rejected";
103
+ export interface TeamOutcomeFragment {
104
+ id: string;
105
+ teamId: string;
106
+ outcomeId: string;
107
+ section: string;
108
+ sourceAgentId: string;
109
+ sourceRunId?: string;
110
+ content: string;
111
+ status: TeamOutcomeFragmentStatus;
112
+ reviewedBy?: string;
113
+ reviewedAt?: Date;
114
+ createdAt: Date;
115
+ }
116
+ export interface TeamRuntimeSnapshot {
117
+ teamId: string;
118
+ teamName: string;
119
+ members: TeamMemberSnapshot[];
120
+ taskCounts: Record<TeamTaskStatus, number>;
121
+ unreadMessages: number;
122
+ missionLogEntries: number;
123
+ activeRuns: number;
124
+ queuedRuns: number;
125
+ outcomeCounts: Record<TeamOutcomeStatus, number>;
126
+ }
127
+ export interface TeamRuntimeState {
128
+ teamId: string;
129
+ teamName: string;
130
+ members: TeamMemberSnapshot[];
131
+ tasks: TeamTask[];
132
+ mailbox: TeamMailboxMessage[];
133
+ missionLog: MissionLogEntry[];
134
+ runs: TeamRunRecord[];
135
+ outcomes: TeamOutcome[];
136
+ outcomeFragments: TeamOutcomeFragment[];
137
+ }
138
+ export interface AppendMissionLogInput {
139
+ agentId: string;
140
+ taskId?: string;
141
+ kind: MissionLogKind;
142
+ summary: string;
143
+ evidence?: string[];
144
+ nextAction?: string;
145
+ }
146
+ export interface CreateTeamTaskInput {
147
+ title: string;
148
+ description: string;
149
+ createdBy: string;
150
+ dependsOn?: string[];
151
+ assignee?: string;
152
+ }
153
+ export interface CreateTeamOutcomeInput {
154
+ title: string;
155
+ requiredSections: string[];
156
+ createdBy: string;
157
+ }
158
+ export interface AttachTeamOutcomeFragmentInput {
159
+ outcomeId: string;
160
+ section: string;
161
+ sourceAgentId: string;
162
+ sourceRunId?: string;
163
+ content: string;
164
+ }
165
+ export interface ReviewTeamOutcomeFragmentInput {
166
+ fragmentId: string;
167
+ reviewedBy: string;
168
+ approved: boolean;
169
+ }
170
+ export interface RouteToTeammateOptions {
171
+ taskId?: string;
172
+ fromAgentId?: string;
173
+ continueConversation?: boolean;
174
+ }
175
+ export declare enum TeamMessageType {
176
+ TaskStart = "task_start",
177
+ TaskEnd = "task_end",
178
+ AgentEvent = "agent_event",
179
+ TeammateSpawned = "teammate_spawned",
180
+ TeammateShutdown = "teammate_shutdown",
181
+ TeamTaskUpdated = "team_task_updated",
182
+ TeamMessage = "team_message",
183
+ TeamMissionLog = "team_mission_log",
184
+ TeamTaskCompleted = "team_task_completed",
185
+ RunStarted = "run_started",
186
+ RunQueued = "run_queued",
187
+ RunProgress = "run_progress",
188
+ RunCompleted = "run_completed",
189
+ RunFailed = "run_failed",
190
+ RunCancelled = "run_cancelled",
191
+ RunInterrupted = "run_interrupted",
192
+ OutcomeCreated = "outcome_created",
193
+ OutcomeFragmentAttached = "outcome_fragment_attached",
194
+ OutcomeFragmentReviewed = "outcome_fragment_reviewed",
195
+ OutcomeFinalized = "outcome_finalized"
196
+ }
@@ -0,0 +1,22 @@
1
+ import { z } from "zod";
2
+ import type { AgentTool, AgentToolContext } from "../agent";
3
+ export declare function createTool<TInput, TOutput>(config: {
4
+ name: string;
5
+ description: string;
6
+ inputSchema: Record<string, unknown>;
7
+ execute: (input: TInput, context: AgentToolContext) => Promise<TOutput>;
8
+ lifecycle?: AgentTool<TInput, TOutput>["lifecycle"];
9
+ timeoutMs?: number;
10
+ retryable?: boolean;
11
+ maxRetries?: number;
12
+ }): AgentTool<TInput, TOutput>;
13
+ export declare function createTool<TSchema extends z.ZodTypeAny, TOutput>(config: {
14
+ name: string;
15
+ description: string;
16
+ inputSchema: TSchema;
17
+ execute: (input: z.infer<TSchema>, context: AgentToolContext) => Promise<TOutput>;
18
+ lifecycle?: AgentTool<z.infer<TSchema>, TOutput>["lifecycle"];
19
+ timeoutMs?: number;
20
+ retryable?: boolean;
21
+ maxRetries?: number;
22
+ }): AgentTool<z.infer<TSchema>, TOutput>;
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Canonical list of OAuth provider IDs managed by the platform.
3
+ * Derive sets, types, and guards from this single source of truth.
4
+ */
5
+ export declare const OAUTH_PROVIDER_IDS: readonly ["cline", "oca", "openai-codex"];
6
+ export type OAuthProviderId = (typeof OAUTH_PROVIDER_IDS)[number];
7
+ /**
8
+ * Check whether a provider ID is a managed OAuth provider.
9
+ */
10
+ export declare function isOAuthProviderId(providerId: string): providerId is OAuthProviderId;
11
+ /**
12
+ * Error‑message sub-strings that indicate an auth / credential failure.
13
+ * Used to decide whether a failed API call should trigger an OAuth refresh.
14
+ */
15
+ export declare const AUTH_ERROR_PATTERNS: readonly ["401", "403", "unauthorized", "forbidden", "invalid token", "expired token", "authentication"];
16
+ /**
17
+ * Returns `true` when `error` looks like an authentication failure
18
+ * *and* the provider is a managed OAuth provider.
19
+ */
20
+ export declare function isLikelyAuthError(error: unknown, providerId: string): boolean;
@@ -0,0 +1,2 @@
1
+ export * from "./auth";
2
+ export * from "./vcr";
@@ -0,0 +1,14 @@
1
+ /** A single recorded HTTP interaction. */
2
+ export interface VcrRecording {
3
+ scope: string;
4
+ method: string;
5
+ path: string;
6
+ body?: string;
7
+ /** Sanitized canonical request body used as an optional playback contract. */
8
+ requestBody?: string;
9
+ status: number;
10
+ response: unknown;
11
+ responseIsBinary: boolean;
12
+ /** Content-Type header from the original response (captured at record time). */
13
+ contentType?: string;
14
+ }
package/dist/vcr.d.ts ADDED
@@ -0,0 +1,41 @@
1
+ /**
2
+ * VCR (Video Cassette Recorder) for HTTP requests.
3
+ *
4
+ * Patches `globalThis.fetch` to record and replay HTTP interactions,
5
+ * enabling deterministic testing without making real API calls.
6
+ *
7
+ * Unlike nock (which patches Node's `http` module), this works by wrapping
8
+ * `globalThis.fetch` directly, catching all HTTP traffic in this codebase
9
+ * including calls made through the OpenAI, Anthropic, Gemini, and Vercel AI
10
+ * SDKs (all of which delegate to the global fetch).
11
+ *
12
+ * Environment variables:
13
+ * CLINE_VCR - "record" to record HTTP requests, "playback" to replay them
14
+ * CLINE_VCR_CASSETTE - Path to the cassette file (default: ./vcr-cassette.json)
15
+ * CLINE_VCR_FILTER - Substring to filter recorded/replayed request paths.
16
+ * When set to a non-empty string, only requests whose path
17
+ * contains this substring are recorded/replayed; all other
18
+ * requests pass through to the real network.
19
+ * When empty or unset, ALL requests are intercepted (no filter).
20
+ * CLINE_VCR_INCLUDE_REQUEST_BODY - "1" to save sanitized request bodies and
21
+ * assert them during playback.
22
+ * CLINE_VCR_SSE_DELAY - Milliseconds between SSE chunks during playback (default: 100).
23
+ * Set to 0 for instant delivery.
24
+ *
25
+ * Usage:
26
+ * # Record only inference requests
27
+ * CLINE_VCR=record CLINE_VCR_CASSETTE=./fixtures/my-test.json cline task "hello"
28
+ *
29
+ * # Replay: auth/S3/etc. requests go through normally, only inference is mocked
30
+ * CLINE_VCR=playback CLINE_VCR_CASSETTE=./fixtures/my-test.json cline task "hello"
31
+ *
32
+ * # Record everything (no filter)
33
+ * CLINE_VCR=record CLINE_VCR_FILTER="" CLINE_VCR_CASSETTE=./fixtures/all.json cline task "hello"
34
+ */
35
+ /**
36
+ * Initialize VCR mode based on environment variables.
37
+ * Must be called early in startup, before HTTP requests are made.
38
+ *
39
+ * Does nothing if `CLINE_VCR` is not set.
40
+ */
41
+ export declare function initVcr(vcrMode: string | undefined): void;
package/package.json ADDED
@@ -0,0 +1,63 @@
1
+ {
2
+ "name": "@sctg/cline-shared",
3
+ "version": "3.84.0-beta.20260524130712",
4
+ "description": "Shared utilities, types, and schemas for Cline packages",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "https://github.com/cline/cline",
8
+ "directory": "sdk/packages/shared"
9
+ },
10
+ "type": "module",
11
+ "main": "dist/index.js",
12
+ "types": "dist/index.d.ts",
13
+ "exports": {
14
+ ".": {
15
+ "browser": "./dist/index.browser.js",
16
+ "types": "./dist/index.d.ts",
17
+ "import": "./dist/index.js",
18
+ "default": "./dist/index.js"
19
+ },
20
+ "./browser": {
21
+ "types": "./dist/index.browser.d.ts",
22
+ "import": "./dist/index.browser.js"
23
+ },
24
+ "./types": {
25
+ "types": "./dist/types/index.d.ts",
26
+ "import": "./dist/types/index.js"
27
+ },
28
+ "./storage": {
29
+ "types": "./dist/storage/index.d.ts",
30
+ "import": "./dist/storage/index.js"
31
+ },
32
+ "./db": {
33
+ "types": "./dist/db/index.d.ts",
34
+ "import": "./dist/db/index.js"
35
+ },
36
+ "./automation": {
37
+ "types": "./dist/automation/index.d.ts",
38
+ "import": "./dist/automation/index.js"
39
+ },
40
+ "./remote-config": {
41
+ "types": "./dist/remote-config/index.d.ts",
42
+ "import": "./dist/remote-config/index.js"
43
+ }
44
+ },
45
+ "files": [
46
+ "dist"
47
+ ],
48
+ "scripts": {
49
+ "build": "BUILD_MODE=package bun bun.mts",
50
+ "typecheck": "bun tsc --noEmit",
51
+ "test": "bun run test:unit",
52
+ "test:unit": "vitest run --config vitest.config.ts"
53
+ },
54
+ "engines": {
55
+ "node": ">=22"
56
+ },
57
+ "dependencies": {
58
+ "aws4fetch": "^1.0.20",
59
+ "jsonrepair": "^3.13.2",
60
+ "zod": "^4.3.6",
61
+ "zod-to-json-schema": "^3.25.1"
62
+ }
63
+ }