@debian777/kairos-mcp 4.0.0 → 4.0.1
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/dist/.tsbuildinfo +1 -1
- package/dist/constants/builtin-search-meta.d.ts +4 -0
- package/dist/constants/builtin-search-meta.d.ts.map +1 -1
- package/dist/constants/builtin-search-meta.js +20 -0
- package/dist/constants/builtin-search-meta.js.map +1 -1
- package/dist/embed-docs/mem/00000000-0000-0000-0000-000000002001.md +11 -6
- package/dist/embed-docs/mem/00000000-0000-0000-0000-000000002002.md +1 -1
- package/dist/embed-docs/mem/00000000-0000-0000-0000-000000002003.md +2 -2
- package/dist/embed-docs/mem/00000000-0000-0000-0000-000000002004.md +5 -5
- package/dist/embed-docs/mem/00000000-0000-0000-0000-000000002005.md +2 -2
- package/dist/mcp-apps/forward-widget-inline-script.js +1 -1
- package/dist/resources/embedded-mcp-resources.js +8 -8
- package/dist/resources/embedded-mcp-resources.js.map +1 -1
- package/dist/services/memory/activation-pattern-payload.d.ts.map +1 -1
- package/dist/services/memory/activation-pattern-payload.js +3 -0
- package/dist/services/memory/activation-pattern-payload.js.map +1 -1
- package/dist/services/memory/adapter-builder.d.ts.map +1 -1
- package/dist/services/memory/adapter-builder.js +16 -1
- package/dist/services/memory/adapter-builder.js.map +1 -1
- package/dist/services/memory/qdrant-point-to-memory.d.ts.map +1 -1
- package/dist/services/memory/qdrant-point-to-memory.js +3 -0
- package/dist/services/memory/qdrant-point-to-memory.js.map +1 -1
- package/dist/services/memory/store-adapter-default-handler.d.ts.map +1 -1
- package/dist/services/memory/store-adapter-default-handler.js +2 -1
- package/dist/services/memory/store-adapter-default-handler.js.map +1 -1
- package/dist/services/memory/store-adapter-header-handler.d.ts.map +1 -1
- package/dist/services/memory/store-adapter-header-handler.js +2 -1
- package/dist/services/memory/store-adapter-header-handler.js.map +1 -1
- package/dist/services/qdrant/memory-retrieval.d.ts.map +1 -1
- package/dist/services/qdrant/memory-retrieval.js +3 -0
- package/dist/services/qdrant/memory-retrieval.js.map +1 -1
- package/dist/tools/activate.d.ts.map +1 -1
- package/dist/tools/activate.js +3 -4
- package/dist/tools/activate.js.map +1 -1
- package/dist/tools/dump.d.ts.map +1 -1
- package/dist/tools/dump.js +19 -0
- package/dist/tools/dump.js.map +1 -1
- package/dist/tools/forward_schema.d.ts +40 -4
- package/dist/tools/forward_schema.d.ts.map +1 -1
- package/dist/tools/forward_schema.js +66 -4
- package/dist/tools/forward_schema.js.map +1 -1
- package/dist/tools/mcp-tool-input-teaching.d.ts.map +1 -1
- package/dist/tools/mcp-tool-input-teaching.js +11 -3
- package/dist/tools/mcp-tool-input-teaching.js.map +1 -1
- package/dist/tools/search.d.ts.map +1 -1
- package/dist/tools/search.js +2 -2
- package/dist/tools/search.js.map +1 -1
- package/dist/tools/search_output.d.ts.map +1 -1
- package/dist/tools/search_output.js +13 -9
- package/dist/tools/search_output.js.map +1 -1
- package/dist/tools/tune-execute.d.ts +4 -0
- package/dist/tools/tune-execute.d.ts.map +1 -0
- package/dist/tools/tune-execute.js +260 -0
- package/dist/tools/tune-execute.js.map +1 -0
- package/dist/tools/tune.d.ts +1 -3
- package/dist/tools/tune.d.ts.map +1 -1
- package/dist/tools/tune.js +8 -125
- package/dist/tools/tune.js.map +1 -1
- package/dist/types/memory.d.ts +1 -0
- package/dist/types/memory.d.ts.map +1 -1
- package/dist/ui/assets/{AccountPage-0lWmC1Yi.js → AccountPage-Bin0OWw2.js} +1 -1
- package/dist/ui/assets/{ErrorAlert-CEK6Hts_.js → ErrorAlert-xId7zQnR.js} +1 -1
- package/dist/ui/assets/{HomePage-DHaSrH_k.js → HomePage-U88uxI09.js} +1 -1
- package/dist/ui/assets/{KairosPage-D3vTZLht.js → KairosPage-B8Bgfpqu.js} +1 -1
- package/dist/ui/assets/{NotFoundPage-DTGI5qLn.js → NotFoundPage-CSfAllV_.js} +1 -1
- package/dist/ui/assets/{ProtocolDetailPage-CbEkCdWc.js → ProtocolDetailPage-DkzLwH8_.js} +1 -1
- package/dist/ui/assets/{ProtocolEditPage-DBf4NQGA.js → ProtocolEditPage-DP9Sk1Fh.js} +1 -1
- package/dist/ui/assets/{RichTextEditor-MeDG49aR.js → RichTextEditor-CpNxz2Fi.js} +1 -1
- package/dist/ui/assets/{RunGuidedPage-QZ-FTCqP.js → RunGuidedPage-BVCMdEbN.js} +1 -1
- package/dist/ui/assets/{RunsPage-D8QLy4VF.js → RunsPage-1wzJYbQQ.js} +1 -1
- package/dist/ui/assets/{SkillBundlePage-CiQ_FPd0.js → SkillBundlePage-Bqzg9lj8.js} +1 -1
- package/dist/ui/assets/{SpaceSelect-D8dsuZ8v.js → SpaceSelect-C_bHSva4.js} +1 -1
- package/dist/ui/assets/{StepFlowGraph-DjRbEg_P.js → StepFlowGraph-BEV34aU4.js} +1 -1
- package/dist/ui/assets/{index-B0SMMGlX.js → index-BhOTXMY1.js} +3 -3
- package/dist/ui/assets/{tiptap-DcbFCWb9.js → tiptap-VSnrfrI4.js} +2 -2
- package/dist/ui/assets/{useProtocol-CN2rdtdQ.js → useProtocol-DMe_p3jp.js} +1 -1
- package/dist/ui/assets/vendor-DLefRYp3.js +33 -0
- package/dist/ui/index.html +3 -3
- package/package.json +3 -3
- package/dist/ui/assets/vendor-CwKUmZK2.js +0 -33
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tune-execute.js","sourceRoot":"","sources":["../../src/tools/tune-execute.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,0BAA0B,EAAE,MAAM,4BAA4B,CAAC;AACxE,OAAO,EAAE,2BAA2B,EAAE,MAAM,iCAAiC,CAAC;AAC9E,OAAO,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAC;AACzE,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAC1D,OAAO,EAAE,wBAAwB,EAAE,MAAM,uCAAuC,CAAC;AACjF,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC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AAC,CAAC,CAAC;YACvB,IAAI,CAAC,GAAG,IAAI,GAAG,CAAC,MAAM,KAAK,SAAS;gBAAE,SAAS;YAC/C,IAAI,CAAC;gBACH,MAAM,4BAA4B,CAAC,aAAa,EAAE,WAAW,EAAE,aAAa,CAAC,CAAC;gBAC9E,GAAG,CAAC,OAAO,GAAG,GAAG,GAAG,CAAC,OAAO,8BAA8B,CAAC;YAC7D,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,MAAM,YAAY,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;gBAC5E,OAAO,CAAC,CAAC,CAAC,GAAG;oBACX,GAAG,EAAE,GAAG,CAAC,GAAG;oBACZ,MAAM,EAAE,OAAO;oBACf,OAAO,EAAE,kDAAkD,YAAY,EAAE;iBAC1E,CAAC;gBACF,YAAY,EAAE,CAAC;gBACf,aAAa,EAAE,CAAC;YAClB,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO;QACL,OAAO;QACP,aAAa;QACb,YAAY;KACb,CAAC;AACJ,CAAC"}
|
package/dist/tools/tune.d.ts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
import { type TuneInput, type TuneOutput } from './tune_schema.js';
|
|
3
|
-
export declare function executeTune(qdrantService: QdrantService, input: TuneInput): Promise<TuneOutput>;
|
|
1
|
+
export { executeTune } from './tune-execute.js';
|
|
4
2
|
export declare function registerTuneTool(server: any, toolName?: string): void;
|
|
5
3
|
//# sourceMappingURL=tune.d.ts.map
|
package/dist/tools/tune.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tune.d.ts","sourceRoot":"","sources":["../../src/tools/tune.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"tune.d.ts","sourceRoot":"","sources":["../../src/tools/tune.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,GAAG,EAAE,QAAQ,SAAS,QA6C9D"}
|
package/dist/tools/tune.js
CHANGED
|
@@ -1,134 +1,13 @@
|
|
|
1
|
-
import { qdrantService as qdrantServiceSingleton } from '../services/qdrant/index.js';
|
|
2
1
|
import { getToolDoc } from '../resources/embedded-mcp-resources.js';
|
|
3
|
-
import { getTenantId
|
|
4
|
-
import { resolveSpaceParamForContext } from '../utils/resolve-space-param.js';
|
|
5
|
-
import { executeUpdate } from './update.js';
|
|
2
|
+
import { getTenantId } from '../utils/tenant-context.js';
|
|
6
3
|
import { tuneInputSchema, tuneOutputSchema } from './tune_schema.js';
|
|
7
|
-
import { parseKairosUri, buildLayerUri } from './kairos-uri.js';
|
|
8
4
|
import { mcpToolCalls, mcpToolDuration, mcpToolErrors, mcpToolInputSize, mcpToolOutputSize } from '../services/metrics/mcp-metrics.js';
|
|
9
|
-
import { buildTuneResultMessage } from './tune-messages.js';
|
|
10
5
|
import { mcpLooseToolInput } from './mcp-loose-input-schema.js';
|
|
11
6
|
import { mcpToolInputValidationErrorResult } from './mcp-tool-input-teaching.js';
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
if (parsed.kind === 'layer') {
|
|
15
|
-
return `kairos://mem/${parsed.id}`;
|
|
16
|
-
}
|
|
17
|
-
const layers = await qdrantService.getAdapterLayers(parsed.id);
|
|
18
|
-
const head = layers[0]?.uuid ?? parsed.id;
|
|
19
|
-
return `kairos://mem/${head}`;
|
|
20
|
-
}
|
|
21
|
-
async function collectLayerMemoryUuidsForTune(qdrantService, uri) {
|
|
22
|
-
const parsed = parseKairosUri(uri);
|
|
23
|
-
if (parsed.kind === 'layer') {
|
|
24
|
-
return [parsed.id];
|
|
25
|
-
}
|
|
26
|
-
const layers = await qdrantService.getAdapterLayers(parsed.id);
|
|
27
|
-
return layers.map((l) => l.uuid);
|
|
28
|
-
}
|
|
29
|
-
async function reassignAdapterLayersToSpace(qdrantService, originalUri, targetSpaceId) {
|
|
30
|
-
const layerUuids = await collectLayerMemoryUuidsForTune(qdrantService, originalUri);
|
|
31
|
-
for (const uuid of layerUuids) {
|
|
32
|
-
await qdrantService.updateMemory(uuid, { space_id: targetSpaceId });
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
export async function executeTune(qdrantService, input) {
|
|
36
|
-
const ctx = getSpaceContextFromStorage();
|
|
37
|
-
const rawSpace = typeof input.space === 'string' ? input.space.trim() : '';
|
|
38
|
-
let targetSpaceId;
|
|
39
|
-
if (rawSpace.length > 0) {
|
|
40
|
-
const r = resolveSpaceParamForContext(ctx, rawSpace);
|
|
41
|
-
if (!r.ok) {
|
|
42
|
-
throw new Error(r.message);
|
|
43
|
-
}
|
|
44
|
-
targetSpaceId = r.spaceId;
|
|
45
|
-
if (!ctx.allowedSpaceIds.includes(targetSpaceId)) {
|
|
46
|
-
throw new Error('Target space is not in your allowed spaces');
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
const hasMarkdown = Array.isArray(input.markdown_doc) &&
|
|
50
|
-
input.markdown_doc.some((s) => typeof s === 'string' && s.trim().length > 0);
|
|
51
|
-
const hasUpdates = input.updates && Object.keys(input.updates).length > 0;
|
|
52
|
-
const hasContent = Boolean(hasMarkdown || hasUpdates);
|
|
53
|
-
if (!hasContent && !targetSpaceId) {
|
|
54
|
-
throw new Error('Provide markdown_doc, updates, or space');
|
|
55
|
-
}
|
|
56
|
-
const normalizedUris = await Promise.all(input.uris.map((uri) => normalizeTuneUri(qdrantService, uri)));
|
|
57
|
-
if (!hasContent && targetSpaceId) {
|
|
58
|
-
const results = [];
|
|
59
|
-
let total_updated = 0;
|
|
60
|
-
let total_failed = 0;
|
|
61
|
-
for (const originalUri of input.uris) {
|
|
62
|
-
try {
|
|
63
|
-
const layerUuids = await collectLayerMemoryUuidsForTune(qdrantService, originalUri);
|
|
64
|
-
for (const uuid of layerUuids) {
|
|
65
|
-
await qdrantService.updateMemory(uuid, { space_id: targetSpaceId });
|
|
66
|
-
}
|
|
67
|
-
const head = layerUuids[0];
|
|
68
|
-
results.push({
|
|
69
|
-
uri: head ? buildLayerUri(head) : originalUri,
|
|
70
|
-
status: 'updated',
|
|
71
|
-
message: 'Adapter layers reassigned to target space'
|
|
72
|
-
});
|
|
73
|
-
total_updated++;
|
|
74
|
-
}
|
|
75
|
-
catch (error) {
|
|
76
|
-
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
77
|
-
results.push({
|
|
78
|
-
uri: originalUri,
|
|
79
|
-
status: 'error',
|
|
80
|
-
message: `Space move failed: ${errorMessage}`
|
|
81
|
-
});
|
|
82
|
-
total_failed++;
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
return { results, total_updated, total_failed };
|
|
86
|
-
}
|
|
87
|
-
const updateResult = await executeUpdate(qdrantService, {
|
|
88
|
-
uris: normalizedUris,
|
|
89
|
-
markdown_doc: input.markdown_doc,
|
|
90
|
-
updates: input.updates
|
|
91
|
-
});
|
|
92
|
-
const results = updateResult.results.map((entry) => {
|
|
93
|
-
const layerUri = buildLayerUri(entry.uri.split('/').pop() ?? '');
|
|
94
|
-
return {
|
|
95
|
-
uri: layerUri,
|
|
96
|
-
status: entry.status,
|
|
97
|
-
message: buildTuneResultMessage(entry, layerUri)
|
|
98
|
-
};
|
|
99
|
-
});
|
|
100
|
-
let total_updated = updateResult.total_updated;
|
|
101
|
-
let total_failed = updateResult.total_failed;
|
|
102
|
-
if (targetSpaceId) {
|
|
103
|
-
for (let i = 0; i < input.uris.length; i++) {
|
|
104
|
-
const originalUri = input.uris[i];
|
|
105
|
-
const row = results[i];
|
|
106
|
-
if (!row || row.status !== 'updated')
|
|
107
|
-
continue;
|
|
108
|
-
try {
|
|
109
|
-
await reassignAdapterLayersToSpace(qdrantService, originalUri, targetSpaceId);
|
|
110
|
-
row.message = `${row.message} Reassigned to target space.`;
|
|
111
|
-
}
|
|
112
|
-
catch (error) {
|
|
113
|
-
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
114
|
-
results[i] = {
|
|
115
|
-
uri: row.uri,
|
|
116
|
-
status: 'error',
|
|
117
|
-
message: `Content updated but space reassignment failed: ${errorMessage}`
|
|
118
|
-
};
|
|
119
|
-
total_failed++;
|
|
120
|
-
total_updated--;
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
return {
|
|
125
|
-
results,
|
|
126
|
-
total_updated,
|
|
127
|
-
total_failed
|
|
128
|
-
};
|
|
129
|
-
}
|
|
7
|
+
import { executeTune } from './tune-execute.js';
|
|
8
|
+
export { executeTune } from './tune-execute.js';
|
|
130
9
|
export function registerTuneTool(server, toolName = 'tune') {
|
|
131
|
-
|
|
10
|
+
let qdrantService = null;
|
|
132
11
|
server.registerTool(toolName, {
|
|
133
12
|
title: 'Update adapter content',
|
|
134
13
|
description: getToolDoc('tune') || 'Update adapter layer content.',
|
|
@@ -147,6 +26,10 @@ export function registerTuneTool(server, toolName = 'tune') {
|
|
|
147
26
|
}
|
|
148
27
|
const input = parsedInput.data;
|
|
149
28
|
try {
|
|
29
|
+
if (!qdrantService) {
|
|
30
|
+
const qdrantModule = await import('../services/qdrant/index.js');
|
|
31
|
+
qdrantService = qdrantModule.qdrantService;
|
|
32
|
+
}
|
|
150
33
|
const result = await executeTune(qdrantService, input);
|
|
151
34
|
mcpToolCalls.inc({ tool: toolName, status: 'success', tenant_id: tenantId });
|
|
152
35
|
mcpToolOutputSize.observe({ tool: toolName, tenant_id: tenantId }, JSON.stringify(result).length);
|
package/dist/tools/tune.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tune.js","sourceRoot":"","sources":["../../src/tools/tune.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"tune.js","sourceRoot":"","sources":["../../src/tools/tune.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,wCAAwC,C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AC;gBAClE,iBAAiB,EAAE,MAAM;aAC1B,CAAC;QACJ,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,YAAY,CAAC,GAAG,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,CAAC,CAAC;YAC3E,aAAa,CAAC,GAAG,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,CAAC,CAAC;YAC5E,KAAK,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,CAAC,CAAC;YAChE,MAAM,KAAK,CAAC;QACd,CAAC;IACH,CAAC,CACF,CAAC;AACJ,CAAC"}
|
package/dist/types/memory.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"memory.d.ts","sourceRoot":"","sources":["../../src/types/memory.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,mBAAmB,CAAC,EAAE,MAAM,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"memory.d.ts","sourceRoot":"","sources":["../../src/types/memory.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,mBAAmB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC/B,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAA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;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,2EAA2E;IAC3E,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,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,OAAO,CAAC,EAAE,WAAW,CAAC;IACtB,kBAAkB,CAAC,EAAE,2BAA2B,CAAC;CAClD;AAGD,MAAM,MAAM,eAAe,GAAG,OAAO,CAAC,qBAAqB,EAAE,QAAQ,CAAC,CAAC;AACvE,MAAM,MAAM,qBAAqB,GAAG,2BAA2B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{g as e,y as t}from"./vendor-
|
|
1
|
+
import{g as e,y as t}from"./vendor-DLefRYp3.js";import{t as n}from"./react-BdWJx0XL.js";import{n as r,r as i,t as a}from"./index-BhOTXMY1.js";import{t as o}from"./api-D88c6lbH.js";async function s(){let e=await o(`/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 c(){return e({queryKey:[`me`],queryFn:s,retry:!1})}var l=n(),u={light:`account.themeOptionLight`,dark:`account.themeOptionDark`};function d(e){if(e.name&&e.name.trim().length>0)return e.name;let t=[e.given_name,e.family_name].filter(e=>typeof e==`string`&&e.trim().length>0);return t.length>0?t.join(` `):e.preferred_username&&e.preferred_username.length>0?e.preferred_username:e.sub}function f(){let{t:e}=t(),{data:n,isLoading:o,isError:s}=c(),{preference:f,setPreference:p}=i();return o?(0,l.jsx)(`p`,{className:`text-[var(--color-text-muted)]`,children:e(`account.loading`)}):s||!n?(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`h1`,{className:`text-[var(--color-text-heading)] text-2xl font-semibold mb-4`,children:e(`account.title`)}),(0,l.jsx)(`p`,{className:`text-[var(--color-text-muted)]`,children:e(`account.notSignedIn`)}),(0,l.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,l.jsxs)(`div`,{children:[(0,l.jsx)(`h1`,{className:`text-[var(--color-text-heading)] text-2xl font-semibold mb-6`,children:e(`account.title`)}),(0,l.jsx)(`p`,{className:`text-[var(--color-text-muted)] mb-6`,children:e(`account.intro`)}),(0,l.jsxs)(`div`,{className:`rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface-elevated)] p-6`,children:[(0,l.jsxs)(`div`,{className:`mb-6 rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface)] p-4`,children:[(0,l.jsx)(`h2`,{className:`mb-1 text-base font-semibold text-[var(--color-text-heading)]`,children:e(`account.themeTitle`)}),(0,l.jsx)(`p`,{className:`mb-3 text-sm text-[var(--color-text-muted)]`,children:e(`account.themeDescription`)}),(0,l.jsx)(`label`,{htmlFor:`account-theme-preference`,className:`sr-only`,children:e(`account.themePreferenceLabel`)}),(0,l.jsxs)(`select`,{id:`account-theme-preference`,value:f,onChange:e=>{let t=e.target.value;r(t)&&p(t)},className:`min-h-[44px] w-full max-w-xs rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface)] px-3 py-2 text-[var(--color-text)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,children:[(0,l.jsx)(`option`,{value:`system`,children:e(`account.themeOptionSystem`)}),a.map(t=>(0,l.jsx)(`option`,{value:t,children:e(u[t])},t))]})]}),(0,l.jsxs)(`div`,{className:`mb-4`,children:[(0,l.jsx)(`span`,{className:`block text-xs uppercase tracking-wider text-[var(--color-text-muted)] mb-1`,children:e(`account.name`)}),(0,l.jsx)(`span`,{className:`text-[var(--color-text-heading)]`,children:d(n)})]}),n.preferred_username&&n.preferred_username!==d(n)&&(0,l.jsxs)(`div`,{className:`mb-4`,children:[(0,l.jsx)(`span`,{className:`block text-xs uppercase tracking-wider text-[var(--color-text-muted)] mb-1`,children:e(`account.username`)}),(0,l.jsx)(`span`,{className:`text-[var(--color-text-heading)]`,children:n.preferred_username})]}),n.email&&(0,l.jsxs)(`div`,{className:`mb-4`,children:[(0,l.jsx)(`span`,{className:`block text-xs uppercase tracking-wider text-[var(--color-text-muted)] mb-1`,children:e(`account.email`)}),(0,l.jsxs)(`span`,{className:`text-[var(--color-text-heading)]`,children:[n.email,n.email_verified===!0?` (${e(`account.emailVerified`)})`:``]})]}),(0,l.jsxs)(`div`,{className:`mb-4`,children:[(0,l.jsx)(`span`,{className:`block text-xs uppercase tracking-wider text-[var(--color-text-muted)] mb-1`,children:e(`account.accountType`)}),(0,l.jsx)(`span`,{className:`text-[var(--color-text-heading)]`,children:n.account_label})]}),(0,l.jsxs)(`div`,{className:`mb-4`,children:[(0,l.jsx)(`span`,{className:`block text-xs uppercase tracking-wider text-[var(--color-text-muted)] mb-1`,children:e(`account.realm`)}),(0,l.jsx)(`span`,{className:`text-[var(--color-text-heading)]`,children:n.realm})]}),n.identity_provider&&(0,l.jsxs)(`div`,{className:`mb-4`,children:[(0,l.jsx)(`span`,{className:`block text-xs uppercase tracking-wider text-[var(--color-text-muted)] mb-1`,children:e(`account.identityProvider`)}),(0,l.jsx)(`span`,{className:`text-[var(--color-text-heading)]`,children:n.identity_provider})]}),n.groups.length>0&&(0,l.jsxs)(`div`,{className:`mb-4`,children:[(0,l.jsx)(`span`,{className:`block text-xs uppercase tracking-wider text-[var(--color-text-muted)] mb-1`,children:e(`account.groups`)}),(0,l.jsx)(`ul`,{className:`list-disc list-inside text-[var(--color-text-heading)] space-y-1`,children:n.groups.map(e=>(0,l.jsx)(`li`,{children:e},e))})]}),(0,l.jsx)(`div`,{className:`mt-6 flex gap-2 flex-wrap`,children:(0,l.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{f as AccountPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,y as t}from"./vendor-
|
|
1
|
+
import{a as e,y as t}from"./vendor-DLefRYp3.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-DLefRYp3.js";import{t as r}from"./react-BdWJx0XL.js";import{n as i,r as a}from"./SpaceSelect-C_bHSva4.js";import{t as o}from"./SurfaceCard-BBbNWQYu.js";var s=r();function c(){let{t:r}=n(),c=t(),{data:l,isLoading:u,isError:d}=a(),f=e=>{e.preventDefault();let t=e.currentTarget.querySelector(`input[name="q"]`)?.value?.trim()??``;c(t?`/kairos?q=${encodeURIComponent(t)}`:`/kairos`)},p=l?.spaces??[],m=u||d||p.length===0;return(0,s.jsxs)(`div`,{children:[(0,s.jsx)(`h1`,{className:`text-[var(--color-text-heading)] text-2xl font-semibold mb-1`,children:r(`home.title`)}),(0,s.jsx)(`p`,{className:`text-sm text-[var(--color-text-muted)] mb-6`,children:r(`home.tagline`)}),(0,s.jsx)(o,{title:r(`home.findCardTitle`),subtitle:r(`home.findCardSubtitle`),className:`mb-6`,children:(0,s.jsxs)(`form`,{onSubmit:f,className:`grid gap-3 md:grid-cols-[1fr_auto] md:items-end`,"aria-label":r(`home.searchLabel`),children:[(0,s.jsxs)(`div`,{children:[(0,s.jsx)(`label`,{htmlFor:`home-search-query`,className:`block font-medium text-[var(--color-text-heading)] mb-2`,children:r(`home.searchLabel`)}),(0,s.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,s.jsx)(`p`,{id:`home-search-hint`,className:`text-sm text-[var(--color-text-muted)] mt-2`,children:r(`home.searchHint`)})]}),(0,s.jsxs)(`div`,{className:`flex flex-wrap gap-2 md:flex-col md:items-stretch`,children:[(0,s.jsx)(`button`,{type:`submit`,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 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:r(`kairos.search`)}),(0,s.jsx)(e,{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)] bg-[var(--color-surface)] 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:r(`home.goToBrowse`)})]})]})}),(0,s.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-3 mb-6`,children:[(0,s.jsx)(o,{title:r(`home.cardBrowseTitle`),subtitle:r(`home.cardBrowseSubtitle`),children:(0,s.jsx)(e,{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 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:r(`home.cardBrowseCta`)})}),(0,s.jsx)(o,{title:r(`home.cardCreateTitle`),subtitle:r(`home.cardCreateSubtitle`),children:(0,s.jsx)(e,{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)] bg-[var(--color-surface)] 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:r(`home.cardCreateCta`)})}),(0,s.jsx)(o,{title:r(`home.cardRunsTitle`),subtitle:r(`home.cardRunsSubtitle`),children:(0,s.jsx)(e,{to:`/runs`,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)] bg-[var(--color-surface)] 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:r(`home.cardRunsCta`)})})]}),(0,s.jsxs)(`section`,{"aria-labelledby":`home-stats-heading`,children:[(0,s.jsx)(`h2`,{id:`home-stats-heading`,className:`text-lg font-semibold text-[var(--color-text-heading)] mb-2`,children:r(`home.spacesHeading`)}),(0,s.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2 lg:grid-cols-3`,"aria-label":r(`home.statsLabel`),children:[m&&p.length===0?(0,s.jsxs)(`div`,{className:`rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface-elevated)] p-4`,children:[(0,s.jsx)(`span`,{className:`text-2xl font-semibold text-[var(--color-text-heading)]`,children:`—`}),(0,s.jsx)(`span`,{className:`block text-xs uppercase tracking-wide text-[var(--color-text-muted)] mt-1`,children:r(`home.stats.spacesLabel`)}),(0,s.jsx)(`span`,{className:`block text-sm text-[var(--color-text-muted)] mt-2`,children:r(`home.stats.protocolCount`,{count:0})})]}):null,p.map(e=>(0,s.jsxs)(`div`,{className:`rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface-elevated)] p-4`,children:[(0,s.jsx)(`div`,{className:`text-2xl font-semibold text-[var(--color-text-heading)]`,children:u?`—`:e.adapter_count}),(0,s.jsxs)(`div`,{className:`mt-1 flex flex-wrap items-center gap-2`,children:[(0,s.jsx)(`span`,{className:`text-xs uppercase tracking-wide text-[var(--color-text-muted)]`,children:e.name}),(0,s.jsx)(i,{type:e.type})]}),(0,s.jsx)(`div`,{className:`mt-2 text-sm text-[var(--color-text-muted)]`,children:u?`—`:r(`home.stats.protocolCount`,{count:e.adapter_count})})]},e.space_id))]})]})]})}export{c as HomePage};
|
|
@@ -1 +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-CwKUmZK2.js";import{i as a,t as o}from"./react-BdWJx0XL.js";import{t as s}from"./api-D88c6lbH.js";import{n as c,r as l,t as u}from"./SpaceSelect-D8dsuZ8v.js";import{t as d}from"./ErrorAlert-CEK6Hts_.js";var f=e(a(),1);async function p(e,t){let n={query:e.trim()},r=t?.space?.trim();r&&(n.space=r),t?.max_choices!=null&&(n.max_choices=t.max_choices);let i=await s(`/api/activate`,{method:`POST`,body:JSON.stringify(n)});if(!i.ok){let e=await i.json().catch(()=>({}));throw Error(e.message??i.statusText)}return await i.json()}function m(e,t,n){let r=e.trim();return{queryKey:[`activate`,r,(n?.space?.trim()??``)||null,n?.max_choices??null],queryFn:()=>p(r,n),enabled:t&&r.length>0}}function h(e,t,r){return n(m(e,t,r))}var g=o();function _(){return(0,g.jsx)(`ul`,{className:`list-none p-0 m-0 space-y-2`,role:`list`,"aria-hidden":`true`,children:[1,2,3].map(e=>(0,g.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,g.jsxs)(`div`,{className:`flex-1 min-w-0 space-y-2`,children:[(0,g.jsx)(`div`,{className:`h-5 w-3/4 rounded bg-[var(--color-border)] animate-pulse`}),(0,g.jsx)(`div`,{className:`h-4 w-1/2 rounded bg-[var(--color-border)] animate-pulse`}),(0,g.jsx)(`div`,{className:`h-5 w-16 rounded bg-[var(--color-border)] animate-pulse`})]}),(0,g.jsx)(`div`,{className:`h-10 w-20 rounded-[var(--radius-md)] bg-[var(--color-border)] animate-pulse flex-shrink-0`})]},e))})}function v(e){return typeof e!=`number`||Number.isNaN(e)?0:Math.round(Math.max(0,Math.min(e,1))*100)}var y=`ABCDEFGHIJKLMNOPQRSTUVWXYZ`.split(``);function b(e){let t=[];for(let n of e??[])for(let e of n.adapters??[])t.push({adapter_id:e.adapter_id,title:e.title,layer_count:e.layer_count,space_name:n.name,space_type:n.type});let n=new Map,r=[];for(let e of t){let t=(e.adapter_id??``).trim();if(!t){r.push(e);continue}let i=n.get(t);i?(e.layer_count??0)>(i.layer_count??0)&&n.set(t,e):n.set(t,e)}let i=[...n.values(),...r],a={};for(let e of y)a[e]=0;for(let e of i){let t=(e.title??``).trim().charAt(0).toUpperCase();y.includes(t)&&(a[t]=(a[t]??0)+1)}return{browseAdapters:i,countsByLetter:a}}var x=`kairos://adapter/`;function S(e){let{t:n,spacesLoading:r,browseAdapters:i,countsByLetter:a}=e,[o,s]=(0,f.useState)(null),l=(0,f.useMemo)(()=>o?i.filter(e=>(e.title??``).trim().charAt(0).toUpperCase()===o).sort((e,t)=>(e.title??``).localeCompare(t.title??``,void 0,{sensitivity:`base`})):[],[i,o]),u=i.length>0;return(0,g.jsxs)(`section`,{"aria-labelledby":`browse-by-label-heading`,children:[(0,g.jsx)(`h2`,{id:`browse-by-label-heading`,className:`text-lg font-semibold text-[var(--color-text-heading)] mb-3`,children:n(`kairos.browseByLabel`)}),(0,g.jsx)(`p`,{className:`text-sm text-[var(--color-text-muted)] mb-4`,children:n(`kairos.browseByLetterHint`)}),!r&&!u?(0,g.jsx)(`p`,{className:`text-sm text-[var(--color-text-muted)]`,children:n(`kairos.browseEmpty`)}):null,!r&&u?(0,g.jsx)(`div`,{className:`flex flex-wrap gap-2 mb-4`,role:`group`,"aria-label":n(`kairos.browseByLabel`),children:y.map(e=>{let t=a[e]??0;return(0,g.jsxs)(`button`,{type:`button`,onClick:()=>s(t=>t===e?null:e),"aria-expanded":o===e,"aria-controls":`browse-letter-panel-${e}`,"aria-pressed":o===e,"aria-label":n(`kairos.letterCount`,{letter:e,count:t}),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 ${o===e?`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:[e,`: `,t]},e)})}):null,o&&!r&&u?(0,g.jsxs)(`div`,{id:`browse-letter-panel-${o}`,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,g.jsx)(`h3`,{id:`browse-letter-panel-heading`,className:`text-base font-semibold text-[var(--color-text-heading)] mb-3`,children:n(`kairos.labelsStartingWith`,{letter:o})}),l.length===0?(0,g.jsx)(`p`,{className:`text-sm text-[var(--color-text-muted)]`,children:n(`kairos.noLabelsForLetter`)}):(0,g.jsx)(`ul`,{className:`m-0 list-none space-y-2 p-0`,role:`list`,"aria-label":n(`kairos.labelsStartingWith`,{letter:o}),children:l.map(e=>{let r=`${x}${e.adapter_id}`;return(0,g.jsxs)(`li`,{className:`flex flex-col gap-3 rounded-[var(--radius-sm)] border border-[var(--color-border)] bg-[var(--color-surface)] p-3 sm:flex-row sm:items-center sm:justify-between`,children:[(0,g.jsxs)(`div`,{className:`min-w-0 flex flex-col gap-1`,children:[(0,g.jsx)(`span`,{className:`font-medium text-[var(--color-text-heading)]`,children:e.title}),(0,g.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,g.jsx)(c,{type:e.space_type}),(0,g.jsx)(`span`,{className:`text-xs text-[var(--color-text-muted)]`,children:e.space_name})]})]}),(0,g.jsx)(`div`,{className:`flex-shrink-0`,children:(0,g.jsx)(t,{to:`/protocols/${encodeURIComponent(r)}`,"aria-label":n(`kairos.viewProtocol`,{title:e.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:n(`kairos.view`)})})]},e.adapter_id)})})]}):null]})}function C(e){let{t:n,choices:r,topScore:i,roleBadgeClass:a}=e;return(0,g.jsxs)(g.Fragment,{children:[r.length>0&&(0,g.jsx)(`p`,{id:`kairos-results-summary`,className:`text-sm text-[var(--color-text-muted)] mb-4`,"aria-live":`polite`,role:`status`,children:n(`kairos.foundMatches`,{count:r.length,top:i==null?0:Math.round(i)})}),(0,g.jsx)(`ul`,{className:`list-none p-0 m-0 space-y-2`,role:`list`,"aria-label":n(`kairos.resultsLabel`),children:r.map(e=>(0,g.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,g.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,g.jsx)(`span`,{className:`font-medium text-[var(--color-text-heading)] block`,children:e.label}),(0,g.jsxs)(`div`,{className:`text-sm text-[var(--color-text-muted)] mt-1`,children:[e.adapter_name??(e.role===`refine`?n(`kairos.refineMeta`):e.role===`create`?n(`kairos.createMeta`):``),e.role===`match`&&e.space_name!=null&&e.space_name.length>0&&(0,g.jsxs)(g.Fragment,{children:[` `,`· `,n(`kairos.spaceLabel`),`: `,e.space_name]}),e.activation_score!=null&&` · ${n(`kairos.score`)}: ${v(e.activation_score)}%`,e.adapter_version&&` · ${n(`kairos.version`)}: ${e.adapter_version}`]}),(0,g.jsx)(`span`,{className:`inline-block mt-1 text-xs uppercase tracking-wide px-2 py-0.5 rounded ${a[e.role]??`bg-[var(--color-surface)] text-[var(--color-text-muted)]`}`,"aria-label":`Role: ${e.role}`,children:e.role}),e.tags?.length>0&&(0,g.jsx)(`div`,{className:`flex flex-wrap gap-1 mt-2`,"aria-label":n(`kairos.tagsLabel`),children:e.tags.slice(0,8).map(e=>(0,g.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,g.jsxs)(`div`,{className:`flex-shrink-0`,children:[e.role===`match`&&(0,g.jsx)(t,{to:`/protocols/${encodeURIComponent(e.uri)}`,"aria-label":n(`kairos.viewProtocol`,{title:e.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:n(`kairos.view`)}),e.role===`refine`&&(0,g.jsx)(t,{to:`/protocols/${encodeURIComponent(e.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:n(`kairos.refineSearch`)}),e.role===`create`&&(0,g.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:n(`kairos.createNew`)})]})]},e.uri))})]})}var w={match:`bg-[var(--badge-match-bg)] text-[var(--badge-match-fg)]`,refine:`bg-[var(--badge-refine-bg)] text-[var(--badge-refine-fg)]`,create:`bg-[var(--badge-create-bg)] text-[var(--badge-create-fg)]`};function T(){let{t:e}=i(),[n,a]=r(),o=n.get(`q`)??``,s=n.get(`space`)??``,[c,p]=(0,f.useState)(o),[m,y]=(0,f.useState)(o),[x,T]=(0,f.useState)(s),[E,D]=(0,f.useState)(s),O=E.trim(),{data:k,isLoading:A,isError:j,error:M,refetch:N}=h(m,!!m,{...O?{space:O}:{}}),P=!m,{data:F,isLoading:I,isError:L,error:R,refetch:z}=l(!0,{includeAdapterTitles:P});(0,f.useEffect)(()=>{let e=n.get(`q`)??``,t=n.get(`space`)??``;p(e),y(e),T(t),D(t)},[n]);let B=e=>{e.preventDefault(),y(c),D(x);let t={};c.trim()&&(t.q=c.trim()),x.trim()&&(t.space=x.trim()),a(t,{replace:!0})},V=k?.choices??[],H={match:0,refine:1,create:2},U=V.slice().sort((e,t)=>{let n=(H[e.role]??99)-(H[t.role]??99);if(n!==0)return n;let r=e.activation_score??-1;return(t.activation_score??-1)-r}),W=U.length>0?Math.max(...U.map(e=>v(e.activation_score))):null,{browseAdapters:G,countsByLetter:K}=(0,f.useMemo)(()=>b(F?.spaces),[F?.spaces]);return(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`h1`,{className:`text-[var(--color-text-heading)] text-2xl font-semibold mb-1`,children:e(`kairos.title`)}),(0,g.jsx)(`p`,{className:`text-sm text-[var(--color-text-muted)] mb-6`,children:e(`kairos.searchHint`)}),(0,g.jsxs)(`section`,{className:`mb-8`,"aria-labelledby":`browse-search-label`,children:[(0,g.jsx)(`h2`,{id:`browse-search-label`,className:`sr-only`,children:e(`kairos.searchLabel`)}),(0,g.jsxs)(`form`,{onSubmit:B,"aria-label":e(`kairos.searchLabel`),children:[(0,g.jsx)(`label`,{htmlFor:`kairos-search-query`,className:`block font-medium text-[var(--color-text-heading)] mb-2`,children:e(`kairos.searchLabel`)}),(0,g.jsxs)(`div`,{className:`grid gap-3 md:grid-cols-[1fr_auto] md:items-end mb-4`,children:[(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`input`,{id:`kairos-search-query`,type:`search`,value:c,onChange:e=>p(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,g.jsx)(`p`,{id:`kairos-search-hint`,className:`text-sm text-[var(--color-text-muted)] mt-2`,children:e(`kairos.searchHintShort`)})]}),(0,g.jsx)(`div`,{className:`flex md:pb-0 pb-0`,children:(0,g.jsx)(`button`,{type:`submit`,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:e(`kairos.search`)})})]}),(0,g.jsxs)(`div`,{className:`max-w-md mb-6`,children:[(0,g.jsx)(`label`,{htmlFor:`kairos-activate-space`,className:`block text-sm font-medium text-[var(--color-text-heading)] mb-2`,children:e(`kairos.scopeSpaceLabel`)}),(0,g.jsx)(u,{id:`kairos-activate-space`,spaces:F?.spaces,value:x,onChange:T,includeAllOption:!0,disabled:I,"aria-describedby":`kairos-search-hint`})]})]})]}),j&&(0,g.jsx)(d,{message:M instanceof Error?M.message:String(M),onRetry:()=>N(),showGoBack:!0}),P&&L&&(0,g.jsx)(d,{message:R instanceof Error?R.message:String(R),onRetry:()=>z(),showGoBack:!0}),A&&m&&(0,g.jsxs)(`div`,{className:`mb-4`,"aria-live":`polite`,"aria-busy":`true`,children:[(0,g.jsx)(`p`,{className:`sr-only`,children:e(`kairos.loading`)}),(0,g.jsx)(_,{})]}),P&&I&&(0,g.jsxs)(`div`,{className:`mb-4`,"aria-live":`polite`,"aria-busy":`true`,children:[(0,g.jsx)(`p`,{className:`sr-only`,children:e(`kairos.loading`)}),(0,g.jsx)(_,{})]}),!A&&!j&&!(P&&L)&&(0,g.jsx)(g.Fragment,{children:m?U.length===0?(0,g.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,g.jsx)(`p`,{className:`text-[var(--color-text-muted)] mb-4`,children:e(`kairos.empty`)}),(0,g.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,g.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,g.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`)})]})]}):m?(0,g.jsx)(C,{t:e,choices:U,topScore:W,roleBadgeClass:w}):null:(0,g.jsx)(S,{t:e,spacesLoading:I,browseAdapters:G,countsByLetter:K})})]})}export{T as KairosPage};
|
|
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-DLefRYp3.js";import{i as a,t as o}from"./react-BdWJx0XL.js";import{t as s}from"./api-D88c6lbH.js";import{n as c,r as l,t as u}from"./SpaceSelect-C_bHSva4.js";import{t as d}from"./ErrorAlert-xId7zQnR.js";var f=e(a(),1);async function p(e,t){let n={query:e.trim()},r=t?.space?.trim();r&&(n.space=r),t?.max_choices!=null&&(n.max_choices=t.max_choices);let i=await s(`/api/activate`,{method:`POST`,body:JSON.stringify(n)});if(!i.ok){let e=await i.json().catch(()=>({}));throw Error(e.message??i.statusText)}return await i.json()}function m(e,t,n){let r=e.trim();return{queryKey:[`activate`,r,(n?.space?.trim()??``)||null,n?.max_choices??null],queryFn:()=>p(r,n),enabled:t&&r.length>0}}function h(e,t,r){return n(m(e,t,r))}var g=o();function _(){return(0,g.jsx)(`ul`,{className:`list-none p-0 m-0 space-y-2`,role:`list`,"aria-hidden":`true`,children:[1,2,3].map(e=>(0,g.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,g.jsxs)(`div`,{className:`flex-1 min-w-0 space-y-2`,children:[(0,g.jsx)(`div`,{className:`h-5 w-3/4 rounded bg-[var(--color-border)] animate-pulse`}),(0,g.jsx)(`div`,{className:`h-4 w-1/2 rounded bg-[var(--color-border)] animate-pulse`}),(0,g.jsx)(`div`,{className:`h-5 w-16 rounded bg-[var(--color-border)] animate-pulse`})]}),(0,g.jsx)(`div`,{className:`h-10 w-20 rounded-[var(--radius-md)] bg-[var(--color-border)] animate-pulse flex-shrink-0`})]},e))})}function v(e){return typeof e!=`number`||Number.isNaN(e)?0:Math.round(Math.max(0,Math.min(e,1))*100)}var y=`ABCDEFGHIJKLMNOPQRSTUVWXYZ`.split(``);function b(e){let t=[];for(let n of e??[])for(let e of n.adapters??[])t.push({adapter_id:e.adapter_id,title:e.title,layer_count:e.layer_count,space_name:n.name,space_type:n.type});let n=new Map,r=[];for(let e of t){let t=(e.adapter_id??``).trim();if(!t){r.push(e);continue}let i=n.get(t);i?(e.layer_count??0)>(i.layer_count??0)&&n.set(t,e):n.set(t,e)}let i=[...n.values(),...r],a={};for(let e of y)a[e]=0;for(let e of i){let t=(e.title??``).trim().charAt(0).toUpperCase();y.includes(t)&&(a[t]=(a[t]??0)+1)}return{browseAdapters:i,countsByLetter:a}}var x=`kairos://adapter/`;function S(e){let{t:n,spacesLoading:r,browseAdapters:i,countsByLetter:a}=e,[o,s]=(0,f.useState)(null),l=(0,f.useMemo)(()=>o?i.filter(e=>(e.title??``).trim().charAt(0).toUpperCase()===o).sort((e,t)=>(e.title??``).localeCompare(t.title??``,void 0,{sensitivity:`base`})):[],[i,o]),u=i.length>0;return(0,g.jsxs)(`section`,{"aria-labelledby":`browse-by-label-heading`,children:[(0,g.jsx)(`h2`,{id:`browse-by-label-heading`,className:`text-lg font-semibold text-[var(--color-text-heading)] mb-3`,children:n(`kairos.browseByLabel`)}),(0,g.jsx)(`p`,{className:`text-sm text-[var(--color-text-muted)] mb-4`,children:n(`kairos.browseByLetterHint`)}),!r&&!u?(0,g.jsx)(`p`,{className:`text-sm text-[var(--color-text-muted)]`,children:n(`kairos.browseEmpty`)}):null,!r&&u?(0,g.jsx)(`div`,{className:`flex flex-wrap gap-2 mb-4`,role:`group`,"aria-label":n(`kairos.browseByLabel`),children:y.map(e=>{let t=a[e]??0;return(0,g.jsxs)(`button`,{type:`button`,onClick:()=>s(t=>t===e?null:e),"aria-expanded":o===e,"aria-controls":`browse-letter-panel-${e}`,"aria-pressed":o===e,"aria-label":n(`kairos.letterCount`,{letter:e,count:t}),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 ${o===e?`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:[e,`: `,t]},e)})}):null,o&&!r&&u?(0,g.jsxs)(`div`,{id:`browse-letter-panel-${o}`,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,g.jsx)(`h3`,{id:`browse-letter-panel-heading`,className:`text-base font-semibold text-[var(--color-text-heading)] mb-3`,children:n(`kairos.labelsStartingWith`,{letter:o})}),l.length===0?(0,g.jsx)(`p`,{className:`text-sm text-[var(--color-text-muted)]`,children:n(`kairos.noLabelsForLetter`)}):(0,g.jsx)(`ul`,{className:`m-0 list-none space-y-2 p-0`,role:`list`,"aria-label":n(`kairos.labelsStartingWith`,{letter:o}),children:l.map(e=>{let r=`${x}${e.adapter_id}`;return(0,g.jsxs)(`li`,{className:`flex flex-col gap-3 rounded-[var(--radius-sm)] border border-[var(--color-border)] bg-[var(--color-surface)] p-3 sm:flex-row sm:items-center sm:justify-between`,children:[(0,g.jsxs)(`div`,{className:`min-w-0 flex flex-col gap-1`,children:[(0,g.jsx)(`span`,{className:`font-medium text-[var(--color-text-heading)]`,children:e.title}),(0,g.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,g.jsx)(c,{type:e.space_type}),(0,g.jsx)(`span`,{className:`text-xs text-[var(--color-text-muted)]`,children:e.space_name})]})]}),(0,g.jsx)(`div`,{className:`flex-shrink-0`,children:(0,g.jsx)(t,{to:`/protocols/${encodeURIComponent(r)}`,"aria-label":n(`kairos.viewProtocol`,{title:e.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:n(`kairos.view`)})})]},e.adapter_id)})})]}):null]})}function C(e){let{t:n,choices:r,topScore:i,roleBadgeClass:a}=e;return(0,g.jsxs)(g.Fragment,{children:[r.length>0&&(0,g.jsx)(`p`,{id:`kairos-results-summary`,className:`text-sm text-[var(--color-text-muted)] mb-4`,"aria-live":`polite`,role:`status`,children:n(`kairos.foundMatches`,{count:r.length,top:i==null?0:Math.round(i)})}),(0,g.jsx)(`ul`,{className:`list-none p-0 m-0 space-y-2`,role:`list`,"aria-label":n(`kairos.resultsLabel`),children:r.map(e=>(0,g.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,g.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,g.jsx)(`span`,{className:`font-medium text-[var(--color-text-heading)] block`,children:e.label}),(0,g.jsxs)(`div`,{className:`text-sm text-[var(--color-text-muted)] mt-1`,children:[e.adapter_name??(e.role===`refine`?n(`kairos.refineMeta`):e.role===`create`?n(`kairos.createMeta`):``),e.role===`match`&&e.space_name!=null&&e.space_name.length>0&&(0,g.jsxs)(g.Fragment,{children:[` `,`· `,n(`kairos.spaceLabel`),`: `,e.space_name]}),e.activation_score!=null&&` · ${n(`kairos.score`)}: ${v(e.activation_score)}%`,e.adapter_version&&` · ${n(`kairos.version`)}: ${e.adapter_version}`]}),(0,g.jsx)(`span`,{className:`inline-block mt-1 text-xs uppercase tracking-wide px-2 py-0.5 rounded ${a[e.role]??`bg-[var(--color-surface)] text-[var(--color-text-muted)]`}`,"aria-label":`Role: ${e.role}`,children:e.role}),e.tags?.length>0&&(0,g.jsx)(`div`,{className:`flex flex-wrap gap-1 mt-2`,"aria-label":n(`kairos.tagsLabel`),children:e.tags.slice(0,8).map(e=>(0,g.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,g.jsxs)(`div`,{className:`flex-shrink-0`,children:[e.role===`match`&&(0,g.jsx)(t,{to:`/protocols/${encodeURIComponent(e.uri)}`,"aria-label":n(`kairos.viewProtocol`,{title:e.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:n(`kairos.view`)}),e.role===`refine`&&(0,g.jsx)(t,{to:`/protocols/${encodeURIComponent(e.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:n(`kairos.refineSearch`)}),e.role===`create`&&(0,g.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:n(`kairos.createNew`)})]})]},e.uri))})]})}var w={match:`bg-[var(--badge-match-bg)] text-[var(--badge-match-fg)]`,refine:`bg-[var(--badge-refine-bg)] text-[var(--badge-refine-fg)]`,create:`bg-[var(--badge-create-bg)] text-[var(--badge-create-fg)]`};function T(){let{t:e}=i(),[n,a]=r(),o=n.get(`q`)??``,s=n.get(`space`)??``,[c,p]=(0,f.useState)(o),[m,y]=(0,f.useState)(o),[x,T]=(0,f.useState)(s),[E,D]=(0,f.useState)(s),O=E.trim(),{data:k,isLoading:A,isError:j,error:M,refetch:N}=h(m,!!m,{...O?{space:O}:{}}),P=!m,{data:F,isLoading:I,isError:L,error:R,refetch:z}=l(!0,{includeAdapterTitles:P});(0,f.useEffect)(()=>{let e=n.get(`q`)??``,t=n.get(`space`)??``;p(e),y(e),T(t),D(t)},[n]);let B=e=>{e.preventDefault(),y(c),D(x);let t={};c.trim()&&(t.q=c.trim()),x.trim()&&(t.space=x.trim()),a(t,{replace:!0})},V=k?.choices??[],H={match:0,refine:1,create:2},U=V.slice().sort((e,t)=>{let n=(H[e.role]??99)-(H[t.role]??99);if(n!==0)return n;let r=e.activation_score??-1;return(t.activation_score??-1)-r}),W=U.length>0?Math.max(...U.map(e=>v(e.activation_score))):null,{browseAdapters:G,countsByLetter:K}=(0,f.useMemo)(()=>b(F?.spaces),[F?.spaces]);return(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`h1`,{className:`text-[var(--color-text-heading)] text-2xl font-semibold mb-1`,children:e(`kairos.title`)}),(0,g.jsx)(`p`,{className:`text-sm text-[var(--color-text-muted)] mb-6`,children:e(`kairos.searchHint`)}),(0,g.jsxs)(`section`,{className:`mb-8`,"aria-labelledby":`browse-search-label`,children:[(0,g.jsx)(`h2`,{id:`browse-search-label`,className:`sr-only`,children:e(`kairos.searchLabel`)}),(0,g.jsxs)(`form`,{onSubmit:B,"aria-label":e(`kairos.searchLabel`),children:[(0,g.jsx)(`label`,{htmlFor:`kairos-search-query`,className:`block font-medium text-[var(--color-text-heading)] mb-2`,children:e(`kairos.searchLabel`)}),(0,g.jsxs)(`div`,{className:`grid gap-3 md:grid-cols-[1fr_auto] md:items-end mb-4`,children:[(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`input`,{id:`kairos-search-query`,type:`search`,value:c,onChange:e=>p(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,g.jsx)(`p`,{id:`kairos-search-hint`,className:`text-sm text-[var(--color-text-muted)] mt-2`,children:e(`kairos.searchHintShort`)})]}),(0,g.jsx)(`div`,{className:`flex md:pb-0 pb-0`,children:(0,g.jsx)(`button`,{type:`submit`,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:e(`kairos.search`)})})]}),(0,g.jsxs)(`div`,{className:`max-w-md mb-6`,children:[(0,g.jsx)(`label`,{htmlFor:`kairos-activate-space`,className:`block text-sm font-medium text-[var(--color-text-heading)] mb-2`,children:e(`kairos.scopeSpaceLabel`)}),(0,g.jsx)(u,{id:`kairos-activate-space`,spaces:F?.spaces,value:x,onChange:T,includeAllOption:!0,disabled:I,"aria-describedby":`kairos-search-hint`})]})]})]}),j&&(0,g.jsx)(d,{message:M instanceof Error?M.message:String(M),onRetry:()=>N(),showGoBack:!0}),P&&L&&(0,g.jsx)(d,{message:R instanceof Error?R.message:String(R),onRetry:()=>z(),showGoBack:!0}),A&&m&&(0,g.jsxs)(`div`,{className:`mb-4`,"aria-live":`polite`,"aria-busy":`true`,children:[(0,g.jsx)(`p`,{className:`sr-only`,children:e(`kairos.loading`)}),(0,g.jsx)(_,{})]}),P&&I&&(0,g.jsxs)(`div`,{className:`mb-4`,"aria-live":`polite`,"aria-busy":`true`,children:[(0,g.jsx)(`p`,{className:`sr-only`,children:e(`kairos.loading`)}),(0,g.jsx)(_,{})]}),!A&&!j&&!(P&&L)&&(0,g.jsx)(g.Fragment,{children:m?U.length===0?(0,g.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,g.jsx)(`p`,{className:`text-[var(--color-text-muted)] mb-4`,children:e(`kairos.empty`)}),(0,g.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,g.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,g.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`)})]})]}):m?(0,g.jsx)(C,{t:e,choices:U,topScore:W,roleBadgeClass:w}):null:(0,g.jsx)(S,{t:e,spacesLoading:I,browseAdapters:G,countsByLetter:K})})]})}export{T as KairosPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{y as e}from"./vendor-
|
|
1
|
+
import{y as e}from"./vendor-DLefRYp3.js";import{t}from"./react-BdWJx0XL.js";import{t as n}from"./ErrorAlert-xId7zQnR.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-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{a as t,f as n,y as r}from"./vendor-DLefRYp3.js";import{i,t as a}from"./react-BdWJx0XL.js";import{t as o}from"./SurfaceCard-BBbNWQYu.js";import{i as s,n as c}from"./useProtocol-DMe_p3jp.js";import{n as l}from"./ChallengeCard-Coecs--0.js";import{n as u,t as d}from"./StepFlowGraph-BEV34aU4.js";var f=e(i(),1),p=a();function m({value:e,label:t,className:n}){let{t:i}=r(),[a,o]=(0,f.useState)(!1);return(0,p.jsx)(`button`,{type:`button`,onClick:(0,f.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`)})}function h(e){return e.body.replace(/\n```json\s*[\s\S]*?```\s*$/g,``).trim()}function g(){let{t:e}=r(),{uri:i}=n(),{data:a,isLoading:f,isError:g,error:_}=s(i?decodeURIComponent(i):void 0,!0);if(f&&!a)return(0,p.jsx)(`p`,{className:`text-[var(--color-text-muted)]`,children:e(`protocol.loading`)});if(g||!a)return(0,p.jsxs)(`div`,{role:`alert`,className:`p-4 rounded-[var(--radius-md)] bg-[var(--color-error-bg)] text-[var(--color-error)]`,children:[_ instanceof Error?_.message:e(`protocol.notFound`),(0,p.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:v,steps:y,triggers:b,completion:x}=c(a.markdown_doc),S=()=>{let e=v.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)},C=()=>{let e=v.replace(/[^a-zA-Z0-9]+/g,`-`).replace(/^-|-$/g,``)||`protocol`,t=`# ${v}\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)},w=`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-[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`;return(0,p.jsxs)(`div`,{children:[(0,p.jsx)(`h1`,{className:`text-[var(--color-text-heading)] text-2xl font-semibold mb-1`,children:v}),(0,p.jsxs)(`div`,{className:`mb-4 flex flex-wrap items-center gap-2`,children:[(0,p.jsxs)(`p`,{className:`text-sm text-[var(--color-text-muted)] m-0`,children:[(0,p.jsxs)(`span`,{className:`sr-only`,children:[e(`protocol.uri`),`: `]}),(0,p.jsx)(`code`,{className:`break-all rounded bg-[var(--color-surface-elevated)] px-2 py-0.5 text-xs`,children:a.uri}),(0,p.jsxs)(`span`,{className:`ml-2`,children:[`· `,e(`protocol.readOnly`)]}),a.space_name!=null&&a.space_name.length>0?(0,p.jsxs)(`span`,{className:`ml-2 block w-full sm:inline sm:w-auto`,children:[`· `,e(`protocol.spaceLabel`),`: `,a.space_name]}):null]}),(0,p.jsx)(m,{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,p.jsxs)(`div`,{className:`mb-6 flex flex-wrap gap-2`,children:[(0,p.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,p.jsx)(t,{to:`/protocols/${encodeURIComponent(a.uri)}/edit`,className:w,children:e(`protocol.edit`)}),(0,p.jsx)(t,{to:`/protocols/new`,className:w,children:e(`protocol.duplicate`)})]}),(0,p.jsxs)(`div`,{className:`mb-6 grid gap-4 xl:grid-cols-[1.6fr_1fr]`,children:[(0,p.jsx)(o,{title:e(`protocol.howToUse`),subtitle:e(`protocol.howToUseInProduct`),children:(0,p.jsxs)(`p`,{className:`text-sm text-[var(--color-text-muted)] m-0`,children:[e(`protocol.howToUseCopy`),` `,(0,p.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`)})]})}),(0,p.jsx)(o,{title:e(`protocol.exportCardTitle`),subtitle:e(`protocol.exportCardSubtitle`),children:(0,p.jsxs)(`div`,{className:`w-full max-w-[22rem] rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface)] p-3`,children:[(0,p.jsx)(`div`,{className:`mb-2 text-sm font-medium text-[var(--color-text-heading)]`,children:e(`protocol.download`)}),(0,p.jsxs)(`button`,{type:`button`,onClick:S,className:`flex min-h-[44px] w-full items-center justify-between rounded-[var(--radius-md)] px-3 text-left text-sm text-[var(--color-text)] hover:bg-[var(--color-surface-elevated)]`,children:[(0,p.jsx)(`span`,{children:e(`protocol.downloadAsMarkdown`)}),(0,p.jsx)(`span`,{className:`text-[var(--color-text-muted)]`,children:`.md`})]}),(0,p.jsxs)(`button`,{type:`button`,onClick:C,className:`mt-1 flex min-h-[44px] w-full items-center justify-between rounded-[var(--radius-md)] px-3 text-left text-sm text-[var(--color-text)] hover:bg-[var(--color-surface-elevated)]`,children:[(0,p.jsx)(`span`,{children:e(`protocol.downloadAsSkill`)}),(0,p.jsx)(`span`,{className:`text-[var(--color-text-muted)]`,children:`.md`})]}),(0,p.jsxs)(t,{to:`/protocols/${encodeURIComponent(a.uri)}/skill`,className:`mt-1 flex min-h-[44px] w-full items-center justify-between rounded-[var(--radius-md)] px-3 text-left text-sm text-[var(--color-text)] no-underline hover:bg-[var(--color-surface-elevated)]`,children:[(0,p.jsx)(`span`,{children:e(`protocol.editAsSkill`)}),(0,p.jsx)(`span`,{className:`text-[var(--color-text-muted)]`,children:`bundle`})]}),(0,p.jsx)(`p`,{className:`mt-3 text-xs leading-5 text-[var(--color-text-muted)] m-0`,children:e(`protocol.exportFooter`)})]})})]}),(0,p.jsxs)(`section`,{className:`mb-6`,"aria-labelledby":`flow-heading`,children:[(0,p.jsx)(`h2`,{id:`flow-heading`,className:`mb-2 text-lg font-semibold text-[var(--color-text-heading)]`,children:e(`protocol.stepFlow`)}),(0,p.jsx)(d,{steps:y.map(e=>({label:e.label}))})]}),(0,p.jsxs)(`section`,{"aria-labelledby":`steps-heading`,className:`mb-6`,children:[(0,p.jsx)(`h2`,{id:`steps-heading`,className:`mb-2 text-lg font-semibold text-[var(--color-text-heading)]`,children:e(`protocol.steps`)}),(0,p.jsx)(`ul`,{className:`m-0 list-none divide-y divide-[var(--color-border)] rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface-elevated)] p-0`,children:y.map((e,t)=>{let n=h(e);return(0,p.jsxs)(`li`,{className:`p-4`,children:[(0,p.jsxs)(`strong`,{className:`block text-[var(--color-text-heading)]`,children:[t+1,`. `,e.label]}),(0,p.jsx)(`div`,{className:`mt-1 text-sm text-[var(--color-text-muted)] break-words`,children:e.summary}),(0,p.jsx)(`div`,{className:`mt-3`,children:(0,p.jsx)(l,{type:e.type,payload:e.challengePayload})}),n?(0,p.jsx)(`div`,{className:`mt-3 border-t border-[var(--color-border)] pt-3`,children:(0,p.jsx)(u,{content:n})}):null]},t)})})]}),(b||x)&&(0,p.jsxs)(`div`,{className:`grid gap-4 lg:grid-cols-2`,children:[b?(0,p.jsx)(o,{title:e(`protocol.triggers`),children:(0,p.jsx)(`div`,{className:`max-w-none text-sm text-[var(--color-text)]`,children:(0,p.jsx)(u,{content:b})})}):null,x?(0,p.jsx)(o,{title:e(`protocol.completion`),children:(0,p.jsx)(`div`,{className:`max-w-none text-sm text-[var(--color-text)]`,children:(0,p.jsx)(u,{content:x})})}):null]})]})}export{g as ProtocolDetailPage};
|
|
@@ -1,4 +1,4 @@
|
|
|
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-CwKUmZK2.js";import{i as o,t as s}from"./react-BdWJx0XL.js";import{t as c}from"./api-D88c6lbH.js";import{r as ee,t as l}from"./SpaceSelect-D8dsuZ8v.js";import{t as u}from"./SurfaceCard-BBbNWQYu.js";import{i as d,n as f,r as p,t as m}from"./useProtocol-CN2rdtdQ.js";import{t as h}from"./ChallengeCard-Coecs--0.js";import{t as g}from"./RichTextEditor-MeDG49aR.js";var _=e(o(),1),v=s(),y=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)`),b={label:`Step`,bodyMarkdown:`What the user or agent does in this step.`,type:`comment`,comment:{min_length:10}},x=[`shell`,`mcp`,`user_input`,`comment`],S=/^kairos:\/\/adapter\/[0-9a-f-]{36}$/i;function C(){let{t:e}=a(),{uri:i}=r(),o=n(),s=i?decodeURIComponent(i):void 0,C=!s,{data:w,isLoading:T}=d(s,!C),[E,D]=(0,_.useState)({protocolLabel:``,triggersMarkdown:``,steps:[{...b}],completionMarkdown:``}),[O,k]=(0,_.useState)(()=>String(Date.now())),[A,j]=(0,_.useState)(!1),[M,N]=(0,_.useState)(null),[P,F]=(0,_.useState)(null),I=(0,_.useRef)(null),L=(0,_.useRef)(``),[R,z]=(0,_.useState)(``),[B,V]=(0,_.useState)(``),[H,U]=(0,_.useState)(``),{data:W,isLoading:G}=ee(!0,{});(0,_.useEffect)(()=>{C&&(z(``),U(``))},[C]),(0,_.useEffect)(()=>{if(!C)return;let e=W?.spaces?.find(e=>e.type===`personal`);z(t=>t===``&&e?e.space_id:t)},[C,W?.spaces]),(0,_.useEffect)(()=>{if(C||!w)return;let e=typeof w.space_id==`string`?w.space_id.trim():``;L.current=e,V(e)},[C,w]),(0,_.useEffect)(()=>{if(w?.markdown_doc)try{D(p(w.markdown_doc)),k(String(Date.now()))}catch{D({protocolLabel:w.label||`Protocol`,triggersMarkdown:``,steps:[{...b}],completionMarkdown:``})}},[w]);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{D(p(e)),k(String(Date.now())),F(null),N(null)}catch{N(`Could not parse the uploaded file. Use valid protocol markdown.`)}},n.readAsText(t,`UTF-8`),e.target.value=``},q=(e,t)=>{D(n=>({...n,[e]:t}))},J=(e,t)=>{D(n=>({...n,steps:n.steps.map((n,r)=>r===e?typeof t==`function`?t(n):{...n,...t}:n)}))},Y=()=>{D(e=>({...e,steps:[...e.steps,{...b,label:`Step ${e.steps.length+1}`}]}))},X=e=>{D(t=>({...t,steps:t.steps.filter((t,n)=>n!==e)}))},Z=async t=>{t.preventDefault(),N(null),F(null);let n=m(E),r=y.safeParse(n);if(!r.success){F(r.error.errors[0]?.message??`Invalid`);return}let i=H.trim();if(i&&!S.test(i)){F(e(`protocolEdit.forkUriInvalid`));return}j(!0);try{if(C){let e=R.trim()||`personal`,t=await c(`/api/train`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({markdown_doc:n,llm_model_id:`kairos-ui`,force_update:!1,space:e,...i?{source_adapter_uri:i}:{}})});if(!t.ok){let e=await t.json().catch(()=>({}));throw Error(e.message??t.statusText)}let r=await t.json(),a=r.items?.[0]?.adapter_uri,s=r.items?.[0]?.uri;o(a?`/protocols/${encodeURIComponent(a)}`:s?`/protocols/${encodeURIComponent(s)}`:`/`)}else{let e=L.current.trim(),t=B.trim(),r={uris:[s],markdown_doc:[n]};t&&t!==e&&(r.space=t);let i=await c(`/api/tune`,{method:`POST`,body:JSON.stringify(r)});if(!i.ok){let e=await i.json().catch(()=>({}));throw Error(e.message??i.statusText)}o(`/protocols/${encodeURIComponent(s)}`)}}catch(e){N(e instanceof Error?e.message:String(e))}finally{j(!1)}},Q=(()=>{try{return f(m(E))}catch{return{title:E.protocolLabel||`Protocol`,steps:[],triggers:``,completion:``}}})();if(!C&&T&&!w)return(0,v.jsx)(`p`,{className:`text-[var(--color-text-muted)]`,children:e(`protocol.loading`)});let te={shell:e(`protocolEdit.challengeShell`),mcp:e(`protocolEdit.challengeMcp`),user_input:e(`protocolEdit.challengeUserInput`),comment:e(`protocolEdit.challengeComment`)},$=(E.protocolLabel.trim()||Q.title||`skill`).replace(/[^a-zA-Z0-9]+/g,`-`).replace(/^-|-$/g,``).toLowerCase()||`skill`;return(0,v.jsxs)(`div`,{children:[(0,v.jsx)(`h1`,{className:`mb-1 text-2xl font-semibold text-[var(--color-text-heading)]`,children:e(C?`protocolEdit.newTitle`:`protocolEdit.editTitle`)}),(0,v.jsx)(`p`,{className:`mb-6 text-sm text-[var(--color-text-muted)]`,children:e(`protocolEdit.hint`)}),(0,v.jsx)(`section`,{className:`mb-8 space-y-5 rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface-elevated)] p-5`,children:C?(0,v.jsxs)(v.Fragment,{children:[(0,v.jsxs)(`div`,{children:[(0,v.jsx)(`label`,{htmlFor:`protocol-target-space`,className:`mb-2 block font-medium text-[var(--color-text-heading)]`,children:e(`protocolEdit.targetSpaceLabel`)}),(0,v.jsx)(l,{id:`protocol-target-space`,spaces:W?.spaces,value:R,onChange:z,disabled:G}),(0,v.jsx)(`p`,{className:`mt-2 text-sm text-[var(--color-text-muted)]`,children:e(`protocolEdit.targetSpaceHint`)})]}),(0,v.jsxs)(`div`,{children:[(0,v.jsx)(`label`,{htmlFor:`protocol-fork-source`,className:`mb-2 block font-medium text-[var(--color-text-heading)]`,children:e(`protocolEdit.forkSourceLabel`)}),(0,v.jsx)(`input`,{id:`protocol-fork-source`,type:`text`,value:H,onChange:e=>U(e.target.value),placeholder:e(`protocolEdit.forkSourcePlaceholder`),autoComplete:`off`,className:`min-h-[44px] w-full max-w-2xl 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,v.jsx)(`p`,{className:`mt-2 text-sm text-[var(--color-text-muted)]`,children:e(`protocolEdit.forkSourceHint`)})]})]}):(0,v.jsxs)(`div`,{children:[(0,v.jsx)(`label`,{htmlFor:`protocol-move-space`,className:`mb-2 block font-medium text-[var(--color-text-heading)]`,children:e(`protocolEdit.moveSpaceLabel`)}),(0,v.jsx)(l,{id:`protocol-move-space`,spaces:W?.spaces,value:B,onChange:V,disabled:G}),(0,v.jsx)(`p`,{className:`mt-2 text-sm text-[var(--color-text-muted)]`,children:e(`protocolEdit.moveSpaceHint`)})]})}),(0,v.jsx)(u,{className:`mb-8`,title:e(`protocolEdit.importCardTitle`),subtitle:e(`protocolEdit.uploadHint`),children:(0,v.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,v.jsx)(`input`,{ref:I,type:`file`,accept:`.md,text/markdown`,onChange:K,className:`sr-only`,id:`protocol-upload`,"aria-label":e(`protocolEdit.upload`)}),(0,v.jsx)(`button`,{type:`button`,onClick:()=>I.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,v.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,v.jsx)(`form`,{onSubmit:Z,"aria-label":e(`protocolEdit.formLabel`),children:(0,v.jsxs)(`div`,{className:`mb-6 grid gap-6 xl:grid-cols-[1.45fr_1fr]`,children:[(0,v.jsxs)(`div`,{className:`space-y-6`,children:[(0,v.jsxs)(`div`,{children:[(0,v.jsx)(`label`,{htmlFor:`protocol-label`,className:`mb-2 block font-medium text-[var(--color-text-heading)]`,children:e(`protocolEdit.protocolLabel`)}),(0,v.jsx)(`input`,{id:`protocol-label`,type:`text`,value:E.protocolLabel,onChange:e=>q(`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,v.jsx)(g,{label:e(`protocolEdit.triggersLabel`),hint:e(`protocolEdit.triggersEditorHint`),value:E.triggersMarkdown,onChange:e=>q(`triggersMarkdown`,e),contentKey:O}),E.steps.map((t,n)=>(0,v.jsxs)(`div`,{className:`rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface-elevated)] p-5 space-y-5`,children:[(0,v.jsxs)(`div`,{className:`mb-4 flex flex-wrap items-center justify-between gap-2`,children:[(0,v.jsxs)(`div`,{children:[(0,v.jsx)(`div`,{className:`text-sm font-medium text-[var(--color-text-heading)]`,children:e(`protocolEdit.stepHeading`,{n:n+1})}),(0,v.jsx)(`div`,{className:`text-sm text-[var(--color-text-muted)]`,children:e(`protocolEdit.stepEditorHint`)})]}),(0,v.jsx)(`button`,{type:`button`,onClick:()=>X(n),disabled:E.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,v.jsxs)(`div`,{children:[(0,v.jsx)(`label`,{className:`mb-2 block font-medium text-[var(--color-text-heading)]`,children:e(`protocolEdit.stepLabel`)}),(0,v.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,v.jsxs)(`div`,{children:[(0,v.jsx)(`div`,{className:`mb-2 font-medium text-[var(--color-text-heading)]`,children:e(`protocolEdit.challengeType`)}),(0,v.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:x.map(e=>(0,v.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:te[e]},e))})]}),(0,v.jsx)(`div`,{children:(0,v.jsx)(g,{label:e(`protocolEdit.stepContent`),value:t.bodyMarkdown,onChange:e=>J(n,{bodyMarkdown:e}),contentKey:O})}),(0,v.jsxs)(`div`,{className:`rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface)] p-4`,children:[(0,v.jsx)(`div`,{className:`mb-3 text-sm font-medium text-[var(--color-text-heading)]`,children:`Challenge fields`}),(0,v.jsxs)(`div`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-2`,children:[t.type===`shell`&&(0,v.jsxs)(v.Fragment,{children:[(0,v.jsxs)(`div`,{children:[(0,v.jsx)(`label`,{className:`mb-2 block text-sm font-medium text-[var(--color-text-heading)]`,children:e(`protocolEdit.shellCmd`)}),(0,v.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,v.jsxs)(`div`,{children:[(0,v.jsx)(`label`,{className:`mb-2 block text-sm font-medium text-[var(--color-text-heading)]`,children:e(`protocolEdit.shellTimeout`)}),(0,v.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,v.jsxs)(`div`,{children:[(0,v.jsx)(`label`,{className:`mb-2 block text-sm font-medium text-[var(--color-text-heading)]`,children:e(`protocolEdit.shellInterpreter`)}),(0,v.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,v.jsxs)(`div`,{children:[(0,v.jsx)(`label`,{className:`mb-2 block text-sm font-medium text-[var(--color-text-heading)]`,children:e(`protocolEdit.shellWorkdir`)}),(0,v.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,v.jsxs)(`div`,{className:`sm:col-span-2`,children:[(0,v.jsx)(`label`,{className:`mb-2 block text-sm font-medium text-[var(--color-text-heading)]`,children:e(`protocolEdit.shellFlags`)}),(0,v.jsx)(`textarea`,{rows:3,value:(t.shell?.flags??[]).join(`
|
|
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-DLefRYp3.js";import{i as o,t as s}from"./react-BdWJx0XL.js";import{t as c}from"./api-D88c6lbH.js";import{r as ee,t as l}from"./SpaceSelect-C_bHSva4.js";import{t as u}from"./SurfaceCard-BBbNWQYu.js";import{i as d,n as f,r as p,t as m}from"./useProtocol-DMe_p3jp.js";import{t as h}from"./ChallengeCard-Coecs--0.js";import{t as g}from"./RichTextEditor-CpNxz2Fi.js";var _=e(o(),1),v=s(),y=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)`),b={label:`Step`,bodyMarkdown:`What the user or agent does in this step.`,type:`comment`,comment:{min_length:10}},x=[`shell`,`mcp`,`user_input`,`comment`],S=/^kairos:\/\/adapter\/[0-9a-f-]{36}$/i;function C(){let{t:e}=a(),{uri:i}=r(),o=n(),s=i?decodeURIComponent(i):void 0,C=!s,{data:w,isLoading:T}=d(s,!C),[E,D]=(0,_.useState)({protocolLabel:``,triggersMarkdown:``,steps:[{...b}],completionMarkdown:``}),[O,k]=(0,_.useState)(()=>String(Date.now())),[A,j]=(0,_.useState)(!1),[M,N]=(0,_.useState)(null),[P,F]=(0,_.useState)(null),I=(0,_.useRef)(null),L=(0,_.useRef)(``),[R,z]=(0,_.useState)(``),[B,V]=(0,_.useState)(``),[H,U]=(0,_.useState)(``),{data:W,isLoading:G}=ee(!0,{});(0,_.useEffect)(()=>{C&&(z(``),U(``))},[C]),(0,_.useEffect)(()=>{if(!C)return;let e=W?.spaces?.find(e=>e.type===`personal`);z(t=>t===``&&e?e.space_id:t)},[C,W?.spaces]),(0,_.useEffect)(()=>{if(C||!w)return;let e=typeof w.space_id==`string`?w.space_id.trim():``;L.current=e,V(e)},[C,w]),(0,_.useEffect)(()=>{if(w?.markdown_doc)try{D(p(w.markdown_doc)),k(String(Date.now()))}catch{D({protocolLabel:w.label||`Protocol`,triggersMarkdown:``,steps:[{...b}],completionMarkdown:``})}},[w]);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{D(p(e)),k(String(Date.now())),F(null),N(null)}catch{N(`Could not parse the uploaded file. Use valid protocol markdown.`)}},n.readAsText(t,`UTF-8`),e.target.value=``},q=(e,t)=>{D(n=>({...n,[e]:t}))},J=(e,t)=>{D(n=>({...n,steps:n.steps.map((n,r)=>r===e?typeof t==`function`?t(n):{...n,...t}:n)}))},Y=()=>{D(e=>({...e,steps:[...e.steps,{...b,label:`Step ${e.steps.length+1}`}]}))},X=e=>{D(t=>({...t,steps:t.steps.filter((t,n)=>n!==e)}))},Z=async t=>{t.preventDefault(),N(null),F(null);let n=m(E),r=y.safeParse(n);if(!r.success){F(r.error.errors[0]?.message??`Invalid`);return}let i=H.trim();if(i&&!S.test(i)){F(e(`protocolEdit.forkUriInvalid`));return}j(!0);try{if(C){let e=R.trim()||`personal`,t=await c(`/api/train`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({markdown_doc:n,llm_model_id:`kairos-ui`,force_update:!1,space:e,...i?{source_adapter_uri:i}:{}})});if(!t.ok){let e=await t.json().catch(()=>({}));throw Error(e.message??t.statusText)}let r=await t.json(),a=r.items?.[0]?.adapter_uri,s=r.items?.[0]?.uri;o(a?`/protocols/${encodeURIComponent(a)}`:s?`/protocols/${encodeURIComponent(s)}`:`/`)}else{let e=L.current.trim(),t=B.trim(),r={uris:[s],markdown_doc:[n]};t&&t!==e&&(r.space=t);let i=await c(`/api/tune`,{method:`POST`,body:JSON.stringify(r)});if(!i.ok){let e=await i.json().catch(()=>({}));throw Error(e.message??i.statusText)}o(`/protocols/${encodeURIComponent(s)}`)}}catch(e){N(e instanceof Error?e.message:String(e))}finally{j(!1)}},Q=(()=>{try{return f(m(E))}catch{return{title:E.protocolLabel||`Protocol`,steps:[],triggers:``,completion:``}}})();if(!C&&T&&!w)return(0,v.jsx)(`p`,{className:`text-[var(--color-text-muted)]`,children:e(`protocol.loading`)});let te={shell:e(`protocolEdit.challengeShell`),mcp:e(`protocolEdit.challengeMcp`),user_input:e(`protocolEdit.challengeUserInput`),comment:e(`protocolEdit.challengeComment`)},$=(E.protocolLabel.trim()||Q.title||`skill`).replace(/[^a-zA-Z0-9]+/g,`-`).replace(/^-|-$/g,``).toLowerCase()||`skill`;return(0,v.jsxs)(`div`,{children:[(0,v.jsx)(`h1`,{className:`mb-1 text-2xl font-semibold text-[var(--color-text-heading)]`,children:e(C?`protocolEdit.newTitle`:`protocolEdit.editTitle`)}),(0,v.jsx)(`p`,{className:`mb-6 text-sm text-[var(--color-text-muted)]`,children:e(`protocolEdit.hint`)}),(0,v.jsx)(`section`,{className:`mb-8 space-y-5 rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface-elevated)] p-5`,children:C?(0,v.jsxs)(v.Fragment,{children:[(0,v.jsxs)(`div`,{children:[(0,v.jsx)(`label`,{htmlFor:`protocol-target-space`,className:`mb-2 block font-medium text-[var(--color-text-heading)]`,children:e(`protocolEdit.targetSpaceLabel`)}),(0,v.jsx)(l,{id:`protocol-target-space`,spaces:W?.spaces,value:R,onChange:z,disabled:G}),(0,v.jsx)(`p`,{className:`mt-2 text-sm text-[var(--color-text-muted)]`,children:e(`protocolEdit.targetSpaceHint`)})]}),(0,v.jsxs)(`div`,{children:[(0,v.jsx)(`label`,{htmlFor:`protocol-fork-source`,className:`mb-2 block font-medium text-[var(--color-text-heading)]`,children:e(`protocolEdit.forkSourceLabel`)}),(0,v.jsx)(`input`,{id:`protocol-fork-source`,type:`text`,value:H,onChange:e=>U(e.target.value),placeholder:e(`protocolEdit.forkSourcePlaceholder`),autoComplete:`off`,className:`min-h-[44px] w-full max-w-2xl 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,v.jsx)(`p`,{className:`mt-2 text-sm text-[var(--color-text-muted)]`,children:e(`protocolEdit.forkSourceHint`)})]})]}):(0,v.jsxs)(`div`,{children:[(0,v.jsx)(`label`,{htmlFor:`protocol-move-space`,className:`mb-2 block font-medium text-[var(--color-text-heading)]`,children:e(`protocolEdit.moveSpaceLabel`)}),(0,v.jsx)(l,{id:`protocol-move-space`,spaces:W?.spaces,value:B,onChange:V,disabled:G}),(0,v.jsx)(`p`,{className:`mt-2 text-sm text-[var(--color-text-muted)]`,children:e(`protocolEdit.moveSpaceHint`)})]})}),(0,v.jsx)(u,{className:`mb-8`,title:e(`protocolEdit.importCardTitle`),subtitle:e(`protocolEdit.uploadHint`),children:(0,v.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,v.jsx)(`input`,{ref:I,type:`file`,accept:`.md,text/markdown`,onChange:K,className:`sr-only`,id:`protocol-upload`,"aria-label":e(`protocolEdit.upload`)}),(0,v.jsx)(`button`,{type:`button`,onClick:()=>I.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,v.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,v.jsx)(`form`,{onSubmit:Z,"aria-label":e(`protocolEdit.formLabel`),children:(0,v.jsxs)(`div`,{className:`mb-6 grid gap-6 xl:grid-cols-[1.45fr_1fr]`,children:[(0,v.jsxs)(`div`,{className:`space-y-6`,children:[(0,v.jsxs)(`div`,{children:[(0,v.jsx)(`label`,{htmlFor:`protocol-label`,className:`mb-2 block font-medium text-[var(--color-text-heading)]`,children:e(`protocolEdit.protocolLabel`)}),(0,v.jsx)(`input`,{id:`protocol-label`,type:`text`,value:E.protocolLabel,onChange:e=>q(`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,v.jsx)(g,{label:e(`protocolEdit.triggersLabel`),hint:e(`protocolEdit.triggersEditorHint`),value:E.triggersMarkdown,onChange:e=>q(`triggersMarkdown`,e),contentKey:O}),E.steps.map((t,n)=>(0,v.jsxs)(`div`,{className:`rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface-elevated)] p-5 space-y-5`,children:[(0,v.jsxs)(`div`,{className:`mb-4 flex flex-wrap items-center justify-between gap-2`,children:[(0,v.jsxs)(`div`,{children:[(0,v.jsx)(`div`,{className:`text-sm font-medium text-[var(--color-text-heading)]`,children:e(`protocolEdit.stepHeading`,{n:n+1})}),(0,v.jsx)(`div`,{className:`text-sm text-[var(--color-text-muted)]`,children:e(`protocolEdit.stepEditorHint`)})]}),(0,v.jsx)(`button`,{type:`button`,onClick:()=>X(n),disabled:E.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,v.jsxs)(`div`,{children:[(0,v.jsx)(`label`,{className:`mb-2 block font-medium text-[var(--color-text-heading)]`,children:e(`protocolEdit.stepLabel`)}),(0,v.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,v.jsxs)(`div`,{children:[(0,v.jsx)(`div`,{className:`mb-2 font-medium text-[var(--color-text-heading)]`,children:e(`protocolEdit.challengeType`)}),(0,v.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:x.map(e=>(0,v.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:te[e]},e))})]}),(0,v.jsx)(`div`,{children:(0,v.jsx)(g,{label:e(`protocolEdit.stepContent`),value:t.bodyMarkdown,onChange:e=>J(n,{bodyMarkdown:e}),contentKey:O})}),(0,v.jsxs)(`div`,{className:`rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface)] p-4`,children:[(0,v.jsx)(`div`,{className:`mb-3 text-sm font-medium text-[var(--color-text-heading)]`,children:`Challenge fields`}),(0,v.jsxs)(`div`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-2`,children:[t.type===`shell`&&(0,v.jsxs)(v.Fragment,{children:[(0,v.jsxs)(`div`,{children:[(0,v.jsx)(`label`,{className:`mb-2 block text-sm font-medium text-[var(--color-text-heading)]`,children:e(`protocolEdit.shellCmd`)}),(0,v.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,v.jsxs)(`div`,{children:[(0,v.jsx)(`label`,{className:`mb-2 block text-sm font-medium text-[var(--color-text-heading)]`,children:e(`protocolEdit.shellTimeout`)}),(0,v.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,v.jsxs)(`div`,{children:[(0,v.jsx)(`label`,{className:`mb-2 block text-sm font-medium text-[var(--color-text-heading)]`,children:e(`protocolEdit.shellInterpreter`)}),(0,v.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,v.jsxs)(`div`,{children:[(0,v.jsx)(`label`,{className:`mb-2 block text-sm font-medium text-[var(--color-text-heading)]`,children:e(`protocolEdit.shellWorkdir`)}),(0,v.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,v.jsxs)(`div`,{className:`sm:col-span-2`,children:[(0,v.jsx)(`label`,{className:`mb-2 block text-sm font-medium text-[var(--color-text-heading)]`,children:e(`protocolEdit.shellFlags`)}),(0,v.jsx)(`textarea`,{rows:3,value:(t.shell?.flags??[]).join(`
|
|
2
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
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,v.jsxs)(`div`,{className:`sm:col-span-2`,children:[(0,v.jsx)(`label`,{className:`mb-2 block text-sm font-medium text-[var(--color-text-heading)]`,children:e(`protocolEdit.shellArgs`)}),(0,v.jsx)(`textarea`,{rows:3,value:(t.shell?.args??[]).join(`
|
|
4
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(`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{i as t,t as n}from"./react-BdWJx0XL.js";import{a as r,c as i,i as a,l as o,n as s,o as c,r as l,s as u,t as d}from"./tiptap-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{i as t,t as n}from"./react-BdWJx0XL.js";import{a as r,c as i,i as a,l as o,n as s,o as c,r as l,s as u,t as d}from"./tiptap-VSnrfrI4.js";function f(){return[c.configure({link:!1,heading:{levels:[2,3,4]}}),u.configure({openOnClick:!1,autolink:!1}),s.configure({resizable:!1}),r,l,a,d.configure({markedOptions:{gfm:!0,breaks:!1}})]}var p=e(t(),1),m=n(),h=`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 g({children:e,className:t=`h-4 w-4`}){return(0,m.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 _(){return(0,m.jsxs)(g,{children:[(0,m.jsx)(`circle`,{cx:`3`,cy:`4`,r:`1`,fill:`currentColor`,stroke:`none`}),(0,m.jsx)(`circle`,{cx:`3`,cy:`8`,r:`1`,fill:`currentColor`,stroke:`none`}),(0,m.jsx)(`circle`,{cx:`3`,cy:`12`,r:`1`,fill:`currentColor`,stroke:`none`}),(0,m.jsx)(`path`,{d:`M6 4h7`}),(0,m.jsx)(`path`,{d:`M6 8h7`}),(0,m.jsx)(`path`,{d:`M6 12h7`})]})}function v(){return(0,m.jsxs)(g,{children:[(0,m.jsx)(`path`,{d:`M6 10L4.5 11.5a2.5 2.5 0 1 1-3.5-3.5L2.5 6.5`}),(0,m.jsx)(`path`,{d:`M10 6l1.5-1.5a2.5 2.5 0 1 1 3.5 3.5L13.5 9.5`}),(0,m.jsx)(`path`,{d:`M5.5 10.5l5-5`})]})}function y(){return(0,m.jsxs)(g,{children:[(0,m.jsx)(`path`,{d:`M5.5 5.5A2.5 2.5 0 0 0 3 8v2.5h3V8H4.5`}),(0,m.jsx)(`path`,{d:`M11.5 5.5A2.5 2.5 0 0 0 9 8v2.5h3V8h-1.5`})]})}function b(){return(0,m.jsxs)(g,{children:[(0,m.jsx)(`path`,{d:`M6 5.5l2 5-2 5`}),(0,m.jsx)(`path`,{d:`M10 5.5l2 5-2 5`})]})}function x(){return(0,m.jsxs)(g,{children:[(0,m.jsx)(`path`,{d:`M6 4L2.5 8L6 12`}),(0,m.jsx)(`path`,{d:`M10 4l3.5 4L10 12`}),(0,m.jsx)(`path`,{d:`M8.75 3.5L7.25 12.5`})]})}function S(){return(0,m.jsxs)(g,{children:[(0,m.jsx)(`path`,{d:`M2 3h12v2H2V3z`}),(0,m.jsx)(`path`,{d:`M2 7h12v1H2V7z`}),(0,m.jsx)(`path`,{d:`M2 11h12v1H2v-1z`}),(0,m.jsx)(`path`,{d:`M2 15h12v1H2v-1z`}),(0,m.jsx)(`path`,{d:`M2 4v11`}),(0,m.jsx)(`path`,{d:`M6 4v11`}),(0,m.jsx)(`path`,{d:`M10 4v11`}),(0,m.jsx)(`path`,{d:`M14 4v11`})]})}function C({label:e,ariaLabel:t,active:n,onClick:r}){return(0,m.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 w({editor:e}){return e?(0,m.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,m.jsx)(C,{label:(0,m.jsx)(`span`,{className:`text-base leading-none`,children:`¶`}),ariaLabel:`Paragraph`,active:e.isActive(`paragraph`),onClick:()=>e.chain().focus().setParagraph().run()}),(0,m.jsx)(C,{label:(0,m.jsx)(`strong`,{className:`text-sm font-semibold`,children:`B`}),ariaLabel:`Bold`,active:e.isActive(`bold`),onClick:()=>e.chain().focus().toggleBold().run()}),(0,m.jsx)(C,{label:(0,m.jsx)(`em`,{className:`text-sm`,children:`I`}),ariaLabel:`Italic`,active:e.isActive(`italic`),onClick:()=>e.chain().focus().toggleItalic().run()}),(0,m.jsx)(C,{label:(0,m.jsx)(_,{}),ariaLabel:`Bullet list`,active:e.isActive(`bulletList`),onClick:()=>e.chain().focus().toggleBulletList().run()}),(0,m.jsx)(C,{label:(0,m.jsx)(`span`,{className:`text-sm font-semibold`,children:`1.`}),ariaLabel:`Numbered list`,active:e.isActive(`orderedList`),onClick:()=>e.chain().focus().toggleOrderedList().run()}),(0,m.jsx)(C,{label:(0,m.jsx)(v,{}),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,m.jsx)(C,{label:(0,m.jsx)(y,{}),ariaLabel:`Quote`,active:e.isActive(`blockquote`),onClick:()=>e.chain().focus().toggleBlockquote().run()}),(0,m.jsx)(C,{label:(0,m.jsx)(b,{}),ariaLabel:`Inline code`,active:e.isActive(`code`),onClick:()=>e.chain().focus().toggleCode().run()}),(0,m.jsx)(C,{label:(0,m.jsx)(x,{}),ariaLabel:`Code block`,active:e.isActive(`codeBlock`),onClick:()=>e.chain().focus().toggleCodeBlock().run()}),(0,m.jsx)(C,{label:(0,m.jsx)(S,{}),ariaLabel:`Insert table`,active:e.isActive(`table`),onClick:()=>e.chain().focus().insertTable({rows:3,cols:3,withHeaderRow:!0}).run()})]}):null}function T({value:e,onChange:t,label:n,hint:r,id:a,contentKey:s}){let c=(0,p.useRef)(s),l=(0,p.useRef)(null),u=(0,p.useRef)(e),d=(0,p.useRef)(t);u.current=e,d.current=t;let g=o({key:s??`default`,immediatelyRender:!1,extensions:f(),content:e,contentType:`markdown`,editorProps:{attributes:{class:h}},onUpdate:({editor:e})=>{let t=e.getMarkdown?.()??``;l.current=t,t!==u.current&&d.current(t)}});return(0,p.useEffect)(()=>{if(g){if(s!==c.current){c.current=s,l.current=e,g.commands.setContent(e,!1,{contentType:`markdown`});return}e!==l.current&&(l.current=e,g.commands.setContent(e,!1,{contentType:`markdown`}))}},[s,e,g]),(0,m.jsxs)(`div`,{children:[n&&(0,m.jsx)(`label`,{htmlFor:a,className:`mb-2 block font-medium text-[var(--color-text-heading)]`,children:n}),(0,m.jsxs)(`div`,{className:`overflow-hidden rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface)]`,children:[(0,m.jsx)(w,{editor:g}),(0,m.jsx)(i,{editor:g})]}),r&&(0,m.jsx)(`p`,{className:`mt-2 text-sm text-[var(--color-text-muted)]`,children:r})]})}export{T as t};
|