opencode-pair-autonomy 1.0.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 +90 -0
- package/bin/opencode-pair-autonomy.js +20 -0
- package/dist/__tests__/comment-guard.test.d.ts +1 -0
- package/dist/__tests__/config.test.d.ts +1 -0
- package/dist/__tests__/learning.test.d.ts +1 -0
- package/dist/__tests__/plan-mode.test.d.ts +1 -0
- package/dist/agents.d.ts +2 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +15351 -0
- package/dist/commands.d.ts +2 -0
- package/dist/config.d.ts +3 -0
- package/dist/hooks/comment-guard.d.ts +15 -0
- package/dist/hooks/file-edited.d.ts +7 -0
- package/dist/hooks/index.d.ts +46 -0
- package/dist/hooks/post-tool-use.d.ts +5 -0
- package/dist/hooks/pre-compact.d.ts +4 -0
- package/dist/hooks/pre-tool-use.d.ts +5 -0
- package/dist/hooks/prompt-refiner.d.ts +38 -0
- package/dist/hooks/runtime.d.ts +91 -0
- package/dist/hooks/sdk.d.ts +6 -0
- package/dist/hooks/session-end.d.ts +4 -0
- package/dist/hooks/session-start.d.ts +19 -0
- package/dist/hooks/stop.d.ts +5 -0
- package/dist/i18n/index.d.ts +15 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +17823 -0
- package/dist/installer.d.ts +12 -0
- package/dist/learning/analyzer.d.ts +15 -0
- package/dist/learning/store.d.ts +4 -0
- package/dist/learning/types.d.ts +32 -0
- package/dist/mcp.d.ts +4 -0
- package/dist/project-facts.d.ts +8 -0
- package/dist/prompts/coordinator.d.ts +2 -0
- package/dist/prompts/shared.d.ts +5 -0
- package/dist/prompts/workers.d.ts +8 -0
- package/dist/types.d.ts +81 -0
- package/dist/utils.d.ts +6 -0
- package/examples/opencode-pair-autonomy.jsonc +35 -0
- package/examples/opencode.jsonc +17 -0
- package/package.json +103 -0
- package/vendor/mcp/pg-mcp/README.md +91 -0
- package/vendor/mcp/pg-mcp/config.example.json +26 -0
- package/vendor/mcp/pg-mcp/config.json +15 -0
- package/vendor/mcp/pg-mcp/package-lock.json +1288 -0
- package/vendor/mcp/pg-mcp/package.json +18 -0
- package/vendor/mcp/pg-mcp/src/config.js +71 -0
- package/vendor/mcp/pg-mcp/src/db.js +85 -0
- package/vendor/mcp/pg-mcp/src/index.js +203 -0
- package/vendor/mcp/pg-mcp/src/sqlGuard.js +75 -0
- package/vendor/mcp/pg-mcp/src/tools.js +89 -0
- package/vendor/mcp/ssh-mcp/README.md +46 -0
- package/vendor/mcp/ssh-mcp/config.example.json +23 -0
- package/vendor/mcp/ssh-mcp/config.json +6 -0
- package/vendor/mcp/ssh-mcp/package-lock.json +1142 -0
- package/vendor/mcp/ssh-mcp/package.json +18 -0
- package/vendor/mcp/ssh-mcp/src/config.js +140 -0
- package/vendor/mcp/ssh-mcp/src/index.js +130 -0
- package/vendor/mcp/ssh-mcp/src/ssh.js +163 -0
- package/vendor/mcp/sudo-mcp/README.md +51 -0
- package/vendor/mcp/sudo-mcp/config.example.json +28 -0
- package/vendor/mcp/sudo-mcp/config.json +28 -0
- package/vendor/mcp/sudo-mcp/package-lock.json +1145 -0
- package/vendor/mcp/sudo-mcp/package.json +18 -0
- package/vendor/mcp/sudo-mcp/src/config.js +57 -0
- package/vendor/mcp/sudo-mcp/src/index.js +267 -0
- package/vendor/mcp/sudo-mcp/src/runner.js +168 -0
- package/vendor/mcp/web-agent-mcp/package-lock.json +2886 -0
- package/vendor/mcp/web-agent-mcp/package.json +28 -0
- package/vendor/mcp/web-agent-mcp/src/adapters/cloakbrowser/adapter.ts +335 -0
- package/vendor/mcp/web-agent-mcp/src/adapters/cloakbrowser/auth-heuristics.ts +324 -0
- package/vendor/mcp/web-agent-mcp/src/adapters/cloakbrowser/launcher.ts +1340 -0
- package/vendor/mcp/web-agent-mcp/src/config/env.ts +107 -0
- package/vendor/mcp/web-agent-mcp/src/core/action-flow.ts +82 -0
- package/vendor/mcp/web-agent-mcp/src/core/artifact-store.ts +109 -0
- package/vendor/mcp/web-agent-mcp/src/core/errors.ts +108 -0
- package/vendor/mcp/web-agent-mcp/src/core/observation-flow.ts +38 -0
- package/vendor/mcp/web-agent-mcp/src/core/policy-engine.ts +113 -0
- package/vendor/mcp/web-agent-mcp/src/core/retry-policy.ts +42 -0
- package/vendor/mcp/web-agent-mcp/src/core/session-manager.ts +670 -0
- package/vendor/mcp/web-agent-mcp/src/core/session-restart-policy.ts +34 -0
- package/vendor/mcp/web-agent-mcp/src/core/task-history.ts +97 -0
- package/vendor/mcp/web-agent-mcp/src/index.ts +3 -0
- package/vendor/mcp/web-agent-mcp/src/schemas/act.ts +167 -0
- package/vendor/mcp/web-agent-mcp/src/schemas/common.ts +56 -0
- package/vendor/mcp/web-agent-mcp/src/schemas/observe.ts +214 -0
- package/vendor/mcp/web-agent-mcp/src/schemas/page.ts +21 -0
- package/vendor/mcp/web-agent-mcp/src/schemas/policy.ts +42 -0
- package/vendor/mcp/web-agent-mcp/src/schemas/runtime.ts +21 -0
- package/vendor/mcp/web-agent-mcp/src/schemas/session.ts +63 -0
- package/vendor/mcp/web-agent-mcp/src/server.ts +75 -0
- package/vendor/mcp/web-agent-mcp/src/tools/act/click.ts +68 -0
- package/vendor/mcp/web-agent-mcp/src/tools/act/drag.ts +57 -0
- package/vendor/mcp/web-agent-mcp/src/tools/act/enter-code.ts +78 -0
- package/vendor/mcp/web-agent-mcp/src/tools/act/fill.ts +65 -0
- package/vendor/mcp/web-agent-mcp/src/tools/act/pinch.ts +58 -0
- package/vendor/mcp/web-agent-mcp/src/tools/act/press.ts +67 -0
- package/vendor/mcp/web-agent-mcp/src/tools/act/shared.ts +73 -0
- package/vendor/mcp/web-agent-mcp/src/tools/act/swipe.ts +59 -0
- package/vendor/mcp/web-agent-mcp/src/tools/act/wait-for.ts +56 -0
- package/vendor/mcp/web-agent-mcp/src/tools/act/wheel.ts +59 -0
- package/vendor/mcp/web-agent-mcp/src/tools/observe/a11y.ts +60 -0
- package/vendor/mcp/web-agent-mcp/src/tools/observe/auth-state.ts +92 -0
- package/vendor/mcp/web-agent-mcp/src/tools/observe/boxes.ts +66 -0
- package/vendor/mcp/web-agent-mcp/src/tools/observe/console.ts +67 -0
- package/vendor/mcp/web-agent-mcp/src/tools/observe/dom.ts +60 -0
- package/vendor/mcp/web-agent-mcp/src/tools/observe/network.ts +67 -0
- package/vendor/mcp/web-agent-mcp/src/tools/observe/page-state.ts +93 -0
- package/vendor/mcp/web-agent-mcp/src/tools/observe/screenshot.ts +73 -0
- package/vendor/mcp/web-agent-mcp/src/tools/observe/text.ts +70 -0
- package/vendor/mcp/web-agent-mcp/src/tools/observe/wait-for-network.ts +70 -0
- package/vendor/mcp/web-agent-mcp/src/tools/page/navigate.ts +59 -0
- package/vendor/mcp/web-agent-mcp/src/tools/policy/recommend-observation.ts +40 -0
- package/vendor/mcp/web-agent-mcp/src/tools/register-tools.ts +55 -0
- package/vendor/mcp/web-agent-mcp/src/tools/runtime/evaluate-js.ts +83 -0
- package/vendor/mcp/web-agent-mcp/src/tools/session/close.ts +41 -0
- package/vendor/mcp/web-agent-mcp/src/tools/session/create.ts +86 -0
- package/vendor/mcp/web-agent-mcp/src/tools/session/restart.ts +72 -0
- package/vendor/mcp/web-agent-mcp/src/utils/fs.ts +28 -0
- package/vendor/mcp/web-agent-mcp/src/utils/ids.ts +9 -0
- package/vendor/mcp/web-agent-mcp/src/utils/time.ts +7 -0
- package/vendor/mcp/web-agent-mcp/tsconfig.json +22 -0
- package/vendor/skills/editorial-technical-ui/SKILL.md +84 -0
- package/vendor/skills/figma-console/SKILL.md +839 -0
- package/vendor/skills/go-fiber-postgres/SKILL.md +31 -0
- package/vendor/skills/opencode-plugin-dev/SKILL.md +31 -0
- package/vendor/skills/rust-media-desktop/SKILL.md +30 -0
- package/vendor/skills/vue-vite-ui/SKILL.md +31 -0
- package/vendor/skills/web-agent-browser/SKILL.md +140 -0
package/dist/config.d.ts
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { HarnessConfig } from "./types";
|
|
2
|
+
export declare function loadHarnessConfig(projectDirectory: string): HarnessConfig;
|
|
3
|
+
export declare const SAMPLE_PROJECT_CONFIG = "{\n // Project-level overrides for opencode-pair-autonomy\n \"default_mode\": \"coordinator\",\n \"credentials\": {\n \"jina_api_key\": \"\",\n \"figma_access_token\": \"\"\n },\n \"figma_console\": {\n \"ssh_host\": \"\"\n },\n \"hooks\": {\n \"profile\": \"standard\",\n \"comment_guard\": true,\n \"session_start\": true,\n \"pre_tool_use\": true,\n \"post_tool_use\": true,\n \"pre_compact\": true,\n \"stop\": true,\n \"session_end\": true,\n \"file_edited\": true,\n \"prompt_refiner\": false\n },\n \"memory\": {\n \"enabled\": true,\n \"lookback_days\": 7,\n \"max_injected_chars\": 3500\n },\n \"learning\": {\n \"enabled\": true,\n \"min_observations\": 6,\n \"auto_promote\": true,\n \"max_patterns\": 24,\n \"max_injected_patterns\": 5\n },\n \"mcps\": {\n \"context7\": true,\n \"grep_app\": true,\n \"websearch\": true,\n \"fff\": true,\n \"web_agent_mcp\": true,\n \"pg_mcp\": true,\n \"ssh_mcp\": true,\n \"sudo_mcp\": false,\n \"jina\": true,\n \"figma_console\": true,\n \"mariadb\": true\n },\n \"agents\": {}\n}";
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
type ToolAfterInput = {
|
|
2
|
+
tool: string;
|
|
3
|
+
sessionID: string;
|
|
4
|
+
callID: string;
|
|
5
|
+
args: Record<string, unknown>;
|
|
6
|
+
};
|
|
7
|
+
type ToolAfterOutput = {
|
|
8
|
+
title: string;
|
|
9
|
+
output: string;
|
|
10
|
+
metadata: unknown;
|
|
11
|
+
};
|
|
12
|
+
export declare function createCommentGuardHook(): {
|
|
13
|
+
"tool.execute.after": (input: ToolAfterInput, output: ToolAfterOutput) => Promise<void>;
|
|
14
|
+
};
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { PluginInput } from "@opencode-ai/plugin";
|
|
2
|
+
import type { HarnessConfig } from "../types";
|
|
3
|
+
export declare function createHarnessHooks(ctx: PluginInput, config: HarnessConfig): Promise<{
|
|
4
|
+
config: ((config: any) => Promise<void>) | undefined;
|
|
5
|
+
"chat.message": ((input: any, output: any) => Promise<void>) | undefined;
|
|
6
|
+
"chat.headers": undefined;
|
|
7
|
+
event: ((input: {
|
|
8
|
+
event: {
|
|
9
|
+
type: string;
|
|
10
|
+
properties?: unknown;
|
|
11
|
+
};
|
|
12
|
+
}) => Promise<void>) | undefined;
|
|
13
|
+
"tool.execute.before": ((input: any) => Promise<void>) | undefined;
|
|
14
|
+
"tool.execute.after": ((input: any, output: any) => Promise<void>) | undefined;
|
|
15
|
+
"file.edited": ((input: any) => Promise<void>) | undefined;
|
|
16
|
+
"session.created": ((input: any) => Promise<void>) | undefined;
|
|
17
|
+
"session.idle": ((input: any) => Promise<void>) | undefined;
|
|
18
|
+
"session.deleted": ((input: any) => Promise<void>) | undefined;
|
|
19
|
+
"experimental.session.compacting": ((input: any) => Promise<void>) | undefined;
|
|
20
|
+
"experimental.chat.messages.transform": ((_input: unknown, output: {
|
|
21
|
+
messages?: {
|
|
22
|
+
info?: {
|
|
23
|
+
id?: string;
|
|
24
|
+
role?: string;
|
|
25
|
+
sessionID?: string;
|
|
26
|
+
};
|
|
27
|
+
parts?: {
|
|
28
|
+
id?: string;
|
|
29
|
+
sessionID?: string;
|
|
30
|
+
messageID?: string;
|
|
31
|
+
type: string;
|
|
32
|
+
text?: string;
|
|
33
|
+
mime?: string;
|
|
34
|
+
filename?: string;
|
|
35
|
+
ignored?: boolean;
|
|
36
|
+
synthetic?: boolean;
|
|
37
|
+
metadata?: Record<string, unknown>;
|
|
38
|
+
}[];
|
|
39
|
+
}[];
|
|
40
|
+
}) => Promise<void>) | undefined;
|
|
41
|
+
"experimental.text.complete": ((input: {
|
|
42
|
+
sessionID?: string;
|
|
43
|
+
}, output: {
|
|
44
|
+
text?: string;
|
|
45
|
+
}) => Promise<void>) | undefined;
|
|
46
|
+
}>;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { HarnessConfig, HookProfile } from "../types";
|
|
2
|
+
import type { HookRuntime } from "./runtime";
|
|
3
|
+
export declare function createPostToolUseHook(config: HarnessConfig, runtime: HookRuntime, profile: HookProfile): {
|
|
4
|
+
"tool.execute.after": (input: unknown, output: unknown) => Promise<void>;
|
|
5
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { HarnessConfig } from "../types";
|
|
2
|
+
import type { HookRuntime } from "./runtime";
|
|
3
|
+
export declare function createPreToolUseHook(config: HarnessConfig, runtime: HookRuntime, profile: import("../types").HookProfile): {
|
|
4
|
+
"tool.execute.before": (input: unknown) => Promise<void>;
|
|
5
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { PluginInput } from "@opencode-ai/plugin";
|
|
2
|
+
type MessagePart = {
|
|
3
|
+
id?: string;
|
|
4
|
+
sessionID?: string;
|
|
5
|
+
messageID?: string;
|
|
6
|
+
type: string;
|
|
7
|
+
text?: string;
|
|
8
|
+
mime?: string;
|
|
9
|
+
filename?: string;
|
|
10
|
+
ignored?: boolean;
|
|
11
|
+
synthetic?: boolean;
|
|
12
|
+
metadata?: Record<string, unknown>;
|
|
13
|
+
};
|
|
14
|
+
type Message = {
|
|
15
|
+
info?: {
|
|
16
|
+
id?: string;
|
|
17
|
+
role?: string;
|
|
18
|
+
sessionID?: string;
|
|
19
|
+
};
|
|
20
|
+
parts?: MessagePart[];
|
|
21
|
+
};
|
|
22
|
+
export declare function createPromptRefinerHook(ctx: PluginInput): {
|
|
23
|
+
"experimental.chat.messages.transform": (_input: unknown, output: {
|
|
24
|
+
messages?: Message[];
|
|
25
|
+
}) => Promise<void>;
|
|
26
|
+
"experimental.text.complete": (input: {
|
|
27
|
+
sessionID?: string;
|
|
28
|
+
}, output: {
|
|
29
|
+
text?: string;
|
|
30
|
+
}) => Promise<void>;
|
|
31
|
+
"experimental.session.compacting": (_input: {
|
|
32
|
+
sessionID: string;
|
|
33
|
+
}, output: {
|
|
34
|
+
context: string[];
|
|
35
|
+
prompt?: string;
|
|
36
|
+
}) => Promise<void>;
|
|
37
|
+
};
|
|
38
|
+
export {};
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import type { PluginInput } from "@opencode-ai/plugin";
|
|
2
|
+
import { type SupportedLocale } from "../i18n";
|
|
3
|
+
import type { HarnessConfig, HookProfile } from "../types";
|
|
4
|
+
import { readText } from "../utils";
|
|
5
|
+
import type { LearnedPattern } from "../learning/types";
|
|
6
|
+
import { type ProjectFacts } from "../project-facts";
|
|
7
|
+
export type PersistedSessionSummary = {
|
|
8
|
+
sessionID: string;
|
|
9
|
+
savedAt: string;
|
|
10
|
+
locale?: SupportedLocale;
|
|
11
|
+
packageManager: string;
|
|
12
|
+
languages: string[];
|
|
13
|
+
frameworks: string[];
|
|
14
|
+
changedFiles: string[];
|
|
15
|
+
incompleteTodos: string[];
|
|
16
|
+
lastUserMessage: string;
|
|
17
|
+
lastAssistantMessage: string;
|
|
18
|
+
approxTokens: number;
|
|
19
|
+
};
|
|
20
|
+
export type Observation = {
|
|
21
|
+
timestamp: string;
|
|
22
|
+
phase: "pre" | "post" | "idle";
|
|
23
|
+
sessionID?: string;
|
|
24
|
+
agent?: string;
|
|
25
|
+
tool?: string;
|
|
26
|
+
note?: string;
|
|
27
|
+
};
|
|
28
|
+
declare function estimateTokens(chunks: string[]): number;
|
|
29
|
+
export declare function resolveHookProfile(config: HarnessConfig): HookProfile;
|
|
30
|
+
export declare function profileMatches(profile: HookProfile, allowed: HookProfile | HookProfile[]): boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Primary (user-facing) agents that should receive session-context injection.
|
|
33
|
+
* Subagents spawned via Task tool should NOT get previous-session context
|
|
34
|
+
* injected into their system prompt — it causes session mixing.
|
|
35
|
+
*/
|
|
36
|
+
export declare const PRIMARY_AGENTS: Set<string>;
|
|
37
|
+
/**
|
|
38
|
+
* Resolve a session ID from a hook input object.
|
|
39
|
+
*
|
|
40
|
+
* IMPORTANT: Does NOT fall back to bare `candidate.id` because tool-execution
|
|
41
|
+
* inputs often carry a tool-call / message `id` that is not a session ID.
|
|
42
|
+
* Use {@link resolveSessionOrEntityID} in session-lifecycle hooks where the
|
|
43
|
+
* input object IS the session itself and `.id` is the session ID.
|
|
44
|
+
*/
|
|
45
|
+
export declare function resolveSessionID(value: unknown): string | undefined;
|
|
46
|
+
/**
|
|
47
|
+
* Like {@link resolveSessionID} but also falls back to bare `.id`.
|
|
48
|
+
* Use ONLY for session-lifecycle hooks (session.created, session.idle,
|
|
49
|
+
* session.deleted) where the input object represents the session itself.
|
|
50
|
+
*/
|
|
51
|
+
export declare function resolveSessionOrEntityID(value: unknown): string | undefined;
|
|
52
|
+
export declare function resolveAgentName(value: unknown): string | undefined;
|
|
53
|
+
export declare function resolveToolName(value: unknown): string | undefined;
|
|
54
|
+
export declare function resolveToolArgs(value: unknown): Record<string, unknown>;
|
|
55
|
+
export declare function resolveFilePathFromArgs(args: Record<string, unknown>): string | undefined;
|
|
56
|
+
export declare function stringifyToolOutput(output: unknown): string;
|
|
57
|
+
export declare function createHookRuntime(ctx: PluginInput, config: HarnessConfig): {
|
|
58
|
+
detectProjectFacts: () => ProjectFacts;
|
|
59
|
+
estimateTokens: typeof estimateTokens;
|
|
60
|
+
loadLatestSummary: () => PersistedSessionSummary | undefined;
|
|
61
|
+
loadLearnedPatterns: () => LearnedPattern[];
|
|
62
|
+
prepareSessionContext: (sessionID: string) => void;
|
|
63
|
+
consumePendingInjection: (sessionID: string, locale?: SupportedLocale) => string | undefined;
|
|
64
|
+
saveSessionSummary: (summary: PersistedSessionSummary) => void;
|
|
65
|
+
appendObservation: (observation: Observation) => void;
|
|
66
|
+
promoteLearning: (summary: PersistedSessionSummary) => LearnedPattern[];
|
|
67
|
+
setSessionAgent: (sessionID: string, agent: string | undefined) => void;
|
|
68
|
+
getSessionAgent: (sessionID: string) => string | undefined;
|
|
69
|
+
setSessionLocale: (sessionID: string, locale: SupportedLocale | undefined) => void;
|
|
70
|
+
getSessionLocale: (sessionID: string) => SupportedLocale | undefined;
|
|
71
|
+
resolveLocale: (sessionID?: string, ...texts: Array<string | undefined>) => SupportedLocale;
|
|
72
|
+
rememberEditedFile: (sessionID: string, filePath: string) => void;
|
|
73
|
+
getEditedFiles: (sessionID: string) => string[];
|
|
74
|
+
incrementToolCount: (sessionID: string) => number;
|
|
75
|
+
shouldSuggestCompact: (sessionID: string, threshold?: number, repeat?: number) => boolean;
|
|
76
|
+
clearSession: (sessionID: string) => void;
|
|
77
|
+
readText: typeof readText;
|
|
78
|
+
getPlanMode: (sessionID: string) => "planning" | "executing";
|
|
79
|
+
setPlanMode: (sessionID: string, mode: "planning" | "executing") => void;
|
|
80
|
+
incrementPlanModeBlock: (sessionID: string) => number;
|
|
81
|
+
resetPlanModeBlockCount: (sessionID: string) => void;
|
|
82
|
+
incrementWorkerMessages: (workerID: string) => number;
|
|
83
|
+
shouldSpawnFresh: (workerID: string) => boolean;
|
|
84
|
+
incrementReviewCycle: (sessionID: string) => number;
|
|
85
|
+
getReviewCycleCount: (sessionID: string) => number;
|
|
86
|
+
isWsl: () => boolean;
|
|
87
|
+
getWslWinPath: () => string;
|
|
88
|
+
buildModeInjection: (sessionID: string) => string;
|
|
89
|
+
};
|
|
90
|
+
export type HookRuntime = ReturnType<typeof createHookRuntime>;
|
|
91
|
+
export {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare class BlockingHookError extends Error {
|
|
2
|
+
constructor(message: string);
|
|
3
|
+
}
|
|
4
|
+
export declare function unwrapData<T>(value: unknown, fallback: T): T;
|
|
5
|
+
export declare function safeCreateHook<T>(name: string, factory: () => T): T | undefined;
|
|
6
|
+
export declare function safeHook<T extends (...args: any[]) => Promise<void> | void>(name: string, hook?: T): T | undefined;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { PluginInput } from "@opencode-ai/plugin";
|
|
2
|
+
import type { HarnessConfig } from "../types";
|
|
3
|
+
import type { HookRuntime } from "./runtime";
|
|
4
|
+
type ChatMessageInput = {
|
|
5
|
+
sessionID: string;
|
|
6
|
+
agent?: string;
|
|
7
|
+
};
|
|
8
|
+
type ChatMessageOutput = {
|
|
9
|
+
message: Record<string, unknown>;
|
|
10
|
+
parts?: Array<{
|
|
11
|
+
type?: string;
|
|
12
|
+
text?: string;
|
|
13
|
+
}>;
|
|
14
|
+
};
|
|
15
|
+
export declare function createSessionStartHook(ctx: PluginInput, config: HarnessConfig, runtime: HookRuntime): {
|
|
16
|
+
"session.created": (input?: unknown) => Promise<void>;
|
|
17
|
+
"chat.message": (input: ChatMessageInput, output: ChatMessageOutput) => Promise<void>;
|
|
18
|
+
};
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import en from "./en.json";
|
|
2
|
+
export type SupportedLocale = "en" | "tr";
|
|
3
|
+
type Catalog = typeof en;
|
|
4
|
+
export declare function getCatalog(locale: SupportedLocale): Catalog;
|
|
5
|
+
export declare function normalizeText(text: string): string;
|
|
6
|
+
export declare function getSignals(locale: SupportedLocale, group: "intent" | "preferences", key: string): string[];
|
|
7
|
+
export declare function getLanguageHints(locale: SupportedLocale): string[];
|
|
8
|
+
export declare function matchesAnySignal(text: string, phrases: string[]): boolean;
|
|
9
|
+
export declare function detectLocaleFromTexts(...texts: Array<string | undefined>): SupportedLocale;
|
|
10
|
+
export declare function extractTextParts(parts: Array<{
|
|
11
|
+
type?: string;
|
|
12
|
+
text?: string;
|
|
13
|
+
}>): string;
|
|
14
|
+
export declare function getAllSignals(group: "intent" | "preferences", key: string): string[];
|
|
15
|
+
export {};
|
package/dist/index.d.ts
ADDED