@agimon-ai/po-grep 0.0.0-alpha.21 → 0.0.0-alpha.23
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.
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import { defineNativePlugin, defineToolRenderer } from "@agimon-ai/po-core/native";
|
|
2
|
+
import { View } from "react-native-unistyles/components/native/View";
|
|
3
|
+
import { Text } from "react-native-unistyles/components/native/Text";
|
|
4
|
+
import { HashlineLines, MessageItem, MessageItemBody, MessageItemHeader, MessageItemStatus, fontOf, hashlineBody, resultTextLines, toolTone } from "@agimon-ai/po-native-components";
|
|
5
|
+
import { StyleSheet } from "react-native-unistyles";
|
|
6
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
//#region src/extensions/workspaces/sessions/(frontend)/tool/_lib/grepToolView.ts
|
|
8
|
+
/** What the grep call heading shows: the pattern, then where and how it searched. */
|
|
9
|
+
function grepCallView(args) {
|
|
10
|
+
const limit = typeof args.limit === "number" && Number.isFinite(args.limit) ? args.limit : void 0;
|
|
11
|
+
return {
|
|
12
|
+
pattern: typeof args.pattern === "string" ? args.pattern : "",
|
|
13
|
+
details: [
|
|
14
|
+
typeof args.path === "string" && args.path.length > 0 ? args.path : ".",
|
|
15
|
+
typeof args.glob === "string" ? args.glob : void 0,
|
|
16
|
+
args.ignoreCase === true ? "ignore case" : void 0,
|
|
17
|
+
limit === void 0 ? void 0 : `${limit} matches`
|
|
18
|
+
].filter((value) => value !== void 0 && value.length > 0)
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
//#endregion
|
|
22
|
+
//#region src/extensions/workspaces/sessions/(frontend)/tool/_components/GrepToolMessage.native.tsx
|
|
23
|
+
/**
|
|
24
|
+
* The grep tool's timeline item on native, as the web's GrepToolMessage: the
|
|
25
|
+
* call summary in the header and, once expanded, the anchored matches with a
|
|
26
|
+
* line-number gutter, or the tool's message in red when the search failed.
|
|
27
|
+
*/
|
|
28
|
+
function GrepToolMessage({ args, result, output, running, isError }) {
|
|
29
|
+
const view = grepCallView(args);
|
|
30
|
+
const body = result === null || isError ? null : hashlineBody(result, output, "grep", true);
|
|
31
|
+
return /* @__PURE__ */ jsx(MessageItem, {
|
|
32
|
+
tone: toolTone({
|
|
33
|
+
running,
|
|
34
|
+
isError
|
|
35
|
+
}),
|
|
36
|
+
expandable: true,
|
|
37
|
+
defaultExpanded: false,
|
|
38
|
+
children: ({ expanded }) => /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(MessageItemHeader, {
|
|
39
|
+
title: "grep",
|
|
40
|
+
children: /* @__PURE__ */ jsxs(View, {
|
|
41
|
+
testID: "tool-call-grep",
|
|
42
|
+
style: styles.summary,
|
|
43
|
+
children: [/* @__PURE__ */ jsx(Text, {
|
|
44
|
+
numberOfLines: 1,
|
|
45
|
+
style: [styles.sans, styles.pattern],
|
|
46
|
+
children: view.pattern
|
|
47
|
+
}), view.details.length > 0 ? /* @__PURE__ */ jsxs(Text, {
|
|
48
|
+
numberOfLines: 1,
|
|
49
|
+
style: [styles.sans, styles.detail],
|
|
50
|
+
children: ["· ", view.details.join(" · ")]
|
|
51
|
+
}) : null]
|
|
52
|
+
})
|
|
53
|
+
}), expanded ? isError ? /* @__PURE__ */ jsxs(MessageItemBody, {
|
|
54
|
+
testID: "tool-result-grep",
|
|
55
|
+
children: [/* @__PURE__ */ jsx(MessageItemStatus, {
|
|
56
|
+
tone: "error",
|
|
57
|
+
children: "failed"
|
|
58
|
+
}), resultTextLines(result, output).map((line, index) => /* @__PURE__ */ jsx(Text, {
|
|
59
|
+
selectable: true,
|
|
60
|
+
style: [styles.sans, styles.error],
|
|
61
|
+
children: line
|
|
62
|
+
}, `${String(index)}-${line}`))]
|
|
63
|
+
}) : body === null ? running ? /* @__PURE__ */ jsx(MessageItemBody, {
|
|
64
|
+
testID: "tool-result-grep",
|
|
65
|
+
children: /* @__PURE__ */ jsx(MessageItemStatus, {
|
|
66
|
+
tone: "running",
|
|
67
|
+
children: "running"
|
|
68
|
+
})
|
|
69
|
+
}) : null : body.shown.length === 0 && body.notice === void 0 ? null : /* @__PURE__ */ jsxs(MessageItemBody, {
|
|
70
|
+
testID: "tool-result-grep",
|
|
71
|
+
children: [/* @__PURE__ */ jsx(HashlineLines, {
|
|
72
|
+
lines: body.shown,
|
|
73
|
+
gutter: body.gutter
|
|
74
|
+
}), body.notice !== void 0 ? /* @__PURE__ */ jsx(Text, {
|
|
75
|
+
style: [styles.sans, styles.detail],
|
|
76
|
+
children: body.notice
|
|
77
|
+
}) : null]
|
|
78
|
+
}) : null] })
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
const styles = StyleSheet.create((theme) => ({
|
|
82
|
+
summary: {
|
|
83
|
+
flex: 1,
|
|
84
|
+
flexDirection: "row",
|
|
85
|
+
alignItems: "center",
|
|
86
|
+
gap: theme.spacing(2),
|
|
87
|
+
minWidth: 0,
|
|
88
|
+
uni__dependencies: [0]
|
|
89
|
+
},
|
|
90
|
+
sans: {
|
|
91
|
+
fontFamily: fontOf(theme.fontFamily.sans),
|
|
92
|
+
fontSize: theme.fontSize.base,
|
|
93
|
+
lineHeight: theme.lineHeight.base,
|
|
94
|
+
uni__dependencies: [0]
|
|
95
|
+
},
|
|
96
|
+
pattern: {
|
|
97
|
+
flexShrink: 1,
|
|
98
|
+
color: theme.colors.text,
|
|
99
|
+
uni__dependencies: [0]
|
|
100
|
+
},
|
|
101
|
+
detail: {
|
|
102
|
+
flexShrink: 1,
|
|
103
|
+
color: theme.colors.faint,
|
|
104
|
+
uni__dependencies: [0]
|
|
105
|
+
},
|
|
106
|
+
error: {
|
|
107
|
+
color: theme.colors.red,
|
|
108
|
+
uni__dependencies: [0]
|
|
109
|
+
}
|
|
110
|
+
}));
|
|
111
|
+
//#endregion
|
|
112
|
+
//#region src/extensions/workspaces/sessions/(frontend)/tool/grep.native.tsx
|
|
113
|
+
var grep_native_default = defineToolRenderer({ message: GrepToolMessage });
|
|
114
|
+
//#endregion
|
|
115
|
+
//#region generated/native.ts
|
|
116
|
+
const via = (identity, value) => value === void 0 ? void 0 : {
|
|
117
|
+
...identity,
|
|
118
|
+
...value
|
|
119
|
+
};
|
|
120
|
+
const nativePlugin = defineNativePlugin({
|
|
121
|
+
id: "grep",
|
|
122
|
+
session: { get toolRenderers() {
|
|
123
|
+
return [via({ tools: ["grep"] }, grep_native_default)];
|
|
124
|
+
} }
|
|
125
|
+
});
|
|
126
|
+
//#endregion
|
|
127
|
+
export { nativePlugin };
|
|
128
|
+
|
|
129
|
+
//# sourceMappingURL=native.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"native.mjs","names":["ToolMessageRenderProps","fontOf","HashlineLines","hashlineBody","MessageItem","MessageItemBody","MessageItemHeader","MessageItemStatus","resultTextLines","toolTone","PoNativeTheme","StyleSheet","grepCallView","GrepToolMessage","args","result","output","running","isError","view","body","expanded","styles","summary","sans","pattern","details","length","detail","join","map","line","index","String","error","shown","notice","undefined","gutter","create","theme","flex","flexDirection","alignItems","gap","spacing","minWidth","uni__dependencies","fontFamily","fontSize","base","lineHeight","flexShrink","color","colors","text","faint","red","toolGrep"],"sources":["../../src/extensions/workspaces/sessions/(frontend)/tool/_lib/grepToolView.ts","../../src/extensions/workspaces/sessions/(frontend)/tool/_components/GrepToolMessage.native.tsx","../../src/extensions/workspaces/sessions/(frontend)/tool/grep.native.tsx","../../generated/native.ts"],"sourcesContent":["// Imports nothing at runtime: the web and native cards share it, and the native\n// bundle may not load the web component library.\n\nexport interface GrepCallView {\n readonly pattern: string;\n /** Search path, glob, case flag, and limit, as the TUI's call heading lists them. */\n readonly details: readonly string[];\n}\n\n/** What the grep call heading shows: the pattern, then where and how it searched. */\nexport function grepCallView(args: Readonly<Record<string, unknown>>): GrepCallView {\n const limit = typeof args.limit === 'number' && Number.isFinite(args.limit) ? args.limit : undefined;\n return {\n pattern: typeof args.pattern === 'string' ? args.pattern : '',\n details: [\n typeof args.path === 'string' && args.path.length > 0 ? args.path : '.',\n typeof args.glob === 'string' ? args.glob : undefined,\n args.ignoreCase === true ? 'ignore case' : undefined,\n limit === undefined ? undefined : `${limit} matches`,\n ].filter((value): value is string => value !== undefined && value.length > 0),\n };\n}\n","import type { ToolMessageRenderProps } from '@agimon-ai/po-core/native';\nimport {\n fontOf,\n HashlineLines,\n hashlineBody,\n MessageItem,\n MessageItemBody,\n MessageItemHeader,\n MessageItemStatus,\n resultTextLines,\n toolTone,\n} from '@agimon-ai/po-native-components';\nimport type { PoNativeTheme } from '@agimon-ai/po-web-components/nativeTheme';\nimport { Text, View } from 'react-native';\nimport { StyleSheet } from 'react-native-unistyles';\n\nimport { grepCallView } from '../_lib/grepToolView';\n\n/**\n * The grep tool's timeline item on native, as the web's GrepToolMessage: the\n * call summary in the header and, once expanded, the anchored matches with a\n * line-number gutter, or the tool's message in red when the search failed.\n */\nexport function GrepToolMessage({ args, result, output, running, isError }: ToolMessageRenderProps) {\n const view = grepCallView(args);\n const body = result === null || isError ? null : hashlineBody(result, output, 'grep', true);\n return (\n <MessageItem tone={toolTone({ running, isError })} expandable defaultExpanded={false}>\n {({ expanded }) => (\n <>\n <MessageItemHeader title=\"grep\">\n <View testID=\"tool-call-grep\" style={styles.summary}>\n <Text numberOfLines={1} style={[styles.sans, styles.pattern]}>\n {view.pattern}\n </Text>\n {view.details.length > 0 ? (\n <Text numberOfLines={1} style={[styles.sans, styles.detail]}>\n · {view.details.join(' · ')}\n </Text>\n ) : null}\n </View>\n </MessageItemHeader>\n {expanded ? (\n isError ? (\n <MessageItemBody testID=\"tool-result-grep\">\n <MessageItemStatus tone=\"error\">failed</MessageItemStatus>\n {resultTextLines(result, output).map((line, index) => (\n <Text key={`${String(index)}-${line}`} selectable style={[styles.sans, styles.error]}>\n {line}\n </Text>\n ))}\n </MessageItemBody>\n ) : body === null ? (\n running ? (\n <MessageItemBody testID=\"tool-result-grep\">\n <MessageItemStatus tone=\"running\">running</MessageItemStatus>\n </MessageItemBody>\n ) : null\n ) : body.shown.length === 0 && body.notice === undefined ? null : (\n <MessageItemBody testID=\"tool-result-grep\">\n <HashlineLines lines={body.shown} gutter={body.gutter} />\n {body.notice !== undefined ? <Text style={[styles.sans, styles.detail]}>{body.notice}</Text> : null}\n </MessageItemBody>\n )\n ) : null}\n </>\n )}\n </MessageItem>\n );\n}\n\nconst styles = StyleSheet.create((theme: PoNativeTheme) => ({\n summary: { flex: 1, flexDirection: 'row', alignItems: 'center', gap: theme.spacing(2), minWidth: 0 },\n sans: {\n fontFamily: fontOf(theme.fontFamily.sans),\n fontSize: theme.fontSize.base,\n lineHeight: theme.lineHeight.base,\n },\n // Both shrink: a phone is narrower than the web card, and a pattern cut to\n // nothing by a long path reads worse than both cut short.\n pattern: { flexShrink: 1, color: theme.colors.text },\n detail: { flexShrink: 1, color: theme.colors.faint },\n error: { color: theme.colors.red },\n}));\n","import { defineToolRenderer } from '@agimon-ai/po-core/native';\n\nimport { GrepToolMessage } from './_components/GrepToolMessage.native';\n\nexport default defineToolRenderer({ message: GrepToolMessage });\n","// Generated by @agimon-ai/po-build. Do not edit by hand.\nimport { defineNativePlugin, type WebPluginContributions } from '@agimon-ai/po-core/native';\n\nimport toolGrep from '../src/extensions/workspaces/sessions/(frontend)/tool/grep.native';\n\nconst via = <T>(identity: Record<string, unknown>, value: unknown): T =>\n (value === undefined ? undefined : { ...identity, ...(value as object) }) as T;\n\nexport const nativePlugin = defineNativePlugin({\n id: 'grep',\n session: {\n get toolRenderers(): WebPluginContributions['toolRenderers'] { return [via({ tools: ['grep'] }, toolGrep)]; },\n },\n});\n"],"mappings":";;;;;;;;AAUA,SAAgB,aAAa,MAAuD;CAClF,MAAM,QAAQ,OAAO,KAAK,UAAU,YAAY,OAAO,SAAS,KAAK,KAAK,IAAI,KAAK,QAAQ,KAAA;CAC3F,OAAO;EACL,SAAS,OAAO,KAAK,YAAY,WAAW,KAAK,UAAU;EAC3D,SAAS;GACP,OAAO,KA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C;AACnC,EAAE;;;AC/EF,IAAA,sBAAe,mBAAmB,EAAE,SAAS,gBAAgB,CAAC;;;ACC9D,MAAM,OAAU,UAAmC,UAChD,UAAU,KAAA,IAAY,KAAA,IAAY;CAAE,GAAG;CAAU,GAAI;AAAiB;AAEzE,MAAa,eAAe,mBAAmB;CAC7C,IAAI;CACJ,SAAS,EACP,IAAI,gBAAyD;EAAE,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,MAAM,EAAE,GAAGW,mBAAQ,CAAC;CAAG,EAC9G;AACF,CAAC"}
|
package/dist/extensions/web.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { defineToolRenderer, defineWebPlugin } from "@agimon-ai/po-core/web";
|
|
2
|
-
import { HashlineLines, MessageItem, MessageItemBody, MessageItemHeader, MessageItemStatus,
|
|
2
|
+
import { HashlineLines, MessageItem, MessageItemBody, MessageItemHeader, MessageItemStatus, hashlineBody, resultTextLines, toolTone } from "@agimon-ai/po-web-components";
|
|
3
3
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
4
4
|
//#region src/extensions/workspaces/sessions/(frontend)/tool/_lib/grepToolView.ts
|
|
5
5
|
/** What the grep call heading shows: the pattern, then where and how it searched. */
|
|
@@ -7,12 +7,12 @@ function grepCallView(args) {
|
|
|
7
7
|
const limit = typeof args.limit === "number" && Number.isFinite(args.limit) ? args.limit : void 0;
|
|
8
8
|
return {
|
|
9
9
|
pattern: typeof args.pattern === "string" ? args.pattern : "",
|
|
10
|
-
details:
|
|
10
|
+
details: [
|
|
11
11
|
typeof args.path === "string" && args.path.length > 0 ? args.path : ".",
|
|
12
12
|
typeof args.glob === "string" ? args.glob : void 0,
|
|
13
13
|
args.ignoreCase === true ? "ignore case" : void 0,
|
|
14
14
|
limit === void 0 ? void 0 : `${limit} matches`
|
|
15
|
-
])
|
|
15
|
+
].filter((value) => value !== void 0 && value.length > 0)
|
|
16
16
|
};
|
|
17
17
|
}
|
|
18
18
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"web.mjs","names":["toolGrep"],"sources":["../../src/extensions/workspaces/sessions/(frontend)/tool/_lib/grepToolView.ts","../../src/extensions/workspaces/sessions/(frontend)/tool/_components/GrepToolMessage.tsx","../../src/extensions/workspaces/sessions/(frontend)/tool/grep.web.tsx","../../generated/web.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"web.mjs","names":["toolGrep"],"sources":["../../src/extensions/workspaces/sessions/(frontend)/tool/_lib/grepToolView.ts","../../src/extensions/workspaces/sessions/(frontend)/tool/_components/GrepToolMessage.tsx","../../src/extensions/workspaces/sessions/(frontend)/tool/grep.web.tsx","../../generated/web.ts"],"sourcesContent":["// Imports nothing at runtime: the web and native cards share it, and the native\n// bundle may not load the web component library.\n\nexport interface GrepCallView {\n readonly pattern: string;\n /** Search path, glob, case flag, and limit, as the TUI's call heading lists them. */\n readonly details: readonly string[];\n}\n\n/** What the grep call heading shows: the pattern, then where and how it searched. */\nexport function grepCallView(args: Readonly<Record<string, unknown>>): GrepCallView {\n const limit = typeof args.limit === 'number' && Number.isFinite(args.limit) ? args.limit : undefined;\n return {\n pattern: typeof args.pattern === 'string' ? args.pattern : '',\n details: [\n typeof args.path === 'string' && args.path.length > 0 ? args.path : '.',\n typeof args.glob === 'string' ? args.glob : undefined,\n args.ignoreCase === true ? 'ignore case' : undefined,\n limit === undefined ? undefined : `${limit} matches`,\n ].filter((value): value is string => value !== undefined && value.length > 0),\n };\n}\n","import type { ToolMessageRenderProps } from '@agimon-ai/po-core/web';\nimport {\n HashlineLines,\n hashlineBody,\n MessageItem,\n MessageItemBody,\n MessageItemHeader,\n MessageItemStatus,\n resultTextLines,\n toolTone,\n} from '@agimon-ai/po-web-components';\n\nimport { grepCallView } from '../_lib/grepToolView';\n\n/**\n * The grep tool's timeline item, the web half of its renderCall and\n * renderResult: the call summary in the header and, when expanded, the\n * anchored matches with a line-number gutter in the body. A failure shows the\n * tool's message in red inside the expanded body instead.\n */\nexport function GrepToolMessage({ args, result, output, running, isError }: ToolMessageRenderProps) {\n const view = grepCallView(args);\n const body = result === null || isError ? null : hashlineBody(result, output, 'grep', true);\n return (\n <MessageItem tone={toolTone({ running, isError })} expandable defaultExpanded={false}>\n {({ expanded }) => {\n return (\n <>\n <MessageItemHeader title=\"grep\">\n <span data-testid=\"tool-call-grep\" className=\"flex min-w-0 flex-1 items-center gap-2\">\n <span className=\"truncate text-po-text\">{view.pattern}</span>\n {view.details.length > 0 ? (\n <span className=\"shrink-0 text-po-faint\">· {view.details.join(' · ')}</span>\n ) : null}\n </span>\n </MessageItemHeader>\n {expanded ? (\n isError ? (\n <MessageItemBody data-testid=\"tool-result-grep\" className=\"flex flex-col\">\n <MessageItemStatus tone=\"error\">failed</MessageItemStatus>\n {resultTextLines(result, output).map((line, index) => (\n <span key={`${String(index)}-${line}`} className=\"whitespace-pre-wrap break-words text-po-red\">\n {line}\n </span>\n ))}\n </MessageItemBody>\n ) : body === null ? (\n running ? (\n <MessageItemBody data-testid=\"tool-result-grep\">\n <MessageItemStatus tone=\"running\">running</MessageItemStatus>\n </MessageItemBody>\n ) : null\n ) : body.shown.length === 0 && body.notice === undefined ? null : (\n <MessageItemBody data-testid=\"tool-result-grep\" className=\"flex flex-col gap-1\">\n <HashlineLines lines={body.shown} gutter={body.gutter} />\n {body.notice !== undefined ? <span className=\"text-po-faint\">{body.notice}</span> : null}\n </MessageItemBody>\n )\n ) : null}\n </>\n );\n }}\n </MessageItem>\n );\n}\n","import { defineToolRenderer } from '@agimon-ai/po-core/web';\n\nimport { GrepToolMessage } from './_components/GrepToolMessage';\n\n/**\n * The grep tool's timeline card, the web half of the TUI's renderCall and\n * renderResult for hashline searches. The filename binds it to the tool.\n */\nexport default defineToolRenderer({ message: GrepToolMessage });\n","// Generated by @agimon-ai/po-build. Do not edit by hand.\nimport { defineWebPlugin, type WebPluginContributions } from '@agimon-ai/po-core/web';\n\nimport toolGrep from '../src/extensions/workspaces/sessions/(frontend)/tool/grep.web';\n\nconst via = <T>(identity: Record<string, unknown>, value: unknown): T =>\n (value === undefined ? undefined : { ...identity, ...(value as object) }) as T;\n\nexport const webPlugin = defineWebPlugin({\n id: 'grep',\n session: {\n get toolRenderers(): WebPluginContributions['toolRenderers'] { return [via({ tools: ['grep'] }, toolGrep)]; },\n },\n});\n"],"mappings":";;;;;AAUA,SAAgB,aAAa,MAAuD;CAClF,MAAM,QAAQ,OAAO,KAAK,UAAU,YAAY,OAAO,SAAS,KAAK,KAAK,IAAI,KAAK,QAAQ,KAAA;CAC3F,OAAO;EACL,SAAS,OAAO,KAAK,YAAY,WAAW,KAAK,UAAU;EAC3D,SAAS;GACP,OAAO,KAAK,SAAS,YAAY,KAAK,KAAK,SAAS,IAAI,KAAK,OAAO;GACpE,OAAO,KAAK,SAAS,WAAW,KAAK,OAAO,KAAA;GAC5C,KAAK,eAAe,OAAO,gBAAgB,KAAA;GAC3C,UAAU,KAAA,IAAY,KAAA,IAAY,GAAG,MAAM;EAC7C,CAAC,CAAC,QAAQ,UAA2B,UAAU,KAAA,KAAa,MAAM,SAAS,CAAC;CAC9E;AACF;;;;;;;;;ACDA,SAAgB,gBAAgB,EAAE,MAAM,QAAQ,QAAQ,SAAS,WAAmC;CAClG,MAAM,OAAO,aAAa,IAAI;CAC9B,MAAM,OAAO,WAAW,QAAQ,UAAU,OAAO,aAAa,QAAQ,QAAQ,QAAQ,IAAI;CAC1F,OACE,oBAAC,aAAD;EAAa,MAAM,SAAS;GAAE;GAAS;EAAQ,CAAC;EAAG,YAAA;EAAW,iBAAiB;EAC3E,WAAA,EAAE,eAAe;GACjB,OACE,qBAAA,UAAA,EAAA,UAAA,CACE,oBAAC,mBAAD;IAAmB,OAAM;IACvB,UAAA,qBAAC,QAAD;KAAM,eAAY;KAAiB,WAAU;KAA7C,UAAA,CACE,oBAAC,QAAD;MAAM,WAAU;MAAyB,UAAA,KAAK;KAAc,CAAA,GAC3D,KAAK,QAAQ,SAAS,IACrB,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HANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agimon-ai/po-grep",
|
|
3
|
-
"version": "0.0.0-alpha.
|
|
3
|
+
"version": "0.0.0-alpha.23",
|
|
4
4
|
"description": "Snapshot-bound hashline grep for Pi and Po.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ai",
|
|
@@ -43,6 +43,9 @@
|
|
|
43
43
|
"import": "./dist/apiContracts.mjs",
|
|
44
44
|
"require": "./dist/apiContracts.cjs"
|
|
45
45
|
},
|
|
46
|
+
"./extensions/native": {
|
|
47
|
+
"import": "./dist/extensions/native.mjs"
|
|
48
|
+
},
|
|
46
49
|
"./extensions/server": {
|
|
47
50
|
"types": "./dist/extensions/server.d.mts",
|
|
48
51
|
"import": "./dist/extensions/server.mjs",
|
|
@@ -57,15 +60,16 @@
|
|
|
57
60
|
"access": "public"
|
|
58
61
|
},
|
|
59
62
|
"dependencies": {
|
|
60
|
-
"@agimon-ai/po-core": "0.0.0-alpha.
|
|
61
|
-
"@agimon-ai/po-hashline": "0.0.0-alpha.
|
|
62
|
-
"@agimon-ai/po-ui": "0.0.0-alpha.
|
|
63
|
-
"@agimon-ai/po-web-components": "0.0.0-alpha.
|
|
63
|
+
"@agimon-ai/po-core": "0.0.0-alpha.23",
|
|
64
|
+
"@agimon-ai/po-hashline": "0.0.0-alpha.23",
|
|
65
|
+
"@agimon-ai/po-ui": "0.0.0-alpha.23",
|
|
66
|
+
"@agimon-ai/po-web-components": "0.0.0-alpha.23",
|
|
64
67
|
"@deepseek-ai/cordis": "4.0.5",
|
|
65
68
|
"typebox": "1.3.37"
|
|
66
69
|
},
|
|
67
70
|
"devDependencies": {
|
|
68
|
-
"@agimon-ai/po-build": "0.0.0-alpha.
|
|
71
|
+
"@agimon-ai/po-build": "0.0.0-alpha.23",
|
|
72
|
+
"@agimon-ai/po-native-components": "0.0.0-alpha.23",
|
|
69
73
|
"@earendil-works/pi-coding-agent": "1.3.0",
|
|
70
74
|
"@tanstack/react-store": "0.11.2",
|
|
71
75
|
"@tanstack/store": "0.11.2",
|
|
@@ -75,16 +79,30 @@
|
|
|
75
79
|
"@vscode/ripgrep": "1.18.0",
|
|
76
80
|
"react": "19.3.0",
|
|
77
81
|
"react-dom": "19.3.0",
|
|
82
|
+
"react-native": "0.86.3",
|
|
83
|
+
"react-native-unistyles": "3.5.3",
|
|
78
84
|
"tsdown": "0.23.1",
|
|
79
85
|
"typescript": "7.0.2",
|
|
80
86
|
"vitest": "5.0.4"
|
|
81
87
|
},
|
|
82
88
|
"peerDependencies": {
|
|
83
|
-
"@
|
|
89
|
+
"@agimon-ai/po-native-components": "0.0.0-alpha.23",
|
|
90
|
+
"@earendil-works/pi-coding-agent": "1.3.0",
|
|
91
|
+
"react-native": "0.86.3",
|
|
92
|
+
"react-native-unistyles": "^3.5.3"
|
|
84
93
|
},
|
|
85
94
|
"peerDependenciesMeta": {
|
|
86
95
|
"@earendil-works/pi-coding-agent": {
|
|
87
96
|
"optional": true
|
|
97
|
+
},
|
|
98
|
+
"@agimon-ai/po-native-components": {
|
|
99
|
+
"optional": true
|
|
100
|
+
},
|
|
101
|
+
"react-native": {
|
|
102
|
+
"optional": true
|
|
103
|
+
},
|
|
104
|
+
"react-native-unistyles": {
|
|
105
|
+
"optional": true
|
|
88
106
|
}
|
|
89
107
|
},
|
|
90
108
|
"engines": {
|
|
@@ -104,6 +122,14 @@
|
|
|
104
122
|
]
|
|
105
123
|
}
|
|
106
124
|
},
|
|
125
|
+
"poNative": {
|
|
126
|
+
"pluginId": "grep",
|
|
127
|
+
"channels": [],
|
|
128
|
+
"client": "./dist/extensions/native.mjs",
|
|
129
|
+
"scopes": [
|
|
130
|
+
"session"
|
|
131
|
+
]
|
|
132
|
+
},
|
|
107
133
|
"poServer": {
|
|
108
134
|
"entry": "./generated/server.ts",
|
|
109
135
|
"dist": "./dist/extensions/server.mjs",
|
|
@@ -127,7 +153,7 @@
|
|
|
127
153
|
"build": "tsdown && tsdown --config tsdown.mcp.config.ts",
|
|
128
154
|
"build:mcp": "tsdown --config tsdown.mcp.config.ts",
|
|
129
155
|
"test": "vitest --run",
|
|
130
|
-
"typecheck": "tsc --noEmit && tsc --noEmit -p tsconfig.web.json && tsc --noEmit -p tsconfig.mcp.json",
|
|
156
|
+
"typecheck": "tsc --noEmit && tsc --noEmit -p tsconfig.web.json && tsc --noEmit -p tsconfig.native.json && tsc --noEmit -p tsconfig.mcp.json",
|
|
131
157
|
"lint": "oxlint . && oxfmt . --check",
|
|
132
158
|
"fixcode": "oxlint . --fix && oxfmt ."
|
|
133
159
|
}
|