@agentage/cli 0.35.0 → 0.38.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (85) hide show
  1. package/README.md +53 -83
  2. package/dist/cli.js +0 -5
  3. package/dist/commands/auth/setup.d.ts +0 -2
  4. package/dist/commands/auth/setup.js +0 -18
  5. package/dist/commands/status/status.js +1 -25
  6. package/dist/commands/update/update.d.ts +0 -9
  7. package/dist/commands/update/update.js +0 -20
  8. package/dist/core/flag.d.ts +1 -0
  9. package/dist/core/flag.js +1 -0
  10. package/dist/lib/auth/api.js +1 -1
  11. package/dist/lib/auth/oauth.js +1 -1
  12. package/dist/lib/net/origins.d.ts +0 -2
  13. package/dist/lib/net/origins.js +1 -5
  14. package/dist/lib/net/user-agent.d.ts +1 -6
  15. package/dist/lib/net/user-agent.js +3 -4
  16. package/dist/lib/status/status-info.d.ts +0 -18
  17. package/dist/lib/status/status-info.js +1 -42
  18. package/dist/plugin.d.ts +1 -0
  19. package/dist/plugin.js +2 -0
  20. package/dist/program.js +4 -16
  21. package/package.json +17 -12
  22. package/dist/commands/daemon/daemon-cmd.d.ts +0 -2
  23. package/dist/commands/daemon/daemon-cmd.js +0 -107
  24. package/dist/commands/memory/memory-verbs.d.ts +0 -21
  25. package/dist/commands/memory/memory-verbs.js +0 -98
  26. package/dist/commands/memory/memory.d.ts +0 -2
  27. package/dist/commands/memory/memory.js +0 -54
  28. package/dist/commands/vault/vault-sync.d.ts +0 -13
  29. package/dist/commands/vault/vault-sync.js +0 -90
  30. package/dist/commands/vault/vault.d.ts +0 -22
  31. package/dist/commands/vault/vault.js +0 -129
  32. package/dist/daemon/actions.d.ts +0 -5
  33. package/dist/daemon/actions.js +0 -22
  34. package/dist/daemon/client-provider.d.ts +0 -2
  35. package/dist/daemon/client-provider.js +0 -16
  36. package/dist/daemon/entry.d.ts +0 -8
  37. package/dist/daemon/entry.js +0 -113
  38. package/dist/daemon/guards.d.ts +0 -3
  39. package/dist/daemon/guards.js +0 -13
  40. package/dist/daemon/lifecycle.d.ts +0 -17
  41. package/dist/daemon/lifecycle.js +0 -151
  42. package/dist/daemon/mcp-http.d.ts +0 -3
  43. package/dist/daemon/mcp-http.js +0 -34
  44. package/dist/daemon/server.d.ts +0 -23
  45. package/dist/daemon/server.js +0 -135
  46. package/dist/daemon-entry.d.ts +0 -1
  47. package/dist/daemon-entry.js +0 -9
  48. package/dist/lib/auth/provision.d.ts +0 -14
  49. package/dist/lib/auth/provision.js +0 -49
  50. package/dist/lib/daemon/daemon-client.d.ts +0 -37
  51. package/dist/lib/daemon/daemon-client.js +0 -136
  52. package/dist/lib/daemon/daemon-pref.d.ts +0 -2
  53. package/dist/lib/daemon/daemon-pref.js +0 -10
  54. package/dist/lib/memory/memory-client.d.ts +0 -30
  55. package/dist/lib/memory/memory-client.js +0 -98
  56. package/dist/lib/status/format.d.ts +0 -1
  57. package/dist/lib/status/format.js +0 -12
  58. package/dist/lib/status/vaults-format.d.ts +0 -2
  59. package/dist/lib/status/vaults-format.js +0 -49
  60. package/dist/lib/status/vaults-status.d.ts +0 -12
  61. package/dist/lib/status/vaults-status.js +0 -54
  62. package/dist/lib/vault/vault-registry.d.ts +0 -12
  63. package/dist/lib/vault/vault-registry.js +0 -81
  64. package/dist/lib/vault/vaults.d.ts +0 -10
  65. package/dist/lib/vault/vaults.js +0 -66
  66. package/dist/lib/vault/vaults.schema.d.ts +0 -2
  67. package/dist/lib/vault/vaults.schema.js +0 -10
  68. package/dist/mcp/local-server.d.ts +0 -4
  69. package/dist/mcp/local-server.js +0 -26
  70. package/dist/observability.d.ts +0 -4
  71. package/dist/observability.js +0 -35
  72. package/dist/sync/discover/watcher.d.ts +0 -26
  73. package/dist/sync/discover/watcher.js +0 -159
  74. package/dist/sync/git/conflict.d.ts +0 -1
  75. package/dist/sync/git/conflict.js +0 -16
  76. package/dist/sync/git/cycle.d.ts +0 -18
  77. package/dist/sync/git/cycle.js +0 -158
  78. package/dist/sync/git/git-exec.d.ts +0 -22
  79. package/dist/sync/git/git-exec.js +0 -56
  80. package/dist/sync/git/manager.d.ts +0 -28
  81. package/dist/sync/git/manager.js +0 -114
  82. package/dist/sync/git/planner.d.ts +0 -15
  83. package/dist/sync/git/planner.js +0 -46
  84. package/dist/sync/git/remote-url.d.ts +0 -3
  85. package/dist/sync/git/remote-url.js +0 -30
