@newtype-ai/nit 0.4.8 → 0.4.10
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/README.md +36 -1
- package/dist/chunk-M6SR6QMR.js +291 -0
- package/dist/chunk-WHSQICPU.js +3896 -0
- package/dist/cli.js +204 -2
- package/dist/index.d.ts +168 -1
- package/dist/index.js +34 -10
- package/dist/remote-WZ625MBZ.js +15 -0
- package/package.json +2 -1
- package/scripts/postinstall.js +8 -1
- package/dist/chunk-7LNGTHKO.js +0 -1601
package/dist/cli.js
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
// nit — version control for agent cards
|
|
3
3
|
import {
|
|
4
|
+
authSet,
|
|
5
|
+
authShow,
|
|
4
6
|
branch,
|
|
7
|
+
broadcast,
|
|
5
8
|
checkout,
|
|
6
9
|
commit,
|
|
7
10
|
diff,
|
|
@@ -9,13 +12,20 @@ import {
|
|
|
9
12
|
init,
|
|
10
13
|
log,
|
|
11
14
|
loginPayload,
|
|
15
|
+
pull,
|
|
12
16
|
push,
|
|
13
17
|
remote,
|
|
14
18
|
remoteAdd,
|
|
15
19
|
remoteSetUrl,
|
|
20
|
+
reset,
|
|
21
|
+
rpcInfo,
|
|
22
|
+
rpcSetUrl,
|
|
23
|
+
show,
|
|
16
24
|
sign,
|
|
25
|
+
signTx,
|
|
17
26
|
status
|
|
18
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-WHSQICPU.js";
|
|
28
|
+
import "./chunk-M6SR6QMR.js";
|
|
19
29
|
|
|
20
30
|
// src/update-check.ts
|
|
21
31
|
import { execSync } from "child_process";
|
|
@@ -28,7 +38,7 @@ var FETCH_TIMEOUT_MS = 3e3;
|
|
|
28
38
|
var REGISTRY_URL = "https://registry.npmjs.org/@newtype-ai/nit/latest";
|
|
29
39
|
function getCurrentVersion() {
|
|
30
40
|
try {
|
|
31
|
-
return "0.4.
|
|
41
|
+
return "0.4.10";
|
|
32
42
|
} catch {
|
|
33
43
|
return "0.0.0";
|
|
34
44
|
}
|
|
@@ -149,6 +159,27 @@ async function main() {
|
|
|
149
159
|
case "remote":
|
|
150
160
|
await cmdRemote(args);
|
|
151
161
|
break;
|
|
162
|
+
case "sign-tx":
|
|
163
|
+
await cmdSignTx(args);
|
|
164
|
+
break;
|
|
165
|
+
case "broadcast":
|
|
166
|
+
await cmdBroadcast(args);
|
|
167
|
+
break;
|
|
168
|
+
case "rpc":
|
|
169
|
+
await cmdRpc(args);
|
|
170
|
+
break;
|
|
171
|
+
case "auth":
|
|
172
|
+
await cmdAuth(args);
|
|
173
|
+
break;
|
|
174
|
+
case "reset":
|
|
175
|
+
await cmdReset(args);
|
|
176
|
+
break;
|
|
177
|
+
case "show":
|
|
178
|
+
await cmdShow(args);
|
|
179
|
+
break;
|
|
180
|
+
case "pull":
|
|
181
|
+
await cmdPull(args);
|
|
182
|
+
break;
|
|
152
183
|
case "help":
|
|
153
184
|
case "--help":
|
|
154
185
|
case "-h":
|
|
@@ -359,6 +390,167 @@ async function cmdSign(args) {
|
|
|
359
390
|
const signature = await sign(message);
|
|
360
391
|
console.log(signature);
|
|
361
392
|
}
|
|
393
|
+
async function cmdSignTx(args) {
|
|
394
|
+
const chainIndex = args.indexOf("--chain");
|
|
395
|
+
if (chainIndex === -1 || !args[chainIndex + 1]) {
|
|
396
|
+
console.error("Usage: nit sign-tx --chain <evm|solana> <hex-data>");
|
|
397
|
+
process.exit(1);
|
|
398
|
+
}
|
|
399
|
+
const chain = args[chainIndex + 1];
|
|
400
|
+
if (chain !== "evm" && chain !== "solana") {
|
|
401
|
+
console.error(`Unknown chain: ${chain}. Use 'evm' or 'solana'.`);
|
|
402
|
+
process.exit(1);
|
|
403
|
+
}
|
|
404
|
+
const data = args.filter((_, i) => i !== chainIndex && i !== chainIndex + 1)[0];
|
|
405
|
+
if (!data) {
|
|
406
|
+
console.error("Usage: nit sign-tx --chain <evm|solana> <hex-data>");
|
|
407
|
+
process.exit(1);
|
|
408
|
+
}
|
|
409
|
+
const result = await signTx(chain, data);
|
|
410
|
+
console.log(JSON.stringify(result, null, 2));
|
|
411
|
+
}
|
|
412
|
+
async function cmdBroadcast(args) {
|
|
413
|
+
const chainIndex = args.indexOf("--chain");
|
|
414
|
+
if (chainIndex === -1 || !args[chainIndex + 1]) {
|
|
415
|
+
console.error("Usage: nit broadcast --chain <evm|solana> <signed-tx>");
|
|
416
|
+
process.exit(1);
|
|
417
|
+
}
|
|
418
|
+
const chain = args[chainIndex + 1];
|
|
419
|
+
if (chain !== "evm" && chain !== "solana") {
|
|
420
|
+
console.error(`Unknown chain: ${chain}. Use 'evm' or 'solana'.`);
|
|
421
|
+
process.exit(1);
|
|
422
|
+
}
|
|
423
|
+
const signedTx = args.filter((_, i) => i !== chainIndex && i !== chainIndex + 1)[0];
|
|
424
|
+
if (!signedTx) {
|
|
425
|
+
console.error("Usage: nit broadcast --chain <evm|solana> <signed-tx>");
|
|
426
|
+
process.exit(1);
|
|
427
|
+
}
|
|
428
|
+
const result = await broadcast(chain, signedTx);
|
|
429
|
+
console.log(`${green("+")} ${result.txHash}`);
|
|
430
|
+
console.log(dim(` \u2192 ${result.rpcUrl}`));
|
|
431
|
+
}
|
|
432
|
+
async function cmdRpc(args) {
|
|
433
|
+
if (args[0] === "set-url") {
|
|
434
|
+
const chain = args[1];
|
|
435
|
+
const url = args[2];
|
|
436
|
+
if (!chain || !url) {
|
|
437
|
+
console.error("Usage: nit rpc set-url <chain> <url>");
|
|
438
|
+
process.exit(1);
|
|
439
|
+
}
|
|
440
|
+
await rpcSetUrl(chain, url);
|
|
441
|
+
console.log(`Set RPC URL for '${chain}' to ${url}`);
|
|
442
|
+
return;
|
|
443
|
+
}
|
|
444
|
+
if (args[0]) {
|
|
445
|
+
console.error(`nit rpc: unknown subcommand '${args[0]}'`);
|
|
446
|
+
console.error("Usage: nit rpc [set-url <chain> <url>]");
|
|
447
|
+
process.exit(1);
|
|
448
|
+
}
|
|
449
|
+
const info = await rpcInfo();
|
|
450
|
+
const chains = Object.keys(info);
|
|
451
|
+
if (chains.length === 0) {
|
|
452
|
+
console.log(dim("No RPC endpoints configured."));
|
|
453
|
+
console.log(dim("Run: nit rpc set-url <chain> <url>"));
|
|
454
|
+
return;
|
|
455
|
+
}
|
|
456
|
+
for (const [chain, config] of Object.entries(info)) {
|
|
457
|
+
console.log(` ${bold(chain)}: ${config.url}`);
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
async function cmdReset(args) {
|
|
461
|
+
const target = args[0];
|
|
462
|
+
const result = await reset(target);
|
|
463
|
+
console.log(`Reset to ${dim(result.hash.slice(0, 8))}`);
|
|
464
|
+
}
|
|
465
|
+
async function cmdShow(args) {
|
|
466
|
+
const target = args[0];
|
|
467
|
+
const s = await show(target);
|
|
468
|
+
const date = new Date(s.timestamp * 1e3).toISOString().slice(0, 19);
|
|
469
|
+
console.log(`${bold("commit")} ${yellow(s.hash.slice(0, 8))}`);
|
|
470
|
+
console.log(`Author: ${s.author}`);
|
|
471
|
+
console.log(`Date: ${date}`);
|
|
472
|
+
if (s.parent) {
|
|
473
|
+
console.log(`Parent: ${dim(s.parent.slice(0, 8))}`);
|
|
474
|
+
}
|
|
475
|
+
console.log();
|
|
476
|
+
console.log(` ${s.message}`);
|
|
477
|
+
console.log();
|
|
478
|
+
console.log(JSON.stringify(s.cardJson, null, 2));
|
|
479
|
+
}
|
|
480
|
+
async function cmdPull(args) {
|
|
481
|
+
const all = args.includes("--all");
|
|
482
|
+
const results = await pull({ all });
|
|
483
|
+
for (const r of results) {
|
|
484
|
+
if (r.updated) {
|
|
485
|
+
console.log(`${green("\u2713")} ${r.branch} \u2190 ${dim(r.commitHash.slice(0, 8))}`);
|
|
486
|
+
} else {
|
|
487
|
+
console.log(`${dim("\u2014")} ${r.branch} ${dim("(up to date)")}`);
|
|
488
|
+
}
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
async function cmdAuth(args) {
|
|
492
|
+
const subcommand = args[0];
|
|
493
|
+
if (subcommand === "set") {
|
|
494
|
+
const domain = args[1];
|
|
495
|
+
if (!domain) {
|
|
496
|
+
console.error("Usage: nit auth set <domain> --provider <google|github|x> --account <email>");
|
|
497
|
+
process.exit(1);
|
|
498
|
+
}
|
|
499
|
+
const providerIndex = args.indexOf("--provider");
|
|
500
|
+
if (providerIndex === -1 || !args[providerIndex + 1]) {
|
|
501
|
+
console.error("Missing --provider. Usage: nit auth set <domain> --provider <google|github|x> --account <email>");
|
|
502
|
+
process.exit(1);
|
|
503
|
+
}
|
|
504
|
+
const provider = args[providerIndex + 1];
|
|
505
|
+
const validProviders = ["google", "github", "x"];
|
|
506
|
+
if (!validProviders.includes(provider)) {
|
|
507
|
+
console.error(`Unknown provider: ${provider}. Use: google, github, x`);
|
|
508
|
+
process.exit(1);
|
|
509
|
+
}
|
|
510
|
+
const accountIndex = args.indexOf("--account");
|
|
511
|
+
if (accountIndex === -1 || !args[accountIndex + 1]) {
|
|
512
|
+
console.error("Missing --account. Usage: nit auth set <domain> --provider <google|github|x> --account <email>");
|
|
513
|
+
process.exit(1);
|
|
514
|
+
}
|
|
515
|
+
const account = args[accountIndex + 1];
|
|
516
|
+
const result = await authSet(domain, provider, account);
|
|
517
|
+
if (result.createdBranch) {
|
|
518
|
+
console.log(`Created branch '${green(result.branch)}'`);
|
|
519
|
+
}
|
|
520
|
+
if (result.switchedBranch) {
|
|
521
|
+
console.log(`Switched to branch '${green(result.switchedBranch)}'`);
|
|
522
|
+
}
|
|
523
|
+
console.log(`${green("\u2713")} Auth configured for ${bold(domain)}: ${result.provider} (${result.account})`);
|
|
524
|
+
console.log(dim(` Updated SKILL.md: ${result.skillId}/SKILL.md`));
|
|
525
|
+
return;
|
|
526
|
+
}
|
|
527
|
+
if (subcommand === "show") {
|
|
528
|
+
const domain = args[1];
|
|
529
|
+
const results = await authShow(domain);
|
|
530
|
+
if (results.length === 0) {
|
|
531
|
+
if (domain) {
|
|
532
|
+
console.log(dim(`No auth configured for '${domain}'.`));
|
|
533
|
+
} else {
|
|
534
|
+
console.log(dim("No branches with auth configured."));
|
|
535
|
+
}
|
|
536
|
+
return;
|
|
537
|
+
}
|
|
538
|
+
for (const r of results) {
|
|
539
|
+
if (r.auth) {
|
|
540
|
+
console.log(` ${bold(r.branch)}: ${r.auth.provider} (${r.auth.account})`);
|
|
541
|
+
} else {
|
|
542
|
+
console.log(` ${bold(r.branch)}: ${dim("(no auth)")}`);
|
|
543
|
+
}
|
|
544
|
+
}
|
|
545
|
+
return;
|
|
546
|
+
}
|
|
547
|
+
if (subcommand) {
|
|
548
|
+
console.error(`nit auth: unknown subcommand '${subcommand}'`);
|
|
549
|
+
}
|
|
550
|
+
console.error("Usage: nit auth set <domain> --provider <google|github|x> --account <email>");
|
|
551
|
+
console.error(" nit auth show [domain]");
|
|
552
|
+
process.exit(1);
|
|
553
|
+
}
|
|
362
554
|
function printUsage() {
|
|
363
555
|
console.log(`
|
|
364
556
|
${bold("nit")} \u2014 version control for agent cards
|
|
@@ -374,11 +566,21 @@ ${bold("Commands:")}
|
|
|
374
566
|
branch [name] List branches or create a new one
|
|
375
567
|
checkout <branch> Switch branch (overwrites agent-card.json)
|
|
376
568
|
push [--all] Push branch(es) to remote
|
|
569
|
+
pull [--all] Pull branch(es) from remote
|
|
570
|
+
reset [target] Restore agent-card.json from HEAD or target
|
|
571
|
+
show [target] Show commit metadata and card content
|
|
377
572
|
sign "message" Sign a message with your Ed25519 key
|
|
378
573
|
sign --login <dom> Switch to domain branch + generate login payload
|
|
379
574
|
remote Show remote info
|
|
380
575
|
remote add <n> <u> Add a new remote
|
|
381
576
|
remote set-url <n> <u> Change remote URL
|
|
577
|
+
sign-tx --chain <c> <data> Sign tx data (evm: hash, solana: message)
|
|
578
|
+
broadcast --chain <c> <tx> Send signed tx to RPC endpoint
|
|
579
|
+
rpc Show configured RPC endpoints
|
|
580
|
+
rpc set-url <c> <url> Set RPC endpoint for a chain
|
|
581
|
+
auth set <dom> --provider <p> --account <a>
|
|
582
|
+
Configure OAuth auth for a branch
|
|
583
|
+
auth show [dom] Show auth config for branch(es)
|
|
382
584
|
|
|
383
585
|
${bold("Examples:")}
|
|
384
586
|
nit init
|
package/dist/index.d.ts
CHANGED
|
@@ -32,12 +32,19 @@ interface NitRemoteConfig {
|
|
|
32
32
|
/** Legacy field — push auth is now via Ed25519 keypair */
|
|
33
33
|
credential?: string;
|
|
34
34
|
}
|
|
35
|
+
/** RPC endpoint configuration for a specific chain. */
|
|
36
|
+
interface NitRpcConfig {
|
|
37
|
+
/** JSON-RPC endpoint URL */
|
|
38
|
+
url: string;
|
|
39
|
+
}
|
|
35
40
|
/** Full .nit/config file contents. */
|
|
36
41
|
interface NitConfig {
|
|
37
42
|
/** Keyed by remote name (e.g. "origin") */
|
|
38
43
|
remotes: Record<string, NitRemoteConfig>;
|
|
39
44
|
/** Discovered skills directory path */
|
|
40
45
|
skillsDir?: string;
|
|
46
|
+
/** RPC endpoints keyed by chain name (e.g. "evm", "solana") */
|
|
47
|
+
rpc?: Record<string, NitRpcConfig>;
|
|
41
48
|
}
|
|
42
49
|
/** A2A-compatible agent card. */
|
|
43
50
|
interface AgentCard {
|
|
@@ -124,6 +131,33 @@ interface StatusResult {
|
|
|
124
131
|
behind: number;
|
|
125
132
|
}>;
|
|
126
133
|
}
|
|
134
|
+
/** Result of signing transaction data. */
|
|
135
|
+
interface SignTxResult {
|
|
136
|
+
/** Chain that was signed for */
|
|
137
|
+
chain: 'evm' | 'solana';
|
|
138
|
+
/** The signature (EVM: "0x{r}{s}{v}" 130 hex chars, Solana: base64 64-byte Ed25519) */
|
|
139
|
+
signature: string;
|
|
140
|
+
/** EVM only: recovery parameter (0 or 1) for agent to compute chain-specific v */
|
|
141
|
+
recovery?: number;
|
|
142
|
+
/** The signer address */
|
|
143
|
+
address: string;
|
|
144
|
+
}
|
|
145
|
+
/** Result of broadcasting a signed transaction. */
|
|
146
|
+
interface BroadcastResult {
|
|
147
|
+
/** Chain that was broadcast to */
|
|
148
|
+
chain: 'evm' | 'solana';
|
|
149
|
+
/** Transaction hash (EVM) or signature (Solana) */
|
|
150
|
+
txHash: string;
|
|
151
|
+
/** RPC endpoint used */
|
|
152
|
+
rpcUrl: string;
|
|
153
|
+
}
|
|
154
|
+
/** OAuth provider for per-branch authentication config. */
|
|
155
|
+
type AuthProvider = 'google' | 'github' | 'x';
|
|
156
|
+
/** Per-branch authentication configuration stored in SKILL.md frontmatter. */
|
|
157
|
+
interface AuthConfig {
|
|
158
|
+
provider: AuthProvider;
|
|
159
|
+
account: string;
|
|
160
|
+
}
|
|
127
161
|
/** Result of generating a login payload for app authentication. */
|
|
128
162
|
interface LoginPayload {
|
|
129
163
|
agent_id: string;
|
|
@@ -225,6 +259,28 @@ declare function getWalletAddresses(nitDir: string): Promise<WalletAddresses>;
|
|
|
225
259
|
* For EVM transaction signing.
|
|
226
260
|
*/
|
|
227
261
|
declare function loadSecp256k1RawKeyPair(nitDir: string): Promise<Uint8Array>;
|
|
262
|
+
/**
|
|
263
|
+
* Sign a 32-byte hash with the agent's derived secp256k1 private key.
|
|
264
|
+
* Returns ECDSA signature with recovery parameter.
|
|
265
|
+
*
|
|
266
|
+
* The caller (agent) provides a pre-hashed message (e.g. keccak256 of
|
|
267
|
+
* an RLP-encoded EVM transaction). nit signs it and returns (r, s, recovery).
|
|
268
|
+
* The agent computes chain-specific v = chainId * 2 + 35 + recovery (EIP-155).
|
|
269
|
+
*/
|
|
270
|
+
declare function signEvmHash(nitDir: string, hash: Uint8Array): Promise<{
|
|
271
|
+
r: string;
|
|
272
|
+
s: string;
|
|
273
|
+
v: number;
|
|
274
|
+
recovery: number;
|
|
275
|
+
signature: string;
|
|
276
|
+
}>;
|
|
277
|
+
/**
|
|
278
|
+
* Sign raw bytes with the agent's Ed25519 private key.
|
|
279
|
+
* Returns 64-byte signature as Uint8Array.
|
|
280
|
+
*
|
|
281
|
+
* For Solana transactions: the caller provides the serialized message bytes.
|
|
282
|
+
*/
|
|
283
|
+
declare function signSolanaBytes(nitDir: string, message: Uint8Array): Promise<Uint8Array>;
|
|
228
284
|
|
|
229
285
|
/**
|
|
230
286
|
* Walk up from startDir looking for a .nit/ directory.
|
|
@@ -343,5 +399,116 @@ declare function remoteAdd(name: string, url: string, options?: {
|
|
|
343
399
|
declare function remoteSetUrl(name: string, url: string, options?: {
|
|
344
400
|
projectDir?: string;
|
|
345
401
|
}): Promise<void>;
|
|
402
|
+
/**
|
|
403
|
+
* Sign transaction data with the agent's identity-derived key.
|
|
404
|
+
*
|
|
405
|
+
* EVM: pass a 32-byte keccak256 hash (hex). Returns ECDSA signature.
|
|
406
|
+
* Solana: pass serialized message bytes (hex). Returns Ed25519 signature.
|
|
407
|
+
*/
|
|
408
|
+
declare function signTx(chain: 'evm' | 'solana', data: string, options?: {
|
|
409
|
+
projectDir?: string;
|
|
410
|
+
}): Promise<SignTxResult>;
|
|
411
|
+
/**
|
|
412
|
+
* Broadcast a signed transaction to the configured RPC endpoint.
|
|
413
|
+
*/
|
|
414
|
+
declare function broadcast(chain: 'evm' | 'solana', signedTx: string, options?: {
|
|
415
|
+
projectDir?: string;
|
|
416
|
+
rpcUrl?: string;
|
|
417
|
+
}): Promise<BroadcastResult>;
|
|
418
|
+
/**
|
|
419
|
+
* Set the RPC endpoint URL for a chain.
|
|
420
|
+
*/
|
|
421
|
+
declare function rpcSetUrl(chain: string, url: string, options?: {
|
|
422
|
+
projectDir?: string;
|
|
423
|
+
}): Promise<void>;
|
|
424
|
+
/**
|
|
425
|
+
* Get all configured RPC endpoints.
|
|
426
|
+
*/
|
|
427
|
+
declare function rpcInfo(options?: {
|
|
428
|
+
projectDir?: string;
|
|
429
|
+
}): Promise<Record<string, NitRpcConfig>>;
|
|
430
|
+
/**
|
|
431
|
+
* Restore agent-card.json from a commit, discarding uncommitted changes.
|
|
432
|
+
*
|
|
433
|
+
* - No target: restore from HEAD (discard all uncommitted changes)
|
|
434
|
+
* - Commit hash or branch name: restore card from that commit
|
|
435
|
+
*
|
|
436
|
+
* Does NOT move the branch pointer — only overwrites the working card.
|
|
437
|
+
*/
|
|
438
|
+
declare function reset(target?: string, options?: {
|
|
439
|
+
projectDir?: string;
|
|
440
|
+
}): Promise<{
|
|
441
|
+
hash: string;
|
|
442
|
+
}>;
|
|
443
|
+
interface ShowResult {
|
|
444
|
+
hash: string;
|
|
445
|
+
card: string;
|
|
446
|
+
parent: string | null;
|
|
447
|
+
author: string;
|
|
448
|
+
timestamp: number;
|
|
449
|
+
message: string;
|
|
450
|
+
cardJson: AgentCard;
|
|
451
|
+
}
|
|
452
|
+
/**
|
|
453
|
+
* Show a commit's metadata and card content.
|
|
454
|
+
*
|
|
455
|
+
* - No target: show HEAD
|
|
456
|
+
* - Commit hash or branch name: show that commit
|
|
457
|
+
*/
|
|
458
|
+
declare function show(target?: string, options?: {
|
|
459
|
+
projectDir?: string;
|
|
460
|
+
}): Promise<ShowResult>;
|
|
461
|
+
interface PullResult {
|
|
462
|
+
branch: string;
|
|
463
|
+
commitHash: string;
|
|
464
|
+
updated: boolean;
|
|
465
|
+
}
|
|
466
|
+
/**
|
|
467
|
+
* Fetch current branch (or all branches) from the remote and update local state.
|
|
468
|
+
*
|
|
469
|
+
* 1. Fetch card JSON from remote
|
|
470
|
+
* 2. Write card to object store
|
|
471
|
+
* 3. Create a commit object
|
|
472
|
+
* 4. Update branch ref + remote-tracking ref
|
|
473
|
+
* 5. Write card to working copy (current branch only)
|
|
474
|
+
*/
|
|
475
|
+
declare function pull(options?: {
|
|
476
|
+
projectDir?: string;
|
|
477
|
+
remoteName?: string;
|
|
478
|
+
all?: boolean;
|
|
479
|
+
}): Promise<PullResult[]>;
|
|
480
|
+
interface AuthSetResult {
|
|
481
|
+
branch: string;
|
|
482
|
+
skillId: string;
|
|
483
|
+
provider: AuthProvider;
|
|
484
|
+
account: string;
|
|
485
|
+
switchedBranch?: string;
|
|
486
|
+
createdBranch?: boolean;
|
|
487
|
+
}
|
|
488
|
+
interface AuthShowResult {
|
|
489
|
+
branch: string;
|
|
490
|
+
auth: AuthConfig | null;
|
|
491
|
+
}
|
|
492
|
+
/**
|
|
493
|
+
* Configure OAuth authentication for a branch.
|
|
494
|
+
*
|
|
495
|
+
* 1. Switches to the target branch (creates if needed)
|
|
496
|
+
* 2. Updates the branch's SKILL.md with auth frontmatter + consent instructions
|
|
497
|
+
* 3. Adds skill pointer to agent-card.json if not present
|
|
498
|
+
*
|
|
499
|
+
* The SKILL.md tells OpenClaw which OAuth provider and account to use when
|
|
500
|
+
* the agent encounters a login page. The agent reuses the human's existing
|
|
501
|
+
* Chrome session (browser-profile = user) and only handles OAuth consent
|
|
502
|
+
* flows — never enters credentials.
|
|
503
|
+
*/
|
|
504
|
+
declare function authSet(domain: string, provider: AuthProvider, account: string, options?: {
|
|
505
|
+
projectDir?: string;
|
|
506
|
+
}): Promise<AuthSetResult>;
|
|
507
|
+
/**
|
|
508
|
+
* Show auth config for a specific branch, or all branches with auth configured.
|
|
509
|
+
*/
|
|
510
|
+
declare function authShow(domain?: string, options?: {
|
|
511
|
+
projectDir?: string;
|
|
512
|
+
}): Promise<AuthShowResult[]>;
|
|
346
513
|
|
|
347
|
-
export { type AgentCard, type AgentCardSkill, type DiffResult, type FieldDiff, type InitResult, type LoginPayload, NIT_NAMESPACE, type NitBranch, type NitCommit, type NitConfig, type NitHead, type NitRemoteConfig, type PushResult, type RemoteInfo, type SkillMetadata, type StatusResult, type WalletAddresses$1 as WalletAddresses, base58Encode, branch, checkout, commit, deriveAgentId, diff, diffCards, fetchBranchCard, findNitDir, formatDiff, formatPublicKeyField, getEvmAddress, getSolanaAddress, getWalletAddresses, init, loadAgentId, loadRawKeyPair, loadSecp256k1RawKeyPair, log, loginPayload, parsePublicKeyField, push, remote, remoteAdd, remoteSetUrl, sign, signChallenge, signMessage, status };
|
|
514
|
+
export { type AgentCard, type AgentCardSkill, type AuthConfig, type AuthProvider, type AuthSetResult, type AuthShowResult, type BroadcastResult, type DiffResult, type FieldDiff, type InitResult, type LoginPayload, NIT_NAMESPACE, type NitBranch, type NitCommit, type NitConfig, type NitHead, type NitRemoteConfig, type NitRpcConfig, type PullResult, type PushResult, type RemoteInfo, type ShowResult, type SignTxResult, type SkillMetadata, type StatusResult, type WalletAddresses$1 as WalletAddresses, authSet, authShow, base58Encode, branch, broadcast, checkout, commit, deriveAgentId, diff, diffCards, fetchBranchCard, findNitDir, formatDiff, formatPublicKeyField, getEvmAddress, getSolanaAddress, getWalletAddresses, init, loadAgentId, loadRawKeyPair, loadSecp256k1RawKeyPair, log, loginPayload, parsePublicKeyField, pull, push, remote, remoteAdd, remoteSetUrl, reset, rpcInfo, rpcSetUrl, show, sign, signChallenge, signEvmHash, signMessage, signSolanaBytes, signTx, status };
|
package/dist/index.js
CHANGED
|
@@ -1,40 +1,56 @@
|
|
|
1
1
|
// nit — version control for agent cards
|
|
2
2
|
import {
|
|
3
|
-
|
|
3
|
+
authSet,
|
|
4
|
+
authShow,
|
|
4
5
|
base58Encode,
|
|
5
6
|
branch,
|
|
7
|
+
broadcast,
|
|
6
8
|
checkout,
|
|
7
9
|
commit,
|
|
8
|
-
deriveAgentId,
|
|
9
10
|
diff,
|
|
10
11
|
diffCards,
|
|
11
|
-
fetchBranchCard,
|
|
12
12
|
findNitDir,
|
|
13
13
|
formatDiff,
|
|
14
|
-
formatPublicKeyField,
|
|
15
14
|
getEvmAddress,
|
|
16
15
|
getSolanaAddress,
|
|
17
16
|
getWalletAddresses,
|
|
18
17
|
init,
|
|
19
|
-
loadAgentId,
|
|
20
|
-
loadRawKeyPair,
|
|
21
18
|
loadSecp256k1RawKeyPair,
|
|
22
19
|
log,
|
|
23
20
|
loginPayload,
|
|
24
|
-
|
|
21
|
+
pull,
|
|
25
22
|
push,
|
|
26
23
|
remote,
|
|
27
24
|
remoteAdd,
|
|
28
25
|
remoteSetUrl,
|
|
26
|
+
reset,
|
|
27
|
+
rpcInfo,
|
|
28
|
+
rpcSetUrl,
|
|
29
|
+
show,
|
|
29
30
|
sign,
|
|
30
|
-
|
|
31
|
-
|
|
31
|
+
signEvmHash,
|
|
32
|
+
signSolanaBytes,
|
|
33
|
+
signTx,
|
|
32
34
|
status
|
|
33
|
-
} from "./chunk-
|
|
35
|
+
} from "./chunk-WHSQICPU.js";
|
|
36
|
+
import {
|
|
37
|
+
NIT_NAMESPACE,
|
|
38
|
+
deriveAgentId,
|
|
39
|
+
fetchBranchCard,
|
|
40
|
+
formatPublicKeyField,
|
|
41
|
+
loadAgentId,
|
|
42
|
+
loadRawKeyPair,
|
|
43
|
+
parsePublicKeyField,
|
|
44
|
+
signChallenge,
|
|
45
|
+
signMessage
|
|
46
|
+
} from "./chunk-M6SR6QMR.js";
|
|
34
47
|
export {
|
|
35
48
|
NIT_NAMESPACE,
|
|
49
|
+
authSet,
|
|
50
|
+
authShow,
|
|
36
51
|
base58Encode,
|
|
37
52
|
branch,
|
|
53
|
+
broadcast,
|
|
38
54
|
checkout,
|
|
39
55
|
commit,
|
|
40
56
|
deriveAgentId,
|
|
@@ -54,12 +70,20 @@ export {
|
|
|
54
70
|
log,
|
|
55
71
|
loginPayload,
|
|
56
72
|
parsePublicKeyField,
|
|
73
|
+
pull,
|
|
57
74
|
push,
|
|
58
75
|
remote,
|
|
59
76
|
remoteAdd,
|
|
60
77
|
remoteSetUrl,
|
|
78
|
+
reset,
|
|
79
|
+
rpcInfo,
|
|
80
|
+
rpcSetUrl,
|
|
81
|
+
show,
|
|
61
82
|
sign,
|
|
62
83
|
signChallenge,
|
|
84
|
+
signEvmHash,
|
|
63
85
|
signMessage,
|
|
86
|
+
signSolanaBytes,
|
|
87
|
+
signTx,
|
|
64
88
|
status
|
|
65
89
|
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// nit — version control for agent cards
|
|
2
|
+
import {
|
|
3
|
+
deleteRemoteBranch,
|
|
4
|
+
fetchBranchCard,
|
|
5
|
+
listRemoteBranches,
|
|
6
|
+
pushAll,
|
|
7
|
+
pushBranch
|
|
8
|
+
} from "./chunk-M6SR6QMR.js";
|
|
9
|
+
export {
|
|
10
|
+
deleteRemoteBranch,
|
|
11
|
+
fetchBranchCard,
|
|
12
|
+
listRemoteBranches,
|
|
13
|
+
pushAll,
|
|
14
|
+
pushBranch
|
|
15
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@newtype-ai/nit",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.10",
|
|
4
4
|
"description": "Version control for agent cards",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -42,6 +42,7 @@
|
|
|
42
42
|
},
|
|
43
43
|
"homepage": "https://github.com/newtype-ai/nit",
|
|
44
44
|
"devDependencies": {
|
|
45
|
+
"@noble/curves": "^2.0.0",
|
|
45
46
|
"@noble/hashes": "^2.0.1",
|
|
46
47
|
"@types/node": "^25.3.0",
|
|
47
48
|
"tsup": "^8.0.0",
|
package/scripts/postinstall.js
CHANGED
|
@@ -1,8 +1,15 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
console.log(`
|
|
3
|
+
_ _ _____
|
|
4
|
+
| \\ |"| ___ |_ " _|
|
|
5
|
+
<| \\| |> |_"_| | |
|
|
6
|
+
U| |\\ |u | | /| |\\
|
|
7
|
+
|_| \\_| U/| |\\u u |_|U
|
|
8
|
+
|| \\\\,-.-,_|___|_,-._// \\\\_
|
|
9
|
+
(_") (_/ \\_)-' '-(_/(__) (__)
|
|
10
|
+
|
|
3
11
|
nit — version control for agent cards
|
|
4
12
|
|
|
5
13
|
Get started: nit init
|
|
6
14
|
Commands: nit --help
|
|
7
|
-
Full playbook: https://github.com/newtype-ai/nit/blob/main/SKILL.md
|
|
8
15
|
`);
|