@cline/shared 0.0.38-nightly.1778113663

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 (71) hide show
  1. package/README.md +47 -0
  2. package/dist/agent.d.ts +397 -0
  3. package/dist/agents/index.d.ts +1 -0
  4. package/dist/agents/types.d.ts +959 -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 +173 -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 +468 -0
  23. package/dist/index.browser.d.ts +57 -0
  24. package/dist/index.browser.js +76 -0
  25. package/dist/index.d.ts +63 -0
  26. package/dist/index.js +149 -0
  27. package/dist/llms/ai-sdk-format.d.ts +42 -0
  28. package/dist/llms/gateway.d.ts +117 -0
  29. package/dist/llms/messages.d.ts +147 -0
  30. package/dist/llms/model-info.d.ts +112 -0
  31. package/dist/llms/reasoning-effort.d.ts +21 -0
  32. package/dist/llms/requests.d.ts +2 -0
  33. package/dist/llms/tools.d.ts +86 -0
  34. package/dist/logging/logger.d.ts +37 -0
  35. package/dist/parse/error.d.ts +2 -0
  36. package/dist/parse/headers/utils.d.ts +1 -0
  37. package/dist/parse/json.d.ts +3 -0
  38. package/dist/parse/shell.d.ts +2 -0
  39. package/dist/parse/string.d.ts +4 -0
  40. package/dist/parse/time.d.ts +9 -0
  41. package/dist/parse/zod.d.ts +12 -0
  42. package/dist/prompt/cline.d.ts +24 -0
  43. package/dist/prompt/format.d.ts +11 -0
  44. package/dist/prompt/system.d.ts +2 -0
  45. package/dist/remote-config/constants.d.ts +5 -0
  46. package/dist/remote-config/schema.d.ts +408 -0
  47. package/dist/rpc/index.d.ts +5 -0
  48. package/dist/rpc/runtime.d.ts +320 -0
  49. package/dist/rpc/team-progress.d.ts +53 -0
  50. package/dist/runtime/build-env.d.ts +13 -0
  51. package/dist/runtime/hub-daemon-env.d.ts +2 -0
  52. package/dist/services/telemetry-config.d.ts +6 -0
  53. package/dist/services/telemetry.d.ts +117 -0
  54. package/dist/session/hook-context.d.ts +12 -0
  55. package/dist/session/index.d.ts +1 -0
  56. package/dist/session/records.d.ts +31 -0
  57. package/dist/session/runtime-config.d.ts +26 -0
  58. package/dist/session/runtime-env.d.ts +8 -0
  59. package/dist/session/workspace.d.ts +28 -0
  60. package/dist/storage/index.d.ts +1 -0
  61. package/dist/storage/index.js +1 -0
  62. package/dist/storage/paths.d.ts +86 -0
  63. package/dist/team/index.d.ts +2 -0
  64. package/dist/team/schema.d.ts +411 -0
  65. package/dist/team/types.d.ts +196 -0
  66. package/dist/tools/create.d.ts +22 -0
  67. package/dist/types/auth.d.ts +20 -0
  68. package/dist/types/index.d.ts +2 -0
  69. package/dist/types/vcr.d.ts +12 -0
  70. package/dist/vcr.d.ts +39 -0
  71. package/package.json +65 -0
@@ -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,12 @@
1
+ /** A single recorded HTTP interaction (nock-compatible shape). */
2
+ export interface VcrRecording {
3
+ scope: string;
4
+ method: string;
5
+ path: string;
6
+ body?: string;
7
+ status: number;
8
+ response: unknown;
9
+ responseIsBinary: boolean;
10
+ /** Content-Type header from the original response (captured at record time). */
11
+ contentType?: string;
12
+ }
package/dist/vcr.d.ts ADDED
@@ -0,0 +1,39 @@
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_SSE_DELAY - Milliseconds between SSE chunks during playback (default: 100).
21
+ * Set to 0 for instant delivery.
22
+ *
23
+ * Usage:
24
+ * # Record only inference requests
25
+ * CLINE_VCR=record CLINE_VCR_CASSETTE=./fixtures/my-test.json clite task "hello"
26
+ *
27
+ * # Replay — auth/S3/etc. requests go through normally, only inference is mocked
28
+ * CLINE_VCR=playback CLINE_VCR_CASSETTE=./fixtures/my-test.json clite task "hello"
29
+ *
30
+ * # Record everything (no filter)
31
+ * CLINE_VCR=record CLINE_VCR_FILTER="" CLINE_VCR_CASSETTE=./fixtures/all.json clite task "hello"
32
+ */
33
+ /**
34
+ * Initialize VCR mode based on environment variables.
35
+ * Must be called early in startup, before HTTP requests are made.
36
+ *
37
+ * Does nothing if `CLINE_VCR` is not set.
38
+ */
39
+ export declare function initVcr(vcrMode: string | undefined): void;
package/package.json ADDED
@@ -0,0 +1,65 @@
1
+ {
2
+ "name": "@cline/shared",
3
+ "version": "0.0.38-nightly.1778113663",
4
+ "description": "Shared utilities, types, and schemas for Cline packages",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "https://github.com/cline/sdk",
8
+ "directory": "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
+ "development": "./src/index.ts",
17
+ "types": "./dist/index.d.ts",
18
+ "import": "./dist/index.js",
19
+ "default": "./dist/index.js"
20
+ },
21
+ "./browser": {
22
+ "development": "./src/index.browser.ts",
23
+ "types": "./dist/index.browser.d.ts",
24
+ "import": "./dist/index.browser.js"
25
+ },
26
+ "./types": {
27
+ "development": "./src/types/index.ts",
28
+ "types": "./dist/types/index.d.ts",
29
+ "import": "./dist/types/index.js"
30
+ },
31
+ "./storage": {
32
+ "development": "./src/storage/index.ts",
33
+ "types": "./dist/storage/index.d.ts",
34
+ "import": "./dist/storage/index.js"
35
+ },
36
+ "./db": {
37
+ "development": "./src/db/index.ts",
38
+ "types": "./dist/db/index.d.ts",
39
+ "import": "./dist/db/index.js"
40
+ },
41
+ "./automation": {
42
+ "development": "./src/automation/index.ts",
43
+ "types": "./dist/automation/index.d.ts",
44
+ "import": "./dist/automation/index.js"
45
+ }
46
+ },
47
+ "files": [
48
+ "dist"
49
+ ],
50
+ "scripts": {
51
+ "build": "BUILD_MODE=package bun bun.mts",
52
+ "clean": "rm -rf dist node_modules",
53
+ "typecheck": "bun tsc --noEmit",
54
+ "test": "bun run test:unit",
55
+ "test:unit": "vitest run --config vitest.config.ts"
56
+ },
57
+ "engines": {
58
+ "node": ">=22"
59
+ },
60
+ "dependencies": {
61
+ "jsonrepair": "^3.13.2",
62
+ "zod": "^4.3.6",
63
+ "zod-to-json-schema": "^3.25.1"
64
+ }
65
+ }