@sbugallo/opencode-vpet 0.1.0 → 0.2.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/README.md +8 -12
- package/dist/adapters/opencode/server-plugin.d.ts +78 -0
- package/dist/adapters/opencode/server-plugin.d.ts.map +1 -0
- package/dist/adapters/opencode/session-messages.d.ts +4 -9
- package/dist/adapters/opencode/session-messages.d.ts.map +1 -1
- package/dist/adapters/opencode/usage-event-mapper.d.ts +6 -3
- package/dist/adapters/opencode/usage-event-mapper.d.ts.map +1 -1
- package/dist/adapters/opencode/vpet-toast.d.ts +4 -2
- package/dist/adapters/opencode/vpet-toast.d.ts.map +1 -1
- package/dist/cli/install.d.ts +9 -0
- package/dist/cli/install.d.ts.map +1 -0
- package/dist/cli.js +52 -95
- package/dist/cli.js.map +5 -5
- package/dist/commands/vpet-command-result.d.ts +2 -2
- package/dist/commands/vpet-command-result.d.ts.map +1 -1
- package/dist/commands/vpet-freeze.d.ts +1 -5
- package/dist/commands/vpet-freeze.d.ts.map +1 -1
- package/dist/commands/vpet-set.d.ts +0 -2
- package/dist/commands/vpet-set.d.ts.map +1 -1
- package/dist/commands/vpet-spawn.d.ts +0 -2
- package/dist/commands/vpet-spawn.d.ts.map +1 -1
- package/dist/commands/vpet-unfreeze.d.ts +1 -5
- package/dist/commands/vpet-unfreeze.d.ts.map +1 -1
- package/dist/index.d.ts +4 -8
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +535 -470
- package/dist/index.js.map +22 -21
- package/dist/package.json +10 -0
- package/dist/rpc.d.ts +32 -0
- package/dist/rpc.d.ts.map +1 -0
- package/dist/tui/theme.d.ts +27 -0
- package/dist/tui/theme.d.ts.map +1 -0
- package/dist/tui/vpet-command-layer.d.ts +32 -5
- package/dist/tui/vpet-command-layer.d.ts.map +1 -1
- package/dist/tui/vpet-dex-dialog.d.ts +2 -2
- package/dist/tui/vpet-dex-dialog.d.ts.map +1 -1
- package/dist/tui/vpet-history-dialog.d.ts +2 -2
- package/dist/tui/vpet-history-dialog.d.ts.map +1 -1
- package/dist/tui.d.ts +22 -12
- package/dist/tui.d.ts.map +1 -1
- package/dist/tui.js +203 -66
- package/dist/tui.js.map +10 -7
- package/package.json +14 -13
- package/dist/adapters/opencode/create-server-hooks.d.ts +0 -39
- package/dist/adapters/opencode/create-server-hooks.d.ts.map +0 -1
- package/dist/cli/config.d.ts +0 -17
- package/dist/cli/config.d.ts.map +0 -1
package/README.md
CHANGED
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
>
|
|
36
36
|
</div>
|
|
37
37
|
|
|
38
|
-
`@sbugallo/opencode-vpet` is an OpenCode
|
|
38
|
+
`@sbugallo/opencode-vpet` is an OpenCode v2 plugin that adds a Digimon virtual pet to your OpenCode TUI
|
|
39
39
|
sidebar. Your Digimon evolves as you use OpenCode, and you can browse your discoveries and
|
|
40
40
|
partner history.
|
|
41
41
|
|
|
@@ -62,25 +62,20 @@ options in that Digimon's line.
|
|
|
62
62
|
## Quick start
|
|
63
63
|
|
|
64
64
|
Requirements:
|
|
65
|
-
- OpenCode `>=
|
|
65
|
+
- OpenCode `>=2.0.18`
|
|
66
66
|
- Node `>=20` to run `npx`
|
|
67
67
|
- Bun `>=1.3.5` only for local development
|
|
68
68
|
|
|
69
69
|
|
|
70
|
-
1.
|
|
70
|
+
1. Install both plugins:
|
|
71
71
|
|
|
72
72
|
```sh
|
|
73
73
|
npx @sbugallo/opencode-vpet init
|
|
74
74
|
```
|
|
75
75
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
```json
|
|
80
|
-
{
|
|
81
|
-
"plugin": ["@sbugallo/opencode-vpet"]
|
|
82
|
-
}
|
|
83
|
-
```
|
|
76
|
+
The CLI delegates to `opencode plugin add @sbugallo/opencode-vpet@<installed-package-version>`.
|
|
77
|
+
It uses the package's installed exact version so OpenCode uses a version-specific cache key rather
|
|
78
|
+
than reusing a stale bare or `@latest` cache entry.
|
|
84
79
|
|
|
85
80
|
2. Restart OpenCode when the command finishes.
|
|
86
81
|
|
|
@@ -112,7 +107,8 @@ To update the plugin, run:
|
|
|
112
107
|
npx @sbugallo/opencode-vpet update
|
|
113
108
|
```
|
|
114
109
|
|
|
115
|
-
|
|
110
|
+
Like `init`, `update` delegates to OpenCode's native global plugin installer with the installed exact
|
|
111
|
+
package version. If a legacy unscoped `opencode-vpet` registration is present, remove it manually.
|
|
116
112
|
|
|
117
113
|
## Settings
|
|
118
114
|
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import type { Plugin } from "@opencode/plugin";
|
|
2
|
+
import type { PartnerLifecycle } from "../../application/ports/partner-lifecycle.ts";
|
|
3
|
+
import type { UsageLedger } from "../../application/ports/usage-ledger.ts";
|
|
4
|
+
import type { VpetControl } from "../../application/ports/vpet-control.ts";
|
|
5
|
+
import type { VpetCommandResult } from "../../commands/vpet-command-result.ts";
|
|
6
|
+
import type { ResolvedVpetSettings, VpetLanguage } from "../../config/types.ts";
|
|
7
|
+
import { type DigimonCatalog } from "../../data/catalog.ts";
|
|
8
|
+
import type { EvolutionSelector, StageThresholds } from "../../domain/evolution.ts";
|
|
9
|
+
import { type SessionMessagesFetcher } from "./session-messages.ts";
|
|
10
|
+
import { type VpetToastNotifier } from "./vpet-toast.ts";
|
|
11
|
+
export type ServerResource = {
|
|
12
|
+
close(): Promise<void>;
|
|
13
|
+
};
|
|
14
|
+
export type ServerRepository = PartnerLifecycle & UsageLedger & VpetControl & ServerResource;
|
|
15
|
+
export type ServerContext = Pick<Plugin.Context, "options" | "command" | "event" | "rpc" | "session">;
|
|
16
|
+
export type ServerEventSource = {
|
|
17
|
+
subscribe(options: {
|
|
18
|
+
readonly signal: AbortSignal;
|
|
19
|
+
}): AsyncIterable<{
|
|
20
|
+
readonly type: string;
|
|
21
|
+
readonly data: unknown;
|
|
22
|
+
}>;
|
|
23
|
+
};
|
|
24
|
+
export type ServerCommandDefinition = {
|
|
25
|
+
readonly name: string;
|
|
26
|
+
readonly description: string;
|
|
27
|
+
readonly execute: (input: {
|
|
28
|
+
readonly prompt: {
|
|
29
|
+
readonly text: string;
|
|
30
|
+
};
|
|
31
|
+
}) => Promise<void>;
|
|
32
|
+
};
|
|
33
|
+
export type ServerRepositoryInput = {
|
|
34
|
+
readonly appDataRoot?: string;
|
|
35
|
+
readonly databasePath?: string;
|
|
36
|
+
};
|
|
37
|
+
export type ServerDependencies = {
|
|
38
|
+
readonly openRepository: (input: ServerRepositoryInput) => Promise<ServerRepository>;
|
|
39
|
+
readonly loadSettings?: () => Promise<ResolvedVpetSettings>;
|
|
40
|
+
readonly loadCatalog?: () => Promise<DigimonCatalog>;
|
|
41
|
+
readonly evolutionSelector?: EvolutionSelector;
|
|
42
|
+
readonly evolutionThresholds?: StageThresholds;
|
|
43
|
+
readonly language?: VpetLanguage;
|
|
44
|
+
readonly notificationsEnabled?: boolean;
|
|
45
|
+
readonly notify?: VpetToastNotifier;
|
|
46
|
+
readonly fetchMessages?: SessionMessagesFetcher;
|
|
47
|
+
};
|
|
48
|
+
export declare const createCommandConfig: () => {
|
|
49
|
+
"vpet-spawn": {
|
|
50
|
+
description: string;
|
|
51
|
+
};
|
|
52
|
+
"vpet-freeze": {
|
|
53
|
+
description: string;
|
|
54
|
+
};
|
|
55
|
+
"vpet-unfreeze": {
|
|
56
|
+
description: string;
|
|
57
|
+
};
|
|
58
|
+
"vpet-set": {
|
|
59
|
+
description: string;
|
|
60
|
+
};
|
|
61
|
+
};
|
|
62
|
+
/** Narrows a v2 event to the sessions whose completed usage should be reconciled. */
|
|
63
|
+
export declare const toReconcileSessionID: (event: unknown) => string | undefined;
|
|
64
|
+
export type ServerReconcile = (messages: readonly unknown[]) => Promise<void>;
|
|
65
|
+
export declare const consumeVpetSessionEvents: (input: {
|
|
66
|
+
readonly event: ServerEventSource;
|
|
67
|
+
readonly signal: AbortSignal;
|
|
68
|
+
readonly fetchMessages: SessionMessagesFetcher;
|
|
69
|
+
readonly reconcile: ServerReconcile;
|
|
70
|
+
}) => Promise<void>;
|
|
71
|
+
export type VpetCommandDefinitionDependencies = {
|
|
72
|
+
readonly repository: ServerRepository;
|
|
73
|
+
readonly emit: (result: VpetCommandResult, catalog?: DigimonCatalog) => Promise<void>;
|
|
74
|
+
readonly loadCatalog: () => Promise<DigimonCatalog>;
|
|
75
|
+
};
|
|
76
|
+
export declare const createVpetCommandDefinitions: ({ repository, emit, loadCatalog, }: VpetCommandDefinitionDependencies) => readonly ServerCommandDefinition[];
|
|
77
|
+
export declare const setupVpetServer: (context: ServerContext, dependencies: ServerDependencies) => Promise<Plugin.Cleanup>;
|
|
78
|
+
//# sourceMappingURL=server-plugin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server-plugin.d.ts","sourceRoot":"","sources":["../../../src/adapters/opencode/server-plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AAG9C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,8CAA8C,CAAA;AACpF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yCAAyC,CAAA;AAC1E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yCAAyC,CAAA;AAE1E,OAAO,KAAK,EAAoB,iBAAiB,EAAE,MAAM,uCAAuC,CAAA;AAMhG,OAAO,KAAK,EAAE,oBAAoB,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAA;AAC/E,OAAO,EAAsB,KAAK,cAAc,EAAE,MAAM,uBAAuB,CAAA;AAC/E,OAAO,KAAK,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAA;AAEnF,OAAO,EAAgC,KAAK,sBAAsB,EAAE,MAAM,uBAAuB,CAAA;AAEjG,OAAO,EAIL,KAAK,iBAAiB,EACvB,MAAM,iBAAiB,CAAA;AAExB,MAAM,MAAM,cAAc,GAAG;IAC3B,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC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cAAc,kBAAkB,KAC/B,OAAO,CAAC,MAAM,CAAC,OAAO,CAsHxB,CAAA"}
|
|
@@ -1,14 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
export type SessionMessagesFetcher = (sessionID: string) => Promise<readonly Message[]>;
|
|
1
|
+
export type SessionMessagesFetcher = (sessionID: string) => Promise<readonly unknown[]>;
|
|
3
2
|
export type SessionMessagesClient = {
|
|
4
3
|
readonly session: {
|
|
5
|
-
|
|
6
|
-
readonly
|
|
7
|
-
|
|
8
|
-
};
|
|
9
|
-
}) => Promise<{
|
|
10
|
-
readonly data: SessionMessagesResponse | undefined;
|
|
11
|
-
}>;
|
|
4
|
+
context: (input: {
|
|
5
|
+
readonly sessionID: string;
|
|
6
|
+
}) => Promise<readonly unknown[]>;
|
|
12
7
|
};
|
|
13
8
|
};
|
|
14
9
|
export declare const createSessionMessagesFetcher: (client: SessionMessagesClient) => SessionMessagesFetcher;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session-messages.d.ts","sourceRoot":"","sources":["../../../src/adapters/opencode/session-messages.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"session-messages.d.ts","sourceRoot":"","sources":["../../../src/adapters/opencode/session-messages.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,sBAAsB,GAAG,CAAC,SAAS,EAAE,MAAM,KAAK,OAAO,CAAC,SAAS,OAAO,EAAE,CAAC,CAAA;AAEvF,MAAM,MAAM,qBAAqB,GAAG;IAClC,QAAQ,CAAC,OAAO,EAAE;QAChB,OAAO,EAAE,CAAC,KAAK,EAAE;YAAE,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;SAAE,KAAK,OAAO,CAAC,SAAS,OAAO,EAAE,CAAC,CAAA;KAChF,CAAA;CACF,CAAA;AAED,eAAO,MAAM,4BAA4B,GAAI,QAAQ,qBAAqB,KAAG,sBAE5E,CAAA"}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
import type { Event, Message } from "@opencode-ai/sdk";
|
|
2
1
|
import type { CompletedUsage } from "../../application/use-cases/record-usage.ts";
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
/**
|
|
3
|
+
* Maps a completed assistant message from the v2 `session.context()` shape into
|
|
4
|
+
* a usage receipt. Messages without a completed timestamp or full token usage
|
|
5
|
+
* (for example title or compaction messages) are not recordable.
|
|
6
|
+
*/
|
|
7
|
+
export declare const toCompletedUsageFromMessage: (message: unknown) => CompletedUsage | null;
|
|
5
8
|
//# sourceMappingURL=usage-event-mapper.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usage-event-mapper.d.ts","sourceRoot":"","sources":["../../../src/adapters/opencode/usage-event-mapper.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"usage-event-mapper.d.ts","sourceRoot":"","sources":["../../../src/adapters/opencode/usage-event-mapper.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,6CAA6C,CAAA;AAajF;;;;GAIG;AACH,eAAO,MAAM,2BAA2B,GAAI,SAAS,OAAO,KAAG,cAAc,GAAG,IAsC/E,CAAA"}
|
|
@@ -3,7 +3,7 @@ import type { DigimonCatalog } from "../../data/catalog.ts";
|
|
|
3
3
|
export type VpetToastPayload = Readonly<{
|
|
4
4
|
readonly title: string;
|
|
5
5
|
readonly message: string;
|
|
6
|
-
readonly variant: "info" | "success";
|
|
6
|
+
readonly variant: "info" | "success" | "warning";
|
|
7
7
|
readonly duration: number;
|
|
8
8
|
}>;
|
|
9
9
|
export type VpetToastEvent = Readonly<{
|
|
@@ -23,7 +23,9 @@ export type VpetToastEvent = Readonly<{
|
|
|
23
23
|
readonly toNodeId: string;
|
|
24
24
|
}>;
|
|
25
25
|
export type VpetToastNotifier = (payload: VpetToastPayload) => Promise<void>;
|
|
26
|
-
export type VpetToastTransport = (payload: VpetToastPayload) =>
|
|
26
|
+
export type VpetToastTransport = (payload: VpetToastPayload) => unknown | Promise<unknown>;
|
|
27
|
+
/** Narrows untyped RPC event data into a toast payload. */
|
|
28
|
+
export declare const toVpetToastPayload: (data: unknown) => VpetToastPayload | undefined;
|
|
27
29
|
export declare const formatVpetToast: (event: VpetToastEvent, language: VpetLanguage, catalog: DigimonCatalog) => VpetToastPayload | undefined;
|
|
28
30
|
export declare const createBestEffortVpetToastNotifier: (transport: VpetToastTransport) => VpetToastNotifier;
|
|
29
31
|
//# sourceMappingURL=vpet-toast.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vpet-toast.d.ts","sourceRoot":"","sources":["../../../src/adapters/opencode/vpet-toast.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAA;AACzD,OAAO,KAAK,EAAE,cAAc,EAAe,MAAM,uBAAuB,CAAA;AAExE,MAAM,MAAM,gBAAgB,GAAG,QAAQ,CAAC;IACtC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IACxB,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,CAAA;
|
|
1
|
+
{"version":3,"file":"vpet-toast.d.ts","sourceRoot":"","sources":["../../../src/adapters/opencode/vpet-toast.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAA;AACzD,OAAO,KAAK,EAAE,cAAc,EAAe,MAAM,uBAAuB,CAAA;AAExE,MAAM,MAAM,gBAAgB,GAAG,QAAQ,CAAC;IACtC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IACxB,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS,CAAA;IAChD,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;CAC1B,CAAC,CAAA;AAEF,MAAM,MAAM,cAAc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itCode: number | null);
|
|
5
|
+
}
|
|
6
|
+
export type CommandExecutor = (command: string, arguments_: readonly string[]) => Promise<void>;
|
|
7
|
+
export declare const runCommand: CommandExecutor;
|
|
8
|
+
export declare const installGlobalPlugin: (packageSpec: string, execute?: CommandExecutor) => Promise<void>;
|
|
9
|
+
//# sourceMappingURL=install.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"install.d.ts","sourceRoot":"","sources":["../../src/cli/install.ts"],"names":[],"mappings":"AAEA,qBAAa,0BAA2B,SAAQ,KAAK;IAGvC,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI;IAF5C,QAAQ,CAAC,IAAI,gCAA+B;gBAEvB,QAAQ,EAAE,MAAM,GAAG,IAAI;CAO7C;AAED,MAAM,MAAM,eAAe,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,SAAS,MAAM,EAAE,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;AAE/F,eAAO,MAAM,UAAU,EAAE,eAQrB,CAAA;AAEJ,eAAO,MAAM,mBAAmB,GAAU,aAAa,MAAM,EAAE,UAAS,eAA4B,KAAG,OAAO,CAAC,IAAI,CAC9D,CAAA"}
|
package/dist/cli.js
CHANGED
|
@@ -1,103 +1,58 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
// src/cli
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
if (error instanceof Error && "code" in error && error.code === "ENOENT")
|
|
16
|
-
return false;
|
|
17
|
-
throw error;
|
|
18
|
-
}
|
|
19
|
-
};
|
|
20
|
-
var preferredConfigPath = async (directory, name) => {
|
|
21
|
-
const jsonc = join(directory, `${name}.jsonc`);
|
|
22
|
-
return await exists(jsonc) ? jsonc : join(directory, `${name}.json`);
|
|
23
|
-
};
|
|
24
|
-
var nonEmptyPath = (value) => value === undefined || value.trim().length === 0 ? undefined : value;
|
|
25
|
-
var resolveConfigDirectory = (env, home) => {
|
|
26
|
-
const configDirectory = nonEmptyPath(env.OPENCODE_CONFIG_DIR);
|
|
27
|
-
if (configDirectory !== undefined)
|
|
28
|
-
return configDirectory;
|
|
29
|
-
const xdgConfigHome = nonEmptyPath(env.XDG_CONFIG_HOME);
|
|
30
|
-
return xdgConfigHome === undefined ? join(home, ".config", "opencode") : join(xdgConfigHome, "opencode");
|
|
31
|
-
};
|
|
32
|
-
var resolveConfigPaths = async (env, home) => {
|
|
33
|
-
const directory = resolveConfigDirectory(env, home);
|
|
34
|
-
return [
|
|
35
|
-
nonEmptyPath(env.OPENCODE_CONFIG) ?? await preferredConfigPath(directory, "opencode"),
|
|
36
|
-
nonEmptyPath(env.OPENCODE_TUI_CONFIG) ?? await preferredConfigPath(directory, "tui")
|
|
37
|
-
];
|
|
38
|
-
};
|
|
39
|
-
var parseConfig = (source, path) => {
|
|
40
|
-
const errors = [];
|
|
41
|
-
const parsed = parse(source, errors, { allowEmptyContent: false, allowTrailingComma: true });
|
|
42
|
-
if (errors.length > 0)
|
|
43
|
-
throw new Error(`Cannot parse OpenCode configuration: ${path}`);
|
|
44
|
-
if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) {
|
|
45
|
-
throw new Error(`OpenCode configuration must be an object: ${path}`);
|
|
46
|
-
}
|
|
47
|
-
return parsed;
|
|
48
|
-
};
|
|
49
|
-
var normalizedPlugins = (value) => {
|
|
50
|
-
if (value === undefined)
|
|
51
|
-
return [CANONICAL_PLUGIN];
|
|
52
|
-
if (!Array.isArray(value))
|
|
53
|
-
throw new Error("OpenCode plugin configuration must be an array.");
|
|
54
|
-
const retained = value.filter((entry) => typeof entry !== "string" || entry !== LEGACY_PLUGIN && entry !== CANONICAL_PLUGIN);
|
|
55
|
-
return [...retained, CANONICAL_PLUGIN];
|
|
56
|
-
};
|
|
57
|
-
var planConfig = async (path) => {
|
|
58
|
-
const source = await exists(path) ? await readFile(path, "utf8") : `{}
|
|
59
|
-
`;
|
|
60
|
-
const parsed = parseConfig(source, path);
|
|
61
|
-
const plugins = normalizedPlugins(parsed.plugin);
|
|
62
|
-
const content = applyEdits(source, modify(source, ["plugin"], plugins, { formattingOptions: { insertSpaces: true, tabSize: 2, eol: `
|
|
63
|
-
` } }));
|
|
64
|
-
return { path, content, changed: content !== source };
|
|
65
|
-
};
|
|
66
|
-
var writeAtomically = async (plan) => {
|
|
67
|
-
const existing = await exists(plan.path);
|
|
68
|
-
const targetPath = existing ? await realpath(plan.path) : plan.path;
|
|
69
|
-
const mode = existing ? (await stat(targetPath)).mode & 511 : 384;
|
|
70
|
-
await mkdir(dirname(targetPath), { recursive: true });
|
|
71
|
-
const temporaryPath = join(dirname(targetPath), `.${process.pid}-${Date.now()}-${Math.random().toString(16).slice(2)}`);
|
|
72
|
-
try {
|
|
73
|
-
await writeFile(temporaryPath, plan.content, { encoding: "utf8", flag: "wx", mode });
|
|
74
|
-
await rename(temporaryPath, targetPath);
|
|
75
|
-
} catch (error) {
|
|
76
|
-
await rm(temporaryPath, { force: true });
|
|
77
|
-
throw error;
|
|
3
|
+
// src/cli.ts
|
|
4
|
+
import { readFile } from "node:fs/promises";
|
|
5
|
+
|
|
6
|
+
// src/cli/install.ts
|
|
7
|
+
import { spawn } from "node:child_process";
|
|
8
|
+
|
|
9
|
+
class OpenCodePluginInstallError extends Error {
|
|
10
|
+
exitCode;
|
|
11
|
+
name = "OpenCodePluginInstallError";
|
|
12
|
+
constructor(exitCode) {
|
|
13
|
+
super(exitCode === null ? "OpenCode plugin installer exited without a status." : `OpenCode plugin installer exited with status ${exitCode}.`);
|
|
14
|
+
this.exitCode = exitCode;
|
|
78
15
|
}
|
|
79
|
-
}
|
|
80
|
-
var
|
|
81
|
-
const
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
};
|
|
16
|
+
}
|
|
17
|
+
var runCommand = (command, arguments_) => new Promise((resolve, reject) => {
|
|
18
|
+
const child = spawn(command, arguments_, { shell: false, stdio: "inherit" });
|
|
19
|
+
child.once("error", reject);
|
|
20
|
+
child.once("close", (exitCode) => {
|
|
21
|
+
if (exitCode === 0)
|
|
22
|
+
resolve();
|
|
23
|
+
else
|
|
24
|
+
reject(new OpenCodePluginInstallError(exitCode));
|
|
25
|
+
});
|
|
26
|
+
});
|
|
27
|
+
var installGlobalPlugin = async (packageSpec, execute = runCommand) => execute("opencode", ["plugin", "add", packageSpec]);
|
|
89
28
|
|
|
90
29
|
// src/cli.ts
|
|
91
30
|
var HELP = `Usage: opencode-vpet <init|update> [--dry-run]
|
|
92
31
|
|
|
93
32
|
Commands:
|
|
94
|
-
init
|
|
95
|
-
update
|
|
33
|
+
init Install the current package version through OpenCode's global plugin installer.
|
|
34
|
+
update Reinstall the current package version through the same installer.
|
|
96
35
|
|
|
97
36
|
Options:
|
|
98
|
-
--dry-run Show
|
|
37
|
+
--dry-run Show the native OpenCode command without running it.
|
|
99
38
|
--help Show this help text.
|
|
100
39
|
`;
|
|
40
|
+
var EXACT_SEMVER = /^(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)(?:-(?:0|[1-9]\d*|\d*[A-Za-z-][0-9A-Za-z-]*)(?:\.(?:0|[1-9]\d*|\d*[A-Za-z-][0-9A-Za-z-]*))*)?(?:\+[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?$/;
|
|
41
|
+
var isPackageManifest = (value) => {
|
|
42
|
+
if (typeof value !== "object" || value === null || Array.isArray(value))
|
|
43
|
+
return false;
|
|
44
|
+
if (!("name" in value) || !("version" in value))
|
|
45
|
+
return false;
|
|
46
|
+
const { name, version } = value;
|
|
47
|
+
return name === "@sbugallo/opencode-vpet" && typeof version === "string" && EXACT_SEMVER.test(version);
|
|
48
|
+
};
|
|
49
|
+
var readPackageManifest = async () => {
|
|
50
|
+
const source = await readFile(new URL("../package.json", import.meta.url), "utf8");
|
|
51
|
+
const manifest = JSON.parse(source);
|
|
52
|
+
if (!isPackageManifest(manifest))
|
|
53
|
+
throw new Error("Invalid opencode-vpet package manifest.");
|
|
54
|
+
return manifest;
|
|
55
|
+
};
|
|
101
56
|
var parseArguments = (arguments_) => {
|
|
102
57
|
if (arguments_.length === 1 && arguments_[0] === "--help")
|
|
103
58
|
return { kind: "help" };
|
|
@@ -122,13 +77,15 @@ var run = async () => {
|
|
|
122
77
|
${HELP}`);
|
|
123
78
|
return 2;
|
|
124
79
|
case "command": {
|
|
125
|
-
const
|
|
126
|
-
const
|
|
127
|
-
if (
|
|
128
|
-
process.stdout.write(`
|
|
80
|
+
const manifest = await readPackageManifest();
|
|
81
|
+
const packageSpec = `${manifest.name}@${manifest.version}`;
|
|
82
|
+
if (parsed.dryRun) {
|
|
83
|
+
process.stdout.write(`opencode plugin add ${packageSpec}
|
|
129
84
|
`);
|
|
130
|
-
|
|
131
|
-
|
|
85
|
+
return 0;
|
|
86
|
+
}
|
|
87
|
+
await installGlobalPlugin(packageSpec);
|
|
88
|
+
process.stdout.write(`OpenCode plugin installation completed. Restart OpenCode.
|
|
132
89
|
`);
|
|
133
90
|
return 0;
|
|
134
91
|
}
|
|
@@ -143,5 +100,5 @@ run().then((exitCode) => {
|
|
|
143
100
|
process.exitCode = 1;
|
|
144
101
|
});
|
|
145
102
|
|
|
146
|
-
//# debugId=
|
|
103
|
+
//# debugId=2B68ABCF198098E364756E2164756E21
|
|
147
104
|
//# sourceMappingURL=cli.js.map
|
package/dist/cli.js.map
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../src/cli
|
|
3
|
+
"sources": ["../src/cli.ts", "../src/cli/install.ts"],
|
|
4
4
|
"sourcesContent": [
|
|
5
|
-
"
|
|
6
|
-
"
|
|
5
|
+
"#!/usr/bin/env node\nimport { readFile } from \"node:fs/promises\"\n\nimport { installGlobalPlugin } from \"./cli/install.ts\"\n\nconst HELP = `Usage: opencode-vpet <init|update> [--dry-run]\n\nCommands:\n init Install the current package version through OpenCode's global plugin installer.\n update Reinstall the current package version through the same installer.\n\nOptions:\n --dry-run Show the native OpenCode command without running it.\n --help Show this help text.\n`\n\ntype Command = \"init\" | \"update\"\n\ntype ParsedArguments =\n | Readonly<{ readonly kind: \"help\" }>\n | Readonly<{ readonly kind: \"command\"; readonly command: Command; readonly dryRun: boolean }>\n | Readonly<{ readonly kind: \"invalid\"; readonly message: string }>\n\ntype PackageManifest = Readonly<{ readonly name: \"@sbugallo/opencode-vpet\"; readonly version: string }>\n\nconst EXACT_SEMVER =\n /^(?:0|[1-9]\\d*)\\.(?:0|[1-9]\\d*)\\.(?:0|[1-9]\\d*)(?:-(?:0|[1-9]\\d*|\\d*[A-Za-z-][0-9A-Za-z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[A-Za-z-][0-9A-Za-z-]*))*)?(?:\\+[0-9A-Za-z-]+(?:\\.[0-9A-Za-z-]+)*)?$/\n\nconst isPackageManifest = (value: unknown): value is PackageManifest => {\n if (typeof value !== \"object\" || value === null || Array.isArray(value)) return false\n if (!(\"name\" in value) || !(\"version\" in value)) return false\n const { name, version } = value\n return name === \"@sbugallo/opencode-vpet\" && typeof version === \"string\" && EXACT_SEMVER.test(version)\n}\n\nconst readPackageManifest = async (): Promise<PackageManifest> => {\n const source = await readFile(new URL(\"../package.json\", import.meta.url), \"utf8\")\n const manifest: unknown = JSON.parse(source)\n if (!isPackageManifest(manifest)) throw new Error(\"Invalid opencode-vpet package manifest.\")\n return manifest\n}\n\nconst parseArguments = (arguments_: readonly string[]): ParsedArguments => {\n if (arguments_.length === 1 && arguments_[0] === \"--help\") return { kind: \"help\" }\n const [command, ...options] = arguments_\n if (command !== \"init\" && command !== \"update\") return { kind: \"invalid\", message: \"Expected init or update.\" }\n if (options.length === 0) return { kind: \"command\", command, dryRun: false }\n if (options.length === 1 && options[0] === \"--dry-run\") return { kind: \"command\", command, dryRun: true }\n return { kind: \"invalid\", message: \"Only --dry-run is supported after a command.\" }\n}\n\nconst run = async (): Promise<number> => {\n const parsed = parseArguments(process.argv.slice(2))\n switch (parsed.kind) {\n case \"help\":\n process.stdout.write(HELP)\n return 0\n case \"invalid\":\n process.stderr.write(`${parsed.message}\\n\\n${HELP}`)\n return 2\n case \"command\": {\n const manifest = await readPackageManifest()\n const packageSpec = `${manifest.name}@${manifest.version}`\n if (parsed.dryRun) {\n process.stdout.write(`opencode plugin add ${packageSpec}\\n`)\n return 0\n }\n await installGlobalPlugin(packageSpec)\n process.stdout.write(\"OpenCode plugin installation completed. Restart OpenCode.\\n\")\n return 0\n }\n }\n}\n\nrun()\n .then((exitCode) => {\n process.exitCode = exitCode\n })\n .catch((error: unknown) => {\n const message = error instanceof Error ? error.message : \"Unexpected CLI failure.\"\n process.stderr.write(`${message}\\n`)\n process.exitCode = 1\n })\n",
|
|
6
|
+
"import { spawn } from \"node:child_process\"\n\nexport class OpenCodePluginInstallError extends Error {\n readonly name = \"OpenCodePluginInstallError\"\n\n constructor(readonly exitCode: number | null) {\n super(\n exitCode === null\n ? \"OpenCode plugin installer exited without a status.\"\n : `OpenCode plugin installer exited with status ${exitCode}.`,\n )\n }\n}\n\nexport type CommandExecutor = (command: string, arguments_: readonly string[]) => Promise<void>\n\nexport const runCommand: CommandExecutor = (command, arguments_) =>\n new Promise((resolve, reject) => {\n const child = spawn(command, arguments_, { shell: false, stdio: \"inherit\" })\n child.once(\"error\", reject)\n child.once(\"close\", (exitCode) => {\n if (exitCode === 0) resolve()\n else reject(new OpenCodePluginInstallError(exitCode))\n })\n })\n\nexport const installGlobalPlugin = async (packageSpec: string, execute: CommandExecutor = runCommand): Promise<void> =>\n execute(\"opencode\", [\"plugin\", \"add\", packageSpec])\n"
|
|
7
7
|
],
|
|
8
|
-
"mappings": ";;;
|
|
9
|
-
"debugId": "
|
|
8
|
+
"mapp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C,UAAmB;AAAA,EACzB,MAAM,UAAU,iBAAiB,QAAQ,MAAM,UAAU;AAAA,EACzD,QAAQ,OAAO,MAAM,GAAG;AAAA,CAAW;AAAA,EACnC,QAAQ,WAAW;AAAA,CACpB;",
|
|
9
|
+
"debugId": "2B68ABCF198098E364756E2164756E21",
|
|
10
10
|
"names": []
|
|
11
11
|
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { Part } from "@opencode-ai/sdk";
|
|
2
1
|
export type VpetCommandEvent = {
|
|
3
2
|
readonly kind: "spawned";
|
|
4
3
|
readonly nodeId: string;
|
|
@@ -12,7 +11,8 @@ export type VpetCommandEvent = {
|
|
|
12
11
|
readonly nodeId: string;
|
|
13
12
|
};
|
|
14
13
|
export type VpetCommandResult = {
|
|
15
|
-
readonly
|
|
14
|
+
readonly message: string;
|
|
15
|
+
readonly variant: "info" | "warning";
|
|
16
16
|
readonly event?: VpetCommandEvent;
|
|
17
17
|
};
|
|
18
18
|
//# sourceMappingURL=vpet-command-result.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vpet-command-result.d.ts","sourceRoot":"","sources":["../../src/commands/vpet-command-result.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"vpet-command-result.d.ts","sourceRoot":"","sources":["../../src/commands/vpet-command-result.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,gBAAgB,GACxB;IAAE,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAA;CAAE,GAClF;IAAE,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAA;CAAE,GAC3B;IAAE,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAA;CAAE,GAC7B;IAAE,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAA;AAErD,MAAM,MAAM,iBAAiB,GAAG;IAC9B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IACxB,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,CAAA;IACpC,QAAQ,CAAC,KAAK,CAAC,EAAE,gBAAgB,CAAA;CAClC,CAAA"}
|
|
@@ -1,8 +1,4 @@
|
|
|
1
1
|
import type { VpetControl } from "../application/ports/vpet-control.ts";
|
|
2
2
|
import type { VpetCommandResult } from "./vpet-command-result.ts";
|
|
3
|
-
export
|
|
4
|
-
readonly sessionID: string;
|
|
5
|
-
readonly messageID: string;
|
|
6
|
-
};
|
|
7
|
-
export declare const runVpetFreezeCommand: (control: Pick<VpetControl, "freeze">, context: VpetFreezeContext) => Promise<VpetCommandResult>;
|
|
3
|
+
export declare const runVpetFreezeCommand: (control: Pick<VpetControl, "freeze">) => Promise<VpetCommandResult>;
|
|
8
4
|
//# sourceMappingURL=vpet-freeze.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vpet-freeze.d.ts","sourceRoot":"","sources":["../../src/commands/vpet-freeze.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sCAAsC,CAAA;AAEvE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAA;AAEjE,
|
|
1
|
+
{"version":3,"file":"vpet-freeze.d.ts","sourceRoot":"","sources":["../../src/commands/vpet-freeze.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sCAAsC,CAAA;AAEvE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAA;AAEjE,eAAO,MAAM,oBAAoB,GAAU,SAAS,IAAI,CAAC,WAAW,EAAE,QAAQ,CAAC,KAAG,OAAO,CAAC,iBAAiB,CAa1G,CAAA"}
|
|
@@ -2,8 +2,6 @@ import type { VpetControl } from "../application/ports/vpet-control.ts";
|
|
|
2
2
|
import type { DigimonCatalog } from "../data/catalog.ts";
|
|
3
3
|
import type { VpetCommandResult } from "./vpet-command-result.ts";
|
|
4
4
|
export type VpetSetContext = {
|
|
5
|
-
readonly sessionID: string;
|
|
6
|
-
readonly messageID: string;
|
|
7
5
|
readonly arguments: string;
|
|
8
6
|
};
|
|
9
7
|
export type DigimonCatalogLoader = () => Promise<DigimonCatalog>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vpet-set.d.ts","sourceRoot":"","sources":["../../src/commands/vpet-set.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"vpet-set.d.ts","sourceRoot":"","sources":["../../src/commands/vpet-set.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sCAAsC,CAAA;AAEvE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA;AACxD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAA;AAEjE,MAAM,MAAM,cAAc,GAAG;IAC3B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;CAC3B,CAAA;AAED,MAAM,MAAM,oBAAoB,GAAG,MAAM,OAAO,CAAC,cAAc,CAAC,CAAA;AAEhE,eAAO,MAAM,iBAAiB,GAC5B,SAAS,IAAI,CAAC,WAAW,EAAE,cAAc,CAAC,EAC1C,SAAS,cAAc,EACvB,aAAa,oBAAoB,KAChC,OAAO,CAAC,iBAAiB,CAwB3B,CAAA"}
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import type { PartnerLifecycle } from "../application/ports/partner-lifecycle.ts";
|
|
2
2
|
import type { VpetCommandResult } from "./vpet-command-result.ts";
|
|
3
3
|
export type VpetSpawnContext = {
|
|
4
|
-
readonly sessionID: string;
|
|
5
|
-
readonly messageID: string;
|
|
6
4
|
readonly createdAt: string;
|
|
7
5
|
};
|
|
8
6
|
export declare const runVpetSpawnCommand: (lifecycle: PartnerLifecycle, context: VpetSpawnContext) => Promise<VpetCommandResult>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vpet-spawn.d.ts","sourceRoot":"","sources":["../../src/commands/vpet-spawn.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,2CAA2C,CAAA;AAEjF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAA;AAEjE,MAAM,MAAM,gBAAgB,GAAG;IAC7B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;
|
|
1
|
+
{"version":3,"file":"vpet-spawn.d.ts","sourceRoot":"","sources":["../../src/commands/vpet-spawn.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,2CAA2C,CAAA;AAEjF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAA;AAEjE,MAAM,MAAM,gBAAgB,GAAG;IAC7B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;CAC3B,CAAA;AAED,eAAO,MAAM,mBAAmB,GAC9B,WAAW,gBAAgB,EAC3B,SAAS,gBAAgB,KACxB,OAAO,CAAC,iBAAiB,CAQ3B,CAAA"}
|
|
@@ -1,8 +1,4 @@
|
|
|
1
1
|
import type { VpetControl } from "../application/ports/vpet-control.ts";
|
|
2
2
|
import type { VpetCommandResult } from "./vpet-command-result.ts";
|
|
3
|
-
export
|
|
4
|
-
readonly sessionID: string;
|
|
5
|
-
readonly messageID: string;
|
|
6
|
-
};
|
|
7
|
-
export declare const runVpetUnfreezeCommand: (control: Pick<VpetControl, "unfreeze">, context: VpetUnfreezeContext) => Promise<VpetCommandResult>;
|
|
3
|
+
export declare const runVpetUnfreezeCommand: (control: Pick<VpetControl, "unfreeze">) => Promise<VpetCommandResult>;
|
|
8
4
|
//# sourceMappingURL=vpet-unfreeze.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vpet-unfreeze.d.ts","sourceRoot":"","sources":["../../src/commands/vpet-unfreeze.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sCAAsC,CAAA;AAEvE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAA;AAEjE,
|
|
1
|
+
{"version":3,"file":"vpet-unfreeze.d.ts","sourceRoot":"","sources":["../../src/commands/vpet-unfreeze.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sCAAsC,CAAA;AAEvE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAA;AAEjE,eAAO,MAAM,sBAAsB,GAAU,SAAS,IAAI,CAAC,WAAW,EAAE,UAAU,CAAC,KAAG,OAAO,CAAC,iBAAiB,CAa9G,CAAA"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,11 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
export { createCommandConfig } from "./adapters/opencode/
|
|
1
|
+
import { Plugin } from "@opencode/plugin";
|
|
2
|
+
export { createCommandConfig } from "./adapters/opencode/server-plugin.ts";
|
|
3
3
|
export { DIGIMON_DATA } from "./data/digimon-data.js";
|
|
4
4
|
export type { DigimonId, DigimonRecord, DigimonStage } from "./data/digimon-data.js";
|
|
5
|
-
export declare const plugin: Plugin;
|
|
6
|
-
|
|
7
|
-
readonly id: "opencode-vpet";
|
|
8
|
-
readonly server: Plugin;
|
|
9
|
-
};
|
|
10
|
-
export default entryPlugin;
|
|
5
|
+
export declare const plugin: Plugin.Plugin;
|
|
6
|
+
export default plugin;
|
|
11
7
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AAKzC,OAAO,EAAE,mBAAmB,EAAE,MAAM,sCAAsC,CAAA;AAC1E,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAA;AACrD,YAAY,EAAE,SAAS,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAA;AAEpF,eAAO,MAAM,MAAM,eAGjB,CAAA;AAEF,eAAe,MAAM,CAAA"}
|