aegiscode 7.0.25 → 7.0.26
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/package.json +7 -3
- package/scripts/check.mjs +52 -1
- package/scripts/demo.mjs +94 -1
- package/scripts/predist.mjs +75 -1
- package/scripts/runtests.mjs +56 -1
- package/scripts/seal-gate.mjs +74 -1
- package/src/agents.js +139 -1
- package/src/app.js +2957 -1
- package/src/art.js +289 -1
- package/src/chatflow.js +3023 -1
- package/src/checkpoint.js +90 -1
- package/src/clipboard.js +424 -1
- package/src/cloudsync.js +528 -1
- package/src/commands.js +4089 -1
- package/src/config.js +581 -1
- package/src/connect.js +349 -1
- package/src/credentials.js +33 -1
- package/src/deps.js +232 -1
- package/src/devrun.js +187 -1
- package/src/diff.js +333 -1
- package/src/diffview.js +296 -1
- package/src/engine.js +297 -1
- package/src/entitlement.js +355 -1
- package/src/events.js +707 -1
- package/src/export.js +67 -1
- package/src/filepreview.js +153 -1
- package/src/fingerprint.js +592 -1
- package/src/format.js +259 -1
- package/src/fuzzy.js +119 -1
- package/src/history.js +423 -1
- package/src/init.js +175 -1
- package/src/input.js +139 -1
- package/src/keys.js +183 -1
- package/src/markdown.js +306 -1
- package/src/models.js +507 -1
- package/src/naming.js +57 -1
- package/src/overlays.js +462 -1
- package/src/panels.js +1418 -1
- package/src/ping.js +226 -1
- package/src/presence.js +238 -1
- package/src/render.js +516 -1
- package/src/screen.js +518 -1
- package/src/screens.js +896 -1
- package/src/secret.js +59 -1
- package/src/securefs.js +359 -1
- package/src/settings.js +155 -1
- package/src/shared.js +52 -1
- package/src/sharedpaths.js +53 -1
- package/src/signup.js +156 -1
- package/src/summarize.js +95 -1
- package/src/sysdiag.js +585 -1
- package/src/system.js +40 -1
- package/src/theme.js +570 -1
- package/src/title.js +220 -1
- package/src/todos.js +115 -1
- package/src/tokens.js +263 -1
- package/src/topup.js +210 -1
- package/src/update.js +191 -1
- package/vendor/client/aegis.js +2441 -1
- package/vendor/client/attest.js +518 -1
- package/vendor/client/authorship-key.js +410 -1
- package/vendor/client/auto-provision.js +134 -1
- package/vendor/client/brain-catalog.js +268 -1
- package/vendor/client/byok-catalog.js +199 -1
- package/vendor/client/catalog-client.js +487 -1
- package/vendor/client/conversation-export.js +177 -1
- package/vendor/client/credentials.js +494 -1
- package/vendor/client/device-fingerprint.js +141 -1
- package/vendor/client/drive-connect.js +110 -1
- package/vendor/client/drive-upload.js +234 -1
- package/vendor/client/env-file.js +1273 -1
- package/vendor/client/fingerprint.js +1064 -1
- package/vendor/client/foreign-memory.js +669 -1
- package/vendor/client/google-signin.js +133 -1
- package/vendor/client/hooks.js +430 -1
- package/vendor/client/model-discovery.js +373 -1
- package/vendor/client/naming.js +283 -1
- package/vendor/client/platform.js +937 -1
- package/vendor/client/prefs.js +351 -1
- package/vendor/client/presence-constants.js +107 -1
- package/vendor/client/presence.js +438 -1
- package/vendor/client/record-vault.js +1055 -3
- package/vendor/client/session-store.js +575 -1
- package/vendor/client/topup.js +297 -1
- package/vendor/client/touch.js +458 -1
- package/vendor/client/update.js +763 -1
- package/vendor/client/user-models.js +381 -1
- package/vendor/desktop/lib/local/agents.js +105 -1
- package/vendor/desktop/lib/local/attachments.js +276 -1
- package/vendor/desktop/lib/local/autonomous.js +1045 -1
- package/vendor/desktop/lib/local/claude-pro.js +1028 -1
- package/vendor/desktop/lib/local/context.js +125 -1
- package/vendor/desktop/lib/local/engine.js +3666 -1
- package/vendor/desktop/lib/local/entitlement.js +660 -1
- package/vendor/desktop/lib/local/git-scope.js +228 -1
- package/vendor/desktop/lib/local/local.js +2145 -1
- package/vendor/desktop/lib/local/prompt.js +280 -1
- package/vendor/desktop/lib/local/queue.js +560 -1
- package/vendor/desktop/lib/local/session-rounds.js +238 -1
- package/vendor/desktop/lib/local/spill.js +75 -1
- package/vendor/desktop/lib/local/turn-guard.js +300 -1
- package/vendor/desktop/lib/local/worktree-lock.js +235 -1
- package/vendor/desktop/lib/settings.js +890 -1
- package/vendor/desktop/renderer/usage.js +1239 -1
- package/vendor/hosts/install.js +638 -1
- package/vendor/hosts/openai-shim.js +515 -1
- package/vendor/hosts/spec.js +164 -1
- package/vendor/hosts/targets.js +346 -1
- package/vendor/mcp/server.js +221 -1
- package/vendor/mcp/tools.js +408 -1
- package/vendor/one/src/child.js +285 -1
- package/vendor/one/src/permissions.js +383 -1
- package/SOURCE-OFFER.txt +0 -9
package/src/export.js
CHANGED
|
@@ -1,3 +1,69 @@
|
|
|
1
1
|
// SPDX-License-Identifier: AGPL-3.0-or-later
|
|
2
2
|
// Copyright (C) 2026 Niklas Borneklint — AEGIS Code (aegiscode) / Aegiscloud.
|
|
3
|
-
|
|
3
|
+
// AEGIS Code (aegiscode) — source: https://github.com/aegisinfo/aegiscode-plugin
|
|
4
|
+
// Conveying a modified copy, or running one as a network service, owes the
|
|
5
|
+
// corresponding source under this licence (§5/§13) — see LICENSING.md.
|
|
6
|
+
'use strict';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Transcript → markdown/json export for /export, and the last-response
|
|
10
|
+
* extraction for /copy. Exports are written to the current directory (or the
|
|
11
|
+
* clipboard) and the resulting path is reported in the transcript.
|
|
12
|
+
*
|
|
13
|
+
* Ported from the upstream engine reference (ESM → CommonJS). Output strings
|
|
14
|
+
* (the # Aegiscodex session header, the ## Claude / ## User role headers, the
|
|
15
|
+
* aegiscodex-export- filename) are kept as in the reference.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
const fs = require('node:fs');
|
|
19
|
+
const path = require('node:path');
|
|
20
|
+
|
|
21
|
+
/** Render the transcript as a markdown document. */
|
|
22
|
+
function transcriptToMarkdown(transcript) {
|
|
23
|
+
const lines = ['# Aegiscodex session', '', `> exported ${new Date().toISOString()}`, ''];
|
|
24
|
+
for (const m of transcript) {
|
|
25
|
+
const text = (m.text || '').replace(/\n{3,}/g, '\n\n').trim();
|
|
26
|
+
if (m.role === 'user') lines.push(`## User\n\n${text || '_(empty)_'}`, '');
|
|
27
|
+
else if (m.role === 'assistant') lines.push(`## Claude\n\n${text || '_(empty)_'}`, '');
|
|
28
|
+
else if (m.role === 'note') lines.push(`> ${text}`, '');
|
|
29
|
+
}
|
|
30
|
+
return lines.join('\n');
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/** Render the transcript as a JSON document (array of messages). */
|
|
34
|
+
function transcriptToJSON(transcript) {
|
|
35
|
+
const clean = transcript.map((m) => ({
|
|
36
|
+
role: m.role,
|
|
37
|
+
text: m.text || '',
|
|
38
|
+
...(m.tool ? { tool: m.tool } : {}),
|
|
39
|
+
}));
|
|
40
|
+
return JSON.stringify(clean, null, 2);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Write exported text to a file. target: absolute path, 'clipboard' handled by
|
|
45
|
+
* the caller (clipboard.js) — here we only do files.
|
|
46
|
+
* Returns the absolute path written.
|
|
47
|
+
*/
|
|
48
|
+
function writeExportFile(text, format, cwd = process.cwd()) {
|
|
49
|
+
const ext = format === 'json' ? 'json' : 'md';
|
|
50
|
+
const ts = new Date().toISOString().replace(/[:.]/g, '-').slice(0, 19);
|
|
51
|
+
const name = `aegiscodex-export-${ts}.${ext}`;
|
|
52
|
+
const p = path.join(cwd, name);
|
|
53
|
+
fs.writeFileSync(p, text, 'utf8');
|
|
54
|
+
return p;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/** The most recent assistant response (last N when given a count). */
|
|
58
|
+
function lastAssistantText(transcript, count = 1) {
|
|
59
|
+
const asst = transcript.filter((m) => m.role === 'assistant');
|
|
60
|
+
const n = Math.max(1, Math.min(count, asst.length));
|
|
61
|
+
return asst.slice(asst.length - n).map((m) => m.text || '').join('\n\n');
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
module.exports = {
|
|
65
|
+
transcriptToMarkdown,
|
|
66
|
+
transcriptToJSON,
|
|
67
|
+
writeExportFile,
|
|
68
|
+
lastAssistantText,
|
|
69
|
+
};
|
package/src/filepreview.js
CHANGED
|
@@ -1,3 +1,155 @@
|
|
|
1
1
|
// SPDX-License-Identifier: AGPL-3.0-or-later
|
|
2
2
|
// Copyright (C) 2026 Niklas Borneklint — AEGIS Code (aegiscode) / Aegiscloud.
|
|
3
|
-
|
|
3
|
+
// AEGIS Code (aegiscode) — source: https://github.com/aegisinfo/aegiscode-plugin
|
|
4
|
+
// Conveying a modified copy, or running one as a network service, owes the
|
|
5
|
+
// corresponding source under this licence (§5/§13) — see LICENSING.md.
|
|
6
|
+
'use strict';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* File preview cards for Write/Edit operations.
|
|
10
|
+
*
|
|
11
|
+
* Shows the first N lines of a file with syntax highlighting, line numbers,
|
|
12
|
+
* and a "View Full" note. For writes, shows the new file content; for edits,
|
|
13
|
+
* shows the after state.
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
const path = require('node:path');
|
|
17
|
+
|
|
18
|
+
// Max lines to show in preview (collapsed)
|
|
19
|
+
const PREVIEW_LINES = 8;
|
|
20
|
+
const PREVIEW_LINES_EXPANDED = 30;
|
|
21
|
+
|
|
22
|
+
/** Language detection by file extension */
|
|
23
|
+
const LANGUAGE_BY_EXT = {
|
|
24
|
+
'.js': 'javascript',
|
|
25
|
+
'.ts': 'typescript',
|
|
26
|
+
'.tsx': 'typescript',
|
|
27
|
+
'.jsx': 'javascript',
|
|
28
|
+
'.py': 'python',
|
|
29
|
+
'.rb': 'ruby',
|
|
30
|
+
'.go': 'go',
|
|
31
|
+
'.rs': 'rust',
|
|
32
|
+
'.java': 'java',
|
|
33
|
+
'.c': 'c',
|
|
34
|
+
'.cpp': 'cpp',
|
|
35
|
+
'.h': 'c',
|
|
36
|
+
'.hpp': 'cpp',
|
|
37
|
+
'.cs': 'csharp',
|
|
38
|
+
'.php': 'php',
|
|
39
|
+
'.html': 'html',
|
|
40
|
+
'.htm': 'html',
|
|
41
|
+
'.css': 'css',
|
|
42
|
+
'.scss': 'scss',
|
|
43
|
+
'.json': 'json',
|
|
44
|
+
'.yaml': 'yaml',
|
|
45
|
+
'.yml': 'yaml',
|
|
46
|
+
'.xml': 'xml',
|
|
47
|
+
'.md': 'markdown',
|
|
48
|
+
'.sh': 'bash',
|
|
49
|
+
'.bash': 'bash',
|
|
50
|
+
'.sql': 'sql',
|
|
51
|
+
'.lua': 'lua',
|
|
52
|
+
'.swift': 'swift',
|
|
53
|
+
'.kt': 'kotlin',
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Extract file preview from content.
|
|
58
|
+
* @param {string} file File path
|
|
59
|
+
* @param {string} content File content
|
|
60
|
+
* @param {number} [maxLines] Max lines to show (defaults to PREVIEW_LINES)
|
|
61
|
+
* @returns {{file: string, language: string, lines: Array<string>, totalLines: number, truncated: boolean}}
|
|
62
|
+
*/
|
|
63
|
+
function extractPreview(file, content, maxLines = PREVIEW_LINES) {
|
|
64
|
+
if (!file || typeof content !== 'string') return null;
|
|
65
|
+
|
|
66
|
+
const ext = path.extname(file).toLowerCase();
|
|
67
|
+
const language = LANGUAGE_BY_EXT[ext] || '';
|
|
68
|
+
|
|
69
|
+
const allLines = content.split('\n');
|
|
70
|
+
const truncated = allLines.length > maxLines;
|
|
71
|
+
const previewLines = allLines.slice(0, maxLines);
|
|
72
|
+
|
|
73
|
+
return {
|
|
74
|
+
file,
|
|
75
|
+
language,
|
|
76
|
+
lines: previewLines,
|
|
77
|
+
totalLines: allLines.length,
|
|
78
|
+
truncated,
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Render a file preview card with syntax highlighting and line numbers.
|
|
84
|
+
* @param {object} preview Preview object from extractPreview()
|
|
85
|
+
* @param {object} ctx Render context with theme
|
|
86
|
+
* @param {number} [width] Terminal width
|
|
87
|
+
* @returns {Array<string>} ANSI-colored lines
|
|
88
|
+
*/
|
|
89
|
+
function renderFilePreview(preview, ctx, width = 80) {
|
|
90
|
+
if (!preview) return [];
|
|
91
|
+
|
|
92
|
+
const { RESET, BOLD, DIM } = require('./theme.js');
|
|
93
|
+
const t = require('./theme.js').themeOf(ctx);
|
|
94
|
+
const { clip } = require('./screen.js');
|
|
95
|
+
|
|
96
|
+
const lines = [];
|
|
97
|
+
const shortPath = clip(preview.file, Math.max(20, width - 20));
|
|
98
|
+
const header = `${BOLD}${shortPath}${RESET} ${DIM}(${preview.totalLines} line${preview.totalLines === 1 ? '' : 's'})${RESET}`;
|
|
99
|
+
|
|
100
|
+
// Header line
|
|
101
|
+
lines.push(` ${t.gold}┌─ ${header}`);
|
|
102
|
+
|
|
103
|
+
// Content lines with line numbers
|
|
104
|
+
const gutterWidth = String(preview.totalLines).length;
|
|
105
|
+
for (let i = 0; i < preview.lines.length; i++) {
|
|
106
|
+
const lineNo = i + 1;
|
|
107
|
+
const gutterStr = String(lineNo).padStart(gutterWidth, ' ');
|
|
108
|
+
const text = preview.lines[i] || '';
|
|
109
|
+
const displayText = clip(text, Math.max(8, width - gutterWidth - 10));
|
|
110
|
+
|
|
111
|
+
const gutterFmt = `${t.gray}${gutterStr}${RESET} ${DIM}│${RESET}`;
|
|
112
|
+
lines.push(` ${gutterFmt} ${displayText}`);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
// Footer with "View Full" note
|
|
116
|
+
if (preview.truncated) {
|
|
117
|
+
const remaining = preview.totalLines - preview.lines.length;
|
|
118
|
+
const note = `${remaining} more line${remaining === 1 ? '' : 's'} — press 'v' to view full`;
|
|
119
|
+
lines.push(` ${t.gray}└─ ${DIM}${note}${RESET}`);
|
|
120
|
+
} else {
|
|
121
|
+
lines.push(` ${t.gray}└─${RESET}`);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
return lines;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* Extract new file content from Write/Edit args.
|
|
129
|
+
* @param {string} toolName Tool name (writeFile/editFile/Write/Edit)
|
|
130
|
+
* @param {object} args Tool arguments
|
|
131
|
+
* @returns {string|null} The new file content, or null
|
|
132
|
+
*/
|
|
133
|
+
function extractNewContent(toolName, args) {
|
|
134
|
+
if (!args || typeof args !== 'object') return null;
|
|
135
|
+
|
|
136
|
+
if (toolName === 'Write' || toolName === 'writeFile') {
|
|
137
|
+
return args.content;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
if (toolName === 'Edit' || toolName === 'editFile') {
|
|
141
|
+
// For edits, we'd need the full file to show after state
|
|
142
|
+
// For now, return null to keep showing the diff
|
|
143
|
+
return null;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
return null;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
module.exports = {
|
|
150
|
+
extractPreview,
|
|
151
|
+
renderFilePreview,
|
|
152
|
+
extractNewContent,
|
|
153
|
+
PREVIEW_LINES,
|
|
154
|
+
PREVIEW_LINES_EXPANDED,
|
|
155
|
+
};
|