@newtype-ai/nit 0.2.4 → 0.2.6
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 +15 -9
- package/dist/{chunk-U6PEH4IJ.js → chunk-3RRHLPAC.js} +0 -14
- package/dist/cli.js +1 -1
- package/dist/index.d.ts +1 -7
- package/dist/index.js +3 -5
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -57,7 +57,7 @@ nit push --all
|
|
|
57
57
|
| `nit checkout <branch>` | Switch branch (overwrites agent-card.json) |
|
|
58
58
|
| `nit push [--all]` | Push branch(es) to remote |
|
|
59
59
|
| `nit sign "msg"` | Sign a message with your Ed25519 key |
|
|
60
|
-
| `nit sign --login <domain>` |
|
|
60
|
+
| `nit sign --login <domain>` | Auto-switch to domain branch + generate login payload |
|
|
61
61
|
| `nit remote` | Show remote URL and credential status |
|
|
62
62
|
| `nit remote add <name> <url>` | Add a new remote |
|
|
63
63
|
| `nit remote set-url <name> <url>` | Change a remote's URL |
|
|
@@ -84,7 +84,9 @@ Each branch is a different agent card for a different platform. Branch name = ro
|
|
|
84
84
|
|
|
85
85
|
### Skill Resolution
|
|
86
86
|
|
|
87
|
-
|
|
87
|
+
Your card can store skills as **pointers** — just `{ "id": "skill-name" }` — resolved from SKILL.md files at commit time. SKILL.md is the single source of truth when present.
|
|
88
|
+
|
|
89
|
+
nit auto-discovers your skills directory from all major agent frameworks:
|
|
88
90
|
|
|
89
91
|
- `.claude/skills/` — Claude Code
|
|
90
92
|
- `.cursor/skills/` — Cursor
|
|
@@ -92,7 +94,7 @@ At commit time, nit discovers SKILL.md files from all major agent frameworks:
|
|
|
92
94
|
- `.codex/skills/` — OpenAI Codex
|
|
93
95
|
- `.agents/skills/` — Generic
|
|
94
96
|
|
|
95
|
-
|
|
97
|
+
The discovered path is stored in `.nit/config`. When `nit sign --login <domain>` creates a new branch, it auto-creates a SKILL.md template and adds a pointer to the card. The committed card always contains fully resolved, self-contained skill data.
|
|
96
98
|
|
|
97
99
|
### Remote Protocol
|
|
98
100
|
|
|
@@ -116,10 +118,11 @@ nit remote set-url origin https://my-server.com
|
|
|
116
118
|
your-project/
|
|
117
119
|
├── .nit/ # nit repository (gitignored)
|
|
118
120
|
│ ├── HEAD # Current branch ref
|
|
119
|
-
│ ├── config # Remote URL
|
|
121
|
+
│ ├── config # Remote URL, credentials, skills directory
|
|
120
122
|
│ ├── identity/
|
|
121
123
|
│ │ ├── agent.pub # Ed25519 public key
|
|
122
|
-
│ │
|
|
124
|
+
│ │ ├── agent.key # Ed25519 private key (0600)
|
|
125
|
+
│ │ └── agent-id # UUIDv5 derived from public key
|
|
123
126
|
│ ├── objects/ # Content-addressable store
|
|
124
127
|
│ └── refs/heads/ # Branch pointers
|
|
125
128
|
├── agent-card.json # Working copy (changes with checkout)
|
|
@@ -129,12 +132,15 @@ your-project/
|
|
|
129
132
|
## Programmatic API
|
|
130
133
|
|
|
131
134
|
```typescript
|
|
132
|
-
import { init, commit, checkout, branch, push, status } from '@newtype-ai/nit';
|
|
135
|
+
import { init, commit, checkout, branch, push, status, sign, loginPayload } from '@newtype-ai/nit';
|
|
133
136
|
|
|
134
137
|
await init();
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
+
|
|
139
|
+
// Log into an app (auto-creates and switches to domain branch)
|
|
140
|
+
const payload = await loginPayload('faam.io');
|
|
141
|
+
// → { agent_id, domain, timestamp, signature, switchedBranch, createdSkill }
|
|
142
|
+
|
|
143
|
+
// Customize card, then commit & push
|
|
138
144
|
await commit('FAAM config');
|
|
139
145
|
await push({ all: true });
|
|
140
146
|
```
|
|
@@ -249,19 +249,6 @@ async function signChallenge(nitDir, challenge) {
|
|
|
249
249
|
const sig = sign(null, Buffer.from(challenge, "utf-8"), privateKey);
|
|
250
250
|
return sig.toString("base64");
|
|
251
251
|
}
|
|
252
|
-
function verifySignature(pubBase64, challenge, signatureBase64) {
|
|
253
|
-
const xB64url = base64ToBase64url(pubBase64);
|
|
254
|
-
const publicKeyObj = createPublicKey({
|
|
255
|
-
key: { kty: "OKP", crv: "Ed25519", x: xB64url },
|
|
256
|
-
format: "jwk"
|
|
257
|
-
});
|
|
258
|
-
return verify(
|
|
259
|
-
null,
|
|
260
|
-
Buffer.from(challenge, "utf-8"),
|
|
261
|
-
publicKeyObj,
|
|
262
|
-
Buffer.from(signatureBase64, "base64")
|
|
263
|
-
);
|
|
264
|
-
}
|
|
265
252
|
async function signMessage(nitDir, message) {
|
|
266
253
|
const privateKey = await loadPrivateKey(nitDir);
|
|
267
254
|
const sig = sign(null, Buffer.from(message, "utf-8"), privateKey);
|
|
@@ -1153,7 +1140,6 @@ export {
|
|
|
1153
1140
|
formatPublicKeyField,
|
|
1154
1141
|
parsePublicKeyField,
|
|
1155
1142
|
signChallenge,
|
|
1156
|
-
verifySignature,
|
|
1157
1143
|
signMessage,
|
|
1158
1144
|
NIT_NAMESPACE,
|
|
1159
1145
|
deriveAgentId,
|
package/dist/cli.js
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -149,12 +149,6 @@ declare function parsePublicKeyField(field: string): string;
|
|
|
149
149
|
* Returns a standard base64-encoded signature.
|
|
150
150
|
*/
|
|
151
151
|
declare function signChallenge(nitDir: string, challenge: string): Promise<string>;
|
|
152
|
-
/**
|
|
153
|
-
* Verify a signature against a challenge using the raw base64 public key.
|
|
154
|
-
* This is a utility for consumers; nit itself uses it in the remote module
|
|
155
|
-
* for challenge-response flows.
|
|
156
|
-
*/
|
|
157
|
-
declare function verifySignature(pubBase64: string, challenge: string, signatureBase64: string): boolean;
|
|
158
152
|
/**
|
|
159
153
|
* Sign an arbitrary message with the agent's private key.
|
|
160
154
|
* Returns a standard base64-encoded signature.
|
|
@@ -311,4 +305,4 @@ declare function remoteSetUrl(name: string, url: string, options?: {
|
|
|
311
305
|
projectDir?: string;
|
|
312
306
|
}): Promise<void>;
|
|
313
307
|
|
|
314
|
-
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, branch, checkout, commit, deriveAgentId, diff, diffCards, fetchBranchCard, findNitDir, formatDiff, formatPublicKeyField, init, loadAgentId, log, loginPayload, parsePublicKeyField, push, remote, remoteAdd, remoteSetUrl, sign, signChallenge, signMessage, status
|
|
308
|
+
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, branch, checkout, commit, deriveAgentId, diff, diffCards, fetchBranchCard, findNitDir, formatDiff, formatPublicKeyField, init, loadAgentId, log, loginPayload, parsePublicKeyField, push, remote, remoteAdd, remoteSetUrl, sign, signChallenge, signMessage, status };
|
package/dist/index.js
CHANGED
|
@@ -23,9 +23,8 @@ import {
|
|
|
23
23
|
sign,
|
|
24
24
|
signChallenge,
|
|
25
25
|
signMessage,
|
|
26
|
-
status
|
|
27
|
-
|
|
28
|
-
} from "./chunk-U6PEH4IJ.js";
|
|
26
|
+
status
|
|
27
|
+
} from "./chunk-3RRHLPAC.js";
|
|
29
28
|
export {
|
|
30
29
|
NIT_NAMESPACE,
|
|
31
30
|
branch,
|
|
@@ -50,6 +49,5 @@ export {
|
|
|
50
49
|
sign,
|
|
51
50
|
signChallenge,
|
|
52
51
|
signMessage,
|
|
53
|
-
status
|
|
54
|
-
verifySignature
|
|
52
|
+
status
|
|
55
53
|
};
|