approval-box 0.1.6 → 0.1.8
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/cli.mjs +31 -6
- package/package.json +1 -1
package/dist/cli.mjs
CHANGED
|
@@ -11795,7 +11795,15 @@ var Api = class {
|
|
|
11795
11795
|
throw new ServerError(0, "network", `Approval Box\u30B5\u30FC\u30D0\u30FC\uFF08${this.server}\uFF09\u306B\u3064\u306A\u304C\u308A\u307E\u305B\u3093: ${error.message}`, {});
|
|
11796
11796
|
}
|
|
11797
11797
|
const text2 = await response.text();
|
|
11798
|
-
|
|
11798
|
+
let json;
|
|
11799
|
+
try {
|
|
11800
|
+
json = text2 ? JSON.parse(text2) : {};
|
|
11801
|
+
} catch {
|
|
11802
|
+
const contentType = response.headers.get("content-type") ?? "";
|
|
11803
|
+
const head = `Approval Box\u30B5\u30FC\u30D0\u30FC\u304B\u3089\u3001JSON\u3067\u306A\u3044\u5FDC\u7B54\u304C\u8FD4\u308A\u307E\u3057\u305F\uFF08HTTP ${response.status}\u3001Content-Type: ${contentType || "\u306A\u3057"}\uFF09\u3002\u524D\u6BB5\uFF08Cloudflare\u306A\u3069\uFF09\u306E\u30A8\u30E9\u30FC\u30DA\u30FC\u30B8\u3067\u3001\u30B5\u30FC\u30D0\u30FC\u304C\u4E00\u6642\u7684\u306B\u6B62\u307E\u3063\u3066\u3044\u305F\u53EF\u80FD\u6027\u304C\u3042\u308A\u307E\u3059\u3002`;
|
|
11804
|
+
const tail = method === "GET" ? "\u5C11\u3057\u5F85\u3063\u3066\u304B\u3089\u3001\u540C\u3058\u64CD\u4F5C\u3092\u3084\u308A\u76F4\u3057\u3066\u304F\u3060\u3055\u3044\u3002" : "\u3053\u306E\u64CD\u4F5C\u304C\u30B5\u30FC\u30D0\u30FC\u3067\u884C\u308F\u308C\u305F\u304B\u306F\u5206\u304B\u308A\u307E\u305B\u3093\u3002\u3084\u308A\u76F4\u3059\u524D\u306B list_my_decisions \u3067\u78BA\u304B\u3081\u3066\u304F\u3060\u3055\u3044\u3002\u7533\u8ACB\u306A\u3089\u3001\u4E00\u89A7\u306B\u7121\u3051\u308C\u3070\u51FA\u3057\u76F4\u3057\u3001\u3042\u308C\u3070\u305D\u308C\u3092\u4F7F\u3063\u3066\u304F\u3060\u3055\u3044\u3002";
|
|
11805
|
+
throw new ServerError(response.status, "non_json_response", `${head}${tail}`, { http_status: response.status, content_type: contentType, outcome: method === "GET" ? "not_applied" : "unknown" });
|
|
11806
|
+
}
|
|
11799
11807
|
if (!response.ok) {
|
|
11800
11808
|
const error = json.error ?? {};
|
|
11801
11809
|
throw new ServerError(response.status, error.code ?? "internal", error.message ?? `HTTP ${response.status}`, error);
|
|
@@ -15641,7 +15649,7 @@ import { existsSync as existsSync5, readFileSync as readFileSync5 } from "node:f
|
|
|
15641
15649
|
import { basename as basename2, join as join5 } from "node:path";
|
|
15642
15650
|
|
|
15643
15651
|
// src/version.ts
|
|
15644
|
-
var VERSION = true ? "0.1.
|
|
15652
|
+
var VERSION = true ? "0.1.8" : "0.0.0-dev";
|
|
15645
15653
|
function osName() {
|
|
15646
15654
|
return process.platform === "darwin" ? "macos" : process.platform === "win32" ? "windows" : process.platform;
|
|
15647
15655
|
}
|
|
@@ -15658,7 +15666,7 @@ function harnessOf(clientName) {
|
|
|
15658
15666
|
}
|
|
15659
15667
|
var INSTRUCTIONS = [
|
|
15660
15668
|
"Approval Box\u306F\u3001\u5229\u7528\u8005\uFF08\u4EBA\u9593\uFF09\u306E\u5224\u65AD\u30FB\u627F\u8A8D\u30FB\u64CD\u4F5C\u304C\u8981\u308B\u6642\u306B\u4F7F\u3046\u3002URL\u3092\u958B\u3044\u3066\u306E\u627F\u8A8D\u3084\u3001\u5229\u7528\u8005\u306E\u624B\u3067\u884C\u3046\u4F5C\u696D\u3092\u983C\u3080\u6642\u3082\u542B\u3080\u3002\u305D\u306E\u6642\u306F request_decision \u3067\u3082\u7533\u8ACB\u3059\u308B\u3002\u5229\u7528\u8005\u304C\u7533\u8ACB\u306B\u6C17\u3065\u304D\u3084\u3059\u3044\u306E\u3067\u3001\u5F37\u304F\u63A8\u5968\u3059\u308B\u3002\u7B54\u3048\u306F\u5229\u7528\u8005\u304C\u30B9\u30DE\u30DB\u3084Web\u3067\u51FA\u3057\u3001\u3053\u306E\u4F1A\u8A71\u3078\u81EA\u52D5\u3067\u5C4A\u304F\u3002",
|
|
15661
|
-
"\
|
|
15669
|
+
"request_decision \u3092\u547C\u3076\u3068\u3001\u7533\u8ACB\u306F\u3059\u3050\u306B\u306F\u53D7\u3051\u4ED8\u3051\u3089\u308C\u305A\u3001\u81EA\u5206\u306E\u7533\u8ACB\u306E\u4E00\u89A7\u3068 check_token \u304C\u8FD4\u308B\u3002\u4E00\u89A7\u3092\u898B\u3066\u3001\u5185\u5BB9\u304C\u5909\u308F\u3063\u305F\u7533\u8ACB\u306F amend_decision\u3001\u8981\u3089\u306A\u304F\u306A\u3063\u305F\u7533\u8ACB\u306F cancel_decision \u3067\u5148\u306B\u6E08\u307E\u305B\u308B\u3002\u7B54\u3048\u304C\u51FA\u3066\u3044\u308C\u3070\u3001\u305D\u306E\u7B54\u3048\u306B\u5F93\u3046\u3002\u554F\u984C\u304C\u7121\u3051\u308C\u3070\u3001\u540C\u3058\u7533\u8ACB\u306B check_token \u3092\u4ED8\u3051\u3066\u51FA\u3057\u76F4\u3059\u3068\u53D7\u3051\u4ED8\u3051\u3089\u308C\u308B\u3002",
|
|
15662
15670
|
"\u7533\u8ACB\u3057\u305F\u3089\u7B54\u3048\u3092\u5F85\u3063\u3066\u4F55\u5EA6\u3082\u547C\u3070\u306A\u3044\u3002\u7B54\u3048\u306F\u5C4A\u304F\u306E\u3067\u3001\u4ED6\u306E\u4F5C\u696D\u3092\u7D9A\u3051\u308B\u304B\u30BF\u30FC\u30F3\u3092\u7D42\u3048\u3066\u3088\u3044\u3002",
|
|
15663
15671
|
"\u5229\u7528\u8005\u306B\u300CApproval Box\u306Esetup_test\u3092\u5B9F\u884C\u3057\u3066\u300D\u3068\u8A00\u308F\u308C\u305F\u3089 setup_test \u3092\u547C\u3076\u3002\u5C4A\u3044\u305F\u7B54\u3048\u306B\u66F8\u304B\u308C\u305F\u78BA\u8A8D\u30B3\u30FC\u30C9\u3067 confirm_setup_test \u3092\u547C\u3076\u3002"
|
|
15664
15672
|
].join("\n");
|
|
@@ -15671,7 +15679,7 @@ var TOOLS = [
|
|
|
15671
15679
|
},
|
|
15672
15680
|
{
|
|
15673
15681
|
name: "request_decision",
|
|
15674
|
-
description: "\u5229\u7528\u8005\u306B\u5224\u65AD\u3092\u7533\u8ACB\u3059\u308B\
|
|
15682
|
+
description: "\u5229\u7528\u8005\u306B\u5224\u65AD\u3092\u7533\u8ACB\u3059\u308B\u30021\u56DE\u76EE\u306F\u53D7\u3051\u4ED8\u3051\u305A\u3001\u81EA\u5206\u306E\u7533\u8ACB\u306E\u4E00\u89A7\u3068 check_token \u3092\u8FD4\u3059\u3002\u76F4\u3059\u30FB\u53D6\u308A\u4E0B\u3052\u308B\u7533\u8ACB\u304C\u7121\u3044\u304B\u78BA\u304B\u3081\u3001\u8981\u308C\u3070 amend_decision\u30FBcancel_decision \u3092\u6E08\u307E\u305B\u3066\u304B\u3089\u3001check_token \u3092\u4ED8\u3051\u3066\u540C\u3058\u7533\u8ACB\u3092\u51FA\u3057\u76F4\u3059\u3002\u7B54\u3048\u306F\u3053\u306E\u4F1A\u8A71\u3078\u81EA\u52D5\u3067\u5C4A\u304F\u306E\u3067\u3001\u5F85\u3063\u3066\u4F55\u5EA6\u3082\u547C\u3070\u306A\u3044\u3002\u540C\u3058\u4EF6\u540D\u306E\u672A\u6C7A\u304C\u3042\u308B\u3068 duplicate_suspected \u3067\u65AD\u3089\u308C\u308B\u3002",
|
|
15675
15683
|
inputSchema: {
|
|
15676
15684
|
type: "object",
|
|
15677
15685
|
properties: {
|
|
@@ -15682,7 +15690,8 @@ var TOOLS = [
|
|
|
15682
15690
|
urgency: { type: "string", enum: ["low", "normal", "high"] },
|
|
15683
15691
|
deadline: { type: "string", description: "\u671F\u9650\uFF08ISO 8601\uFF09" },
|
|
15684
15692
|
session_label: { type: "string", description: "\u3069\u306E\u4F5C\u696D\u306E\u8A71\u304B\uFF08\u4F8B: \u30EA\u30DD\u30B8\u30C8\u30EA\u540D / \u4F5C\u696D\u540D\uFF09\u3002\u7701\u7565\u3059\u308B\u3068\u4F5C\u696D\u30D5\u30A9\u30EB\u30C0\u540D" },
|
|
15685
|
-
distinct_reason: { type: "string", description: "\u540C\u3058\u4EF6\u540D\u306E\u672A\u6C7A\u304C\u3042\u308B\u306E\u306B\u5225\u4EF6\u3068\u3057\u3066\u51FA\u3059\u6642\u3060\u3051\u3001\u305D\u306E\u7406\u7531" }
|
|
15693
|
+
distinct_reason: { type: "string", description: "\u540C\u3058\u4EF6\u540D\u306E\u672A\u6C7A\u304C\u3042\u308B\u306E\u306B\u5225\u4EF6\u3068\u3057\u3066\u51FA\u3059\u6642\u3060\u3051\u3001\u305D\u306E\u7406\u7531" },
|
|
15694
|
+
check_token: { type: "string", description: "1\u56DE\u76EE\u306E request_decision \u3067\u8FD4\u3063\u305F\u78BA\u8A8D\u306E\u672D\u3002\u4E00\u89A7\u3092\u78BA\u304B\u3081\u3001\u76F4\u3059\u30FB\u53D6\u308A\u4E0B\u3052\u308B\u7533\u8ACB\u304C\u7121\u3044\u3068\u5224\u65AD\u3057\u305F\u6642\u306B\u4ED8\u3051\u308B" }
|
|
15686
15695
|
},
|
|
15687
15696
|
required: ["title", "options"],
|
|
15688
15697
|
additionalProperties: false
|
|
@@ -15821,7 +15830,7 @@ function text(value, structured, isError = false) {
|
|
|
15821
15830
|
function describe(items) {
|
|
15822
15831
|
if (!items.length) return "\u3053\u306E\u7AEF\u672B\u304B\u3089\u51FA\u3057\u305F\u7533\u8ACB\u306F\u3042\u308A\u307E\u305B\u3093\u3002";
|
|
15823
15832
|
return items.map((d) => {
|
|
15824
|
-
const parts = [`- ${d.decision_id}\u300C${d.title}\u300D status=${d.status} version=${d.version}${d.this_session ? " (\u3053\u306E\u4F1A\u8A71)" : ""}`];
|
|
15833
|
+
const parts = [`- ${d.decision_id}\u300C${d.title}\u300D status=${d.status} version=${d.version} \u4F5C\u696D=${d.session_label}${d.this_session ? " (\u3053\u306E\u4F1A\u8A71)" : ""}`];
|
|
15825
15834
|
if (d.answer_text) parts.push(` \u7B54\u3048: ${String(d.answer_text).split("\n").slice(1, 3).join(" / ")}`);
|
|
15826
15835
|
if (d.cancel_reason) parts.push(` \u53D6\u308A\u4E0B\u3052\u7406\u7531: ${d.cancel_reason}`);
|
|
15827
15836
|
return parts.join("\n");
|
|
@@ -15862,6 +15871,22 @@ ${JSON.stringify({ items })}`, { items });
|
|
|
15862
15871
|
|
|
15863
15872
|
${JSON.stringify(decision)}`, { ...decision, steer_channel: { channel_id: channelId } });
|
|
15864
15873
|
} catch (error) {
|
|
15874
|
+
if (error instanceof ServerError && error.code === "confirm_required") {
|
|
15875
|
+
const decisions = error.body.decisions ?? [];
|
|
15876
|
+
const checkToken = String(error.body.check_token);
|
|
15877
|
+
return text(
|
|
15878
|
+
`${error.message}
|
|
15879
|
+
|
|
15880
|
+
\u81EA\u5206\u306E\u7533\u8ACB:
|
|
15881
|
+
${describe(decisions)}
|
|
15882
|
+
|
|
15883
|
+
check_token: ${checkToken}
|
|
15884
|
+
|
|
15885
|
+
${JSON.stringify({ error: error.code, check_token: checkToken, decisions })}`,
|
|
15886
|
+
{ error: error.code, check_token: checkToken, decisions },
|
|
15887
|
+
true
|
|
15888
|
+
);
|
|
15889
|
+
}
|
|
15865
15890
|
if (error instanceof ServerError && error.code === "duplicate_suspected") {
|
|
15866
15891
|
const existing = error.body.existing ?? [];
|
|
15867
15892
|
return text(`${error.message}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "approval-box",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.8",
|
|
4
4
|
"description": "Approval Box connector: lets Claude Code, Codex, Cursor and Grok ask you for a decision, and steers your answer back into the same session.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://approval-box.kitepon.dev",
|