@debian777/kairos-mcp 3.3.3 → 3.4.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 +179 -105
- package/dist/.tsbuildinfo +1 -1
- package/dist/cli/commands/mint.d.ts.map +1 -1
- package/dist/cli/commands/mint.js +9 -1
- package/dist/cli/commands/mint.js.map +1 -1
- package/dist/embed-docs/mem/00000000-0000-0000-0000-000000002001.md +124 -162
- package/dist/embed-docs/mem/00000000-0000-0000-0000-000000002002.md +36 -34
- package/dist/embed-docs/mem/00000000-0000-0000-0000-000000002003.md +195 -0
- package/dist/embed-docs/mem/00000000-0000-0000-0000-000000002004.md +240 -0
- package/dist/embed-docs/mem/README.md +24 -0
- package/dist/resources/docs-resources.d.ts.map +1 -1
- package/dist/resources/docs-resources.js +9 -1
- package/dist/resources/docs-resources.js.map +1 -1
- package/dist/resources/embedded-mcp-resources.d.ts +14 -0
- package/dist/resources/embedded-mcp-resources.d.ts.map +1 -1
- package/dist/resources/embedded-mcp-resources.js +33 -9
- package/dist/resources/embedded-mcp-resources.js.map +1 -1
- package/dist/resources/mem-resources-boot.d.ts.map +1 -1
- package/dist/resources/mem-resources-boot.js +11 -3
- package/dist/resources/mem-resources-boot.js.map +1 -1
- package/dist/services/chain-step-count.d.ts +23 -0
- package/dist/services/chain-step-count.d.ts.map +1 -0
- package/dist/services/chain-step-count.js +23 -0
- package/dist/services/chain-step-count.js.map +1 -0
- package/dist/services/chain-utils.d.ts.map +1 -1
- package/dist/services/chain-utils.js +14 -9
- package/dist/services/chain-utils.js.map +1 -1
- package/dist/services/memory/store-methods.d.ts.map +1 -1
- package/dist/services/memory/store-methods.js +20 -12
- package/dist/services/memory/store-methods.js.map +1 -1
- package/dist/services/qdrant/memory-retrieval.d.ts +6 -1
- package/dist/services/qdrant/memory-retrieval.d.ts.map +1 -1
- package/dist/services/qdrant/memory-retrieval.js +21 -3
- package/dist/services/qdrant/memory-retrieval.js.map +1 -1
- package/dist/services/qdrant/service.d.ts +1 -1
- package/dist/services/qdrant/service.d.ts.map +1 -1
- package/dist/services/qdrant/service.js +2 -2
- package/dist/services/qdrant/service.js.map +1 -1
- package/dist/tools/kairos-challenge-display.d.ts.map +1 -1
- package/dist/tools/kairos-challenge-display.js +32 -2
- package/dist/tools/kairos-challenge-display.js.map +1 -1
- package/dist/tools/kairos_begin.d.ts +5 -0
- package/dist/tools/kairos_begin.d.ts.map +1 -1
- package/dist/tools/kairos_begin.js +8 -8
- package/dist/tools/kairos_begin.js.map +1 -1
- package/dist/tools/kairos_begin_schema.d.ts +5 -0
- package/dist/tools/kairos_begin_schema.d.ts.map +1 -1
- package/dist/tools/kairos_begin_schema.js +6 -1
- package/dist/tools/kairos_begin_schema.js.map +1 -1
- package/dist/tools/kairos_dump.js +1 -1
- package/dist/tools/kairos_dump.js.map +1 -1
- package/dist/tools/kairos_next-previous-step.d.ts.map +1 -1
- package/dist/tools/kairos_next-previous-step.js +11 -3
- package/dist/tools/kairos_next-previous-step.js.map +1 -1
- package/dist/tools/kairos_next_schema.d.ts +5 -0
- package/dist/tools/kairos_next_schema.d.ts.map +1 -1
- package/dist/tools/kairos_next_schema.js +7 -1
- package/dist/tools/kairos_next_schema.js.map +1 -1
- package/dist/tools/shell-challenge-invocation.d.ts +32 -0
- package/dist/tools/shell-challenge-invocation.d.ts.map +1 -0
- package/dist/tools/shell-challenge-invocation.js +113 -0
- package/dist/tools/shell-challenge-invocation.js.map +1 -0
- package/dist/types/memory.d.ts +10 -0
- package/dist/types/memory.d.ts.map +1 -1
- package/dist/ui/assets/{AccountPage-kxmPtqQP.js → AccountPage-BL4GHk9f.js} +1 -1
- package/dist/ui/assets/{ErrorAlert-ME7tEJ6X.js → ErrorAlert-KEgeKl22.js} +1 -1
- package/dist/ui/assets/{HomePage-DxiAsvs-.js → HomePage-DWAvtfBC.js} +1 -1
- package/dist/ui/assets/KairosPage-DZpZ35yd.js +1 -0
- package/dist/ui/assets/NotFoundPage-BrPNDuhe.js +1 -0
- package/dist/ui/assets/{ProtocolDetailPage-DKaSVepL.js → ProtocolDetailPage-R0XlRsIa.js} +1 -1
- package/dist/ui/assets/ProtocolEditPage-CzAnruE6.js +5 -0
- package/dist/ui/assets/{RenderedMarkdown-DjbuQlBl.js → RenderedMarkdown-CMavJdAJ.js} +1 -1
- package/dist/ui/assets/RunGuidedPage-Cm68aCC7.js +1 -0
- package/dist/ui/assets/{RunsPage-ctnsEF2U.js → RunsPage-DcDoMCq1.js} +1 -1
- package/dist/ui/assets/{SkillBundlePage-CaWW5oGq.js → SkillBundlePage-LuYOnVDQ.js} +1 -1
- package/dist/ui/assets/index-0G3wloMr.css +2 -0
- package/dist/ui/assets/index-S4_XWO39.js +8 -0
- package/dist/ui/assets/{tiptap-kMFBDujG.js → tiptap-CzV8H9Mb.js} +22 -22
- package/dist/ui/assets/useProtocol-C3ClZHlN.js +4 -0
- package/dist/ui/assets/{useSpaces-BV6eUjY3.js → useSpaces-DQEfGh8E.js} +1 -1
- package/dist/ui/assets/{vendor-GiUVcjs7.js → vendor-CVpIjmrD.js} +1 -1
- package/dist/ui/index.html +4 -4
- package/dist/utils/space-filter.d.ts +8 -0
- package/dist/utils/space-filter.d.ts.map +1 -1
- package/dist/utils/space-filter.js +18 -0
- package/dist/utils/space-filter.js.map +1 -1
- package/package.json +2 -1
- package/dist/ui/assets/KairosPage-BkqYs3-_.js +0 -1
- package/dist/ui/assets/NotFoundPage-DyfbQ-6G.js +0 -1
- package/dist/ui/assets/ProtocolEditPage-D-aTavvx.js +0 -1
- package/dist/ui/assets/RunGuidedPage-BUD0MaGh.js +0 -1
- package/dist/ui/assets/index-Duu55PkQ.css +0 -2
- package/dist/ui/assets/index-bQSxsGMU.js +0 -8
- package/dist/ui/assets/useProtocol-BruWpIzq.js +0 -4
|
@@ -87,6 +87,11 @@ export declare const kairosNextOutputSchema: z.ZodObject<{
|
|
|
87
87
|
shell: z.ZodOptional<z.ZodObject<{
|
|
88
88
|
cmd: z.ZodString;
|
|
89
89
|
timeout_seconds: z.ZodNumber;
|
|
90
|
+
interpreter: z.ZodOptional<z.ZodString>;
|
|
91
|
+
flags: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
92
|
+
args: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
93
|
+
workdir: z.ZodOptional<z.ZodString>;
|
|
94
|
+
invocation_display: z.ZodOptional<z.ZodString>;
|
|
90
95
|
}, z.core.$strip>>;
|
|
91
96
|
mcp: z.ZodOptional<z.ZodObject<{
|
|
92
97
|
tool_name: z.ZodString;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kairos_next_schema.d.ts","sourceRoot":"","sources":["../../src/tools/kairos_next_schema.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,QAAA,MAAM,eAAe,aAEyD,CAAC;AAE/E,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAiC1B,CAAC;
|
|
1
|
+
{"version":3,"file":"kairos_next_schema.d.ts","sourceRoot":"","sources":["../../src/tools/kairos_next_schema.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,QAAA,MAAM,eAAe,aAEyD,CAAC;AAE/E,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAiC1B,CAAC;AA6BF,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAGhC,CAAC;AAEH,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAajC,CAAC;AAEH,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AAChE,OAAO,EAAE,eAAe,EAAE,CAAC"}
|
|
@@ -47,7 +47,13 @@ const challengeSchema = z.object({
|
|
|
47
47
|
proof_hash: z.string().optional().describe('Echo back as solution.proof_hash'),
|
|
48
48
|
shell: z.object({
|
|
49
49
|
cmd: z.string(),
|
|
50
|
-
timeout_seconds: z.number()
|
|
50
|
+
timeout_seconds: z.number(),
|
|
51
|
+
interpreter: z.string().optional(),
|
|
52
|
+
flags: z.array(z.string()).optional(),
|
|
53
|
+
args: z.array(z.string()).optional(),
|
|
54
|
+
workdir: z.string().optional(),
|
|
55
|
+
/** Server-computed display line for agents/UI. */
|
|
56
|
+
invocation_display: z.string().optional()
|
|
51
57
|
}).optional(),
|
|
52
58
|
mcp: z.object({
|
|
53
59
|
tool_name: z.string(),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kairos_next_schema.js","sourceRoot":"","sources":["../../src/tools/kairos_next_schema.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,eAAe,GAAG,CAAC;KACtB,MAAM,EAAE;KACR,KAAK,CAAC,kCAAkC,EAAE,gCAAgC,CAAC,CAAC;AAE/E,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,CAAC,MAAM,CAAC;IACrC,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,KAAK,EAAE,YAAY,EAAE,SAAS,CAAC,CAAC,CAAC,QAAQ,CAAC,2BAA2B,CAAC;IAC7F,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,2BAA2B,CAAC;IAClE,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,qDAAqD,CAAC;IACjG,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC;QACd,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;QACrB,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;QAC7B,MAA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,EAAE,CAAC,QAAQ,CAAC,gDAAgD,CAAC;IAClF,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,sEAAsE,CAAC;IAClH,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC9B,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,0EAA0E,CAAC;IACtH,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,6DAA6D,CAAC;CAC3G,CAAC,CAAC;AAGH,OAAO,EAAE,eAAe,EAAE,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Build logical argv for shell challenges. Executors (agents/CLI) run this locally;
|
|
3
|
+
* the MCP server does not spawn processes for PoW.
|
|
4
|
+
*/
|
|
5
|
+
export type ShellChallengeFields = {
|
|
6
|
+
cmd?: string;
|
|
7
|
+
interpreter?: string;
|
|
8
|
+
flags?: string[];
|
|
9
|
+
args?: string[];
|
|
10
|
+
workdir?: string;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Normalize loose proof/UI fields into argv input without assigning `undefined`
|
|
14
|
+
* to optional keys (required when `exactOptionalPropertyTypes` is enabled).
|
|
15
|
+
*/
|
|
16
|
+
export declare function pickShellChallengeFields(shell: {
|
|
17
|
+
cmd: string;
|
|
18
|
+
interpreter?: string | undefined;
|
|
19
|
+
flags?: string[] | undefined;
|
|
20
|
+
args?: string[] | undefined;
|
|
21
|
+
workdir?: string | undefined;
|
|
22
|
+
}): ShellChallengeFields;
|
|
23
|
+
/**
|
|
24
|
+
* argv for the challenge. Legacy: no interpreter or bash → bash -c cmd [-- args].
|
|
25
|
+
*/
|
|
26
|
+
export declare function buildShellChallengeArgv(shell: ShellChallengeFields): string[];
|
|
27
|
+
/** Best-effort single-line invocation for descriptions/UI (POSIX-style quoting). */
|
|
28
|
+
export declare function shellQuoteArg(arg: string): string;
|
|
29
|
+
export declare function formatShellInvocationForDisplay(argv: string[]): string;
|
|
30
|
+
/** One-line summary for error messages (missing proof, etc.). */
|
|
31
|
+
export declare function formatShellChallengeInvocationSummary(shell: ShellChallengeFields): string;
|
|
32
|
+
//# sourceMappingURL=shell-challenge-invocation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shell-challenge-invocation.d.ts","sourceRoot":"","sources":["../../src/tools/shell-challenge-invocation.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,MAAM,oBAAoB,GAAG;IACjC,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF;;;GAGG;AACH,wBAAgB,wBAAwB,CAAC,KAAK,EAAE;IAC9C,GAAG,EAAE,MAAM,CAAC;IACZ,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACjC,KAAK,CAAC,EAAE,MAAM,EAAE,GAAG,SAAS,CAAC;IAC7B,IAAI,CAAC,EAAE,MAAM,EAAE,GAAG,SAAS,CAAC;IAC5B,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAC9B,GAAG,oBAAoB,CASvB;AAoDD;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,oBAAoB,GAAG,MAAM,EAAE,CAiC7E;AAED,oFAAoF;AACpF,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAIjD;AAED,wBAAgB,+BAA+B,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,MAAM,CAEtE;AAED,iEAAiE;AACjE,wBAAgB,qCAAqC,CAAC,KAAK,EAAE,oBAAoB,GAAG,MAAM,CAEzF"}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Build logical argv for shell challenges. Executors (agents/CLI) run this locally;
|
|
3
|
+
* the MCP server does not spawn processes for PoW.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Normalize loose proof/UI fields into argv input without assigning `undefined`
|
|
7
|
+
* to optional keys (required when `exactOptionalPropertyTypes` is enabled).
|
|
8
|
+
*/
|
|
9
|
+
export function pickShellChallengeFields(shell) {
|
|
10
|
+
const out = { cmd: shell.cmd };
|
|
11
|
+
const interp = shell.interpreter?.trim();
|
|
12
|
+
if (interp)
|
|
13
|
+
out.interpreter = interp;
|
|
14
|
+
if (shell.flags !== undefined)
|
|
15
|
+
out.flags = shell.flags;
|
|
16
|
+
if (shell.args !== undefined)
|
|
17
|
+
out.args = shell.args;
|
|
18
|
+
const wd = shell.workdir?.trim();
|
|
19
|
+
if (wd)
|
|
20
|
+
out.workdir = wd;
|
|
21
|
+
return out;
|
|
22
|
+
}
|
|
23
|
+
function normalizedInterpreter(raw) {
|
|
24
|
+
const t = raw?.trim();
|
|
25
|
+
return t ? t : undefined;
|
|
26
|
+
}
|
|
27
|
+
/** Interpreters that use -c for inline script (auto-injected when absent). */
|
|
28
|
+
const INJECT_C = new Set(['python3', 'python', 'sh']);
|
|
29
|
+
/** Interpreters that use -e for inline script (auto-injected when absent). */
|
|
30
|
+
const INJECT_E = new Set(['perl', 'node', 'nodejs', 'ruby']);
|
|
31
|
+
/**
|
|
32
|
+
* Known "other" style: argv is interpreter + flags + cmd + args with no auto code flag
|
|
33
|
+
* (subcommands live in flags and/or cmd per author).
|
|
34
|
+
*/
|
|
35
|
+
const OTHER_STYLE = new Set([
|
|
36
|
+
'terraform',
|
|
37
|
+
'go',
|
|
38
|
+
'npx',
|
|
39
|
+
'npm',
|
|
40
|
+
'yarn',
|
|
41
|
+
'pnpm',
|
|
42
|
+
'cargo',
|
|
43
|
+
'rustc',
|
|
44
|
+
'make',
|
|
45
|
+
'docker',
|
|
46
|
+
'kubectl',
|
|
47
|
+
'ansible-playbook'
|
|
48
|
+
]);
|
|
49
|
+
function flagTokensLower(flags) {
|
|
50
|
+
const s = new Set();
|
|
51
|
+
for (const f of flags || []) {
|
|
52
|
+
const m = f.match(/^-+(.+)$/);
|
|
53
|
+
const cap = m?.[1];
|
|
54
|
+
s.add((cap ?? f).toLowerCase());
|
|
55
|
+
}
|
|
56
|
+
return s;
|
|
57
|
+
}
|
|
58
|
+
function hasExplicitCodeFlagC(flags) {
|
|
59
|
+
return (flags || []).some(f => /^-c$/i.test(f) || /^-c=/i.test(f));
|
|
60
|
+
}
|
|
61
|
+
/** Perl/node/ruby script modes that carry the program as the next argv segment. */
|
|
62
|
+
function hasScriptCarrierE(flags) {
|
|
63
|
+
const t = flagTokensLower(flags);
|
|
64
|
+
return t.has('e') || t.has('E') || t.has('ne') || t.has('pe');
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* argv for the challenge. Legacy: no interpreter or bash → bash -c cmd [-- args].
|
|
68
|
+
*/
|
|
69
|
+
export function buildShellChallengeArgv(shell) {
|
|
70
|
+
const cmd = shell.cmd ?? '';
|
|
71
|
+
const flags = shell.flags ?? [];
|
|
72
|
+
const args = shell.args ?? [];
|
|
73
|
+
const interp = normalizedInterpreter(shell.interpreter);
|
|
74
|
+
if (!interp || interp.toLowerCase() === 'bash') {
|
|
75
|
+
const out = ['bash', '-c', cmd.trim() || 'true'];
|
|
76
|
+
if (args.length)
|
|
77
|
+
out.push('--', ...args);
|
|
78
|
+
return out;
|
|
79
|
+
}
|
|
80
|
+
const low = interp.toLowerCase();
|
|
81
|
+
if (OTHER_STYLE.has(low)) {
|
|
82
|
+
return [interp, ...flags, ...(cmd.trim() ? [cmd] : []), ...args];
|
|
83
|
+
}
|
|
84
|
+
if (INJECT_C.has(low)) {
|
|
85
|
+
if (hasExplicitCodeFlagC(flags)) {
|
|
86
|
+
return [interp, ...flags, ...(cmd.trim() ? [cmd] : []), ...args];
|
|
87
|
+
}
|
|
88
|
+
return [interp, ...flags, '-c', cmd, ...args];
|
|
89
|
+
}
|
|
90
|
+
if (INJECT_E.has(low)) {
|
|
91
|
+
if (hasScriptCarrierE(flags)) {
|
|
92
|
+
return [interp, ...flags, ...(cmd.trim() ? [cmd] : []), ...args];
|
|
93
|
+
}
|
|
94
|
+
return [interp, ...flags, '-e', cmd, ...args];
|
|
95
|
+
}
|
|
96
|
+
return [interp, ...flags, ...(cmd.trim() ? [cmd] : []), ...args];
|
|
97
|
+
}
|
|
98
|
+
/** Best-effort single-line invocation for descriptions/UI (POSIX-style quoting). */
|
|
99
|
+
export function shellQuoteArg(arg) {
|
|
100
|
+
if (arg === '')
|
|
101
|
+
return "''";
|
|
102
|
+
if (/^[\w@%+=:,./-]+$/i.test(arg))
|
|
103
|
+
return arg;
|
|
104
|
+
return "'" + arg.replace(/'/g, "'\\''") + "'";
|
|
105
|
+
}
|
|
106
|
+
export function formatShellInvocationForDisplay(argv) {
|
|
107
|
+
return argv.map(shellQuoteArg).join(' ');
|
|
108
|
+
}
|
|
109
|
+
/** One-line summary for error messages (missing proof, etc.). */
|
|
110
|
+
export function formatShellChallengeInvocationSummary(shell) {
|
|
111
|
+
return formatShellInvocationForDisplay(buildShellChallengeArgv(shell));
|
|
112
|
+
}
|
|
113
|
+
//# sourceMappingURL=shell-challenge-invocation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shell-challenge-invocation.js","sourceRoot":"","sources":["../../src/tools/shell-challenge-invocation.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAUH;;;GAGG;AACH,MAAM,UAAU,wBAAwB,CAAC,KAMxC;IACC,MAAM,GAAG,GAAyB,EAAE,GAAG,EAAE,KAAK,CAAC,GAAG,EAAE,CAAC;IACrD,MAAM,MAAM,GAAG,KAAK,CAAC,WAAW,EAAE,IAAI,EAAE,CAAC;IACzC,IAAI,MAAM;QAAE,GAAG,CA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,GAAG,KAAK,EAAE,GAAG,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,GAAG,IAAI,CAAC,CAAC;AACnE,CAAC;AAED,oFAAoF;AACpF,MAAM,UAAU,aAAa,CAAC,GAAW;IACvC,IAAI,GAAG,KAAK,EAAE;QAAE,OAAO,IAAI,CAAC;IAC5B,IAAI,mBAAmB,CAAC,IAAI,CAAC,GAAG,CAAC;QAAE,OAAO,GAAG,CAAC;IAC9C,OAAO,GAAG,GAAG,GAAG,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,GAAG,CAAC;AAChD,CAAC;AAED,MAAM,UAAU,+BAA+B,CAAC,IAAc;IAC5D,OAAO,IAAI,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC3C,CAAC;AAED,iEAAiE;AACjE,MAAM,UAAU,qCAAqC,CAAC,KAA2B;IAC/E,OAAO,+BAA+B,CAAC,uBAAuB,CAAC,KAAK,CAAC,CAAC,CAAC;AACzE,CAAC"}
|
package/dist/types/memory.d.ts
CHANGED
|
@@ -14,6 +14,14 @@ export interface ProofOfWorkDefinition {
|
|
|
14
14
|
shell?: {
|
|
15
15
|
cmd: string;
|
|
16
16
|
timeout_seconds: number;
|
|
17
|
+
/** Optional; default bash -c when omitted. */
|
|
18
|
+
interpreter?: string;
|
|
19
|
+
/** Interpreter-specific flags (do not duplicate auto-injected -c / -e). */
|
|
20
|
+
flags?: string[];
|
|
21
|
+
/** Positional args after script body (e.g. bash -- "$1"). */
|
|
22
|
+
args?: string[];
|
|
23
|
+
/** Working directory for execution (executor resolves $KAIROS_WORK_DIR, paths). */
|
|
24
|
+
workdir?: string;
|
|
17
25
|
};
|
|
18
26
|
mcp?: {
|
|
19
27
|
tool_name: string;
|
|
@@ -35,6 +43,8 @@ export interface Memory {
|
|
|
35
43
|
created_at: string;
|
|
36
44
|
chain?: ChainInfo;
|
|
37
45
|
proof_of_work?: ProofOfWorkDefinition;
|
|
46
|
+
/** Qdrant payload space_id when present; used to scope sibling chain scrolls to spaces we already read from. */
|
|
47
|
+
space_id?: string;
|
|
38
48
|
/** Qdrant payload: exact routing key for kairos_begin(key). */
|
|
39
49
|
slug?: string;
|
|
40
50
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"memory.d.ts","sourceRoot":"","sources":["../../src/types/memory.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,SAAS;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED,MAAM,MAAM,eAAe,GAAG,OAAO,GAAG,KAAK,GAAG,YAAY,GAAG,SAAS,CAAC;AAEzE,MAAM,WAAW,qBAAqB;IACpC,IAAI,CAAC,EAAE,eAAe,CAAC;IAEvB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,EAAE,OAAO,CAAC;IAElB,KAAK,CAAC,EAAE;QACN,GAAG,EAAE,MAAM,CAAC;QACZ,eAAe,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"memory.d.ts","sourceRoot":"","sources":["../../src/types/memory.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,SAAS;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED,MAAM,MAAM,eAAe,GAAG,OAAO,GAAG,KAAK,GAAG,YAAY,GAAG,SAAS,CAAC;AAEzE,MAAM,WAAW,qBAAqB;IACpC,IAAI,CAAC,EAAE,eAAe,CAAC;IAEvB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,EAAE,OAAO,CAAC;IAElB,KAAK,CAAC,EAAE;QACN,GAAG,EAAE,MAAM,CAAC;QACZ,eAAe,EAAE,MAAM,CAAC;QACxB,8CAA8C;QAC9C,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,2EAA2E;QAC3E,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;QACjB,6DAA6D;QAC7D,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;QAChB,mFAAmF;QACnF,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,CAAC;IACF,GAAG,CAAC,EAAE;QACJ,SAAS,EAAE,MAAM,CAAC;QAClB,eAAe,CAAC,EAAE,GAAG,CAAC;KACvB,CAAC;IACF,UAAU,CAAC,EAAE;QACX,MAAM,CAAC,EAAE,MAAM,CAAC;KACjB,CAAC;IACF,OAAO,CAAC,EAAE;QACR,UAAU,CAAC,EAAE,MAAM,CAAC;KACrB,CAAC;CACH;AAED,MAAM,WAAW,MAAM;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,aAAa,CAAC,EAAE,qBAAqB,CAAC;IACtC,gHAAgH;IAChH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,+DAA+D;IAC/D,IAAI,CAAC,EAAE,MAAM,CAAC;CACf"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{g as e,y as t}from"./vendor-
|
|
1
|
+
import{g as e,y as t}from"./vendor-CVpIjmrD.js";import{t as n}from"./react-BdWJx0XL.js";import"./tiptap-CzV8H9Mb.js";import{t as r}from"./api-D88c6lbH.js";async function i(){let e=await r(`/api/me`);if(!e.ok){let t=await e.json().catch(()=>({})),n=Error(t.message??e.statusText);throw n.statusCode=e.status,n}return e.json()}function a(){return e({queryKey:[`me`],queryFn:i,retry:!1})}var o=n();function s(){let{t:e}=t(),{data:n,isLoading:r,isError:i}=a();return r?(0,o.jsx)(`p`,{className:`text-[var(--color-text-muted)]`,children:e(`account.loading`)}):i||!n?(0,o.jsxs)(`div`,{children:[(0,o.jsx)(`h1`,{className:`text-[var(--color-text-heading)] text-2xl font-semibold mb-4`,children:e(`account.title`)}),(0,o.jsx)(`p`,{className:`text-[var(--color-text-muted)]`,children:e(`account.notSignedIn`)}),(0,o.jsx)(`a`,{href:`/auth/callback`,className:`mt-4 min-h-[44px] min-w-[44px] inline-flex items-center justify-center px-4 py-2 rounded-[var(--radius-md)] font-medium bg-[var(--color-primary)] text-white no-underline hover:bg-[var(--color-primary-hover)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,children:e(`account.signIn`)})]}):(0,o.jsxs)(`div`,{children:[(0,o.jsx)(`h1`,{className:`text-[var(--color-text-heading)] text-2xl font-semibold mb-6`,children:e(`account.title`)}),(0,o.jsx)(`p`,{className:`text-[var(--color-text-muted)] mb-6`,children:e(`account.intro`)}),(0,o.jsxs)(`div`,{className:`rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface-elevated)] p-6`,children:[(0,o.jsxs)(`div`,{className:`mb-4`,children:[(0,o.jsx)(`span`,{className:`block text-xs uppercase tracking-wider text-[var(--color-text-muted)] mb-1`,children:e(`account.name`)}),(0,o.jsx)(`span`,{className:`text-[var(--color-text-heading)]`,children:n.name??n.sub})]}),n.email&&(0,o.jsxs)(`div`,{className:`mb-4`,children:[(0,o.jsx)(`span`,{className:`block text-xs uppercase tracking-wider text-[var(--color-text-muted)] mb-1`,children:e(`account.email`)}),(0,o.jsx)(`span`,{className:`text-[var(--color-text-heading)]`,children:n.email})]}),(0,o.jsx)(`div`,{className:`mt-6 flex gap-2 flex-wrap`,children:(0,o.jsx)(`a`,{href:`/auth/logout`,className:`min-h-[44px] min-w-[44px] inline-flex items-center justify-center px-4 py-2 rounded-[var(--radius-md)] font-medium border border-[var(--color-border)] text-[var(--color-text)] bg-transparent no-underline hover:bg-[var(--color-surface-elevated)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,children:e(`account.logOut`)})})]})]})}export{s as AccountPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,y as t}from"./vendor-
|
|
1
|
+
import{a as e,y as t}from"./vendor-CVpIjmrD.js";import{t as n}from"./react-BdWJx0XL.js";var r=n();function i({message:n,nextAction:i,onRetry:a,showGoBack:o=!0,supportLink:s}){let{t:c}=t();return(0,r.jsxs)(`div`,{className:`p-4 rounded-[var(--radius-md)] border border-[var(--color-error)] bg-[var(--color-error-bg)]`,role:`alert`,children:[(0,r.jsx)(`h2`,{className:`text-base font-semibold text-[var(--color-error)] mb-2`,children:c(`error.title`)}),(0,r.jsx)(`p`,{className:`text-[var(--color-text)]`,children:n}),i&&(0,r.jsx)(`p`,{className:`mt-4 pt-4 border-t border-[var(--color-border)] font-medium`,children:i}),(0,r.jsxs)(`div`,{className:`flex flex-wrap gap-2 mt-4`,children:[a&&(0,r.jsx)(`button`,{type:`button`,onClick:a,className:`min-h-[44px] min-w-[44px] px-4 py-2 rounded-[var(--radius-md)] font-medium bg-[var(--color-primary)] text-white border-0 cursor-pointer hover:bg-[var(--color-primary-hover)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,children:c(`error.retry`)}),o&&(0,r.jsx)(e,{to:`/`,className:`min-h-[44px] min-w-[44px] inline-flex items-center justify-center px-4 py-2 rounded-[var(--radius-md)] font-medium border border-[var(--color-border)] text-[var(--color-text)] no-underline hover:bg-[var(--color-surface-elevated)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,children:c(`error.goBack`)}),s&&(0,r.jsx)(`a`,{href:s,target:`_blank`,rel:`noopener noreferrer`,className:`min-h-[44px] min-w-[44px] inline-flex items-center justify-center px-4 py-2 rounded-[var(--radius-md)] font-medium border border-[var(--color-border)] text-[var(--color-text)] no-underline hover:bg-[var(--color-surface-elevated)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,children:c(`error.support`)})]})]})}export{i as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,d as t,y as n}from"./vendor-
|
|
1
|
+
import{a as e,d as t,y as n}from"./vendor-CVpIjmrD.js";import{t as r}from"./react-BdWJx0XL.js";import"./tiptap-CzV8H9Mb.js";import{t as i}from"./useSpaces-DQEfGh8E.js";var a=r();function o(){let{t:r}=n(),o=t(),{data:s,isLoading:c,isError:l}=i(),u=e=>{e.preventDefault();let t=e.currentTarget.querySelector(`input[name="q"]`)?.value?.trim()??``;o(t?`/kairos?q=${encodeURIComponent(t)}`:`/kairos`)},d=s?.spaces??[],f=c||l||d.length===0;return(0,a.jsxs)(`div`,{children:[(0,a.jsx)(`h1`,{className:`text-[var(--color-text-heading)] text-2xl font-semibold mb-1`,children:r(`home.title`)}),(0,a.jsx)(`p`,{className:`text-sm text-[var(--color-text-muted)] mb-8`,children:r(`home.tagline`)}),(0,a.jsxs)(`form`,{onSubmit:u,className:`mb-8 max-w-xl`,"aria-label":r(`home.searchLabel`),children:[(0,a.jsx)(`label`,{htmlFor:`home-search-query`,className:`block font-medium text-[var(--color-text-heading)] mb-2`,children:r(`home.searchLabel`)}),(0,a.jsx)(`input`,{id:`home-search-query`,name:`q`,type:`search`,autoComplete:`off`,placeholder:r(`home.searchPlaceholder`),"aria-describedby":`home-search-hint`,className:`w-full min-h-[44px] px-4 py-2 border border-[var(--color-border)] rounded-[var(--radius-md)] text-[var(--color-text)] bg-[var(--color-surface)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`}),(0,a.jsx)(`p`,{id:`home-search-hint`,className:`text-sm text-[var(--color-text-muted)] mt-2`,children:r(`home.searchHint`)})]}),(0,a.jsxs)(`div`,{className:`flex gap-4 flex-wrap mb-8`,"aria-label":r(`home.statsLabel`),children:[f&&d.length===0?(0,a.jsxs)(`div`,{className:`min-w-[7rem] rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface-elevated)] p-5`,children:[(0,a.jsx)(`span`,{className:`text-2xl font-semibold text-[var(--color-text-heading)]`,children:`—`}),(0,a.jsx)(`span`,{className:`block text-xs uppercase tracking-wide text-[var(--color-text-muted)] mt-1`,children:r(`home.stats.spacesLabel`)})]}):null,d.map(e=>(0,a.jsxs)(`div`,{className:`min-w-[7rem] rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface-elevated)] p-5`,children:[(0,a.jsx)(`span`,{className:`block font-semibold text-[var(--color-text-heading)]`,children:e.name}),(0,a.jsx)(`span`,{className:`block text-sm text-[var(--color-text-muted)] mt-1`,children:c?`—`:r(`home.stats.protocolCount`,{count:e.chain_count})})]},e.name))]}),(0,a.jsxs)(`p`,{className:`text-sm text-[var(--color-text-muted)]`,children:[r(`home.ctaPre`),` `,(0,a.jsx)(e,{to:`/kairos`,className:`text-[var(--color-primary)] font-medium underline hover:no-underline focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,children:r(`nav.kairos`)}),r(`home.ctaSuffix`)]})]})}export{o as HomePage};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{a as t,g as n,p as r,y as i}from"./vendor-CVpIjmrD.js";import{i as a,t as o}from"./react-BdWJx0XL.js";import"./tiptap-CzV8H9Mb.js";import{t as s}from"./api-D88c6lbH.js";import{t as c}from"./useSpaces-DQEfGh8E.js";import{t as l}from"./ErrorAlert-KEgeKl22.js";var u=e(a(),1);async function d(e){let t=await s(`/api/kairos_search`,{method:`POST`,body:JSON.stringify({query:e.trim()})});if(!t.ok){let e=await t.json().catch(()=>({}));throw Error(e.message??t.statusText)}return t.json()}function f(e,t){return n({queryKey:[`search`,e],queryFn:()=>d(e),enabled:t&&e.trim().length>0})}var p=o();function m(){return(0,p.jsx)(`ul`,{className:`list-none p-0 m-0 space-y-2`,role:`list`,"aria-hidden":`true`,children:[1,2,3].map(e=>(0,p.jsxs)(`li`,{className:`rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface-elevated)] p-4 flex justify-between items-start gap-4`,children:[(0,p.jsxs)(`div`,{className:`flex-1 min-w-0 space-y-2`,children:[(0,p.jsx)(`div`,{className:`h-5 w-3/4 rounded bg-[var(--color-border)] animate-pulse`}),(0,p.jsx)(`div`,{className:`h-4 w-1/2 rounded bg-[var(--color-border)] animate-pulse`}),(0,p.jsx)(`div`,{className:`h-5 w-16 rounded bg-[var(--color-border)] animate-pulse`})]}),(0,p.jsx)(`div`,{className:`h-10 w-20 rounded-[var(--radius-md)] bg-[var(--color-border)] animate-pulse flex-shrink-0`})]},e))})}var h=`ABCDEFGHIJKLMNOPQRSTUVWXYZ`.split(``);function g(e){let t=[];for(let n of e??[])for(let e of n.chains??[])t.push({chain_id:e.chain_id,title:e.title,step_count:e.step_count});let n=new Map,r=[];for(let e of t){let t=(e.chain_id??``).trim();if(!t){r.push(e);continue}let i=n.get(t);i?(e.step_count??0)>(i.step_count??0)&&n.set(t,e):n.set(t,e)}let i=[...n.values(),...r],a={};for(let e of h)a[e]=0;for(let e of i){let t=(e.title??``).trim().charAt(0).toUpperCase();h.includes(t)&&(a[t]=(a[t]??0)+1)}return{browseChains:i,countsByLetter:a}}var _={match:`bg-[#dcfce7] text-[#166534]`,refine:`bg-[#dbeafe] text-[#1e40af]`,create:`bg-[#fef3c7] text-[#92400e]`},v=`kairos://mem/`;function y(){let{t:e}=i(),[n,a]=r(),o=n.get(`q`)??``,[s,d]=(0,u.useState)(o),[y,b]=(0,u.useState)(o),[x,S]=(0,u.useState)(null),{data:C,isLoading:w,isError:T,error:E,refetch:D}=f(y,!!y),O=!y,{data:k,isLoading:A,isError:j,error:M,refetch:N}=c(O,{includeChainTitles:!0});(0,u.useEffect)(()=>{let e=n.get(`q`)??``;d(e),b(e)},[n]);let P=e=>{e.preventDefault(),b(s),a(s?{q:s}:{},{replace:!0})},F=C?.choices??[],I={match:0,refine:1,create:2},L=F.slice().sort((e,t)=>{let n=(I[e.role]??99)-(I[t.role]??99);if(n!==0)return n;let r=e.score??-1;return(t.score??-1)-r}),R=L.length>0?Math.max(...L.map(e=>e.score==null?0:e.score*100)):null,{browseChains:z,countsByLetter:B}=(0,u.useMemo)(()=>g(k?.spaces),[k?.spaces]),V=(0,u.useMemo)(()=>x?z.filter(e=>(e.title??``).trim().charAt(0).toUpperCase()===x):[],[z,x]);return(0,p.jsxs)(`div`,{children:[(0,p.jsx)(`h1`,{className:`text-[var(--color-text-heading)] text-2xl font-semibold mb-1`,children:e(`kairos.title`)}),(0,p.jsx)(`p`,{className:`text-sm text-[var(--color-text-muted)] mb-8`,children:e(`kairos.searchHint`)}),(0,p.jsxs)(`section`,{className:`mb-8`,"aria-labelledby":`browse-search-label`,children:[(0,p.jsx)(`h2`,{id:`browse-search-label`,className:`sr-only`,children:e(`kairos.searchLabel`)}),(0,p.jsxs)(`form`,{onSubmit:P,className:`mb-6 max-w-xl`,"aria-label":e(`kairos.searchLabel`),children:[(0,p.jsx)(`label`,{htmlFor:`kairos-search-query`,className:`block font-medium text-[var(--color-text-heading)] mb-2`,children:e(`kairos.searchLabel`)}),(0,p.jsx)(`input`,{id:`kairos-search-query`,type:`search`,value:s,onChange:e=>d(e.target.value),placeholder:e(`kairos.searchPlaceholder`),"aria-describedby":`kairos-search-hint`,className:`w-full min-h-[44px] px-4 py-2 border border-[var(--color-border)] rounded-[var(--radius-md)] text-[var(--color-text)] bg-[var(--color-surface)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`}),(0,p.jsx)(`p`,{id:`kairos-search-hint`,className:`text-sm text-[var(--color-text-muted)] mt-2`,children:e(`kairos.searchHint`)}),(0,p.jsx)(`button`,{type:`submit`,className:`mt-3 min-h-[44px] min-w-[44px] px-4 py-2 rounded-[var(--radius-md)] font-medium bg-[var(--color-primary)] text-white border-0 cursor-pointer hover:bg-[var(--color-primary-hover)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,children:e(`kairos.search`)})]})]}),T&&(0,p.jsx)(l,{message:E instanceof Error?E.message:String(E),onRetry:()=>D(),showGoBack:!0}),O&&j&&(0,p.jsx)(l,{message:M instanceof Error?M.message:String(M),onRetry:()=>N(),showGoBack:!0}),w&&y&&(0,p.jsxs)(`div`,{className:`mb-4`,"aria-live":`polite`,"aria-busy":`true`,children:[(0,p.jsx)(`p`,{className:`sr-only`,children:e(`kairos.loading`)}),(0,p.jsx)(m,{})]}),O&&A&&(0,p.jsxs)(`div`,{className:`mb-4`,"aria-live":`polite`,"aria-busy":`true`,children:[(0,p.jsx)(`p`,{className:`sr-only`,children:e(`kairos.loading`)}),(0,p.jsx)(m,{})]}),!w&&!T&&!(O&&j)&&(0,p.jsx)(p.Fragment,{children:y?L.length===0?(0,p.jsxs)(`div`,{className:`rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface-elevated)] p-6`,role:`status`,"aria-live":`polite`,children:[(0,p.jsx)(`p`,{className:`text-[var(--color-text-muted)] mb-4`,children:e(`kairos.empty`)}),(0,p.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,p.jsx)(t,{to:`/kairos`,className:`min-h-[44px] min-w-[44px] inline-flex items-center justify-center px-4 py-2 rounded-[var(--radius-md)] font-medium border border-[var(--color-border)] text-[var(--color-text)] no-underline hover:bg-[var(--color-surface-elevated)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,children:e(`kairos.refineSearch`)}),(0,p.jsx)(t,{to:`/protocols/new`,className:`min-h-[44px] min-w-[44px] inline-flex items-center justify-center px-4 py-2 rounded-[var(--radius-md)] font-medium bg-[var(--color-primary)] text-white border-0 no-underline hover:bg-[var(--color-primary-hover)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,children:e(`kairos.createNew`)})]})]}):y?(0,p.jsxs)(p.Fragment,{children:[L.length>0&&(0,p.jsx)(`p`,{id:`kairos-results-summary`,className:`text-sm text-[var(--color-text-muted)] mb-4`,"aria-live":`polite`,role:`status`,children:e(`kairos.foundMatches`,{count:L.length,top:R==null?0:Math.round(R)})}),(0,p.jsx)(`ul`,{className:`list-none p-0 m-0 space-y-2`,role:`list`,"aria-label":e(`kairos.resultsLabel`),children:L.map(n=>(0,p.jsxs)(`li`,{className:`rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface-elevated)] p-5 flex justify-between items-start gap-4`,children:[(0,p.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,p.jsx)(`span`,{className:`font-medium text-[var(--color-text-heading)] block`,children:n.label}),(0,p.jsxs)(`div`,{className:`text-sm text-[var(--color-text-muted)] mt-1`,children:[n.chain_label??(n.role===`refine`?e(`kairos.refineMeta`):n.role===`create`?e(`kairos.createMeta`):``),n.score!=null&&` · ${e(`kairos.score`)}: ${Math.round(n.score*100)}%`,n.protocol_version&&` · ${e(`kairos.version`)}: ${n.protocol_version}`]}),(0,p.jsx)(`span`,{className:`inline-block mt-1 text-xs uppercase tracking-wide px-2 py-0.5 rounded ${_[n.role]??`bg-[var(--color-surface)] text-[var(--color-text-muted)]`}`,"aria-label":`Role: ${n.role}`,children:n.role}),n.tags?.length>0&&(0,p.jsx)(`div`,{className:`flex flex-wrap gap-1 mt-2`,"aria-label":e(`kairos.tagsLabel`),children:n.tags.slice(0,8).map(e=>(0,p.jsx)(`span`,{className:`inline-block text-xs px-2 py-0.5 rounded bg-[var(--color-surface)] border border-[var(--color-border)] text-[var(--color-text-muted)]`,children:e},e))})]}),(0,p.jsxs)(`div`,{className:`flex-shrink-0`,children:[n.role===`match`&&(0,p.jsx)(t,{to:`/protocols/${encodeURIComponent(n.uri)}`,"aria-label":e(`kairos.viewProtocol`,{title:n.label}),className:`min-h-[44px] min-w-[44px] inline-flex items-center justify-center px-4 py-2 rounded-[var(--radius-md)] font-medium bg-[var(--color-primary)] text-white no-underline hover:bg-[var(--color-primary-hover)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,children:e(`kairos.view`)}),n.role===`refine`&&(0,p.jsx)(t,{to:`/protocols/${encodeURIComponent(n.uri)}`,className:`min-h-[44px] min-w-[44px] inline-flex items-center justify-center px-4 py-2 rounded-[var(--radius-md)] font-medium bg-[var(--color-primary)] text-white no-underline hover:bg-[var(--color-primary-hover)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,children:e(`kairos.refineSearch`)}),n.role===`create`&&(0,p.jsx)(t,{to:`/protocols/new`,className:`min-h-[44px] min-w-[44px] inline-flex items-center justify-center px-4 py-2 rounded-[var(--radius-md)] font-medium bg-[var(--color-primary)] text-white no-underline hover:bg-[var(--color-primary-hover)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,children:e(`kairos.createNew`)})]})]},n.uri))})]}):null:(0,p.jsxs)(`section`,{"aria-labelledby":`browse-by-label-heading`,children:[(0,p.jsx)(`h2`,{id:`browse-by-label-heading`,className:`text-lg font-semibold text-[var(--color-text-heading)] mb-3`,children:e(`kairos.browseByLabel`)}),(0,p.jsx)(`p`,{className:`text-sm text-[var(--color-text-muted)] mb-4`,children:e(`kairos.browseByLetterHint`)}),!A&&(0,p.jsx)(`div`,{className:`flex flex-wrap gap-2 mb-4`,role:`group`,"aria-label":e(`kairos.browseByLabel`),children:h.map(t=>{let n=B[t]??0;return(0,p.jsxs)(`button`,{type:`button`,onClick:()=>S(e=>e===t?null:t),"aria-expanded":x===t,"aria-controls":`browse-letter-panel-${t}`,"aria-pressed":x===t,"aria-label":e(`kairos.letterCount`,{letter:t,count:n}),className:`min-h-[var(--layout-touch-target)] min-w-[var(--layout-touch-target)] inline-flex items-center justify-center rounded-[var(--radius-md)] border px-3 py-2 text-sm font-medium transition-colors focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2 ${x===t?`border-[var(--color-primary)] bg-[var(--color-surface-elevated)] text-[var(--color-primary)]`:`border-[var(--color-border)] bg-[var(--color-surface)] text-[var(--color-text)] hover:bg-[var(--color-surface-elevated)]`}`,children:[t,`: `,n]},t)})}),x&&!A&&(0,p.jsxs)(`div`,{id:`browse-letter-panel-${x}`,role:`region`,"aria-labelledby":`browse-letter-panel-heading`,"aria-live":`polite`,className:`rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface-elevated)] p-5`,children:[(0,p.jsx)(`h3`,{id:`browse-letter-panel-heading`,className:`text-base font-semibold text-[var(--color-text-heading)] mb-3`,children:e(`kairos.labelsStartingWith`,{letter:x})}),V.length===0?(0,p.jsx)(`p`,{className:`text-sm text-[var(--color-text-muted)]`,children:e(`kairos.noLabelsForLetter`)}):(0,p.jsx)(`ul`,{className:`list-none p-0 m-0 space-y-2`,role:`list`,"aria-label":e(`kairos.labelsStartingWith`,{letter:x}),children:V.map((n,r)=>{let i=`${v}${n.chain_id}`,a=(n.chain_id??``).trim()?n.chain_id:`browse-${x}-${r}-${n.title}`;return(0,p.jsxs)(`li`,{className:`flex flex-wrap items-center justify-between gap-3 rounded-[var(--radius-sm)] border border-[var(--color-border)] bg-[var(--color-surface)] p-3`,children:[(0,p.jsx)(`span`,{className:`font-medium text-[var(--color-text-heading)]`,children:n.title}),(0,p.jsx)(t,{to:`/protocols/${encodeURIComponent(i)}`,"aria-label":e(`kairos.viewProtocol`,{title:n.title}),className:`min-h-[var(--layout-touch-target)] min-w-[var(--layout-touch-target)] inline-flex items-center justify-center px-4 py-2 rounded-[var(--radius-md)] font-medium bg-[var(--color-primary)] text-white no-underline hover:bg-[var(--color-primary-hover)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,children:e(`kairos.view`)})]},a)})})]})]})})]})}export{y as KairosPage};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{y as e}from"./vendor-CVpIjmrD.js";import{t}from"./react-BdWJx0XL.js";import"./tiptap-CzV8H9Mb.js";import{t as n}from"./ErrorAlert-KEgeKl22.js";var r=t();function i(){let{t}=e();return(0,r.jsxs)(`div`,{children:[(0,r.jsx)(`h1`,{className:`text-[var(--color-text-heading)] text-2xl font-semibold mb-4`,children:t(`notFound.title`)}),(0,r.jsx)(n,{message:t(`notFound.message`),showGoBack:!0})]})}export{i as NotFoundPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{a as t,f as n,y as r}from"./vendor-GiUVcjs7.js";import{i,t as a}from"./react-BdWJx0XL.js";import"./tiptap-kMFBDujG.js";import{i as o,n as s}from"./useProtocol-BruWpIzq.js";import{t as c}from"./RenderedMarkdown-DjbuQlBl.js";var l=e(i(),1),u=a();function d({value:e,label:t,className:n}){let{t:i}=r(),[a,o]=(0,l.useState)(!1);return(0,u.jsx)(`button`,{type:`button`,onClick:(0,l.useCallback)(async()=>{try{await navigator.clipboard.writeText(e),o(!0),setTimeout(()=>o(!1),2e3)}catch{}},[e]),className:n,"aria-label":a?i(`run.copied`):t,title:t,children:i(a?`run.copied`:`run.copy`)})}var f={shell:`bg-[#fef3c7] text-[#92400e]`,mcp:`bg-[#dbeafe] text-[#1e40af]`,user_input:`bg-[#ede9fe] text-[#5b21b6]`,comment:`bg-[#e2e8f0] text-[#334155]`},p={shell:`Shell command`,mcp:`MCP tool call`,user_input:`User input`,comment:`Comment`};function m(){let{t:e}=r(),{uri:i}=n(),{data:a,isLoading:m,isError:h,error:g}=o(i?decodeURIComponent(i):void 0,!0),[_,v]=(0,l.useState)(null),[y,b]=(0,l.useState)(!1),x=(0,l.useRef)(null);if((0,l.useEffect)(()=>{if(!y)return;let e=e=>{x.current&&!x.current.contains(e.target)&&b(!1)};return document.addEventListener(`click`,e),()=>document.removeEventListener(`click`,e)},[y]),m&&!a)return(0,u.jsx)(`p`,{className:`text-[var(--color-text-muted)]`,children:e(`protocol.loading`)});if(h||!a)return(0,u.jsxs)(`div`,{role:`alert`,className:`p-4 rounded-[var(--radius-md)] bg-[var(--color-error-bg)] text-[var(--color-error)]`,children:[g instanceof Error?g.message:e(`protocol.notFound`),(0,u.jsx)(t,{to:`/`,className:`block mt-2 text-[var(--color-primary)] underline hover:no-underline focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,children:e(`notFound.goHome`)})]});let{title:S,steps:C,triggers:w,completion:T}=s(a.markdown_doc),E=()=>{let e=S.replace(/[^a-zA-Z0-9]+/g,`-`).replace(/^-|-$/g,``)||`protocol`,t=new Blob([a.markdown_doc],{type:`text/markdown;charset=utf-8`}),n=URL.createObjectURL(t),r=document.createElement(`a`);r.href=n,r.download=`${e}.md`,r.click(),URL.revokeObjectURL(n),b(!1)},D=()=>{let e=S.replace(/[^a-zA-Z0-9]+/g,`-`).replace(/^-|-$/g,``)||`protocol`,t=`# ${S}\n\n${a.markdown_doc}`,n=new Blob([t],{type:`text/markdown;charset=utf-8`}),r=URL.createObjectURL(n),i=document.createElement(`a`);i.href=r,i.download=`${e}-skill.md`,i.click(),URL.revokeObjectURL(r),b(!1)};return(0,u.jsxs)(`div`,{children:[(0,u.jsx)(`h1`,{className:`text-[var(--color-text-heading)] text-2xl font-semibold mb-3`,children:S}),(0,u.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 mb-6`,children:[(0,u.jsxs)(`p`,{className:`text-sm text-[var(--color-text-muted)] m-0`,children:[(0,u.jsxs)(`span`,{className:`sr-only`,children:[e(`protocol.uri`),`: `]}),(0,u.jsx)(`code`,{className:`text-xs bg-[var(--color-surface-elevated)] px-2 py-0.5 rounded break-all`,children:a.uri}),(0,u.jsxs)(`span`,{className:`ml-2`,children:[`· `,e(`protocol.readOnly`)]})]}),(0,u.jsx)(d,{value:a.uri,label:e(`protocol.copyUri`),className:`min-h-[44px] min-w-[44px] inline-flex items-center justify-center px-3 py-1.5 text-sm font-medium rounded-[var(--radius-md)] border border-[var(--color-border)] text-[var(--color-text)] bg-[var(--color-surface)] hover:bg-[var(--color-surface-elevated)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`}),(0,u.jsxs)(`div`,{className:`relative`,ref:x,children:[(0,u.jsx)(`button`,{type:`button`,onClick:()=>b(e=>!e),"aria-expanded":y,"aria-haspopup":`true`,"aria-label":e(`protocol.download`),className:`min-h-[44px] min-w-[44px] inline-flex items-center justify-center px-3 py-1.5 text-sm font-medium rounded-[var(--radius-md)] border border-[var(--color-border)] text-[var(--color-text)] bg-[var(--color-surface)] hover:bg-[var(--color-surface-elevated)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,children:e(`protocol.download`)}),y&&(0,u.jsxs)(`div`,{className:`absolute left-0 top-full z-10 mt-1 min-w-[12rem] rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface)] py-1 shadow-sm`,role:`menu`,children:[(0,u.jsxs)(`button`,{type:`button`,role:`menuitem`,onClick:E,className:`flex w-full min-h-[44px] items-center justify-between px-3 py-2 text-left text-sm text-[var(--color-text)] hover:bg-[var(--color-surface-elevated)] focus:bg-[var(--color-surface-elevated)] focus:outline-none`,children:[e(`protocol.downloadAsMarkdown`),(0,u.jsx)(`span`,{className:`text-[var(--color-text-muted)]`,children:`.md`})]}),(0,u.jsxs)(`button`,{type:`button`,role:`menuitem`,onClick:D,className:`flex w-full min-h-[44px] items-center justify-between px-3 py-2 text-left text-sm text-[var(--color-text)] hover:bg-[var(--color-surface-elevated)] focus:bg-[var(--color-surface-elevated)] focus:outline-none`,children:[e(`protocol.downloadAsSkill`),(0,u.jsx)(`span`,{className:`text-[var(--color-text-muted)]`,children:`.md`})]})]})]}),(0,u.jsx)(t,{to:`/protocols/${encodeURIComponent(a.uri)}/skill`,className:`min-h-[44px] min-w-[44px] inline-flex items-center justify-center px-3 py-1.5 text-sm font-medium rounded-[var(--radius-md)] border border-[var(--color-border)] text-[var(--color-text)] bg-[var(--color-surface)] no-underline hover:bg-[var(--color-surface-elevated)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,children:e(`protocol.editAsSkill`)})]}),(0,u.jsxs)(`div`,{className:`flex flex-wrap gap-2 mb-8`,children:[(0,u.jsx)(t,{to:`/protocols/${encodeURIComponent(a.uri)}/run`,className:`min-h-[44px] min-w-[44px] inline-flex items-center justify-center px-4 py-2 rounded-[var(--radius-md)] font-medium bg-[var(--color-primary)] text-white no-underline hover:bg-[var(--color-primary-hover)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,children:e(`protocol.runGuided`)}),(0,u.jsx)(t,{to:`/protocols/${encodeURIComponent(a.uri)}/edit`,className:`min-h-[44px] min-w-[44px] inline-flex items-center justify-center px-4 py-2 rounded-[var(--radius-md)] font-medium border border-[var(--color-border)] text-[var(--color-text)] no-underline hover:bg-[var(--color-surface-elevated)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,children:e(`protocol.edit`)}),(0,u.jsx)(t,{to:`/protocols/new`,className:`min-h-[44px] min-w-[44px] inline-flex items-center justify-center px-4 py-2 rounded-[var(--radius-md)] font-medium border border-[var(--color-border)] text-[var(--color-text)] no-underline hover:bg-[var(--color-surface-elevated)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,children:e(`protocol.duplicate`)})]}),(0,u.jsxs)(`section`,{"aria-labelledby":`steps-heading`,className:`mb-8`,children:[(0,u.jsx)(`h2`,{id:`steps-heading`,className:`text-lg font-semibold text-[var(--color-text-heading)] mb-2`,children:e(`protocol.steps`)}),(0,u.jsx)(`ul`,{className:`list-none p-0 m-0 rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface-elevated)] divide-y divide-[var(--color-border)]`,children:C.map((t,n)=>(0,u.jsxs)(`li`,{className:`p-5`,children:[(0,u.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,u.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,u.jsxs)(`span`,{className:`block text-sm font-medium text-[var(--color-text)]`,children:[`Step `,n+1,`: `,t.label]}),(0,u.jsx)(`div`,{className:`text-sm text-[var(--color-text-muted)] mt-1 break-words`,children:t.summary}),(0,u.jsx)(`span`,{className:`inline-block mt-1 text-xs uppercase tracking-wide px-2 py-0.5 rounded ${f[t.type]??`bg-[var(--color-surface)] text-[var(--color-text-muted)]`}`,"aria-label":`Challenge type: ${p[t.type]??t.type}`,children:p[t.type]??t.type})]}),(0,u.jsxs)(`div`,{className:`flex items-center gap-2 flex-shrink-0`,children:[(0,u.jsx)(d,{value:t.body||t.summary,label:`${e(`run.copy`)} ${t.label}`,className:`min-h-[44px] min-w-[44px] inline-flex items-center justify-center px-3 py-1.5 text-sm font-medium rounded-[var(--radius-md)] border border-[var(--color-border)] text-[var(--color-text)] bg-[var(--color-surface)] hover:bg-[var(--color-surface-elevated)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`}),t.body?(0,u.jsx)(`button`,{type:`button`,onClick:()=>v(_===n?null:n),"aria-expanded":_===n,"aria-controls":`step-detail-${n}`,id:`step-toggle-${n}`,className:`min-h-[44px] min-w-[44px] inline-flex items-center justify-center px-3 py-1.5 text-sm font-medium rounded-[var(--radius-md)] border border-[var(--color-border)] text-[var(--color-text)] bg-[var(--color-surface)] hover:bg-[var(--color-surface-elevated)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,children:e(_===n?`protocol.collapse`:`protocol.expand`)}):null]})]}),t.body?(0,u.jsx)(`div`,{id:`step-detail-${n}`,role:`region`,"aria-labelledby":`step-toggle-${n}`,hidden:_!==n,className:`mt-3 pt-3 border-t border-[var(--color-border)]`,children:(0,u.jsx)(c,{content:t.body})}):null]},n))})]}),w&&(0,u.jsxs)(`section`,{"aria-labelledby":`triggers-heading`,className:`mb-8`,children:[(0,u.jsx)(`h2`,{id:`triggers-heading`,className:`text-lg font-semibold text-[var(--color-text-heading)] mb-2`,children:e(`protocol.triggers`)}),(0,u.jsx)(`div`,{className:`rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface-elevated)] p-4`,children:(0,u.jsx)(c,{content:w})})]}),T&&(0,u.jsxs)(`section`,{"aria-labelledby":`completion-heading`,className:`mb-8`,children:[(0,u.jsx)(`h2`,{id:`completion-heading`,className:`text-lg font-semibold text-[var(--color-text-heading)] mb-2`,children:e(`protocol.completion`)}),(0,u.jsx)(`div`,{className:`rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface-elevated)] p-4`,children:(0,u.jsx)(c,{content:T})})]}),(0,u.jsxs)(`div`,{className:`rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface-elevated)] p-5 mt-8`,role:`region`,"aria-labelledby":`how-to-use-heading`,children:[(0,u.jsx)(`h2`,{id:`how-to-use-heading`,className:`text-base font-semibold text-[var(--color-text-heading)] mb-2`,children:e(`protocol.howToUse`)}),(0,u.jsx)(`p`,{className:`text-sm text-[var(--color-text-muted)] mb-2`,children:e(`protocol.howToUseInProduct`)}),(0,u.jsxs)(`p`,{className:`text-sm text-[var(--color-text-muted)]`,children:[e(`protocol.howToUseCopy`),` `,(0,u.jsx)(`a`,{href:`https://github.com/debian777/kairos-mcp#readme`,target:`_blank`,rel:`noopener noreferrer`,className:`text-[var(--color-primary)] underline hover:no-underline focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,children:e(`protocol.docsLink`)})]})]})]})}export{m as ProtocolDetailPage};
|
|
1
|
+
import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{a as t,f as n,y as r}from"./vendor-CVpIjmrD.js";import{i,t as a}from"./react-BdWJx0XL.js";import"./tiptap-CzV8H9Mb.js";import{i as o,n as s}from"./useProtocol-C3ClZHlN.js";import{t as c}from"./RenderedMarkdown-CMavJdAJ.js";var l=e(i(),1),u=a();function d({value:e,label:t,className:n}){let{t:i}=r(),[a,o]=(0,l.useState)(!1);return(0,u.jsx)(`button`,{type:`button`,onClick:(0,l.useCallback)(async()=>{try{await navigator.clipboard.writeText(e),o(!0),setTimeout(()=>o(!1),2e3)}catch{}},[e]),className:n,"aria-label":a?i(`run.copied`):t,title:t,children:i(a?`run.copied`:`run.copy`)})}var f={shell:`bg-[#fef3c7] text-[#92400e]`,mcp:`bg-[#dbeafe] text-[#1e40af]`,user_input:`bg-[#ede9fe] text-[#5b21b6]`,comment:`bg-[#e2e8f0] text-[#334155]`},p={shell:`Shell command`,mcp:`MCP tool call`,user_input:`User input`,comment:`Comment`};function m(){let{t:e}=r(),{uri:i}=n(),{data:a,isLoading:m,isError:h,error:g}=o(i?decodeURIComponent(i):void 0,!0),[_,v]=(0,l.useState)(null),[y,b]=(0,l.useState)(!1),x=(0,l.useRef)(null);if((0,l.useEffect)(()=>{if(!y)return;let e=e=>{x.current&&!x.current.contains(e.target)&&b(!1)};return document.addEventListener(`click`,e),()=>document.removeEventListener(`click`,e)},[y]),m&&!a)return(0,u.jsx)(`p`,{className:`text-[var(--color-text-muted)]`,children:e(`protocol.loading`)});if(h||!a)return(0,u.jsxs)(`div`,{role:`alert`,className:`p-4 rounded-[var(--radius-md)] bg-[var(--color-error-bg)] text-[var(--color-error)]`,children:[g instanceof Error?g.message:e(`protocol.notFound`),(0,u.jsx)(t,{to:`/`,className:`block mt-2 text-[var(--color-primary)] underline hover:no-underline focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,children:e(`notFound.goHome`)})]});let{title:S,steps:C,triggers:w,completion:T}=s(a.markdown_doc),E=()=>{let e=S.replace(/[^a-zA-Z0-9]+/g,`-`).replace(/^-|-$/g,``)||`protocol`,t=new Blob([a.markdown_doc],{type:`text/markdown;charset=utf-8`}),n=URL.createObjectURL(t),r=document.createElement(`a`);r.href=n,r.download=`${e}.md`,r.click(),URL.revokeObjectURL(n),b(!1)},D=()=>{let e=S.replace(/[^a-zA-Z0-9]+/g,`-`).replace(/^-|-$/g,``)||`protocol`,t=`# ${S}\n\n${a.markdown_doc}`,n=new Blob([t],{type:`text/markdown;charset=utf-8`}),r=URL.createObjectURL(n),i=document.createElement(`a`);i.href=r,i.download=`${e}-skill.md`,i.click(),URL.revokeObjectURL(r),b(!1)};return(0,u.jsxs)(`div`,{children:[(0,u.jsx)(`h1`,{className:`text-[var(--color-text-heading)] text-2xl font-semibold mb-3`,children:S}),(0,u.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 mb-6`,children:[(0,u.jsxs)(`p`,{className:`text-sm text-[var(--color-text-muted)] m-0`,children:[(0,u.jsxs)(`span`,{className:`sr-only`,children:[e(`protocol.uri`),`: `]}),(0,u.jsx)(`code`,{className:`text-xs bg-[var(--color-surface-elevated)] px-2 py-0.5 rounded break-all`,children:a.uri}),(0,u.jsxs)(`span`,{className:`ml-2`,children:[`· `,e(`protocol.readOnly`)]})]}),(0,u.jsx)(d,{value:a.uri,label:e(`protocol.copyUri`),className:`min-h-[44px] min-w-[44px] inline-flex items-center justify-center px-3 py-1.5 text-sm font-medium rounded-[var(--radius-md)] border border-[var(--color-border)] text-[var(--color-text)] bg-[var(--color-surface)] hover:bg-[var(--color-surface-elevated)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`}),(0,u.jsxs)(`div`,{className:`relative`,ref:x,children:[(0,u.jsx)(`button`,{type:`button`,onClick:()=>b(e=>!e),"aria-expanded":y,"aria-haspopup":`true`,"aria-label":e(`protocol.download`),className:`min-h-[44px] min-w-[44px] inline-flex items-center justify-center px-3 py-1.5 text-sm font-medium rounded-[var(--radius-md)] border border-[var(--color-border)] text-[var(--color-text)] bg-[var(--color-surface)] hover:bg-[var(--color-surface-elevated)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,children:e(`protocol.download`)}),y&&(0,u.jsxs)(`div`,{className:`absolute left-0 top-full z-10 mt-1 min-w-[12rem] rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface)] py-1 shadow-sm`,role:`menu`,children:[(0,u.jsxs)(`button`,{type:`button`,role:`menuitem`,onClick:E,className:`flex w-full min-h-[44px] items-center justify-between px-3 py-2 text-left text-sm text-[var(--color-text)] hover:bg-[var(--color-surface-elevated)] focus:bg-[var(--color-surface-elevated)] focus:outline-none`,children:[e(`protocol.downloadAsMarkdown`),(0,u.jsx)(`span`,{className:`text-[var(--color-text-muted)]`,children:`.md`})]}),(0,u.jsxs)(`button`,{type:`button`,role:`menuitem`,onClick:D,className:`flex w-full min-h-[44px] items-center justify-between px-3 py-2 text-left text-sm text-[var(--color-text)] hover:bg-[var(--color-surface-elevated)] focus:bg-[var(--color-surface-elevated)] focus:outline-none`,children:[e(`protocol.downloadAsSkill`),(0,u.jsx)(`span`,{className:`text-[var(--color-text-muted)]`,children:`.md`})]})]})]}),(0,u.jsx)(t,{to:`/protocols/${encodeURIComponent(a.uri)}/skill`,className:`min-h-[44px] min-w-[44px] inline-flex items-center justify-center px-3 py-1.5 text-sm font-medium rounded-[var(--radius-md)] border border-[var(--color-border)] text-[var(--color-text)] bg-[var(--color-surface)] no-underline hover:bg-[var(--color-surface-elevated)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,children:e(`protocol.editAsSkill`)})]}),(0,u.jsxs)(`div`,{className:`flex flex-wrap gap-2 mb-8`,children:[(0,u.jsx)(t,{to:`/protocols/${encodeURIComponent(a.uri)}/run`,className:`min-h-[44px] min-w-[44px] inline-flex items-center justify-center px-4 py-2 rounded-[var(--radius-md)] font-medium bg-[var(--color-primary)] text-white no-underline hover:bg-[var(--color-primary-hover)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,children:e(`protocol.runGuided`)}),(0,u.jsx)(t,{to:`/protocols/${encodeURIComponent(a.uri)}/edit`,className:`min-h-[44px] min-w-[44px] inline-flex items-center justify-center px-4 py-2 rounded-[var(--radius-md)] font-medium border border-[var(--color-border)] text-[var(--color-text)] no-underline hover:bg-[var(--color-surface-elevated)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,children:e(`protocol.edit`)}),(0,u.jsx)(t,{to:`/protocols/new`,className:`min-h-[44px] min-w-[44px] inline-flex items-center justify-center px-4 py-2 rounded-[var(--radius-md)] font-medium border border-[var(--color-border)] text-[var(--color-text)] no-underline hover:bg-[var(--color-surface-elevated)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,children:e(`protocol.duplicate`)})]}),(0,u.jsxs)(`section`,{"aria-labelledby":`steps-heading`,className:`mb-8`,children:[(0,u.jsx)(`h2`,{id:`steps-heading`,className:`text-lg font-semibold text-[var(--color-text-heading)] mb-2`,children:e(`protocol.steps`)}),(0,u.jsx)(`ul`,{className:`list-none p-0 m-0 rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface-elevated)] divide-y divide-[var(--color-border)]`,children:C.map((t,n)=>(0,u.jsxs)(`li`,{className:`p-5`,children:[(0,u.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,u.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,u.jsxs)(`span`,{className:`block text-sm font-medium text-[var(--color-text)]`,children:[`Step `,n+1,`: `,t.label]}),(0,u.jsx)(`div`,{className:`text-sm text-[var(--color-text-muted)] mt-1 break-words`,children:t.summary}),(0,u.jsx)(`span`,{className:`inline-block mt-1 text-xs uppercase tracking-wide px-2 py-0.5 rounded ${f[t.type]??`bg-[var(--color-surface)] text-[var(--color-text-muted)]`}`,"aria-label":`Challenge type: ${p[t.type]??t.type}`,children:p[t.type]??t.type})]}),(0,u.jsxs)(`div`,{className:`flex items-center gap-2 flex-shrink-0`,children:[(0,u.jsx)(d,{value:t.body||t.summary,label:`${e(`run.copy`)} ${t.label}`,className:`min-h-[44px] min-w-[44px] inline-flex items-center justify-center px-3 py-1.5 text-sm font-medium rounded-[var(--radius-md)] border border-[var(--color-border)] text-[var(--color-text)] bg-[var(--color-surface)] hover:bg-[var(--color-surface-elevated)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`}),t.body?(0,u.jsx)(`button`,{type:`button`,onClick:()=>v(_===n?null:n),"aria-expanded":_===n,"aria-controls":`step-detail-${n}`,id:`step-toggle-${n}`,className:`min-h-[44px] min-w-[44px] inline-flex items-center justify-center px-3 py-1.5 text-sm font-medium rounded-[var(--radius-md)] border border-[var(--color-border)] text-[var(--color-text)] bg-[var(--color-surface)] hover:bg-[var(--color-surface-elevated)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,children:e(_===n?`protocol.collapse`:`protocol.expand`)}):null]})]}),t.body?(0,u.jsx)(`div`,{id:`step-detail-${n}`,role:`region`,"aria-labelledby":`step-toggle-${n}`,hidden:_!==n,className:`mt-3 pt-3 border-t border-[var(--color-border)]`,children:(0,u.jsx)(c,{content:t.body})}):null]},n))})]}),w&&(0,u.jsxs)(`section`,{"aria-labelledby":`triggers-heading`,className:`mb-8`,children:[(0,u.jsx)(`h2`,{id:`triggers-heading`,className:`text-lg font-semibold text-[var(--color-text-heading)] mb-2`,children:e(`protocol.triggers`)}),(0,u.jsx)(`div`,{className:`rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface-elevated)] p-4`,children:(0,u.jsx)(c,{content:w})})]}),T&&(0,u.jsxs)(`section`,{"aria-labelledby":`completion-heading`,className:`mb-8`,children:[(0,u.jsx)(`h2`,{id:`completion-heading`,className:`text-lg font-semibold text-[var(--color-text-heading)] mb-2`,children:e(`protocol.completion`)}),(0,u.jsx)(`div`,{className:`rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface-elevated)] p-4`,children:(0,u.jsx)(c,{content:T})})]}),(0,u.jsxs)(`div`,{className:`rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface-elevated)] p-5 mt-8`,role:`region`,"aria-labelledby":`how-to-use-heading`,children:[(0,u.jsx)(`h2`,{id:`how-to-use-heading`,className:`text-base font-semibold text-[var(--color-text-heading)] mb-2`,children:e(`protocol.howToUse`)}),(0,u.jsx)(`p`,{className:`text-sm text-[var(--color-text-muted)] mb-2`,children:e(`protocol.howToUseInProduct`)}),(0,u.jsxs)(`p`,{className:`text-sm text-[var(--color-text-muted)]`,children:[e(`protocol.howToUseCopy`),` `,(0,u.jsx)(`a`,{href:`https://github.com/debian777/kairos-mcp#readme`,target:`_blank`,rel:`noopener noreferrer`,className:`text-[var(--color-primary)] underline hover:no-underline focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,children:e(`protocol.docsLink`)})]})]})]})}export{m as ProtocolDetailPage};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{a as t,d as n,f as r,t as i,y as a}from"./vendor-CVpIjmrD.js";import{i as o,t as s}from"./react-BdWJx0XL.js";import{a as c,c as l,i as u,l as d,n as f,o as p,r as m,s as h,t as g}from"./tiptap-CzV8H9Mb.js";import{t as _}from"./api-D88c6lbH.js";import{i as v,n as y,r as b,t as x}from"./useProtocol-C3ClZHlN.js";var S=e(o(),1);function C(){return[p.configure({heading:!1,link:!1}),h.configure({openOnClick:!1,autolink:!1}),f.configure({resizable:!1}),c,m,u,g.configure({markedOptions:{gfm:!0,breaks:!1}})]}var w=s(),T=`min-h-[11rem] px-4 py-3 text-sm leading-6 text-[var(--color-text)] focus:outline-none prose prose-sm max-w-none [&_table]:my-3 [&_table]:w-full [&_table]:border-collapse [&_th]:border [&_th]:border-[var(--color-border)] [&_th]:bg-[var(--color-surface-elevated)] [&_th]:px-2 [&_th]:py-1.5 [&_td]:border [&_td]:border-[var(--color-border)] [&_td]:px-2 [&_td]:py-1.5`;function E({children:e,className:t=`h-4 w-4`}){return(0,w.jsx)(`svg`,{"aria-hidden":`true`,viewBox:`0 0 16 16`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`,className:t,children:e})}function D(){return(0,w.jsxs)(E,{children:[(0,w.jsx)(`circle`,{cx:`3`,cy:`4`,r:`1`,fill:`currentColor`,stroke:`none`}),(0,w.jsx)(`circle`,{cx:`3`,cy:`8`,r:`1`,fill:`currentColor`,stroke:`none`}),(0,w.jsx)(`circle`,{cx:`3`,cy:`12`,r:`1`,fill:`currentColor`,stroke:`none`}),(0,w.jsx)(`path`,{d:`M6 4h7`}),(0,w.jsx)(`path`,{d:`M6 8h7`}),(0,w.jsx)(`path`,{d:`M6 12h7`})]})}function O(){return(0,w.jsxs)(E,{children:[(0,w.jsx)(`path`,{d:`M6 10L4.5 11.5a2.5 2.5 0 1 1-3.5-3.5L2.5 6.5`}),(0,w.jsx)(`path`,{d:`M10 6l1.5-1.5a2.5 2.5 0 1 1 3.5 3.5L13.5 9.5`}),(0,w.jsx)(`path`,{d:`M5.5 10.5l5-5`})]})}function k(){return(0,w.jsxs)(E,{children:[(0,w.jsx)(`path`,{d:`M5.5 5.5A2.5 2.5 0 0 0 3 8v2.5h3V8H4.5`}),(0,w.jsx)(`path`,{d:`M11.5 5.5A2.5 2.5 0 0 0 9 8v2.5h3V8h-1.5`})]})}function A(){return(0,w.jsxs)(E,{children:[(0,w.jsx)(`path`,{d:`M6 5.5l2 5-2 5`}),(0,w.jsx)(`path`,{d:`M10 5.5l2 5-2 5`})]})}function j(){return(0,w.jsxs)(E,{children:[(0,w.jsx)(`path`,{d:`M6 4L2.5 8L6 12`}),(0,w.jsx)(`path`,{d:`M10 4l3.5 4L10 12`}),(0,w.jsx)(`path`,{d:`M8.75 3.5L7.25 12.5`})]})}function M(){return(0,w.jsxs)(E,{children:[(0,w.jsx)(`path`,{d:`M2 3h12v2H2V3z`}),(0,w.jsx)(`path`,{d:`M2 7h12v1H2V7z`}),(0,w.jsx)(`path`,{d:`M2 11h12v1H2v-1z`}),(0,w.jsx)(`path`,{d:`M2 15h12v1H2v-1z`}),(0,w.jsx)(`path`,{d:`M2 4v11`}),(0,w.jsx)(`path`,{d:`M6 4v11`}),(0,w.jsx)(`path`,{d:`M10 4v11`}),(0,w.jsx)(`path`,{d:`M14 4v11`})]})}function N({label:e,ariaLabel:t,active:n,onClick:r}){return(0,w.jsx)(`button`,{type:`button`,"aria-label":t,title:t,onClick:r,className:`inline-flex min-h-[36px] min-w-[36px] items-center justify-center rounded-[var(--radius-sm)] border px-3 text-xs font-medium transition-colors ${n?`border-[var(--color-primary)] bg-[var(--color-primary)] text-white`:`border-[var(--color-border)] bg-[var(--color-surface)] text-[var(--color-text-muted)] hover:bg-[var(--color-surface)] hover:text-[var(--color-text)]`}`,children:e})}function P({editor:e}){return e?(0,w.jsxs)(`div`,{className:`flex flex-wrap gap-2 border-b border-[var(--color-border)] bg-[var(--color-surface-elevated)] px-3 py-2`,children:[(0,w.jsx)(N,{label:(0,w.jsx)(`span`,{className:`text-base leading-none`,children:`¶`}),ariaLabel:`Paragraph`,active:e.isActive(`paragraph`),onClick:()=>e.chain().focus().setParagraph().run()}),(0,w.jsx)(N,{label:(0,w.jsx)(`strong`,{className:`text-sm font-semibold`,children:`B`}),ariaLabel:`Bold`,active:e.isActive(`bold`),onClick:()=>e.chain().focus().toggleBold().run()}),(0,w.jsx)(N,{label:(0,w.jsx)(`em`,{className:`text-sm`,children:`I`}),ariaLabel:`Italic`,active:e.isActive(`italic`),onClick:()=>e.chain().focus().toggleItalic().run()}),(0,w.jsx)(N,{label:(0,w.jsx)(D,{}),ariaLabel:`Bullet list`,active:e.isActive(`bulletList`),onClick:()=>e.chain().focus().toggleBulletList().run()}),(0,w.jsx)(N,{label:(0,w.jsx)(`span`,{className:`text-sm font-semibold`,children:`1.`}),ariaLabel:`Numbered list`,active:e.isActive(`orderedList`),onClick:()=>e.chain().focus().toggleOrderedList().run()}),(0,w.jsx)(N,{label:(0,w.jsx)(O,{}),ariaLabel:`Link`,active:e.isActive(`link`),onClick:()=>{let t=e.getAttributes(`link`).href,n=window.prompt(`Enter URL`,t??`https://`);if(n==null)return;let r=n.trim();if(!r){e.chain().focus().unsetLink().run();return}e.chain().focus().extendMarkRange(`link`).setLink({href:r}).run()}}),(0,w.jsx)(N,{label:(0,w.jsx)(k,{}),ariaLabel:`Quote`,active:e.isActive(`blockquote`),onClick:()=>e.chain().focus().toggleBlockquote().run()}),(0,w.jsx)(N,{label:(0,w.jsx)(A,{}),ariaLabel:`Inline code`,active:e.isActive(`code`),onClick:()=>e.chain().focus().toggleCode().run()}),(0,w.jsx)(N,{label:(0,w.jsx)(j,{}),ariaLabel:`Code block`,active:e.isActive(`codeBlock`),onClick:()=>e.chain().focus().toggleCodeBlock().run()}),(0,w.jsx)(N,{label:(0,w.jsx)(M,{}),ariaLabel:`Insert table`,active:e.isActive(`table`),onClick:()=>e.chain().focus().insertTable({rows:3,cols:3,withHeaderRow:!0}).run()})]}):null}function F({value:e,onChange:t,label:n,hint:r,id:i,contentKey:a}){let o=(0,S.useRef)(a),s=(0,S.useRef)(null),c=(0,S.useRef)(e),u=(0,S.useRef)(t);c.current=e,u.current=t;let f=d({key:a??`default`,immediatelyRender:!1,extensions:C(),content:e,contentType:`markdown`,editorProps:{attributes:{class:T}},onUpdate:({editor:e})=>{let t=e.getMarkdown?.()??``;s.current=t,t!==c.current&&u.current(t)}});return(0,S.useEffect)(()=>{if(f){if(a!==o.current){o.current=a,s.current=e,f.commands.setContent(e,!1,{contentType:`markdown`,preserveWhitespace:`full`});return}e!==s.current&&(s.current=e,f.commands.setContent(e,!1,{contentType:`markdown`,preserveWhitespace:`full`}))}},[a,e,f]),(0,w.jsxs)(`div`,{children:[n&&(0,w.jsx)(`label`,{htmlFor:i,className:`mb-2 block font-medium text-[var(--color-text-heading)]`,children:n}),(0,w.jsxs)(`div`,{className:`overflow-hidden rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface)]`,children:[(0,w.jsx)(P,{editor:f}),(0,w.jsx)(l,{editor:f})]}),r&&(0,w.jsx)(`p`,{className:`mt-2 text-sm text-[var(--color-text-muted)]`,children:r})]})}var I=i().min(1,`Protocol content is required`).refine(e=>e.includes(`# `),`Protocol must have an H1 title`).refine(e=>/(^|\n)##\s+Natural language triggers\b/i.test(e),`Include a "Natural language triggers" section (H2)`).refine(e=>/(^|\n)##\s+Completion rule\b/i.test(e),`Include a "Completion rule" section (H2)`),L={label:`Step`,bodyMarkdown:`What the user or agent does in this step.`,type:`comment`,comment:{min_length:10}},R=[`shell`,`mcp`,`user_input`,`comment`];function z(){let{t:e}=a(),{uri:i}=r(),o=n(),s=i?decodeURIComponent(i):void 0,c=!s,{data:l,isLoading:u}=v(s,!c),[d,f]=(0,S.useState)({protocolLabel:``,triggersMarkdown:``,steps:[{...L}],completionMarkdown:``}),[p,m]=(0,S.useState)(()=>String(Date.now())),[h,g]=(0,S.useState)(!1),[C,T]=(0,S.useState)(null),[E,D]=(0,S.useState)(null),O=(0,S.useRef)(null);(0,S.useEffect)(()=>{if(l?.markdown_doc)try{f(b(l.markdown_doc)),m(String(Date.now()))}catch{f({protocolLabel:l.label||`Protocol`,triggersMarkdown:``,steps:[{...L}],completionMarkdown:``})}},[l]);let k=e=>{let t=e.target.files?.[0];if(!t)return;let n=new FileReader;n.onload=()=>{let e=typeof n.result==`string`?n.result:``;try{f(b(e)),m(String(Date.now())),D(null),T(null)}catch{T(`Could not parse the uploaded file. Use valid protocol markdown.`)}},n.readAsText(t,`UTF-8`),e.target.value=``},A=(e,t)=>{f(n=>({...n,[e]:t}))},j=(e,t)=>{f(n=>({...n,steps:n.steps.map((n,r)=>r===e?typeof t==`function`?t(n):{...n,...t}:n)}))},M=()=>{f(e=>({...e,steps:[...e.steps,{...L,label:`Step ${e.steps.length+1}`}]}))},N=e=>{f(t=>({...t,steps:t.steps.filter((t,n)=>n!==e)}))},P=async e=>{e.preventDefault(),T(null),D(null);let t=x(d),n=I.safeParse(t);if(!n.success){D(n.error.errors[0]?.message??`Invalid`);return}g(!0);try{if(c){let e=await _(`/api/kairos_mint/raw`,{method:`POST`,headers:{"Content-Type":`text/markdown`},body:t});if(!e.ok){let t=await e.json().catch(()=>({}));throw Error(t.message??e.statusText)}let n=(await e.json()).items?.[0]?.uri;o(n?`/protocols/${encodeURIComponent(n)}`:`/`)}else{let e=await _(`/api/kairos_update`,{method:`POST`,body:JSON.stringify({uris:[s],markdown_doc:[t]})});if(!e.ok){let t=await e.json().catch(()=>({}));throw Error(t.message??e.statusText)}o(`/protocols/${encodeURIComponent(s)}`)}}catch(e){T(e instanceof Error?e.message:String(e))}finally{g(!1)}},z=(()=>{try{return y(x(d))}catch{return{title:d.protocolLabel||`Protocol`,steps:[],triggers:``,completion:``}}})();if(!c&&u&&!l)return(0,w.jsx)(`p`,{className:`text-[var(--color-text-muted)]`,children:e(`protocol.loading`)});let B={shell:e(`protocolEdit.challengeShell`),mcp:e(`protocolEdit.challengeMcp`),user_input:e(`protocolEdit.challengeUserInput`),comment:e(`protocolEdit.challengeComment`)};return(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`h1`,{className:`mb-1 text-2xl font-semibold text-[var(--color-text-heading)]`,children:!c&&d.protocolLabel.trim()?d.protocolLabel.trim():e(c?`protocolEdit.newTitle`:`protocolEdit.editTitle`)}),(0,w.jsx)(`p`,{className:`mb-6 text-sm text-[var(--color-text-muted)]`,children:e(`protocolEdit.hint`)}),(0,w.jsxs)(`div`,{className:`mb-8 flex flex-wrap items-center justify-between gap-3 rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface-elevated)] p-5`,children:[(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`div`,{className:`font-medium text-[var(--color-text-heading)]`,children:`Import existing content`}),(0,w.jsx)(`p`,{className:`mt-1 text-sm text-[var(--color-text-muted)]`,children:e(`protocolEdit.uploadHint`)})]}),(0,w.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,w.jsx)(`input`,{ref:O,type:`file`,accept:`.md,text/markdown`,onChange:k,className:`sr-only`,id:`protocol-upload`,"aria-label":e(`protocolEdit.upload`)}),(0,w.jsx)(`button`,{type:`button`,onClick:()=>O.current?.click(),className:`min-h-[44px] min-w-[44px] inline-flex items-center justify-center rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface)] px-4 py-2 text-sm font-medium text-[var(--color-text)] hover:bg-[var(--color-surface-elevated)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,children:e(`protocolEdit.upload`)}),!c&&s&&(0,w.jsx)(t,{to:`/protocols/${encodeURIComponent(s)}/skill`,className:`min-h-[44px] min-w-[44px] inline-flex items-center justify-center rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface)] px-4 py-2 text-sm font-medium text-[var(--color-text)] no-underline hover:bg-[var(--color-surface-elevated)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,children:e(`protocol.editAsSkill`)})]})]}),(0,w.jsx)(`form`,{onSubmit:P,"aria-label":e(`protocolEdit.formLabel`),children:(0,w.jsxs)(`div`,{className:`mb-6 grid gap-6 xl:grid-cols-[1.6fr_1fr]`,children:[(0,w.jsxs)(`div`,{className:`space-y-6`,children:[(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`label`,{htmlFor:`protocol-label`,className:`mb-2 block font-medium text-[var(--color-text-heading)]`,children:e(`protocolEdit.protocolLabel`)}),(0,w.jsx)(`input`,{id:`protocol-label`,type:`text`,value:d.protocolLabel,onChange:e=>A(`protocolLabel`,e.target.value),className:`min-h-[44px] w-full rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface)] px-4 py-3 text-sm text-[var(--color-text)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`})]}),(0,w.jsx)(F,{label:e(`protocolEdit.triggersLabel`),hint:e(`protocolEdit.triggersHint`),value:d.triggersMarkdown,onChange:e=>A(`triggersMarkdown`,e),contentKey:p}),d.steps.map((t,n)=>(0,w.jsxs)(`div`,{className:`rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface-elevated)] p-5 space-y-5`,children:[(0,w.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,w.jsxs)(`div`,{className:`text-sm text-[var(--color-text-muted)]`,children:[`Step `,n+1,t.label.trim()?`: ${t.label.trim()}`:``]}),(0,w.jsx)(`button`,{type:`button`,onClick:()=>N(n),disabled:d.steps.length<=1,className:`min-h-[44px] min-w-[44px] inline-flex items-center justify-center rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface)] px-4 py-2 text-sm font-medium text-[var(--color-text)] hover:bg-[var(--color-surface-elevated)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2 disabled:opacity-50`,children:e(`protocolEdit.removeStep`)})]}),(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`label`,{className:`mb-2 block font-medium text-[var(--color-text-heading)]`,children:e(`protocolEdit.stepLabel`)}),(0,w.jsx)(`input`,{type:`text`,value:t.label,onChange:e=>j(n,{label:e.target.value}),className:`min-h-[44px] w-full rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface)] px-4 py-3 text-sm text-[var(--color-text)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`})]}),(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`div`,{className:`mb-2 font-medium text-[var(--color-text-heading)]`,children:e(`protocolEdit.challengeType`)}),(0,w.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:R.map(e=>(0,w.jsx)(`button`,{type:`button`,"aria-pressed":t.type===e,onClick:()=>j(n,{type:e,shell:e===`shell`?{cmd:t.shell?.cmd??``,timeout_seconds:t.shell?.timeout_seconds??30,interpreter:t.shell?.interpreter,workdir:t.shell?.workdir,flags:t.shell?.flags??[],args:t.shell?.args??[]}:void 0,mcp:e===`mcp`?{tool_name:t.mcp?.tool_name??``}:void 0,user_input:e===`user_input`?{prompt:t.user_input?.prompt??``}:void 0,comment:e===`comment`?{min_length:t.comment?.min_length??10}:void 0}),className:`min-h-[44px] rounded-[var(--radius-md)] px-4 text-sm font-medium ${t.type===e?`bg-[var(--color-primary)] text-white`:`border border-[var(--color-border)] bg-[var(--color-surface)] text-[var(--color-text)]`}`,children:B[e]},e))})]}),(0,w.jsx)(`div`,{children:(0,w.jsx)(F,{label:e(`protocolEdit.stepContent`),value:t.bodyMarkdown,onChange:e=>j(n,{bodyMarkdown:e}),contentKey:p})}),(0,w.jsxs)(`div`,{className:`rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface)] p-4`,children:[(0,w.jsx)(`div`,{className:`mb-3 text-sm font-medium text-[var(--color-text-heading)]`,children:`Challenge fields`}),(0,w.jsxs)(`div`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-2`,children:[t.type===`shell`&&(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`label`,{className:`mb-2 block text-sm font-medium text-[var(--color-text-heading)]`,children:e(`protocolEdit.shellCmd`)}),(0,w.jsx)(`input`,{type:`text`,value:t.shell?.cmd??``,onChange:e=>j(n,{shell:{cmd:e.target.value,timeout_seconds:t.shell?.timeout_seconds??30,interpreter:t.shell?.interpreter,workdir:t.shell?.workdir,flags:t.shell?.flags??[],args:t.shell?.args??[]}}),className:`min-h-[44px] w-full rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface-elevated)] px-4 py-3 text-sm text-[var(--color-text)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`})]}),(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`label`,{className:`mb-2 block text-sm font-medium text-[var(--color-text-heading)]`,children:e(`protocolEdit.shellTimeout`)}),(0,w.jsx)(`input`,{type:`number`,min:1,value:t.shell?.timeout_seconds??30,onChange:e=>j(n,{shell:{cmd:t.shell?.cmd??``,timeout_seconds:Math.max(1,Number(e.target.value)||30),interpreter:t.shell?.interpreter,workdir:t.shell?.workdir,flags:t.shell?.flags??[],args:t.shell?.args??[]}}),className:`min-h-[44px] w-full rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface-elevated)] px-4 py-3 text-sm text-[var(--color-text)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`})]}),(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`label`,{className:`mb-2 block text-sm font-medium text-[var(--color-text-heading)]`,children:e(`protocolEdit.shellInterpreter`)}),(0,w.jsx)(`input`,{type:`text`,value:t.shell?.interpreter??``,onChange:e=>j(n,{shell:{cmd:t.shell?.cmd??``,timeout_seconds:t.shell?.timeout_seconds??30,interpreter:e.target.value||void 0,workdir:t.shell?.workdir,flags:t.shell?.flags??[],args:t.shell?.args??[]}}),className:`min-h-[44px] w-full rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface-elevated)] px-4 py-3 text-sm text-[var(--color-text)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`})]}),(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`label`,{className:`mb-2 block text-sm font-medium text-[var(--color-text-heading)]`,children:e(`protocolEdit.shellWorkdir`)}),(0,w.jsx)(`input`,{type:`text`,value:t.shell?.workdir??``,onChange:e=>j(n,{shell:{cmd:t.shell?.cmd??``,timeout_seconds:t.shell?.timeout_seconds??30,interpreter:t.shell?.interpreter,workdir:e.target.value||void 0,flags:t.shell?.flags??[],args:t.shell?.args??[]}}),className:`min-h-[44px] w-full rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface-elevated)] px-4 py-3 text-sm text-[var(--color-text)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`})]}),(0,w.jsxs)(`div`,{className:`sm:col-span-2`,children:[(0,w.jsx)(`label`,{className:`mb-2 block text-sm font-medium text-[var(--color-text-heading)]`,children:e(`protocolEdit.shellFlags`)}),(0,w.jsx)(`textarea`,{rows:3,value:(t.shell?.flags??[]).join(`
|
|
2
|
+
`),onChange:e=>j(n,{shell:{cmd:t.shell?.cmd??``,timeout_seconds:t.shell?.timeout_seconds??30,interpreter:t.shell?.interpreter,workdir:t.shell?.workdir,flags:e.target.value.split(`
|
|
3
|
+
`).map(e=>e.trim()).filter(Boolean),args:t.shell?.args??[]}}),className:`w-full rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface-elevated)] px-4 py-3 text-sm text-[var(--color-text)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`})]}),(0,w.jsxs)(`div`,{className:`sm:col-span-2`,children:[(0,w.jsx)(`label`,{className:`mb-2 block text-sm font-medium text-[var(--color-text-heading)]`,children:e(`protocolEdit.shellArgs`)}),(0,w.jsx)(`textarea`,{rows:3,value:(t.shell?.args??[]).join(`
|
|
4
|
+
`),onChange:e=>j(n,{shell:{cmd:t.shell?.cmd??``,timeout_seconds:t.shell?.timeout_seconds??30,interpreter:t.shell?.interpreter,workdir:t.shell?.workdir,flags:t.shell?.flags??[],args:e.target.value.split(`
|
|
5
|
+
`).map(e=>e.trim()).filter(Boolean)}}),className:`w-full rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface-elevated)] px-4 py-3 text-sm text-[var(--color-text)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`})]})]}),t.type===`mcp`&&(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`label`,{className:`mb-2 block text-sm font-medium text-[var(--color-text-heading)]`,children:e(`protocolEdit.mcpToolName`)}),(0,w.jsx)(`input`,{type:`text`,value:t.mcp?.tool_name??``,onChange:e=>j(n,{mcp:{tool_name:e.target.value}}),className:`min-h-[44px] w-full rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface-elevated)] px-4 py-3 text-sm text-[var(--color-text)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`})]}),t.type===`user_input`&&(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`label`,{className:`mb-2 block text-sm font-medium text-[var(--color-text-heading)]`,children:e(`protocolEdit.userInputPrompt`)}),(0,w.jsx)(`input`,{type:`text`,value:t.user_input?.prompt??``,onChange:e=>j(n,{user_input:{prompt:e.target.value}}),className:`min-h-[44px] w-full rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface-elevated)] px-4 py-3 text-sm text-[var(--color-text)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`})]}),t.type===`comment`&&(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`label`,{className:`mb-2 block text-sm font-medium text-[var(--color-text-heading)]`,children:e(`protocolEdit.commentMinLength`)}),(0,w.jsx)(`input`,{type:`number`,min:1,value:t.comment?.min_length??10,onChange:e=>j(n,{comment:{min_length:Math.max(1,parseInt(e.target.value,10)||10)}}),className:`min-h-[44px] w-full rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface-elevated)] px-4 py-3 text-sm text-[var(--color-text)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`})]})]})]})]},n)),(0,w.jsx)(`button`,{type:`button`,onClick:M,className:`min-h-[44px] min-w-[44px] inline-flex items-center justify-center rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface)] px-4 py-2 text-sm font-medium text-[var(--color-text)] hover:bg-[var(--color-surface-elevated)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,children:e(`protocolEdit.addStep`)}),(0,w.jsx)(F,{label:e(`protocolEdit.completionLabel`),value:d.completionMarkdown,onChange:e=>A(`completionMarkdown`,e),contentKey:p}),E&&(0,w.jsx)(`p`,{className:`text-sm text-[var(--color-error)]`,role:`alert`,children:E}),C&&(0,w.jsx)(`div`,{className:`rounded-[var(--radius-md)] bg-[var(--color-error-bg)] p-4 text-[var(--color-error)]`,role:`alert`,children:C}),(0,w.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,w.jsx)(`button`,{type:`submit`,disabled:h,className:`min-h-[44px] min-w-[44px] inline-flex items-center justify-center rounded-[var(--radius-md)] bg-[var(--color-primary)] px-4 py-2 font-medium text-white hover:bg-[var(--color-primary-hover)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2 disabled:opacity-60`,children:e(h?`protocolEdit.saving`:`protocolEdit.save`)}),(0,w.jsx)(t,{to:c?`/`:`/protocols/${encodeURIComponent(s)}`,className:`min-h-[44px] min-w-[44px] inline-flex items-center justify-center rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface)] px-4 py-2 font-medium text-[var(--color-text)] no-underline hover:bg-[var(--color-surface-elevated)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,children:e(`protocolEdit.cancel`)})]})]}),(0,w.jsx)(`div`,{"aria-label":e(`protocolEdit.previewLabel`),children:(0,w.jsxs)(`div`,{className:`rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface-elevated)] p-4`,children:[(0,w.jsx)(`div`,{className:`text-sm text-[var(--color-text-muted)]`,children:e(`protocolEdit.previewTitle`)}),(0,w.jsx)(`div`,{className:`mt-1 text-lg font-semibold text-[var(--color-text-heading)]`,children:z.title}),(0,w.jsxs)(`div`,{className:`mt-4`,children:[(0,w.jsx)(`div`,{className:`mb-2 text-sm font-medium text-[var(--color-text-heading)]`,children:e(`protocolEdit.previewSteps`)}),z.steps.length===0?(0,w.jsx)(`div`,{className:`text-sm text-[var(--color-text-muted)]`,children:e(`protocolEdit.previewNoSteps`)}):(0,w.jsx)(`ul`,{className:`m-0 list-none space-y-2 p-0`,children:z.steps.slice(0,20).map((e,t)=>(0,w.jsxs)(`li`,{className:`rounded-[var(--radius-sm)] border border-[var(--color-border)] bg-[var(--color-surface)] p-3`,children:[(0,w.jsx)(`div`,{className:`font-medium text-[var(--color-text-heading)]`,children:e.label}),(0,w.jsx)(`div`,{className:`mt-1 text-sm text-[var(--color-text-muted)]`,children:e.summary})]},`${e.label}:${t}`))})]}),(0,w.jsxs)(`div`,{className:`mt-4`,children:[(0,w.jsx)(`div`,{className:`mb-2 text-sm font-medium text-[var(--color-text-heading)]`,children:e(`protocolEdit.previewSections`)}),(0,w.jsxs)(`div`,{className:`text-sm text-[var(--color-text-muted)]`,children:[(0,w.jsxs)(`div`,{children:[(0,w.jsxs)(`strong`,{className:`text-[var(--color-text-heading)]`,children:[e(`protocol.triggers`),`:`]}),` `,z.triggers?e(`protocolEdit.present`):e(`protocolEdit.missing`)]}),(0,w.jsxs)(`div`,{className:`mt-1`,children:[(0,w.jsxs)(`strong`,{className:`text-[var(--color-text-heading)]`,children:[e(`protocol.completion`),`:`]}),` `,z.completion?e(`protocolEdit.present`):e(`protocolEdit.missing`)]})]})]})]})})]})})]})}export{z as ProtocolEditPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e,r as t}from"./vendor-
|
|
1
|
+
import{n as e,r as t}from"./vendor-CVpIjmrD.js";import{t as n}from"./react-BdWJx0XL.js";var r=n(),i=`text-sm leading-6 text-[var(--color-text)] [&_p]:mt-0 [&_p:first-child]:mt-0 [&_p+p]:mt-3 [&_ul]:my-3 [&_ul]:pl-6 [&_ol]:my-3 [&_ol]:pl-6 [&_li]:my-0.5 [&_strong]:font-semibold [&_strong]:text-[var(--color-text-heading)] [&_code]:rounded [&_code]:bg-[var(--color-surface-elevated)] [&_code]:px-1.5 [&_code]:py-0.5 [&_code]:text-xs [&_code]:font-mono [&_pre]:my-3 [&_pre]:overflow-x-auto [&_pre]:rounded-[var(--radius-md)] [&_pre]:bg-[var(--color-surface-elevated)] [&_pre]:p-3 [&_pre]:text-sm [&_pre]:font-mono [&_pre]:whitespace-pre-wrap [&_pre_code]:bg-transparent [&_pre_code]:p-0 [&_pre_code]:text-inherit [&_a]:text-[var(--color-primary)] [&_a]:underline [&_a:hover]:no-underline [&_a:focus-visible]:outline [&_a:focus-visible]:outline-2 [&_a:focus-visible]:outline-[var(--color-focus-ring)] [&_a:focus-visible]:outline-offset-2 [&_blockquote]:border-l-4 [&_blockquote]:border-[var(--color-border)] [&_blockquote]:pl-4 [&_blockquote]:italic [&_blockquote]:text-[var(--color-text-muted)] [&_h1]:text-xl [&_h1]:font-semibold [&_h1]:text-[var(--color-text-heading)] [&_h1]:mt-4 [&_h1]:mb-2 [&_h2]:text-lg [&_h2]:font-semibold [&_h2]:text-[var(--color-text-heading)] [&_h2]:mt-4 [&_h2]:mb-2 [&_h3]:text-base [&_h3]:font-medium [&_h3]:text-[var(--color-text-heading)] [&_h3]:mt-3 [&_h3]:mb-1 [&_table]:my-4 [&_table]:w-full [&_table]:border-collapse [&_table]:text-left [&_th]:border [&_th]:border-[var(--color-border)] [&_th]:bg-[var(--color-surface-elevated)] [&_th]:px-3 [&_th]:py-2 [&_th]:font-semibold [&_th]:text-[var(--color-text-heading)] [&_td]:border [&_td]:border-[var(--color-border)] [&_td]:px-3 [&_td]:py-2 [&_tr]:border-b [&_tr]:border-[var(--color-border)] [&_tr:last-child]:border-b-0`;function a({content:n,className:a=``}){return n.trim()?(0,r.jsx)(`div`,{className:`${i} ${a}`.trim(),children:(0,r.jsx)(t,{remarkPlugins:[e],children:n})}):null}export{a as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{a as t,f as n,h as r,p as i,y as a}from"./vendor-CVpIjmrD.js";import{i as o,t as s}from"./react-BdWJx0XL.js";import"./tiptap-CzV8H9Mb.js";import{t as c}from"./api-D88c6lbH.js";import{t as l}from"./ErrorAlert-KEgeKl22.js";import{t as u}from"./RenderedMarkdown-CMavJdAJ.js";import{n as d,t as f}from"./useRunSession-CciNdgs6.js";var p=e(o(),1),m=s();function h(e){let t=e.trim();return t?JSON.parse(t):null}function g({challenge:e,disabled:t,onSubmit:n}){let{t:r}=a(),i=e.type,[o,s]=(0,p.useState)(0),[c,l]=(0,p.useState)(``),[u,d]=(0,p.useState)(``),f=e.mcp?.tool_name??``,[g,_]=(0,p.useState)(!0),[v,y]=(0,p.useState)(``),[b,x]=(0,p.useState)(``),S=e.user_input?.prompt??``,[C,w]=(0,p.useState)(``),T=e.comment?.min_length??10,[E,D]=(0,p.useState)(``),[O,k]=(0,p.useState)(null);(0,p.useEffect)(()=>{k(null),s(0),l(``),d(``),_(!0),y(``),x(``),w(``),D(``)},[i,f,S,T]);let A=(0,p.useMemo)(()=>i===`shell`?Number.isFinite(o):i===`mcp`?f.trim().length>0:i===`user_input`?C.trim().length>0:i===`comment`?E.trim().length>=T:!1,[i,o,f,C,E,T]);return(0,m.jsxs)(`form`,{onSubmit:e=>{if(e.preventDefault(),k(null),A)try{if(i===`shell`){n({type:i,shell:{exit_code:o,...c.trim()?{stdout:c}:{},...u.trim()?{stderr:u}:{}}});return}if(i===`mcp`){let e=h(v),t=h(b);n({type:i,mcp:{tool_name:f,...e===null?{}:{arguments:e},result:t,success:g}});return}if(i===`user_input`){n({type:i,user_input:{confirmation:C.trim(),timestamp:new Date().toISOString()}});return}if(i===`comment`){n({type:i,comment:{text:E.trim()}});return}}catch(e){k(e instanceof Error?e.message:String(e))}},"aria-label":r(`run.solutionFormLabel`),children:[O&&(0,m.jsx)(`div`,{className:`mb-4 p-4 rounded-[var(--radius-md)] bg-[var(--color-error-bg)] text-[var(--color-error)]`,role:`alert`,children:O}),i===`shell`&&(0,m.jsxs)(`div`,{className:`space-y-4`,children:[(0,m.jsxs)(`div`,{children:[(0,m.jsx)(`label`,{htmlFor:`run-shell-exit-code`,className:`block font-medium text-[var(--color-text-heading)] mb-2`,children:r(`run.shell.exitCode`)}),(0,m.jsx)(`input`,{id:`run-shell-exit-code`,type:`number`,inputMode:`numeric`,value:o,onChange:e=>s(Number(e.target.value)),className:`w-full min-h-[44px] px-4 py-2 border border-[var(--color-border)] rounded-[var(--radius-md)] text-[var(--color-text)] bg-[var(--color-surface)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,disabled:t,required:!0})]}),(0,m.jsxs)(`div`,{children:[(0,m.jsx)(`label`,{htmlFor:`run-shell-stdout`,className:`block font-medium text-[var(--color-text-heading)] mb-2`,children:r(`run.shell.stdout`)}),(0,m.jsx)(`textarea`,{id:`run-shell-stdout`,value:c,onChange:e=>l(e.target.value),className:`w-full min-h-[8rem] px-4 py-3 border border-[var(--color-border)] rounded-[var(--radius-md)] text-[var(--color-text)] bg-[var(--color-surface)] font-mono text-sm resize-y`,disabled:t})]}),(0,m.jsxs)(`div`,{children:[(0,m.jsx)(`label`,{htmlFor:`run-shell-stderr`,className:`block font-medium text-[var(--color-text-heading)] mb-2`,children:r(`run.shell.stderr`)}),(0,m.jsx)(`textarea`,{id:`run-shell-stderr`,value:u,onChange:e=>d(e.target.value),className:`w-full min-h-[6rem] px-4 py-3 border border-[var(--color-border)] rounded-[var(--radius-md)] text-[var(--color-text)] bg-[var(--color-surface)] font-mono text-sm resize-y`,disabled:t})]})]}),i===`mcp`&&(0,m.jsxs)(`div`,{className:`space-y-4`,children:[(0,m.jsxs)(`div`,{className:`rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface)] p-4`,children:[(0,m.jsx)(`div`,{className:`text-sm text-[var(--color-text-muted)]`,children:r(`run.mcp.toolName`)}),(0,m.jsx)(`div`,{className:`font-medium text-[var(--color-text-heading)] break-all`,children:f||r(`run.mcp.toolMissing`)})]}),(0,m.jsxs)(`label`,{className:`inline-flex items-center gap-2 min-h-[44px]`,children:[(0,m.jsx)(`input`,{type:`checkbox`,checked:g,onChange:e=>_(e.target.checked),disabled:t,className:`h-4 w-4`}),(0,m.jsx)(`span`,{className:`text-sm text-[var(--color-text)]`,children:r(`run.mcp.success`)})]}),(0,m.jsxs)(`div`,{children:[(0,m.jsx)(`label`,{htmlFor:`run-mcp-args`,className:`block font-medium text-[var(--color-text-heading)] mb-2`,children:r(`run.mcp.arguments`)}),(0,m.jsx)(`textarea`,{id:`run-mcp-args`,value:v,onChange:e=>y(e.target.value),placeholder:`{ "example": true }`,className:`w-full min-h-[6rem] px-4 py-3 border border-[var(--color-border)] rounded-[var(--radius-md)] text-[var(--color-text)] bg-[var(--color-surface)] font-mono text-sm resize-y`,disabled:t})]}),(0,m.jsxs)(`div`,{children:[(0,m.jsx)(`label`,{htmlFor:`run-mcp-result`,className:`block font-medium text-[var(--color-text-heading)] mb-2`,children:r(`run.mcp.result`)}),(0,m.jsx)(`textarea`,{id:`run-mcp-result`,value:b,onChange:e=>x(e.target.value),placeholder:`{ "ok": true }`,className:`w-full min-h-[10rem] px-4 py-3 border border-[var(--color-border)] rounded-[var(--radius-md)] text-[var(--color-text)] bg-[var(--color-surface)] font-mono text-sm resize-y`,disabled:t,required:!0})]})]}),i===`user_input`&&(0,m.jsxs)(`div`,{className:`space-y-4`,children:[(0,m.jsxs)(`div`,{className:`rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface)] p-4`,children:[(0,m.jsx)(`div`,{className:`text-sm text-[var(--color-text-muted)]`,children:r(`run.userInput.prompt`)}),(0,m.jsx)(`div`,{className:`font-medium text-[var(--color-text-heading)]`,children:S||r(`run.userInput.promptMissing`)})]}),(0,m.jsxs)(`div`,{children:[(0,m.jsx)(`label`,{htmlFor:`run-user-confirmation`,className:`block font-medium text-[var(--color-text-heading)] mb-2`,children:r(`run.userInput.confirmation`)}),(0,m.jsx)(`textarea`,{id:`run-user-confirmation`,value:C,onChange:e=>w(e.target.value),className:`w-full min-h-[6rem] px-4 py-3 border border-[var(--color-border)] rounded-[var(--radius-md)] text-[var(--color-text)] bg-[var(--color-surface)] resize-y`,disabled:t,required:!0})]})]}),i===`comment`&&(0,m.jsxs)(`div`,{className:`space-y-2`,children:[(0,m.jsxs)(`div`,{className:`text-sm text-[var(--color-text-muted)]`,children:[r(`run.comment.minLength`,{count:T}),` · `,r(`run.comment.count`,{count:E.length})]}),(0,m.jsxs)(`div`,{children:[(0,m.jsx)(`label`,{htmlFor:`run-comment-text`,className:`block font-medium text-[var(--color-text-heading)] mb-2`,children:r(`run.comment.text`)}),(0,m.jsx)(`textarea`,{id:`run-comment-text`,value:E,onChange:e=>D(e.target.value),className:`w-full min-h-[10rem] px-4 py-3 border border-[var(--color-border)] rounded-[var(--radius-md)] text-[var(--color-text)] bg-[var(--color-surface)] resize-y`,disabled:t,required:!0,"aria-invalid":E.trim().length>0&&E.trim().length<T})]})]}),(0,m.jsx)(`button`,{type:`submit`,disabled:t||!A,className:`mt-4 min-h-[44px] min-w-[44px] px-4 py-2 rounded-[var(--radius-md)] font-medium bg-[var(--color-primary)] text-white border-0 cursor-pointer disabled:opacity-60 disabled:cursor-not-allowed hover:bg-[var(--color-primary-hover)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,children:r(`run.submitStep`)})]})}function _({run:e,attestOutcome:t,setAttestOutcome:n,attestMessage:r,setAttestMessage:i,copyStatus:o,onCopy:s,onSubmitStep:c,onAttest:l,isNextPending:d,isBeginPending:f,isAttestPending:p}){let{t:h}=a();return(0,m.jsxs)(m.Fragment,{children:[e.status===`running`&&(0,m.jsx)(`div`,{className:`mb-4 flex items-center gap-2 text-sm text-[var(--color-text-muted)]`,role:`status`,"aria-live":`polite`,children:(0,m.jsx)(`span`,{className:`font-medium text-[var(--color-text-heading)]`,children:h(`run.stepperProgress`,{completed:e.history.length})})}),e.last_message&&(0,m.jsxs)(`div`,{className:`mb-4 p-4 rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface)]`,role:`status`,"aria-live":`polite`,children:[(0,m.jsx)(`div`,{className:`text-sm text-[var(--color-text-muted)]`,children:h(`run.serverMessage`)}),(0,m.jsx)(`div`,{className:`text-[var(--color-text)]`,children:e.last_message})]}),(0,m.jsxs)(`section`,{"aria-labelledby":`run-current-step`,className:`mb-6`,children:[(0,m.jsx)(`h2`,{id:`run-current-step`,className:`text-lg font-semibold text-[var(--color-text-heading)] mb-2`,children:h(`run.currentStep`)}),(0,m.jsx)(`div`,{className:`rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface-elevated)] p-4`,children:e.current_step?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)(`div`,{className:`text-sm text-[var(--color-text-muted)] mb-2`,children:[h(`run.stepUri`),`: `,(0,m.jsx)(`span`,{className:`font-mono break-all`,children:e.current_step.uri})]}),e.current_step.content?(0,m.jsx)(u,{content:e.current_step.content}):(0,m.jsx)(`p`,{className:`text-sm text-[var(--color-text-muted)] m-0`,children:h(`run.noStepContent`)})]}):(0,m.jsx)(`p`,{className:`text-sm text-[var(--color-text-muted)] m-0`,children:h(`run.noStepContent`)})})]}),(0,m.jsxs)(`section`,{"aria-labelledby":`run-challenge`,className:`mb-6`,children:[(0,m.jsx)(`h2`,{id:`run-challenge`,className:`text-lg font-semibold text-[var(--color-text-heading)] mb-2`,children:h(`run.challenge`)}),(0,m.jsxs)(`div`,{className:`rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface-elevated)] p-4`,children:[(0,m.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,m.jsxs)(`div`,{children:[(0,m.jsx)(`div`,{className:`text-sm text-[var(--color-text-muted)]`,children:h(`run.challengeType`)}),(0,m.jsx)(`div`,{className:`font-medium text-[var(--color-text-heading)]`,children:e.challenge.type})]}),(0,m.jsxs)(`details`,{className:`text-sm`,children:[(0,m.jsx)(`summary`,{className:`cursor-pointer text-[var(--color-primary)]`,children:h(`run.advanced`)}),(0,m.jsxs)(`div`,{className:`mt-2 space-y-1 text-[var(--color-text-muted)]`,children:[e.challenge.nonce&&(0,m.jsxs)(`div`,{children:[h(`run.nonce`),`: `,(0,m.jsx)(`span`,{className:`font-mono break-all`,children:e.challenge.nonce})]}),e.challenge.proof_hash&&(0,m.jsxs)(`div`,{children:[h(`run.proofHash`),`: `,(0,m.jsx)(`span`,{className:`font-mono break-all`,children:e.challenge.proof_hash})]}),e.previous_proof_hash&&(0,m.jsxs)(`div`,{children:[h(`run.previousProofHash`),`: `,(0,m.jsx)(`span`,{className:`font-mono break-all`,children:e.previous_proof_hash})]})]})]})]}),e.challenge.description&&(0,m.jsx)(`p`,{className:`text-sm text-[var(--color-text-muted)] mt-3`,children:e.challenge.description}),e.challenge.type===`shell`&&e.challenge.shell&&(e.challenge.shell.invocation_display||e.challenge.shell.cmd)&&(0,m.jsxs)(`div`,{className:`mt-4 rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface)] p-4 space-y-3`,children:[e.challenge.shell.invocation_display&&(0,m.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,m.jsxs)(`div`,{className:`min-w-0`,children:[(0,m.jsx)(`div`,{className:`text-sm text-[var(--color-text-muted)]`,children:h(`run.shell.invocation`)}),(0,m.jsx)(`div`,{className:`font-mono text-sm text-[var(--color-text)] break-all`,children:e.challenge.shell.invocation_display})]}),(0,m.jsx)(`button`,{type:`button`,onClick:()=>s(e.challenge.shell.invocation_display),className:`min-h-[44px] min-w-[44px] px-4 py-2 rounded-[var(--radius-md)] font-medium border border-[var(--color-border)] text-[var(--color-text)] bg-transparent flex-shrink-0 hover:bg-[var(--color-surface-elevated)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,children:h(`run.copy`)})]}),e.challenge.shell.cmd&&(0,m.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,m.jsxs)(`div`,{className:`min-w-0`,children:[(0,m.jsx)(`div`,{className:`text-sm text-[var(--color-text-muted)]`,children:h(`run.shell.command`)}),(0,m.jsx)(`div`,{className:`font-mono text-sm text-[var(--color-text)] break-all`,children:e.challenge.shell.cmd})]}),!e.challenge.shell.invocation_display&&(0,m.jsx)(`button`,{type:`button`,onClick:()=>s(e.challenge.shell.cmd),className:`min-h-[44px] min-w-[44px] px-4 py-2 rounded-[var(--radius-md)] font-medium border border-[var(--color-border)] text-[var(--color-text)] bg-transparent flex-shrink-0 hover:bg-[var(--color-surface-elevated)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,children:h(`run.copy`)})]}),o&&(0,m.jsx)(`div`,{className:`text-xs text-[var(--color-text-muted)]`,children:o})]})]})]}),e.status!==`completed`&&e.status!==`ready_to_attest`&&(0,m.jsxs)(`section`,{"aria-labelledby":`run-solution`,className:`mb-6`,children:[(0,m.jsx)(`h2`,{id:`run-solution`,className:`text-lg font-semibold text-[var(--color-text-heading)] mb-2`,children:h(`run.solution`)}),(0,m.jsx)(`div`,{className:`rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface-elevated)] p-4`,children:(0,m.jsx)(g,{challenge:e.challenge,disabled:d||f,onSubmit:c})})]}),e.status===`ready_to_attest`&&(0,m.jsxs)(`section`,{"aria-labelledby":`run-attest`,className:`mb-6`,children:[(0,m.jsx)(`h2`,{id:`run-attest`,className:`text-lg font-semibold text-[var(--color-text-heading)] mb-2`,children:h(`run.attest.title`)}),(0,m.jsxs)(`div`,{className:`rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface-elevated)] p-4`,children:[(0,m.jsx)(`div`,{className:`text-sm text-[var(--color-text-muted)] mb-4`,children:h(`run.attest.subtitle`)}),(0,m.jsxs)(`div`,{className:`flex flex-wrap gap-4 mb-4`,role:`radiogroup`,"aria-label":h(`run.attest.outcomeLabel`),children:[(0,m.jsxs)(`label`,{className:`inline-flex items-center gap-2 min-h-[44px]`,children:[(0,m.jsx)(`input`,{type:`radio`,name:`attest-outcome`,value:`success`,checked:t===`success`,onChange:()=>n(`success`)}),(0,m.jsx)(`span`,{className:`text-sm text-[var(--color-text)]`,children:h(`run.attest.success`)})]}),(0,m.jsxs)(`label`,{className:`inline-flex items-center gap-2 min-h-[44px]`,children:[(0,m.jsx)(`input`,{type:`radio`,name:`attest-outcome`,value:`failure`,checked:t===`failure`,onChange:()=>n(`failure`)}),(0,m.jsx)(`span`,{className:`text-sm text-[var(--color-text)]`,children:h(`run.attest.failure`)})]})]}),(0,m.jsxs)(`div`,{className:`mb-4`,children:[(0,m.jsx)(`label`,{htmlFor:`run-attest-message`,className:`block font-medium text-[var(--color-text-heading)] mb-2`,children:h(`run.attest.message`)}),(0,m.jsx)(`textarea`,{id:`run-attest-message`,value:r,onChange:e=>i(e.target.value),className:`w-full min-h-[8rem] px-4 py-3 border border-[var(--color-border)] rounded-[var(--radius-md)] text-[var(--color-text)] bg-[var(--color-surface)] resize-y focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`})]}),(0,m.jsx)(`button`,{type:`button`,onClick:l,disabled:p,className:`min-h-[44px] min-w-[44px] px-4 py-2 rounded-[var(--radius-md)] font-medium bg-[var(--color-primary)] text-white border-0 cursor-pointer disabled:opacity-60 disabled:cursor-not-allowed hover:bg-[var(--color-primary-hover)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,children:h(p?`run.attest.submitting`:`run.attest.submit`)})]})]}),e.history.length>0&&(0,m.jsxs)(`section`,{"aria-labelledby":`run-history`,className:`mb-6`,children:[(0,m.jsx)(`h2`,{id:`run-history`,className:`text-lg font-semibold text-[var(--color-text-heading)] mb-2`,children:h(`run.history`)}),(0,m.jsx)(`ul`,{className:`list-none p-0 m-0 space-y-2`,"aria-label":h(`run.historyLabel`),children:e.history.slice().reverse().map((e,t)=>(0,m.jsxs)(`li`,{className:`rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface-elevated)] p-4`,children:[(0,m.jsxs)(`div`,{className:`text-sm text-[var(--color-text-muted)]`,children:[new Date(e.submitted_at).toLocaleString(),` · `,e.challenge.type,` ·`,` `,(0,m.jsx)(`span`,{className:`font-mono break-all`,children:e.step.uri})]}),e.server_message&&(0,m.jsx)(`div`,{className:`text-sm text-[var(--color-text)] mt-1`,children:e.server_message})]},`${e.step.uri}:${t}`))})]}),e.status===`completed`&&(0,m.jsxs)(`div`,{className:`rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[#dcfce7] text-[#166534] p-4`,children:[(0,m.jsx)(`strong`,{className:`block`,children:h(`run.completed`)}),e.last_message&&(0,m.jsx)(`div`,{className:`text-sm mt-1`,children:e.last_message})]})]})}async function v(e){let t=await c(`/api/kairos_begin`,{method:`POST`,body:JSON.stringify({uri:e})});if(!t.ok){let e=await t.json().catch(()=>({}));throw Error(e.message??t.statusText)}return t.json()}function y(){return r({mutationFn:e=>v(e)})}async function b(e){let t=await c(`/api/kairos_next`,{method:`POST`,body:JSON.stringify(e)});if(!t.ok){let e=await t.json().catch(()=>({}));throw Error(e.message??t.statusText)}return t.json()}function x(){return r({mutationFn:e=>b(e)})}async function S(e){let t=await c(`/api/kairos_attest`,{method:`POST`,body:JSON.stringify(e)});if(!t.ok){let e=await t.json().catch(()=>({}));throw Error(e.message??t.statusText)}return t.json()}function C(){return r({mutationFn:e=>S(e)})}function w(e){if(e)return e.match(/kairos:\/\/mem\/[0-9a-fA-F-]{36}/)?.[0]}function T(){return new Date().toISOString()}function E(){let{t:e}=a(),{uri:r}=n(),[o]=i(),s=r?decodeURIComponent(r):void 0,{session:c}=f(o.get(`session`)),{upsert:u}=d(),h=y(),g=x(),v=C(),[b,S]=(0,p.useState)(null),[E,D]=(0,p.useState)(`success`),[O,k]=(0,p.useState)(``),[A,j]=(0,p.useState)(null);(0,p.useEffect)(()=>{c&&!b&&(S(c),D(`success`),k(``))},[c,b]);let M=e=>{S(e),u(e)},N=async()=>{if(s)try{let e=await h.mutateAsync(s),t=T(),n=`${s}:${t}`,r=e.next_action?.includes(`kairos_attest`)?`ready_to_attest`:`running`,i=w(e.next_action);M({id:n,protocol_uri:s,started_at:t,updated_at:t,status:r,current_step:e.current_step??null,challenge:e.challenge,next_action:e.next_action,last_message:e.message,previous_proof_hash:e.proof_hash,attest_uri:r===`ready_to_attest`?i:void 0,history:[]})}catch{S(null)}};return s?(0,m.jsxs)(`div`,{children:[(0,m.jsx)(`h1`,{className:`text-[var(--color-text-heading)] text-2xl font-semibold mb-1`,children:e(`run.title`)}),(0,m.jsxs)(`p`,{className:`text-sm text-[var(--color-text-muted)] mb-4`,children:[e(`run.protocolUri`),`:`,` `,(0,m.jsx)(`span`,{className:`font-mono break-all`,children:s})]}),(0,m.jsxs)(`div`,{className:`flex flex-wrap gap-2 mb-6`,children:[(0,m.jsx)(t,{to:`/protocols/${encodeURIComponent(s)}`,className:`min-h-[44px] min-w-[44px] inline-flex items-center justify-center px-4 py-2 rounded-[var(--radius-md)] font-medium border border-[var(--color-border)] text-[var(--color-text)] no-underline hover:bg-[var(--color-surface-elevated)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,children:e(`run.backToProtocol`)}),!b&&(0,m.jsx)(`button`,{type:`button`,onClick:N,disabled:h.isPending,className:`min-h-[44px] min-w-[44px] px-4 py-2 rounded-[var(--radius-md)] font-medium bg-[var(--color-primary)] text-white border-0 cursor-pointer disabled:opacity-60 disabled:cursor-not-allowed hover:bg-[var(--color-primary-hover)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,children:h.isPending?e(`run.starting`):e(`run.start`)})]}),(0,m.jsxs)(`div`,{className:`rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface-elevated)] p-4 mb-6`,children:[(0,m.jsx)(`strong`,{className:`block text-[var(--color-text-heading)] mb-1`,children:e(`run.safety.title`)}),(0,m.jsx)(`p`,{className:`text-sm text-[var(--color-text-muted)]`,children:e(`run.safety.copy`)})]}),h.isError&&(0,m.jsx)(l,{message:h.error instanceof Error?h.error.message:String(h.error),onRetry:()=>N(),showGoBack:!0}),b?.status===`error`&&b.last_message&&(0,m.jsx)(`div`,{className:`mb-6`,children:(0,m.jsx)(l,{message:b.last_message,onRetry:()=>N(),showGoBack:!0})}),b&&b.status!==`error`&&(0,m.jsx)(_,{run:b,attestOutcome:E,setAttestOutcome:D,attestMessage:O,setAttestMessage:k,copyStatus:A,onCopy:async t=>{j(null);try{await navigator.clipboard.writeText(t),j(e(`run.copied`)),setTimeout(()=>j(null),1500)}catch(e){j(e instanceof Error?e.message:String(e))}},onSubmitStep:async e=>{if(!b?.current_step)return;let t=b.challenge.nonce,n=b.previous_proof_hash??b.challenge.proof_hash,r={...e,...t?{nonce:t}:{},...n?{proof_hash:n}:{}};try{let e=await g.mutateAsync({uri:b.current_step.uri,solution:r}),t=T(),n=e.next_action?.includes(`kairos_attest`)||(e.message?.toLowerCase().includes(`call kairos_attest`)??!1),i=w(e.next_action)??b.attest_uri;M({...b,updated_at:t,status:n?`ready_to_attest`:`running`,current_step:e.current_step??null,challenge:e.challenge,next_action:e.next_action,last_message:e.message,previous_proof_hash:e.proof_hash??b.previous_proof_hash,attest_uri:n?i:void 0,history:[...b.history,{step:b.current_step,challenge:b.challenge,solution:r,submitted_at:t,proof_hash:e.proof_hash,server_message:e.message}]})}catch(e){M({...b,updated_at:T(),status:`error`,last_message:e instanceof Error?e.message:String(e)})}},onAttest:async()=>{if(!b)return;let t=b.attest_uri??b.current_step?.uri;if(t)try{let n=await v.mutateAsync({uri:t,outcome:E,message:O.trim()||e(`run.attest.defaultMessage`)});M({...b,updated_at:T(),status:`completed`,last_message:n.results[0]?.message??b.last_message})}catch(e){M({...b,updated_at:T(),status:`error`,last_message:e instanceof Error?e.message:String(e)})}},isNextPending:g.isPending,isBeginPending:h.isPending,isAttestPending:v.isPending})]}):(0,m.jsx)(l,{message:e(`run.missingUri`),showGoBack:!0})}export{E as RunGuidedPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,y as t}from"./vendor-
|
|
1
|
+
import{a as e,y as t}from"./vendor-CVpIjmrD.js";import{t as n}from"./react-BdWJx0XL.js";import"./tiptap-CzV8H9Mb.js";import{n as r}from"./useRunSession-CciNdgs6.js";var i=n();function a(){let{t:n}=t(),{sessions:a,remove:o}=r();return(0,i.jsxs)(`div`,{children:[(0,i.jsx)(`h1`,{className:`text-[var(--color-text-heading)] text-2xl font-semibold mb-1`,children:n(`runs.title`)}),(0,i.jsx)(`p`,{className:`text-sm text-[var(--color-text-muted)] mb-6`,children:n(`runs.subtitle`)}),a.length===0?(0,i.jsx)(`div`,{className:`rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface-elevated)] p-6`,children:(0,i.jsx)(`p`,{className:`text-[var(--color-text-muted)]`,children:n(`runs.empty`)})}):(0,i.jsx)(`ul`,{className:`list-none p-0 m-0 space-y-2`,"aria-label":n(`runs.listLabel`),children:a.map(t=>(0,i.jsxs)(`li`,{className:`rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface-elevated)] p-4 flex items-start justify-between gap-4`,children:[(0,i.jsxs)(`div`,{className:`min-w-0`,children:[(0,i.jsx)(`div`,{className:`font-medium text-[var(--color-text-heading)] truncate`,children:t.protocol_uri}),(0,i.jsxs)(`div`,{className:`text-sm text-[var(--color-text-muted)] mt-1`,children:[n(`runs.status`),`: `,t.status,` · `,n(`runs.updated`),`: `,new Date(t.updated_at).toLocaleString(),` · `,n(`runs.stepsDone`,{count:t.history.length})]}),t.last_message&&(0,i.jsx)(`div`,{className:`text-sm text-[var(--color-text-muted)] mt-1`,children:t.last_message})]}),(0,i.jsxs)(`div`,{className:`flex flex-wrap gap-2 flex-shrink-0`,children:[(0,i.jsx)(e,{to:`/protocols/${encodeURIComponent(t.protocol_uri)}/run?session=${encodeURIComponent(t.id)}`,className:`min-h-[44px] min-w-[44px] inline-flex items-center justify-center px-4 py-2 rounded-[var(--radius-md)] font-medium bg-[var(--color-primary)] text-white no-underline hover:bg-[var(--color-primary-hover)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,children:n(`runs.resume`)}),(0,i.jsx)(`button`,{type:`button`,onClick:()=>o(t.id),className:`min-h-[44px] min-w-[44px] px-4 py-2 rounded-[var(--radius-md)] font-medium border border-[var(--color-border)] text-[var(--color-text)] bg-transparent hover:bg-[var(--color-surface-elevated)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,children:n(`runs.remove`)})]})]},t.id))})]})}export{a as RunsPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{a as t,f as n,y as r}from"./vendor-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{a as t,f as n,y as r}from"./vendor-CVpIjmrD.js";import{i,t as a}from"./react-BdWJx0XL.js";import"./tiptap-CzV8H9Mb.js";import{i as o,n as s}from"./useProtocol-C3ClZHlN.js";var c=e(i(),1),l=a();function u(){let{t:e}=r(),{uri:i}=n(),{data:a,isLoading:u,isError:d,error:f}=o(i?decodeURIComponent(i):void 0,!0),[p,m]=(0,c.useState)(``),[h,g]=(0,c.useState)(``),[_,v]=(0,c.useState)(``),[y,b]=(0,c.useState)(!0);if(u&&!a)return(0,l.jsx)(`p`,{className:`text-[var(--color-text-muted)]`,children:e(`protocol.loading`)});if(d||!a)return(0,l.jsxs)(`div`,{role:`alert`,className:`rounded-[var(--radius-md)] bg-[var(--color-error-bg)] p-4 text-[var(--color-error)]`,children:[f instanceof Error?f.message:e(`protocol.notFound`),(0,l.jsx)(t,{to:`/`,className:`mt-2 block text-[var(--color-primary)] underline hover:no-underline focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,children:e(`notFound.goHome`)})]});let{title:x}=s(a.markdown_doc),S=p.trim()||x,C=S.replace(/[^a-zA-Z0-9]+/g,`-`).replace(/^-|-$/g,``)||`skill`;return(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`h1`,{className:`mb-1 text-2xl font-semibold text-[var(--color-text-heading)]`,children:e(`skill.title`)}),(0,l.jsx)(`p`,{className:`mb-6 text-sm text-[var(--color-text-muted)]`,children:e(`skill.subtitle`)}),(0,l.jsxs)(`div`,{className:`mb-6 grid gap-4 xl:grid-cols-[1.3fr_1fr]`,children:[(0,l.jsxs)(`div`,{className:`space-y-4`,children:[(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`label`,{htmlFor:`skill-name`,className:`mb-2 block font-medium text-[var(--color-text-heading)]`,children:e(`skill.skillName`)}),(0,l.jsx)(`input`,{id:`skill-name`,type:`text`,value:p,onChange:e=>m(e.target.value),placeholder:x,className:`min-h-[44px] w-full rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface)] px-4 py-3 text-sm text-[var(--color-text)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`})]}),(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`label`,{htmlFor:`skill-desc`,className:`mb-2 block font-medium text-[var(--color-text-heading)]`,children:e(`skill.description`)}),(0,l.jsx)(`textarea`,{id:`skill-desc`,value:h,onChange:e=>g(e.target.value),placeholder:x,rows:3,className:`w-full rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface)] px-4 py-3 text-sm text-[var(--color-text)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`})]}),(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`label`,{htmlFor:`skill-when`,className:`mb-2 block font-medium text-[var(--color-text-heading)]`,children:e(`skill.whenToUse`)}),(0,l.jsx)(`textarea`,{id:`skill-when`,value:_,onChange:e=>v(e.target.value),placeholder:`e.g. deploy and test, run tests before release`,rows:2,className:`w-full rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface)] px-4 py-3 text-sm text-[var(--color-text)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`})]}),(0,l.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,l.jsx)(`input`,{id:`skill-refs`,type:`checkbox`,checked:y,onChange:e=>b(e.target.checked),className:`h-4 w-4 rounded border-[var(--color-border)] text-[var(--color-primary)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)]`}),(0,l.jsx)(`label`,{htmlFor:`skill-refs`,className:`text-sm text-[var(--color-text)]`,children:e(`skill.includeReferences`)})]}),(0,l.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,l.jsx)(`button`,{type:`button`,onClick:()=>{let e=`# ${S}\n\n${h.trim()||x}\n\n## When to use it\n\n${_.trim()||`Use when this protocol applies.`}\n\n## Protocol\n\n${a.markdown_doc}`,t=new Blob([e],{type:`text/markdown;charset=utf-8`}),n=URL.createObjectURL(t),r=document.createElement(`a`);r.href=n,r.download=`${C}-skill.md`,r.click(),URL.revokeObjectURL(n)},className:`min-h-[44px] min-w-[44px] inline-flex items-center justify-center rounded-[var(--radius-md)] bg-[var(--color-primary)] px-4 py-2 font-medium text-white hover:bg-[var(--color-primary-hover)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,children:e(`skill.downloadAsSkill`)}),(0,l.jsx)(t,{to:`/protocols/${encodeURIComponent(a.uri)}`,className:`min-h-[44px] min-w-[44px] inline-flex items-center justify-center rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface)] px-4 py-2 font-medium text-[var(--color-text)] no-underline hover:bg-[var(--color-surface-elevated)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,children:e(`skill.backToProtocol`)})]})]}),(0,l.jsxs)(`div`,{className:`rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface-elevated)] p-4`,children:[(0,l.jsx)(`div`,{className:`text-sm font-medium text-[var(--color-text-heading)]`,children:`Bundle preview`}),(0,l.jsxs)(`p`,{className:`mt-2 text-sm text-[var(--color-text-muted)]`,children:[C,`-skill.md (and optionally references/) will be included in the download. Full ZIP packaging can be added later.`]})]})]})]})}export{u as SkillBundlePage};
|