@cerefox/memory 0.10.2 → 0.10.4
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/AGENT_GUIDE.md +10 -6
- package/AGENT_QUICK_REFERENCE.md +3 -3
- package/dist/bin/cerefox.js +356 -282
- package/dist/server-assets/_shared/ef-meta/index.ts +1 -1
- package/dist/server-assets/_shared/mcp-tools/_projects.ts +117 -1
- package/dist/server-assets/_shared/mcp-tools/get-help-content.ts +3 -3
- package/dist/server-assets/_shared/mcp-tools/metadata-search.ts +17 -11
- package/dist/server-assets/_shared/mcp-tools/set-document-projects.ts +9 -74
- package/dist/server-assets/supabase/functions/cerefox-metadata-search/index.ts +25 -7
- package/docs/guides/access-paths.md +1 -1
- package/docs/guides/agent-coordination.md +1 -1
- package/docs/guides/cli.md +89 -1
- package/docs/guides/connect-agents.md +12 -5
- package/package.json +1 -1
package/dist/bin/cerefox.js
CHANGED
|
@@ -7184,7 +7184,7 @@ var exports_meta = {};
|
|
|
7184
7184
|
__export(exports_meta, {
|
|
7185
7185
|
PKG_VERSION: () => PKG_VERSION
|
|
7186
7186
|
});
|
|
7187
|
-
var PKG_VERSION = "0.10.
|
|
7187
|
+
var PKG_VERSION = "0.10.4";
|
|
7188
7188
|
var init_meta = () => {};
|
|
7189
7189
|
|
|
7190
7190
|
// ../../node_modules/.bun/tslib@2.8.1/node_modules/tslib/tslib.js
|
|
@@ -7792,7 +7792,7 @@ var require_tslib = __commonJS((exports, module) => {
|
|
|
7792
7792
|
});
|
|
7793
7793
|
});
|
|
7794
7794
|
|
|
7795
|
-
// ../../node_modules/.bun/@supabase+functions-js@2.
|
|
7795
|
+
// ../../node_modules/.bun/@supabase+functions-js@2.108.1/node_modules/@supabase/functions-js/dist/main/helper.js
|
|
7796
7796
|
var require_helper = __commonJS((exports) => {
|
|
7797
7797
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7798
7798
|
exports.resolveFetch = undefined;
|
|
@@ -7805,7 +7805,7 @@ var require_helper = __commonJS((exports) => {
|
|
|
7805
7805
|
exports.resolveFetch = resolveFetch;
|
|
7806
7806
|
});
|
|
7807
7807
|
|
|
7808
|
-
// ../../node_modules/.bun/@supabase+functions-js@2.
|
|
7808
|
+
// ../../node_modules/.bun/@supabase+functions-js@2.108.1/node_modules/@supabase/functions-js/dist/main/types.js
|
|
7809
7809
|
var require_types = __commonJS((exports) => {
|
|
7810
7810
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7811
7811
|
exports.FunctionRegion = exports.FunctionsHttpError = exports.FunctionsRelayError = exports.FunctionsFetchError = exports.FunctionsError = undefined;
|
|
@@ -7866,7 +7866,7 @@ var require_types = __commonJS((exports) => {
|
|
|
7866
7866
|
})(FunctionRegion || (exports.FunctionRegion = FunctionRegion = {}));
|
|
7867
7867
|
});
|
|
7868
7868
|
|
|
7869
|
-
// ../../node_modules/.bun/@supabase+functions-js@2.
|
|
7869
|
+
// ../../node_modules/.bun/@supabase+functions-js@2.108.1/node_modules/@supabase/functions-js/dist/main/FunctionsClient.js
|
|
7870
7870
|
var require_FunctionsClient = __commonJS((exports) => {
|
|
7871
7871
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7872
7872
|
exports.FunctionsClient = undefined;
|
|
@@ -7979,7 +7979,7 @@ var require_FunctionsClient = __commonJS((exports) => {
|
|
|
7979
7979
|
exports.FunctionsClient = FunctionsClient;
|
|
7980
7980
|
});
|
|
7981
7981
|
|
|
7982
|
-
// ../../node_modules/.bun/@supabase+functions-js@2.
|
|
7982
|
+
// ../../node_modules/.bun/@supabase+functions-js@2.108.1/node_modules/@supabase/functions-js/dist/main/index.js
|
|
7983
7983
|
var require_main = __commonJS((exports) => {
|
|
7984
7984
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7985
7985
|
exports.FunctionRegion = exports.FunctionsRelayError = exports.FunctionsHttpError = exports.FunctionsFetchError = exports.FunctionsError = exports.FunctionsClient = undefined;
|
|
@@ -8005,7 +8005,7 @@ var require_main = __commonJS((exports) => {
|
|
|
8005
8005
|
} });
|
|
8006
8006
|
});
|
|
8007
8007
|
|
|
8008
|
-
// ../../node_modules/.bun/@supabase+postgrest-js@2.
|
|
8008
|
+
// ../../node_modules/.bun/@supabase+postgrest-js@2.108.1/node_modules/@supabase/postgrest-js/dist/index.mjs
|
|
8009
8009
|
function sleep(ms, signal) {
|
|
8010
8010
|
return new Promise((resolve) => {
|
|
8011
8011
|
if (signal === null || signal === undefined ? undefined : signal.aborted) {
|
|
@@ -8144,14 +8144,17 @@ var DEFAULT_MAX_RETRIES = 3, getRetryDelay = (attemptIndex) => Math.min(1000 * 2
|
|
|
8144
8144
|
const executeWithRetry = async () => {
|
|
8145
8145
|
let attemptCount = 0;
|
|
8146
8146
|
while (true) {
|
|
8147
|
-
const
|
|
8147
|
+
const headers = {};
|
|
8148
|
+
_this.headers.forEach((value, key) => {
|
|
8149
|
+
headers[key] = value;
|
|
8150
|
+
});
|
|
8148
8151
|
if (attemptCount > 0)
|
|
8149
|
-
|
|
8152
|
+
headers["X-Retry-Count"] = String(attemptCount);
|
|
8150
8153
|
let res$1;
|
|
8151
8154
|
try {
|
|
8152
8155
|
res$1 = await _fetch(_this.url.toString(), {
|
|
8153
8156
|
method: _this.method,
|
|
8154
|
-
headers
|
|
8157
|
+
headers,
|
|
8155
8158
|
body: JSON.stringify(_this.body, (_, value) => typeof value === "bigint" ? value.toString() : value),
|
|
8156
8159
|
signal: _this.signal
|
|
8157
8160
|
});
|
|
@@ -8562,6 +8565,9 @@ var init_dist = __esm(() => {
|
|
|
8562
8565
|
}
|
|
8563
8566
|
};
|
|
8564
8567
|
PostgrestTransformBuilder = class extends PostgrestBuilder {
|
|
8568
|
+
throwOnError() {
|
|
8569
|
+
return super.throwOnError();
|
|
8570
|
+
}
|
|
8565
8571
|
select(columns) {
|
|
8566
8572
|
let quoted = false;
|
|
8567
8573
|
const cleanedColumns = (columns !== null && columns !== undefined ? columns : "*").split("").map((c2) => {
|
|
@@ -8581,9 +8587,9 @@ var init_dist = __esm(() => {
|
|
|
8581
8587
|
this.url.searchParams.set(key, `${existingOrder ? `${existingOrder},` : ""}${column}.${ascending ? "asc" : "desc"}${nullsFirst === undefined ? "" : nullsFirst ? ".nullsfirst" : ".nullslast"}`);
|
|
8582
8588
|
return this;
|
|
8583
8589
|
}
|
|
8584
|
-
limit(
|
|
8590
|
+
limit(rows, { foreignTable, referencedTable = foreignTable } = {}) {
|
|
8585
8591
|
const key = typeof referencedTable === "undefined" ? "limit" : `${referencedTable}.limit`;
|
|
8586
|
-
this.url.searchParams.set(key, `${
|
|
8592
|
+
this.url.searchParams.set(key, `${rows}`);
|
|
8587
8593
|
return this;
|
|
8588
8594
|
}
|
|
8589
8595
|
range(from, to, { foreignTable, referencedTable = foreignTable } = {}) {
|
|
@@ -8636,14 +8642,17 @@ var init_dist = __esm(() => {
|
|
|
8636
8642
|
returns() {
|
|
8637
8643
|
return this;
|
|
8638
8644
|
}
|
|
8639
|
-
maxAffected(
|
|
8645
|
+
maxAffected(rows) {
|
|
8640
8646
|
this.headers.append("Prefer", "handling=strict");
|
|
8641
|
-
this.headers.append("Prefer", `max-affected=${
|
|
8647
|
+
this.headers.append("Prefer", `max-affected=${rows}`);
|
|
8642
8648
|
return this;
|
|
8643
8649
|
}
|
|
8644
8650
|
};
|
|
8645
8651
|
PostgrestReservedCharsRegexp = /* @__PURE__ */ new RegExp("[,()]");
|
|
8646
8652
|
PostgrestFilterBuilder = class extends PostgrestTransformBuilder {
|
|
8653
|
+
throwOnError() {
|
|
8654
|
+
return super.throwOnError();
|
|
8655
|
+
}
|
|
8647
8656
|
eq(column, value) {
|
|
8648
8657
|
this.url.searchParams.append(column, `eq.${value}`);
|
|
8649
8658
|
return this;
|
|
@@ -8807,7 +8816,7 @@ var init_dist = __esm(() => {
|
|
|
8807
8816
|
};
|
|
8808
8817
|
});
|
|
8809
8818
|
|
|
8810
|
-
// ../../node_modules/.bun/@supabase+realtime-js@2.
|
|
8819
|
+
// ../../node_modules/.bun/@supabase+realtime-js@2.108.1/node_modules/@supabase/realtime-js/dist/main/lib/websocket-factory.js
|
|
8811
8820
|
var require_websocket_factory = __commonJS((exports) => {
|
|
8812
8821
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8813
8822
|
exports.WebSocketFactory = undefined;
|
|
@@ -8898,14 +8907,14 @@ Suggested solution: ${env.workaround}`;
|
|
|
8898
8907
|
exports.default = WebSocketFactory;
|
|
8899
8908
|
});
|
|
8900
8909
|
|
|
8901
|
-
// ../../node_modules/.bun/@supabase+realtime-js@2.
|
|
8910
|
+
// ../../node_modules/.bun/@supabase+realtime-js@2.108.1/node_modules/@supabase/realtime-js/dist/main/lib/version.js
|
|
8902
8911
|
var require_version = __commonJS((exports) => {
|
|
8903
8912
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8904
8913
|
exports.version = undefined;
|
|
8905
|
-
exports.version = "2.
|
|
8914
|
+
exports.version = "2.108.1";
|
|
8906
8915
|
});
|
|
8907
8916
|
|
|
8908
|
-
// ../../node_modules/.bun/@supabase+realtime-js@2.
|
|
8917
|
+
// ../../node_modules/.bun/@supabase+realtime-js@2.108.1/node_modules/@supabase/realtime-js/dist/main/lib/constants.js
|
|
8909
8918
|
var require_constants = __commonJS((exports) => {
|
|
8910
8919
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8911
8920
|
exports.CONNECTION_STATE = exports.TRANSPORTS = exports.CHANNEL_EVENTS = exports.CHANNEL_STATES = exports.SOCKET_STATES = exports.MAX_PUSH_BUFFER_SIZE = exports.WS_CLOSE_NORMAL = exports.DEFAULT_TIMEOUT = exports.VERSION = exports.DEFAULT_VSN = exports.VSN_2_0_0 = exports.VSN_1_0_0 = exports.DEFAULT_VERSION = undefined;
|
|
@@ -8950,7 +8959,7 @@ var require_constants = __commonJS((exports) => {
|
|
|
8950
8959
|
};
|
|
8951
8960
|
});
|
|
8952
8961
|
|
|
8953
|
-
// ../../node_modules/.bun/@supabase+realtime-js@2.
|
|
8962
|
+
// ../../node_modules/.bun/@supabase+realtime-js@2.108.1/node_modules/@supabase/realtime-js/dist/main/lib/serializer.js
|
|
8954
8963
|
var require_serializer = __commonJS((exports) => {
|
|
8955
8964
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8956
8965
|
|
|
@@ -9095,7 +9104,7 @@ var require_serializer = __commonJS((exports) => {
|
|
|
9095
9104
|
exports.default = Serializer;
|
|
9096
9105
|
});
|
|
9097
9106
|
|
|
9098
|
-
// ../../node_modules/.bun/@supabase+realtime-js@2.
|
|
9107
|
+
// ../../node_modules/.bun/@supabase+realtime-js@2.108.1/node_modules/@supabase/realtime-js/dist/main/lib/transformers.js
|
|
9099
9108
|
var require_transformers = __commonJS((exports) => {
|
|
9100
9109
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9101
9110
|
exports.httpEndpointURL = exports.toTimestampString = exports.toArray = exports.toJson = exports.toNumber = exports.toBoolean = exports.convertCell = exports.convertColumn = exports.convertChangeData = exports.PostgresTypes = undefined;
|
|
@@ -10642,7 +10651,7 @@ var require_phoenix_cjs = __commonJS((exports, module) => {
|
|
|
10642
10651
|
};
|
|
10643
10652
|
});
|
|
10644
10653
|
|
|
10645
|
-
// ../../node_modules/.bun/@supabase+realtime-js@2.
|
|
10654
|
+
// ../../node_modules/.bun/@supabase+realtime-js@2.108.1/node_modules/@supabase/realtime-js/dist/main/phoenix/presenceAdapter.js
|
|
10646
10655
|
var require_presenceAdapter = __commonJS((exports) => {
|
|
10647
10656
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10648
10657
|
var phoenix_1 = require_phoenix_cjs();
|
|
@@ -10715,7 +10724,7 @@ var require_presenceAdapter = __commonJS((exports) => {
|
|
|
10715
10724
|
}
|
|
10716
10725
|
});
|
|
10717
10726
|
|
|
10718
|
-
// ../../node_modules/.bun/@supabase+realtime-js@2.
|
|
10727
|
+
// ../../node_modules/.bun/@supabase+realtime-js@2.108.1/node_modules/@supabase/realtime-js/dist/main/RealtimePresence.js
|
|
10719
10728
|
var require_RealtimePresence = __commonJS((exports) => {
|
|
10720
10729
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10721
10730
|
exports.REALTIME_PRESENCE_LISTEN_EVENTS = undefined;
|
|
@@ -10740,7 +10749,7 @@ var require_RealtimePresence = __commonJS((exports) => {
|
|
|
10740
10749
|
exports.default = RealtimePresence;
|
|
10741
10750
|
});
|
|
10742
10751
|
|
|
10743
|
-
// ../../node_modules/.bun/@supabase+realtime-js@2.
|
|
10752
|
+
// ../../node_modules/.bun/@supabase+realtime-js@2.108.1/node_modules/@supabase/realtime-js/dist/main/lib/normalizeChannelError.js
|
|
10744
10753
|
var require_normalizeChannelError = __commonJS((exports) => {
|
|
10745
10754
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10746
10755
|
exports.normalizeChannelError = normalizeChannelError;
|
|
@@ -10763,7 +10772,7 @@ var require_normalizeChannelError = __commonJS((exports) => {
|
|
|
10763
10772
|
}
|
|
10764
10773
|
});
|
|
10765
10774
|
|
|
10766
|
-
// ../../node_modules/.bun/@supabase+realtime-js@2.
|
|
10775
|
+
// ../../node_modules/.bun/@supabase+realtime-js@2.108.1/node_modules/@supabase/realtime-js/dist/main/phoenix/channelAdapter.js
|
|
10767
10776
|
var require_channelAdapter = __commonJS((exports) => {
|
|
10768
10777
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10769
10778
|
var constants_1 = require_constants();
|
|
@@ -10865,7 +10874,7 @@ var require_channelAdapter = __commonJS((exports) => {
|
|
|
10865
10874
|
}
|
|
10866
10875
|
});
|
|
10867
10876
|
|
|
10868
|
-
// ../../node_modules/.bun/@supabase+realtime-js@2.
|
|
10877
|
+
// ../../node_modules/.bun/@supabase+realtime-js@2.108.1/node_modules/@supabase/realtime-js/dist/main/RealtimeChannel.js
|
|
10869
10878
|
var require_RealtimeChannel = __commonJS((exports) => {
|
|
10870
10879
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10871
10880
|
exports.REALTIME_CHANNEL_STATES = exports.REALTIME_SUBSCRIBE_STATES = exports.REALTIME_LISTEN_TYPES = exports.REALTIME_POSTGRES_CHANGES_LISTEN_EVENT = undefined;
|
|
@@ -11240,7 +11249,7 @@ var require_RealtimeChannel = __commonJS((exports) => {
|
|
|
11240
11249
|
exports.default = RealtimeChannel;
|
|
11241
11250
|
});
|
|
11242
11251
|
|
|
11243
|
-
// ../../node_modules/.bun/@supabase+realtime-js@2.
|
|
11252
|
+
// ../../node_modules/.bun/@supabase+realtime-js@2.108.1/node_modules/@supabase/realtime-js/dist/main/phoenix/socketAdapter.js
|
|
11244
11253
|
var require_socketAdapter = __commonJS((exports) => {
|
|
11245
11254
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11246
11255
|
var phoenix_1 = require_phoenix_cjs();
|
|
@@ -11353,7 +11362,7 @@ var require_socketAdapter = __commonJS((exports) => {
|
|
|
11353
11362
|
exports.default = SocketAdapter;
|
|
11354
11363
|
});
|
|
11355
11364
|
|
|
11356
|
-
// ../../node_modules/.bun/@supabase+realtime-js@2.
|
|
11365
|
+
// ../../node_modules/.bun/@supabase+realtime-js@2.108.1/node_modules/@supabase/realtime-js/dist/main/RealtimeClient.js
|
|
11357
11366
|
var require_RealtimeClient = __commonJS((exports) => {
|
|
11358
11367
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11359
11368
|
var tslib_1 = require_tslib();
|
|
@@ -11820,7 +11829,7 @@ var require_RealtimeClient = __commonJS((exports) => {
|
|
|
11820
11829
|
exports.default = RealtimeClient;
|
|
11821
11830
|
});
|
|
11822
11831
|
|
|
11823
|
-
// ../../node_modules/.bun/@supabase+realtime-js@2.
|
|
11832
|
+
// ../../node_modules/.bun/@supabase+realtime-js@2.108.1/node_modules/@supabase/realtime-js/dist/main/index.js
|
|
11824
11833
|
var require_main2 = __commonJS((exports) => {
|
|
11825
11834
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11826
11835
|
exports.WebSocketFactory = exports.REALTIME_CHANNEL_STATES = exports.REALTIME_SUBSCRIBE_STATES = exports.REALTIME_PRESENCE_LISTEN_EVENTS = exports.REALTIME_POSTGRES_CHANGES_LISTEN_EVENT = exports.REALTIME_LISTEN_TYPES = exports.RealtimeClient = exports.RealtimeChannel = exports.RealtimePresence = undefined;
|
|
@@ -12150,7 +12159,7 @@ var init_dist2 = __esm(() => {
|
|
|
12150
12159
|
};
|
|
12151
12160
|
});
|
|
12152
12161
|
|
|
12153
|
-
// ../../node_modules/.bun/@supabase+storage-js@2.
|
|
12162
|
+
// ../../node_modules/.bun/@supabase+storage-js@2.108.1/node_modules/@supabase/storage-js/dist/index.mjs
|
|
12154
12163
|
function _typeof2(o) {
|
|
12155
12164
|
"@babel/helpers - typeof";
|
|
12156
12165
|
return _typeof2 = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(o$1) {
|
|
@@ -12458,7 +12467,7 @@ var StorageError, StorageApiError, StorageUnknownError, resolveFetch = (customFe
|
|
|
12458
12467
|
throw error;
|
|
12459
12468
|
}
|
|
12460
12469
|
}
|
|
12461
|
-
}, DEFAULT_SEARCH_OPTIONS, DEFAULT_FILE_OPTIONS, StorageFileApi, version = "2.
|
|
12470
|
+
}, DEFAULT_SEARCH_OPTIONS, DEFAULT_FILE_OPTIONS, StorageFileApi, version = "2.108.1", DEFAULT_HEADERS, StorageBucketApi, StorageAnalyticsClient, VectorIndexApi, VectorDataApi, VectorBucketApi, StorageVectorsClient, VectorBucketScope, VectorIndexScope, StorageClient;
|
|
12462
12471
|
var init_dist3 = __esm(() => {
|
|
12463
12472
|
init_dist2();
|
|
12464
12473
|
StorageError = class extends Error {
|
|
@@ -13166,14 +13175,14 @@ var init_dist3 = __esm(() => {
|
|
|
13166
13175
|
};
|
|
13167
13176
|
});
|
|
13168
13177
|
|
|
13169
|
-
// ../../node_modules/.bun/@supabase+auth-js@2.
|
|
13178
|
+
// ../../node_modules/.bun/@supabase+auth-js@2.108.1/node_modules/@supabase/auth-js/dist/main/lib/version.js
|
|
13170
13179
|
var require_version2 = __commonJS((exports) => {
|
|
13171
13180
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13172
13181
|
exports.version = undefined;
|
|
13173
|
-
exports.version = "2.
|
|
13182
|
+
exports.version = "2.108.1";
|
|
13174
13183
|
});
|
|
13175
13184
|
|
|
13176
|
-
// ../../node_modules/.bun/@supabase+auth-js@2.
|
|
13185
|
+
// ../../node_modules/.bun/@supabase+auth-js@2.108.1/node_modules/@supabase/auth-js/dist/main/lib/constants.js
|
|
13177
13186
|
var require_constants2 = __commonJS((exports) => {
|
|
13178
13187
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13179
13188
|
exports.JWKS_TTL = exports.BASE64URL_REGEX = exports.API_VERSIONS = exports.API_VERSION_HEADER_NAME = exports.NETWORK_FAILURE = exports.DEFAULT_HEADERS = exports.AUDIENCE = exports.STORAGE_KEY = exports.GOTRUE_URL = exports.EXPIRY_MARGIN_MS = exports.AUTO_REFRESH_TICK_THRESHOLD = exports.AUTO_REFRESH_TICK_DURATION_MS = undefined;
|
|
@@ -13200,7 +13209,7 @@ var require_constants2 = __commonJS((exports) => {
|
|
|
13200
13209
|
exports.JWKS_TTL = 10 * 60 * 1000;
|
|
13201
13210
|
});
|
|
13202
13211
|
|
|
13203
|
-
// ../../node_modules/.bun/@supabase+auth-js@2.
|
|
13212
|
+
// ../../node_modules/.bun/@supabase+auth-js@2.108.1/node_modules/@supabase/auth-js/dist/main/lib/errors.js
|
|
13204
13213
|
var require_errors = __commonJS((exports) => {
|
|
13205
13214
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13206
13215
|
exports.AuthInvalidJwtError = exports.AuthWeakPasswordError = exports.AuthRefreshDiscardedError = exports.AuthRetryableFetchError = exports.AuthPKCECodeVerifierMissingError = exports.AuthPKCEGrantCodeExchangeError = exports.AuthImplicitGrantRedirectError = exports.AuthInvalidCredentialsError = exports.AuthInvalidTokenResponseError = exports.AuthSessionMissingError = exports.CustomAuthError = exports.AuthUnknownError = exports.AuthApiError = exports.AuthError = undefined;
|
|
@@ -13369,7 +13378,7 @@ var require_errors = __commonJS((exports) => {
|
|
|
13369
13378
|
exports.AuthInvalidJwtError = AuthInvalidJwtError;
|
|
13370
13379
|
});
|
|
13371
13380
|
|
|
13372
|
-
// ../../node_modules/.bun/@supabase+auth-js@2.
|
|
13381
|
+
// ../../node_modules/.bun/@supabase+auth-js@2.108.1/node_modules/@supabase/auth-js/dist/main/lib/base64url.js
|
|
13373
13382
|
var require_base64url = __commonJS((exports) => {
|
|
13374
13383
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13375
13384
|
exports.byteToBase64URL = byteToBase64URL;
|
|
@@ -13557,7 +13566,7 @@ var require_base64url = __commonJS((exports) => {
|
|
|
13557
13566
|
}
|
|
13558
13567
|
});
|
|
13559
13568
|
|
|
13560
|
-
// ../../node_modules/.bun/@supabase+auth-js@2.
|
|
13569
|
+
// ../../node_modules/.bun/@supabase+auth-js@2.108.1/node_modules/@supabase/auth-js/dist/main/lib/helpers.js
|
|
13561
13570
|
var require_helpers = __commonJS((exports) => {
|
|
13562
13571
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13563
13572
|
exports.Deferred = exports.removeItemAsync = exports.getItemAsync = exports.setItemAsync = exports.looksLikeFetchResponse = exports.resolveFetch = exports.supportsLocalStorage = exports.isBrowser = undefined;
|
|
@@ -13872,7 +13881,7 @@ var require_helpers = __commonJS((exports) => {
|
|
|
13872
13881
|
}
|
|
13873
13882
|
});
|
|
13874
13883
|
|
|
13875
|
-
// ../../node_modules/.bun/@supabase+auth-js@2.
|
|
13884
|
+
// ../../node_modules/.bun/@supabase+auth-js@2.108.1/node_modules/@supabase/auth-js/dist/main/lib/fetch.js
|
|
13876
13885
|
var require_fetch = __commonJS((exports) => {
|
|
13877
13886
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13878
13887
|
exports.handleError = handleError2;
|
|
@@ -14037,14 +14046,14 @@ var require_fetch = __commonJS((exports) => {
|
|
|
14037
14046
|
}
|
|
14038
14047
|
});
|
|
14039
14048
|
|
|
14040
|
-
// ../../node_modules/.bun/@supabase+auth-js@2.
|
|
14049
|
+
// ../../node_modules/.bun/@supabase+auth-js@2.108.1/node_modules/@supabase/auth-js/dist/main/lib/types.js
|
|
14041
14050
|
var require_types2 = __commonJS((exports) => {
|
|
14042
14051
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14043
14052
|
exports.SIGN_OUT_SCOPES = undefined;
|
|
14044
14053
|
exports.SIGN_OUT_SCOPES = ["global", "local", "others"];
|
|
14045
14054
|
});
|
|
14046
14055
|
|
|
14047
|
-
// ../../node_modules/.bun/@supabase+auth-js@2.
|
|
14056
|
+
// ../../node_modules/.bun/@supabase+auth-js@2.108.1/node_modules/@supabase/auth-js/dist/main/GoTrueAdminApi.js
|
|
14048
14057
|
var require_GoTrueAdminApi = __commonJS((exports) => {
|
|
14049
14058
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14050
14059
|
var tslib_1 = require_tslib();
|
|
@@ -14491,7 +14500,7 @@ var require_GoTrueAdminApi = __commonJS((exports) => {
|
|
|
14491
14500
|
exports.default = GoTrueAdminApi;
|
|
14492
14501
|
});
|
|
14493
14502
|
|
|
14494
|
-
// ../../node_modules/.bun/@supabase+auth-js@2.
|
|
14503
|
+
// ../../node_modules/.bun/@supabase+auth-js@2.108.1/node_modules/@supabase/auth-js/dist/main/lib/local-storage.js
|
|
14495
14504
|
var require_local_storage = __commonJS((exports) => {
|
|
14496
14505
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14497
14506
|
exports.memoryLocalStorageAdapter = memoryLocalStorageAdapter;
|
|
@@ -14510,7 +14519,7 @@ var require_local_storage = __commonJS((exports) => {
|
|
|
14510
14519
|
}
|
|
14511
14520
|
});
|
|
14512
14521
|
|
|
14513
|
-
// ../../node_modules/.bun/@supabase+auth-js@2.
|
|
14522
|
+
// ../../node_modules/.bun/@supabase+auth-js@2.108.1/node_modules/@supabase/auth-js/dist/main/lib/locks.js
|
|
14514
14523
|
var require_locks = __commonJS((exports) => {
|
|
14515
14524
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14516
14525
|
exports.ProcessLockAcquireTimeoutError = exports.NavigatorLockAcquireTimeoutError = exports.LockAcquireTimeoutError = exports.internals = undefined;
|
|
@@ -14684,7 +14693,7 @@ var require_locks = __commonJS((exports) => {
|
|
|
14684
14693
|
}
|
|
14685
14694
|
});
|
|
14686
14695
|
|
|
14687
|
-
// ../../node_modules/.bun/@supabase+auth-js@2.
|
|
14696
|
+
// ../../node_modules/.bun/@supabase+auth-js@2.108.1/node_modules/@supabase/auth-js/dist/main/lib/polyfills.js
|
|
14688
14697
|
var require_polyfills = __commonJS((exports) => {
|
|
14689
14698
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14690
14699
|
exports.polyfillGlobalThis = polyfillGlobalThis;
|
|
@@ -14708,7 +14717,7 @@ var require_polyfills = __commonJS((exports) => {
|
|
|
14708
14717
|
}
|
|
14709
14718
|
});
|
|
14710
14719
|
|
|
14711
|
-
// ../../node_modules/.bun/@supabase+auth-js@2.
|
|
14720
|
+
// ../../node_modules/.bun/@supabase+auth-js@2.108.1/node_modules/@supabase/auth-js/dist/main/lib/web3/ethereum.js
|
|
14712
14721
|
var require_ethereum = __commonJS((exports) => {
|
|
14713
14722
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14714
14723
|
exports.getAddress = getAddress;
|
|
@@ -14785,7 +14794,7 @@ ${suffix}`;
|
|
|
14785
14794
|
}
|
|
14786
14795
|
});
|
|
14787
14796
|
|
|
14788
|
-
// ../../node_modules/.bun/@supabase+auth-js@2.
|
|
14797
|
+
// ../../node_modules/.bun/@supabase+auth-js@2.108.1/node_modules/@supabase/auth-js/dist/main/lib/webauthn.errors.js
|
|
14789
14798
|
var require_webauthn_errors = __commonJS((exports) => {
|
|
14790
14799
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14791
14800
|
exports.WebAuthnUnknownError = exports.WebAuthnError = undefined;
|
|
@@ -14972,7 +14981,7 @@ var require_webauthn_errors = __commonJS((exports) => {
|
|
|
14972
14981
|
}
|
|
14973
14982
|
});
|
|
14974
14983
|
|
|
14975
|
-
// ../../node_modules/.bun/@supabase+auth-js@2.
|
|
14984
|
+
// ../../node_modules/.bun/@supabase+auth-js@2.108.1/node_modules/@supabase/auth-js/dist/main/lib/webauthn.js
|
|
14976
14985
|
var require_webauthn = __commonJS((exports) => {
|
|
14977
14986
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14978
14987
|
exports.WebAuthnApi = exports.DEFAULT_REQUEST_OPTIONS = exports.DEFAULT_CREATION_OPTIONS = exports.webAuthnAbortService = exports.WebAuthnAbortService = exports.identifyAuthenticationError = exports.identifyRegistrationError = exports.isWebAuthnError = exports.WebAuthnError = undefined;
|
|
@@ -15426,7 +15435,7 @@ var require_webauthn = __commonJS((exports) => {
|
|
|
15426
15435
|
exports.WebAuthnApi = WebAuthnApi;
|
|
15427
15436
|
});
|
|
15428
15437
|
|
|
15429
|
-
// ../../node_modules/.bun/@supabase+auth-js@2.
|
|
15438
|
+
// ../../node_modules/.bun/@supabase+auth-js@2.108.1/node_modules/@supabase/auth-js/dist/main/GoTrueClient.js
|
|
15430
15439
|
var require_GoTrueClient = __commonJS((exports) => {
|
|
15431
15440
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15432
15441
|
var tslib_1 = require_tslib();
|
|
@@ -16261,15 +16270,25 @@ var require_GoTrueClient = __commonJS((exports) => {
|
|
|
16261
16270
|
const endpoint = `${this.url}/resend`;
|
|
16262
16271
|
if ("email" in credentials) {
|
|
16263
16272
|
const { email, type, options } = credentials;
|
|
16273
|
+
let codeChallenge = null;
|
|
16274
|
+
let codeChallengeMethod = null;
|
|
16275
|
+
if (this.flowType === "pkce") {
|
|
16276
|
+
[codeChallenge, codeChallengeMethod] = await (0, helpers_1.getCodeChallengeAndMethod)(this.storage, this.storageKey);
|
|
16277
|
+
}
|
|
16264
16278
|
const { error } = await (0, fetch_1._request)(this.fetch, "POST", endpoint, {
|
|
16265
16279
|
headers: this.headers,
|
|
16266
16280
|
body: {
|
|
16267
16281
|
email,
|
|
16268
16282
|
type,
|
|
16269
|
-
gotrue_meta_security: { captcha_token: options === null || options === undefined ? undefined : options.captchaToken }
|
|
16283
|
+
gotrue_meta_security: { captcha_token: options === null || options === undefined ? undefined : options.captchaToken },
|
|
16284
|
+
code_challenge: codeChallenge,
|
|
16285
|
+
code_challenge_method: codeChallengeMethod
|
|
16270
16286
|
},
|
|
16271
16287
|
redirectTo: options === null || options === undefined ? undefined : options.emailRedirectTo
|
|
16272
16288
|
});
|
|
16289
|
+
if (error) {
|
|
16290
|
+
await (0, helpers_1.removeItemAsync)(this.storage, `${this.storageKey}-code-verifier`);
|
|
16291
|
+
}
|
|
16273
16292
|
return this._returnResult({ data: { user: null, session: null }, error });
|
|
16274
16293
|
} else if ("phone" in credentials) {
|
|
16275
16294
|
const { phone, type, options } = credentials;
|
|
@@ -16288,6 +16307,7 @@ var require_GoTrueClient = __commonJS((exports) => {
|
|
|
16288
16307
|
}
|
|
16289
16308
|
throw new errors_1.AuthInvalidCredentialsError("You must provide either an email or phone number and a type");
|
|
16290
16309
|
} catch (error) {
|
|
16310
|
+
await (0, helpers_1.removeItemAsync)(this.storage, `${this.storageKey}-code-verifier`);
|
|
16291
16311
|
if ((0, errors_1.isAuthError)(error)) {
|
|
16292
16312
|
return this._returnResult({ data: { user: null, session: null }, error });
|
|
16293
16313
|
}
|
|
@@ -17002,7 +17022,7 @@ var require_GoTrueClient = __commonJS((exports) => {
|
|
|
17002
17022
|
if ((0, errors_1.isAuthRefreshDiscardedError)(error)) {
|
|
17003
17023
|
this._debug(debugName, "refresh discarded by commit guard", error);
|
|
17004
17024
|
} else {
|
|
17005
|
-
|
|
17025
|
+
this._debug(debugName, "refresh failed", error);
|
|
17006
17026
|
if (!(0, errors_1.isAuthRetryableFetchError)(error)) {
|
|
17007
17027
|
this._debug(debugName, "refresh failed with a non-retryable error, removing the session", error);
|
|
17008
17028
|
await this._removeSession();
|
|
@@ -18068,7 +18088,7 @@ var require_GoTrueClient = __commonJS((exports) => {
|
|
|
18068
18088
|
exports.default = GoTrueClient;
|
|
18069
18089
|
});
|
|
18070
18090
|
|
|
18071
|
-
// ../../node_modules/.bun/@supabase+auth-js@2.
|
|
18091
|
+
// ../../node_modules/.bun/@supabase+auth-js@2.108.1/node_modules/@supabase/auth-js/dist/main/AuthAdminApi.js
|
|
18072
18092
|
var require_AuthAdminApi = __commonJS((exports) => {
|
|
18073
18093
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18074
18094
|
var tslib_1 = require_tslib();
|
|
@@ -18077,7 +18097,7 @@ var require_AuthAdminApi = __commonJS((exports) => {
|
|
|
18077
18097
|
exports.default = AuthAdminApi;
|
|
18078
18098
|
});
|
|
18079
18099
|
|
|
18080
|
-
// ../../node_modules/.bun/@supabase+auth-js@2.
|
|
18100
|
+
// ../../node_modules/.bun/@supabase+auth-js@2.108.1/node_modules/@supabase/auth-js/dist/main/AuthClient.js
|
|
18081
18101
|
var require_AuthClient = __commonJS((exports) => {
|
|
18082
18102
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18083
18103
|
var tslib_1 = require_tslib();
|
|
@@ -18086,7 +18106,7 @@ var require_AuthClient = __commonJS((exports) => {
|
|
|
18086
18106
|
exports.default = AuthClient;
|
|
18087
18107
|
});
|
|
18088
18108
|
|
|
18089
|
-
// ../../node_modules/.bun/@supabase+auth-js@2.
|
|
18109
|
+
// ../../node_modules/.bun/@supabase+auth-js@2.108.1/node_modules/@supabase/auth-js/dist/main/index.js
|
|
18090
18110
|
var require_main3 = __commonJS((exports) => {
|
|
18091
18111
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18092
18112
|
exports.processLock = exports.lockInternals = exports.NavigatorLockAcquireTimeoutError = exports.navigatorLock = exports.AuthClient = exports.AuthAdminApi = exports.GoTrueClient = exports.GoTrueAdminApi = undefined;
|
|
@@ -18116,7 +18136,7 @@ var require_main3 = __commonJS((exports) => {
|
|
|
18116
18136
|
} });
|
|
18117
18137
|
});
|
|
18118
18138
|
|
|
18119
|
-
// ../../node_modules/.bun/@supabase+supabase-js@2.
|
|
18139
|
+
// ../../node_modules/.bun/@supabase+supabase-js@2.108.1/node_modules/@supabase/supabase-js/dist/index.mjs
|
|
18120
18140
|
var exports_dist = {};
|
|
18121
18141
|
__export(exports_dist, {
|
|
18122
18142
|
createClient: () => createClient,
|
|
@@ -18377,7 +18397,7 @@ function shouldShowDeprecationWarning() {
|
|
|
18377
18397
|
return false;
|
|
18378
18398
|
return parseInt(versionMatch[1], 10) <= 18;
|
|
18379
18399
|
}
|
|
18380
|
-
var import_functions_js, import_realtime_js, import_auth_js, version2 = "2.
|
|
18400
|
+
var import_functions_js, import_realtime_js, import_auth_js, version2 = "2.108.1", JS_ENV = "", JS_RUNTIME_VERSION, _Deno$version, _process$version, _runtimeMeta, DEFAULT_HEADERS2, DEFAULT_GLOBAL_OPTIONS, DEFAULT_DB_OPTIONS, DEFAULT_AUTH_OPTIONS, DEFAULT_REALTIME_OPTIONS, DEFAULT_TRACE_PROPAGATION_OPTIONS, otelModulePromise = null, OTEL_PKG = "@opentelemetry/api", resolveFetch2 = (customFetch) => {
|
|
18381
18401
|
if (customFetch)
|
|
18382
18402
|
return (...args) => customFetch(...args);
|
|
18383
18403
|
return (...args) => fetch(...args);
|
|
@@ -24758,6 +24778,157 @@ var init_src = __esm(() => {
|
|
|
24758
24778
|
src_default = Postgres;
|
|
24759
24779
|
});
|
|
24760
24780
|
|
|
24781
|
+
// ../../_shared/mcp-tools/_utils.ts
|
|
24782
|
+
function getMaxResponseBytes() {
|
|
24783
|
+
const raw = globalThis.process?.env?.CEREFOX_MAX_RESPONSE_BYTES;
|
|
24784
|
+
if (raw === undefined || raw === "")
|
|
24785
|
+
return MAX_RESPONSE_BYTES;
|
|
24786
|
+
const n = Number.parseInt(raw, 10);
|
|
24787
|
+
return Number.isNaN(n) || n <= 0 ? MAX_RESPONSE_BYTES : n;
|
|
24788
|
+
}
|
|
24789
|
+
function getMinSearchScore() {
|
|
24790
|
+
const raw = globalThis.process?.env?.CEREFOX_MIN_SEARCH_SCORE;
|
|
24791
|
+
if (raw === undefined || raw === "")
|
|
24792
|
+
return DEFAULT_MIN_SEARCH_SCORE;
|
|
24793
|
+
const n = Number.parseFloat(raw);
|
|
24794
|
+
return Number.isNaN(n) || n < 0 || n > 1 ? DEFAULT_MIN_SEARCH_SCORE : n;
|
|
24795
|
+
}
|
|
24796
|
+
function applyByteBudget(rows, maxBytes) {
|
|
24797
|
+
const accepted = [];
|
|
24798
|
+
let usedBytes = 0;
|
|
24799
|
+
let truncated = false;
|
|
24800
|
+
for (const row of rows) {
|
|
24801
|
+
const rowBytes = new TextEncoder().encode(JSON.stringify(row)).length;
|
|
24802
|
+
if (usedBytes + rowBytes > maxBytes) {
|
|
24803
|
+
truncated = true;
|
|
24804
|
+
break;
|
|
24805
|
+
}
|
|
24806
|
+
accepted.push(row);
|
|
24807
|
+
usedBytes += rowBytes;
|
|
24808
|
+
}
|
|
24809
|
+
return { accepted, truncated, usedBytes };
|
|
24810
|
+
}
|
|
24811
|
+
function logUsage(supabase, params) {
|
|
24812
|
+
Promise.resolve(supabase.rpc("cerefox_log_usage", {
|
|
24813
|
+
p_operation: params.operation,
|
|
24814
|
+
p_access_path: params.accessPath,
|
|
24815
|
+
p_requestor: params.requestor ?? "mcp-agent",
|
|
24816
|
+
p_document_id: params.document_id ?? null,
|
|
24817
|
+
p_project_id: params.project_id ?? null,
|
|
24818
|
+
p_query_text: params.query_text ?? null,
|
|
24819
|
+
p_result_count: params.result_count ?? null,
|
|
24820
|
+
p_extra: params.extra ?? {}
|
|
24821
|
+
})).catch(() => {});
|
|
24822
|
+
}
|
|
24823
|
+
var MAX_RESPONSE_BYTES = 200000, DEFAULT_MIN_SEARCH_SCORE = 0.5;
|
|
24824
|
+
|
|
24825
|
+
// ../../_shared/mcp-tools/_projects.ts
|
|
24826
|
+
async function ensureDocumentInProject(supabase, documentId, projectName) {
|
|
24827
|
+
let projectId = null;
|
|
24828
|
+
const { data: proj } = await supabase.from("cerefox_projects").select("id").ilike("name", projectName).limit(1);
|
|
24829
|
+
if (proj?.length) {
|
|
24830
|
+
projectId = proj[0].id;
|
|
24831
|
+
} else {
|
|
24832
|
+
const { data: newProj } = await supabase.from("cerefox_projects").insert({ name: projectName }).select("id");
|
|
24833
|
+
projectId = newProj?.[0]?.id ?? null;
|
|
24834
|
+
}
|
|
24835
|
+
if (!projectId)
|
|
24836
|
+
return null;
|
|
24837
|
+
const { data: existing } = await supabase.from("cerefox_document_projects").select("document_id").eq("document_id", documentId).eq("project_id", projectId).limit(1);
|
|
24838
|
+
if (existing?.length)
|
|
24839
|
+
return projectId;
|
|
24840
|
+
const { error: insertErr } = await supabase.from("cerefox_document_projects").insert({ document_id: documentId, project_id: projectId });
|
|
24841
|
+
if (insertErr && !String(insertErr.message ?? "").includes("duplicate key")) {
|
|
24842
|
+
console.warn("ensureDocumentInProject: insert failed", insertErr);
|
|
24843
|
+
}
|
|
24844
|
+
return projectId;
|
|
24845
|
+
}
|
|
24846
|
+
async function setDocumentProjectsByName(supabase, documentId, projectNames) {
|
|
24847
|
+
const projectIds = [];
|
|
24848
|
+
for (const name of projectNames) {
|
|
24849
|
+
if (!name)
|
|
24850
|
+
continue;
|
|
24851
|
+
const { data: proj } = await supabase.from("cerefox_projects").select("id").ilike("name", name).limit(1);
|
|
24852
|
+
if (proj?.length) {
|
|
24853
|
+
projectIds.push(proj[0].id);
|
|
24854
|
+
} else {
|
|
24855
|
+
const { data: newProj } = await supabase.from("cerefox_projects").insert({ name }).select("id");
|
|
24856
|
+
if (newProj?.[0]?.id)
|
|
24857
|
+
projectIds.push(newProj[0].id);
|
|
24858
|
+
}
|
|
24859
|
+
}
|
|
24860
|
+
await supabase.from("cerefox_document_projects").delete().eq("document_id", documentId);
|
|
24861
|
+
if (projectIds.length > 0) {
|
|
24862
|
+
const rows = projectIds.map((pid) => ({ document_id: documentId, project_id: pid }));
|
|
24863
|
+
await supabase.from("cerefox_document_projects").insert(rows);
|
|
24864
|
+
}
|
|
24865
|
+
return projectIds;
|
|
24866
|
+
}
|
|
24867
|
+
async function replaceDocumentProjects(supabase, opts) {
|
|
24868
|
+
const { documentId, projectNames, author, authorType, accessPath } = opts;
|
|
24869
|
+
const seenLower = new Set;
|
|
24870
|
+
const cleanNames = [];
|
|
24871
|
+
for (const n of projectNames) {
|
|
24872
|
+
const stripped = (n ?? "").trim();
|
|
24873
|
+
if (!stripped)
|
|
24874
|
+
continue;
|
|
24875
|
+
const key = stripped.toLowerCase();
|
|
24876
|
+
if (seenLower.has(key))
|
|
24877
|
+
continue;
|
|
24878
|
+
seenLower.add(key);
|
|
24879
|
+
cleanNames.push(stripped);
|
|
24880
|
+
}
|
|
24881
|
+
const { data: doc } = await supabase.from("cerefox_documents").select("id, title").eq("id", documentId).is("deleted_at", null).limit(1);
|
|
24882
|
+
if (!doc?.length) {
|
|
24883
|
+
throw new Error(`Document not found (or soft-deleted): ${documentId}`);
|
|
24884
|
+
}
|
|
24885
|
+
const projectIds = [];
|
|
24886
|
+
for (const name of cleanNames) {
|
|
24887
|
+
const { data: proj } = await supabase.from("cerefox_projects").select("id").ilike("name", name).limit(1);
|
|
24888
|
+
if (proj?.length) {
|
|
24889
|
+
projectIds.push(proj[0].id);
|
|
24890
|
+
} else {
|
|
24891
|
+
const { data: newProj } = await supabase.from("cerefox_projects").insert({ name }).select("id");
|
|
24892
|
+
if (newProj?.[0]?.id)
|
|
24893
|
+
projectIds.push(newProj[0].id);
|
|
24894
|
+
}
|
|
24895
|
+
}
|
|
24896
|
+
await supabase.from("cerefox_document_projects").delete().eq("document_id", documentId);
|
|
24897
|
+
if (projectIds.length > 0) {
|
|
24898
|
+
const rows = projectIds.map((pid) => ({ document_id: documentId, project_id: pid }));
|
|
24899
|
+
await supabase.from("cerefox_document_projects").insert(rows);
|
|
24900
|
+
}
|
|
24901
|
+
try {
|
|
24902
|
+
await supabase.rpc("cerefox_create_audit_entry", {
|
|
24903
|
+
p_document_id: documentId,
|
|
24904
|
+
p_version_id: null,
|
|
24905
|
+
p_operation: "update-metadata",
|
|
24906
|
+
p_author: author,
|
|
24907
|
+
p_author_type: authorType,
|
|
24908
|
+
p_size_before: null,
|
|
24909
|
+
p_size_after: null,
|
|
24910
|
+
p_description: cleanNames.length > 0 ? `Set document projects to [${cleanNames.join(", ")}]` : "Cleared all project memberships"
|
|
24911
|
+
});
|
|
24912
|
+
} catch (err) {
|
|
24913
|
+
console.warn("replaceDocumentProjects: audit entry failed", err);
|
|
24914
|
+
}
|
|
24915
|
+
logUsage(supabase, {
|
|
24916
|
+
operation: "set-document-projects",
|
|
24917
|
+
accessPath,
|
|
24918
|
+
requestor: author,
|
|
24919
|
+
document_id: documentId,
|
|
24920
|
+
result_count: projectIds.length
|
|
24921
|
+
});
|
|
24922
|
+
return { documentTitle: doc[0].title, cleanNames, projectIds };
|
|
24923
|
+
}
|
|
24924
|
+
async function lookupProjectId(supabase, projectName) {
|
|
24925
|
+
const { data, error } = await supabase.from("cerefox_projects").select("id").ilike("name", projectName).limit(1);
|
|
24926
|
+
if (error || !data?.length)
|
|
24927
|
+
return null;
|
|
24928
|
+
return data[0].id;
|
|
24929
|
+
}
|
|
24930
|
+
var init__projects = () => {};
|
|
24931
|
+
|
|
24761
24932
|
// src/cli/util/bundled-docs.ts
|
|
24762
24933
|
import { existsSync as existsSync8, readdirSync as readdirSync3, readFileSync as readFileSync6, statSync } from "node:fs";
|
|
24763
24934
|
import { dirname as dirname3, join as join7, resolve as resolve2 } from "node:path";
|
|
@@ -39828,10 +39999,10 @@ var require_flate = __commonJS((exports) => {
|
|
|
39828
39999
|
var GenericWorker = require_GenericWorker();
|
|
39829
40000
|
var ARRAY_TYPE = USE_TYPEDARRAY ? "uint8array" : "array";
|
|
39830
40001
|
exports.magic = "\b\x00";
|
|
39831
|
-
function FlateWorker(
|
|
39832
|
-
GenericWorker.call(this, "FlateWorker/" +
|
|
40002
|
+
function FlateWorker(action18, options) {
|
|
40003
|
+
GenericWorker.call(this, "FlateWorker/" + action18);
|
|
39833
40004
|
this._pako = null;
|
|
39834
|
-
this._pakoAction =
|
|
40005
|
+
this._pakoAction = action18;
|
|
39835
40006
|
this._pakoOptions = options;
|
|
39836
40007
|
this.meta = {};
|
|
39837
40008
|
}
|
|
@@ -53732,50 +53903,6 @@ var require_cli_progress = __commonJS((exports, module) => {
|
|
|
53732
53903
|
};
|
|
53733
53904
|
});
|
|
53734
53905
|
|
|
53735
|
-
// ../../_shared/mcp-tools/_utils.ts
|
|
53736
|
-
function getMaxResponseBytes() {
|
|
53737
|
-
const raw = globalThis.process?.env?.CEREFOX_MAX_RESPONSE_BYTES;
|
|
53738
|
-
if (raw === undefined || raw === "")
|
|
53739
|
-
return MAX_RESPONSE_BYTES;
|
|
53740
|
-
const n = Number.parseInt(raw, 10);
|
|
53741
|
-
return Number.isNaN(n) || n <= 0 ? MAX_RESPONSE_BYTES : n;
|
|
53742
|
-
}
|
|
53743
|
-
function getMinSearchScore() {
|
|
53744
|
-
const raw = globalThis.process?.env?.CEREFOX_MIN_SEARCH_SCORE;
|
|
53745
|
-
if (raw === undefined || raw === "")
|
|
53746
|
-
return DEFAULT_MIN_SEARCH_SCORE;
|
|
53747
|
-
const n = Number.parseFloat(raw);
|
|
53748
|
-
return Number.isNaN(n) || n < 0 || n > 1 ? DEFAULT_MIN_SEARCH_SCORE : n;
|
|
53749
|
-
}
|
|
53750
|
-
function applyByteBudget(rows, maxBytes) {
|
|
53751
|
-
const accepted = [];
|
|
53752
|
-
let usedBytes = 0;
|
|
53753
|
-
let truncated = false;
|
|
53754
|
-
for (const row of rows) {
|
|
53755
|
-
const rowBytes = new TextEncoder().encode(JSON.stringify(row)).length;
|
|
53756
|
-
if (usedBytes + rowBytes > maxBytes) {
|
|
53757
|
-
truncated = true;
|
|
53758
|
-
break;
|
|
53759
|
-
}
|
|
53760
|
-
accepted.push(row);
|
|
53761
|
-
usedBytes += rowBytes;
|
|
53762
|
-
}
|
|
53763
|
-
return { accepted, truncated, usedBytes };
|
|
53764
|
-
}
|
|
53765
|
-
function logUsage(supabase, params) {
|
|
53766
|
-
Promise.resolve(supabase.rpc("cerefox_log_usage", {
|
|
53767
|
-
p_operation: params.operation,
|
|
53768
|
-
p_access_path: params.accessPath,
|
|
53769
|
-
p_requestor: params.requestor ?? "mcp-agent",
|
|
53770
|
-
p_document_id: params.document_id ?? null,
|
|
53771
|
-
p_project_id: params.project_id ?? null,
|
|
53772
|
-
p_query_text: params.query_text ?? null,
|
|
53773
|
-
p_result_count: params.result_count ?? null,
|
|
53774
|
-
p_extra: params.extra ?? {}
|
|
53775
|
-
})).catch(() => {});
|
|
53776
|
-
}
|
|
53777
|
-
var MAX_RESPONSE_BYTES = 200000, DEFAULT_MIN_SEARCH_SCORE = 0.5;
|
|
53778
|
-
|
|
53779
53906
|
// ../../_shared/mcp-tools/audit-log.ts
|
|
53780
53907
|
async function handler(supabase, args, ctx) {
|
|
53781
53908
|
const params = {};
|
|
@@ -53910,15 +54037,15 @@ var init_get_document = __esm(() => {
|
|
|
53910
54037
|
});
|
|
53911
54038
|
|
|
53912
54039
|
// ../../_shared/mcp-tools/get-help-content.ts
|
|
53913
|
-
var HELP_FULL = '# Cerefox Knowledge Base -- Agent Quick Reference\n\nCerefox is a persistent, shared knowledge base. You have **10 MCP tools** (9 of them have CLI equivalents — `cerefox_get_help` is MCP-only). For the full guide, search Cerefox for "How AI Agents Use Cerefox" or call `cerefox_get_help` to retrieve this content over MCP.\n\n## Tools\n\n| Tool | Purpose | Key params |\n|------|---------|------------|\n| `cerefox_search` | Find documents (hybrid FTS + semantic) | `query` (required), `project_name`, `metadata_filter`, `requestor` |\n| `cerefox_ingest` | Save or update a document | `title`, `content` (required), `document_id` (update by ID), `update_if_exists`, `project_name` (single, non-destructive add on update), `project_names` (list, destructive replace on update), `metadata`, `author` |\n| `cerefox_get_document` | Get full document by ID | `document_id` (required) |\n| `cerefox_list_versions` | Version history of a document | `document_id` (required) |\n| `cerefox_metadata_search` | Find docs by metadata (no text query) | `metadata_filter` (
|
|
54040
|
+
var HELP_FULL = '# Cerefox Knowledge Base -- Agent Quick Reference\n\nCerefox is a persistent, shared knowledge base. You have **10 MCP tools** (9 of them have CLI equivalents — `cerefox_get_help` is MCP-only). For the full guide, search Cerefox for "How AI Agents Use Cerefox" or call `cerefox_get_help` to retrieve this content over MCP.\n\n## Tools\n\n| Tool | Purpose | Key params |\n|------|---------|------------|\n| `cerefox_search` | Find documents (hybrid FTS + semantic) | `query` (required), `project_name`, `metadata_filter`, `requestor` |\n| `cerefox_ingest` | Save or update a document | `title`, `content` (required), `document_id` (update by ID), `update_if_exists`, `project_name` (single, non-destructive add on update), `project_names` (list, destructive replace on update), `metadata`, `author` |\n| `cerefox_get_document` | Get full document by ID | `document_id` (required) |\n| `cerefox_list_versions` | Version history of a document | `document_id` (required) |\n| `cerefox_metadata_search` | Find or list docs by metadata, project, or time (no text query) | `metadata_filter`, `project_name` (list a project\'s docs), `updated_since`, `include_content` — **at least one** of metadata_filter/project_name/updated_since/created_since |\n| `cerefox_list_metadata_keys` | Discover available metadata keys | (none required) |\n| `cerefox_list_projects` | List all projects | (none required) |\n| `cerefox_set_document_projects` | Set doc\'s project memberships to exactly the given list (destructive replace; metadata-only, no content change) | `document_id`, `project_names` (required) |\n| `cerefox_get_audit_log` | Query write operation history | `document_id`, `author`, `operation`, `since` |\n| `cerefox_get_help` | Retrieve Cerefox conventions (this reference) over MCP. **Call this whenever uncertain.** | `topic` (optional, case-insensitive H2 substring match) |\n\n## Essential Rules\n\n1. **Search before ingesting** -- check if the document exists first.\n2. **Prefer ID-based updates** -- pass `document_id` from search results for deterministic updates. Falls back to title-matching with `update_if_exists: true`.\n3. **Set `author`/`requestor`** to your name on every call (e.g., "Claude Code", "archiver"). On MCP, pass as parameters. On CLI, pass `--author`/`--author-type`/`--requestor` flags, or rely on `CEREFOX_AUTHOR_NAME`/`CEREFOX_AUTHOR_TYPE`/`CEREFOX_REQUESTOR_NAME` env vars set in the user\'s `.env`.\n4. **Use `document_id` from search results** `[id: uuid]` for get_document and list_versions.\n5. **Add metadata** -- at minimum `type` ("decision-log", "research", "design-doc") and `status` ("active", "draft").\n6. **Write structured Markdown** with H1/H2/H3 headings for good chunking and search.\n7. **Deletes are soft (recoverable); purge is web-UI-only.** If you decide to delete, surface it to the user (`I soft-deleted X — recoverable from the Cerefox web UI trash`). You cannot un-do your own delete from agent code by design.\n8. **Cross-doc links inside content**: **always use `[Text](document-uuid)`.** UUIDs are the only fully reliable link form — stable across title changes, never ambiguous, no encoding gotchas. Every `cerefox_search` result shows `[id: <uuid>]` after the title; grab it and use it. Title-based linking (`[Text](<Title With Spaces>)`) is fragile (breaks on colons, parens, ampersands, brackets — silently navigates to wrong page) — **don\'t write title-based links**; do an extra search to get the UUID instead. Repo-path forms (`[Text](docs/path.md)`) exist for repo-ingested files; don\'t construct manually. See `AGENT_GUIDE.md → Writing linkable content` for the full rule.\n9. **Project memberships — non-destructive by default**: on `cerefox_ingest` updates, **`project_name` (singular) is a non-destructive add** (ensures membership, preserves others). Use **`project_names` (list)** when you want to set the doc\'s full project set in one call (destructive replace). For metadata-only project changes without writing content, use **`cerefox_set_document_projects(document_id, project_names)`** — that tool is the destructive-replace contract made explicit. Never call `cerefox_set_document_projects` with a single name when you mean "add" — that would REMOVE the doc from all other projects. When in doubt, use `cerefox_ingest` with singular `project_name`.\n\n## Update Workflow (ID-based -- preferred)\n\n```\nsearch("topic") -> find doc [id: abc123] -> get_document(abc123) -> modify ->\ningest(title="Same Title", content="...", document_id="abc123", author="my-agent")\n```\n\n## Update Workflow (title-based -- fallback)\n\n```\nsearch("topic") -> find doc -> modify ->\ningest(title="Same Title", content="...", update_if_exists=true, author="my-agent")\n```\n\n## Catch-Up Workflow\n\n```\nmetadata_search(metadata_filter={"type": "decision-log"}, updated_since="2026-03-28T00:00:00Z")\n```\n\n## CLI fallback (when MCP is unavailable)\n\nIf `cerefox_search` is not in your tool list, your user has likely installed the Cerefox CLI. The canonical invocation is plain **`cerefox <subcommand>`** (the TypeScript CLI, installed via `npm install -g @cerefox/memory`). It uses a resource-verb shape (`cerefox document get`, `cerefox project list`, …). The legacy Python `uv run cerefox` is now a frozen husk as of v0.9 — only `uv run cerefox mcp` still works.\n\nSame operations, same conventions. Full reference: [`docs/guides/cli.md`](docs/guides/cli.md). CLI flag names match MCP parameter names exactly (e.g. `metadata_filter` ↔ `--metadata-filter`); common flags also have single-letter short forms (`-f`, `-p`, `-c`, `-m`, `-u`, `-a`, `-r`). Use the canonical long name (what `--help` shows) or its short form — there are no long-form aliases like `--filter` or `--count`.\n\n| MCP tool | CLI |\n|---|---|\n| `cerefox_search` | `cerefox search "<q>" --requestor "<your-name>"` |\n| `cerefox_ingest` (paste) | `printf \'...\' \\| cerefox document ingest --paste --title "<t>" --author "<your-name>" --author-type agent` |\n| `cerefox_ingest` (update by ID) | `printf \'...\' \\| cerefox document ingest --paste --title "<t>" --document-id "<uuid>" --author "<your-name>" --author-type agent` |\n| `cerefox_get_document` | `cerefox document get <id> --version-id <vid> --requestor "<your-name>"` |\n| `cerefox_list_versions` | `cerefox document version list <id> --requestor "<your-name>"` |\n| `cerefox_list_projects` | `cerefox project list --requestor "<your-name>"` |\n| `cerefox_list_metadata_keys` | `cerefox metadata keys` |\n| `cerefox_metadata_search` | `cerefox metadata search --metadata-filter \'<json>\' --requestor "<your-name>"` (list a project: `cerefox document list --project <name>`) |\n| `cerefox_set_document_projects` | `cerefox document set-projects <id> <name...> --author "<your-name>" --author-type agent` (or `--clear` to remove all) |\n| `cerefox_get_audit_log` | `cerefox audit list --requestor "<your-name>"` (add `--json` for scripted access) |\n| `cerefox_get_help` | `cerefox guides show agent-quick-reference` (or `cerefox guides list` for the full bundled-docs index) |\n\n**Set identity on every call**, exactly as you would on MCP:\n- Writes (`document ingest`, `document ingest-dir`): `--author "<your-name>" --author-type agent`\n- Reads: `--requestor "<your-name>"`\n\nOr have your user set `CEREFOX_AUTHOR_NAME` / `CEREFOX_AUTHOR_TYPE` / `CEREFOX_REQUESTOR_NAME` in their `.env` to apply defaults once.\n', HELP_SECTIONS, HELP_SECTION_HEADINGS;
|
|
53914
54041
|
var init_get_help_content = __esm(() => {
|
|
53915
54042
|
HELP_SECTIONS = {
|
|
53916
|
-
Tools: "## Tools\n\n| Tool | Purpose | Key params |\n|------|---------|------------|\n| `cerefox_search` | Find documents (hybrid FTS + semantic) | `query` (required), `project_name`, `metadata_filter`, `requestor` |\n| `cerefox_ingest` | Save or update a document | `title`, `content` (required), `document_id` (update by ID), `update_if_exists`, `project_name` (single, non-destructive add on update), `project_names` (list, destructive replace on update), `metadata`, `author` |\n| `cerefox_get_document` | Get full document by ID | `document_id` (required) |\n| `cerefox_list_versions` | Version history of a document | `document_id` (required) |\n| `cerefox_metadata_search` | Find docs by metadata (no text query) | `metadata_filter` (
|
|
54043
|
+
Tools: "## Tools\n\n| Tool | Purpose | Key params |\n|------|---------|------------|\n| `cerefox_search` | Find documents (hybrid FTS + semantic) | `query` (required), `project_name`, `metadata_filter`, `requestor` |\n| `cerefox_ingest` | Save or update a document | `title`, `content` (required), `document_id` (update by ID), `update_if_exists`, `project_name` (single, non-destructive add on update), `project_names` (list, destructive replace on update), `metadata`, `author` |\n| `cerefox_get_document` | Get full document by ID | `document_id` (required) |\n| `cerefox_list_versions` | Version history of a document | `document_id` (required) |\n| `cerefox_metadata_search` | Find or list docs by metadata, project, or time (no text query) | `metadata_filter`, `project_name` (list a project's docs), `updated_since`, `include_content` — **at least one** of metadata_filter/project_name/updated_since/created_since |\n| `cerefox_list_metadata_keys` | Discover available metadata keys | (none required) |\n| `cerefox_list_projects` | List all projects | (none required) |\n| `cerefox_set_document_projects` | Set doc's project memberships to exactly the given list (destructive replace; metadata-only, no content change) | `document_id`, `project_names` (required) |\n| `cerefox_get_audit_log` | Query write operation history | `document_id`, `author`, `operation`, `since` |\n| `cerefox_get_help` | Retrieve Cerefox conventions (this reference) over MCP. **Call this whenever uncertain.** | `topic` (optional, case-insensitive H2 substring match) |",
|
|
53917
54044
|
"Essential Rules": '## Essential Rules\n\n1. **Search before ingesting** -- check if the document exists first.\n2. **Prefer ID-based updates** -- pass `document_id` from search results for deterministic updates. Falls back to title-matching with `update_if_exists: true`.\n3. **Set `author`/`requestor`** to your name on every call (e.g., "Claude Code", "archiver"). On MCP, pass as parameters. On CLI, pass `--author`/`--author-type`/`--requestor` flags, or rely on `CEREFOX_AUTHOR_NAME`/`CEREFOX_AUTHOR_TYPE`/`CEREFOX_REQUESTOR_NAME` env vars set in the user\'s `.env`.\n4. **Use `document_id` from search results** `[id: uuid]` for get_document and list_versions.\n5. **Add metadata** -- at minimum `type` ("decision-log", "research", "design-doc") and `status` ("active", "draft").\n6. **Write structured Markdown** with H1/H2/H3 headings for good chunking and search.\n7. **Deletes are soft (recoverable); purge is web-UI-only.** If you decide to delete, surface it to the user (`I soft-deleted X — recoverable from the Cerefox web UI trash`). You cannot un-do your own delete from agent code by design.\n8. **Cross-doc links inside content**: **always use `[Text](document-uuid)`.** UUIDs are the only fully reliable link form — stable across title changes, never ambiguous, no encoding gotchas. Every `cerefox_search` result shows `[id: <uuid>]` after the title; grab it and use it. Title-based linking (`[Text](<Title With Spaces>)`) is fragile (breaks on colons, parens, ampersands, brackets — silently navigates to wrong page) — **don\'t write title-based links**; do an extra search to get the UUID instead. Repo-path forms (`[Text](docs/path.md)`) exist for repo-ingested files; don\'t construct manually. See `AGENT_GUIDE.md → Writing linkable content` for the full rule.\n9. **Project memberships — non-destructive by default**: on `cerefox_ingest` updates, **`project_name` (singular) is a non-destructive add** (ensures membership, preserves others). Use **`project_names` (list)** when you want to set the doc\'s full project set in one call (destructive replace). For metadata-only project changes without writing content, use **`cerefox_set_document_projects(document_id, project_names)`** — that tool is the destructive-replace contract made explicit. Never call `cerefox_set_document_projects` with a single name when you mean "add" — that would REMOVE the doc from all other projects. When in doubt, use `cerefox_ingest` with singular `project_name`.',
|
|
53918
54045
|
"Update Workflow (ID-based -- preferred)": '## Update Workflow (ID-based -- preferred)\n\n```\nsearch("topic") -> find doc [id: abc123] -> get_document(abc123) -> modify ->\ningest(title="Same Title", content="...", document_id="abc123", author="my-agent")\n```',
|
|
53919
54046
|
"Update Workflow (title-based -- fallback)": '## Update Workflow (title-based -- fallback)\n\n```\nsearch("topic") -> find doc -> modify ->\ningest(title="Same Title", content="...", update_if_exists=true, author="my-agent")\n```',
|
|
53920
54047
|
"Catch-Up Workflow": '## Catch-Up Workflow\n\n```\nmetadata_search(metadata_filter={"type": "decision-log"}, updated_since="2026-03-28T00:00:00Z")\n```',
|
|
53921
|
-
"CLI fallback (when MCP is unavailable)": '## CLI fallback (when MCP is unavailable)\n\nIf `cerefox_search` is not in your tool list, your user has likely installed the Cerefox CLI. The canonical invocation is plain **`cerefox <subcommand>`** (the TypeScript CLI, installed via `npm install -g @cerefox/memory`). It uses a resource-verb shape (`cerefox document get`, `cerefox project list`, …). The legacy Python `uv run cerefox` is now a frozen husk as of v0.9 — only `uv run cerefox mcp` still works.\n\nSame operations, same conventions. Full reference: [`docs/guides/cli.md`](docs/guides/cli.md). CLI flag names match MCP parameter names exactly (e.g. `metadata_filter` ↔ `--metadata-filter`); common flags also have single-letter short forms (`-f`, `-p`, `-c`, `-m`, `-u`, `-a`, `-r`). Use the canonical long name (what `--help` shows) or its short form — there are no long-form aliases like `--filter` or `--count`.\n\n| MCP tool | CLI |\n|---|---|\n| `cerefox_search` | `cerefox search "<q>" --requestor "<your-name>"` |\n| `cerefox_ingest` (paste) | `printf \'...\' \\| cerefox document ingest --paste --title "<t>" --author "<your-name>" --author-type agent` |\n| `cerefox_ingest` (update by ID) | `printf \'...\' \\| cerefox document ingest --paste --title "<t>" --document-id "<uuid>" --author "<your-name>" --author-type agent` |\n| `cerefox_get_document` | `cerefox document get <id> --version-id <vid> --requestor "<your-name>"` |\n| `cerefox_list_versions` | `cerefox document version list <id> --requestor "<your-name>"` |\n| `cerefox_list_projects` | `cerefox project list --requestor "<your-name>"` |\n| `cerefox_list_metadata_keys` | `cerefox metadata keys` |\n| `cerefox_metadata_search` | `cerefox metadata search --metadata-filter \'<json>\' --requestor "<your-name>"` |\n| `cerefox_set_document_projects` |
|
|
54048
|
+
"CLI fallback (when MCP is unavailable)": '## CLI fallback (when MCP is unavailable)\n\nIf `cerefox_search` is not in your tool list, your user has likely installed the Cerefox CLI. The canonical invocation is plain **`cerefox <subcommand>`** (the TypeScript CLI, installed via `npm install -g @cerefox/memory`). It uses a resource-verb shape (`cerefox document get`, `cerefox project list`, …). The legacy Python `uv run cerefox` is now a frozen husk as of v0.9 — only `uv run cerefox mcp` still works.\n\nSame operations, same conventions. Full reference: [`docs/guides/cli.md`](docs/guides/cli.md). CLI flag names match MCP parameter names exactly (e.g. `metadata_filter` ↔ `--metadata-filter`); common flags also have single-letter short forms (`-f`, `-p`, `-c`, `-m`, `-u`, `-a`, `-r`). Use the canonical long name (what `--help` shows) or its short form — there are no long-form aliases like `--filter` or `--count`.\n\n| MCP tool | CLI |\n|---|---|\n| `cerefox_search` | `cerefox search "<q>" --requestor "<your-name>"` |\n| `cerefox_ingest` (paste) | `printf \'...\' \\| cerefox document ingest --paste --title "<t>" --author "<your-name>" --author-type agent` |\n| `cerefox_ingest` (update by ID) | `printf \'...\' \\| cerefox document ingest --paste --title "<t>" --document-id "<uuid>" --author "<your-name>" --author-type agent` |\n| `cerefox_get_document` | `cerefox document get <id> --version-id <vid> --requestor "<your-name>"` |\n| `cerefox_list_versions` | `cerefox document version list <id> --requestor "<your-name>"` |\n| `cerefox_list_projects` | `cerefox project list --requestor "<your-name>"` |\n| `cerefox_list_metadata_keys` | `cerefox metadata keys` |\n| `cerefox_metadata_search` | `cerefox metadata search --metadata-filter \'<json>\' --requestor "<your-name>"` (list a project: `cerefox document list --project <name>`) |\n| `cerefox_set_document_projects` | `cerefox document set-projects <id> <name...> --author "<your-name>" --author-type agent` (or `--clear` to remove all) |\n| `cerefox_get_audit_log` | `cerefox audit list --requestor "<your-name>"` (add `--json` for scripted access) |\n| `cerefox_get_help` | `cerefox guides show agent-quick-reference` (or `cerefox guides list` for the full bundled-docs index) |\n\n**Set identity on every call**, exactly as you would on MCP:\n- Writes (`document ingest`, `document ingest-dir`): `--author "<your-name>" --author-type agent`\n- Reads: `--requestor "<your-name>"`\n\nOr have your user set `CEREFOX_AUTHOR_NAME` / `CEREFOX_AUTHOR_TYPE` / `CEREFOX_REQUESTOR_NAME` in their `.env` to apply defaults once.'
|
|
53922
54049
|
};
|
|
53923
54050
|
HELP_SECTION_HEADINGS = ["Tools", "Essential Rules", "Update Workflow (ID-based -- preferred)", "Update Workflow (title-based -- fallback)", "Catch-Up Workflow", "CLI fallback (when MCP is unavailable)"];
|
|
53924
54051
|
});
|
|
@@ -54137,55 +54264,6 @@ async function sha256hex(text) {
|
|
|
54137
54264
|
}
|
|
54138
54265
|
var MAX_CHUNK_CHARS = 4000;
|
|
54139
54266
|
|
|
54140
|
-
// ../../_shared/mcp-tools/_projects.ts
|
|
54141
|
-
async function ensureDocumentInProject(supabase, documentId, projectName) {
|
|
54142
|
-
let projectId = null;
|
|
54143
|
-
const { data: proj } = await supabase.from("cerefox_projects").select("id").ilike("name", projectName).limit(1);
|
|
54144
|
-
if (proj?.length) {
|
|
54145
|
-
projectId = proj[0].id;
|
|
54146
|
-
} else {
|
|
54147
|
-
const { data: newProj } = await supabase.from("cerefox_projects").insert({ name: projectName }).select("id");
|
|
54148
|
-
projectId = newProj?.[0]?.id ?? null;
|
|
54149
|
-
}
|
|
54150
|
-
if (!projectId)
|
|
54151
|
-
return null;
|
|
54152
|
-
const { data: existing } = await supabase.from("cerefox_document_projects").select("document_id").eq("document_id", documentId).eq("project_id", projectId).limit(1);
|
|
54153
|
-
if (existing?.length)
|
|
54154
|
-
return projectId;
|
|
54155
|
-
const { error: insertErr } = await supabase.from("cerefox_document_projects").insert({ document_id: documentId, project_id: projectId });
|
|
54156
|
-
if (insertErr && !String(insertErr.message ?? "").includes("duplicate key")) {
|
|
54157
|
-
console.warn("ensureDocumentInProject: insert failed", insertErr);
|
|
54158
|
-
}
|
|
54159
|
-
return projectId;
|
|
54160
|
-
}
|
|
54161
|
-
async function setDocumentProjectsByName(supabase, documentId, projectNames) {
|
|
54162
|
-
const projectIds = [];
|
|
54163
|
-
for (const name of projectNames) {
|
|
54164
|
-
if (!name)
|
|
54165
|
-
continue;
|
|
54166
|
-
const { data: proj } = await supabase.from("cerefox_projects").select("id").ilike("name", name).limit(1);
|
|
54167
|
-
if (proj?.length) {
|
|
54168
|
-
projectIds.push(proj[0].id);
|
|
54169
|
-
} else {
|
|
54170
|
-
const { data: newProj } = await supabase.from("cerefox_projects").insert({ name }).select("id");
|
|
54171
|
-
if (newProj?.[0]?.id)
|
|
54172
|
-
projectIds.push(newProj[0].id);
|
|
54173
|
-
}
|
|
54174
|
-
}
|
|
54175
|
-
await supabase.from("cerefox_document_projects").delete().eq("document_id", documentId);
|
|
54176
|
-
if (projectIds.length > 0) {
|
|
54177
|
-
const rows = projectIds.map((pid) => ({ document_id: documentId, project_id: pid }));
|
|
54178
|
-
await supabase.from("cerefox_document_projects").insert(rows);
|
|
54179
|
-
}
|
|
54180
|
-
return projectIds;
|
|
54181
|
-
}
|
|
54182
|
-
async function lookupProjectId(supabase, projectName) {
|
|
54183
|
-
const { data, error: error2 } = await supabase.from("cerefox_projects").select("id").ilike("name", projectName).limit(1);
|
|
54184
|
-
if (error2 || !data?.length)
|
|
54185
|
-
return null;
|
|
54186
|
-
return data[0].id;
|
|
54187
|
-
}
|
|
54188
|
-
|
|
54189
54267
|
// ../../_shared/mcp-tools/ingest.ts
|
|
54190
54268
|
async function handler4(supabase, args, ctx) {
|
|
54191
54269
|
const title = args.title?.trim();
|
|
@@ -54372,6 +54450,7 @@ ${c2.content}`);
|
|
|
54372
54450
|
}
|
|
54373
54451
|
var ingestTool;
|
|
54374
54452
|
var init_ingest = __esm(() => {
|
|
54453
|
+
init__projects();
|
|
54375
54454
|
init_types3();
|
|
54376
54455
|
ingestTool = {
|
|
54377
54456
|
name: "cerefox_ingest",
|
|
@@ -54545,11 +54624,12 @@ async function handler8(supabase, args, ctx) {
|
|
|
54545
54624
|
const limit = args.limit ?? 10;
|
|
54546
54625
|
const include_content = args.include_content ?? false;
|
|
54547
54626
|
const requested_max_bytes = args.max_bytes;
|
|
54548
|
-
if (
|
|
54549
|
-
throw new McpInvalidParams("metadata_filter
|
|
54627
|
+
if (metadata_filter !== undefined && (typeof metadata_filter !== "object" || Array.isArray(metadata_filter))) {
|
|
54628
|
+
throw new McpInvalidParams("metadata_filter must be a JSON object when provided");
|
|
54550
54629
|
}
|
|
54551
|
-
|
|
54552
|
-
|
|
54630
|
+
const has_metadata = !!metadata_filter && Object.keys(metadata_filter).length > 0;
|
|
54631
|
+
if (!has_metadata && !project_name && !updated_since && !created_since) {
|
|
54632
|
+
throw new McpInvalidParams("Provide at least one of: metadata_filter, project_name, updated_since, or created_since.");
|
|
54553
54633
|
}
|
|
54554
54634
|
let projectId = null;
|
|
54555
54635
|
if (project_name) {
|
|
@@ -54560,7 +54640,7 @@ async function handler8(supabase, args, ctx) {
|
|
|
54560
54640
|
const ceiling = getMaxResponseBytes();
|
|
54561
54641
|
const max_bytes = include_content ? Math.min(requested_max_bytes ?? ceiling, ceiling) : null;
|
|
54562
54642
|
const params = {
|
|
54563
|
-
p_metadata_filter: metadata_filter,
|
|
54643
|
+
p_metadata_filter: metadata_filter ?? {},
|
|
54564
54644
|
p_project_id: projectId,
|
|
54565
54645
|
p_updated_since: updated_since ?? null,
|
|
54566
54646
|
p_created_since: created_since ?? null,
|
|
@@ -54577,12 +54657,12 @@ async function handler8(supabase, args, ctx) {
|
|
|
54577
54657
|
operation: "metadata_search",
|
|
54578
54658
|
accessPath: ctx.accessPath,
|
|
54579
54659
|
requestor: args.requestor,
|
|
54580
|
-
query_text: JSON.stringify(metadata_filter),
|
|
54660
|
+
query_text: JSON.stringify(metadata_filter ?? {}),
|
|
54581
54661
|
project_id: projectId,
|
|
54582
54662
|
result_count: rows.length
|
|
54583
54663
|
});
|
|
54584
54664
|
if (rows.length === 0)
|
|
54585
|
-
return "No documents match the
|
|
54665
|
+
return "No documents match the given criteria.";
|
|
54586
54666
|
const parts = rows.map((row) => {
|
|
54587
54667
|
const projects = row.project_names?.length ? ` | projects: ${row.project_names.join(", ")}` : "";
|
|
54588
54668
|
const meta = Object.entries(row.doc_metadata ?? {}).map(([k, v]) => `${k}=${v}`).join(", ");
|
|
@@ -54603,20 +54683,20 @@ ${row.content}`;
|
|
|
54603
54683
|
}
|
|
54604
54684
|
var metadataSearchTool;
|
|
54605
54685
|
var init_metadata_search = __esm(() => {
|
|
54686
|
+
init__projects();
|
|
54606
54687
|
init_types3();
|
|
54607
54688
|
metadataSearchTool = {
|
|
54608
54689
|
name: "cerefox_metadata_search",
|
|
54609
|
-
description: "Find documents by metadata key-value criteria without a text search term. Use to discover documents tagged with specific attributes, browse by taxonomy,
|
|
54690
|
+
description: "Find or list documents by metadata key-value criteria without a text search term. Use to discover documents tagged with specific attributes, browse by taxonomy, retrieve messages/tasks by type and status, or list all documents in a project (pass project_name alone). At least one of metadata_filter, project_name, updated_since, or created_since must be supplied; results are ordered newest-updated first.",
|
|
54610
54691
|
inputSchema: {
|
|
54611
54692
|
type: "object",
|
|
54612
|
-
required: ["metadata_filter"],
|
|
54613
54693
|
properties: {
|
|
54614
54694
|
metadata_filter: {
|
|
54615
54695
|
type: "object",
|
|
54616
|
-
description: 'Key-value pairs; ALL must match (AND semantics). Example: {"type": "decision", "status": "active"}. Call cerefox_list_metadata_keys first to discover available keys.',
|
|
54696
|
+
description: 'Key-value pairs; ALL must match (AND semantics). Example: {"type": "decision", "status": "active"}. Call cerefox_list_metadata_keys first to discover available keys. Optional — omit (or pass {}) to list by project_name / time range alone.',
|
|
54617
54697
|
additionalProperties: { type: "string" }
|
|
54618
54698
|
},
|
|
54619
|
-
project_name: { type: "string", description: "Restrict to a project by name (optional)" },
|
|
54699
|
+
project_name: { type: "string", description: "Restrict to a project by name. Sufficient on its own to list that project's documents (optional)." },
|
|
54620
54700
|
updated_since: {
|
|
54621
54701
|
type: "string",
|
|
54622
54702
|
description: "ISO-8601 timestamp; only docs updated on/after (optional)"
|
|
@@ -54747,6 +54827,7 @@ ${row.full_content ?? ""}`;
|
|
|
54747
54827
|
}
|
|
54748
54828
|
var searchTool;
|
|
54749
54829
|
var init_search = __esm(() => {
|
|
54830
|
+
init__projects();
|
|
54750
54831
|
init_types3();
|
|
54751
54832
|
searchTool = {
|
|
54752
54833
|
name: "cerefox_search",
|
|
@@ -54797,58 +54878,12 @@ async function handler10(supabase, args, ctx) {
|
|
|
54797
54878
|
if (!project_names_raw.every((n) => typeof n === "string")) {
|
|
54798
54879
|
throw new McpInvalidParams("project_names must contain only strings.");
|
|
54799
54880
|
}
|
|
54800
|
-
const
|
|
54801
|
-
|
|
54802
|
-
|
|
54803
|
-
|
|
54804
|
-
|
|
54805
|
-
|
|
54806
|
-
const key = stripped.toLowerCase();
|
|
54807
|
-
if (seenLower.has(key))
|
|
54808
|
-
continue;
|
|
54809
|
-
seenLower.add(key);
|
|
54810
|
-
cleanNames.push(stripped);
|
|
54811
|
-
}
|
|
54812
|
-
const { data: doc } = await supabase.from("cerefox_documents").select("id, title").eq("id", document_id).is("deleted_at", null).limit(1);
|
|
54813
|
-
if (!doc?.length) {
|
|
54814
|
-
throw new Error(`Document not found (or soft-deleted): ${document_id}`);
|
|
54815
|
-
}
|
|
54816
|
-
const projectIds = [];
|
|
54817
|
-
for (const name of cleanNames) {
|
|
54818
|
-
const { data: proj } = await supabase.from("cerefox_projects").select("id").ilike("name", name).limit(1);
|
|
54819
|
-
if (proj?.length) {
|
|
54820
|
-
projectIds.push(proj[0].id);
|
|
54821
|
-
} else {
|
|
54822
|
-
const { data: newProj } = await supabase.from("cerefox_projects").insert({ name }).select("id");
|
|
54823
|
-
if (newProj?.[0]?.id)
|
|
54824
|
-
projectIds.push(newProj[0].id);
|
|
54825
|
-
}
|
|
54826
|
-
}
|
|
54827
|
-
await supabase.from("cerefox_document_projects").delete().eq("document_id", document_id);
|
|
54828
|
-
if (projectIds.length > 0) {
|
|
54829
|
-
const rows = projectIds.map((pid) => ({ document_id, project_id: pid }));
|
|
54830
|
-
await supabase.from("cerefox_document_projects").insert(rows);
|
|
54831
|
-
}
|
|
54832
|
-
try {
|
|
54833
|
-
await supabase.rpc("cerefox_create_audit_entry", {
|
|
54834
|
-
p_document_id: document_id,
|
|
54835
|
-
p_version_id: null,
|
|
54836
|
-
p_operation: "update-metadata",
|
|
54837
|
-
p_author: author,
|
|
54838
|
-
p_author_type: "agent",
|
|
54839
|
-
p_size_before: null,
|
|
54840
|
-
p_size_after: null,
|
|
54841
|
-
p_description: cleanNames.length > 0 ? `Set document projects to [${cleanNames.join(", ")}]` : "Cleared all project memberships"
|
|
54842
|
-
});
|
|
54843
|
-
} catch (err) {
|
|
54844
|
-
console.warn("set-document-projects: audit entry failed", err);
|
|
54845
|
-
}
|
|
54846
|
-
logUsage(supabase, {
|
|
54847
|
-
operation: "set-document-projects",
|
|
54848
|
-
accessPath: ctx.accessPath,
|
|
54849
|
-
requestor: author,
|
|
54850
|
-
document_id,
|
|
54851
|
-
result_count: projectIds.length
|
|
54881
|
+
const { cleanNames, projectIds } = await replaceDocumentProjects(supabase, {
|
|
54882
|
+
documentId: document_id,
|
|
54883
|
+
projectNames: project_names_raw,
|
|
54884
|
+
author,
|
|
54885
|
+
authorType: "agent",
|
|
54886
|
+
accessPath: ctx.accessPath
|
|
54852
54887
|
});
|
|
54853
54888
|
if (cleanNames.length === 0) {
|
|
54854
54889
|
return `Cleared all project memberships for document ${document_id}. ` + "The document no longer belongs to any project.";
|
|
@@ -54860,6 +54895,7 @@ async function handler10(supabase, args, ctx) {
|
|
|
54860
54895
|
}
|
|
54861
54896
|
var setDocumentProjectsTool;
|
|
54862
54897
|
var init_set_document_projects = __esm(() => {
|
|
54898
|
+
init__projects();
|
|
54863
54899
|
init_types3();
|
|
54864
54900
|
setDocumentProjectsTool = {
|
|
54865
54901
|
name: "cerefox_set_document_projects",
|
|
@@ -54983,11 +55019,11 @@ async function runSyncSelfDocs(options = {}) {
|
|
|
54983
55019
|
printTable(outcomes.filter((o) => o.status === "error").map((o) => ({ topic: o.topic, error: o.detail.slice(0, 100) })));
|
|
54984
55020
|
}
|
|
54985
55021
|
}
|
|
54986
|
-
async function
|
|
55022
|
+
async function action20(options) {
|
|
54987
55023
|
await runSyncSelfDocs(options);
|
|
54988
55024
|
}
|
|
54989
55025
|
function registerSyncSelfDocs(program2) {
|
|
54990
|
-
program2.command("sync-self-docs").description("Ingest bundled Cerefox docs under the _cerefox-self-docs project.").option("--dry-run", "List what would be ingested without writing.").option("--project <name>", "Override the target project name.", "_cerefox-self-docs").action(
|
|
55026
|
+
program2.command("sync-self-docs").description("Ingest bundled Cerefox docs under the _cerefox-self-docs project.").option("--dry-run", "List what would be ingested without writing.").option("--project <name>", "Override the target project name.", "_cerefox-self-docs").action(action20);
|
|
54991
55027
|
}
|
|
54992
55028
|
var init_sync_self_docs = __esm(() => {
|
|
54993
55029
|
init_cli_core();
|
|
@@ -70322,7 +70358,7 @@ Proceed with deployment to Supabase?`, true);
|
|
|
70322
70358
|
for (const ef of efNames) {
|
|
70323
70359
|
info(` deploying ${ef}…`);
|
|
70324
70360
|
const workdir = assets.functionsDir.replace(/\/functions$/, "").replace(/\/supabase$/, "");
|
|
70325
|
-
const args = ["--yes", "supabase", "functions", "deploy", ef];
|
|
70361
|
+
const args = ["--yes", "supabase", "functions", "deploy", ef, "--use-api"];
|
|
70326
70362
|
if (projectRef)
|
|
70327
70363
|
args.push("--project-ref", projectRef);
|
|
70328
70364
|
const r = spawnSync2("npx", args, {
|
|
@@ -70458,6 +70494,43 @@ function registerDocumentRestore(parent) {
|
|
|
70458
70494
|
parent.command("restore").description("Restore a soft-deleted document from the trash (inverse of `document delete`).").argument("<document-id>", "UUID of the soft-deleted document.").option("-a, --author <name>", "Caller identity (audit log).").option("--author-type <type>", "'user' or 'agent' (default: user).", "user").action(action11);
|
|
70459
70495
|
}
|
|
70460
70496
|
|
|
70497
|
+
// src/cli/commands/document-set-projects.ts
|
|
70498
|
+
init_cli_core();
|
|
70499
|
+
init__projects();
|
|
70500
|
+
init_client();
|
|
70501
|
+
async function action12(documentId, projectNames, options) {
|
|
70502
|
+
const names = projectNames ?? [];
|
|
70503
|
+
if (options.clear && names.length > 0) {
|
|
70504
|
+
throw userError("Pass either project names or --clear, not both.", "Use --clear on its own to remove the document from all projects.");
|
|
70505
|
+
}
|
|
70506
|
+
if (!options.clear && names.length === 0) {
|
|
70507
|
+
throw userError("No project names given.", "Pass one or more project names, or --clear to remove all memberships.");
|
|
70508
|
+
}
|
|
70509
|
+
const author = resolveAuthor(options.author);
|
|
70510
|
+
const authorType = resolveAuthorType(options.authorType);
|
|
70511
|
+
if (author === "unknown") {
|
|
70512
|
+
warn("No --author / CEREFOX_AUTHOR_NAME set — audit log will record this as 'unknown'.");
|
|
70513
|
+
}
|
|
70514
|
+
const client = getClient();
|
|
70515
|
+
const { documentTitle, cleanNames } = await replaceDocumentProjects(client.raw, {
|
|
70516
|
+
documentId,
|
|
70517
|
+
projectNames: names,
|
|
70518
|
+
author,
|
|
70519
|
+
authorType,
|
|
70520
|
+
accessPath: "cli"
|
|
70521
|
+
});
|
|
70522
|
+
if (cleanNames.length === 0) {
|
|
70523
|
+
println(c.green(`✓ Cleared all project memberships for "${documentTitle}" (id: ${documentId}).`));
|
|
70524
|
+
return;
|
|
70525
|
+
}
|
|
70526
|
+
println(c.green(`✓ Set ${cleanNames.length} project membership(s) for "${documentTitle}" (id: ${documentId}).`));
|
|
70527
|
+
println(c.dim(` Projects: ${cleanNames.join(", ")}`));
|
|
70528
|
+
println(c.dim(" This REPLACED the previous set — any project not listed is no longer associated."));
|
|
70529
|
+
}
|
|
70530
|
+
function registerDocumentSetProjects(parent) {
|
|
70531
|
+
parent.command("set-projects").description("Replace a document's project memberships with exactly the given set (or --clear to remove all).").argument("<document-id>", "UUID of the document.").argument("[project-names...]", "Project names to set (created if missing). Omit and pass --clear to remove all.").option("--clear", "Remove the document from all projects.").option("-a, --author <name>", "Caller identity (audit log).").option("--author-type <type>", "'user' or 'agent' (default: user).", "user").action(action12);
|
|
70532
|
+
}
|
|
70533
|
+
|
|
70461
70534
|
// src/cli/commands/guides.ts
|
|
70462
70535
|
init_cli_core();
|
|
70463
70536
|
init_bundled_docs();
|
|
@@ -70505,7 +70578,7 @@ function registerGuides(parent) {
|
|
|
70505
70578
|
// src/cli/commands/project-create.ts
|
|
70506
70579
|
init_cli_core();
|
|
70507
70580
|
init_client();
|
|
70508
|
-
async function
|
|
70581
|
+
async function action13(name, options) {
|
|
70509
70582
|
const trimmed = name.trim();
|
|
70510
70583
|
if (!trimmed)
|
|
70511
70584
|
throw userError("Project name is required.");
|
|
@@ -70517,14 +70590,14 @@ async function action12(name, options) {
|
|
|
70517
70590
|
println(c.green(`✓ Created project "${data.name}" (id: ${data.id}).`));
|
|
70518
70591
|
}
|
|
70519
70592
|
function registerProjectCreate(parent) {
|
|
70520
|
-
parent.command("create").description("Create a new (empty) project.").argument("<name>", "Project name (must be unique).").option("--description <text>", "Optional project description.").action(
|
|
70593
|
+
parent.command("create").description("Create a new (empty) project.").argument("<name>", "Project name (must be unique).").option("--description <text>", "Optional project description.").action(action13);
|
|
70521
70594
|
}
|
|
70522
70595
|
|
|
70523
70596
|
// src/cli/commands/project-edit.ts
|
|
70524
70597
|
init_cli_core();
|
|
70525
70598
|
init_client();
|
|
70526
70599
|
var UUID_RE2 = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
70527
|
-
async function
|
|
70600
|
+
async function action14(target, options) {
|
|
70528
70601
|
const update = {};
|
|
70529
70602
|
if (options.name !== undefined) {
|
|
70530
70603
|
const n = options.name.trim();
|
|
@@ -70551,7 +70624,7 @@ async function action13(target, options) {
|
|
|
70551
70624
|
println(c.green(`✓ Updated project "${data.name}" (id: ${data.id}).`));
|
|
70552
70625
|
}
|
|
70553
70626
|
function registerProjectEdit(parent) {
|
|
70554
|
-
parent.command("edit").description("Rename a project and/or change its description.").argument("<name-or-id>", "Project name (exact match) or UUID.").option("--name <new-name>", "New project name.").option("--description <text>", "New project description.").action(
|
|
70627
|
+
parent.command("edit").description("Rename a project and/or change its description.").argument("<name-or-id>", "Project name (exact match) or UUID.").option("--name <new-name>", "New project name.").option("--description <text>", "New project description.").action(action14);
|
|
70555
70628
|
}
|
|
70556
70629
|
|
|
70557
70630
|
// src/cli/commands/version-archive.ts
|
|
@@ -73974,7 +74047,7 @@ import { homedir as homedir5 } from "node:os";
|
|
|
73974
74047
|
import { join as join8 } from "node:path";
|
|
73975
74048
|
|
|
73976
74049
|
// ../../_shared/ef-meta/index.ts
|
|
73977
|
-
var EF_VERSION = "0.10.
|
|
74050
|
+
var EF_VERSION = "0.10.4";
|
|
73978
74051
|
|
|
73979
74052
|
// src/cli/util/checks.ts
|
|
73980
74053
|
init_config();
|
|
@@ -74539,7 +74612,7 @@ function symbol(status) {
|
|
|
74539
74612
|
return cErr.dim("ℹ");
|
|
74540
74613
|
}
|
|
74541
74614
|
}
|
|
74542
|
-
async function
|
|
74615
|
+
async function action15(options) {
|
|
74543
74616
|
const useSpinner = !options.json && process.stderr.isTTY;
|
|
74544
74617
|
const spinner = useSpinner ? ora({ text: "Starting checks…", spinner: "dots", stream: process.stderr }).start() : null;
|
|
74545
74618
|
const results = await runAllChecks({
|
|
@@ -74596,13 +74669,13 @@ async function action14(options) {
|
|
|
74596
74669
|
}
|
|
74597
74670
|
}
|
|
74598
74671
|
function registerDoctor(program2) {
|
|
74599
|
-
program2.command("doctor").description("Run diagnostic checks against the installed Cerefox.").option("--json", "Emit machine-readable JSON (no colours, structured output).").action(
|
|
74672
|
+
program2.command("doctor").description("Run diagnostic checks against the installed Cerefox.").option("--json", "Emit machine-readable JSON (no colours, structured output).").action(action15);
|
|
74600
74673
|
}
|
|
74601
74674
|
|
|
74602
74675
|
// src/cli/commands/get-audit-log.ts
|
|
74603
74676
|
init_cli_core();
|
|
74604
74677
|
init_client();
|
|
74605
|
-
async function
|
|
74678
|
+
async function action16(options) {
|
|
74606
74679
|
const limit = parsePositiveInt(options.limit, "--limit", 50);
|
|
74607
74680
|
const client = getClient();
|
|
74608
74681
|
const data = await client.rpc("cerefox_list_audit_entries", {
|
|
@@ -74640,14 +74713,14 @@ async function action15(options) {
|
|
|
74640
74713
|
})));
|
|
74641
74714
|
}
|
|
74642
74715
|
function registerGetAuditLog(program2) {
|
|
74643
|
-
program2.command("get-audit-log").description("Query the audit log with optional filters.").option("-d, --document-id <uuid>", "Filter by document.").option("-a, --author <name>", "Filter by author.").option("-o, --operation <type>", "Filter by operation: create, update-content, update-metadata, delete, restore.").option("--since <iso>", "Lower-bound ISO timestamp.").option("--until <iso>", "Upper-bound ISO timestamp.").option("-l, --limit <n>", "Maximum entries (max 200).", "50").option("-r, --requestor <name>", "Agent / user name (usage log).").option("--json", "Emit machine-readable JSON.").action(
|
|
74716
|
+
program2.command("get-audit-log").description("Query the audit log with optional filters.").option("-d, --document-id <uuid>", "Filter by document.").option("-a, --author <name>", "Filter by author.").option("-o, --operation <type>", "Filter by operation: create, update-content, update-metadata, delete, restore.").option("--since <iso>", "Lower-bound ISO timestamp.").option("--until <iso>", "Upper-bound ISO timestamp.").option("-l, --limit <n>", "Maximum entries (max 200).", "50").option("-r, --requestor <name>", "Agent / user name (usage log).").option("--json", "Emit machine-readable JSON.").action(action16);
|
|
74644
74717
|
}
|
|
74645
74718
|
|
|
74646
74719
|
// src/cli/commands/get-doc.ts
|
|
74647
74720
|
init_cli_core();
|
|
74648
74721
|
init_cli_core();
|
|
74649
74722
|
init_client();
|
|
74650
|
-
async function
|
|
74723
|
+
async function action17(documentId, options) {
|
|
74651
74724
|
const client = getClient();
|
|
74652
74725
|
const rows = await client.rpc("cerefox_get_document", {
|
|
74653
74726
|
p_document_id: documentId,
|
|
@@ -74677,7 +74750,7 @@ async function action16(documentId, options) {
|
|
|
74677
74750
|
println(doc.full_content);
|
|
74678
74751
|
}
|
|
74679
74752
|
function registerGetDoc(program2) {
|
|
74680
|
-
program2.command("get-doc").description("Retrieve the full content of a document by ID.").argument("<document-id>", "UUID of the document.").option("--version-id <uuid>", "Specific archived version (default: current).").option("-r, --requestor <name>", "Agent / user name (usage log).").option("--json", "Emit machine-readable JSON.").action(
|
|
74753
|
+
program2.command("get-doc").description("Retrieve the full content of a document by ID.").argument("<document-id>", "UUID of the document.").option("--version-id <uuid>", "Specific archived version (default: current).").option("-r, --requestor <name>", "Agent / user name (usage log).").option("--json", "Emit machine-readable JSON.").action(action17);
|
|
74681
74754
|
}
|
|
74682
74755
|
|
|
74683
74756
|
// src/cli/commands/ingest.ts
|
|
@@ -75455,7 +75528,7 @@ async function readContent(path, paste) {
|
|
|
75455
75528
|
const titleFromPath = basename2(path, extname3(path));
|
|
75456
75529
|
return { content, titleFromPath };
|
|
75457
75530
|
}
|
|
75458
|
-
async function
|
|
75531
|
+
async function action18(path, options) {
|
|
75459
75532
|
const { content, titleFromPath } = await readContent(path, Boolean(options.paste));
|
|
75460
75533
|
const title = options.title ?? titleFromPath;
|
|
75461
75534
|
if (!title || title.trim() === "") {
|
|
@@ -75527,7 +75600,7 @@ async function action17(path, options) {
|
|
|
75527
75600
|
}
|
|
75528
75601
|
}
|
|
75529
75602
|
function registerIngest(program2) {
|
|
75530
|
-
program2.command("ingest").description("Ingest a file (or stdin paste) into the knowledge base.").argument("[path]", "Path to the file to ingest. Omit when using --paste.").option("--paste", "Read content from stdin instead of a file.").option("-t, --title <title>", "Document title (required with --paste; defaults to filename without extension).").option("-p, --project-name <name>", "Single project membership (non-destructive on update).").option("-P, --project-names <names>", "Comma-separated full project membership set (destructive replace on update).").option("-m, --metadata <json>", "JSON metadata object.").option("--source <label>", "Origin label (default: cli).", "cli").option("-u, --update-if-exists", "Update an existing doc with the same title.").option("-i, --document-id <uuid>", "Update a specific document by UUID (overrides --update-if-exists).").option("-a, --author <name>", "Caller identity (audit log).").option("--author-type <type>", "'user' or 'agent' (default: user).", "user").action(
|
|
75603
|
+
program2.command("ingest").description("Ingest a file (or stdin paste) into the knowledge base.").argument("[path]", "Path to the file to ingest. Omit when using --paste.").option("--paste", "Read content from stdin instead of a file.").option("-t, --title <title>", "Document title (required with --paste; defaults to filename without extension).").option("-p, --project-name <name>", "Single project membership (non-destructive on update).").option("-P, --project-names <names>", "Comma-separated full project membership set (destructive replace on update).").option("-m, --metadata <json>", "JSON metadata object.").option("--source <label>", "Origin label (default: cli).", "cli").option("-u, --update-if-exists", "Update an existing doc with the same title.").option("-i, --document-id <uuid>", "Update a specific document by UUID (overrides --update-if-exists).").option("-a, --author <name>", "Caller identity (audit log).").option("--author-type <type>", "'user' or 'agent' (default: user).", "user").action(action18);
|
|
75531
75604
|
}
|
|
75532
75605
|
|
|
75533
75606
|
// src/cli/commands/ingest-dir.ts
|
|
@@ -75563,7 +75636,7 @@ function walk(dir, extensions) {
|
|
|
75563
75636
|
}
|
|
75564
75637
|
return files;
|
|
75565
75638
|
}
|
|
75566
|
-
async function
|
|
75639
|
+
async function action19(dir, options) {
|
|
75567
75640
|
const extensions = new Set((options.extensions ?? ".md,.txt").split(",").map((e) => e.trim().toLowerCase()).map((e) => e.startsWith(".") ? e : "." + e).filter((e) => e.length > 0));
|
|
75568
75641
|
const files = walk(dir, extensions);
|
|
75569
75642
|
if (files.length === 0) {
|
|
@@ -75636,7 +75709,7 @@ async function action18(dir, options) {
|
|
|
75636
75709
|
}
|
|
75637
75710
|
}
|
|
75638
75711
|
function registerIngestDir(program2) {
|
|
75639
|
-
program2.command("ingest-dir").description("Recursively ingest a directory of markdown / text files.").argument("<dir>", "Root directory to walk.").option("-p, --project-name <name>", "Project membership for all ingested docs.").option("-m, --metadata <json>", "JSON metadata applied to every doc.").option("--source <label>", "Origin label (default: cli).", "cli").option("-u, --update-if-exists", "Update an existing doc with the same title.").option("-a, --author <name>", "Caller identity (audit log).").option("--author-type <type>", "'user' or 'agent' (default: user).", "user").option("-e, --extensions <list>", "Comma-separated file extensions to ingest.", ".md,.txt").action(
|
|
75712
|
+
program2.command("ingest-dir").description("Recursively ingest a directory of markdown / text files.").argument("<dir>", "Root directory to walk.").option("-p, --project-name <name>", "Project membership for all ingested docs.").option("-m, --metadata <json>", "JSON metadata applied to every doc.").option("--source <label>", "Origin label (default: cli).", "cli").option("-u, --update-if-exists", "Update an existing doc with the same title.").option("-a, --author <name>", "Caller identity (audit log).").option("--author-type <type>", "'user' or 'agent' (default: user).", "user").option("-e, --extensions <list>", "Comma-separated file extensions to ingest.", ".md,.txt").action(action19);
|
|
75640
75713
|
}
|
|
75641
75714
|
|
|
75642
75715
|
// src/cli/commands/init.ts
|
|
@@ -75966,7 +76039,7 @@ function writeAnswersTo(target, answers) {
|
|
|
75966
76039
|
}
|
|
75967
76040
|
}
|
|
75968
76041
|
}
|
|
75969
|
-
async function
|
|
76042
|
+
async function action21(options) {
|
|
75970
76043
|
const homeEnv = join10(homedir6(), USER_STATE_DIR_NAME, ".env");
|
|
75971
76044
|
const cwdEnv = join10(process.cwd(), ".env");
|
|
75972
76045
|
const explicitDir = (process.env.CEREFOX_CONFIG_DIR ?? "").trim();
|
|
@@ -76075,13 +76148,13 @@ async function action20(options) {
|
|
|
76075
76148
|
await postWriteLifecycle(target, options);
|
|
76076
76149
|
}
|
|
76077
76150
|
function registerInit(program2) {
|
|
76078
|
-
program2.command("init").description("Interactive first-run setup (config, schema deploy stub, optional MCP wiring).").option("-c, --config <file>", "Non-interactive mode: read answers from a JSON file.").option("--force", "Overwrite existing configuration without prompting.").option("--skip-schema", "Skip the schema deploy step.").option("--skip-self-docs", "Skip the bundled self-doc ingest.").option("--skip-agent-config", "Skip the optional MCP agent wiring.").action(
|
|
76151
|
+
program2.command("init").description("Interactive first-run setup (config, schema deploy stub, optional MCP wiring).").option("-c, --config <file>", "Non-interactive mode: read answers from a JSON file.").option("--force", "Overwrite existing configuration without prompting.").option("--skip-schema", "Skip the schema deploy step.").option("--skip-self-docs", "Skip the bundled self-doc ingest.").option("--skip-agent-config", "Skip the optional MCP agent wiring.").action(action21);
|
|
76079
76152
|
}
|
|
76080
76153
|
|
|
76081
76154
|
// src/cli/commands/list-docs.ts
|
|
76082
76155
|
init_cli_core();
|
|
76083
76156
|
init_client();
|
|
76084
|
-
async function
|
|
76157
|
+
async function action22(options) {
|
|
76085
76158
|
const deleted = !!options.deleted;
|
|
76086
76159
|
const limit = parsePositiveInt(options.limit, "--limit", 100);
|
|
76087
76160
|
const client = getClient();
|
|
@@ -76141,13 +76214,13 @@ async function action21(options) {
|
|
|
76141
76214
|
}));
|
|
76142
76215
|
}
|
|
76143
76216
|
function registerListDocs(program2) {
|
|
76144
|
-
program2.command("list-docs").description("List documents in the knowledge base.").option("-p, --project <name>", "Filter to a specific project.").option("-l, --limit <n>", "Maximum docs to return.", "100").option("--deleted", "List soft-deleted (trashed) documents instead of active ones.").option("--json", "Emit machine-readable JSON.").action(
|
|
76217
|
+
program2.command("list-docs").description("List documents in the knowledge base.").option("-p, --project <name>", "Filter to a specific project.").option("-l, --limit <n>", "Maximum docs to return.", "100").option("--deleted", "List soft-deleted (trashed) documents instead of active ones.").option("--json", "Emit machine-readable JSON.").action(action22);
|
|
76145
76218
|
}
|
|
76146
76219
|
|
|
76147
76220
|
// src/cli/commands/list-metadata-keys.ts
|
|
76148
76221
|
init_cli_core();
|
|
76149
76222
|
init_client();
|
|
76150
|
-
async function
|
|
76223
|
+
async function action23(options) {
|
|
76151
76224
|
const client = getClient();
|
|
76152
76225
|
const data = await client.rpc("cerefox_list_metadata_keys");
|
|
76153
76226
|
if (data === null) {
|
|
@@ -76175,13 +76248,13 @@ async function action22(options) {
|
|
|
76175
76248
|
})));
|
|
76176
76249
|
}
|
|
76177
76250
|
function registerListMetadataKeys(program2) {
|
|
76178
|
-
program2.command("list-metadata-keys").description("List all metadata keys with document counts and example values.").option("-r, --requestor <name>", "Agent / user name (usage log).").option("--json", "Emit machine-readable JSON.").action(
|
|
76251
|
+
program2.command("list-metadata-keys").description("List all metadata keys with document counts and example values.").option("-r, --requestor <name>", "Agent / user name (usage log).").option("--json", "Emit machine-readable JSON.").action(action23);
|
|
76179
76252
|
}
|
|
76180
76253
|
|
|
76181
76254
|
// src/cli/commands/list-projects.ts
|
|
76182
76255
|
init_cli_core();
|
|
76183
76256
|
init_client();
|
|
76184
|
-
async function
|
|
76257
|
+
async function action24(options) {
|
|
76185
76258
|
const client = getClient();
|
|
76186
76259
|
const { data, error: error2 } = await client.raw.from("cerefox_projects").select("id, name, description, created_at").order("name", { ascending: true });
|
|
76187
76260
|
if (error2) {
|
|
@@ -76210,13 +76283,13 @@ async function action23(options) {
|
|
|
76210
76283
|
})), "(no projects)");
|
|
76211
76284
|
}
|
|
76212
76285
|
function registerListProjects(program2) {
|
|
76213
|
-
program2.command("list-projects").description("List all projects in the knowledge base.").option("-r, --requestor <name>", "Agent / user name (usage log).").option("--json", "Emit machine-readable JSON.").action(
|
|
76286
|
+
program2.command("list-projects").description("List all projects in the knowledge base.").option("-r, --requestor <name>", "Agent / user name (usage log).").option("--json", "Emit machine-readable JSON.").action(action24);
|
|
76214
76287
|
}
|
|
76215
76288
|
|
|
76216
76289
|
// src/cli/commands/list-versions.ts
|
|
76217
76290
|
init_cli_core();
|
|
76218
76291
|
init_client();
|
|
76219
|
-
async function
|
|
76292
|
+
async function action25(documentId, options) {
|
|
76220
76293
|
const client = getClient();
|
|
76221
76294
|
const data = await client.rpc("cerefox_list_document_versions", {
|
|
76222
76295
|
p_document_id: documentId
|
|
@@ -76257,7 +76330,7 @@ async function action24(documentId, options) {
|
|
|
76257
76330
|
})));
|
|
76258
76331
|
}
|
|
76259
76332
|
function registerListVersions(program2) {
|
|
76260
|
-
program2.command("list-versions").description("List archived versions of a document.").argument("<document-id>", "UUID of the document.").option("-r, --requestor <name>", "Agent / user name (usage log).").option("--json", "Emit machine-readable JSON.").action(
|
|
76333
|
+
program2.command("list-versions").description("List archived versions of a document.").argument("<document-id>", "UUID of the document.").option("-r, --requestor <name>", "Agent / user name (usage log).").option("--json", "Emit machine-readable JSON.").action(action25);
|
|
76261
76334
|
}
|
|
76262
76335
|
|
|
76263
76336
|
// src/cli/commands/mcp.ts
|
|
@@ -76272,7 +76345,7 @@ function registerMcp(program2) {
|
|
|
76272
76345
|
// src/cli/commands/metadata-search.ts
|
|
76273
76346
|
init_cli_core();
|
|
76274
76347
|
init_client();
|
|
76275
|
-
async function
|
|
76348
|
+
async function action26(options) {
|
|
76276
76349
|
const metadataFilter = parseJsonObjectArg(options.metadataFilter, "--metadata-filter");
|
|
76277
76350
|
if (!metadataFilter || Object.keys(metadataFilter).length === 0) {
|
|
76278
76351
|
throw userError("--metadata-filter is required and must be a non-empty JSON object.", `Example: --metadata-filter '{"type":"decision-log"}'.`);
|
|
@@ -76335,7 +76408,7 @@ async function action25(options) {
|
|
|
76335
76408
|
}
|
|
76336
76409
|
}
|
|
76337
76410
|
function registerMetadataSearch(program2) {
|
|
76338
|
-
program2.command("metadata-search").description("Find documents by metadata criteria (no text query).").requiredOption("-f, --metadata-filter <json>", "JSON object; only docs whose metadata contains ALL pairs are returned.").option("-p, --project-name <name>", "Filter to a specific project.").option("--updated-since <iso>", "Only docs updated on/after this ISO timestamp.").option("--created-since <iso>", "Only docs created on/after this ISO timestamp.").option("--include-content", "Include full document text in results.").option("-l, --limit <n>", "Maximum docs to return.", "10").option("--max-bytes <n>", "Response size budget in bytes (with --include-content).", "200000").option("-r, --requestor <name>", "Agent / user name (usage log).").option("--json", "Emit machine-readable JSON.").action(
|
|
76411
|
+
program2.command("metadata-search").description("Find documents by metadata criteria (no text query).").requiredOption("-f, --metadata-filter <json>", "JSON object; only docs whose metadata contains ALL pairs are returned.").option("-p, --project-name <name>", "Filter to a specific project.").option("--updated-since <iso>", "Only docs updated on/after this ISO timestamp.").option("--created-since <iso>", "Only docs created on/after this ISO timestamp.").option("--include-content", "Include full document text in results.").option("-l, --limit <n>", "Maximum docs to return.", "10").option("--max-bytes <n>", "Response size budget in bytes (with --include-content).", "200000").option("-r, --requestor <name>", "Agent / user name (usage log).").option("--json", "Emit machine-readable JSON.").action(action26);
|
|
76339
76412
|
}
|
|
76340
76413
|
|
|
76341
76414
|
// src/cli/commands/reindex.ts
|
|
@@ -76343,7 +76416,7 @@ init_dist4();
|
|
|
76343
76416
|
init_cli_core();
|
|
76344
76417
|
init_config();
|
|
76345
76418
|
var DEFAULT_MODEL = "text-embedding-3-small";
|
|
76346
|
-
async function
|
|
76419
|
+
async function action27(options) {
|
|
76347
76420
|
const settings = loadSettings();
|
|
76348
76421
|
if (!settings.supabaseUrl || !settings.supabaseKey) {
|
|
76349
76422
|
throw userError("Supabase credentials not configured — run `cerefox init` first.");
|
|
@@ -76422,7 +76495,7 @@ ${c2.content}`;
|
|
|
76422
76495
|
}
|
|
76423
76496
|
}
|
|
76424
76497
|
function registerReindex(program2) {
|
|
76425
|
-
program2.command("reindex").description("Re-embed existing document chunks (v0.7+).").option("--all", "Reindex every chunk regardless of embedder.").option("--batch <n>", "Chunks per OpenAI batch call. Capped at 96 internally.", "32").option("--dry-run", "Show counts without re-embedding.").option("-i, --document-id <uuid>", "Limit reindex to a single document.").action(
|
|
76498
|
+
program2.command("reindex").description("Re-embed existing document chunks (v0.7+).").option("--all", "Reindex every chunk regardless of embedder.").option("--batch <n>", "Chunks per OpenAI batch call. Capped at 96 internally.", "32").option("--dry-run", "Show counts without re-embedding.").option("-i, --document-id <uuid>", "Limit reindex to a single document.").action(action27);
|
|
76426
76499
|
}
|
|
76427
76500
|
|
|
76428
76501
|
// src/cli/commands/restore.ts
|
|
@@ -76452,7 +76525,7 @@ function resolveBackupFile(target) {
|
|
|
76452
76525
|
}
|
|
76453
76526
|
return join11(path, candidates[0].name);
|
|
76454
76527
|
}
|
|
76455
|
-
async function
|
|
76528
|
+
async function action28(target, options) {
|
|
76456
76529
|
const file = resolveBackupFile(target);
|
|
76457
76530
|
let payload;
|
|
76458
76531
|
try {
|
|
@@ -76508,7 +76581,7 @@ async function action27(target, options) {
|
|
|
76508
76581
|
}
|
|
76509
76582
|
}
|
|
76510
76583
|
function registerRestore(program2) {
|
|
76511
|
-
program2.command("restore").description("Restore a JSON-snapshot backup into the knowledge base.").argument("<snapshot>", "Backup file (or directory; most recent is picked) produced by `cerefox backup`.").option("--dry-run", "Print what would be restored without writing.").option("-p, --project-name <name>", "Reserved for future use; currently ignored (project memberships ride along with each doc's metadata).").action(
|
|
76584
|
+
program2.command("restore").description("Restore a JSON-snapshot backup into the knowledge base.").argument("<snapshot>", "Backup file (or directory; most recent is picked) produced by `cerefox backup`.").option("--dry-run", "Print what would be restored without writing.").option("-p, --project-name <name>", "Reserved for future use; currently ignored (project memberships ride along with each doc's metadata).").action(action28);
|
|
76512
76585
|
}
|
|
76513
76586
|
|
|
76514
76587
|
// src/cli/commands/search.ts
|
|
@@ -76533,7 +76606,7 @@ async function embedQuery(query) {
|
|
|
76533
76606
|
}
|
|
76534
76607
|
|
|
76535
76608
|
// src/cli/commands/search.ts
|
|
76536
|
-
async function
|
|
76609
|
+
async function action29(query, options) {
|
|
76537
76610
|
if (!query || query.trim() === "") {
|
|
76538
76611
|
throw userError("Empty query.");
|
|
76539
76612
|
}
|
|
@@ -76685,7 +76758,7 @@ async function action28(query, options) {
|
|
|
76685
76758
|
}
|
|
76686
76759
|
}
|
|
76687
76760
|
function registerSearch(program2) {
|
|
76688
|
-
program2.command("search").description("Search the knowledge base (hybrid FTS + semantic).").argument("<query>", "Natural-language search query.").option("-c, --match-count <n>", "Maximum number of documents to return.", "5").option("-p, --project-name <name>", "Filter results to a specific project.").option("-f, --metadata-filter <json>", "JSON containment filter; only docs whose metadata contains ALL pairs are returned.").option("--mode <mode>", "Search mode: docs (default), hybrid, fts.", "docs").option("--alpha <float>", "Semantic weight 0..1 (default: 0.7).", "0.7").option("--min-score <float>", "Minimum cosine similarity threshold (default: CEREFOX_MIN_SEARCH_SCORE or 0.5).").option("--max-bytes <n>", "Response size budget in bytes (default: CEREFOX_MAX_RESPONSE_BYTES or 200000).").option("-r, --requestor <name>", "Agent / user name (recorded in usage log).").option("--json", "Emit machine-readable JSON instead of the default text.").option("--only-metadata", "List matching docs (id, score, chunks, chars, partial/full) WITHOUT their content — like the web UI's collapsed result list. Grab a [id:…] then `cerefox document get <id>`.").action(
|
|
76761
|
+
program2.command("search").description("Search the knowledge base (hybrid FTS + semantic).").argument("<query>", "Natural-language search query.").option("-c, --match-count <n>", "Maximum number of documents to return.", "5").option("-p, --project-name <name>", "Filter results to a specific project.").option("-f, --metadata-filter <json>", "JSON containment filter; only docs whose metadata contains ALL pairs are returned.").option("--mode <mode>", "Search mode: docs (default), hybrid, fts.", "docs").option("--alpha <float>", "Semantic weight 0..1 (default: 0.7).", "0.7").option("--min-score <float>", "Minimum cosine similarity threshold (default: CEREFOX_MIN_SEARCH_SCORE or 0.5).").option("--max-bytes <n>", "Response size budget in bytes (default: CEREFOX_MAX_RESPONSE_BYTES or 200000).").option("-r, --requestor <name>", "Agent / user name (recorded in usage log).").option("--json", "Emit machine-readable JSON instead of the default text.").option("--only-metadata", "List matching docs (id, score, chunks, chars, partial/full) WITHOUT their content — like the web UI's collapsed result list. Grab a [id:…] then `cerefox document get <id>`.").action(action29);
|
|
76689
76762
|
}
|
|
76690
76763
|
|
|
76691
76764
|
// src/cli/commands/self-update.ts
|
|
@@ -76732,7 +76805,7 @@ async function fetchLatestVersion() {
|
|
|
76732
76805
|
}
|
|
76733
76806
|
return body.version;
|
|
76734
76807
|
}
|
|
76735
|
-
async function
|
|
76808
|
+
async function action30(options) {
|
|
76736
76809
|
let target;
|
|
76737
76810
|
try {
|
|
76738
76811
|
target = options.version ?? await fetchLatestVersion();
|
|
@@ -76784,7 +76857,7 @@ async function action29(options) {
|
|
|
76784
76857
|
}
|
|
76785
76858
|
function registerSelfUpdate(program2) {
|
|
76786
76859
|
const desc = "Upgrade Cerefox in place. Alias: `cerefox upgrade`.";
|
|
76787
|
-
const declaration = (cmd) => cmd.description(desc).option("--check", "Print current vs latest; do nothing.").option("--yes", "Non-interactive (skip confirmation).").option("--version <version>", "Pin a specific version (e.g. 0.5.1 or 0.6.0-rc.1).").action(
|
|
76860
|
+
const declaration = (cmd) => cmd.description(desc).option("--check", "Print current vs latest; do nothing.").option("--yes", "Non-interactive (skip confirmation).").option("--version <version>", "Pin a specific version (e.g. 0.5.1 or 0.6.0-rc.1).").action(action30);
|
|
76788
76861
|
declaration(program2.command("self-update"));
|
|
76789
76862
|
declaration(program2.command("upgrade"));
|
|
76790
76863
|
}
|
|
@@ -76803,7 +76876,7 @@ function symbol2(status) {
|
|
|
76803
76876
|
return cErr.dim("ℹ");
|
|
76804
76877
|
}
|
|
76805
76878
|
}
|
|
76806
|
-
async function
|
|
76879
|
+
async function action31(options) {
|
|
76807
76880
|
const useSpinner = !options.json && process.stderr.isTTY;
|
|
76808
76881
|
const spinner = useSpinner ? ora({ text: "Starting checks…", spinner: "dots", stream: process.stderr }).start() : null;
|
|
76809
76882
|
const results = await runFastChecks({
|
|
@@ -76824,7 +76897,7 @@ async function action30(options) {
|
|
|
76824
76897
|
}
|
|
76825
76898
|
}
|
|
76826
76899
|
function registerStatus(program2) {
|
|
76827
|
-
program2.command("status").description("Quick sanity check (fast subset of `cerefox doctor`).").option("--json", "Emit machine-readable JSON.").action(
|
|
76900
|
+
program2.command("status").description("Quick sanity check (fast subset of `cerefox doctor`).").option("--json", "Emit machine-readable JSON.").action(action31);
|
|
76828
76901
|
}
|
|
76829
76902
|
|
|
76830
76903
|
// src/cli/program.ts
|
|
@@ -76833,15 +76906,15 @@ init_sync_self_docs();
|
|
|
76833
76906
|
// src/cli/commands/web.ts
|
|
76834
76907
|
init_cli_core();
|
|
76835
76908
|
|
|
76836
|
-
// ../../node_modules/.bun/@hono+node-server@2.0.4+
|
|
76909
|
+
// ../../node_modules/.bun/@hono+node-server@2.0.4+8bc17dcb8a4189a6/node_modules/@hono/node-server/dist/constants-BLSFu_RU.mjs
|
|
76837
76910
|
var X_ALREADY_SENT = "x-hono-already-sent";
|
|
76838
76911
|
|
|
76839
|
-
// ../../node_modules/.bun/@hono+node-server@2.0.4+
|
|
76912
|
+
// ../../node_modules/.bun/@hono+node-server@2.0.4+8bc17dcb8a4189a6/node_modules/@hono/node-server/dist/index.mjs
|
|
76840
76913
|
import { STATUS_CODES, createServer } from "node:http";
|
|
76841
76914
|
import { Http2ServerRequest, constants } from "node:http2";
|
|
76842
76915
|
import { Readable } from "node:stream";
|
|
76843
76916
|
|
|
76844
|
-
// ../../node_modules/.bun/hono@4.12.
|
|
76917
|
+
// ../../node_modules/.bun/hono@4.12.25/node_modules/hono/dist/helper/websocket/index.js
|
|
76845
76918
|
var WSContext = class {
|
|
76846
76919
|
#init;
|
|
76847
76920
|
constructor(init) {
|
|
@@ -76889,7 +76962,7 @@ var defineWebSocketHelper = (handler11) => {
|
|
|
76889
76962
|
};
|
|
76890
76963
|
};
|
|
76891
76964
|
|
|
76892
|
-
// ../../node_modules/.bun/@hono+node-server@2.0.4+
|
|
76965
|
+
// ../../node_modules/.bun/@hono+node-server@2.0.4+8bc17dcb8a4189a6/node_modules/@hono/node-server/dist/index.mjs
|
|
76893
76966
|
var RequestError = class extends Error {
|
|
76894
76967
|
constructor(message, options) {
|
|
76895
76968
|
super(message, options);
|
|
@@ -78023,7 +78096,7 @@ var serve = (options, listeningListener) => {
|
|
|
78023
78096
|
return server;
|
|
78024
78097
|
};
|
|
78025
78098
|
|
|
78026
|
-
// ../../node_modules/.bun/@hono+node-server@2.0.4+
|
|
78099
|
+
// ../../node_modules/.bun/@hono+node-server@2.0.4+8bc17dcb8a4189a6/node_modules/@hono/node-server/dist/utils/stream.mjs
|
|
78027
78100
|
import { Readable as Readable2 } from "node:stream";
|
|
78028
78101
|
import { versions as versions2 } from "node:process";
|
|
78029
78102
|
var pr54206Applied = () => {
|
|
@@ -78089,7 +78162,7 @@ var createStreamBody = (stream, useNativeReadableToWeb = useReadableToWeb) => {
|
|
|
78089
78162
|
});
|
|
78090
78163
|
};
|
|
78091
78164
|
|
|
78092
|
-
// ../../node_modules/.bun/hono@4.12.
|
|
78165
|
+
// ../../node_modules/.bun/hono@4.12.25/node_modules/hono/dist/utils/mime.js
|
|
78093
78166
|
var getMimeType = (filename, mimes = baseMimes) => {
|
|
78094
78167
|
const regexp = /\.([a-zA-Z0-9]+?)$/;
|
|
78095
78168
|
const match = filename.match(regexp);
|
|
@@ -78158,7 +78231,7 @@ var _baseMimes = {
|
|
|
78158
78231
|
};
|
|
78159
78232
|
var baseMimes = _baseMimes;
|
|
78160
78233
|
|
|
78161
|
-
// ../../node_modules/.bun/@hono+node-server@2.0.4+
|
|
78234
|
+
// ../../node_modules/.bun/@hono+node-server@2.0.4+8bc17dcb8a4189a6/node_modules/@hono/node-server/dist/serve-static.mjs
|
|
78162
78235
|
import { createReadStream, existsSync as existsSync12, statSync as statSync5 } from "node:fs";
|
|
78163
78236
|
import { join as join12 } from "node:path";
|
|
78164
78237
|
var COMPRESSIBLE_CONTENT_TYPE_REGEX = /^\s*(?:text\/[^;\s]+|application\/(?:javascript|json|xml|xml-dtd|ecmascript|dart|postscript|rtf|tar|toml|vnd\.dart|vnd\.ms-fontobject|vnd\.ms-opentype|wasm|x-httpd-php|x-javascript|x-ns-proxy-autoconfig|x-sh|x-tar|x-virtualbox-hdd|x-virtualbox-ova|x-virtualbox-ovf|x-virtualbox-vbox|x-virtualbox-vdi|x-virtualbox-vhd|x-virtualbox-vmdk|x-www-form-urlencoded)|font\/(?:otf|ttf)|image\/(?:bmp|vnd\.adobe\.photoshop|vnd\.microsoft\.icon|vnd\.ms-dds|x-icon|x-ms-bmp)|message\/rfc822|model\/gltf-binary|x-shader\/x-fragment|x-shader\/x-vertex|[^;\s]+?\+(?:json|text|xml|yaml))(?:[;\s]|$)/i;
|
|
@@ -78274,7 +78347,7 @@ import { existsSync as existsSync16 } from "node:fs";
|
|
|
78274
78347
|
import { readFileSync as readFileSync15 } from "node:fs";
|
|
78275
78348
|
import { join as join16 } from "node:path";
|
|
78276
78349
|
|
|
78277
|
-
// ../../node_modules/.bun/hono@4.12.
|
|
78350
|
+
// ../../node_modules/.bun/hono@4.12.25/node_modules/hono/dist/compose.js
|
|
78278
78351
|
var compose = (middleware, onError, onNotFound) => {
|
|
78279
78352
|
return (context, next) => {
|
|
78280
78353
|
let index = -1;
|
|
@@ -78318,10 +78391,10 @@ var compose = (middleware, onError, onNotFound) => {
|
|
|
78318
78391
|
};
|
|
78319
78392
|
};
|
|
78320
78393
|
|
|
78321
|
-
// ../../node_modules/.bun/hono@4.12.
|
|
78394
|
+
// ../../node_modules/.bun/hono@4.12.25/node_modules/hono/dist/request/constants.js
|
|
78322
78395
|
var GET_MATCH_RESULT = /* @__PURE__ */ Symbol();
|
|
78323
78396
|
|
|
78324
|
-
// ../../node_modules/.bun/hono@4.12.
|
|
78397
|
+
// ../../node_modules/.bun/hono@4.12.25/node_modules/hono/dist/utils/body.js
|
|
78325
78398
|
var parseBody = async (request, options = /* @__PURE__ */ Object.create(null)) => {
|
|
78326
78399
|
const { all = false, dot = false } = options;
|
|
78327
78400
|
const headers = request instanceof HonoRequest ? request.raw.headers : request.headers;
|
|
@@ -78392,7 +78465,7 @@ var handleParsingNestedValues = (form, key, value) => {
|
|
|
78392
78465
|
});
|
|
78393
78466
|
};
|
|
78394
78467
|
|
|
78395
|
-
// ../../node_modules/.bun/hono@4.12.
|
|
78468
|
+
// ../../node_modules/.bun/hono@4.12.25/node_modules/hono/dist/utils/url.js
|
|
78396
78469
|
var splitPath = (path) => {
|
|
78397
78470
|
const paths = path.split("/");
|
|
78398
78471
|
if (paths[0] === "") {
|
|
@@ -78592,7 +78665,7 @@ var getQueryParams = (url, key) => {
|
|
|
78592
78665
|
};
|
|
78593
78666
|
var decodeURIComponent_ = decodeURIComponent;
|
|
78594
78667
|
|
|
78595
|
-
// ../../node_modules/.bun/hono@4.12.
|
|
78668
|
+
// ../../node_modules/.bun/hono@4.12.25/node_modules/hono/dist/request.js
|
|
78596
78669
|
var tryDecodeURIComponent = (str) => tryDecode2(str, decodeURIComponent_);
|
|
78597
78670
|
var HonoRequest = class {
|
|
78598
78671
|
raw;
|
|
@@ -78706,7 +78779,7 @@ var HonoRequest = class {
|
|
|
78706
78779
|
}
|
|
78707
78780
|
};
|
|
78708
78781
|
|
|
78709
|
-
// ../../node_modules/.bun/hono@4.12.
|
|
78782
|
+
// ../../node_modules/.bun/hono@4.12.25/node_modules/hono/dist/utils/html.js
|
|
78710
78783
|
var HtmlEscapedCallbackPhase = {
|
|
78711
78784
|
Stringify: 1,
|
|
78712
78785
|
BeforeStream: 2,
|
|
@@ -78744,7 +78817,7 @@ var resolveCallback = async (str, phase, preserveCallbacks, context, buffer2) =>
|
|
|
78744
78817
|
}
|
|
78745
78818
|
};
|
|
78746
78819
|
|
|
78747
|
-
// ../../node_modules/.bun/hono@4.12.
|
|
78820
|
+
// ../../node_modules/.bun/hono@4.12.25/node_modules/hono/dist/context.js
|
|
78748
78821
|
var TEXT_PLAIN = "text/plain; charset=UTF-8";
|
|
78749
78822
|
var setDefaultContentType = (contentType2, headers) => {
|
|
78750
78823
|
return {
|
|
@@ -78911,7 +78984,7 @@ var Context = class {
|
|
|
78911
78984
|
};
|
|
78912
78985
|
};
|
|
78913
78986
|
|
|
78914
|
-
// ../../node_modules/.bun/hono@4.12.
|
|
78987
|
+
// ../../node_modules/.bun/hono@4.12.25/node_modules/hono/dist/router.js
|
|
78915
78988
|
var METHOD_NAME_ALL = "ALL";
|
|
78916
78989
|
var METHOD_NAME_ALL_LOWERCASE = "all";
|
|
78917
78990
|
var METHODS = ["get", "post", "put", "delete", "options", "patch"];
|
|
@@ -78919,10 +78992,10 @@ var MESSAGE_MATCHER_IS_ALREADY_BUILT = "Can not add a route since the matcher is
|
|
|
78919
78992
|
var UnsupportedPathError = class extends Error {
|
|
78920
78993
|
};
|
|
78921
78994
|
|
|
78922
|
-
// ../../node_modules/.bun/hono@4.12.
|
|
78995
|
+
// ../../node_modules/.bun/hono@4.12.25/node_modules/hono/dist/utils/constants.js
|
|
78923
78996
|
var COMPOSED_HANDLER = "__COMPOSED_HANDLER";
|
|
78924
78997
|
|
|
78925
|
-
// ../../node_modules/.bun/hono@4.12.
|
|
78998
|
+
// ../../node_modules/.bun/hono@4.12.25/node_modules/hono/dist/hono-base.js
|
|
78926
78999
|
var notFoundHandler = (c2) => {
|
|
78927
79000
|
return c2.text("404 Not Found", 404);
|
|
78928
79001
|
};
|
|
@@ -79146,7 +79219,7 @@ var Hono = class _Hono {
|
|
|
79146
79219
|
};
|
|
79147
79220
|
};
|
|
79148
79221
|
|
|
79149
|
-
// ../../node_modules/.bun/hono@4.12.
|
|
79222
|
+
// ../../node_modules/.bun/hono@4.12.25/node_modules/hono/dist/router/reg-exp-router/matcher.js
|
|
79150
79223
|
var emptyParam = [];
|
|
79151
79224
|
function match(method, path) {
|
|
79152
79225
|
const matchers = this.buildAllMatchers();
|
|
@@ -79167,7 +79240,7 @@ function match(method, path) {
|
|
|
79167
79240
|
return match2(method, path);
|
|
79168
79241
|
}
|
|
79169
79242
|
|
|
79170
|
-
// ../../node_modules/.bun/hono@4.12.
|
|
79243
|
+
// ../../node_modules/.bun/hono@4.12.25/node_modules/hono/dist/router/reg-exp-router/node.js
|
|
79171
79244
|
var LABEL_REG_EXP_STR = "[^/]+";
|
|
79172
79245
|
var ONLY_WILDCARD_REG_EXP_STR = ".*";
|
|
79173
79246
|
var TAIL_WILDCARD_REG_EXP_STR = "(?:|/.*)";
|
|
@@ -79271,7 +79344,7 @@ var Node = class _Node {
|
|
|
79271
79344
|
}
|
|
79272
79345
|
};
|
|
79273
79346
|
|
|
79274
|
-
// ../../node_modules/.bun/hono@4.12.
|
|
79347
|
+
// ../../node_modules/.bun/hono@4.12.25/node_modules/hono/dist/router/reg-exp-router/trie.js
|
|
79275
79348
|
var Trie = class {
|
|
79276
79349
|
#context = { varIndex: 0 };
|
|
79277
79350
|
#root = new Node;
|
|
@@ -79327,7 +79400,7 @@ var Trie = class {
|
|
|
79327
79400
|
}
|
|
79328
79401
|
};
|
|
79329
79402
|
|
|
79330
|
-
// ../../node_modules/.bun/hono@4.12.
|
|
79403
|
+
// ../../node_modules/.bun/hono@4.12.25/node_modules/hono/dist/router/reg-exp-router/router.js
|
|
79331
79404
|
var nullMatcher = [/^$/, [], /* @__PURE__ */ Object.create(null)];
|
|
79332
79405
|
var wildcardRegExpCache = /* @__PURE__ */ Object.create(null);
|
|
79333
79406
|
function buildWildcardRegExp(path) {
|
|
@@ -79492,7 +79565,7 @@ var RegExpRouter = class {
|
|
|
79492
79565
|
}
|
|
79493
79566
|
};
|
|
79494
79567
|
|
|
79495
|
-
// ../../node_modules/.bun/hono@4.12.
|
|
79568
|
+
// ../../node_modules/.bun/hono@4.12.25/node_modules/hono/dist/router/reg-exp-router/prepared-router.js
|
|
79496
79569
|
var PreparedRegExpRouter = class {
|
|
79497
79570
|
name = "PreparedRegExpRouter";
|
|
79498
79571
|
#matchers;
|
|
@@ -79564,7 +79637,7 @@ var PreparedRegExpRouter = class {
|
|
|
79564
79637
|
match = match;
|
|
79565
79638
|
};
|
|
79566
79639
|
|
|
79567
|
-
// ../../node_modules/.bun/hono@4.12.
|
|
79640
|
+
// ../../node_modules/.bun/hono@4.12.25/node_modules/hono/dist/router/smart-router/router.js
|
|
79568
79641
|
var SmartRouter = class {
|
|
79569
79642
|
name = "SmartRouter";
|
|
79570
79643
|
#routers = [];
|
|
@@ -79619,7 +79692,7 @@ var SmartRouter = class {
|
|
|
79619
79692
|
}
|
|
79620
79693
|
};
|
|
79621
79694
|
|
|
79622
|
-
// ../../node_modules/.bun/hono@4.12.
|
|
79695
|
+
// ../../node_modules/.bun/hono@4.12.25/node_modules/hono/dist/router/trie-router/node.js
|
|
79623
79696
|
var emptyParams = /* @__PURE__ */ Object.create(null);
|
|
79624
79697
|
var hasChildren = (children) => {
|
|
79625
79698
|
for (const _ in children) {
|
|
@@ -79788,7 +79861,7 @@ var Node2 = class _Node2 {
|
|
|
79788
79861
|
}
|
|
79789
79862
|
};
|
|
79790
79863
|
|
|
79791
|
-
// ../../node_modules/.bun/hono@4.12.
|
|
79864
|
+
// ../../node_modules/.bun/hono@4.12.25/node_modules/hono/dist/router/trie-router/router.js
|
|
79792
79865
|
var TrieRouter = class {
|
|
79793
79866
|
name = "TrieRouter";
|
|
79794
79867
|
#node;
|
|
@@ -79810,7 +79883,7 @@ var TrieRouter = class {
|
|
|
79810
79883
|
}
|
|
79811
79884
|
};
|
|
79812
79885
|
|
|
79813
|
-
// ../../node_modules/.bun/hono@4.12.
|
|
79886
|
+
// ../../node_modules/.bun/hono@4.12.25/node_modules/hono/dist/hono.js
|
|
79814
79887
|
var Hono2 = class extends Hono {
|
|
79815
79888
|
constructor(options = {}) {
|
|
79816
79889
|
super(options);
|
|
@@ -79820,7 +79893,7 @@ var Hono2 = class extends Hono {
|
|
|
79820
79893
|
}
|
|
79821
79894
|
};
|
|
79822
79895
|
|
|
79823
|
-
// ../../node_modules/.bun/hono@4.12.
|
|
79896
|
+
// ../../node_modules/.bun/hono@4.12.25/node_modules/hono/dist/utils/color.js
|
|
79824
79897
|
function getColorEnabled() {
|
|
79825
79898
|
const { process: process10, Deno: Deno2 } = globalThis;
|
|
79826
79899
|
const isNoColor = typeof Deno2?.noColor === "boolean" ? Deno2.noColor : process10 !== undefined ? "NO_COLOR" in process10?.env : false;
|
|
@@ -79839,7 +79912,7 @@ async function getColorEnabledAsync() {
|
|
|
79839
79912
|
return !isNoColor;
|
|
79840
79913
|
}
|
|
79841
79914
|
|
|
79842
|
-
// ../../node_modules/.bun/hono@4.12.
|
|
79915
|
+
// ../../node_modules/.bun/hono@4.12.25/node_modules/hono/dist/middleware/logger/index.js
|
|
79843
79916
|
var humanize = (times) => {
|
|
79844
79917
|
const [delimiter, separator] = [",", "."];
|
|
79845
79918
|
const orderTimes = times.map((v) => v.replace(/(\d)(?=(\d\d\d)+(?!\d))/g, "$1" + delimiter));
|
|
@@ -82048,6 +82121,7 @@ Learn more:
|
|
|
82048
82121
|
moveInto(document2, registerDeleteDoc, "delete");
|
|
82049
82122
|
registerDocumentRestore(document2);
|
|
82050
82123
|
registerDocumentEdit(document2);
|
|
82124
|
+
registerDocumentSetProjects(document2);
|
|
82051
82125
|
moveInto(document2, registerIngest, "ingest");
|
|
82052
82126
|
moveInto(document2, registerIngestDir, "ingest-dir");
|
|
82053
82127
|
const documentVersion = document2.command("version").description("Document versions: list, archive, unarchive.");
|