opencode-pixel-office 1.0.11 → 1.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/bin/claude-code-hook.js +138 -39
- package/bin/opencode-pixel-office.js +275 -255
- package/client/dist/assets/{index-CocJhp5H.css → index-Bg5BmWlM.css} +1 -1
- package/client/dist/assets/{index-Cfnbdbzw.js → index-Dyzm-JqB.js} +28 -28
- package/client/dist/index.html +2 -2
- package/package.json +1 -1
- package/plugin/pixel-office.js +6 -22
- package/server/index.ts +4 -0
package/client/dist/index.html
CHANGED
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
6
6
|
<link rel="icon" type="image/png" href="/favicon.png" />
|
|
7
7
|
<title>OpenCode Pixel Office</title>
|
|
8
|
-
<script type="module" crossorigin src="/assets/index-
|
|
9
|
-
<link rel="stylesheet" crossorigin href="/assets/index-
|
|
8
|
+
<script type="module" crossorigin src="/assets/index-Dyzm-JqB.js"></script>
|
|
9
|
+
<link rel="stylesheet" crossorigin href="/assets/index-Bg5BmWlM.css">
|
|
10
10
|
</head>
|
|
11
11
|
<body>
|
|
12
12
|
<div id="root"></div>
|
package/package.json
CHANGED
package/plugin/pixel-office.js
CHANGED
|
@@ -22,22 +22,6 @@ const getConfiguredPort = () => {
|
|
|
22
22
|
return DEFAULT_PORT;
|
|
23
23
|
};
|
|
24
24
|
|
|
25
|
-
const readMode = () => {
|
|
26
|
-
try {
|
|
27
|
-
const configPath = path.join(globalDistDir, "config.json");
|
|
28
|
-
if (fs.existsSync(configPath)) {
|
|
29
|
-
const raw = fs.readFileSync(configPath, "utf8");
|
|
30
|
-
const data = JSON.parse(raw);
|
|
31
|
-
if (data && typeof data.mode === "string") {
|
|
32
|
-
return data.mode;
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
} catch {
|
|
36
|
-
return "opencode";
|
|
37
|
-
}
|
|
38
|
-
return "opencode";
|
|
39
|
-
};
|
|
40
|
-
|
|
41
25
|
const resolveEndpoint = () => {
|
|
42
26
|
const port = process.env.PIXEL_OFFICE_PORT || getConfiguredPort();
|
|
43
27
|
const raw = process.env.PIXEL_OFFICE_URL || `http://localhost:${port}/events`;
|
|
@@ -45,11 +29,6 @@ const resolveEndpoint = () => {
|
|
|
45
29
|
};
|
|
46
30
|
|
|
47
31
|
export const PixelOfficePlugin = async ({ directory, worktree, client }) => {
|
|
48
|
-
if (readMode() !== "opencode") {
|
|
49
|
-
// In claude-code mode, plugin does nothing - hooks handle events
|
|
50
|
-
return {};
|
|
51
|
-
}
|
|
52
|
-
|
|
53
32
|
const endpoint = resolveEndpoint();
|
|
54
33
|
|
|
55
34
|
return {
|
|
@@ -58,12 +37,17 @@ export const PixelOfficePlugin = async ({ directory, worktree, client }) => {
|
|
|
58
37
|
return;
|
|
59
38
|
}
|
|
60
39
|
try {
|
|
40
|
+
// Add source tag to identify this is from OpenCode
|
|
41
|
+
const taggedEvent = {
|
|
42
|
+
...event,
|
|
43
|
+
source: "opencode",
|
|
44
|
+
};
|
|
61
45
|
await fetch(endpoint, {
|
|
62
46
|
method: "POST",
|
|
63
47
|
headers: {
|
|
64
48
|
"Content-Type": "application/json",
|
|
65
49
|
},
|
|
66
|
-
body: JSON.stringify(
|
|
50
|
+
body: JSON.stringify(taggedEvent),
|
|
67
51
|
});
|
|
68
52
|
} catch {
|
|
69
53
|
// Server not running, silently ignore
|
package/server/index.ts
CHANGED
|
@@ -72,6 +72,7 @@ type OfficeState = {
|
|
|
72
72
|
|
|
73
73
|
type EventPayload = {
|
|
74
74
|
type?: string;
|
|
75
|
+
source?: "opencode" | "claude";
|
|
75
76
|
properties?: Record<string, any>;
|
|
76
77
|
};
|
|
77
78
|
|
|
@@ -711,6 +712,7 @@ const upsertAgentFromEvent = (event: EventPayload) => {
|
|
|
711
712
|
const sessionTitle = extractSessionTitle(event);
|
|
712
713
|
const updatedAt = Date.now();
|
|
713
714
|
const eventType = getEventType(event);
|
|
715
|
+
const eventSource = event?.source || "opencode";
|
|
714
716
|
const isPartUpdate = eventType === "message.part.updated";
|
|
715
717
|
const messageId = isPartUpdate
|
|
716
718
|
? safeString(part.messageID ?? "", "")
|
|
@@ -777,6 +779,7 @@ const upsertAgentFromEvent = (event: EventPayload) => {
|
|
|
777
779
|
sessionTitle: nextSessionTitle,
|
|
778
780
|
isBackground: nextIsBackground,
|
|
779
781
|
status: nextStatus,
|
|
782
|
+
source: existing.source || eventSource,
|
|
780
783
|
lastEventType: event?.type || existing.lastEventType,
|
|
781
784
|
lastMessageSnippet: trimmedSnippet,
|
|
782
785
|
lastMessageAt: nextMessageAt,
|
|
@@ -800,6 +803,7 @@ const upsertAgentFromEvent = (event: EventPayload) => {
|
|
|
800
803
|
sessionTitle: nextSessionTitle,
|
|
801
804
|
isBackground: nextIsBackground,
|
|
802
805
|
status,
|
|
806
|
+
source: eventSource,
|
|
803
807
|
lastEventType: event?.type || "unknown",
|
|
804
808
|
lastMessageSnippet: trimmedSnippet,
|
|
805
809
|
lastMessageAt: hasMessageUpdate ? Date.now() : 0,
|