@pinta-ai/pinta-gemini 0.1.0
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 +136 -0
- package/README.md +68 -0
- package/dist/index.js +700 -0
- package/docs/BACKGROUND_RESEARCH.md +328 -0
- package/docs/SPEC.md +264 -0
- package/package.json +36 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
# PolyForm Noncommercial License 1.0.0
|
|
2
|
+
|
|
3
|
+
<https://polyformproject.org/licenses/noncommercial/1.0.0>
|
|
4
|
+
|
|
5
|
+
## Acceptance
|
|
6
|
+
|
|
7
|
+
In order to get any license under these terms, you must agree
|
|
8
|
+
to them as both strict obligations and conditions to all
|
|
9
|
+
your licenses.
|
|
10
|
+
|
|
11
|
+
## Copyright License
|
|
12
|
+
|
|
13
|
+
The licensor grants you a copyright license for the
|
|
14
|
+
software to do everything you might do with the software
|
|
15
|
+
that would otherwise infringe the licensor's copyright
|
|
16
|
+
in it for any permitted purpose. However, you may
|
|
17
|
+
only distribute the software according to [Distribution
|
|
18
|
+
License](#distribution-license) and make changes or new works
|
|
19
|
+
based on the software according to [Changes and New Works
|
|
20
|
+
License](#changes-and-new-works-license).
|
|
21
|
+
|
|
22
|
+
## Distribution License
|
|
23
|
+
|
|
24
|
+
The licensor grants you an additional copyright license to
|
|
25
|
+
distribute copies of the software. Your license to distribute
|
|
26
|
+
covers distributing the software with changes and new works
|
|
27
|
+
permitted by [Changes and New Works
|
|
28
|
+
License](#changes-and-new-works-license).
|
|
29
|
+
|
|
30
|
+
## Notices
|
|
31
|
+
|
|
32
|
+
You must ensure that anyone who gets a copy of any part of
|
|
33
|
+
the software from you also gets a copy of these terms or the
|
|
34
|
+
URL for them above, as well as copies of any plain-text lines
|
|
35
|
+
beginning with `Required Notice:` that the licensor provided
|
|
36
|
+
with the software. For example:
|
|
37
|
+
|
|
38
|
+
> Required Notice: Copyright Pinta AI (https://pinta.sh)
|
|
39
|
+
|
|
40
|
+
## Changes and New Works License
|
|
41
|
+
|
|
42
|
+
The licensor grants you an additional copyright license to make
|
|
43
|
+
changes and new works based on the software for any permitted
|
|
44
|
+
purpose.
|
|
45
|
+
|
|
46
|
+
## Patent License
|
|
47
|
+
|
|
48
|
+
The licensor grants you a patent license for the software that
|
|
49
|
+
covers patent claims the licensor can license, or becomes able
|
|
50
|
+
to license, that you would infringe by using the software.
|
|
51
|
+
|
|
52
|
+
## Noncommercial Purposes
|
|
53
|
+
|
|
54
|
+
Any noncommercial purpose is a permitted purpose.
|
|
55
|
+
|
|
56
|
+
## Personal Uses
|
|
57
|
+
|
|
58
|
+
Personal use for research, experiment, and testing for
|
|
59
|
+
the benefit of public knowledge, personal study, private
|
|
60
|
+
entertainment, hobby projects, amateur pursuits, or religious
|
|
61
|
+
observance, without any anticipated commercial application,
|
|
62
|
+
is use for a permitted purpose.
|
|
63
|
+
|
|
64
|
+
## Noncommercial Organizations
|
|
65
|
+
|
|
66
|
+
Use by any charitable organization, educational institution,
|
|
67
|
+
public research organization, public safety or health
|
|
68
|
+
organization, environmental protection organization, or
|
|
69
|
+
government institution is use for a permitted purpose
|
|
70
|
+
regardless of the source of funding or obligations resulting
|
|
71
|
+
from the funding.
|
|
72
|
+
|
|
73
|
+
## Fair Use
|
|
74
|
+
|
|
75
|
+
You may have "fair use" rights for the software under the
|
|
76
|
+
law. These terms do not limit them.
|
|
77
|
+
|
|
78
|
+
## No Other Rights
|
|
79
|
+
|
|
80
|
+
These terms do not allow you to sublicense or transfer any of
|
|
81
|
+
your licenses to anyone else, or prevent the licensor from
|
|
82
|
+
granting licenses to anyone else. These terms do not imply
|
|
83
|
+
any other licenses.
|
|
84
|
+
|
|
85
|
+
## Patent Defense
|
|
86
|
+
|
|
87
|
+
If you make any written claim that the software infringes or
|
|
88
|
+
contributes to infringement of any patent, your patent license
|
|
89
|
+
for the software granted under these terms ends immediately. If
|
|
90
|
+
your company makes such a claim, your patent license ends
|
|
91
|
+
immediately for work on behalf of your company.
|
|
92
|
+
|
|
93
|
+
## Violations
|
|
94
|
+
|
|
95
|
+
The first time you are notified in writing that you have
|
|
96
|
+
violated any of these terms, or done anything with the software
|
|
97
|
+
not covered by your licenses, your licenses can nonetheless
|
|
98
|
+
continue if you come into full compliance with these terms,
|
|
99
|
+
and take practical steps to correct past violations, within
|
|
100
|
+
32 days of receiving notice. Otherwise, all your licenses
|
|
101
|
+
end immediately.
|
|
102
|
+
|
|
103
|
+
## No Liability
|
|
104
|
+
|
|
105
|
+
***As far as the law allows, the software comes as is, without
|
|
106
|
+
any warranty or condition, and the licensor will not be liable
|
|
107
|
+
to you for any damages arising out of these terms or the use
|
|
108
|
+
or nature of the software, under any kind of legal claim.***
|
|
109
|
+
|
|
110
|
+
## Definitions
|
|
111
|
+
|
|
112
|
+
The **licensor** is the individual or entity offering these
|
|
113
|
+
terms, and the **software** is the software the licensor makes
|
|
114
|
+
available under these terms.
|
|
115
|
+
|
|
116
|
+
**You** refers to the individual or entity agreeing to these
|
|
117
|
+
terms.
|
|
118
|
+
|
|
119
|
+
**Your company** is any legal entity, sole proprietorship,
|
|
120
|
+
or other kind of organization that you work for, plus all
|
|
121
|
+
organizations that have control over, are under the control
|
|
122
|
+
of, or are under common control with that organization.
|
|
123
|
+
**Control** means ownership of substantially all the assets of
|
|
124
|
+
an entity, or the power to direct its management and policies
|
|
125
|
+
by vote, contract, or otherwise. Control can be direct or
|
|
126
|
+
indirect.
|
|
127
|
+
|
|
128
|
+
**Your licenses** are all the licenses granted to you for the
|
|
129
|
+
software under these terms.
|
|
130
|
+
|
|
131
|
+
**Use** means anything you do with the software requiring one
|
|
132
|
+
of your licenses.
|
|
133
|
+
|
|
134
|
+
---
|
|
135
|
+
|
|
136
|
+
Required Notice: Copyright (c) 2026 Pinta AI
|
package/README.md
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
# pinta-gemini
|
|
2
|
+
|
|
3
|
+
단일 어댑터로 **세 호스트**의 hook 이벤트를 받아 (1) OTLP/HTTP span 으로 forward(관측),
|
|
4
|
+
(2) tool 호출을 원격 guard 로 allow/deny(집행)한다. `pinta-cc`/`pinta-codex`/`pinta-copilot` 의 자매 어댑터로,
|
|
5
|
+
core(otlp/transport/retry-queue/redact/guard/trace)를 공유 패턴으로 재사용한다.
|
|
6
|
+
|
|
7
|
+
| 호스트 | `--agent` | hook 메커니즘 (실측 검증) |
|
|
8
|
+
|---|---|---|
|
|
9
|
+
| Google Gemini CLI | `gemini` | **extension** `~/.gemini/extensions/pinta-gemini/` (folder-trust 우회) |
|
|
10
|
+
| Antigravity CLI (agy v1.0.x) | `antigravity` | 전역 `~/.gemini/config/hooks.json` |
|
|
11
|
+
| Antigravity 2.0 | `antigravity` | 전역 `~/.gemini/config/hooks.json` (동일) 또는 workspace `.agents/hooks.json` |
|
|
12
|
+
|
|
13
|
+
> 상태: **v0.1 (검증 완료)**. 2026-06-15 실측에서 gemini 8/8, antigravity 5/5 이벤트 커버리지 +
|
|
14
|
+
> payload 형상·deny/allow·인자보존 확인. 자세한 건 [`docs/SPEC.md`](./docs/SPEC.md), [`docs/BACKGROUND_RESEARCH.md`](./docs/BACKGROUND_RESEARCH.md) PART F 참조.
|
|
15
|
+
|
|
16
|
+
## 저장소 구조
|
|
17
|
+
```
|
|
18
|
+
src/
|
|
19
|
+
index.ts 진입점 (loadEnv → parse argv → normalize → guard → forward → decision → exit 0)
|
|
20
|
+
env-file.ts ~/.gemini/pinta-gemini.env 로더 (호스트가 env 안 주므로 주입 벡터)
|
|
21
|
+
core/
|
|
22
|
+
types.ts Agent/Canonical 타입 + 호스트 family helper(gate/identity)
|
|
23
|
+
agent.ts --agent/--event 파싱 + antigravity 제품 서브라벨(transcriptPath)
|
|
24
|
+
normalize.ts 호스트 payload → canonical (snake/camel 흡수)
|
|
25
|
+
config.ts endpoint/headers/guard/data-dir 해석
|
|
26
|
+
guard.ts 원격 guard 평가 (50ms, fail-open) ← pinta-cc 재사용
|
|
27
|
+
decision.ts 호스트별 allow/deny 출력
|
|
28
|
+
otlp.ts 멀티호스트 Bronze flatten + ingest.type/prefix/service.name
|
|
29
|
+
transport.ts OTLP/HTTP POST (5s) + 실패 시 retry-queue
|
|
30
|
+
retry-queue.ts 파일 JSONL 큐 (cap 1000, 파일락) ← pinta-cc 재사용
|
|
31
|
+
redact.ts 시크릿 마스킹 + truncation ← pinta-cc 재사용
|
|
32
|
+
trace.ts session 키 ULID trace map
|
|
33
|
+
invocation-log.ts DEBUG 감사 로그 (invocations.jsonl)
|
|
34
|
+
tools/
|
|
35
|
+
install-hooks.ts 호스트별 설치 (gemini=extension / antigravity=전역 config; lifecycle=flat 구조)
|
|
36
|
+
doctor.ts 설치/엔드포인트 헬스체크
|
|
37
|
+
hook-verify.ts 실측 검증 watcher (watch/report/teardown/selftest)
|
|
38
|
+
e2e-hooks.ts 오프라인 계약 테스트 (mock guard+collector + reference stub)
|
|
39
|
+
e2e-from-config.ts 오프라인 install→read→fire 테스트 (sandbox)
|
|
40
|
+
demo-trace.ts 모든 이벤트 발사 + payload 관측 데모
|
|
41
|
+
tests/core.test.ts 단위 테스트 (normalize/decision/agent/otlp)
|
|
42
|
+
docs/ SPEC + 배경연구
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## 빠른 시작
|
|
46
|
+
```bash
|
|
47
|
+
npm install # devDeps (esbuild/tsx/vitest)
|
|
48
|
+
npm run build # → dist/index.js (install 전 필수)
|
|
49
|
+
npm test # vitest 단위 테스트
|
|
50
|
+
npm run e2e # 오프라인 계약 테스트 (3 호스트 형상)
|
|
51
|
+
|
|
52
|
+
# 실제 호스트 검증 (CLI 는 직접 실행)
|
|
53
|
+
npm run verify # ~/.gemini 에 설치 + watcher; 다른 터미널서 gemini/agy 실행
|
|
54
|
+
# antigravity2 workspace: npm run verify -- --workspace /path/to/project
|
|
55
|
+
npx tsx tools/hook-verify.ts report # 누적 invocations.jsonl 채점
|
|
56
|
+
npm run doctor # 설치/엔드포인트 상태
|
|
57
|
+
npx tsx tools/hook-verify.ts teardown # 원복 (hook 제거, jsonl 보존)
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## 동작 계약 (요약 — 상세 [SPEC §7](./docs/SPEC.md))
|
|
61
|
+
- 이벤트/agent 식별: install 시 command 에 박는 `--agent`/`--event` 인자가 유일 수단(인자보존 실측 확정).
|
|
62
|
+
- 출력: stdout 에 **항상 단일 JSON**, **항상 exit 0**(fail-open).
|
|
63
|
+
- deny: gemini `{decision,reason,systemMessage}` / antigravity `{decision,reason}`. allow: gemini `{}` / antigravity PreToolUse `{decision:"allow"}`.
|
|
64
|
+
- guard: `PINTA_GUARD_ENDPOINT` POST, 50ms, fail-open. 텔레메트리: `GEMINI_PLUGIN_OPTION_*` > `OTEL_EXPORTER_OTLP_*`.
|
|
65
|
+
- 설정 주입: 호스트가 hook 에 env 를 안 주므로 `~/.gemini/pinta-gemini.env`(어댑터가 읽음)로 주입.
|
|
66
|
+
|
|
67
|
+
## 라이선스
|
|
68
|
+
PolyForm Noncommercial 1.0.0
|