@cirtium/acent-connect 0.4.0 → 0.4.1
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/acent/.claude-plugin/plugin.json +1 -1
- package/acent/.codex-plugin/plugin.json +1 -1
- package/acent/.cursor-plugin/plugin.json +1 -1
- package/acent/scripts/encrypted-capture.mjs +38 -12
- package/acent/scripts/list-descriptor.mjs +62 -0
- package/antigravity/plugin.json +1 -1
- package/package.json +1 -1
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createCipheriv,
|
|
3
3
|
createHash,
|
|
4
|
+
createHmac,
|
|
4
5
|
generateKeyPair,
|
|
5
6
|
privateDecrypt,
|
|
6
7
|
randomBytes,
|
|
7
8
|
timingSafeEqual,
|
|
8
9
|
} from "node:crypto"
|
|
10
|
+
import { listFields } from "./list-descriptor.mjs"
|
|
9
11
|
import { promisify } from "node:util"
|
|
10
12
|
|
|
11
13
|
export async function createPairing() {
|
|
@@ -29,7 +31,7 @@ export async function createPairing() {
|
|
|
29
31
|
}
|
|
30
32
|
|
|
31
33
|
// Encode only host fields consumed by the conversation and activity readers.
|
|
32
|
-
const
|
|
34
|
+
const captureFields = [
|
|
33
35
|
"session_id",
|
|
34
36
|
"conversation_id",
|
|
35
37
|
"conversationId",
|
|
@@ -59,23 +61,47 @@ export function encryptCapture(event, credentials, source) {
|
|
|
59
61
|
if (key.length !== 32)
|
|
60
62
|
throw new Error("Encrypted capture requires a paired key.")
|
|
61
63
|
const payload = Object.fromEntries(
|
|
62
|
-
|
|
64
|
+
captureFields
|
|
63
65
|
.filter((field) => field in event)
|
|
64
66
|
.map((field) => [field, event[field]])
|
|
65
67
|
)
|
|
66
|
-
const
|
|
67
|
-
const
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
iv
|
|
72
|
-
cipher.
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
68
|
+
const grant = credentials.client_id
|
|
69
|
+
const at = Date.now()
|
|
70
|
+
const record = { source, project: credentials.project, at, payload }
|
|
71
|
+
function seal(scope, value) {
|
|
72
|
+
const iv = randomBytes(12)
|
|
73
|
+
const cipher = createCipheriv("aes-256-gcm", key, iv)
|
|
74
|
+
cipher.setAAD(Buffer.from("acent:external:v1:" + scope))
|
|
75
|
+
return Buffer.concat([
|
|
76
|
+
iv,
|
|
77
|
+
cipher.update(JSON.stringify(value)),
|
|
78
|
+
cipher.final(),
|
|
79
|
+
cipher.getAuthTag(),
|
|
80
|
+
])
|
|
81
|
+
}
|
|
82
|
+
const sealed = seal(grant, record)
|
|
83
|
+
const { sessionId, preview, ...fields } = listFields(record)
|
|
84
|
+
const id = createHash("sha256")
|
|
85
|
+
.update(JSON.stringify([grant, sessionId]))
|
|
86
|
+
.digest("hex")
|
|
87
|
+
const token = (value) => createHmac("sha256", key).update(value).digest("hex")
|
|
88
|
+
const session = token("session:" + id)
|
|
89
|
+
const descriptor = sessionId
|
|
90
|
+
? {
|
|
91
|
+
...fields,
|
|
92
|
+
at,
|
|
93
|
+
session,
|
|
94
|
+
project: token("project:" + preview.project),
|
|
95
|
+
preview: seal("list:v1:" + grant + ":" + session, {
|
|
96
|
+
...preview,
|
|
97
|
+
id: "encrypted:" + id,
|
|
98
|
+
}).toString("base64"),
|
|
99
|
+
}
|
|
100
|
+
: { skip: true }
|
|
76
101
|
return {
|
|
77
102
|
id: createHash("sha256").update(sealed).digest("hex"),
|
|
78
103
|
ciphertext: sealed.toString("base64"),
|
|
104
|
+
descriptor,
|
|
79
105
|
}
|
|
80
106
|
}
|
|
81
107
|
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
// Shared by new captures and the device that indexes older immutable records.
|
|
2
|
+
export function listFields(record) {
|
|
3
|
+
const event = record.payload ?? {}
|
|
4
|
+
const sessionId =
|
|
5
|
+
record.kind === "summary"
|
|
6
|
+
? record.sessionId
|
|
7
|
+
: record.source === "Cursor"
|
|
8
|
+
? event.conversation_id
|
|
9
|
+
: record.source === "Antigravity"
|
|
10
|
+
? event.conversationId ||
|
|
11
|
+
event.conversation_id ||
|
|
12
|
+
event.result?.conversation_id
|
|
13
|
+
: event.session_id
|
|
14
|
+
const result = record.result ?? {}
|
|
15
|
+
const first = event.messages?.find?.((m) => typeof m?.content === "string")
|
|
16
|
+
const message =
|
|
17
|
+
event.prompt ||
|
|
18
|
+
first?.content ||
|
|
19
|
+
event.message?.content ||
|
|
20
|
+
event.last_assistant_message ||
|
|
21
|
+
event.text ||
|
|
22
|
+
event.result?.response ||
|
|
23
|
+
event.response
|
|
24
|
+
const summary = record.kind === "summary"
|
|
25
|
+
const completed =
|
|
26
|
+
event.hook_event_name === "Stop" ||
|
|
27
|
+
event.hook_event_name === "afterAgentResponse" ||
|
|
28
|
+
event.event === "result" ||
|
|
29
|
+
event.messages?.at?.(-1)?.role === "assistant"
|
|
30
|
+
const project = typeof record.project === "string" ? record.project : ""
|
|
31
|
+
return {
|
|
32
|
+
sessionId: typeof sessionId === "string" ? sessionId.trim() : "",
|
|
33
|
+
type: summary
|
|
34
|
+
? "summary"
|
|
35
|
+
: typeof message === "string" && message.trim()
|
|
36
|
+
? "message"
|
|
37
|
+
: "event",
|
|
38
|
+
pending: summary
|
|
39
|
+
? !!record.more
|
|
40
|
+
: completed
|
|
41
|
+
? true
|
|
42
|
+
: message
|
|
43
|
+
? false
|
|
44
|
+
: undefined,
|
|
45
|
+
decision: !!result.decisions?.length,
|
|
46
|
+
learning: !!result.learnings?.length,
|
|
47
|
+
preview: {
|
|
48
|
+
title: String(
|
|
49
|
+
summary
|
|
50
|
+
? result.title || record.source
|
|
51
|
+
: (typeof message === "string" && message.trim()) ||
|
|
52
|
+
record.source ||
|
|
53
|
+
""
|
|
54
|
+
).slice(0, 100),
|
|
55
|
+
body: String(result.summary || "").slice(0, 220),
|
|
56
|
+
project,
|
|
57
|
+
source: record.source,
|
|
58
|
+
model: String(event.model || event.modelName || "").slice(0, 80),
|
|
59
|
+
summaryStatus: summary ? "Summarized" : "Original conversation",
|
|
60
|
+
},
|
|
61
|
+
}
|
|
62
|
+
}
|
package/antigravity/plugin.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"$schema": "https://antigravity.google/schemas/v1/plugin.json",
|
|
3
3
|
"name": "acent",
|
|
4
4
|
"displayName": "Acent",
|
|
5
|
-
"version": "0.4.
|
|
5
|
+
"version": "0.4.1",
|
|
6
6
|
"description": "Recall past work, trace code changes, revisit decisions, and resume tasks with Acent.",
|
|
7
7
|
"author": {
|
|
8
8
|
"name": "Cirtium"
|