@alpacakit/agents-conventions 0.1.0-beta.19
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/LICENSE +21 -0
- package/README.md +12 -0
- package/dist/index.d.ts +29 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +59 -0
- package/package.json +35 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Masahiro Tonomura (codemafia0000)
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# @alpacakit/agents-conventions
|
|
2
|
+
|
|
3
|
+
AlpacaLoop-family conventions for [`@alpacakit/agents`](../agents) machine-local
|
|
4
|
+
config: the `ALPACA_AGENTS_HOME` / `~/.alpaca/agents` config root, the
|
|
5
|
+
`alpacaloop.agents-home` keyring service, and the managed-home layout shared
|
|
6
|
+
by AlpacaLoop-family products (the CLI, promptopt, codehint).
|
|
7
|
+
|
|
8
|
+
This package is **internal and unpublished** (`private: true`). It is a plain
|
|
9
|
+
consumer of the neutral `@alpacakit/agents` public API — the same shape any
|
|
10
|
+
third party would write for their own convention. The general library ships a
|
|
11
|
+
convention-neutral `@alpacakit/agents/config/xdg` preset; this is the
|
|
12
|
+
AlpacaLoop-specific instance, kept out of the published OSS surface.
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AlpacaLoop-family conventions for `@alpacakit/agents` machine-local
|
|
3
|
+
* config. This lives OUTSIDE the neutral `@alpacakit/agents` package on
|
|
4
|
+
* purpose: it encodes AlpacaLoop-specific paths, keyring service names, and
|
|
5
|
+
* the managed-home layout that no general OSS consumer needs. It builds on
|
|
6
|
+
* the agents package's PUBLIC API only, so it is a plain consumer — the
|
|
7
|
+
* same shape any third party would write for their own family convention.
|
|
8
|
+
*
|
|
9
|
+
* Not published (`private`): the public source doubles as the worked
|
|
10
|
+
* example, without adding org policy to the npm surface.
|
|
11
|
+
*/
|
|
12
|
+
import type { SecretRef } from "@alpacakit/agents";
|
|
13
|
+
import type { OpenAgentsConfigOptions } from "@alpacakit/agents/config";
|
|
14
|
+
export declare const ALPACA_LOOP_AGENTS_CONFIG_ENV_VAR = "ALPACA_AGENTS_HOME";
|
|
15
|
+
export declare const ALPACA_LOOP_AGENTS_CONFIG_DIRECTORY = ".alpaca/agents";
|
|
16
|
+
export declare const ALPACA_LOOP_AGENTS_CONFIG_KEYRING_SERVICE = "alpacaloop.agents-home";
|
|
17
|
+
export declare const ALPACA_LOOP_AGENTS_CONFIG_KEYRING_RESOLVER = "agents-home-keyring";
|
|
18
|
+
export type AgentsConfigOptionsInput = {
|
|
19
|
+
readonly homeDir: string;
|
|
20
|
+
readonly env: Readonly<Record<string, string | undefined>>;
|
|
21
|
+
};
|
|
22
|
+
export type ManagedHomePathInput = {
|
|
23
|
+
readonly rootDir: string;
|
|
24
|
+
readonly profileId: string;
|
|
25
|
+
};
|
|
26
|
+
export declare function resolveAgentsConfigOptions(input: AgentsConfigOptionsInput): OpenAgentsConfigOptions;
|
|
27
|
+
export declare function createKeyringSecretRef(profileId: string): SecretRef;
|
|
28
|
+
export declare function resolveManagedHomePath(input: ManagedHomePathInput): string;
|
|
29
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,KAAK,EAEV,uBAAuB,EACxB,MAAM,0BAA0B,CAAC;AAGlC,eAAO,MAAM,iCAAiC,uBAAuB,CAAC;AACtE,eAAO,MAAM,mCAAmC,mBAAmB,CAAC;AACpE,eAAO,MAAM,yCAAyC,2BAC5B,CAAC;AAC3B,eAAO,MAAM,0CAA0C,wBAAwB,CAAC;AAQhF,MAAM,MAAM,wBAAwB,GAAG;IACrC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,GAAG,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC,CAAC;CAC5D,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG;IACjC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;CAC5B,CAAC;AAEF,wBAAgB,0BAA0B,CACxC,KAAK,EAAE,wBAAwB,GAC9B,uBAAuB,CAKzB;AAED,wBAAgB,sBAAsB,CAAC,SAAS,EAAE,MAAM,GAAG,SAAS,CASnE;AAED,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,oBAAoB,GAAG,MAAM,CAM1E"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AlpacaLoop-family conventions for `@alpacakit/agents` machine-local
|
|
3
|
+
* config. This lives OUTSIDE the neutral `@alpacakit/agents` package on
|
|
4
|
+
* purpose: it encodes AlpacaLoop-specific paths, keyring service names, and
|
|
5
|
+
* the managed-home layout that no general OSS consumer needs. It builds on
|
|
6
|
+
* the agents package's PUBLIC API only, so it is a plain consumer — the
|
|
7
|
+
* same shape any third party would write for their own family convention.
|
|
8
|
+
*
|
|
9
|
+
* Not published (`private`): the public source doubles as the worked
|
|
10
|
+
* example, without adding org policy to the npm surface.
|
|
11
|
+
*/
|
|
12
|
+
import path from "node:path";
|
|
13
|
+
import { keyringResolver } from "@alpacakit/agents/keyring";
|
|
14
|
+
export const ALPACA_LOOP_AGENTS_CONFIG_ENV_VAR = "ALPACA_AGENTS_HOME";
|
|
15
|
+
export const ALPACA_LOOP_AGENTS_CONFIG_DIRECTORY = ".alpaca/agents";
|
|
16
|
+
export const ALPACA_LOOP_AGENTS_CONFIG_KEYRING_SERVICE = "alpacaloop.agents-home";
|
|
17
|
+
export const ALPACA_LOOP_AGENTS_CONFIG_KEYRING_RESOLVER = "agents-home-keyring";
|
|
18
|
+
const ALPACA_LOOP_AGENTS_CONFIG_MANAGED_HOMES_DIRECTORY = "managed-homes";
|
|
19
|
+
const ALPACA_LOOP_AGENTS_CONFIG_KEYRING_ACCOUNT = {
|
|
20
|
+
prefix: "profile",
|
|
21
|
+
apiKeySuffix: "api-key",
|
|
22
|
+
separator: ":",
|
|
23
|
+
};
|
|
24
|
+
export function resolveAgentsConfigOptions(input) {
|
|
25
|
+
return {
|
|
26
|
+
rootDir: resolveAgentsConfigRootDir(input),
|
|
27
|
+
secretResolvers: [createKeyringResolverEntry()],
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
export function createKeyringSecretRef(profileId) {
|
|
31
|
+
return {
|
|
32
|
+
resolver: ALPACA_LOOP_AGENTS_CONFIG_KEYRING_RESOLVER,
|
|
33
|
+
id: [
|
|
34
|
+
ALPACA_LOOP_AGENTS_CONFIG_KEYRING_ACCOUNT.prefix,
|
|
35
|
+
profileId,
|
|
36
|
+
ALPACA_LOOP_AGENTS_CONFIG_KEYRING_ACCOUNT.apiKeySuffix,
|
|
37
|
+
].join(ALPACA_LOOP_AGENTS_CONFIG_KEYRING_ACCOUNT.separator),
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
export function resolveManagedHomePath(input) {
|
|
41
|
+
return path.join(input.rootDir, ALPACA_LOOP_AGENTS_CONFIG_MANAGED_HOMES_DIRECTORY, input.profileId);
|
|
42
|
+
}
|
|
43
|
+
function resolveAgentsConfigRootDir(input) {
|
|
44
|
+
return (readNonBlankEnvValue(input.env, ALPACA_LOOP_AGENTS_CONFIG_ENV_VAR) ??
|
|
45
|
+
path.join(input.homeDir, ALPACA_LOOP_AGENTS_CONFIG_DIRECTORY));
|
|
46
|
+
}
|
|
47
|
+
function createKeyringResolverEntry() {
|
|
48
|
+
return {
|
|
49
|
+
name: ALPACA_LOOP_AGENTS_CONFIG_KEYRING_RESOLVER,
|
|
50
|
+
resolver: keyringResolver({
|
|
51
|
+
service: ALPACA_LOOP_AGENTS_CONFIG_KEYRING_SERVICE,
|
|
52
|
+
}),
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
/** Inlined from the agents package's internal env helper (not exported). */
|
|
56
|
+
function readNonBlankEnvValue(env, name) {
|
|
57
|
+
const value = env[name];
|
|
58
|
+
return typeof value === "string" && value.trim().length > 0 ? value : null;
|
|
59
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@alpacakit/agents-conventions",
|
|
3
|
+
"version": "0.1.0-beta.19",
|
|
4
|
+
"description": "AlpacaKit-family conventions for @alpacakit/agents machine-local config (paths, keyring, managed homes).",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"publishConfig": {
|
|
8
|
+
"access": "public",
|
|
9
|
+
"registry": "https://registry.npmjs.org/"
|
|
10
|
+
},
|
|
11
|
+
"exports": {
|
|
12
|
+
".": {
|
|
13
|
+
"types": "./dist/index.d.ts",
|
|
14
|
+
"import": "./dist/index.js"
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
"types": "./dist/index.d.ts",
|
|
18
|
+
"files": [
|
|
19
|
+
"dist",
|
|
20
|
+
"README*.md",
|
|
21
|
+
"LICENSE"
|
|
22
|
+
],
|
|
23
|
+
"dependencies": {
|
|
24
|
+
"@alpacakit/agents": "0.1.0-beta.19"
|
|
25
|
+
},
|
|
26
|
+
"devDependencies": {
|
|
27
|
+
"typescript": "^5.9.3",
|
|
28
|
+
"vitest": "^4.0.18"
|
|
29
|
+
},
|
|
30
|
+
"scripts": {
|
|
31
|
+
"build": "tsc -p tsconfig.build.json",
|
|
32
|
+
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
33
|
+
"test": "vitest run"
|
|
34
|
+
}
|
|
35
|
+
}
|