@outlit/pi 0.1.6 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -7
- package/dist/extension.cjs +11 -4
- package/dist/extension.cjs.map +1 -1
- package/dist/extension.js +19 -11
- package/dist/extension.js.map +1 -1
- package/dist/index.cjs +19 -12
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +10 -7
- package/dist/index.d.ts +10 -7
- package/dist/index.js +23 -15
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/skills/outlit/SKILL.md +1 -0
package/README.md
CHANGED
|
@@ -28,18 +28,18 @@ The default extension registers the default customer intelligence tools from `@o
|
|
|
28
28
|
- `outlit_list_facts`
|
|
29
29
|
- `outlit_get_fact`
|
|
30
30
|
- `outlit_get_source`
|
|
31
|
+
- `outlit_list_sources`
|
|
31
32
|
- `outlit_search_customer_context`
|
|
32
|
-
- `outlit_send_notification`
|
|
33
33
|
|
|
34
|
-
SQL
|
|
34
|
+
SQL and the other Pi-supported Platform capabilities are available from `@outlit/tools`, but the default Pi policy intentionally stays focused on customer intelligence. A custom Pi extension can opt into every Pi-supported tool with `piToolNames`, including safe integration setup, destination, activation, and workspace-settings actions. Behavior Metric source discovery, event discovery, and creation; responsibility-only commands; and other internal commands are not available through Pi.
|
|
35
35
|
|
|
36
|
-
For analytical agents that need cohorts, usage trends, revenue filters, activation gaps, or aggregate checks, import `
|
|
36
|
+
For analytical agents that need cohorts, usage trends, revenue filters, activation gaps, or aggregate checks, import `analyticalToolNames`. It combines the default customer intelligence tools with `outlit_schema` and `outlit_query` without exposing every customer tool:
|
|
37
37
|
|
|
38
38
|
```ts
|
|
39
|
-
import {
|
|
39
|
+
import { analyticalToolNames, createOutlitPiExtension } from "@outlit/pi"
|
|
40
40
|
|
|
41
41
|
export default createOutlitPiExtension({
|
|
42
|
-
toolNames:
|
|
42
|
+
toolNames: analyticalToolNames,
|
|
43
43
|
})
|
|
44
44
|
```
|
|
45
45
|
|
|
@@ -60,10 +60,10 @@ The facts tool supports `factTypes` filters for narrowing structured customer-me
|
|
|
60
60
|
Create a small Pi extension when you want a narrower or broader toolset:
|
|
61
61
|
|
|
62
62
|
```ts
|
|
63
|
-
import {
|
|
63
|
+
import { createOutlitPiExtension, piToolNames } from "@outlit/pi"
|
|
64
64
|
|
|
65
65
|
export default createOutlitPiExtension({
|
|
66
|
-
toolNames:
|
|
66
|
+
toolNames: piToolNames,
|
|
67
67
|
})
|
|
68
68
|
```
|
|
69
69
|
|
package/dist/extension.cjs
CHANGED
|
@@ -29,6 +29,7 @@ var import_tools = require("@outlit/tools");
|
|
|
29
29
|
var import_tools2 = require("@outlit/tools");
|
|
30
30
|
var OUTLIT_API_KEY_ENV = "OUTLIT_API_KEY";
|
|
31
31
|
var OUTLIT_API_URL_ENV = "OUTLIT_API_URL";
|
|
32
|
+
var piToolNameSet = new Set(import_tools.piToolNames);
|
|
32
33
|
function createOutlitPiExtension(options = {}) {
|
|
33
34
|
return function outlitPiExtension(pi) {
|
|
34
35
|
for (const tool of createOutlitPiTools(options)) {
|
|
@@ -42,7 +43,13 @@ function createOutlitPiTools(options = {}) {
|
|
|
42
43
|
);
|
|
43
44
|
}
|
|
44
45
|
function createOutlitPiTool(toolName, options = {}) {
|
|
45
|
-
|
|
46
|
+
if (!(0, import_tools.isPublicToolName)(toolName)) {
|
|
47
|
+
throw new Error(`Unknown Outlit public tool: ${toolName}`);
|
|
48
|
+
}
|
|
49
|
+
if (!piToolNameSet.has(toolName)) {
|
|
50
|
+
throw new Error(`Tool is not available in @outlit/pi: ${toolName}`);
|
|
51
|
+
}
|
|
52
|
+
const contract = (0, import_tools.getPublicToolContract)(toolName);
|
|
46
53
|
const label = formatOutlitToolLabel(toolName);
|
|
47
54
|
return {
|
|
48
55
|
name: toolName,
|
|
@@ -72,10 +79,10 @@ function formatOutlitToolLabel(toolName) {
|
|
|
72
79
|
return toolName.split("_").map((part) => part.charAt(0).toUpperCase() + part.slice(1)).join(" ");
|
|
73
80
|
}
|
|
74
81
|
function resolveToolNames(toolNames) {
|
|
75
|
-
const names = toolNames ?? import_tools.
|
|
82
|
+
const names = toolNames ?? import_tools.defaultToolNames;
|
|
76
83
|
return [...new Set(names)].map((name) => {
|
|
77
|
-
if (!(0, import_tools.
|
|
78
|
-
throw new Error(`Unknown Outlit
|
|
84
|
+
if (!(0, import_tools.isPublicToolName)(name)) {
|
|
85
|
+
throw new Error(`Unknown Outlit public tool: ${name}`);
|
|
79
86
|
}
|
|
80
87
|
return name;
|
|
81
88
|
});
|
package/dist/extension.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/extension.ts","../src/index.ts"],"sourcesContent":["import { createOutlitPiExtension } from \"./index.js\"\n\nexport default createOutlitPiExtension()\n","import type { AgentToolResult, ExtensionAPI, ToolDefinition } from \"@mariozechner/pi-coding-agent\"\nimport {\n
|
|
1
|
+
{"version":3,"sources":["../src/extension.ts","../src/index.ts"],"sourcesContent":["import { createOutlitPiExtension } from \"./index.js\"\n\nexport default createOutlitPiExtension()\n","import type { AgentToolResult, ExtensionAPI, ToolDefinition } from \"@mariozechner/pi-coding-agent\"\nimport {\n createOutlitClient,\n DEFAULT_OUTLIT_API_URL,\n defaultToolNames,\n getPublicToolContract,\n isPublicToolName,\n type OutlitToolsFetch,\n type PiToolName,\n piToolNames,\n} from \"@outlit/tools\"\nimport type { TSchema } from \"@sinclair/typebox\"\n\nexport const OUTLIT_API_KEY_ENV = \"OUTLIT_API_KEY\"\nexport const OUTLIT_API_URL_ENV = \"OUTLIT_API_URL\"\n\nconst piToolNameSet = new Set<string>(piToolNames)\n\nexport type OutlitPiExtensionOptions = {\n apiKey?: string\n baseUrl?: string\n fetch?: OutlitToolsFetch\n toolNames?: readonly PiToolName[]\n}\n\nexport type OutlitPiRegistry = Pick<ExtensionAPI, \"registerTool\">\n\nexport type OutlitPiToolDetails = {\n toolName: PiToolName\n result: unknown\n}\n\nexport type OutlitPiToolDefinition = ToolDefinition<TSchema, OutlitPiToolDetails>\n\nexport function createOutlitPiExtension(options: OutlitPiExtensionOptions = {}) {\n return function outlitPiExtension(pi: OutlitPiRegistry) {\n for (const tool of createOutlitPiTools(options)) {\n pi.registerTool(tool)\n }\n }\n}\n\nexport function createOutlitPiTools(\n options: OutlitPiExtensionOptions = {},\n): OutlitPiToolDefinition[] {\n return resolveToolNames(options.toolNames).map((toolName) =>\n createOutlitPiTool(toolName, options),\n )\n}\n\nexport function createOutlitPiTool(\n toolName: PiToolName,\n options: OutlitPiExtensionOptions = {},\n): OutlitPiToolDefinition {\n if (!isPublicToolName(toolName)) {\n throw new Error(`Unknown Outlit public tool: ${toolName}`)\n }\n if (!piToolNameSet.has(toolName)) {\n throw new Error(`Tool is not available in @outlit/pi: ${toolName}`)\n }\n\n const contract = getPublicToolContract(toolName)\n const label = formatOutlitToolLabel(toolName)\n\n return {\n name: toolName,\n label,\n description: contract.description,\n promptSnippet: `${label}: ${firstLine(contract.description)}`,\n parameters: toPiToolParameters(contract.inputSchema),\n async execute(_toolCallId, params) {\n const client = createOutlitClient({\n apiKey: resolveApiKey(options),\n baseUrl: resolveBaseUrl(options),\n fetch: options.fetch,\n })\n const result = await client.callTool(toolName, normalizeToolInput(params))\n\n return formatToolResult(toolName, result)\n },\n }\n}\n\nfunction toPiToolParameters(inputSchema: unknown): TSchema {\n if (inputSchema === null || typeof inputSchema !== \"object\" || Array.isArray(inputSchema)) {\n return inputSchema as TSchema\n }\n\n const { $schema: _schema, ...schema } = inputSchema as Record<string, unknown>\n return schema as unknown as TSchema\n}\n\nexport function formatOutlitToolLabel(toolName: PiToolName): string {\n return toolName\n .split(\"_\")\n .map((part) => part.charAt(0).toUpperCase() + part.slice(1))\n .join(\" \")\n}\n\nfunction resolveToolNames(toolNames: readonly PiToolName[] | undefined): PiToolName[] {\n const names = toolNames ?? defaultToolNames\n\n return [...new Set(names)].map((name) => {\n if (!isPublicToolName(name)) {\n throw new Error(`Unknown Outlit public tool: ${name}`)\n }\n\n return name\n })\n}\n\nfunction resolveApiKey(options: OutlitPiExtensionOptions): string {\n const apiKey = normalizeString(options.apiKey) ?? normalizeString(process.env[OUTLIT_API_KEY_ENV])\n\n if (!apiKey) {\n throw new Error(`${OUTLIT_API_KEY_ENV} is required to use @outlit/pi tools`)\n }\n\n return apiKey\n}\n\nfunction resolveBaseUrl(options: OutlitPiExtensionOptions): string {\n return (\n normalizeString(options.baseUrl) ??\n normalizeString(process.env[OUTLIT_API_URL_ENV]) ??\n DEFAULT_OUTLIT_API_URL\n )\n}\n\nfunction normalizeString(value: string | undefined): string | undefined {\n const trimmed = value?.trim()\n return trimmed ? trimmed : undefined\n}\n\nfunction normalizeToolInput(params: unknown): Record<string, unknown> {\n if (params === undefined) {\n return {}\n }\n\n if (params === null || typeof params !== \"object\" || Array.isArray(params)) {\n throw new TypeError(\"Outlit Pi tool input must be an object\")\n }\n\n return params as Record<string, unknown>\n}\n\nfunction formatToolResult(\n toolName: PiToolName,\n result: unknown,\n): AgentToolResult<OutlitPiToolDetails> {\n return {\n content: [{ type: \"text\", text: JSON.stringify(result, null, 2) ?? String(result) }],\n details: {\n toolName,\n result,\n },\n }\n}\n\nfunction firstLine(value: string): string {\n return value.split(\"\\n\", 1)[0] ?? value\n}\n\nexport type { PiToolName } from \"@outlit/tools\"\n/** @deprecated Use PiToolName. */\nexport type PublicToolName = PiToolName\nexport {\n analyticalToolNames,\n defaultToolNames,\n piToolNames,\n piToolNames as allPublicToolNames,\n sqlToolNames,\n} from \"@outlit/tools\"\n\nexport default createOutlitPiExtension()\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACCA,mBASO;AA4JP,IAAAA,gBAMO;AA/JA,IAAM,qBAAqB;AAC3B,IAAM,qBAAqB;AAElC,IAAM,gBAAgB,IAAI,IAAY,wBAAW;AAkB1C,SAAS,wBAAwB,UAAoC,CAAC,GAAG;AAC9E,SAAO,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AAA,EACF;AACF;AAEA,SAAS,UAAU,OAAuB;AACxC,SAAO,MAAM,MAAM,MAAM,CAAC,EAAE,CAAC,KAAK;AACpC;AAaA,IAAO,cAAQ,wBAAwB;;;AD5KvC,IAAO,oBAAQ,wBAAwB;","names":["import_tools"]}
|
package/dist/extension.js
CHANGED
|
@@ -2,19 +2,21 @@
|
|
|
2
2
|
import {
|
|
3
3
|
createOutlitClient,
|
|
4
4
|
DEFAULT_OUTLIT_API_URL,
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
defaultToolNames,
|
|
6
|
+
getPublicToolContract,
|
|
7
|
+
isPublicToolName,
|
|
8
|
+
piToolNames
|
|
8
9
|
} from "@outlit/tools";
|
|
9
10
|
import {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
analyticalToolNames,
|
|
12
|
+
defaultToolNames as defaultToolNames2,
|
|
13
|
+
piToolNames as piToolNames2,
|
|
14
|
+
piToolNames as piToolNames3,
|
|
14
15
|
sqlToolNames
|
|
15
16
|
} from "@outlit/tools";
|
|
16
17
|
var OUTLIT_API_KEY_ENV = "OUTLIT_API_KEY";
|
|
17
18
|
var OUTLIT_API_URL_ENV = "OUTLIT_API_URL";
|
|
19
|
+
var piToolNameSet = new Set(piToolNames);
|
|
18
20
|
function createOutlitPiExtension(options = {}) {
|
|
19
21
|
return function outlitPiExtension(pi) {
|
|
20
22
|
for (const tool of createOutlitPiTools(options)) {
|
|
@@ -28,7 +30,13 @@ function createOutlitPiTools(options = {}) {
|
|
|
28
30
|
);
|
|
29
31
|
}
|
|
30
32
|
function createOutlitPiTool(toolName, options = {}) {
|
|
31
|
-
|
|
33
|
+
if (!isPublicToolName(toolName)) {
|
|
34
|
+
throw new Error(`Unknown Outlit public tool: ${toolName}`);
|
|
35
|
+
}
|
|
36
|
+
if (!piToolNameSet.has(toolName)) {
|
|
37
|
+
throw new Error(`Tool is not available in @outlit/pi: ${toolName}`);
|
|
38
|
+
}
|
|
39
|
+
const contract = getPublicToolContract(toolName);
|
|
32
40
|
const label = formatOutlitToolLabel(toolName);
|
|
33
41
|
return {
|
|
34
42
|
name: toolName,
|
|
@@ -58,10 +66,10 @@ function formatOutlitToolLabel(toolName) {
|
|
|
58
66
|
return toolName.split("_").map((part) => part.charAt(0).toUpperCase() + part.slice(1)).join(" ");
|
|
59
67
|
}
|
|
60
68
|
function resolveToolNames(toolNames) {
|
|
61
|
-
const names = toolNames ??
|
|
69
|
+
const names = toolNames ?? defaultToolNames;
|
|
62
70
|
return [...new Set(names)].map((name) => {
|
|
63
|
-
if (!
|
|
64
|
-
throw new Error(`Unknown Outlit
|
|
71
|
+
if (!isPublicToolName(name)) {
|
|
72
|
+
throw new Error(`Unknown Outlit public tool: ${name}`);
|
|
65
73
|
}
|
|
66
74
|
return name;
|
|
67
75
|
});
|
package/dist/extension.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/extension.ts"],"sourcesContent":["import type { AgentToolResult, ExtensionAPI, ToolDefinition } from \"@mariozechner/pi-coding-agent\"\nimport {\n
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/extension.ts"],"sourcesContent":["import type { AgentToolResult, ExtensionAPI, ToolDefinition } from \"@mariozechner/pi-coding-agent\"\nimport {\n createOutlitClient,\n DEFAULT_OUTLIT_API_URL,\n defaultToolNames,\n getPublicToolContract,\n isPublicToolName,\n type OutlitToolsFetch,\n type PiToolName,\n piToolNames,\n} from \"@outlit/tools\"\nimport type { TSchema } from \"@sinclair/typebox\"\n\nexport const OUTLIT_API_KEY_ENV = \"OUTLIT_API_KEY\"\nexport const OUTLIT_API_URL_ENV = \"OUTLIT_API_URL\"\n\nconst piToolNameSet = new Set<string>(piToolNames)\n\nexport type OutlitPiExtensionOptions = {\n apiKey?: string\n baseUrl?: string\n fetch?: OutlitToolsFetch\n toolNames?: readonly PiToolName[]\n}\n\nexport type OutlitPiRegistry = Pick<ExtensionAPI, \"registerTool\">\n\nexport type OutlitPiToolDetails = {\n toolName: PiToolName\n result: unknown\n}\n\nexport type OutlitPiToolDefinition = ToolDefinition<TSchema, OutlitPiToolDetails>\n\nexport function createOutlitPiExtension(options: OutlitPiExtensionOptions = {}) {\n return function outlitPiExtension(pi: OutlitPiRegistry) {\n for (const tool of createOutlitPiTools(options)) {\n pi.registerTool(tool)\n }\n }\n}\n\nexport function createOutlitPiTools(\n options: OutlitPiExtensionOptions = {},\n): OutlitPiToolDefinition[] {\n return resolveToolNames(options.toolNames).map((toolName) =>\n createOutlitPiTool(toolName, options),\n )\n}\n\nexport function createOutlitPiTool(\n toolName: PiToolName,\n options: OutlitPiExtensionOptions = {},\n): OutlitPiToolDefinition {\n if (!isPublicToolName(toolName)) {\n throw new Error(`Unknown Outlit public tool: ${toolName}`)\n }\n if (!piToolNameSet.has(toolName)) {\n throw new Error(`Tool is not available in @outlit/pi: ${toolName}`)\n }\n\n const contract = getPublicToolContract(toolName)\n const label = formatOutlitToolLabel(toolName)\n\n return {\n name: toolName,\n label,\n description: contract.description,\n promptSnippet: `${label}: ${firstLine(contract.description)}`,\n parameters: toPiToolParameters(contract.inputSchema),\n async execute(_toolCallId, params) {\n const client = createOutlitClient({\n apiKey: resolveApiKey(options),\n baseUrl: resolveBaseUrl(options),\n fetch: options.fetch,\n })\n const result = await client.callTool(toolName, normalizeToolInput(params))\n\n return formatToolResult(toolName, result)\n },\n }\n}\n\nfunction toPiToolParameters(inputSchema: unknown): TSchema {\n if (inputSchema === null || typeof inputSchema !== \"object\" || Array.isArray(inputSchema)) {\n return inputSchema as TSchema\n }\n\n const { $schema: _schema, ...schema } = inputSchema as Record<string, unknown>\n return schema as unknown as TSchema\n}\n\nexport function formatOutlitToolLabel(toolName: PiToolName): string {\n return toolName\n .split(\"_\")\n .map((part) => part.charAt(0).toUpperCase() + part.slice(1))\n .join(\" \")\n}\n\nfunction resolveToolNames(toolNames: readonly PiToolName[] | undefined): PiToolName[] {\n const names = toolNames ?? defaultToolNames\n\n return [...new Set(names)].map((name) => {\n if (!isPublicToolName(name)) {\n throw new Error(`Unknown Outlit public tool: ${name}`)\n }\n\n return name\n })\n}\n\nfunction resolveApiKey(options: OutlitPiExtensionOptions): string {\n const apiKey = normalizeString(options.apiKey) ?? normalizeString(process.env[OUTLIT_API_KEY_ENV])\n\n if (!apiKey) {\n throw new Error(`${OUTLIT_API_KEY_ENV} is required to use @outlit/pi tools`)\n }\n\n return apiKey\n}\n\nfunction resolveBaseUrl(options: OutlitPiExtensionOptions): string {\n return (\n normalizeString(options.baseUrl) ??\n normalizeString(process.env[OUTLIT_API_URL_ENV]) ??\n DEFAULT_OUTLIT_API_URL\n )\n}\n\nfunction normalizeString(value: string | undefined): string | undefined {\n const trimmed = value?.trim()\n return trimmed ? trimmed : undefined\n}\n\nfunction normalizeToolInput(params: unknown): Record<string, unknown> {\n if (params === undefined) {\n return {}\n }\n\n if (params === null || typeof params !== \"object\" || Array.isArray(params)) {\n throw new TypeError(\"Outlit Pi tool input must be an object\")\n }\n\n return params as Record<string, unknown>\n}\n\nfunction formatToolResult(\n toolName: PiToolName,\n result: unknown,\n): AgentToolResult<OutlitPiToolDetails> {\n return {\n content: [{ type: \"text\", text: JSON.stringify(result, null, 2) ?? String(result) }],\n details: {\n toolName,\n result,\n },\n }\n}\n\nfunction firstLine(value: string): string {\n return value.split(\"\\n\", 1)[0] ?? value\n}\n\nexport type { PiToolName } from \"@outlit/tools\"\n/** @deprecated Use PiToolName. */\nexport type PublicToolName = PiToolName\nexport {\n analyticalToolNames,\n defaultToolNames,\n piToolNames,\n piToolNames as allPublicToolNames,\n sqlToolNames,\n} from \"@outlit/tools\"\n\nexport default createOutlitPiExtension()\n","import { createOutlitPiExtension } from \"./index.js\"\n\nexport default createOutlitPiExtension()\n"],"mappings":";AACA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EAGA;AAAA,OACK;AA4JP;AAAA,EACE;AAAA,EACA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T;AAEA,SAAS,iBACP,UACA,QACsC;AACtC,SAAO;AAAA,IACL,SAAS,CAAC,EAAE,MAAM,QAAQ,MAAM,KAAK,UAAU,QAAQ,MAAM,CAAC,KAAK,OAAO,MAAM,EAAE,CAAC;AAAA,IACnF,SAAS;AAAA,MACP;AAAA,MACA;AAAA,IACF;AAAA,EACF;AACF;AAEA,SAAS,UAAU,OAAuB;AACxC,SAAO,MAAM,MAAM,MAAM,CAAC,EAAE,CAAC,KAAK;AACpC;AAaA,IAAO,cAAQ,wBAAwB;;;AC5KvC,IAAO,oBAAQ,wBAAwB;","names":["defaultToolNames","piToolNames"]}
|
package/dist/index.cjs
CHANGED
|
@@ -22,15 +22,15 @@ var src_exports = {};
|
|
|
22
22
|
__export(src_exports, {
|
|
23
23
|
OUTLIT_API_KEY_ENV: () => OUTLIT_API_KEY_ENV,
|
|
24
24
|
OUTLIT_API_URL_ENV: () => OUTLIT_API_URL_ENV,
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
analyticalAgentToolNames: () => import_tools2.analyticalAgentToolNames,
|
|
25
|
+
allPublicToolNames: () => import_tools2.piToolNames,
|
|
26
|
+
analyticalToolNames: () => import_tools2.analyticalToolNames,
|
|
28
27
|
createOutlitPiExtension: () => createOutlitPiExtension,
|
|
29
28
|
createOutlitPiTool: () => createOutlitPiTool,
|
|
30
29
|
createOutlitPiTools: () => createOutlitPiTools,
|
|
31
30
|
default: () => src_default,
|
|
32
|
-
|
|
31
|
+
defaultToolNames: () => import_tools2.defaultToolNames,
|
|
33
32
|
formatOutlitToolLabel: () => formatOutlitToolLabel,
|
|
33
|
+
piToolNames: () => import_tools2.piToolNames,
|
|
34
34
|
sqlToolNames: () => import_tools2.sqlToolNames
|
|
35
35
|
});
|
|
36
36
|
module.exports = __toCommonJS(src_exports);
|
|
@@ -38,6 +38,7 @@ var import_tools = require("@outlit/tools");
|
|
|
38
38
|
var import_tools2 = require("@outlit/tools");
|
|
39
39
|
var OUTLIT_API_KEY_ENV = "OUTLIT_API_KEY";
|
|
40
40
|
var OUTLIT_API_URL_ENV = "OUTLIT_API_URL";
|
|
41
|
+
var piToolNameSet = new Set(import_tools.piToolNames);
|
|
41
42
|
function createOutlitPiExtension(options = {}) {
|
|
42
43
|
return function outlitPiExtension(pi) {
|
|
43
44
|
for (const tool of createOutlitPiTools(options)) {
|
|
@@ -51,7 +52,13 @@ function createOutlitPiTools(options = {}) {
|
|
|
51
52
|
);
|
|
52
53
|
}
|
|
53
54
|
function createOutlitPiTool(toolName, options = {}) {
|
|
54
|
-
|
|
55
|
+
if (!(0, import_tools.isPublicToolName)(toolName)) {
|
|
56
|
+
throw new Error(`Unknown Outlit public tool: ${toolName}`);
|
|
57
|
+
}
|
|
58
|
+
if (!piToolNameSet.has(toolName)) {
|
|
59
|
+
throw new Error(`Tool is not available in @outlit/pi: ${toolName}`);
|
|
60
|
+
}
|
|
61
|
+
const contract = (0, import_tools.getPublicToolContract)(toolName);
|
|
55
62
|
const label = formatOutlitToolLabel(toolName);
|
|
56
63
|
return {
|
|
57
64
|
name: toolName,
|
|
@@ -81,10 +88,10 @@ function formatOutlitToolLabel(toolName) {
|
|
|
81
88
|
return toolName.split("_").map((part) => part.charAt(0).toUpperCase() + part.slice(1)).join(" ");
|
|
82
89
|
}
|
|
83
90
|
function resolveToolNames(toolNames) {
|
|
84
|
-
const names = toolNames ?? import_tools.
|
|
91
|
+
const names = toolNames ?? import_tools.defaultToolNames;
|
|
85
92
|
return [...new Set(names)].map((name) => {
|
|
86
|
-
if (!(0, import_tools.
|
|
87
|
-
throw new Error(`Unknown Outlit
|
|
93
|
+
if (!(0, import_tools.isPublicToolName)(name)) {
|
|
94
|
+
throw new Error(`Unknown Outlit public tool: ${name}`);
|
|
88
95
|
}
|
|
89
96
|
return name;
|
|
90
97
|
});
|
|
@@ -129,14 +136,14 @@ var src_default = createOutlitPiExtension();
|
|
|
129
136
|
0 && (module.exports = {
|
|
130
137
|
OUTLIT_API_KEY_ENV,
|
|
131
138
|
OUTLIT_API_URL_ENV,
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
analyticalAgentToolNames,
|
|
139
|
+
allPublicToolNames,
|
|
140
|
+
analyticalToolNames,
|
|
135
141
|
createOutlitPiExtension,
|
|
136
142
|
createOutlitPiTool,
|
|
137
143
|
createOutlitPiTools,
|
|
138
|
-
|
|
144
|
+
defaultToolNames,
|
|
139
145
|
formatOutlitToolLabel,
|
|
146
|
+
piToolNames,
|
|
140
147
|
sqlToolNames
|
|
141
148
|
});
|
|
142
149
|
//# sourceMappingURL=index.cjs.map
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["import type { AgentToolResult, ExtensionAPI, ToolDefinition } from \"@mariozechner/pi-coding-agent\"\nimport {\n
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["import type { AgentToolResult, ExtensionAPI, ToolDefinition } from \"@mariozechner/pi-coding-agent\"\nimport {\n createOutlitClient,\n DEFAULT_OUTLIT_API_URL,\n defaultToolNames,\n getPublicToolContract,\n isPublicToolName,\n type OutlitToolsFetch,\n type PiToolName,\n piToolNames,\n} from \"@outlit/tools\"\nimport type { TSchema } from \"@sinclair/typebox\"\n\nexport const OUTLIT_API_KEY_ENV = \"OUTLIT_API_KEY\"\nexport const OUTLIT_API_URL_ENV = \"OUTLIT_API_URL\"\n\nconst piToolNameSet = new Set<string>(piToolNames)\n\nexport type OutlitPiExtensionOptions = {\n apiKey?: string\n baseUrl?: string\n fetch?: OutlitToolsFetch\n toolNames?: readonly PiToolName[]\n}\n\nexport type OutlitPiRegistry = Pick<ExtensionAPI, \"registerTool\">\n\nexport type OutlitPiToolDetails = {\n toolName: PiToolName\n result: unknown\n}\n\nexport type OutlitPiToolDefinition = ToolDefinition<TSchema, OutlitPiToolDetails>\n\nexport function createOutlitPiExtension(options: OutlitPiExtensionOptions = {}) {\n return function outlitPiExtension(pi: OutlitPiRegistry) {\n for (const tool of createOutlitPiTools(options)) {\n pi.registerTool(tool)\n }\n }\n}\n\nexport function createOutlitPiTools(\n options: OutlitPiExtensionOptions = {},\n): OutlitPiToolDefinition[] {\n return resolveToolNames(options.toolNames).map((toolName) =>\n createOutlitPiTool(toolName, options),\n )\n}\n\nexport function createOutlitPiTool(\n toolName: PiToolName,\n options: OutlitPiExtensionOptions = {},\n): OutlitPiToolDefinition {\n if (!isPublicToolName(toolName)) {\n throw new Error(`Unknown Outlit public tool: ${toolName}`)\n }\n if (!piToolNameSet.has(toolName)) {\n throw new Error(`Tool is not available in @outlit/pi: ${toolName}`)\n }\n\n const contract = getPublicToolContract(toolName)\n const label = formatOutlitToolLabel(toolName)\n\n return {\n name: toolName,\n label,\n description: contract.description,\n promptSnippet: `${label}: ${firstLine(contract.description)}`,\n parameters: toPiToolParameters(contract.inputSchema),\n async execute(_toolCallId, params) {\n const client = createOutlitClient({\n apiKey: resolveApiKey(options),\n baseUrl: resolveBaseUrl(options),\n fetch: options.fetch,\n })\n const result = await client.callTool(toolName, normalizeToolInput(params))\n\n return formatToolResult(toolName, result)\n },\n }\n}\n\nfunction toPiToolParameters(inputSchema: unknown): TSchema {\n if (inputSchema === null || typeof inputSchema !== \"object\" || Array.isArray(inputSchema)) {\n return inputSchema as TSchema\n }\n\n const { $schema: _schema, ...schema } = inputSchema as Record<string, unknown>\n return schema as unknown as TSchema\n}\n\nexport function formatOutlitToolLabel(toolName: PiToolName): string {\n return toolName\n .split(\"_\")\n .map((part) => part.charAt(0).toUpperCase() + part.slice(1))\n .join(\" \")\n}\n\nfunction resolveToolNames(toolNames: readonly PiToolName[] | undefined): PiToolName[] {\n const names = toolNames ?? defaultToolNames\n\n return [...new Set(names)].map((name) => {\n if (!isPublicToolName(name)) {\n throw new Error(`Unknown Outlit public tool: ${name}`)\n }\n\n return name\n })\n}\n\nfunction resolveApiKey(options: OutlitPiExtensionOptions): string {\n const apiKey = normalizeString(options.apiKey) ?? normalizeString(process.env[OUTLIT_API_KEY_ENV])\n\n if (!apiKey) {\n throw new Error(`${OUTLIT_API_KEY_ENV} is required to use @outlit/pi tools`)\n }\n\n return apiKey\n}\n\nfunction resolveBaseUrl(options: OutlitPiExtensionOptions): string {\n return (\n normalizeString(options.baseUrl) ??\n normalizeString(process.env[OUTLIT_API_URL_ENV]) ??\n DEFAULT_OUTLIT_API_URL\n )\n}\n\nfunction normalizeString(value: string | undefined): string | undefined {\n const trimmed = value?.trim()\n return trimmed ? trimmed : undefined\n}\n\nfunction normalizeToolInput(params: unknown): Record<string, unknown> {\n if (params === undefined) {\n return {}\n }\n\n if (params === null || typeof params !== \"object\" || Array.isArray(params)) {\n throw new TypeError(\"Outlit Pi tool input must be an object\")\n }\n\n return params as Record<string, unknown>\n}\n\nfunction formatToolResult(\n toolName: PiToolName,\n result: unknown,\n): AgentToolResult<OutlitPiToolDetails> {\n return {\n content: [{ type: \"text\", text: JSON.stringify(result, null, 2) ?? String(result) }],\n details: {\n toolName,\n result,\n },\n }\n}\n\nfunction firstLine(value: string): string {\n return value.split(\"\\n\", 1)[0] ?? value\n}\n\nexport type { PiToolName } from \"@outlit/tools\"\n/** @deprecated Use PiToolName. */\nexport type PublicToolName = PiToolName\nexport {\n analyticalToolNames,\n defaultToolNames,\n piToolNames,\n piToolNames as allPublicToolNames,\n sqlToolNames,\n} from \"@outlit/tools\"\n\nexport default createOutlitPiExtension()\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,mBASO;AA4JP,IAAAA,gBAMO;AA/JA,IAAM,qBAAqB;AAC3B,IAAM,qBAAqB;AAElC,IAAM,gBAAgB,IAAI,IAAY,wBAAW;AAkB1C,SAAS,wBAAwB,UAAoC,CAAC,GAAG;AAC9E,SAAO,SAAS,kBAAkB,IAAsB;AACtD,eAAW,QAAQ,oBAAoB,OAAO,GAAG;AAC/C,SA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AAC,EAAE,CAAC,KAAK;AACpC;AAaA,IAAO,cAAQ,wBAAwB;","names":["import_tools"]}
|
package/dist/index.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ExtensionAPI, ToolDefinition } from '@mariozechner/pi-coding-agent';
|
|
2
|
-
import { OutlitToolsFetch,
|
|
3
|
-
export {
|
|
2
|
+
import { OutlitToolsFetch, PiToolName } from '@outlit/tools';
|
|
3
|
+
export { PiToolName, piToolNames as allPublicToolNames, analyticalToolNames, defaultToolNames, piToolNames, sqlToolNames } from '@outlit/tools';
|
|
4
4
|
import { TSchema } from '@sinclair/typebox';
|
|
5
5
|
|
|
6
6
|
declare const OUTLIT_API_KEY_ENV = "OUTLIT_API_KEY";
|
|
@@ -9,19 +9,22 @@ type OutlitPiExtensionOptions = {
|
|
|
9
9
|
apiKey?: string;
|
|
10
10
|
baseUrl?: string;
|
|
11
11
|
fetch?: OutlitToolsFetch;
|
|
12
|
-
toolNames?: readonly
|
|
12
|
+
toolNames?: readonly PiToolName[];
|
|
13
13
|
};
|
|
14
14
|
type OutlitPiRegistry = Pick<ExtensionAPI, "registerTool">;
|
|
15
15
|
type OutlitPiToolDetails = {
|
|
16
|
-
toolName:
|
|
16
|
+
toolName: PiToolName;
|
|
17
17
|
result: unknown;
|
|
18
18
|
};
|
|
19
19
|
type OutlitPiToolDefinition = ToolDefinition<TSchema, OutlitPiToolDetails>;
|
|
20
20
|
declare function createOutlitPiExtension(options?: OutlitPiExtensionOptions): (pi: OutlitPiRegistry) => void;
|
|
21
21
|
declare function createOutlitPiTools(options?: OutlitPiExtensionOptions): OutlitPiToolDefinition[];
|
|
22
|
-
declare function createOutlitPiTool(toolName:
|
|
23
|
-
declare function formatOutlitToolLabel(toolName:
|
|
22
|
+
declare function createOutlitPiTool(toolName: PiToolName, options?: OutlitPiExtensionOptions): OutlitPiToolDefinition;
|
|
23
|
+
declare function formatOutlitToolLabel(toolName: PiToolName): string;
|
|
24
|
+
|
|
25
|
+
/** @deprecated Use PiToolName. */
|
|
26
|
+
type PublicToolName = PiToolName;
|
|
24
27
|
|
|
25
28
|
declare const _default: (pi: OutlitPiRegistry) => void;
|
|
26
29
|
|
|
27
|
-
export { OUTLIT_API_KEY_ENV, OUTLIT_API_URL_ENV, type OutlitPiExtensionOptions, type OutlitPiRegistry, type OutlitPiToolDefinition, type OutlitPiToolDetails, createOutlitPiExtension, createOutlitPiTool, createOutlitPiTools, _default as default, formatOutlitToolLabel };
|
|
30
|
+
export { OUTLIT_API_KEY_ENV, OUTLIT_API_URL_ENV, type OutlitPiExtensionOptions, type OutlitPiRegistry, type OutlitPiToolDefinition, type OutlitPiToolDetails, type PublicToolName, createOutlitPiExtension, createOutlitPiTool, createOutlitPiTools, _default as default, formatOutlitToolLabel };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ExtensionAPI, ToolDefinition } from '@mariozechner/pi-coding-agent';
|
|
2
|
-
import { OutlitToolsFetch,
|
|
3
|
-
export {
|
|
2
|
+
import { OutlitToolsFetch, PiToolName } from '@outlit/tools';
|
|
3
|
+
export { PiToolName, piToolNames as allPublicToolNames, analyticalToolNames, defaultToolNames, piToolNames, sqlToolNames } from '@outlit/tools';
|
|
4
4
|
import { TSchema } from '@sinclair/typebox';
|
|
5
5
|
|
|
6
6
|
declare const OUTLIT_API_KEY_ENV = "OUTLIT_API_KEY";
|
|
@@ -9,19 +9,22 @@ type OutlitPiExtensionOptions = {
|
|
|
9
9
|
apiKey?: string;
|
|
10
10
|
baseUrl?: string;
|
|
11
11
|
fetch?: OutlitToolsFetch;
|
|
12
|
-
toolNames?: readonly
|
|
12
|
+
toolNames?: readonly PiToolName[];
|
|
13
13
|
};
|
|
14
14
|
type OutlitPiRegistry = Pick<ExtensionAPI, "registerTool">;
|
|
15
15
|
type OutlitPiToolDetails = {
|
|
16
|
-
toolName:
|
|
16
|
+
toolName: PiToolName;
|
|
17
17
|
result: unknown;
|
|
18
18
|
};
|
|
19
19
|
type OutlitPiToolDefinition = ToolDefinition<TSchema, OutlitPiToolDetails>;
|
|
20
20
|
declare function createOutlitPiExtension(options?: OutlitPiExtensionOptions): (pi: OutlitPiRegistry) => void;
|
|
21
21
|
declare function createOutlitPiTools(options?: OutlitPiExtensionOptions): OutlitPiToolDefinition[];
|
|
22
|
-
declare function createOutlitPiTool(toolName:
|
|
23
|
-
declare function formatOutlitToolLabel(toolName:
|
|
22
|
+
declare function createOutlitPiTool(toolName: PiToolName, options?: OutlitPiExtensionOptions): OutlitPiToolDefinition;
|
|
23
|
+
declare function formatOutlitToolLabel(toolName: PiToolName): string;
|
|
24
|
+
|
|
25
|
+
/** @deprecated Use PiToolName. */
|
|
26
|
+
type PublicToolName = PiToolName;
|
|
24
27
|
|
|
25
28
|
declare const _default: (pi: OutlitPiRegistry) => void;
|
|
26
29
|
|
|
27
|
-
export { OUTLIT_API_KEY_ENV, OUTLIT_API_URL_ENV, type OutlitPiExtensionOptions, type OutlitPiRegistry, type OutlitPiToolDefinition, type OutlitPiToolDetails, createOutlitPiExtension, createOutlitPiTool, createOutlitPiTools, _default as default, formatOutlitToolLabel };
|
|
30
|
+
export { OUTLIT_API_KEY_ENV, OUTLIT_API_URL_ENV, type OutlitPiExtensionOptions, type OutlitPiRegistry, type OutlitPiToolDefinition, type OutlitPiToolDetails, type PublicToolName, createOutlitPiExtension, createOutlitPiTool, createOutlitPiTools, _default as default, formatOutlitToolLabel };
|
package/dist/index.js
CHANGED
|
@@ -2,19 +2,21 @@
|
|
|
2
2
|
import {
|
|
3
3
|
createOutlitClient,
|
|
4
4
|
DEFAULT_OUTLIT_API_URL,
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
defaultToolNames,
|
|
6
|
+
getPublicToolContract,
|
|
7
|
+
isPublicToolName,
|
|
8
|
+
piToolNames
|
|
8
9
|
} from "@outlit/tools";
|
|
9
10
|
import {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
analyticalToolNames,
|
|
12
|
+
defaultToolNames as defaultToolNames2,
|
|
13
|
+
piToolNames as piToolNames2,
|
|
14
|
+
piToolNames as piToolNames3,
|
|
14
15
|
sqlToolNames
|
|
15
16
|
} from "@outlit/tools";
|
|
16
17
|
var OUTLIT_API_KEY_ENV = "OUTLIT_API_KEY";
|
|
17
18
|
var OUTLIT_API_URL_ENV = "OUTLIT_API_URL";
|
|
19
|
+
var piToolNameSet = new Set(piToolNames);
|
|
18
20
|
function createOutlitPiExtension(options = {}) {
|
|
19
21
|
return function outlitPiExtension(pi) {
|
|
20
22
|
for (const tool of createOutlitPiTools(options)) {
|
|
@@ -28,7 +30,13 @@ function createOutlitPiTools(options = {}) {
|
|
|
28
30
|
);
|
|
29
31
|
}
|
|
30
32
|
function createOutlitPiTool(toolName, options = {}) {
|
|
31
|
-
|
|
33
|
+
if (!isPublicToolName(toolName)) {
|
|
34
|
+
throw new Error(`Unknown Outlit public tool: ${toolName}`);
|
|
35
|
+
}
|
|
36
|
+
if (!piToolNameSet.has(toolName)) {
|
|
37
|
+
throw new Error(`Tool is not available in @outlit/pi: ${toolName}`);
|
|
38
|
+
}
|
|
39
|
+
const contract = getPublicToolContract(toolName);
|
|
32
40
|
const label = formatOutlitToolLabel(toolName);
|
|
33
41
|
return {
|
|
34
42
|
name: toolName,
|
|
@@ -58,10 +66,10 @@ function formatOutlitToolLabel(toolName) {
|
|
|
58
66
|
return toolName.split("_").map((part) => part.charAt(0).toUpperCase() + part.slice(1)).join(" ");
|
|
59
67
|
}
|
|
60
68
|
function resolveToolNames(toolNames) {
|
|
61
|
-
const names = toolNames ??
|
|
69
|
+
const names = toolNames ?? defaultToolNames;
|
|
62
70
|
return [...new Set(names)].map((name) => {
|
|
63
|
-
if (!
|
|
64
|
-
throw new Error(`Unknown Outlit
|
|
71
|
+
if (!isPublicToolName(name)) {
|
|
72
|
+
throw new Error(`Unknown Outlit public tool: ${name}`);
|
|
65
73
|
}
|
|
66
74
|
return name;
|
|
67
75
|
});
|
|
@@ -105,15 +113,15 @@ var src_default = createOutlitPiExtension();
|
|
|
105
113
|
export {
|
|
106
114
|
OUTLIT_API_KEY_ENV,
|
|
107
115
|
OUTLIT_API_URL_ENV,
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
analyticalAgentToolNames,
|
|
116
|
+
piToolNames3 as allPublicToolNames,
|
|
117
|
+
analyticalToolNames,
|
|
111
118
|
createOutlitPiExtension,
|
|
112
119
|
createOutlitPiTool,
|
|
113
120
|
createOutlitPiTools,
|
|
114
121
|
src_default as default,
|
|
115
|
-
|
|
122
|
+
defaultToolNames2 as defaultToolNames,
|
|
116
123
|
formatOutlitToolLabel,
|
|
124
|
+
piToolNames2 as piToolNames,
|
|
117
125
|
sqlToolNames
|
|
118
126
|
};
|
|
119
127
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["import type { AgentToolResult, ExtensionAPI, ToolDefinition } from \"@mariozechner/pi-coding-agent\"\nimport {\n
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["import type { AgentToolResult, ExtensionAPI, ToolDefinition } from \"@mariozechner/pi-coding-agent\"\nimport {\n createOutlitClient,\n DEFAULT_OUTLIT_API_URL,\n defaultToolNames,\n getPublicToolContract,\n isPublicToolName,\n type OutlitToolsFetch,\n type PiToolName,\n piToolNames,\n} from \"@outlit/tools\"\nimport type { TSchema } from \"@sinclair/typebox\"\n\nexport const OUTLIT_API_KEY_ENV = \"OUTLIT_API_KEY\"\nexport const OUTLIT_API_URL_ENV = \"OUTLIT_API_URL\"\n\nconst piToolNameSet = new Set<string>(piToolNames)\n\nexport type OutlitPiExtensionOptions = {\n apiKey?: string\n baseUrl?: string\n fetch?: OutlitToolsFetch\n toolNames?: readonly PiToolName[]\n}\n\nexport type OutlitPiRegistry = Pick<ExtensionAPI, \"registerTool\">\n\nexport type OutlitPiToolDetails = {\n toolName: PiToolName\n result: unknown\n}\n\nexport type OutlitPiToolDefinition = ToolDefinition<TSchema, OutlitPiToolDetails>\n\nexport function createOutlitPiExtension(options: OutlitPiExtensionOptions = {}) {\n return function outlitPiExtension(pi: OutlitPiRegistry) {\n for (const tool of createOutlitPiTools(options)) {\n pi.registerTool(tool)\n }\n }\n}\n\nexport function createOutlitPiTools(\n options: OutlitPiExtensionOptions = {},\n): OutlitPiToolDefinition[] {\n return resolveToolNames(options.toolNames).map((toolName) =>\n createOutlitPiTool(toolName, options),\n )\n}\n\nexport function createOutlitPiTool(\n toolName: PiToolName,\n options: OutlitPiExtensionOptions = {},\n): OutlitPiToolDefinition {\n if (!isPublicToolName(toolName)) {\n throw new Error(`Unknown Outlit public tool: ${toolName}`)\n }\n if (!piToolNameSet.has(toolName)) {\n throw new Error(`Tool is not available in @outlit/pi: ${toolName}`)\n }\n\n const contract = getPublicToolContract(toolName)\n const label = formatOutlitToolLabel(toolName)\n\n return {\n name: toolName,\n label,\n description: contract.description,\n promptSnippet: `${label}: ${firstLine(contract.description)}`,\n parameters: toPiToolParameters(contract.inputSchema),\n async execute(_toolCallId, params) {\n const client = createOutlitClient({\n apiKey: resolveApiKey(options),\n baseUrl: resolveBaseUrl(options),\n fetch: options.fetch,\n })\n const result = await client.callTool(toolName, normalizeToolInput(params))\n\n return formatToolResult(toolName, result)\n },\n }\n}\n\nfunction toPiToolParameters(inputSchema: unknown): TSchema {\n if (inputSchema === null || typeof inputSchema !== \"object\" || Array.isArray(inputSchema)) {\n return inputSchema as TSchema\n }\n\n const { $schema: _schema, ...schema } = inputSchema as Record<string, unknown>\n return schema as unknown as TSchema\n}\n\nexport function formatOutlitToolLabel(toolName: PiToolName): string {\n return toolName\n .split(\"_\")\n .map((part) => part.charAt(0).toUpperCase() + part.slice(1))\n .join(\" \")\n}\n\nfunction resolveToolNames(toolNames: readonly PiToolName[] | undefined): PiToolName[] {\n const names = toolNames ?? defaultToolNames\n\n return [...new Set(names)].map((name) => {\n if (!isPublicToolName(name)) {\n throw new Error(`Unknown Outlit public tool: ${name}`)\n }\n\n return name\n })\n}\n\nfunction resolveApiKey(options: OutlitPiExtensionOptions): string {\n const apiKey = normalizeString(options.apiKey) ?? normalizeString(process.env[OUTLIT_API_KEY_ENV])\n\n if (!apiKey) {\n throw new Error(`${OUTLIT_API_KEY_ENV} is required to use @outlit/pi tools`)\n }\n\n return apiKey\n}\n\nfunction resolveBaseUrl(options: OutlitPiExtensionOptions): string {\n return (\n normalizeString(options.baseUrl) ??\n normalizeString(process.env[OUTLIT_API_URL_ENV]) ??\n DEFAULT_OUTLIT_API_URL\n )\n}\n\nfunction normalizeString(value: string | undefined): string | undefined {\n const trimmed = value?.trim()\n return trimmed ? trimmed : undefined\n}\n\nfunction normalizeToolInput(params: unknown): Record<string, unknown> {\n if (params === undefined) {\n return {}\n }\n\n if (params === null || typeof params !== \"object\" || Array.isArray(params)) {\n throw new TypeError(\"Outlit Pi tool input must be an object\")\n }\n\n return params as Record<string, unknown>\n}\n\nfunction formatToolResult(\n toolName: PiToolName,\n result: unknown,\n): AgentToolResult<OutlitPiToolDetails> {\n return {\n content: [{ type: \"text\", text: JSON.stringify(result, null, 2) ?? String(result) }],\n details: {\n toolName,\n result,\n },\n }\n}\n\nfunction firstLine(value: string): string {\n return value.split(\"\\n\", 1)[0] ?? value\n}\n\nexport type { PiToolName } from \"@outlit/tools\"\n/** @deprecated Use PiToolName. */\nexport type PublicToolName = PiToolName\nexport {\n analyticalToolNames,\n defaultToolNames,\n piToolNames,\n piToolNames as allPublicToolNames,\n sqlToolNames,\n} from \"@outlit/tools\"\n\nexport default createOutlitPiExtension()\n"],"mappings":";AACA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EAGA;AAAA,OACK;AA4JP;AAAA,EACE;AAAA,EACA,oBAAAA;AAAA,EACA,eAAAC;AAAA,EACe,eAAfA;AAAA,EACA;AAAA,OACK;AA/JA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AAM,QAAQ,MAAM,KAAK,UAAU,QAAQ,MAAM,CAAC,KAAK,OAAO,MAAM,EAAE,CAAC;AAAA,IACnF,SAAS;AAAA,MACP;AAAA,MACA;AAAA,IACF;AAAA,EACF;AACF;AAEA,SAAS,UAAU,OAAuB;AACxC,SAAO,MAAM,MAAM,MAAM,CAAC,EAAE,CAAC,KAAK;AACpC;AAaA,IAAO,cAAQ,wBAAwB;","names":["defaultToolNames","piToolNames"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@outlit/pi",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "Pi package for Outlit customer intelligence tools and skill guidance",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "Outlit AI",
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
"test": "vitest run"
|
|
67
67
|
},
|
|
68
68
|
"dependencies": {
|
|
69
|
-
"@outlit/tools": "^0.
|
|
69
|
+
"@outlit/tools": "^2.0.0"
|
|
70
70
|
},
|
|
71
71
|
"peerDependencies": {
|
|
72
72
|
"@mariozechner/pi-coding-agent": "*",
|
package/skills/outlit/SKILL.md
CHANGED
|
@@ -20,6 +20,7 @@ Do not invent customer state when Outlit can answer it. Call out sparse or messy
|
|
|
20
20
|
- Use `outlit_list_facts` to browse structured account facts, known signals, open issues, health indicators, relationship notes, activation, billing, or renewal context. Narrow with `status`, `sourceTypes`, and `factTypes` when you know what evidence class you need.
|
|
21
21
|
- Use `outlit_get_fact` when you already have a fact id and need the canonical fact payload.
|
|
22
22
|
- Use `outlit_search_customer_context` for fuzzy or thematic questions such as pricing concern, blocked integration, not using, renewal, champion left, negative sentiment, expansion, implementation, or support escalation.
|
|
23
|
+
- Use `outlit_list_sources` to discover the source artifacts available for a customer before retrieving one in full.
|
|
23
24
|
- Use `outlit_get_source` when a fact or search result needs stronger evidence from the underlying source artifact.
|
|
24
25
|
|
|
25
26
|
Use customer lookups before SQL. SQL is for aggregates, joins, cohorts, time-series analysis, and custom reporting.
|