@awebai/claude-channel 0.2.2 → 0.3.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/.claude-plugin/plugin.json +1 -1
- package/dist/index.js +61 -53
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -21261,7 +21261,7 @@ var StdioServerTransport = class {
|
|
|
21261
21261
|
|
|
21262
21262
|
// src/index.ts
|
|
21263
21263
|
import { join as join2 } from "node:path";
|
|
21264
|
-
import { homedir
|
|
21264
|
+
import { homedir } from "node:os";
|
|
21265
21265
|
import { realpathSync } from "node:fs";
|
|
21266
21266
|
import { readFile as readFile2 } from "node:fs/promises";
|
|
21267
21267
|
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
@@ -21269,7 +21269,6 @@ import { fileURLToPath, pathToFileURL } from "node:url";
|
|
|
21269
21269
|
// src/config.ts
|
|
21270
21270
|
import { readFile } from "node:fs/promises";
|
|
21271
21271
|
import { join } from "node:path";
|
|
21272
|
-
import { homedir } from "node:os";
|
|
21273
21272
|
|
|
21274
21273
|
// node_modules/js-yaml/dist/js-yaml.mjs
|
|
21275
21274
|
function isNothing(subject) {
|
|
@@ -23897,48 +23896,48 @@ var jsYaml = {
|
|
|
23897
23896
|
|
|
23898
23897
|
// src/config.ts
|
|
23899
23898
|
async function resolveConfig(workdir) {
|
|
23900
|
-
const globalPath = process.env.AW_CONFIG_PATH || join(homedir(), ".config", "aw", "config.yaml");
|
|
23901
|
-
const contextPath = join(workdir, ".aw", "context");
|
|
23902
23899
|
const workspacePath = join(workdir, ".aw", "workspace.yaml");
|
|
23903
|
-
const
|
|
23904
|
-
if (!globalConfig2?.accounts || Object.keys(globalConfig2.accounts).length === 0) {
|
|
23905
|
-
throw new Error(`no accounts configured in ${globalPath}`);
|
|
23906
|
-
}
|
|
23907
|
-
let accountName;
|
|
23908
|
-
const context = await readYAML(contextPath);
|
|
23909
|
-
if (context?.default_account) {
|
|
23910
|
-
accountName = context.default_account;
|
|
23911
|
-
} else if (context?.client_default_accounts?.aw) {
|
|
23912
|
-
accountName = context.client_default_accounts.aw;
|
|
23913
|
-
}
|
|
23914
|
-
if (!accountName) {
|
|
23915
|
-
accountName = Object.keys(globalConfig2.accounts)[0];
|
|
23916
|
-
}
|
|
23917
|
-
const account = globalConfig2.accounts[accountName];
|
|
23918
|
-
if (!account) {
|
|
23919
|
-
throw new Error(`account "${accountName}" not found in ${globalPath}`);
|
|
23920
|
-
}
|
|
23921
|
-
if (!account.api_key) {
|
|
23922
|
-
throw new Error(`account "${accountName}" has no api_key`);
|
|
23923
|
-
}
|
|
23924
|
-
const serverName = account.server || "default";
|
|
23925
|
-
const server = globalConfig2.servers?.[serverName];
|
|
23926
|
-
const baseURL = server?.url || "https://app.aweb.ai";
|
|
23927
|
-
const namespace = account.namespace_slug || "";
|
|
23928
|
-
const alias = account.alias || "";
|
|
23929
|
-
const address = namespace && alias ? `${namespace}/${alias}` : "";
|
|
23900
|
+
const identityPath = join(workdir, ".aw", "identity.yaml");
|
|
23930
23901
|
const workspace = await readYAML(workspacePath);
|
|
23931
|
-
|
|
23902
|
+
if (!workspace) {
|
|
23903
|
+
throw new Error("current directory is not initialized for aw; run `aw init` or `aw run` first");
|
|
23904
|
+
}
|
|
23905
|
+
const baseURL = (workspace.server_url || "").trim();
|
|
23906
|
+
const apiKey = (workspace.api_key || "").trim();
|
|
23907
|
+
if (!baseURL || !apiKey) {
|
|
23908
|
+
throw new Error("worktree workspace binding is missing server_url or api_key");
|
|
23909
|
+
}
|
|
23910
|
+
const identity = await readYAML(identityPath);
|
|
23911
|
+
const alias = (workspace.identity_handle || workspace.alias || "").trim() || handleFromAddress((identity?.address || "").trim());
|
|
23912
|
+
const projectSlug = (workspace.project_slug || "").trim();
|
|
23913
|
+
const namespaceSlug = (workspace.namespace_slug || "").trim() || projectSlug;
|
|
23914
|
+
const address = (identity?.address || "").trim() || deriveAddress(namespaceSlug, projectSlug, alias);
|
|
23932
23915
|
return {
|
|
23933
23916
|
baseURL,
|
|
23934
|
-
apiKey
|
|
23935
|
-
did:
|
|
23936
|
-
stableID:
|
|
23917
|
+
apiKey,
|
|
23918
|
+
did: (identity?.did || "").trim() || (workspace.did || "").trim(),
|
|
23919
|
+
stableID: (identity?.stable_id || "").trim() || (workspace.stable_id || "").trim(),
|
|
23937
23920
|
address,
|
|
23938
23921
|
alias,
|
|
23939
23922
|
projectSlug
|
|
23940
23923
|
};
|
|
23941
23924
|
}
|
|
23925
|
+
function deriveAddress(namespaceSlug, projectSlug, alias) {
|
|
23926
|
+
const handle = alias.trim();
|
|
23927
|
+
if (!handle) return "";
|
|
23928
|
+
const namespace = namespaceSlug.trim();
|
|
23929
|
+
if (namespace) return `${namespace}/${handle}`;
|
|
23930
|
+
const project = projectSlug.trim();
|
|
23931
|
+
if (project) return `${project}/${handle}`;
|
|
23932
|
+
return handle;
|
|
23933
|
+
}
|
|
23934
|
+
function handleFromAddress(address) {
|
|
23935
|
+
const trimmed = address.trim();
|
|
23936
|
+
if (!trimmed) return "";
|
|
23937
|
+
const slash = trimmed.lastIndexOf("/");
|
|
23938
|
+
if (slash < 0) return trimmed;
|
|
23939
|
+
return trimmed.slice(slash + 1).trim();
|
|
23940
|
+
}
|
|
23942
23941
|
async function readYAML(path) {
|
|
23943
23942
|
try {
|
|
23944
23943
|
const content = await readFile(path, "utf-8");
|
|
@@ -26099,14 +26098,19 @@ var SenderTrustManager = class {
|
|
|
26099
26098
|
selfDid;
|
|
26100
26099
|
namespace;
|
|
26101
26100
|
metaCache = /* @__PURE__ */ new Map();
|
|
26102
|
-
async normalizeTrust(store, verificationStatus, rawAddress, fromDID, fromStableID, toDID, rotationAnnouncement, replacementAnnouncement) {
|
|
26101
|
+
async normalizeTrust(store, verificationStatus, rawAddress, fromDID, fromStableID, toDID, rotationAnnouncement, replacementAnnouncement, verificationAddress) {
|
|
26103
26102
|
let status = this.checkRecipientBinding(verificationStatus, toDID);
|
|
26104
26103
|
if (!status || !rawAddress.trim()) {
|
|
26105
26104
|
return { status, stored: false };
|
|
26106
26105
|
}
|
|
26107
26106
|
const trustAddress = this.canonicalTrustAddress(rawAddress);
|
|
26108
26107
|
const meta3 = await this.resolveAgentMeta(rawAddress);
|
|
26109
|
-
status = await this.checkStableIdentityRegistry(
|
|
26108
|
+
status = await this.checkStableIdentityRegistry(
|
|
26109
|
+
status,
|
|
26110
|
+
(verificationAddress || rawAddress).trim(),
|
|
26111
|
+
fromDID,
|
|
26112
|
+
fromStableID
|
|
26113
|
+
);
|
|
26110
26114
|
return this.checkTOFUPinWithMeta(
|
|
26111
26115
|
store,
|
|
26112
26116
|
status,
|
|
@@ -26295,11 +26299,6 @@ var SenderTrustManager = class {
|
|
|
26295
26299
|
}
|
|
26296
26300
|
const cached2 = this.metaCache.get(trustAddress);
|
|
26297
26301
|
if (cached2) return cached2;
|
|
26298
|
-
const fallback = {
|
|
26299
|
-
lifetime: "persistent",
|
|
26300
|
-
custody: "self",
|
|
26301
|
-
resolved: true
|
|
26302
|
-
};
|
|
26303
26302
|
try {
|
|
26304
26303
|
const identity = await this.resolveIdentity(rawAddress);
|
|
26305
26304
|
const meta3 = {
|
|
@@ -26311,10 +26310,7 @@ var SenderTrustManager = class {
|
|
|
26311
26310
|
this.metaCache.set(trustAddress, meta3);
|
|
26312
26311
|
return meta3;
|
|
26313
26312
|
} catch {
|
|
26314
|
-
|
|
26315
|
-
return { lifetime: "persistent", custody: "self", resolved: false };
|
|
26316
|
-
}
|
|
26317
|
-
return fallback;
|
|
26313
|
+
return { lifetime: "persistent", custody: "self", resolved: false };
|
|
26318
26314
|
}
|
|
26319
26315
|
}
|
|
26320
26316
|
async resolveIdentity(address) {
|
|
@@ -26413,7 +26409,7 @@ function escapeJSON3(s) {
|
|
|
26413
26409
|
}
|
|
26414
26410
|
|
|
26415
26411
|
// src/index.ts
|
|
26416
|
-
var PIN_STORE_PATH = join2(
|
|
26412
|
+
var PIN_STORE_PATH = join2(homedir(), ".config", "aw", "known_agents.yaml");
|
|
26417
26413
|
var MAX_DISPATCHED_IDS = 2e3;
|
|
26418
26414
|
async function loadPinStore() {
|
|
26419
26415
|
try {
|
|
@@ -26487,16 +26483,17 @@ async function dispatchEvent(mcp, client, pinStore, trust, selfAlias, dispatched
|
|
|
26487
26483
|
for (const msg of messages) {
|
|
26488
26484
|
if (dispatched.has(msg.message_id)) continue;
|
|
26489
26485
|
dispatched.add(msg.message_id);
|
|
26490
|
-
const from = msg.
|
|
26486
|
+
const from = senderDisplayAddress(msg.from_alias, msg.from_address);
|
|
26491
26487
|
const tofu = await trust.normalizeTrust(
|
|
26492
26488
|
pinStore,
|
|
26493
26489
|
msg.verification_status,
|
|
26494
|
-
|
|
26490
|
+
senderTrustAddress(msg.from_alias, msg.from_address),
|
|
26495
26491
|
msg.from_did,
|
|
26496
26492
|
msg.from_stable_id,
|
|
26497
26493
|
msg.to_did,
|
|
26498
26494
|
msg.rotation_announcement,
|
|
26499
|
-
msg.replacement_announcement
|
|
26495
|
+
msg.replacement_announcement,
|
|
26496
|
+
msg.from_address || msg.from_alias || ""
|
|
26500
26497
|
);
|
|
26501
26498
|
msg.verification_status = tofu.status;
|
|
26502
26499
|
if (tofu.stored) pinsDirty = true;
|
|
@@ -26528,16 +26525,17 @@ async function dispatchEvent(mcp, client, pinStore, trust, selfAlias, dispatched
|
|
|
26528
26525
|
if (msg.from_agent === selfAlias) continue;
|
|
26529
26526
|
if (dispatched.has(msg.message_id)) continue;
|
|
26530
26527
|
dispatched.add(msg.message_id);
|
|
26531
|
-
const from = msg.
|
|
26528
|
+
const from = senderDisplayAddress(msg.from_agent, msg.from_address);
|
|
26532
26529
|
const tofu = await trust.normalizeTrust(
|
|
26533
26530
|
pinStore,
|
|
26534
26531
|
msg.verification_status,
|
|
26535
|
-
|
|
26532
|
+
senderTrustAddress(msg.from_agent, msg.from_address),
|
|
26536
26533
|
msg.from_did,
|
|
26537
26534
|
msg.from_stable_id,
|
|
26538
26535
|
msg.to_did,
|
|
26539
26536
|
msg.rotation_announcement,
|
|
26540
|
-
msg.replacement_announcement
|
|
26537
|
+
msg.replacement_announcement,
|
|
26538
|
+
msg.from_address || msg.from_agent || ""
|
|
26541
26539
|
);
|
|
26542
26540
|
msg.verification_status = tofu.status;
|
|
26543
26541
|
if (tofu.stored) pinsDirty = true;
|
|
@@ -26626,6 +26624,16 @@ async function dispatchEvent(mcp, client, pinStore, trust, selfAlias, dispatched
|
|
|
26626
26624
|
break;
|
|
26627
26625
|
}
|
|
26628
26626
|
}
|
|
26627
|
+
function senderDisplayAddress(alias, address) {
|
|
26628
|
+
const qualified = (address || "").trim();
|
|
26629
|
+
if (qualified) return qualified;
|
|
26630
|
+
return (alias || "").trim();
|
|
26631
|
+
}
|
|
26632
|
+
function senderTrustAddress(alias, address) {
|
|
26633
|
+
const handle = (alias || "").trim();
|
|
26634
|
+
if (handle) return handle;
|
|
26635
|
+
return (address || "").trim();
|
|
26636
|
+
}
|
|
26629
26637
|
function isDirectExecution(moduleURL) {
|
|
26630
26638
|
const entry = process.argv[1];
|
|
26631
26639
|
if (!entry) return false;
|