@hasna/snapshots 0.1.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.
- package/LICENSE +130 -0
- package/README.md +90 -0
- package/dist/agent/index.d.ts +3 -0
- package/dist/agent/index.d.ts.map +1 -0
- package/dist/agent/index.js +12 -0
- package/dist/agent/index.js.map +1 -0
- package/dist/capture/index.d.ts +3 -0
- package/dist/capture/index.d.ts.map +1 -0
- package/dist/capture/index.js +267 -0
- package/dist/capture/index.js.map +1 -0
- package/dist/cli/index.d.ts +3 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +195 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -0
- package/dist/mcp/index.d.ts +3 -0
- package/dist/mcp/index.d.ts.map +1 -0
- package/dist/mcp/index.js +116 -0
- package/dist/mcp/index.js.map +1 -0
- package/dist/policy.d.ts +5 -0
- package/dist/policy.d.ts.map +1 -0
- package/dist/policy.js +38 -0
- package/dist/policy.js.map +1 -0
- package/dist/restore.d.ts +4 -0
- package/dist/restore.d.ts.map +1 -0
- package/dist/restore.js +157 -0
- package/dist/restore.js.map +1 -0
- package/dist/runtime.d.ts +38 -0
- package/dist/runtime.d.ts.map +1 -0
- package/dist/runtime.js +91 -0
- package/dist/runtime.js.map +1 -0
- package/dist/server/index.d.ts +3 -0
- package/dist/server/index.d.ts.map +1 -0
- package/dist/server/index.js +51 -0
- package/dist/server/index.js.map +1 -0
- package/dist/service.d.ts +16 -0
- package/dist/service.d.ts.map +1 -0
- package/dist/service.js +84 -0
- package/dist/service.js.map +1 -0
- package/dist/storage.d.ts +25 -0
- package/dist/storage.d.ts.map +1 -0
- package/dist/storage.js +215 -0
- package/dist/storage.js.map +1 -0
- package/dist/types.d.ts +90 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/dist/util.d.ts +26 -0
- package/dist/util.d.ts.map +1 -0
- package/dist/util.js +113 -0
- package/dist/util.js.map +1 -0
- package/package.json +78 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work.
|
|
38
|
+
|
|
39
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
40
|
+
form, that is based on the Work and for which the editorial revisions,
|
|
41
|
+
annotations, elaborations, or other modifications represent, as a
|
|
42
|
+
whole, an original work of authorship. For the purposes of this
|
|
43
|
+
License, Derivative Works shall not include works that remain
|
|
44
|
+
separable from, or merely link or bind by name to the interfaces of,
|
|
45
|
+
the Work and Derivative Works thereof.
|
|
46
|
+
|
|
47
|
+
"Contribution" shall mean any work of authorship, including the
|
|
48
|
+
original version of the Work and any modifications or additions to
|
|
49
|
+
that Work or Derivative Works thereof, that is intentionally submitted
|
|
50
|
+
to Licensor for inclusion in the Work by the copyright owner or by an
|
|
51
|
+
individual or Legal Entity authorized to submit on behalf of the
|
|
52
|
+
copyright owner. For the purposes of this definition, "submitted"
|
|
53
|
+
means any form of electronic, verbal, or written communication sent
|
|
54
|
+
to the Licensor or its representatives, including but not limited to
|
|
55
|
+
communication on electronic mailing lists, source code control
|
|
56
|
+
systems, and issue tracking systems that are managed by, or on behalf
|
|
57
|
+
of, the Licensor for the purpose of discussing and improving the Work,
|
|
58
|
+
but excluding communication that is conspicuously marked or otherwise
|
|
59
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
60
|
+
|
|
61
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
62
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
63
|
+
subsequently incorporated within the Work.
|
|
64
|
+
|
|
65
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
66
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
67
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
68
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
69
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
70
|
+
Work and such Derivative Works in Source or Object form.
|
|
71
|
+
|
|
72
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
73
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
74
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
75
|
+
patent license to make, have made, use, offer to sell, sell, import,
|
|
76
|
+
and otherwise transfer the Work.
|
|
77
|
+
|
|
78
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
79
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
80
|
+
modifications, and in Source or Object form, provided that You meet
|
|
81
|
+
the following conditions:
|
|
82
|
+
|
|
83
|
+
(a) You must give any other recipients of the Work or Derivative
|
|
84
|
+
Works a copy of this License; and
|
|
85
|
+
|
|
86
|
+
(b) You must cause any modified files to carry prominent notices
|
|
87
|
+
stating that You changed the files; and
|
|
88
|
+
|
|
89
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
90
|
+
that You distribute, all copyright, patent, trademark, and
|
|
91
|
+
attribution notices from the Source form of the Work, excluding
|
|
92
|
+
those notices that do not pertain to any part of the Derivative
|
|
93
|
+
Works; and
|
|
94
|
+
|
|
95
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
96
|
+
distribution, then any Derivative Works that You distribute must
|
|
97
|
+
include a readable copy of the attribution notices contained
|
|
98
|
+
within such NOTICE file.
|
|
99
|
+
|
|
100
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
101
|
+
any Contribution intentionally submitted for inclusion in the Work by
|
|
102
|
+
You to the Licensor shall be under the terms and conditions of this
|
|
103
|
+
License, without any additional terms or conditions.
|
|
104
|
+
|
|
105
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
106
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
107
|
+
except as required for reasonable and customary use in describing the
|
|
108
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
109
|
+
|
|
110
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
111
|
+
agreed to in writing, Licensor provides the Work on an "AS IS" BASIS,
|
|
112
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
113
|
+
implied, including, without limitation, any warranties or conditions
|
|
114
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
115
|
+
PARTICULAR PURPOSE.
|
|
116
|
+
|
|
117
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
118
|
+
whether in tort, contract, or otherwise, unless required by
|
|
119
|
+
applicable law, shall any Contributor be liable to You for damages,
|
|
120
|
+
including any direct, indirect, special, incidental, or consequential
|
|
121
|
+
damages arising as a result of this License or out of the use or
|
|
122
|
+
inability to use the Work.
|
|
123
|
+
|
|
124
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
125
|
+
the Work or Derivative Works thereof, You may choose to offer, and
|
|
126
|
+
charge a fee for, acceptance of support, warranty, indemnity, or
|
|
127
|
+
other liability obligations. However, in accepting such obligations,
|
|
128
|
+
You may act only on Your own behalf and on Your sole responsibility.
|
|
129
|
+
|
|
130
|
+
END OF TERMS AND CONDITIONS
|
package/README.md
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
# @hasna/snapshots
|
|
2
|
+
|
|
3
|
+
Runtime snapshot and restore layer for the local Hasna open-source developer environment.
|
|
4
|
+
|
|
5
|
+
`@hasna/snapshots` captures a point-in-time view of local runtime resources, stores it in SQLite, and can build guarded restore plans for the parts that are safe to recreate automatically.
|
|
6
|
+
|
|
7
|
+
## What It Captures
|
|
8
|
+
|
|
9
|
+
- machine identity and runtime context
|
|
10
|
+
- tmux sessions, windows, panes, and pane working directories
|
|
11
|
+
- Hasna project registry output when `projects list --json` is available
|
|
12
|
+
- local process summaries with secret-like arguments redacted
|
|
13
|
+
- session, browser, and desktop state when companion Hasna CLIs or state folders exist
|
|
14
|
+
- diagnostics for optional integrations that are absent or unavailable
|
|
15
|
+
|
|
16
|
+
Missing optional tools do not fail a snapshot. They become diagnostic resources so the snapshot still explains what was visible at capture time.
|
|
17
|
+
|
|
18
|
+
## Safety Model
|
|
19
|
+
|
|
20
|
+
Restore is dry-run by default.
|
|
21
|
+
|
|
22
|
+
The built-in restore allowlist is intentionally narrow:
|
|
23
|
+
|
|
24
|
+
- `project` resources can plan creation of missing project directories.
|
|
25
|
+
- `tmux-session` resources can plan detached tmux session creation.
|
|
26
|
+
- other resource kinds are observed and skipped unless future adapters explicitly support them.
|
|
27
|
+
|
|
28
|
+
Execution requires both `--apply` and `--yes`. Restore never kills existing sessions or overwrites existing service files. Existing project directories and tmux sessions become `noop` operations.
|
|
29
|
+
|
|
30
|
+
## Install
|
|
31
|
+
|
|
32
|
+
```sh
|
|
33
|
+
bun install
|
|
34
|
+
bun run build
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
The package stores data in `$HOME/.hasna/snapshots/snapshots.sqlite` by default. Override with:
|
|
38
|
+
|
|
39
|
+
```sh
|
|
40
|
+
HASNA_SNAPSHOTS_DIR=/path/to/data
|
|
41
|
+
HASNA_SNAPSHOTS_DB_PATH=/path/to/snapshots.sqlite
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## CLI
|
|
45
|
+
|
|
46
|
+
```sh
|
|
47
|
+
snapshots capture --name before-upgrade
|
|
48
|
+
snapshots list
|
|
49
|
+
snapshots show <snapshot-id>
|
|
50
|
+
snapshots resources --limit 50
|
|
51
|
+
snapshots plan <snapshot-id>
|
|
52
|
+
snapshots restore <snapshot-id> --apply --yes
|
|
53
|
+
snapshots policy list
|
|
54
|
+
snapshots policy set kind:process ignore --reason "processes are observe-only"
|
|
55
|
+
snapshots daemon once
|
|
56
|
+
snapshots daemon run --interval 300
|
|
57
|
+
snapshots service plan
|
|
58
|
+
snapshots service install --apply --yes
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
All commands emit JSON so agents can consume stable contracts.
|
|
62
|
+
|
|
63
|
+
## MCP
|
|
64
|
+
|
|
65
|
+
`snapshots-mcp` provides a minimal stdio JSON-RPC bridge with these tools:
|
|
66
|
+
|
|
67
|
+
- `capture_snapshot`
|
|
68
|
+
- `list_snapshots`
|
|
69
|
+
- `get_snapshot`
|
|
70
|
+
- `plan_restore`
|
|
71
|
+
|
|
72
|
+
## Local HTTP Server
|
|
73
|
+
|
|
74
|
+
```sh
|
|
75
|
+
snapshots-serve
|
|
76
|
+
curl http://localhost:7337/health
|
|
77
|
+
curl http://localhost:7337/snapshots
|
|
78
|
+
curl -X POST http://localhost:7337/snapshots -H 'content-type: application/json' -d '{"name":"manual"}'
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
## Release Verification
|
|
82
|
+
|
|
83
|
+
```sh
|
|
84
|
+
bun run typecheck
|
|
85
|
+
bun test
|
|
86
|
+
bun run build
|
|
87
|
+
bun run verify:release
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
Publishing still depends on normal external credentials for npm and GitHub.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/agent/index.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
#!/usr/bin/env bun
|
|
2
|
+
import { main } from "../cli/index.js";
|
|
3
|
+
if (import.meta.main) {
|
|
4
|
+
const args = process.argv.slice(2);
|
|
5
|
+
if (args.length === 0) {
|
|
6
|
+
await main(["daemon", "run"]);
|
|
7
|
+
}
|
|
8
|
+
else {
|
|
9
|
+
await main(["daemon", ...args]);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/agent/index.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAEvC,IAAI,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;IACrB,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IACnC,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACtB,MAAM,IAAI,CAAC,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC,CAAC;IAChC,CAAC;SAAM,CAAC;QACN,MAAM,IAAI,CAAC,CAAC,QAAQ,EAAE,GAAG,IAAI,CAAC,CAAC,CAAC;IAClC,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/capture/index.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAqB,cAAc,EAAE,aAAa,EAA2C,MAAM,aAAa,CAAC;AAG7H,wBAAsB,UAAU,CAAC,OAAO,GAAE,cAAmB,GAAG,OAAO,CAAC,aAAa,CAAC,CAuBrF"}
|
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
import { existsSync, readdirSync, statSync } from "node:fs";
|
|
2
|
+
import { join } from "node:path";
|
|
3
|
+
import { hostname, platform, release, userInfo } from "node:os";
|
|
4
|
+
import { commandExists, defaultDataDir, nowIso, redactJson, redactText, runCommand, runJsonCommand, sha256, slugPart } from "../util.js";
|
|
5
|
+
export async function captureAll(options = {}) {
|
|
6
|
+
const include = new Set(options.include ?? ["machine", "tmux", "projects", "processes", "sessions", "browser", "desktop"]);
|
|
7
|
+
const now = options.now ?? nowIso();
|
|
8
|
+
const result = { resources: [], diagnostics: [] };
|
|
9
|
+
const append = (capture) => {
|
|
10
|
+
result.resources.push(...capture.resources);
|
|
11
|
+
result.diagnostics.push(...capture.diagnostics);
|
|
12
|
+
};
|
|
13
|
+
if (include.has("machine"))
|
|
14
|
+
append(captureMachine(now, options.cwd));
|
|
15
|
+
if (include.has("tmux"))
|
|
16
|
+
append(captureTmux(now));
|
|
17
|
+
if (include.has("projects"))
|
|
18
|
+
append(captureProjects(now));
|
|
19
|
+
if (include.has("processes"))
|
|
20
|
+
append(captureProcesses(now));
|
|
21
|
+
if (include.has("sessions"))
|
|
22
|
+
append(captureSessions(now));
|
|
23
|
+
if (include.has("browser"))
|
|
24
|
+
append(captureBrowser(now));
|
|
25
|
+
if (include.has("desktop"))
|
|
26
|
+
append(captureDesktop(now));
|
|
27
|
+
for (const diagnostic of result.diagnostics) {
|
|
28
|
+
result.resources.push(diagnosticResource(diagnostic, now));
|
|
29
|
+
}
|
|
30
|
+
return result;
|
|
31
|
+
}
|
|
32
|
+
function captureMachine(now, cwd = process.cwd()) {
|
|
33
|
+
return {
|
|
34
|
+
resources: [
|
|
35
|
+
{
|
|
36
|
+
id: `machine:${process.env.HASNA_MACHINE_ID ?? sha256(hostname()).slice(0, 12)}`,
|
|
37
|
+
kind: "machine",
|
|
38
|
+
name: hostname(),
|
|
39
|
+
source: "machine",
|
|
40
|
+
attributes: {
|
|
41
|
+
hostname: hostname(),
|
|
42
|
+
platform: platform(),
|
|
43
|
+
release: release(),
|
|
44
|
+
user: userInfo().username,
|
|
45
|
+
cwd,
|
|
46
|
+
hasna_machine_id: process.env.HASNA_MACHINE_ID ?? null
|
|
47
|
+
},
|
|
48
|
+
observedAt: now
|
|
49
|
+
}
|
|
50
|
+
],
|
|
51
|
+
diagnostics: []
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
function captureTmux(now) {
|
|
55
|
+
if (!commandExists("tmux")) {
|
|
56
|
+
return diagnostic("tmux", "info", "tmux command not found; tmux resources were not captured.");
|
|
57
|
+
}
|
|
58
|
+
const sessions = runCommand("tmux", ["list-sessions", "-F", "#{session_id}\t#{session_name}\t#{session_created}\t#{session_windows}\t#{session_attached}"]);
|
|
59
|
+
if (!sessions.ok) {
|
|
60
|
+
return diagnostic("tmux", "info", "tmux server is not running or cannot be queried.", sessions.stderr.trim());
|
|
61
|
+
}
|
|
62
|
+
const resources = [];
|
|
63
|
+
for (const line of sessions.stdout.trim().split("\n").filter(Boolean)) {
|
|
64
|
+
const [sessionId, name, created, windows, attached] = line.split("\t");
|
|
65
|
+
const id = `tmux-session:${slugPart(name)}`;
|
|
66
|
+
resources.push({
|
|
67
|
+
id,
|
|
68
|
+
kind: "tmux-session",
|
|
69
|
+
name,
|
|
70
|
+
source: "tmux",
|
|
71
|
+
attributes: {
|
|
72
|
+
tmux_id: sessionId,
|
|
73
|
+
created: Number(created),
|
|
74
|
+
windows: Number(windows),
|
|
75
|
+
attached: attached === "1",
|
|
76
|
+
cwd: process.cwd()
|
|
77
|
+
},
|
|
78
|
+
observedAt: now
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
const panes = runCommand("tmux", [
|
|
82
|
+
"list-panes",
|
|
83
|
+
"-a",
|
|
84
|
+
"-F",
|
|
85
|
+
"#{session_name}\t#{window_index}\t#{window_name}\t#{pane_id}\t#{pane_current_path}\t#{pane_current_command}\t#{pane_active}"
|
|
86
|
+
]);
|
|
87
|
+
if (panes.ok) {
|
|
88
|
+
for (const line of panes.stdout.trim().split("\n").filter(Boolean)) {
|
|
89
|
+
const [sessionName, windowIndex, windowName, paneId, panePath, paneCommand, paneActive] = line.split("\t");
|
|
90
|
+
const sessionResourceId = `tmux-session:${slugPart(sessionName)}`;
|
|
91
|
+
const windowResourceId = `tmux-window:${slugPart(sessionName)}:${windowIndex}`;
|
|
92
|
+
if (!resources.some((resource) => resource.id === windowResourceId)) {
|
|
93
|
+
resources.push({
|
|
94
|
+
id: windowResourceId,
|
|
95
|
+
kind: "tmux-window",
|
|
96
|
+
name: `${sessionName}:${windowIndex}:${windowName}`,
|
|
97
|
+
source: "tmux",
|
|
98
|
+
parentId: sessionResourceId,
|
|
99
|
+
attributes: { session: sessionName, index: Number(windowIndex), name: windowName },
|
|
100
|
+
observedAt: now
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
resources.push({
|
|
104
|
+
id: `tmux-pane:${slugPart(sessionName)}:${paneId.replace("%", "")}`,
|
|
105
|
+
kind: "tmux-pane",
|
|
106
|
+
name: `${sessionName}:${paneId}`,
|
|
107
|
+
source: "tmux",
|
|
108
|
+
parentId: windowResourceId,
|
|
109
|
+
attributes: {
|
|
110
|
+
session: sessionName,
|
|
111
|
+
window_index: Number(windowIndex),
|
|
112
|
+
current_path: panePath,
|
|
113
|
+
current_command: paneCommand,
|
|
114
|
+
active: paneActive === "1"
|
|
115
|
+
},
|
|
116
|
+
observedAt: now
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
return { resources, diagnostics: [] };
|
|
121
|
+
}
|
|
122
|
+
function captureProjects(now) {
|
|
123
|
+
const json = commandExists("projects") ? runJsonCommand("projects", ["list", "--json"]) : undefined;
|
|
124
|
+
if (!json) {
|
|
125
|
+
return diagnostic("projects", "info", "projects CLI not found or did not return JSON.");
|
|
126
|
+
}
|
|
127
|
+
const rows = Array.isArray(json) ? json : Array.isArray(json.projects) ? json.projects : [];
|
|
128
|
+
const resources = rows
|
|
129
|
+
.filter((row) => Boolean(row && typeof row === "object" && !Array.isArray(row)))
|
|
130
|
+
.map((row) => {
|
|
131
|
+
const path = typeof row.path === "string" ? row.path : typeof row.primary_path === "string" ? row.primary_path : undefined;
|
|
132
|
+
const name = String(row.name ?? row.slug ?? path ?? "project");
|
|
133
|
+
const attributes = redactJson({ ...row, path: path ?? null });
|
|
134
|
+
return {
|
|
135
|
+
id: `project:${slugPart(String(row.id ?? row.slug ?? path ?? name))}`,
|
|
136
|
+
kind: "project",
|
|
137
|
+
name,
|
|
138
|
+
source: "projects",
|
|
139
|
+
attributes,
|
|
140
|
+
observedAt: now
|
|
141
|
+
};
|
|
142
|
+
});
|
|
143
|
+
return { resources, diagnostics: [] };
|
|
144
|
+
}
|
|
145
|
+
function captureProcesses(now) {
|
|
146
|
+
const ps = runCommand("ps", ["-axo", "pid=,ppid=,comm=,args="], 5_000);
|
|
147
|
+
if (!ps.ok)
|
|
148
|
+
return diagnostic("processes", "warning", "ps command failed.", ps.stderr.trim());
|
|
149
|
+
const resources = [];
|
|
150
|
+
for (const line of ps.stdout.split("\n").map((entry) => entry.trim()).filter(Boolean).slice(0, 250)) {
|
|
151
|
+
const match = line.match(/^(\d+)\s+(\d+)\s+(\S+)\s*(.*)$/);
|
|
152
|
+
if (!match)
|
|
153
|
+
continue;
|
|
154
|
+
const [, pid, ppid, command, args] = match;
|
|
155
|
+
resources.push({
|
|
156
|
+
id: `process:${pid}`,
|
|
157
|
+
kind: "process",
|
|
158
|
+
name: command,
|
|
159
|
+
source: "processes",
|
|
160
|
+
attributes: {
|
|
161
|
+
pid: Number(pid),
|
|
162
|
+
ppid: Number(ppid),
|
|
163
|
+
command,
|
|
164
|
+
args: redactText(args ?? "")
|
|
165
|
+
},
|
|
166
|
+
observedAt: now
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
return { resources, diagnostics: [] };
|
|
170
|
+
}
|
|
171
|
+
function captureSessions(now) {
|
|
172
|
+
const json = commandExists("sessions") ? runJsonCommand("sessions", ["list", "--json"]) : undefined;
|
|
173
|
+
if (!json)
|
|
174
|
+
return diagnostic("sessions", "info", "sessions CLI not found or did not return JSON.");
|
|
175
|
+
const rows = Array.isArray(json) ? json : Array.isArray(json.sessions) ? json.sessions : [];
|
|
176
|
+
const resources = rows
|
|
177
|
+
.filter((row) => Boolean(row && typeof row === "object" && !Array.isArray(row)))
|
|
178
|
+
.map((row) => ({
|
|
179
|
+
id: `session:${slugPart(String(row.id ?? row.session_id ?? row.path ?? JSON.stringify(row).slice(0, 80)))}`,
|
|
180
|
+
kind: "session",
|
|
181
|
+
name: String(row.name ?? row.title ?? row.id ?? "session"),
|
|
182
|
+
source: "sessions",
|
|
183
|
+
attributes: redactJson(row),
|
|
184
|
+
observedAt: now
|
|
185
|
+
}));
|
|
186
|
+
return { resources, diagnostics: [] };
|
|
187
|
+
}
|
|
188
|
+
function captureBrowser(now) {
|
|
189
|
+
const browserRoot = process.env.HASNA_BROWSER_DIR ?? join(defaultDataDir(), "..", "browser");
|
|
190
|
+
const dirs = ["states", "profiles", "persistent"].map((name) => join(browserRoot, name));
|
|
191
|
+
const resources = [];
|
|
192
|
+
for (const dir of dirs) {
|
|
193
|
+
if (!existsSync(dir))
|
|
194
|
+
continue;
|
|
195
|
+
for (const entry of safeReaddir(dir).slice(0, 100)) {
|
|
196
|
+
const path = join(dir, entry);
|
|
197
|
+
const stat = safeStat(path);
|
|
198
|
+
if (!stat)
|
|
199
|
+
continue;
|
|
200
|
+
resources.push({
|
|
201
|
+
id: `browser-state:${slugPart(path)}`,
|
|
202
|
+
kind: "browser-state",
|
|
203
|
+
name: entry,
|
|
204
|
+
source: "browser",
|
|
205
|
+
attributes: {
|
|
206
|
+
path,
|
|
207
|
+
bytes: stat.size,
|
|
208
|
+
directory: stat.isDirectory(),
|
|
209
|
+
modified_at: stat.mtime.toISOString()
|
|
210
|
+
},
|
|
211
|
+
observedAt: now
|
|
212
|
+
});
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
return { resources, diagnostics: resources.length ? [] : diagnostic("browser", "info", "No local browser state directory found.").diagnostics };
|
|
216
|
+
}
|
|
217
|
+
function captureDesktop(now) {
|
|
218
|
+
const json = commandExists("computer") ? runJsonCommand("computer", ["sessions", "--json"]) : undefined;
|
|
219
|
+
if (!json)
|
|
220
|
+
return diagnostic("desktop", "info", "computer CLI not found or did not return desktop session JSON.");
|
|
221
|
+
const rows = Array.isArray(json) ? json : Array.isArray(json.sessions) ? json.sessions : [];
|
|
222
|
+
const resources = rows
|
|
223
|
+
.filter((row) => Boolean(row && typeof row === "object" && !Array.isArray(row)))
|
|
224
|
+
.map((row) => ({
|
|
225
|
+
id: `desktop-window:${slugPart(String(row.id ?? row.window_id ?? JSON.stringify(row).slice(0, 80)))}`,
|
|
226
|
+
kind: "desktop-window",
|
|
227
|
+
name: String(row.title ?? row.app ?? row.id ?? "desktop-window"),
|
|
228
|
+
source: "desktop",
|
|
229
|
+
attributes: redactJson(row),
|
|
230
|
+
observedAt: now
|
|
231
|
+
}));
|
|
232
|
+
return { resources, diagnostics: [] };
|
|
233
|
+
}
|
|
234
|
+
function diagnostic(source, level, message, detail) {
|
|
235
|
+
return { resources: [], diagnostics: [{ source, level, message, detail }] };
|
|
236
|
+
}
|
|
237
|
+
function diagnosticResource(diagnostic, now) {
|
|
238
|
+
return {
|
|
239
|
+
id: `diagnostic:${slugPart(`${diagnostic.source}:${diagnostic.message}`)}`,
|
|
240
|
+
kind: "diagnostic",
|
|
241
|
+
name: `${diagnostic.source}: ${diagnostic.message}`,
|
|
242
|
+
source: diagnostic.source,
|
|
243
|
+
attributes: {
|
|
244
|
+
level: diagnostic.level,
|
|
245
|
+
message: diagnostic.message,
|
|
246
|
+
detail: diagnostic.detail ?? null
|
|
247
|
+
},
|
|
248
|
+
observedAt: now
|
|
249
|
+
};
|
|
250
|
+
}
|
|
251
|
+
function safeReaddir(path) {
|
|
252
|
+
try {
|
|
253
|
+
return readdirSync(path);
|
|
254
|
+
}
|
|
255
|
+
catch {
|
|
256
|
+
return [];
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
function safeStat(path) {
|
|
260
|
+
try {
|
|
261
|
+
return statSync(path);
|
|
262
|
+
}
|
|
263
|
+
catch {
|
|
264
|
+
return undefined;
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/capture/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC5D,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAEhE,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEzI,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,UAA0B,EAAE;IAC3D,MAAM,OAAO,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,OAAO,IAAI,CAAC,SAAS,EAAE,MAAM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