@memnexus-ai/cli 1.7.236 → 1.7.238
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commands/memories.d.ts +14 -0
- package/dist/commands/memories.d.ts.map +1 -1
- package/dist/commands/memories.js +83 -5
- package/dist/commands/memories.js.map +1 -1
- package/dist/lib/api-client.d.ts +17 -1
- package/dist/lib/api-client.d.ts.map +1 -1
- package/dist/lib/api-client.js +42 -11
- package/dist/lib/api-client.js.map +1 -1
- package/dist/lib/retry.d.ts +32 -0
- package/dist/lib/retry.d.ts.map +1 -1
- package/dist/lib/retry.js +89 -5
- package/dist/lib/retry.js.map +1 -1
- package/package.json +2 -2
|
@@ -27,6 +27,12 @@ export declare function recordDeletion(guardPath: string, now: number): void;
|
|
|
27
27
|
* happened and how to override.
|
|
28
28
|
*/
|
|
29
29
|
export declare function checkBulkDeleteGuard(guardPath: string, now: number): boolean;
|
|
30
|
+
/**
|
|
31
|
+
* One-line cause for a recall/digest HTTP failure, or null when the status is
|
|
32
|
+
* not one the recall path reports itself (those fall through to handleError).
|
|
33
|
+
* `elapsedMs` covers every attempt, so "after N s" is what the caller waited.
|
|
34
|
+
*/
|
|
35
|
+
export declare function describeRecallFailure(error: unknown, elapsedMs: number): string | null;
|
|
30
36
|
/**
|
|
31
37
|
* Parse the --code-context JSON flag.
|
|
32
38
|
*
|
|
@@ -303,6 +309,14 @@ export declare function registerMemoryTimelineCommand(memories: Command): void;
|
|
|
303
309
|
* @param memories - Parent memories command
|
|
304
310
|
*/
|
|
305
311
|
export declare function registerDetectRelationshipsCommand(memories: Command): void;
|
|
312
|
+
/**
|
|
313
|
+
* CLI default for `--max-sources` on `digest`/`recall` and `status` (GH #5570, PR-B2 step 3).
|
|
314
|
+
* Lowered from 100 to 20: on dev, maxSources 100 returned 0 of 58 requests with HTTP 200
|
|
315
|
+
* (all 503), while 20 returned 49 of 50. This is a client-side default only; the server
|
|
316
|
+
* schema default (digest.schema.ts) stays 100, so SDK and direct API callers are unchanged.
|
|
317
|
+
* An explicit --max-sources still overrides it.
|
|
318
|
+
*/
|
|
319
|
+
export declare const DEFAULT_RECALL_MAX_SOURCES = "20";
|
|
306
320
|
/**
|
|
307
321
|
* Register digest command for AI-powered memory briefings
|
|
308
322
|
* @param memories - Parent memories command
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"memories.d.ts","sourceRoot":"","sources":["../../src/commands/memories.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"memories.d.ts","sourceRoot":"","sources":["../../src/commands/memories.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAYpC,OAAO,EACL,gBAAgB,EAChB,yBAAyB,EACzB,YAAY,EACZ,mBAAmB,EACnB,eAAe,EAGf,KAAK,EAIN,MAAM,cAAc,CAAC;AAkCtB,qEAAqE;AACrE,eAAO,MAAM,2BAA2B,IAAI,CAAC;AAC7C,mDAAmD;AACnD,eAAO,MAAM,2BAA2B,QAAS,CAAC;AAElD,mDAAmD;AACnD,wBAAgB,sBAAsB,IAAI,MAAM,CAE/C;AAED;;;;;;GAMG;AACH,wBAAgB,yBAAyB,CAAC,SAAS,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE,CAYlF;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,SAAS,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,IAAI,CASnE;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,SAAS,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CA0B5E;AA8CD;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAoCtF;AAeD;;;;;;GAMG;AACH,wBAAgB,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K;aAGzB,KAAK,EAAE,MAAM;aACb,KAAK,EAAE,MAAM;IAH/B,QAAQ,CAAC,IAAI,qBAAqB;gBAEhB,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,MAAM;CAKhC;AAED;;;;;;GAMG;AACH,wBAAsB,YAAY,CAChC,QAAQ,GAAE,MAAqC,GAC9C,OAAO,CAAC,MAAM,CAAC,CA+BjB;AAaD;;;;;;;;;;GAUG;AACH,wBAAsB,qBAAqB,CACzC,aAAa,GAAE,MAAqC,GACnD,OAAO,CAAC,IAAI,CAAC,CAqFf;AAED;;;GAGG;AACH,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAsvD/D;AAqZD;;;GAGG;AACH,wBAAgB,kCAAkC,CAAC,QAAQ,EAAE,OAAO,GAAG,IAAI,CAkN1E;AAED;;;GAGG;AACH,wBAAgB,6BAA6B,CAAC,QAAQ,EAAE,OAAO,GAAG,IAAI,CA0ErE;AAED;;;GAGG;AACH,wBAAgB,kCAAkC,CAAC,QAAQ,EAAE,OAAO,GAAG,IAAI,CAsE1E;AA0DD;;;;;;GAMG;AACH,eAAO,MAAM,0BAA0B,OAAO,CAAC;AAE/C;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,OAAO,GAAG,IAAI,CAoL7D;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,OAAO,GAAG,IAAI,CA+G7D;AAgLD;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,OAAO,GAAG,IAAI,CA0J5D;AAkPD;;;GAGG;AACH,wBAAgB,2BAA2B,CAAC,QAAQ,EAAE,OAAO,GAAG,IAAI,CAkPnE"}
|
|
@@ -36,11 +36,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
36
36
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.StdinTooLargeError = exports.BATCH_CREATE_ALLOWED_KEYS = exports.BATCH_CREATE_MAX_LINE_BYTES = exports.BATCH_CREATE_MAX_STDIN_BYTES = exports.BATCH_CREATE_MAX_RETRIES = exports.BATCH_CREATE_CONCURRENCY_MAX = exports.BATCH_CREATE_CONCURRENCY_MIN = exports.BATCH_CREATE_DEFAULT_CONCURRENCY = exports.sleep = exports.getRetryAfterMs = exports.isNameConflictError = exports.isQuotaError = exports.isServiceUnavailableError = exports.isRateLimitError = exports.BULK_DELETE_LIST_PAGE_SIZE = exports.BULK_DELETE_MAX_RETRIES = exports.BULK_DELETE_PAGE_PAUSE_MS = exports.BULK_DELETE_MAX_IDS = exports.BULK_DELETE_GUARD_WINDOW_MS = exports.BULK_DELETE_GUARD_THRESHOLD = void 0;
|
|
39
|
+
exports.DEFAULT_RECALL_MAX_SOURCES = exports.StdinTooLargeError = exports.BATCH_CREATE_ALLOWED_KEYS = exports.BATCH_CREATE_MAX_LINE_BYTES = exports.BATCH_CREATE_MAX_STDIN_BYTES = exports.BATCH_CREATE_MAX_RETRIES = exports.BATCH_CREATE_CONCURRENCY_MAX = exports.BATCH_CREATE_CONCURRENCY_MIN = exports.BATCH_CREATE_DEFAULT_CONCURRENCY = exports.sleep = exports.getRetryAfterMs = exports.isNameConflictError = exports.isQuotaError = exports.isServiceUnavailableError = exports.isRateLimitError = exports.BULK_DELETE_LIST_PAGE_SIZE = exports.BULK_DELETE_MAX_RETRIES = exports.BULK_DELETE_PAGE_PAUSE_MS = exports.BULK_DELETE_MAX_IDS = exports.BULK_DELETE_GUARD_WINDOW_MS = exports.BULK_DELETE_GUARD_THRESHOLD = void 0;
|
|
40
40
|
exports.getBulkDeleteGuardPath = getBulkDeleteGuardPath;
|
|
41
41
|
exports.readDeleteGuardTimestamps = readDeleteGuardTimestamps;
|
|
42
42
|
exports.recordDeletion = recordDeletion;
|
|
43
43
|
exports.checkBulkDeleteGuard = checkBulkDeleteGuard;
|
|
44
|
+
exports.describeRecallFailure = describeRecallFailure;
|
|
44
45
|
exports.parseCodeContextFlag = parseCodeContextFlag;
|
|
45
46
|
exports.parseBatchIds = parseBatchIds;
|
|
46
47
|
exports.isValidIsoDate = isValidIsoDate;
|
|
@@ -196,6 +197,43 @@ const RECALL_MAX_MS = (() => {
|
|
|
196
197
|
// code needs setting.
|
|
197
198
|
const EXIT_FULL_TIMEOUT = 5;
|
|
198
199
|
const EXIT_DEGRADED_RESULT = 6;
|
|
200
|
+
/**
|
|
201
|
+
* One-line cause for a recall/digest HTTP failure, or null when the status is
|
|
202
|
+
* not one the recall path reports itself (those fall through to handleError).
|
|
203
|
+
* `elapsedMs` covers every attempt, so "after N s" is what the caller waited.
|
|
204
|
+
*/
|
|
205
|
+
function describeRecallFailure(error, elapsedMs) {
|
|
206
|
+
const status = (0, retry_1.httpStatus)(error);
|
|
207
|
+
const secs = `${(elapsedMs / 1000).toFixed(1)}s`;
|
|
208
|
+
const rawReason = (0, retry_1.errorBody)(error)?.reason;
|
|
209
|
+
const reason = typeof rawReason === 'string' ? (0, errors_1.sanitizeServerText)(rawReason, 64) : '';
|
|
210
|
+
switch (status) {
|
|
211
|
+
case 503:
|
|
212
|
+
if (reason === 'deadline_exceeded') {
|
|
213
|
+
return (`Recall failed: the server's digest deadline was exceeded after ${secs} ` +
|
|
214
|
+
`(HTTP 503 deadline_exceeded). Not retried: each retry starts another LLM synthesis.`);
|
|
215
|
+
}
|
|
216
|
+
return `Recall failed: the digest service was unavailable after ${secs} (HTTP 503${reason ? ` ${reason}` : ''}). Not retried.`;
|
|
217
|
+
case 500:
|
|
218
|
+
return (`Recall failed: the server errored while generating the digest after ${secs} (HTTP 500). ` +
|
|
219
|
+
`Not retried. A common cause is the LLM provider rate-limiting digest synthesis.`);
|
|
220
|
+
case 429: {
|
|
221
|
+
const hinted = (0, retry_1.getRetryAfterMs)(error);
|
|
222
|
+
const hint = hinted === null
|
|
223
|
+
? // Only the body field is visible: the SDK drops response headers,
|
|
224
|
+
// so a Retry-After HEADER may have been sent and is not seen here.
|
|
225
|
+
'the server sent no retryAfter in the response body'
|
|
226
|
+
: `the server asked to retry after ${Math.round(hinted / 1000)}s`;
|
|
227
|
+
return `Recall failed: rate limited after ${secs} (HTTP 429; ${hint}).`;
|
|
228
|
+
}
|
|
229
|
+
case 502:
|
|
230
|
+
case 504:
|
|
231
|
+
case 408:
|
|
232
|
+
return `Recall failed: gateway/transport error after ${secs} (HTTP ${status}).`;
|
|
233
|
+
default:
|
|
234
|
+
return null;
|
|
235
|
+
}
|
|
236
|
+
}
|
|
199
237
|
/** True when an error is the SDK aborting the digest call at the ceiling. */
|
|
200
238
|
function isRecallTimeoutError(error) {
|
|
201
239
|
const e = error;
|
|
@@ -554,6 +592,19 @@ function retryRead(fn) {
|
|
|
554
592
|
onRetry: emitRetryNotice,
|
|
555
593
|
});
|
|
556
594
|
}
|
|
595
|
+
/**
|
|
596
|
+
* Wrap the recall/digest call (POST /api/memories/digest). Every attempt runs a
|
|
597
|
+
* server-side LLM synthesis, so this uses the narrower recall policy — at most
|
|
598
|
+
* one retry, never on 503/500, 429 only with a server Retry-After — instead of
|
|
599
|
+
* retryRead. See withRecallRetry in lib/retry.ts and GH #5570.
|
|
600
|
+
*/
|
|
601
|
+
function retryRecall(fn) {
|
|
602
|
+
return (0, retry_1.withRecallRetry)(fn, {
|
|
603
|
+
sleep: retry_1.sleep,
|
|
604
|
+
maxRetries: retry_1.SINGLE_SHOT_MAX_RETRIES,
|
|
605
|
+
onRetry: emitRetryNotice,
|
|
606
|
+
});
|
|
607
|
+
}
|
|
557
608
|
/**
|
|
558
609
|
* Wrap a non-idempotent single-shot write (plain POST create, non-CAS update).
|
|
559
610
|
* Retries ONLY 429 (server rejected before processing — no duplicate risk);
|
|
@@ -3461,6 +3512,14 @@ function formatEffectiveState(state) {
|
|
|
3461
3512
|
return state || 'current';
|
|
3462
3513
|
}
|
|
3463
3514
|
}
|
|
3515
|
+
/**
|
|
3516
|
+
* CLI default for `--max-sources` on `digest`/`recall` and `status` (GH #5570, PR-B2 step 3).
|
|
3517
|
+
* Lowered from 100 to 20: on dev, maxSources 100 returned 0 of 58 requests with HTTP 200
|
|
3518
|
+
* (all 503), while 20 returned 49 of 50. This is a client-side default only; the server
|
|
3519
|
+
* schema default (digest.schema.ts) stays 100, so SDK and direct API callers are unchanged.
|
|
3520
|
+
* An explicit --max-sources still overrides it.
|
|
3521
|
+
*/
|
|
3522
|
+
exports.DEFAULT_RECALL_MAX_SOURCES = '20';
|
|
3464
3523
|
/**
|
|
3465
3524
|
* Register digest command for AI-powered memory briefings
|
|
3466
3525
|
* @param memories - Parent memories command
|
|
@@ -3475,10 +3534,11 @@ function registerDigestCommand(memories) {
|
|
|
3475
3534
|
.option('--recent <duration>', 'Time window (e.g., 24h, 7d, 2w)')
|
|
3476
3535
|
.option('--topics <topics>', 'Filter by topics (comma-separated)')
|
|
3477
3536
|
.option('--digest-format <format>', 'Digest format (structured|narrative|timeline|status-report)', 'structured')
|
|
3478
|
-
.option('--max-sources <number>', 'Maximum source memories to consider',
|
|
3537
|
+
.option('--max-sources <number>', 'Maximum source memories to consider', exports.DEFAULT_RECALL_MAX_SOURCES)
|
|
3479
3538
|
.option('--show-sources', 'Display source memory IDs')
|
|
3480
3539
|
.option('--format <format>', 'Output format (json|yaml|llm)')
|
|
3481
3540
|
.action(async (options) => {
|
|
3541
|
+
let callStartedAt;
|
|
3482
3542
|
try {
|
|
3483
3543
|
if (!options.query) {
|
|
3484
3544
|
throw (0, errors_1.validationError)('--query is required');
|
|
@@ -3506,13 +3566,16 @@ function registerDigestCommand(memories) {
|
|
|
3506
3566
|
// 30s default to the 180s ceiling. The SDK aborts the fetch via AbortController
|
|
3507
3567
|
// when this elapses (verified in @memnexus-ai/typescript-sdk http client), so
|
|
3508
3568
|
// the call fast-fails instead of hanging (KI-77 client half).
|
|
3509
|
-
|
|
3569
|
+
// Single-attempt transport: the SDK's own retry layer is disabled for this
|
|
3570
|
+
// call so retryRecall is the only retry policy (GH #5570).
|
|
3571
|
+
const sdk = (0, api_client_1.getSingleAttemptSdk)();
|
|
3510
3572
|
const prevTimeout = sdk.config?.timeoutMs ?? 30000;
|
|
3511
3573
|
if (sdk.config)
|
|
3512
3574
|
sdk.config.timeoutMs = RECALL_MAX_MS;
|
|
3513
3575
|
let response;
|
|
3576
|
+
callStartedAt = Date.now();
|
|
3514
3577
|
try {
|
|
3515
|
-
response = await
|
|
3578
|
+
response = await retryRecall(() => sdk.memories.generateMemoryDigest(body));
|
|
3516
3579
|
}
|
|
3517
3580
|
finally {
|
|
3518
3581
|
if (sdk.config)
|
|
@@ -3568,6 +3631,21 @@ function registerDigestCommand(memories) {
|
|
|
3568
3631
|
displayDigest(digest, metadata, sources, options, keyFacts, entities, effectiveStateBreakdown, renderable.health);
|
|
3569
3632
|
}
|
|
3570
3633
|
catch (error) {
|
|
3634
|
+
// GH #5570: name the cause of a server-side failure and point at the
|
|
3635
|
+
// retrieval path that needs no LLM synthesis. Exit 5 is the code
|
|
3636
|
+
// handleError already used for every one of these statuses. Checked
|
|
3637
|
+
// BEFORE the client-ceiling branch: an HTTP 504 carries the message
|
|
3638
|
+
// "HTTP 504: Gateway Timeout", which isRecallTimeoutError would otherwise
|
|
3639
|
+
// misreport as the CLI's own 180s ceiling (same exit code, wrong cause).
|
|
3640
|
+
const cause = callStartedAt === undefined
|
|
3641
|
+
? null
|
|
3642
|
+
: describeRecallFailure(error, Date.now() - callStartedAt);
|
|
3643
|
+
if (cause !== null) {
|
|
3644
|
+
console.error(chalk_1.default.red(`\n❌ ${cause}`));
|
|
3645
|
+
console.error(chalk_1.default.yellow('\n💡 Workaround: retrieve the memories directly, without synthesis:'));
|
|
3646
|
+
console.error(chalk_1.default.yellow(' mx memories search --query "<query>" --id-only | mx memories get --stdin'));
|
|
3647
|
+
process.exit(5);
|
|
3648
|
+
}
|
|
3571
3649
|
// KI-77: name the ceiling and give a narrower-query fix instead of the SDK's
|
|
3572
3650
|
// opaque "operation was aborted" so the user knows what happened and how to recover.
|
|
3573
3651
|
if (isRecallTimeoutError(error)) {
|
|
@@ -3594,7 +3672,7 @@ function registerStatusCommand(memories) {
|
|
|
3594
3672
|
.option('--query <text>', 'Topic or project to get status for (required)')
|
|
3595
3673
|
.option('--recent <duration>', 'Time window (e.g., 24h, 7d, 2w)')
|
|
3596
3674
|
.option('--topics <topics>', 'Filter by topics (comma-separated)')
|
|
3597
|
-
.option('--max-sources <number>', 'Maximum source memories to consider',
|
|
3675
|
+
.option('--max-sources <number>', 'Maximum source memories to consider', exports.DEFAULT_RECALL_MAX_SOURCES)
|
|
3598
3676
|
.option('--show-sources', 'Display source memory IDs')
|
|
3599
3677
|
.option('--format <format>', 'Output format (json|yaml|llm)')
|
|
3600
3678
|
.action(async (options) => {
|