@hunterzhu/pulse-cli 0.4.5 → 0.4.6

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/bin.js CHANGED
@@ -3,7 +3,7 @@ import { readFile } from 'node:fs/promises';
3
3
  import { createRequire } from 'node:module';
4
4
  import { isAbsolute, resolve } from 'node:path';
5
5
  import { fileURLToPath } from 'node:url';
6
- import { createMcpCapabilityPack, createPdfCapabilityPack, createSkillCapabilityPack, createSpreadsheetCapabilityPack } from '@hunterzhu/pulse-server';
6
+ import { assertJarvisApiUrl, createMcpCapabilityPack, createPdfCapabilityPack, createSkillCapabilityPack, createSpreadsheetCapabilityPack } from '@hunterzhu/pulse-server';
7
7
  import { defaultPulseConfig, ensurePulseUserConfig, expandHome, loadPulseConfig } from './config.js';
8
8
  import { runInteractive } from './commands/interactive.js';
9
9
  import { runOneShot } from './commands/run.js';
@@ -66,12 +66,36 @@ Options:
66
66
  --mock-after-tool-response <text> deterministic response after tool execution
67
67
  --task-controller force the multi-stage task controller
68
68
  --no-task-controller keep a single ReAct loop
69
+ --jarvis enable Jarvis cognitive memory architecture
70
+ --no-jarvis disable Jarvis cognitive memory architecture
71
+ --jarvis-url <url> Jarvis API base URL (default http://127.0.0.1:7330)
72
+ --jarvis-token <token> bearer token for the Jarvis API
73
+ --jarvis-budget <n> context token budget sent to Jarvis (default 4000)
74
+ --jarvis-allow-remote allow a Jarvis URL that is not loopback
69
75
  --live doctor: make one real provider request
70
76
  --no-color disable terminal styling
71
77
  --help, -h show this help
72
78
  --version, -v show the version
73
79
  setup --force write a user config template (also created on first run)
74
80
  `;
81
+ const knownBooleanFlags = new Set([
82
+ 'resume',
83
+ 'read-only',
84
+ 'auto-approve',
85
+ 'allow-network',
86
+ 'no-network',
87
+ 'trust-workspace',
88
+ 'task-controller',
89
+ 'no-task-controller',
90
+ 'live',
91
+ 'no-color',
92
+ 'help',
93
+ 'version',
94
+ 'force',
95
+ 'jarvis',
96
+ 'no-jarvis',
97
+ 'jarvis-allow-remote',
98
+ ]);
75
99
  export function parse(argv) {
76
100
  const options = {};
77
101
  const positionals = [];
@@ -95,6 +119,10 @@ export function parse(argv) {
95
119
  options[key] = inline;
96
120
  continue;
97
121
  }
122
+ if (knownBooleanFlags.has(key)) {
123
+ options[key] = true;
124
+ continue;
125
+ }
98
126
  const next = forwarded[index + 1];
99
127
  if (next && !next.startsWith('-')) {
100
128
  options[key] = next;
@@ -357,6 +385,32 @@ export async function hostOptions(parsed) {
357
385
  }
358
386
  }
359
387
  const explicitTaskController = parsed.options['task-controller'] === true ? true : parsed.options['no-task-controller'] === true ? false : mockParallelPlanOption !== undefined ? true : undefined;
388
+ const explicitJarvis = parsed.options['jarvis'] === true
389
+ ? true
390
+ : parsed.options['no-jarvis'] === true
391
+ ? false
392
+ : process.env.PULSE_JARVIS_ENABLED !== undefined
393
+ ? process.env.PULSE_JARVIS_ENABLED === '1' || process.env.PULSE_JARVIS_ENABLED.toLowerCase() === 'true'
394
+ : config.jarvis?.enabled;
395
+ const jarvisUrl = option(parsed.options, 'jarvis-url') ?? process.env.PULSE_JARVIS_API_URL ?? config.jarvis?.apiUrl;
396
+ const jarvisToken = option(parsed.options, 'jarvis-token') ?? process.env.PULSE_JARVIS_TOKEN ?? config.jarvis?.token;
397
+ const jarvisBudget = parsePositiveInteger(option(parsed.options, 'jarvis-budget') ?? process.env.PULSE_JARVIS_BUDGET) ?? config.jarvis?.contextTokenBudget;
398
+ const jarvisAutoCandidate = config.jarvis?.autoCandidate ?? true;
399
+ const jarvisAllowRemote = parsed.options['jarvis-allow-remote'] === true
400
+ || process.env.PULSE_JARVIS_ALLOW_REMOTE === '1'
401
+ || process.env.PULSE_JARVIS_ALLOW_REMOTE?.toLowerCase() === 'true'
402
+ || config.jarvis?.allowRemote === true;
403
+ const jarvisEnabled = explicitJarvis ?? false;
404
+ if (jarvisEnabled)
405
+ assertJarvisApiUrl(jarvisUrl ?? 'http://127.0.0.1:7330', jarvisAllowRemote);
406
+ const jarvis = {
407
+ enabled: jarvisEnabled,
408
+ ...(jarvisUrl ? { apiUrl: jarvisUrl } : {}),
409
+ ...(jarvisToken ? { token: jarvisToken } : {}),
410
+ ...(jarvisBudget ? { contextTokenBudget: jarvisBudget } : {}),
411
+ autoCandidate: jarvisAutoCandidate,
412
+ allowRemote: jarvisAllowRemote,
413
+ };
360
414
  return {
361
415
  ...(explicitTaskController === undefined ? {} : { taskController: explicitTaskController }),
362
416
  ...(cwd === undefined ? {} : { cwd }),
@@ -384,6 +438,7 @@ export async function hostOptions(parsed) {
384
438
  ...(configuredAutoCompactPercent === undefined ? {} : { autoCompactPercent: Math.min(90, configuredAutoCompactPercent) }),
385
439
  ...(allowNetwork === undefined ? {} : { allowNetwork }),
386
440
  ...(config.networkHosts === undefined ? {} : { networkHosts: config.networkHosts }),
441
+ jarvis,
387
442
  };
388
443
  }
389
444
  export async function main() {
package/dist/config.d.ts CHANGED
@@ -77,6 +77,21 @@ export interface PulseCliConfig {
77
77
  /** Explicit network destinations; workspace configuration cannot grant these. */
78
78
  networkHosts?: string[];
79
79
  allowNetwork?: boolean;
80
+ jarvis?: PulseCliJarvisConfig;
81
+ }
82
+ export interface PulseCliJarvisConfig {
83
+ /** Master switch to enable or disable Jarvis cognitive memory architecture. */
84
+ enabled?: boolean;
85
+ /** Base URL of the running Jarvis server. Defaults to http://127.0.0.1:7330 */
86
+ apiUrl?: string;
87
+ /** Optional bearer token if Jarvis requires auth. */
88
+ token?: string;
89
+ /** Max token budget for dynamic context package built by Jarvis. Defaults to 4000. */
90
+ contextTokenBudget?: number;
91
+ /** Whether to automatically record candidate memories upon task completion. Defaults to true. */
92
+ autoCandidate?: boolean;
93
+ /** Allow an API URL that is not loopback. Defaults to false. */
94
+ allowRemote?: boolean;
80
95
  }
81
96
  export declare const defaultPulseConfig: PulseCliConfig;
82
97
  export declare function defaultPulseConfigPath(): string;
@@ -84,7 +99,7 @@ export declare function defaultPulseHomePath(): string;
84
99
  /** Create the user config on first run without replacing an existing file. */
85
100
  export declare function ensurePulseUserConfig(path?: string): Promise<void>;
86
101
  export declare function expandHome(path: string | undefined): string | undefined;
87
- /** Workspace files must not escalate approval, network, provider credentials, or the system prompt. */
102
+ /** Workspace files must not escalate approval, network, provider credentials, the system prompt, or the Jarvis endpoint. */
88
103
  export declare function sanitizeWorkspaceConfig(value: PulseCliConfig): PulseCliConfig;
89
104
  export declare function mergePulseConfigs(layers: Array<{
90
105
  value: PulseCliConfig;
package/dist/config.js CHANGED
@@ -27,6 +27,13 @@ export const defaultPulseConfig = {
27
27
  maxTurns: 32,
28
28
  autoCompactPercent: 90,
29
29
  allowNetwork: false,
30
+ jarvis: {
31
+ enabled: false,
32
+ apiUrl: 'http://127.0.0.1:7330',
33
+ contextTokenBudget: 4_000,
34
+ autoCandidate: true,
35
+ allowRemote: false,
36
+ },
30
37
  };
31
38
  export function defaultPulseConfigPath() {
32
39
  return join(defaultPulseHomePath(), 'config.json');
@@ -69,7 +76,7 @@ function asConfig(value) {
69
76
  return undefined;
70
77
  return value;
71
78
  }
72
- /** Workspace files must not escalate approval, network, provider credentials, or the system prompt. */
79
+ /** Workspace files must not escalate approval, network, provider credentials, the system prompt, or the Jarvis endpoint. */
73
80
  export function sanitizeWorkspaceConfig(value) {
74
81
  const providers = value.providers === undefined ? undefined : Object.fromEntries(Object.entries(value.providers).flatMap(([name, profile]) => {
75
82
  const safe = {
@@ -1,5 +1,27 @@
1
1
  // Generated from CHANGELOG.md and CHANGELOG.en.md by scripts/release/sync-cli-highlights.mjs. Do not edit manually.
2
2
  export const releaseHighlights = {
3
+ "0.4.6": [
4
+ {
5
+ "zh": "支持通过 CLI、环境变量或用户配置启用 Jarvis 会话、项目上下文、执行事件和候选记忆;默认关闭,服务不可用时继续独立运行。",
6
+ "en": "Jarvis sessions, project context, execution events, and candidate memories can be enabled through CLI flags, environment variables, or user configuration; integration is off by default and execution continues independently if the service is unavailable."
7
+ },
8
+ {
9
+ "zh": "工具事件仅发送执行标识、工具名称和状态,避免参数、文件内容和输出中的凭据进入记忆;发送的文本增加常见凭据脱敏。",
10
+ "en": "Tool events send only execution identifiers, tool names, and statuses to keep credentials in arguments, file contents, and outputs out of memory; outbound text redacts common credential forms."
11
+ },
12
+ {
13
+ "zh": "持久化每次运行的 Jarvis 会话、上下文和已记录事件,恢复运行时保留上下文并避免重放已记录事件。",
14
+ "en": "Persist each run's Jarvis session, context, and recorded events so restored runs retain context without replaying recorded events."
15
+ },
16
+ {
17
+ "zh": "事件记录不再依赖界面消费,结束前等待本次运行的写入完成;并行运行不会互相等待记忆写入。",
18
+ "en": "Event recording no longer depends on UI consumption, and completion waits for the current run's writes; concurrent runs do not wait for each other's memory writes."
19
+ },
20
+ {
21
+ "zh": "候选记忆标题统一为单行并限制长度;仅验收通过的任务可记录为成功,工作区配置不能启用 Jarvis 或覆盖其端点。",
22
+ "en": "Candidate memory titles are normalized to a single line and capped in length; only accepted tasks are recorded as successful, and workspace configuration cannot enable Jarvis or override its endpoint."
23
+ }
24
+ ],
3
25
  "0.4.5": [
4
26
  {
5
27
  "zh": "复杂任务不再受全局模型调用次数上限截断,继续通过阶段、运行时限和循环检测控制执行;旧会话保持原有预算语义。",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hunterzhu/pulse-cli",
3
- "version": "0.4.5",
3
+ "version": "0.4.6",
4
4
  "description": "A local-first AI task assistant for coding, research, and file workflows.",
5
5
  "license": "PolyForm-Noncommercial-1.0.0",
6
6
  "keywords": [
@@ -36,7 +36,7 @@
36
36
  "registry": "https://registry.npmjs.org"
37
37
  },
38
38
  "dependencies": {
39
- "@hunterzhu/pulse-server": "0.4.5",
39
+ "@hunterzhu/pulse-server": "0.4.6",
40
40
  "chalk": "^5.4.1",
41
41
  "highlight.js": "^11.10.0",
42
42
  "ink": "^7.1.1",