Manifest drives installation metadata
The Core resolves the module, reads manifest, normalizes it, freezes it, creates the package bridge, and then calls install(bridge). The normalized manifest is passed back through api.manifest.
A runtime-grounded reference for package authors. This page separates declared manifest data from actual runtime capabilities, documents the complete package bridge, explains command registration without source duplication, and exposes the current command registry.
Define command metadata once, derive manifest.commands from that definition, and let install() consume the same object. This avoids declaring the same command names twice.
registerCommand(name, meta, {{ source: 'package', packageKey }}) internally. Package authors call only api.registerCommand(name, meta); do not pass a third source/package options object.
(() => {
'use strict';
const COMMANDS = Object.freeze({
test: {
description: 'Run a package self-test.',
usage: 'test [TEXT...]',
aliases: [],
kind: 'plain',
run: ({ args = [], api } = {}) => {
const text = args.length ? args.join(' ') : 'test: ok';
return [api.line(text, 'success')];
}
}
});
const manifest = Object.freeze({
name: 'test',
version: '1.0.0',
description: 'Minimal Light Kali test package.',
author: 'Your Name',
help: 'test help',
official: false,
default: false,
securityLevel: 'low',
permissions: Object.freeze({
storage: 'none',
cookies: 'none',
network: 'none',
filesystem: 'none'
}),
commands: Object.freeze(Object.keys(COMMANDS)),
dependencies: Object.freeze([]),
entry: 'install'
});
const install = async api => {
for (const [name, definition] of Object.entries(COMMANDS)) {
if (!manifest.commands.includes(name)) {
throw new Error(`COMMAND_NOT_DECLARED:${name}`);
}
const registered = api.registerCommand(name, definition);
if (registered === false) {
throw new Error(`PACKAGE_COMMAND_REGISTRATION_FAILED:${name}`);
}
}
return [];
};
const uninstall = async api => {
for (const name of manifest.commands) {
api.unregisterCommand(name);
}
return [];
};
window.__kali_pkg_test = Object.freeze({
manifest,
install,
uninstall
});
})();
The Core resolves the module, reads manifest, normalizes it, freezes it, creates the package bridge, and then calls install(bridge). The normalized manifest is passed back through api.manifest.
Use manifest.commands as the package command inventory. Keep command behavior in one COMMANDS map and register from it instead of repeating command names, aliases, usage strings, and descriptions throughout the lifecycle code.
The bridge is the supported package surface. Internal Core objects are larger and should not be treated as package APIs.
Canonical package key used by the Core for the installed package.
const key = api.packageKey;Normalized, deeply frozen package manifest supplied by the Core.
const version = api.manifest.version;
const commands = api.manifest.commands;Current package registry record. Optional properties should be read defensively.
const status = api.record?.status ?? 'unknown';Append terminal entry objects after lifecycle output blocking is no longer active.
api.append([api.line('Runtime event.', 'output')]);install and uninstall, package transcript output is blocked by the Core.Create a terminal line entry. Text is escaped before rendering.
return [api.line('Ready.', 'success')];Create a blank terminal spacer entry.
return [api.spacer(), api.line('Next section', 'accent')];Return the current runtime snapshot exposed by the package bridge.
const s = api.snapshot();
const mode = s.mode;
const cwd = s.cwd;
const commands = s.commands;
const installed = s.installed;Read the active virtual mode. Current modes are user, root, and ghost.
const mode = api.getMode();Register a package-owned command. The bridge supplies the package source and package identity automatically.
api.registerCommand('test', {
description: 'Run the test command.',
usage: 'test [TEXT...]',
aliases: [],
kind: 'plain',
run: ({ args = [], api } = {}) => [
api.line(args.join(' ') || 'test: ok', 'success')
]
});Remove a command during cleanup.
api.unregisterCommand('test');Security-guard registration is restricted to the official kalisecurity package.
api.registerPackageGuard('example', guard);Security-guard removal is restricted to the official kalisecurity package.
api.unregisterPackageGuard('example');Open the terminal Y/N confirmation flow and resolve to a boolean.
const approved = await api.confirm(
'Allow operation?',
'The user must answer Y or N.'
);Read the bridge capability declaration. The current bridge is always none for all four categories.
console.log(api.permissions);
// { storage: 'none', cookies: 'none',
// network: 'none', filesystem: 'none' }Namespace shape: get, set, remove, keys. Every operation currently denies access.
await api.storage.get('key'); // throwsNamespace shape: get, set, remove. Every operation currently denies access.
await api.cookies.get('session'); // throwsNamespace shape: fetch, request. Every operation currently denies access.
await api.network.fetch('https://example.com'); // throwsNamespace shape: read, write, remove, list. Every operation currently denies access.
await api.filesystem.read('/home/kali/file.txt'); // throwsLow-level flow surface with stub/passthrough behavior. Use confirm() for the supported Y/N flow.
api.flow.begin(value); // returns value
api.flow.next(value); // returns value
api.flow.cancel(); // null
api.flow.resume(); // nullThese are the fields the Core currently normalizes and exposes through api.manifest. Unknown fields are not part of the documented normalized contract.
const manifest = Object.freeze({
name: 'example',
version: '1.0.0',
description: 'Example Light Kali package.',
author: 'Your Name',
help: 'example help',
permissions: Object.freeze({
storage: 'none',
cookies: 'none',
network: 'none',
filesystem: 'none'
}),
commands: Object.freeze(['example']),
dependencies: Object.freeze([]),
entry: 'install',
default: false,
official: false,
securityLevel: 'medium'
});
| Field | Type | Normalization / default | Meaning |
|---|---|---|---|
name | string | pkgKey fallback | Canonical package identity. A non-empty manifest name can migrate the package to that canonical key. |
version | string | unknown | Package version stored in the normalized manifest. |
description | string | empty string | Human-readable package description. |
author | string | unknown | Author or project attribution. |
help | string | <name> help | Main package help reference. |
permissions | object | all categories become none when omitted | Declaration stored in the manifest. It is not a runtime capability grant today. |
commands | array | [] | Declared package command names. Best generated from one command-definition source. |
dependencies | array | [] | Declared package dependency names. |
entry | string | install | Declared package initialization entry name. |
default | boolean | false | Explicit default-package marker. |
official | boolean | false | Explicit official-package marker. |
securityLevel | string | medium | Security-level label. The current Core stores it as text; there is no closed enum validator in the normalizer. |
mod.manifest when it is an object and falls back to loader data otherwise, then creates a deep-frozen normalized object containing exactly the fields documented above.
The implementation currently accepts text for each permission field and lowercases it. Because there is no allow-list, there is no finite set of “all accepted values”; any string can survive normalization. Separately, the package bridge currently grants none of these capabilities.
| Manifest key | Shape | Normalization | Bridge namespace | Current implementation | Documented examples |
|---|---|---|---|---|---|
storage | string | String(value ?? 'none').toLowerCase() | api.storage | DENIED | none, read, write, readwrite, full are merely possible strings; only none is currently granted, and in practice the bridge operation still denies access. |
cookies | string | Lowercase string | api.cookies | DENIED | Any string can normalize; no runtime grant enum exists today. |
network | string | Lowercase string | api.network | DENIED | Any string can normalize; values such as read, request, full are not runtime grants. |
filesystem | string | Lowercase string | api.filesystem | DENIED | Any string can normalize; values such as read, write, full are not runtime grants. |
The current normalizer treats securityLevel as plain text and defaults it to medium. The loader uses a stronger default for built-in protected packages, but no finite public enum is enforced by the normalizer.
securityLevel: 'low'For package interoperability, use a small controlled vocabulary in your own package metadata, but do not claim that the Core currently enforces that vocabulary. Treat security policy as runtime-owned.
'low'
'medium'
'high'
'system'api.permissions is hard-coded to none for storage, cookies, network, and filesystem; the exposed methods are denied functions. Requesting read, write, full, or another string in the manifest does not unlock the operation.
The package-facing signature is intentionally small: api.registerCommand(name, meta). Internally, the bridge marks the command as package-owned and attaches the package key automatically.
| Command metadata | Type | Optional? | Runtime behavior |
|---|---|---|---|
description | string | yes | Human-readable description stored with the command. |
usage | string | yes | Usage line shown by help output. |
aliases | array | yes | Each alias is lowercased. Package aliases are registered into the alias map. |
kind | plain | flow | yes | Any value other than the exact flow string becomes plain. |
run | function | yes | Used for plain commands. If absent, the stored fallback is an empty function. |
begin | function | yes | Used for flow commands when execution starts. |
next | function | yes | Flow callback for the next user input. |
cancel | function | yes | Flow cancellation callback. |
resume | function | yes | Flow resume callback. |
api.registerCommand('test', {
description: 'Run the test command.',
usage: 'test [TEXT...]',
aliases: ['t'],
kind: 'plain',
run: ({ raw, tokens, args, api, ctx } = {}) => [
api.line(`raw: ${raw}`, 'muted'),
api.line(`tokens: ${tokens.join(', ')}`, 'dim'),
api.line(args.length ? args.join(' ') : 'test: ok', 'success')
]
});api.registerCommand('login-demo', {
description: 'Run a package-managed flow example.',
usage: 'login-demo',
aliases: [],
kind: 'flow',
begin: async ({ raw, tokens, args, api, ctx } = {}) => {
return api.confirm(
'Continue?',
'Answer Y or N to continue.'
);
},
next: async ({ input, api } = {}) => [
api.line(`Input: ${String(input ?? '')}`, 'muted')
],
cancel: () => [
api.line('Cancelled.', 'muted')
],
resume: () => [
api.line('Flow is waiting for input.', 'muted')
]
});raw, tokens, args, a scoped api, and ctx. Flow commands receive the same input context in begin(); subsequent flow callbacks receive their flow-specific payloads.
| Input | Example | Purpose |
|---|---|---|
raw | test "hello world" | Original command text after outer trimming. |
tokens | ['test','hello world'] | Tokenized command input. |
args | ['hello world'] | All tokens after the command name. |
api | api.line(...) | Scoped command API. |
ctx | ctx.operation | Current execution context for operations and output handling. |
false when the name already belongs to the Core. Use a unique command name and handle a failed registration explicitly.
Developers publish the package module. The Core resolves the source, verifies the module shape, normalizes its manifest, builds the package bridge, and calls install(bridge).
apt install https://example.com/path/to/test.js| Install mode | Input | Transport | Core behavior |
|---|---|---|---|
internal | Internal package name/path | script | Loads a local package script, resolves the exported module, normalizes manifest, then installs it. |
external-https | HTTPS URL or www. input normalized to HTTPS | fetch | Fetches JavaScript source, rejects empty/HTML responses, evaluates the module, then installs it. |
Manifest, command definitions, package state, install/uninstall cleanup, and package-local behavior.
Source resolution, manifest normalization, package identity migration, security checks, registry persistence, lifecycle status, and external-source confirmation.
A manifest permission string creates browser, cookie, network, or filesystem access. The current bridge does not grant those operations.
Lifecycle hooks are for package setup and teardown. The Core owns lifecycle reporting and suppresses package transcript output while lifecycle hooks are running.
install(api)Register commands, initialize package-local state, validate your own invariants, and return [] on success.
uninstall(api)Unregister package-owned commands, clear package-local state, and return []. The Core cleans package records and modules.
The package source is normalized into an internal or external-HTTPS installation mode.
The Core loads the module and requires a callable install function.
The manifest is normalized and deep-frozen before the package bridge is constructed.
install(bridge) runs while lifecycle output is blocked.
The package is recorded as enabled and its package commands become available.
uninstall(bridge) runs first; the Core then removes package commands and package state.
Use api.line() and api.spacer() for ordinary package output. The renderer also understands structured entry types internally, but package authors should stay on the documented bridge helpers.
return [
api.line('Ready.', 'success'),
api.line('Warning: example warning.', 'danger'),
api.line('Current path: /home/kali', 'dim'),
api.spacer(),
api.line('More information', 'accent')
];| Class | Use in current runtime | Typical package meaning |
|---|---|---|
output | Yes | Default terminal output. |
muted | Yes | Secondary or explanatory text. |
accent | Yes | Highlighted status or heading. |
danger | Yes | Error, blocked action, or attention state. |
success | Yes | Successful result. |
dim | Yes | Low-emphasis metadata. |
purple | Used by current runtime output | Project/information highlight. |
cyan-light | Used by current runtime output | Informational highlight. |
pink | Used by current runtime output | Boot/runtime highlight. |
The current command source registers 166 named command entries. The table below is generated from the current command-source inventory so the documentation has a concrete registry instead of a partial hand-written list.
| # | Command | Source guidance |
|---|
help [command] path resolves a command and can expose its name, usage, description, capability, aliases, and examples where the command definition supplies them. Use that output when debugging the live system.
help
help <command>The package manager classifies common failures so developers can diagnose the stage instead of guessing.
PACKAGE_ENTRY_INVALIDinstall function.PACKAGE_SYNTAX_ERRORPACKAGE_SOURCE_HTMLPACKAGE_SOURCE_UNAVAILABLEPACKAGE_SECURITY_BLOCKEDPACKAGE_COMMAND_REGISTRATION_FAILEDPACKAGE_MANIFEST_INVALIDPACKAGE_HTTPS_LOAD_FAILEDPACKAGE_INSTALL_FAILEDDEFAULT_SOURCE_REJECTEDDEFAULT_PACKAGE_REMOTE_REJECTEDSECURITY_GUARD_UNAVAILABLEUSER_DECLINED_SECURITY_WARNING| Registry state | Meaning |
|---|---|
enabled | Package is recorded as installed and enabled. |
trusted-local | Internal package source has been marked trusted while installation proceeds. |
corrupted | Security processing blocked the package. |
security-declined | User declined a security warning/confirmation. |
securityLevel.
FreeUserProxy is a special browser-side integration exposed outside the normal package bridge. Keep this integration optional and fail cleanly when it is unavailable.
Resolve the exported plugin object defensively rather than assuming the plugin is always loaded.
Prefer infrastructure you control. Never route passwords, cookies, session tokens, API keys, or other secrets through public proxies you do not control.
function getFreeUserProxy() {
return window.__FreeUserProxy
?? globalThis.__FreeUserProxy
?? null;
}
function isFreeUserProxyAvailable() {
const fup = getFreeUserProxy();
return Boolean(
fup &&
typeof fup.getWorkingProxies === 'function'
);
}| Method | Return | Purpose |
|---|---|---|
getRandomUserAgent() | string | Select a User-Agent value from the plugin list. |
getAllProxies() | array | Read configured proxy templates. |
getWorkingProxies() | array | Read proxies that passed the current scan. |
getRandomWorkingProxy() | object | null | Pick a working proxy conveniently. |
isAvailable() | boolean | Check plugin initialization/availability. |
Keep one command definition source, derive the manifest inventory from it, use the documented bridge, and never confuse manifest declarations with runtime capability grants.