opencode-kiro 0.1.2 → 0.1.3
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/dist/server.d.ts +1 -1
- package/dist/server.js +18 -24
- package/package.json +2 -2
package/dist/server.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ declare function readToken(tokenPath: string | undefined): Promise<{
|
|
|
9
9
|
} | {
|
|
10
10
|
type: "failed";
|
|
11
11
|
}>;
|
|
12
|
-
declare function notifyIfTokenExpired(client: PluginInput["client"] | undefined
|
|
12
|
+
declare function notifyIfTokenExpired(client: PluginInput["client"] | undefined): Promise<void>;
|
|
13
13
|
declare const KiroAuthPlugin: Plugin;
|
|
14
14
|
declare const _default: {
|
|
15
15
|
id: string;
|
package/dist/server.js
CHANGED
|
@@ -4,7 +4,7 @@ import { dirname, join } from "path";
|
|
|
4
4
|
var KIRO_PLUGIN_NAME = "opencode-kiro";
|
|
5
5
|
var SIDEBAR_PLUGIN_ID = "internal:sidebar-context";
|
|
6
6
|
var server = async (input) => {
|
|
7
|
-
await notifyIfTokenExpired(input.client
|
|
7
|
+
await notifyIfTokenExpired(input.client);
|
|
8
8
|
const tuiPath = tuiConfigPath();
|
|
9
9
|
const alreadyConfigured = isSidebarConfigured(await readTuiConfig(tuiPath));
|
|
10
10
|
const prompts = alreadyConfigured ? [] : [
|
|
@@ -62,7 +62,9 @@ var server = async (input) => {
|
|
|
62
62
|
};
|
|
63
63
|
}
|
|
64
64
|
const { execFile } = await import("child_process");
|
|
65
|
-
const child = execFile("kiro-cli", ["login"]
|
|
65
|
+
const child = execFile("kiro-cli", ["login"], {
|
|
66
|
+
shell: process.platform === "win32"
|
|
67
|
+
});
|
|
66
68
|
return {
|
|
67
69
|
url: "",
|
|
68
70
|
instructions: "Complete Kiro authentication in the browser window that just opened. Waiting for login...",
|
|
@@ -104,36 +106,28 @@ async function readKiroTokenFile(tokenPath) {
|
|
|
104
106
|
return void 0;
|
|
105
107
|
}
|
|
106
108
|
}
|
|
107
|
-
function tokenExpiresAtMs(token) {
|
|
108
|
-
const raw = token?.expiresAt;
|
|
109
|
-
if (typeof raw === "number") return raw;
|
|
110
|
-
if (typeof raw === "string") return Date.parse(raw);
|
|
111
|
-
return NaN;
|
|
112
|
-
}
|
|
113
109
|
async function readToken(tokenPath) {
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
const
|
|
118
|
-
|
|
119
|
-
return { type: "failed" };
|
|
120
|
-
}
|
|
121
|
-
const access = typeof token.accessToken === "string" ? token.accessToken : "";
|
|
122
|
-
const refresh = typeof token.refreshToken === "string" ? token.refreshToken : "";
|
|
110
|
+
const { verifyAuth } = await import("kiro-acp-ai-provider");
|
|
111
|
+
if (!verifyAuth().authenticated) return { type: "failed" };
|
|
112
|
+
const token = tokenPath ? await readKiroTokenFile(tokenPath) : void 0;
|
|
113
|
+
const access = typeof token?.accessToken === "string" ? token.accessToken : "";
|
|
114
|
+
const refresh = typeof token?.refreshToken === "string" ? token.refreshToken : "";
|
|
123
115
|
return {
|
|
124
116
|
type: "success",
|
|
125
117
|
refresh,
|
|
126
|
-
//
|
|
118
|
+
// real refresh when present, else ""
|
|
127
119
|
access: access || "authenticated",
|
|
128
|
-
|
|
120
|
+
// cosmetic; opencode-core only needs presence
|
|
121
|
+
// FUTURE expiry, refreshed every startup (server() re-runs each session) so
|
|
122
|
+
// opencode-core does not flag a logged-in user as expired. NOT the file value.
|
|
123
|
+
expires: Date.now() + 8 * 60 * 60 * 1e3
|
|
129
124
|
};
|
|
130
125
|
}
|
|
131
|
-
async function notifyIfTokenExpired(client
|
|
126
|
+
async function notifyIfTokenExpired(client) {
|
|
132
127
|
try {
|
|
133
|
-
const
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
const message = "Kiro token expired or missing. Run 'kiro-cli login' to re-authenticate.";
|
|
128
|
+
const { verifyAuth } = await import("kiro-acp-ai-provider");
|
|
129
|
+
if (verifyAuth().authenticated) return;
|
|
130
|
+
const message = "Kiro is not logged in. Run 'kiro-cli login' to authenticate.";
|
|
137
131
|
console.warn(message);
|
|
138
132
|
void client?.tui?.showToast?.({ body: { message, variant: "warning" } })?.catch(() => {
|
|
139
133
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opencode-kiro",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"description": "The ACP-compliant Kiro plugin for opencode: auth via the official kiro-cli login, 12 Kiro models through the Agent Client Protocol, and TUI credits display",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Nacho F. Lizaur (https://github.com/NachoFLizaur)",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"@opencode-ai/plugin": "*"
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"kiro-acp-ai-provider": "^2.0.
|
|
45
|
+
"kiro-acp-ai-provider": "^2.0.2"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
48
|
"@opencode-ai/plugin": "1.16.2",
|