feat(ai-profiles): add plugin profile SDK and Cline demo (#342)
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
89
examples/cline-ai-plugin/README.md
Normal file
89
examples/cline-ai-plugin/README.md
Normal file
@ -0,0 +1,89 @@
|
||||
# Cline AI profile demo
|
||||
|
||||
This is an IdeA plugin package, with an AI adapter and a coding-agent preset.
|
||||
The process uses the public agent-session JSONL v1 protocol and the real
|
||||
`ClineCore` from `@cline/sdk`. There is no Cline-specific host backend.
|
||||
|
||||
## Pinned setup
|
||||
|
||||
The tested runtime is **Node.js 24.15.0**, npm **11.12.1**, and
|
||||
`@cline/sdk` / `@cline/core` **0.2.0**. The lockfile pins transitive dependencies.
|
||||
No Cline CLI or VS Code extension is required. Install that exact Node version
|
||||
on the Linux host and start IdeA with that version first in its trusted PATH.
|
||||
The host resolves the script's `env node` shebang to one
|
||||
canonical interpreter before confinement. The adapter refuses other Node/SDK
|
||||
versions. Dependencies are installed during setup, never by the adapter.
|
||||
|
||||
From this directory:
|
||||
|
||||
```sh
|
||||
npm ci --ignore-scripts --no-audit --no-fund
|
||||
npm run check
|
||||
npm test
|
||||
npm run package
|
||||
```
|
||||
|
||||
Use an explicit npm cache under a writable worktree/managed-temp directory when
|
||||
the host's default cache is read-only. The package command produces
|
||||
`build/cline-ai-plugin-0.1.0.zip` and a symlink-free `build/package` directory.
|
||||
Install that archive or prepared directory through IdeA's plugin installer;
|
||||
do not install the source directory containing npm's `.bin` symlinks.
|
||||
The archive includes runtime dependencies and third-party license files;
|
||||
`node_modules` and build artifacts are not committed.
|
||||
|
||||
## Host policy and configuration
|
||||
|
||||
Linux v1 requires explicit network **Allow**, a filesystem **Deny** fallback and
|
||||
successful strict Landlock ABI v3 enforcement. Configure a host read grant for
|
||||
the installed package and its runtime modules, plus a write grant for the
|
||||
launch directory's `.idea-cline` data directory. The adapter never adds grants.
|
||||
The installed root is `<IdeA app-data>/plugins/installed/idea.cline-demo`.
|
||||
On the tested Linux host, Node also requires an explicit read grant for the
|
||||
canonical `/etc/ssl/openssl.cnf` file before JavaScript starts. If the host's
|
||||
OpenSSL configuration includes other files or provider modules, grant only the
|
||||
specific required files. The demo keeps the host crypto configuration intact;
|
||||
it does not replace `OPENSSL_CONF` or grant the whole `/etc` directory.
|
||||
The host grants EXEC only to the exact adapter, Node interpreter and ELF loader.
|
||||
Unavailable/degraded enforcement refuses launch.
|
||||
|
||||
Enable the plugin for the project, create a profile from `cline-openai`, and
|
||||
set the model and OpenAI-compatible HTTP(S) endpoint. The optional `apiKey`
|
||||
is a host SecretStore value supplied in `open`/`probe` only. Configure a key if
|
||||
the endpoint requires one. No credential belongs in this package, environment,
|
||||
manifest, config defaults, command arguments or setup commands.
|
||||
|
||||
IdeA owns profile assignments and credentials. Cline's private `.idea-cline`
|
||||
directory holds its session history for resume. It does not use `~/.cline`,
|
||||
inherited provider credentials or hub discovery. Keep this directory stable
|
||||
across adapter restarts and within the same project; normal close retains
|
||||
history. Keep this private history directory out of version control.
|
||||
Resume refuses missing history, another project or another model.
|
||||
|
||||
## Lifecycle and tools
|
||||
|
||||
- `initialize` validates protocol/runtime identity.
|
||||
- `probe` validates local runtime/configuration only. It makes no provider call,
|
||||
creates no Cline session and does not prove authentication or connectivity.
|
||||
- `open` starts an interactive ClineCore session without a prompt.
|
||||
- `send` acknowledges before generation, maps SDK streaming events, and emits
|
||||
one final only when the SDK reports completion.
|
||||
- `cancel` uses SDK abort and drains the active turn; `close` awaits stop/dispose.
|
||||
- Native file/shell/web/MCP tools, spawn, teams, checkpoints, automation and
|
||||
config/plugin discovery are disabled. Only the host's supplied tool catalogue
|
||||
becomes SDK tools. Their callbacks invoke `host/tool.call`; host identity,
|
||||
current permissions and deadlines remain authoritative.
|
||||
|
||||
Stdout is JSONL only. Errors are static and credential-free. API keys are supplied
|
||||
only to the SDK's in-memory connection configuration; the adapter never calls
|
||||
Cline settings/auth persistence APIs. Cline intentionally persists conversation
|
||||
history and tool results in its private data directory.
|
||||
One adapter/runtime per process is supported because SDK storage setters are
|
||||
process-global. Environment isolation is restored after cleanup.
|
||||
|
||||
## Deterministic verification
|
||||
|
||||
QA tests import `runAdapter({input, output, fetch, storageRoot})` with Node streams,
|
||||
temporary storage and an injected fake OpenAI-compatible provider. They use the
|
||||
real published ClineCore, not a fake session service. Tests require no real
|
||||
credentials and make no live provider requests. No production fake-provider flag
|
||||
or network-test command is provided. Live provider validation is not part of CI.
|
||||
Reference in New Issue
Block a user