ultracode-shared 1.3.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 +30 -0
- package/dist/constants.d.ts +33 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +37 -0
- package/dist/constants.js.map +1 -0
- package/dist/errors.d.ts +113 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +155 -0
- package/dist/errors.js.map +1 -0
- package/dist/events/EventBus.d.ts +36 -0
- package/dist/events/EventBus.d.ts.map +1 -0
- package/dist/events/EventBus.js +83 -0
- package/dist/events/EventBus.js.map +1 -0
- package/dist/index.d.ts +30 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +34 -0
- package/dist/index.js.map +1 -0
- package/dist/logger.d.ts +65 -0
- package/dist/logger.d.ts.map +1 -0
- package/dist/logger.js +74 -0
- package/dist/logger.js.map +1 -0
- package/dist/types/agent.d.ts +68 -0
- package/dist/types/agent.d.ts.map +1 -0
- package/dist/types/agent.js +9 -0
- package/dist/types/agent.js.map +1 -0
- package/dist/types/config.d.ts +265 -0
- package/dist/types/config.d.ts.map +1 -0
- package/dist/types/config.js +103 -0
- package/dist/types/config.js.map +1 -0
- package/dist/types/events.d.ts +78 -0
- package/dist/types/events.d.ts.map +1 -0
- package/dist/types/events.js +10 -0
- package/dist/types/events.js.map +1 -0
- package/dist/types/memory.d.ts +53 -0
- package/dist/types/memory.d.ts.map +1 -0
- package/dist/types/memory.js +9 -0
- package/dist/types/memory.js.map +1 -0
- package/dist/types/provider.d.ts +129 -0
- package/dist/types/provider.d.ts.map +1 -0
- package/dist/types/provider.js +10 -0
- package/dist/types/provider.js.map +1 -0
- package/dist/types/tool.d.ts +122 -0
- package/dist/types/tool.d.ts.map +1 -0
- package/dist/types/tool.js +11 -0
- package/dist/types/tool.js.map +1 -0
- package/dist/types/versioning.d.ts +141 -0
- package/dist/types/versioning.d.ts.map +1 -0
- package/dist/types/versioning.js +8 -0
- package/dist/types/versioning.js.map +1 -0
- package/dist/utils/async.d.ts +17 -0
- package/dist/utils/async.d.ts.map +1 -0
- package/dist/utils/async.js +45 -0
- package/dist/utils/async.js.map +1 -0
- package/dist/utils/id.d.ts +13 -0
- package/dist/utils/id.d.ts.map +1 -0
- package/dist/utils/id.js +17 -0
- package/dist/utils/id.js.map +1 -0
- package/dist/utils/index.d.ts +11 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +10 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/math.d.ts +15 -0
- package/dist/utils/math.d.ts.map +1 -0
- package/dist/utils/math.js +25 -0
- package/dist/utils/math.js.map +1 -0
- package/dist/utils/object.d.ts +36 -0
- package/dist/utils/object.d.ts.map +1 -0
- package/dist/utils/object.js +122 -0
- package/dist/utils/object.js.map +1 -0
- package/dist/utils/serializeError.d.ts +15 -0
- package/dist/utils/serializeError.d.ts.map +1 -0
- package/dist/utils/serializeError.js +69 -0
- package/dist/utils/serializeError.js.map +1 -0
- package/dist/utils/truncate.d.ts +29 -0
- package/dist/utils/truncate.d.ts.map +1 -0
- package/dist/utils/truncate.js +42 -0
- package/dist/utils/truncate.js.map +1 -0
- package/package.json +39 -0
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Event-bus contracts.
|
|
3
|
+
*
|
|
4
|
+
* UltraCode is event-driven: subsystems publish typed {@link UltraCodeEvent}s
|
|
5
|
+
* onto an {@link IEventBus}. Events are a discriminated union keyed by `type`.
|
|
6
|
+
* The concrete {@link import("../events/EventBus.js").EventBus} implementation
|
|
7
|
+
* isolates handler failures so one bad subscriber cannot break others.
|
|
8
|
+
*/
|
|
9
|
+
import type { SerializedError } from "../errors.js";
|
|
10
|
+
import type { VersionSuggestion } from "./versioning.js";
|
|
11
|
+
/** A tool finished executing. */
|
|
12
|
+
export interface ToolExecutedEvent {
|
|
13
|
+
type: "tool.executed";
|
|
14
|
+
/** Name of the executed tool. */
|
|
15
|
+
toolName: string;
|
|
16
|
+
/** Whether the execution succeeded. */
|
|
17
|
+
ok: boolean;
|
|
18
|
+
/** Execution wall-clock time in milliseconds. */
|
|
19
|
+
durationMs: number;
|
|
20
|
+
}
|
|
21
|
+
/** The active agent changed. */
|
|
22
|
+
export interface AgentSwitchedEvent {
|
|
23
|
+
type: "agent.switched";
|
|
24
|
+
/** Previous agent name (`null` at startup). */
|
|
25
|
+
from: string | null;
|
|
26
|
+
/** New agent name. */
|
|
27
|
+
to: string;
|
|
28
|
+
}
|
|
29
|
+
/** A session started. */
|
|
30
|
+
export interface SessionStartedEvent {
|
|
31
|
+
type: "session.started";
|
|
32
|
+
/** Identifier of the started session. */
|
|
33
|
+
sessionId: string;
|
|
34
|
+
}
|
|
35
|
+
/** A session ended. */
|
|
36
|
+
export interface SessionEndedEvent {
|
|
37
|
+
type: "session.ended";
|
|
38
|
+
/** Identifier of the ended session. */
|
|
39
|
+
sessionId: string;
|
|
40
|
+
}
|
|
41
|
+
/** An error occurred somewhere in the pipeline. */
|
|
42
|
+
export interface ErrorEvent {
|
|
43
|
+
type: "error";
|
|
44
|
+
/** The serialised error. */
|
|
45
|
+
error: SerializedError;
|
|
46
|
+
}
|
|
47
|
+
/** A version was suggested by the versioning engine. */
|
|
48
|
+
export interface VersionSuggestedEvent {
|
|
49
|
+
type: "version.suggested";
|
|
50
|
+
/** The suggestion produced. */
|
|
51
|
+
suggestion: VersionSuggestion;
|
|
52
|
+
}
|
|
53
|
+
/** The full event union published on the bus. */
|
|
54
|
+
export type UltraCodeEvent = ToolExecutedEvent | AgentSwitchedEvent | SessionStartedEvent | SessionEndedEvent | ErrorEvent | VersionSuggestedEvent;
|
|
55
|
+
/** Discriminator literal of any {@link UltraCodeEvent}. */
|
|
56
|
+
export type UltraCodeEventType = UltraCodeEvent["type"];
|
|
57
|
+
/** Narrow an event to its concrete shape by `type`. */
|
|
58
|
+
export type EventOfType<T extends UltraCodeEventType> = Extract<UltraCodeEvent, {
|
|
59
|
+
type: T;
|
|
60
|
+
}>;
|
|
61
|
+
/** Handler for a specific event type. */
|
|
62
|
+
export type EventHandler<T extends UltraCodeEventType> = (event: EventOfType<T>) => void;
|
|
63
|
+
/**
|
|
64
|
+
* The event-bus interface.
|
|
65
|
+
*
|
|
66
|
+
* Contract:
|
|
67
|
+
* - `emit` synchronously invokes all subscribers for the event's `type`; a
|
|
68
|
+
* throwing handler must not prevent other handlers from running.
|
|
69
|
+
* - `on` returns an unsubscribe function that is safe to call at any time,
|
|
70
|
+
* including from within a handler during an active `emit`.
|
|
71
|
+
*/
|
|
72
|
+
export interface IEventBus {
|
|
73
|
+
/** Publish an event to all matching subscribers. */
|
|
74
|
+
emit(event: UltraCodeEvent): void;
|
|
75
|
+
/** Subscribe to a specific event type; returns an unsubscribe function. */
|
|
76
|
+
on<T extends UltraCodeEventType>(type: T, handler: EventHandler<T>): () => void;
|
|
77
|
+
}
|
|
78
|
+
//# sourceMappingURL=events.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../src/types/events.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAEzD,iCAAiC;AACjC,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,eAAe,CAAC;IACtB,iCAAiC;IACjC,QAAQ,EAAE,MAAM,CAAC;IACjB,uCAAuC;IACvC,EAAE,EAAE,OAAO,CAAC;IACZ,iDAAiD;IACjD,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,gCAAgC;AAChC,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,gBAAgB,CAAC;IACvB,+CAA+C;IAC/C,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,sBAAsB;IACtB,EAAE,EAAE,MAAM,CAA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AAC;CACjF"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Event-bus contracts.
|
|
3
|
+
*
|
|
4
|
+
* UltraCode is event-driven: subsystems publish typed {@link UltraCodeEvent}s
|
|
5
|
+
* onto an {@link IEventBus}. Events are a discriminated union keyed by `type`.
|
|
6
|
+
* The concrete {@link import("../events/EventBus.js").EventBus} implementation
|
|
7
|
+
* isolates handler failures so one bad subscriber cannot break others.
|
|
8
|
+
*/
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=events.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"events.js","sourceRoot":"","sources":["../../src/types/events.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Session/memory contracts.
|
|
3
|
+
*
|
|
4
|
+
* A session is an ordered conversation owned by an agent. All timestamps are
|
|
5
|
+
* ISO-8601 strings (UTC). The {@link ISessionStore} abstracts persistence
|
|
6
|
+
* (SQLite, JSON files, in-memory, …).
|
|
7
|
+
*/
|
|
8
|
+
import type { ChatMessage } from "./provider.js";
|
|
9
|
+
/** Lightweight session header, returned by listings. */
|
|
10
|
+
export interface SessionMeta {
|
|
11
|
+
/** Unique session identifier. */
|
|
12
|
+
id: string;
|
|
13
|
+
/** Human-readable title (derived or user-supplied). */
|
|
14
|
+
title: string;
|
|
15
|
+
/** Creation time, ISO-8601 (UTC). */
|
|
16
|
+
createdAt: string;
|
|
17
|
+
/** Last-modification time, ISO-8601 (UTC). */
|
|
18
|
+
updatedAt: string;
|
|
19
|
+
/** Name of the agent that owns the session. */
|
|
20
|
+
agentName: string;
|
|
21
|
+
/** Number of messages currently stored. */
|
|
22
|
+
messageCount: number;
|
|
23
|
+
}
|
|
24
|
+
/** A full session: its header plus the complete message history. */
|
|
25
|
+
export interface SessionRecord extends SessionMeta {
|
|
26
|
+
/** Ordered conversation history. */
|
|
27
|
+
messages: ChatMessage[];
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Persistence boundary for sessions.
|
|
31
|
+
*
|
|
32
|
+
* Contract:
|
|
33
|
+
* - Mutating methods bump `updatedAt` and keep `messageCount` consistent.
|
|
34
|
+
* - `get` resolves `null` for an unknown id (it does not throw).
|
|
35
|
+
* - `delete` resolves `false` when the id did not exist.
|
|
36
|
+
* - Hard storage failures reject with
|
|
37
|
+
* {@link import("../errors.js").SessionError}.
|
|
38
|
+
*/
|
|
39
|
+
export interface ISessionStore {
|
|
40
|
+
/** Create a new, empty session and return its header. */
|
|
41
|
+
create(agentName: string, title?: string): Promise<SessionMeta>;
|
|
42
|
+
/** Load a full session by id, or `null` if absent. */
|
|
43
|
+
get(id: string): Promise<SessionRecord | null>;
|
|
44
|
+
/** Append messages to a session, updating its metadata. */
|
|
45
|
+
appendMessages(id: string, msgs: ChatMessage[]): Promise<void>;
|
|
46
|
+
/** List session headers, most-recent first, capped by `limit` when given. */
|
|
47
|
+
list(limit?: number): Promise<SessionMeta[]>;
|
|
48
|
+
/** Delete a session; resolves `true` if it existed. */
|
|
49
|
+
delete(id: string): Promise<boolean>;
|
|
50
|
+
/** Retain only the `maxSessions` most-recent sessions; returns the count removed. */
|
|
51
|
+
prune(maxSessions: number): Promise<number>;
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=memory.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"memory.d.ts","sourceRoot":"","sources":["../../src/types/memory.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAEjD,wDAAwD;AACxD,MAAM,WAAW,WAAW;IAC1B,iCAAiC;IACjC,EAAE,EAAE,MAAM,CAAC;IACX,uDAAuD;IACvD,KAAK,EAAE,MAAM,CAAC;IACd,qCAAqC;IACrC,SAAS,EAAE,MAAM,CAAC;IAClB,8CAA8C;IAC9C,SAAS,EAAE,MAAM,CAAC;IAClB,+CAA+C;IAC/C,SAAS,EAAE,MAAM,CAAC;IAClB,2CAA2C;IAC3C,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,oEAAoE;AACpE,MAAM,WAAW,aAAc,SAAQ,WAAW;IAChD,oCAAoC;IACpC,QAAQ,EAAE,WAAW,EAAE,CAAC;CACzB;AAED;;;;;;;;;GASG;AACH,MAAM,WAAW,aAAa;IAC5B,yDAAyD;IACzD,MAAM,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;IAChE,sDAAsD;IACtD,GAAG,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC,CAAC;IAC/C,2DAA2D;IAC3D,cAAc,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,WAAW,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC/D,6EAA6E;IAC7E,IAAI,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC,CAAC;IAC7C,uDAAuD;IACvD,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IACrC,qFAAqF;IACrF,KAAK,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;CAC7C"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Session/memory contracts.
|
|
3
|
+
*
|
|
4
|
+
* A session is an ordered conversation owned by an agent. All timestamps are
|
|
5
|
+
* ISO-8601 strings (UTC). The {@link ISessionStore} abstracts persistence
|
|
6
|
+
* (SQLite, JSON files, in-memory, …).
|
|
7
|
+
*/
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=memory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"memory.js","sourceRoot":"","sources":["../../src/types/memory.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG"}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* LLM provider contracts.
|
|
3
|
+
*
|
|
4
|
+
* Providers are the integration boundary to a model backend (Mistral,
|
|
5
|
+
* Anthropic, OpenAI, local). Unlike tools, **providers throw on failure** —
|
|
6
|
+
* specifically {@link ProviderError} (with `retryable` set appropriately) — so
|
|
7
|
+
* the execution engine can apply retry/backoff policy.
|
|
8
|
+
*/
|
|
9
|
+
import type { ToolDefinition } from "./tool.js";
|
|
10
|
+
/** Well-known provider identifiers. */
|
|
11
|
+
export type ProviderName = "mistral" | "anthropic" | "openai" | "local";
|
|
12
|
+
/**
|
|
13
|
+
* A provider identifier. Accepts the well-known {@link ProviderName} values
|
|
14
|
+
* while remaining open to custom backends via the `string & {}` trick (which
|
|
15
|
+
* preserves literal autocompletion without collapsing to `string`).
|
|
16
|
+
*/
|
|
17
|
+
export type ProviderId = ProviderName | (string & {});
|
|
18
|
+
/** Role of a message in a chat completion. */
|
|
19
|
+
export type ChatRole = "system" | "user" | "assistant" | "tool";
|
|
20
|
+
/** A model's request to invoke a tool, emitted as part of a completion. */
|
|
21
|
+
export interface ToolCallRequest {
|
|
22
|
+
/** Provider-assigned identifier correlating the call with its result. */
|
|
23
|
+
id: string;
|
|
24
|
+
/** Name of the tool to invoke. */
|
|
25
|
+
name: string;
|
|
26
|
+
/** Parsed arguments object for the tool. */
|
|
27
|
+
arguments: Record<string, unknown>;
|
|
28
|
+
}
|
|
29
|
+
/** A single message in a conversation. */
|
|
30
|
+
export interface ChatMessage {
|
|
31
|
+
/** Message role. */
|
|
32
|
+
role: ChatRole;
|
|
33
|
+
/** Textual content. May be empty for assistant turns that only call tools. */
|
|
34
|
+
content: string;
|
|
35
|
+
/** For assistant messages: tool calls requested this turn. */
|
|
36
|
+
toolCalls?: ToolCallRequest[];
|
|
37
|
+
/** For `role: "tool"` messages: the {@link ToolCallRequest.id} being answered. */
|
|
38
|
+
toolCallId?: string;
|
|
39
|
+
/** Optional speaker/tool name (provider-specific addressing). */
|
|
40
|
+
name?: string;
|
|
41
|
+
}
|
|
42
|
+
/** Token accounting for a completion. */
|
|
43
|
+
export interface TokenUsage {
|
|
44
|
+
/** Tokens consumed by the prompt. */
|
|
45
|
+
inputTokens: number;
|
|
46
|
+
/** Tokens produced by the model. */
|
|
47
|
+
outputTokens: number;
|
|
48
|
+
}
|
|
49
|
+
/** A request for a (streaming or non-streaming) chat completion. */
|
|
50
|
+
export interface CompletionRequest {
|
|
51
|
+
/** Ordered conversation history. */
|
|
52
|
+
messages: ChatMessage[];
|
|
53
|
+
/** Target model identifier. */
|
|
54
|
+
model: string;
|
|
55
|
+
/** Upper bound on generated tokens. */
|
|
56
|
+
maxTokens?: number;
|
|
57
|
+
/** Sampling temperature, typically `0.0`–`1.0`. */
|
|
58
|
+
temperature?: number;
|
|
59
|
+
/** Tool definitions exposed to the model for this turn. */
|
|
60
|
+
tools?: ToolDefinition[];
|
|
61
|
+
/** Cancellation signal for the in-flight request. */
|
|
62
|
+
signal?: AbortSignal;
|
|
63
|
+
}
|
|
64
|
+
/** A single chunk emitted by {@link ILLMProvider.stream}. */
|
|
65
|
+
export interface CompletionChunk {
|
|
66
|
+
/**
|
|
67
|
+
* Chunk discriminator:
|
|
68
|
+
* - `"text"` — incremental assistant text in `text`.
|
|
69
|
+
* - `"tool_call"` — a (possibly partial) tool call in `toolCall`.
|
|
70
|
+
* - `"done"` — terminal chunk; `usage` is populated.
|
|
71
|
+
*/
|
|
72
|
+
type: "text" | "tool_call" | "done";
|
|
73
|
+
/** Present for `type: "text"`. */
|
|
74
|
+
text?: string;
|
|
75
|
+
/** Present for `type: "tool_call"`. */
|
|
76
|
+
toolCall?: ToolCallRequest;
|
|
77
|
+
/** Present for `type: "done"`. */
|
|
78
|
+
usage?: TokenUsage;
|
|
79
|
+
}
|
|
80
|
+
/** Reason a completion finished. */
|
|
81
|
+
export type FinishReason = "stop" | "tool_calls" | "length" | "error";
|
|
82
|
+
/** Aggregated result of a non-streaming completion. */
|
|
83
|
+
export interface CompletionResult {
|
|
84
|
+
/** Full assistant text. */
|
|
85
|
+
text: string;
|
|
86
|
+
/** Tool calls requested by the model (empty when none). */
|
|
87
|
+
toolCalls: ToolCallRequest[];
|
|
88
|
+
/** Token accounting for the call. */
|
|
89
|
+
usage: TokenUsage;
|
|
90
|
+
/** Why generation stopped. */
|
|
91
|
+
finishReason: FinishReason;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* The implementable provider interface.
|
|
95
|
+
*
|
|
96
|
+
* Contract:
|
|
97
|
+
* - All async methods **throw {@link ProviderError}** on failure; transient
|
|
98
|
+
* failures set `retryable: true`.
|
|
99
|
+
* - `stream` yields {@link CompletionChunk}s and terminates with a `"done"`
|
|
100
|
+
* chunk carrying {@link TokenUsage}.
|
|
101
|
+
* - `healthCheck` resolves `false` (rather than throwing) for a reachable but
|
|
102
|
+
* unhealthy backend; it may throw for hard configuration errors.
|
|
103
|
+
*/
|
|
104
|
+
export interface ILLMProvider {
|
|
105
|
+
/** Stable provider identifier. */
|
|
106
|
+
readonly name: ProviderId;
|
|
107
|
+
/** List model identifiers available from this provider. */
|
|
108
|
+
listModels(): Promise<string[]>;
|
|
109
|
+
/** Run a non-streaming completion. */
|
|
110
|
+
complete(req: CompletionRequest): Promise<CompletionResult>;
|
|
111
|
+
/** Run a streaming completion. */
|
|
112
|
+
stream(req: CompletionRequest): AsyncIterable<CompletionChunk>;
|
|
113
|
+
/** Lightweight liveness/auth probe. */
|
|
114
|
+
healthCheck(): Promise<boolean>;
|
|
115
|
+
}
|
|
116
|
+
/** Construction options shared by provider implementations. */
|
|
117
|
+
export interface ProviderOptions {
|
|
118
|
+
/** API key/credential. Often injected from the environment, not config. */
|
|
119
|
+
apiKey?: string;
|
|
120
|
+
/** Override base URL for self-hosted/proxy endpoints. */
|
|
121
|
+
baseUrl?: string;
|
|
122
|
+
/** Per-request timeout in milliseconds. */
|
|
123
|
+
timeoutMs: number;
|
|
124
|
+
/** Maximum retry attempts for retryable failures. */
|
|
125
|
+
maxRetries: number;
|
|
126
|
+
/** Base delay between retries in milliseconds (subject to backoff). */
|
|
127
|
+
retryDelayMs: number;
|
|
128
|
+
}
|
|
129
|
+
//# sourceMappingURL=provider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../../src/types/provider.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAEhD,uCAAuC;AACvC,MAAM,MAAM,YAAY,GAAG,SAAS,GAAG,WAAW,GAAG,QAAQ,GAAG,OAAO,CAAC;AAExE;;;;GAIG;AACH,MAAM,MAAM,UAAU,GAAG,YAAY,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC;AAEtD,8CAA8C;AAC9C,MAAM,MAAM,QAAQ,GAAG,QAAQ,GAAG,MAAM,GAAG,WAAW,GAAG,MAAM,CAAC;AAEhE,2EAA2E;AAC3E,MAAM,WAAW,eAAe;IAC9B,yEAAyE;IACzE,EAAE,EAAE,MAAM,CAAC;IACX,kCAAkC;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,4CAA4C;IAC5C,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACpC;AAED,0CAA0C;AAC1C,MAAM,WAAW,WAAW;IAC1B,oBAAoB;IACpB,IAAI,EAAE,QAAQ,CAAC;IACf,8EAA8E;IAC9E,OAAO,EAAE,MAAM,CAAC;IAChB,8DAA8D;IAC9D,SAAS,CAAC,EAAE,eAAe,EAAE,CAAC;IAC9B,kFAAkF;IAClF,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,iEAAiE;IACjE,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,yCAAyC;AACzC,MAAM,WAAW,UAAU;IACz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ACtC,QAAQ,CAAC,GAAG,EAAE,iBAAiB,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;IAC5D,kCAAkC;IAClC,MAAM,CAAC,GAAG,EAAE,iBAAiB,GAAG,aAAa,CAAC,eAAe,CAAC,CAAC;IAC/D,uCAAuC;IACvC,WAAW,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;CACjC;AAED,+DAA+D;AAC/D,MAAM,WAAW,eAAe;IAC9B,2EAA2E;IAC3E,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,yDAAyD;IACzD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,2CAA2C;IAC3C,SAAS,EAAE,MAAM,CAAC;IAClB,qDAAqD;IACrD,UAAU,EAAE,MAAM,CAAC;IACnB,uEAAuE;IACvE,YAAY,EAAE,MAAM,CAAC;CACtB"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* LLM provider contracts.
|
|
3
|
+
*
|
|
4
|
+
* Providers are the integration boundary to a model backend (Mistral,
|
|
5
|
+
* Anthropic, OpenAI, local). Unlike tools, **providers throw on failure** —
|
|
6
|
+
* specifically {@link ProviderError} (with `retryable` set appropriately) — so
|
|
7
|
+
* the execution engine can apply retry/backoff policy.
|
|
8
|
+
*/
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=provider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"provider.js","sourceRoot":"","sources":["../../src/types/provider.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG"}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tool contracts.
|
|
3
|
+
*
|
|
4
|
+
* A tool is a single, named, side-effecting (or read-only) capability that an
|
|
5
|
+
* agent can invoke. The cardinal rule of this contract: **tools never throw
|
|
6
|
+
* from `execute`** — failures are reported as a {@link ToolResult} with
|
|
7
|
+
* `ok: false` and a serialised error. `validate` is the *only* method allowed
|
|
8
|
+
* to throw, and it throws exactly {@link ValidationError}.
|
|
9
|
+
*/
|
|
10
|
+
import type { SerializedError } from "../errors.js";
|
|
11
|
+
import type { Logger } from "../logger.js";
|
|
12
|
+
/**
|
|
13
|
+
* Permission disposition for a tool.
|
|
14
|
+
* - `"ask"` — prompt the user via {@link ToolContext.confirm} before running.
|
|
15
|
+
* - `"always"` — run without prompting.
|
|
16
|
+
* - `"never"` — the tool is blocked; execution must be refused.
|
|
17
|
+
*/
|
|
18
|
+
export type ToolPermission = "ask" | "always" | "never";
|
|
19
|
+
/** Logical grouping of tools, used for filtering and default permissions. */
|
|
20
|
+
export type ToolCategory = "file" | "search" | "system" | "project" | "ai" | "utility" | "mcp";
|
|
21
|
+
/**
|
|
22
|
+
* JSON-Schema-like description of a tool's accepted arguments.
|
|
23
|
+
*
|
|
24
|
+
* This is intentionally a pragmatic subset of JSON Schema sufficient to drive
|
|
25
|
+
* LLM tool-calling and runtime validation. `properties` describes object
|
|
26
|
+
* fields; `items` describes array elements; `enum` restricts a value to a fixed
|
|
27
|
+
* set.
|
|
28
|
+
*/
|
|
29
|
+
export interface ToolParameterSchema {
|
|
30
|
+
/** JSON Schema primitive/composite type. */
|
|
31
|
+
type: "object" | "array" | "string" | "number" | "integer" | "boolean" | "null";
|
|
32
|
+
/** Human-readable description, surfaced to the model. */
|
|
33
|
+
description?: string;
|
|
34
|
+
/** For `type: "object"`, the names of required properties. */
|
|
35
|
+
required?: string[];
|
|
36
|
+
/** For `type: "object"`, the schema of each named property. */
|
|
37
|
+
properties?: Record<string, ToolParameterSchema>;
|
|
38
|
+
/** For `type: "array"`, the schema of each element. */
|
|
39
|
+
items?: ToolParameterSchema;
|
|
40
|
+
/** Restricts the value to one of the listed constants. */
|
|
41
|
+
enum?: ReadonlyArray<string | number | boolean | null>;
|
|
42
|
+
/** Default value, advisory for the model and validation. */
|
|
43
|
+
default?: unknown;
|
|
44
|
+
}
|
|
45
|
+
/** Static, registry-level description of a tool. */
|
|
46
|
+
export interface ToolDefinition {
|
|
47
|
+
/** Unique tool name (e.g. `"read"`, `"git_status"`). */
|
|
48
|
+
name: string;
|
|
49
|
+
/** One-line description of what the tool does. */
|
|
50
|
+
description: string;
|
|
51
|
+
/** Category for grouping and default permission resolution. */
|
|
52
|
+
category: ToolCategory;
|
|
53
|
+
/** Schema for the tool's arguments (typically an `object` schema). */
|
|
54
|
+
parameters: ToolParameterSchema;
|
|
55
|
+
/** Default permission disposition; may be overridden by config. */
|
|
56
|
+
permission: ToolPermission;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Execution context handed to a tool at call time.
|
|
60
|
+
*
|
|
61
|
+
* The context is the tool's *only* sanctioned window onto the outside world:
|
|
62
|
+
* working directory, environment, cancellation, user confirmation and logging.
|
|
63
|
+
*/
|
|
64
|
+
export interface ToolContext {
|
|
65
|
+
/** Absolute working directory the tool should resolve paths against. */
|
|
66
|
+
cwd: string;
|
|
67
|
+
/** Read-only snapshot of the process environment. */
|
|
68
|
+
env: Readonly<Record<string, string | undefined>>;
|
|
69
|
+
/** Cancellation signal; tools SHOULD abort promptly when aborted. */
|
|
70
|
+
signal?: AbortSignal;
|
|
71
|
+
/**
|
|
72
|
+
* Request interactive confirmation for an `"ask"`-permission action.
|
|
73
|
+
* Resolves `true` to proceed, `false` to refuse. Absent in non-interactive
|
|
74
|
+
* contexts — tools must treat absence as "no confirmation available".
|
|
75
|
+
*/
|
|
76
|
+
confirm?: (msg: string) => Promise<boolean>;
|
|
77
|
+
/** Structured logger scoped to this execution. */
|
|
78
|
+
logger: Logger;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Outcome of a single tool execution. Always returned, never thrown.
|
|
82
|
+
*
|
|
83
|
+
* @typeParam T - shape of the successful `output` payload.
|
|
84
|
+
*/
|
|
85
|
+
export interface ToolResult<T = unknown> {
|
|
86
|
+
/** `true` on success; `false` when `error` is populated. */
|
|
87
|
+
ok: boolean;
|
|
88
|
+
/** Result payload. On failure this is implementation-defined (often `null`). */
|
|
89
|
+
output: T;
|
|
90
|
+
/** Populated iff `ok === false`; a JSON-safe error description. */
|
|
91
|
+
error?: SerializedError;
|
|
92
|
+
/** Wall-clock execution time in milliseconds. */
|
|
93
|
+
durationMs: number;
|
|
94
|
+
/** `true` when `output` was truncated to respect output limits. */
|
|
95
|
+
truncated?: boolean;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* The implementable tool interface.
|
|
99
|
+
*
|
|
100
|
+
* @typeParam TArgs - validated argument shape produced by {@link ITool.validate}.
|
|
101
|
+
* @typeParam TOut - successful output payload type.
|
|
102
|
+
*
|
|
103
|
+
* Contract:
|
|
104
|
+
* - `validate(args)` parses/narrows untrusted input, throwing
|
|
105
|
+
* {@link ValidationError} on any mismatch.
|
|
106
|
+
* - `execute(args, ctx)` performs the work and **always** resolves with a
|
|
107
|
+
* {@link ToolResult}; it must not reject. Permission denial, timeouts and
|
|
108
|
+
* not-found conditions are reported as `ok: false` with the appropriate
|
|
109
|
+
* serialised error code.
|
|
110
|
+
*/
|
|
111
|
+
export interface ITool<TArgs = Record<string, unknown>, TOut = unknown> {
|
|
112
|
+
/** Static description used by the registry and the model. */
|
|
113
|
+
readonly definition: ToolDefinition;
|
|
114
|
+
/**
|
|
115
|
+
* Validate and narrow raw arguments.
|
|
116
|
+
* @throws {ValidationError} when `args` does not satisfy the schema.
|
|
117
|
+
*/
|
|
118
|
+
validate(args: unknown): TArgs;
|
|
119
|
+
/** Execute the tool. Resolves with a {@link ToolResult}; never rejects. */
|
|
120
|
+
execute(args: TArgs, ctx: ToolContext): Promise<ToolResult<TOut>>;
|
|
121
|
+
}
|
|
122
|
+
//# sourceMappingURL=tool.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool.d.ts","sourceRoot":"","sources":["../../src/types/tool.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAmB,MAAM,cAAc,CAAC;AACr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,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC,CAAC;IAClD,qEAAqE;IACrE,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB;;;;OAIG;IACH,OAAO,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;IAC5C,kDAAkD;IAClD,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;;;GAIG;AACH,MAAM,WAAW,UAAU,CAAC,CAAC,GAAG,OAAO;IACrC,4DAA4D;IAC5D,EAAE,EAAE,OAAO,CAAC;IACZ,gFAAgF;IAChF,MAAM,EAAE,CAAC,CAAC;IACV,mEAAmE;IACnE,KAAK,CAAC,EAAE,eAAe,CAAC;IACxB,iDAAiD;IACjD,UAAU,EAAE,MAAM,CAAC;IACnB,mEAAmE;IACnE,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,WAAW,KAAK,CAAC,KAAK,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,IAAI,GAAG,OAAO;IACpE,6DAA6D;IAC7D,QAAQ,CAAC,UAAU,EAAE,cAAc,CAAC;IACpC;;;OAGG;IACH,QAAQ,CAAC,IAAI,EAAE,OAAO,GAAG,KAAK,CAAC;IAC/B,2EAA2E;IAC3E,OAAO,CAAC,IAAI,EAAE,KAAK,EAAE,GAAG,EAAE,WAAW,GAAG,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC;CACnE"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tool contracts.
|
|
3
|
+
*
|
|
4
|
+
* A tool is a single, named, side-effecting (or read-only) capability that an
|
|
5
|
+
* agent can invoke. The cardinal rule of this contract: **tools never throw
|
|
6
|
+
* from `execute`** — failures are reported as a {@link ToolResult} with
|
|
7
|
+
* `ok: false` and a serialised error. `validate` is the *only* method allowed
|
|
8
|
+
* to throw, and it throws exactly {@link ValidationError}.
|
|
9
|
+
*/
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=tool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool.js","sourceRoot":"","sources":["../../src/types/tool.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG"}
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AI versioning / release-planning contracts.
|
|
3
|
+
*
|
|
4
|
+
* These types describe the inputs and outputs of the Change Analysis,
|
|
5
|
+
* Version Recommender, Release Planning and Quality Gate subsystems.
|
|
6
|
+
*/
|
|
7
|
+
/** Kind of version bump implied by a set of changes. */
|
|
8
|
+
export type BumpType = "major" | "minor" | "patch" | "prerelease" | "none";
|
|
9
|
+
/** A single file's change in a diff. */
|
|
10
|
+
export interface FileChange {
|
|
11
|
+
/** Repository-relative path. */
|
|
12
|
+
path: string;
|
|
13
|
+
/** Change status. */
|
|
14
|
+
status: "added" | "modified" | "deleted" | "renamed";
|
|
15
|
+
/** Lines added. */
|
|
16
|
+
additions: number;
|
|
17
|
+
/** Lines removed. */
|
|
18
|
+
deletions: number;
|
|
19
|
+
}
|
|
20
|
+
/** Parsed Conventional-Commit-style metadata for one commit. */
|
|
21
|
+
export interface CommitInfo {
|
|
22
|
+
/** Commit hash. */
|
|
23
|
+
hash: string;
|
|
24
|
+
/** Conventional type (e.g. `"feat"`), or `null` if unparseable. */
|
|
25
|
+
type: string | null;
|
|
26
|
+
/** Conventional scope, or `null` if absent. */
|
|
27
|
+
scope: string | null;
|
|
28
|
+
/** Commit subject line. */
|
|
29
|
+
subject: string;
|
|
30
|
+
/** Whether the commit declares a breaking change. */
|
|
31
|
+
breaking: boolean;
|
|
32
|
+
}
|
|
33
|
+
/** A detected breaking change. */
|
|
34
|
+
export interface BreakingChange {
|
|
35
|
+
/** Where the signal came from. */
|
|
36
|
+
source: "commit" | "api-diff";
|
|
37
|
+
/** Human-readable description. */
|
|
38
|
+
description: string;
|
|
39
|
+
/** Optional location (file, symbol, …). */
|
|
40
|
+
location?: string;
|
|
41
|
+
}
|
|
42
|
+
/** A security finding from static analysis. */
|
|
43
|
+
export interface SecurityFinding {
|
|
44
|
+
/** Severity ranking. */
|
|
45
|
+
severity: "low" | "medium" | "high" | "critical";
|
|
46
|
+
/** Rule/check identifier. */
|
|
47
|
+
rule: string;
|
|
48
|
+
/** Affected file path. */
|
|
49
|
+
file: string;
|
|
50
|
+
/** Affected line number, when known. */
|
|
51
|
+
line?: number;
|
|
52
|
+
/** Human-readable description. */
|
|
53
|
+
description: string;
|
|
54
|
+
}
|
|
55
|
+
/** Aggregated analysis of a change set. */
|
|
56
|
+
export interface ChangeAnalysis {
|
|
57
|
+
/** Changed files. */
|
|
58
|
+
files: FileChange[];
|
|
59
|
+
/** Parsed commits. */
|
|
60
|
+
commits: CommitInfo[];
|
|
61
|
+
/** Detected breaking changes. */
|
|
62
|
+
breakingChanges: BreakingChange[];
|
|
63
|
+
/** Commit-category tallies. */
|
|
64
|
+
categories: {
|
|
65
|
+
feat: number;
|
|
66
|
+
fix: number;
|
|
67
|
+
docs: number;
|
|
68
|
+
refactor: number;
|
|
69
|
+
test: number;
|
|
70
|
+
chore: number;
|
|
71
|
+
perf: number;
|
|
72
|
+
other: number;
|
|
73
|
+
};
|
|
74
|
+
/** Security findings discovered during analysis. */
|
|
75
|
+
securityFindings: SecurityFinding[];
|
|
76
|
+
}
|
|
77
|
+
/** A recommended next version with rationale. */
|
|
78
|
+
export interface VersionSuggestion {
|
|
79
|
+
/** Current version string. */
|
|
80
|
+
currentVersion: string;
|
|
81
|
+
/** Suggested next version string. */
|
|
82
|
+
suggestedVersion: string;
|
|
83
|
+
/** The bump that produced the suggestion. */
|
|
84
|
+
bump: BumpType;
|
|
85
|
+
/** Confidence in the suggestion, `0`–`1`. */
|
|
86
|
+
confidence: number;
|
|
87
|
+
/** Human-readable reasons supporting the suggestion. */
|
|
88
|
+
reasons: string[];
|
|
89
|
+
}
|
|
90
|
+
/** A release milestone. */
|
|
91
|
+
export interface Milestone {
|
|
92
|
+
/** Milestone title. */
|
|
93
|
+
title: string;
|
|
94
|
+
/** Work items under this milestone. */
|
|
95
|
+
items: string[];
|
|
96
|
+
/** Whether the milestone is complete. */
|
|
97
|
+
done: boolean;
|
|
98
|
+
}
|
|
99
|
+
/** A release risk and its mitigation. */
|
|
100
|
+
export interface Risk {
|
|
101
|
+
/** Risk description. */
|
|
102
|
+
description: string;
|
|
103
|
+
/** Risk severity. */
|
|
104
|
+
severity: "low" | "medium" | "high";
|
|
105
|
+
/** Planned mitigation. */
|
|
106
|
+
mitigation: string;
|
|
107
|
+
}
|
|
108
|
+
/** A drafted release plan. */
|
|
109
|
+
export interface ReleasePlan {
|
|
110
|
+
/** Target version. */
|
|
111
|
+
version: string;
|
|
112
|
+
/** Target date, ISO-8601 (UTC), when set. */
|
|
113
|
+
targetDate?: string;
|
|
114
|
+
/** Milestones for the release. */
|
|
115
|
+
milestones: Milestone[];
|
|
116
|
+
/** Identified risks. */
|
|
117
|
+
risks: Risk[];
|
|
118
|
+
/** Draft changelog text. */
|
|
119
|
+
changelogDraft: string;
|
|
120
|
+
}
|
|
121
|
+
/** Result of a single quality gate. */
|
|
122
|
+
export interface QualityGateResult {
|
|
123
|
+
/** Gate identifier (e.g. `"coverage"`, `"review"`). */
|
|
124
|
+
gate: string;
|
|
125
|
+
/** Whether the gate passed. */
|
|
126
|
+
passed: boolean;
|
|
127
|
+
/** Optional numeric score for the gate. */
|
|
128
|
+
score?: number;
|
|
129
|
+
/** Human-readable detail. */
|
|
130
|
+
details: string;
|
|
131
|
+
}
|
|
132
|
+
/** Aggregated quality report across all gates. */
|
|
133
|
+
export interface QualityReport {
|
|
134
|
+
/** `true` iff every gate passed. */
|
|
135
|
+
passed: boolean;
|
|
136
|
+
/** Per-gate results. */
|
|
137
|
+
gates: QualityGateResult[];
|
|
138
|
+
/** Overall score across gates. */
|
|
139
|
+
overallScore: number;
|
|
140
|
+
}
|
|
141
|
+
//# sourceMappingURL=versioning.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"versioning.d.ts","sourceRoot":"","sources":["../../src/types/versioning.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,wDAAwD;AACxD,MAAM,MAAM,QAAQ,GAAG,OAAO,GAAG,OAAO,GAAG,OAAO,GAAG,YAAY,GAAG,MAAM,CAAC;AAE3E,wCAAwC;AACxC,MAAM,WAAW,UAAU;IACzB,gCAAgC;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,qBAAqB;IACrB,MAAM,EAAE,OAAO,GAAG,UAAU,GAAG,SAAS,GAAG,SAAS,CAAC;IACrD,mBAAmB;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,qBAAqB;IACrB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,gEAAgE;AAChE,MAAM,WAAW,UAAU;IACzB,mBAAmB;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,mEAAmE;IACnE,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,+CAA+C;IAC/C,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,2BAA2B;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB,qDAAqD;IACrD,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED,kCAAkC;AAClC,MAAM,WAAW,cAAc;IAC7B,kCAAkC;IAClC,MAAM,EAAE,QAAQ,GAAG,UAAU,CAAC;IAC9B,kCAAkC;IAClC,WAAW,EAAE,MAAM,CAAC;IACpB,2CAA2C;IAC3C,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,+CAA+C;AAC/C,MAAM,WAAW,eAAe;IAC9B,wBAAwB;IACxB,QAAQ,EAAE,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,UAAU,CAAC;IACjD,6BAA6B;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,0BAA0B;IAC1B,IAAI,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G,QAAQ,GAAG,MAAM,CAAC;IACpC,0BAA0B;IAC1B,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,8BAA8B;AAC9B,MAAM,WAAW,WAAW;IAC1B,sBAAsB;IACtB,OAAO,EAAE,MAAM,CAAC;IAChB,6CAA6C;IAC7C,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,kCAAkC;IAClC,UAAU,EAAE,SAAS,EAAE,CAAC;IACxB,wBAAwB;IACxB,KAAK,EAAE,IAAI,EAAE,CAAC;IACd,4BAA4B;IAC5B,cAAc,EAAE,MAAM,CAAC;CACxB;AAED,uCAAuC;AACvC,MAAM,WAAW,iBAAiB;IAChC,uDAAuD;IACvD,IAAI,EAAE,MAAM,CAAC;IACb,+BAA+B;IAC/B,MAAM,EAAE,OAAO,CAAC;IAChB,2CAA2C;IAC3C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,6BAA6B;IAC7B,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,kDAAkD;AAClD,MAAM,WAAW,aAAa;IAC5B,oCAAoC;IACpC,MAAM,EAAE,OAAO,CAAC;IAChB,wBAAwB;IACxB,KAAK,EAAE,iBAAiB,EAAE,CAAC;IAC3B,kCAAkC;IAClC,YAAY,EAAE,MAAM,CAAC;CACtB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"versioning.js","sourceRoot":"","sources":["../../src/types/versioning.ts"],"names":[],"mappings":"AAAA;;;;;GAKG"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Async helpers: cancellable {@link sleep}.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Resolve after `ms` milliseconds, with optional cancellation.
|
|
6
|
+
*
|
|
7
|
+
* - If `signal` is already aborted, rejects immediately with the signal's
|
|
8
|
+
* `reason` (or an `AbortError` if none).
|
|
9
|
+
* - If `signal` aborts before the timer fires, the timer is cleared and the
|
|
10
|
+
* promise rejects with the abort reason.
|
|
11
|
+
* - Negative or non-finite `ms` is clamped to `0`.
|
|
12
|
+
*
|
|
13
|
+
* @param ms - delay in milliseconds.
|
|
14
|
+
* @param signal - optional cancellation signal.
|
|
15
|
+
*/
|
|
16
|
+
export declare function sleep(ms: number, signal?: AbortSignal): Promise<void>;
|
|
17
|
+
//# sourceMappingURL=async.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"async.d.ts","sourceRoot":"","sources":["../../src/utils/async.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;;;;;;;;;GAWG;AACH,wBAAgB,KAAK,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CA0BrE"}
|