@@ -1,46 +0,0 @@
1
- import { expandPath } from '@agentage/memory-core';
2
- import { isSafeRemoteUrl, redactRemoteUrl } from './remote-url.js';
3
- // The unified schema stores interval as a bare non-negative integer; sync treats it as SECONDS
4
- // (there is no minutes marker in the schema, so seconds is the least-surprising reading and keeps
5
- // tests fast). 0 means manual-only (excluded from the daemon auto loop).
6
- export const DEFAULT_INTERVAL_SECONDS = 300;
7
- // When `ignore` is absent these editor/runtime files are excluded from sync; a set value REPLACES
8
- // the defaults, and an empty array syncs everything.
9
- export const DEFAULT_IGNORE = ['.obsidian/', 'data.json'];
10
- // The reserved account remote is a sentinel, not a URL: never synced over external git.
11
- const RESERVED_REMOTE = 'agentage';
12
- export const resolveIgnore = (ignore) => ignore === undefined ? [...DEFAULT_IGNORE] : ignore;
13
- export const intervalMs = (seconds) => Math.max(0, Math.floor(seconds)) * 1000;
14
- // One vault may carry several origins; each gets a distinct remote name within its own repo.
15
- const remoteNameFor = (index) => (index === 0 ? 'sync' : `sync-${index}`);
16
- // Flatten (vault, origin) pairs into sync targets. A target needs a local `path` (the working
17
- // copy to commit/push from) AND an external origin; origin-only entries (remote backends) and the
18
- // reserved account remote are skipped.
19
- export const syncTargets = (config) => {
20
- const out = [];
21
- for (const [vault, entry] of Object.entries(config.vaults ?? {})) {
22
- if (!entry.path || !entry.origin?.length)
23
- continue;
24
- entry.origin.forEach((origin, index) => {
25
- const remote = origin.remote.trim();
26
- if (!remote || remote === RESERVED_REMOTE)
27
- return;
28
- // One poisoned origin must not run code or kill the whole cycle: skip it with a warning.
29
- if (!isSafeRemoteUrl(remote)) {
30
- console.warn(`agentage: skipping unsafe remote for vault '${vault}': ${redactRemoteUrl(remote)}`);
31
- return;
32
- }
33
- out.push({
34
- vault,
35
- path: expandPath(entry.path),
36
- remoteName: remoteNameFor(index),
37
- remote,
38
- intervalSeconds: origin.interval ?? DEFAULT_INTERVAL_SECONDS,
39
- ignore: resolveIgnore(origin.ignore),
40
- });
41
- });
42
- }
43
- return out;
44
- };
45
- // The targets the daemon auto-loop schedules: interval 0 is manual-only and excluded.
46
- export const autoSyncTargets = (config) => syncTargets(config).filter((t) => t.intervalSeconds > 0);
@@ -1,3 +0,0 @@
1
- export declare const isSafeRemoteUrl: (remote: string) => boolean;
2
- export declare const assertSafeRemoteUrl: (remote: string) => void;
3
- export declare const redactRemoteUrl: (remote: string) => string;
@@ -1,30 +0,0 @@
1
- // Git treats a remote of the form `<helper>::<address>` as a transport helper (`ext::sh -c ...`,
2
- // `fd::...`) and runs it as a command on fetch/push - arbitrary code execution if a poisoned
3
- // vaults.json origin is auto-synced. Only conventional transports are allowed so no origin can
4
- // ever execute code. A leading `-` is also refused (git could read it as an option).
5
- // file:// and absolute local paths are safe transports too (a bare repo on disk/mount); unlike a
6
- // transport helper they cannot run an arbitrary command.
7
- const ALLOWED_SCHEMES = ['https://', 'ssh://', 'git://', 'file://'];
8
- // scp-like short syntax without a scheme: user@host:path.
9
- const SCP_LIKE = /^[^\s/@]+@[^\s/:]+:.+$/;
10
- export const isSafeRemoteUrl = (remote) => {
11
- const url = remote.trim();
12
- if (!url || url.startsWith('-'))
13
- return false;
14
- const lower = url.toLowerCase();
15
- if (ALLOWED_SCHEMES.some((s) => lower.startsWith(s)))
16
- return true;
17
- if (url.includes('::'))
18
- return false; // transport-helper syntax (ext::, fd::, <helper>::)
19
- if (url.startsWith('/'))
20
- return true; // absolute local path
21
- return SCP_LIKE.test(url);
22
- };
23
- export const assertSafeRemoteUrl = (remote) => {
24
- if (!isSafeRemoteUrl(remote))
25
- throw new Error(`unsafe git remote URL ${JSON.stringify(remote.trim())} ` +
26
- '(allowed: https://, ssh://, git://, file://, user@host:path, or an absolute local path)');
27
- };
28
- // Redact `user:password@host` credentials for display; the stored value is left untouched. A bare
29
- // `user@host` (scp-like, or scheme userinfo without a password) carries no secret and is kept.
30
- export const redactRemoteUrl = (remote) => remote.replace(/(:\/\/[^/@]+?):[^/@]+@/, '$1:***@');