@withone/cli 1.42.0 → 1.43.3
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 +57 -17
- package/dist/chunk-3ZJVO4GP.js +59 -0
- package/dist/chunk-44CV5IMX.js +38 -0
- package/dist/chunk-AU2ZEEMS.js +477 -0
- package/dist/chunk-C3ORS3RG.js +762 -0
- package/dist/{chunk-PK2RAVAF.js → chunk-EMAQVPRD.js} +6 -36
- package/dist/chunk-IAFQVFCB.js +1708 -0
- package/dist/chunk-MRGKKO54.js +158 -0
- package/dist/embedding-O4XWBL6T.js +10 -0
- package/dist/{flow-runner-Y2CXXU3U.js → flow-runner-XSJ4US5S.js} +2 -1
- package/dist/index.js +2856 -1691
- package/dist/migrate-BEARUBLO.js +16 -0
- package/dist/runtime-NVC7KAJZ.js +15 -0
- package/dist/sql-EGTWQIU5.js +11 -0
- package/package.json +6 -2
- package/profiles/attio/attioCompanies.json +5 -3
- package/profiles/attio/attioPeople.json +5 -4
- package/skills/one/SKILL.md +83 -10
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getMemoryConfigOrDefault,
|
|
3
|
+
getOpenAiApiKey,
|
|
4
|
+
readConfig
|
|
5
|
+
} from "./chunk-AU2ZEEMS.js";
|
|
6
|
+
|
|
7
|
+
// src/lib/output.ts
|
|
8
|
+
import * as p from "@clack/prompts";
|
|
9
|
+
var _agentMode = false;
|
|
10
|
+
function setAgentMode(value) {
|
|
11
|
+
_agentMode = value;
|
|
12
|
+
}
|
|
13
|
+
function isAgentMode() {
|
|
14
|
+
return _agentMode || process.env.ONE_AGENT === "1";
|
|
15
|
+
}
|
|
16
|
+
function createSpinner() {
|
|
17
|
+
if (isAgentMode()) {
|
|
18
|
+
return { start() {
|
|
19
|
+
}, stop() {
|
|
20
|
+
} };
|
|
21
|
+
}
|
|
22
|
+
return p.spinner();
|
|
23
|
+
}
|
|
24
|
+
function intro2(msg) {
|
|
25
|
+
if (!isAgentMode()) p.intro(msg);
|
|
26
|
+
}
|
|
27
|
+
function outro2(msg) {
|
|
28
|
+
if (!isAgentMode()) p.outro(msg);
|
|
29
|
+
}
|
|
30
|
+
function note2(msg, title) {
|
|
31
|
+
if (!isAgentMode()) p.note(msg, title);
|
|
32
|
+
}
|
|
33
|
+
function cancel2(msg) {
|
|
34
|
+
if (!isAgentMode()) p.cancel(msg);
|
|
35
|
+
}
|
|
36
|
+
function json(data) {
|
|
37
|
+
process.stdout.write(JSON.stringify(data) + "\n");
|
|
38
|
+
}
|
|
39
|
+
function error(message, exitCode = 1) {
|
|
40
|
+
if (isAgentMode()) {
|
|
41
|
+
json({ error: message });
|
|
42
|
+
} else {
|
|
43
|
+
p.cancel(message);
|
|
44
|
+
}
|
|
45
|
+
process.exit(exitCode);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// src/commands/mem/util.ts
|
|
49
|
+
function requireMemoryInit() {
|
|
50
|
+
if (!readConfig()) {
|
|
51
|
+
error("No One config found. Run `one init` first.");
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
function parseJsonArg(arg, field = "data") {
|
|
55
|
+
try {
|
|
56
|
+
const parsed = JSON.parse(arg);
|
|
57
|
+
if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) {
|
|
58
|
+
error(`${field} must be a JSON object, not ${Array.isArray(parsed) ? "an array" : typeof parsed}.`);
|
|
59
|
+
}
|
|
60
|
+
return parsed;
|
|
61
|
+
} catch (err) {
|
|
62
|
+
error(`Invalid JSON for ${field}: ${err instanceof Error ? err.message : String(err)}`);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
function parseCsv(value) {
|
|
66
|
+
if (!value) return void 0;
|
|
67
|
+
return value.split(",").map((s) => s.trim()).filter(Boolean);
|
|
68
|
+
}
|
|
69
|
+
function parsePositiveInt(value, fallback, label = "value") {
|
|
70
|
+
if (value === void 0) return fallback;
|
|
71
|
+
const n = Number.parseInt(value, 10);
|
|
72
|
+
if (!Number.isFinite(n) || n <= 0) {
|
|
73
|
+
error(`${label} must be a positive integer`);
|
|
74
|
+
}
|
|
75
|
+
return n;
|
|
76
|
+
}
|
|
77
|
+
function printRecord(record) {
|
|
78
|
+
if (isAgentMode()) {
|
|
79
|
+
json(record);
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
console.log(JSON.stringify(record, null, 2));
|
|
83
|
+
}
|
|
84
|
+
function printList(items) {
|
|
85
|
+
if (isAgentMode()) {
|
|
86
|
+
json({ items, total: items.length });
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
if (items.length === 0) {
|
|
90
|
+
console.log("(no results)");
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
console.log(JSON.stringify(items, null, 2));
|
|
94
|
+
}
|
|
95
|
+
function okJson(payload) {
|
|
96
|
+
if (isAgentMode()) {
|
|
97
|
+
json(payload);
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
console.log(JSON.stringify(payload, null, 2));
|
|
101
|
+
}
|
|
102
|
+
function semanticSearchUpgradeHint(opts = {}) {
|
|
103
|
+
const cfg = getMemoryConfigOrDefault();
|
|
104
|
+
const keyPresent = !!getOpenAiApiKey();
|
|
105
|
+
const providerOn = cfg.embedding.provider === "openai";
|
|
106
|
+
if (opts.vectorSearchAvailable === false) {
|
|
107
|
+
return {
|
|
108
|
+
capability: "semantic_search",
|
|
109
|
+
available: true,
|
|
110
|
+
currentMode: "fts_only",
|
|
111
|
+
how: "Install pgvector for the bundled Postgres: `brew install pgvector` (or point at a remote Postgres with pgvector via `one mem config set backend postgres`)",
|
|
112
|
+
benefit: "Ranks memories by meaning, not just keyword overlap \u2014 finds relevant records even when the query and the data use different words."
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
if (providerOn && keyPresent) return null;
|
|
116
|
+
if (!keyPresent) {
|
|
117
|
+
return {
|
|
118
|
+
capability: "semantic_search",
|
|
119
|
+
available: true,
|
|
120
|
+
currentMode: "fts_only",
|
|
121
|
+
how: 'Add an OpenAI key: `one init` (then "Add OpenAI key"), or `one mem config set embedding.apiKey sk-...`',
|
|
122
|
+
benefit: "Ranks memories by meaning, not just keyword overlap \u2014 finds relevant records even when the query and the data use different words."
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
return {
|
|
126
|
+
capability: "semantic_search",
|
|
127
|
+
available: true,
|
|
128
|
+
currentMode: "fts_only",
|
|
129
|
+
how: "Flip the provider on: `one mem config set embedding.provider openai`",
|
|
130
|
+
benefit: "Ranks memories by meaning, not just keyword overlap."
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
function semanticSearchUpgradeLine(opts = {}) {
|
|
134
|
+
const hint = semanticSearchUpgradeHint(opts);
|
|
135
|
+
if (!hint) return "";
|
|
136
|
+
return `tip: semantic search available \u2014 ${hint.how}`;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
export {
|
|
140
|
+
setAgentMode,
|
|
141
|
+
isAgentMode,
|
|
142
|
+
createSpinner,
|
|
143
|
+
intro2 as intro,
|
|
144
|
+
outro2 as outro,
|
|
145
|
+
note2 as note,
|
|
146
|
+
cancel2 as cancel,
|
|
147
|
+
json,
|
|
148
|
+
error,
|
|
149
|
+
requireMemoryInit,
|
|
150
|
+
parseJsonArg,
|
|
151
|
+
parseCsv,
|
|
152
|
+
parsePositiveInt,
|
|
153
|
+
printRecord,
|
|
154
|
+
printList,
|
|
155
|
+
okJson,
|
|
156
|
+
semanticSearchUpgradeHint,
|
|
157
|
+
semanticSearchUpgradeLine
|
|
158
|
+
};
|